Exemplo n.º 1
0
    def __init__(self, parent, id, log, size = wx.DefaultSize):
        wx.ScrolledWindow.__init__(self, parent, id, (0, 0), size=size, style=wx.SUNKEN_BORDER)

        self.lines = []
        self.maxWidth  = W
        self.maxHeight = H
        self.x = self.y = 0
        self.curLine = []
        self.drawing = False

        self.SetBackgroundColour("WHITE")
        bmp = images.Test2.GetBitmap()
        mask = wx.Mask(bmp, wx.BLUE)
        bmp.SetMask(mask)
        self.bmp = bmp

        self.SetVirtualSize((self.maxWidth, self.maxHeight))
        self.SetScrollRate(20,20)
        
        # create a PseudoDC to record our drawing
        self.pdc = wx.PseudoDC()
        self.pen_cache = {}
        self.brush_cache = {}
        self.DoDrawing(self.pdc)
        log.write('Created PseudoDC draw list with %d operations!'%self.pdc.GetLen())

        self.Bind(wx.EVT_PAINT, self.OnPaint)
        self.Bind(wx.EVT_ERASE_BACKGROUND, lambda x:None)
        self.Bind(wx.EVT_MOUSE_EVENTS, self.OnMouse)
        
        # vars for handling mouse clicks
        self.dragid = -1
        self.lastpos = (0,0)
Exemplo n.º 2
0
 def CreatePseudoDC(self):
     # create a PseudoDC to record our drawing
     if 'phoenix' in wx.PlatformInfo:
         self.pdc = wx.adv.PseudoDC()
     else:
         self.pdc = wx.PseudoDC()
     self.DoDrawing(self.pdc)
Exemplo n.º 3
0
    def __init__(self, parent, id, size=wx.DefaultSize):
        wx.ScrolledWindow.__init__(self,
                                   parent,
                                   id, (0, 0),
                                   size=size,
                                   style=wx.SUNKEN_BORDER)

        self.maxWidth = 2000
        self.maxHeight = 400
        self.x = self.y = 0

        self.SetBackgroundColour("GREY")

        self.SetVirtualSize((self.maxWidth, self.maxHeight))
        self.SetScrollRate(20, 20)

        # create a PseudoDC to record our drawing
        self.pdc = wx.PseudoDC()
        #self.DoDrawing(self.pdc)

        self.Bind(wx.EVT_PAINT, self.OnPaint)
        self.Bind(wx.EVT_ERASE_BACKGROUND, lambda x: None)
        self.Bind(wx.EVT_MOUSE_EVENTS, self.OnMouse)

        # vars for handling mouse clicks
        self.dragid = -1
        self.needChangePosId = -1
        self.lastpos = (0, 0)
        self.direction = None  #draged shape moving direction
        self.dragedshape_initpos = (0, 0)
        self.posoffset = 0
Exemplo n.º 4
0
 def __init__(
     self,
     parent,
     giface,
     Map,
     frame,
     id=wx.ID_ANY,
     tree=None,
     lmgr=None,
     style=wx.NO_FULL_REPAINT_ON_RESIZE,
     **kwargs
 ):
     BufferedWindow.__init__(
         self,
         parent=parent,
         giface=giface,
         id=id,
         Map=Map,
         frame=frame,
         tree=tree,
         style=style,
         **kwargs
     )
     self.lmgr = lmgr
     self.pdcVector = wx.PseudoDC()
     self.toolbar = self.parent.GetToolbar("rdigit")
     self.digit = None  # wxvdigit.IVDigit
     self.existingCoords = list()
     self.polygons = list()
     self.circles = list()
     self.idx = wx.ID_NEW + 1
     self.selectid = None
     self.selectid_circle = None
     self.idxCats = dict()
     self.Bind(wx.EVT_KEY_DOWN, self.OnKeyDown)
Exemplo n.º 5
0
    def StartEditing(self, mapLayer):
        """!Start editing selected raster map layer.

        @param mapLayer MapLayer to be edited
        """
        # deactive layer FIXME
        # self.Map.ChangeLayerActive(mapLayer, False)

        # clean map canvas
        self.MapWindow.EraseMap()

        #        # unset background map if needed
        #        if mapLayer:
        #            if UserSettings.Get(group = 'vdigit', key = 'bgmap',
        #                                subkey = 'value', internal = True) == mapLayer:
        #                UserSettings.Set(group = 'vdigit', key = 'bgmap',
        #                                 subkey = 'value', value = '', internal = True)
        #
        #            self.parent.SetStatusText(_("Please wait, "
        #                                        "opening raster map <%s> for editing...") % mapLayer,
        #                                        0)
        #
        self.MapWindow.pdcVector = wx.PseudoDC()
        self.digit = self.MapWindow.digit = self.digitClass(
            mapwindow=self.MapWindow)

        self.mapLayer = mapLayer

        self.EnableAll()
        self.EnableUndo(False)
        self.EnableRedo(False)

        Debug.msg(4, "RDigitToolbar.StartEditing(): layer=%s" % mapLayer)

        # change cursor
        if self.MapWindow.mouse["use"] == "pointer":
            self.MapWindow.SetCursor(self.parent.cursors["cross"])

        if not self.MapWindow.resize:
            self.MapWindow.UpdateMap(render=True)

        # respect opacity
        opacity = 100  # FIXME mapLayer.GetOpacity(float = True)

        if opacity < 1.0:
            alpha = int(opacity * 255)
            self.digit.GetDisplay().UpdateSettings(alpha=alpha)

        return True
Exemplo n.º 6
0
    def __init__(self,
                 parent,
                 id=wx.ID_ANY,
                 style=wx.NO_FULL_REPAINT_ON_RESIZE,
                 Map=None,
                 **kwargs):

        wx.Window.__init__(self, parent, id=id, style=style, **kwargs)

        self.parent = parent
        self.Map = Map
        self.mapname = self.parent.mapname

        #
        # Flags
        #
        self.render = True  # re-render the map from GRASS or just redraw image
        self.resize = False  # indicates whether or not a resize event has taken place
        self.dragimg = None  # initialize variable for map panning
        self.pen = None  # pen for drawing zoom boxes, etc.
        self._oldfont = self._oldencoding = None

        #
        # Event bindings
        #
        self.Bind(wx.EVT_PAINT, self.OnPaint)
        self.Bind(wx.EVT_SIZE, self.OnSize)
        self.Bind(wx.EVT_IDLE, self.OnIdle)

        #
        # Render output objects
        #
        self.mapfile = None  # image file to be rendered
        self.img = None  # wx.Image object (self.mapfile)

        self.imagedict = {
        }  # images and their PseudoDC ID's for painting and dragging

        self.pdc = wx.PseudoDC()
        # will store an off screen empty bitmap for saving to file
        self._buffer = wx.EmptyBitmap(max(1, self.Map.width),
                                      max(1, self.Map.height))

        # make sure that extents are updated at init
        self.Map.region = self.Map.GetRegion()
        self.Map.SetRegion()

        self.Bind(wx.EVT_ERASE_BACKGROUND, lambda x: None)
Exemplo n.º 7
0
    def __init__(self,
                 parent,
                 id=wx.ID_ANY,
                 Map=None,
                 tree=None,
                 lmgr=None,
                 style=wx.NO_FULL_REPAINT_ON_RESIZE,
                 **kwargs):
        BufferedWindow.__init__(self, parent, id, Map, tree, lmgr, style,
                                **kwargs)

        self.pdcVector = wx.PseudoDC()
        self.toolbar = self.parent.GetToolbar('vdigit')
        self.digit = None  # wxvdigit.IVDigit

        self.Bind(wx.EVT_KEY_DOWN, self.OnKeyDown)
    def __init__(self, parent, id):
        wx.Panel.__init__(self, parent, id)
        self.SetBackgroundColour("white")

        self.rectColor = wx.Colour(51, 51, 51, 0)

        self.rectSize = 100
        self.rectX = 150 / 2 - self.rectSize / 2
        self.rectY = 680 / 2 - self.rectSize / 2

        self.id = wx.NewId()

        self.pdc = wx.PseudoDC()
        self.pen_cache = {}
        self.brush_cache = {}

        self.drawResult()
Exemplo n.º 9
0
    def __init__(self, parent, id=wx.ID_ANY,
                 style=wx.DEFAULT_FRAME_STYLE | wx.FULL_REPAINT_ON_RESIZE |
                 wx.BORDER_RAISED):
        Debug.msg(2, "AnimationWindow.__init__()")

        self.bitmap = wx.EmptyBitmap(1, 1)
        self.parent = parent
        self._pdc = wx.PseudoDC()
        self._overlay = None
        self._tmpMousePos = None
        self.x = self.y = 0
        self.bitmap_overlay = None

        BufferedWindow.__init__(self, parent=parent, id=id, style=style)
        self.SetBackgroundColour(wx.BLACK)
        self.SetBackgroundStyle(wx.BG_STYLE_CUSTOM)
        self.Bind(wx.EVT_SIZE, self.OnSize)
        self.Bind(wx.EVT_MOUSE_EVENTS, self.OnMouseEvents)
Exemplo n.º 10
0
    def __init__(self,
                 parent,
                 giface,
                 Map,
                 properties,
                 tree=None,
                 id=wx.ID_ANY,
                 lmgr=None,
                 style=wx.NO_FULL_REPAINT_ON_RESIZE,
                 **kwargs):
        BufferedMapWindow.__init__(self,
                                   parent=parent,
                                   giface=giface,
                                   Map=Map,
                                   properties=properties,
                                   style=style,
                                   **kwargs)
        self.lmgr = lmgr
        self.tree = tree
        self.pdcVector = wx.PseudoDC()
        self.toolbar = self.parent.GetToolbar('vdigit')
        self.digit = None  # wxvdigit.IVDigit
        self._digitizingInfo = False  # digitizing with info

        # Emitted when info about digitizing updated
        # Parameter text is a string with information
        # currently used only for coordinates of mouse cursor + segmnt and
        # total feature length
        self.digitizingInfo = Signal('VDigitWindow.digitizingInfo')
        # Emitted when some info about digitizing is or will be availbale
        self.digitizingInfoAvailable = Signal('VDigitWindow.digitizingInfo')
        # Emitted when some info about digitizing is or will be availbale
        # digitizingInfo signal is emmited only between digitizingInfoAvailable
        # and digitizingInfoUnavailable signals
        self.digitizingInfoUnavailable = Signal('VDigitWindow.digitizingInfo')

        self.Bind(wx.EVT_KEY_DOWN, self.OnKeyDown)
        self.mouseMoving.connect(self._mouseMovingToDigitizingInfo)
Exemplo n.º 11
0
    def __init__(self, frame, id=-1):
        """A panel that shows how the routines will fit together
        """
        self.frame = frame
        self.app = frame.app
        self.dpi = self.app.dpi
        wx.ScrolledWindow.__init__(self, frame, id, (0, 0),
                                   size=wx.Size(8 * self.dpi, 3 * self.dpi),
                                   style=wx.HSCROLL | wx.VSCROLL)
        self.SetBackgroundColour(canvasColor)
        self.needUpdate = True
        self.maxWidth = 50 * self.dpi
        self.maxHeight = 2 * self.dpi
        self.mousePos = None
        # if we're adding a loop or routine then add spots to timeline
        # self.drawNearestRoutinePoint = True
        # self.drawNearestLoopPoint = False
        # lists the x-vals of points to draw, eg loop locations:
        self.pointsToDraw = []
        # for flowSize, showLoopInfoInFlow:
        self.appData = self.app.prefs.appData

        # self.SetAutoLayout(True)
        self.SetScrollRate(self.dpi / 4, self.dpi / 4)

        # create a PseudoDC to record our drawing
        self.pdc = wx.PseudoDC()
        self.pen_cache = {}
        self.brush_cache = {}
        # vars for handling mouse clicks
        self.hitradius = 5
        self.dragid = -1
        self.entryPointPosList = []
        self.entryPointIDlist = []
        # mode can also be 'loopPoint1','loopPoint2','routinePoint'
        self.mode = 'normal'
        self.insertingRoutine = ""

        # for the context menu use the ID of the drawn icon to retrieve
        # the component (loop or routine)
        self.componentFromID = {}
        self.contextMenuLabels = {
            'remove': _translate('remove'),
            'rename': _translate('rename')}
        self.contextMenuItems = ['remove', 'rename']
        self.contextItemFromID = {}
        self.contextIDFromItem = {}
        for item in self.contextMenuItems:
            id = wx.NewId()
            self.contextItemFromID[id] = item
            self.contextIDFromItem[item] = id

        # self.btnInsertRoutine = wx.Button(self,-1,
        #                                  'Insert Routine', pos=(10,10))
        # self.btnInsertLoop = wx.Button(self,-1,'Insert Loop', pos=(10,30))
        # Localized labels on PlateButton may be corrupted in Ubuntu.
        if sys.platform.startswith('linux'):
            labelRoutine = 'Insert Routine '
            labelLoop = 'Insert Loop     '
        else:
            labelRoutine = _translate('Insert Routine ')
            labelLoop = _translate('Insert Loop     ')
        self.btnInsertRoutine = platebtn.PlateButton(
            self, -1, labelRoutine, pos=(10, 10))
        self.btnInsertLoop = platebtn.PlateButton(
            self, -1, labelLoop, pos=(10, 30))  # spaces give size for CANCEL

        self.labelTextRed = {'normal': wx.Colour(
            250, 10, 10, 250), 'hlight': wx.Colour(250, 10, 10, 250)}
        self.labelTextBlack = {'normal': wx.Colour(
            0, 0, 0, 250), 'hlight': wx.Colour(250, 250, 250, 250)}

        # use self.appData['flowSize'] to index a tuple to get a specific
        # value, eg: (4,6,8)[self.appData['flowSize']]
        self.flowMaxSize = 2  # upper limit on increaseSize

        self.draw()

        # bind events
        self.Bind(wx.EVT_MOUSE_EVENTS, self.OnMouse)
        self.Bind(wx.EVT_BUTTON, self.onInsertRoutine, self.btnInsertRoutine)
        self.Bind(wx.EVT_BUTTON, self.setLoopPoint1, self.btnInsertLoop)
        self.Bind(wx.EVT_PAINT, self.OnPaint)
        self.SetDropTarget(FileDropTarget(builder=self.frame))

        idClear = wx.NewId()
        self.Bind(wx.EVT_MENU, self.clearMode, id=idClear)
        aTable = wx.AcceleratorTable([
            (wx.ACCEL_NORMAL, wx.WXK_ESCAPE, idClear)
        ])
        self.SetAcceleratorTable(aTable)
Exemplo n.º 12
0
 def CreatePseudoDC(self):
     # create a PseudoDC to record our drawing
     self.pdc = wx.PseudoDC()
     self.DoDrawing(self.pdc)
Exemplo n.º 13
0
    def __init__(self,
                 parent,
                 id=wx.ID_ANY,
                 Map=None,
                 tree=None,
                 lmgr=None,
                 style=wx.NO_FULL_REPAINT_ON_RESIZE,
                 **kwargs):
        MapWindow.__init__(self, parent, id, Map, tree, lmgr, **kwargs)
        wx.Window.__init__(self, parent, id, style=style, **kwargs)

        # flags
        self.resize = False  # indicates whether or not a resize event has taken place
        self.dragimg = None  # initialize variable for map panning

        self.tree = tree
        self.Map = Map
        # variables for drawing on DC
        self.pen = None  # pen for drawing zoom boxes, etc.
        self.polypen = None  # pen for drawing polylines (measurements, profiles, etc)
        # List of wx.Point tuples defining a polyline (geographical coordinates)
        self.polycoords = []
        # ID of rubber band line
        self.lineid = None
        # ID of poly line resulting from cumulative rubber band lines (e.g. measurement)
        self.plineid = None

        # event bindings
        self.Bind(wx.EVT_PAINT, self.OnPaint)
        self.Bind(wx.EVT_SIZE, self.OnSize)
        self.Bind(wx.EVT_IDLE, self.OnIdle)
        ### self.Bind(wx.EVT_MOTION,       self.MouseActions)
        self.Bind(wx.EVT_MOUSE_EVENTS, self.MouseActions)

        if grassversion.rfind("6.4") != 0:
            self.Bind(wx.EVT_MOTION, self.OnMotion)
        #else:
        #self.Bind(wx.EVT_MOTION,       self.MapWindow.OnMotion2)

        self.processMouse = True

        # render output objects
        self.mapfile = None  # image file to be rendered
        self.img = None  # wx.Image object (self.mapfile)
        # used in digitization tool (do not redraw vector map)
        self.imgVectorMap = None
        # decoration overlays
        self.overlays = {}
        # images and their PseudoDC ID's for painting and dragging
        self.imagedict = {}
        self.select = {}  # selecting/unselecting decorations for dragging
        self.textdict = {}  # text, font, and color indexed by id
        self.currtxtid = None  # PseudoDC id for currently selected text

        # zoom objects
        self.zoomhistory = []  # list of past zoom extents
        self.currzoom = 0  # current set of extents in zoom history being used
        self.zoomtype = 1  # 1 zoom in, 0 no zoom, -1 zoom out
        self.hitradius = 10  # distance for selecting map decorations
        self.dialogOffset = 5  # offset for dialog (e.g. DisplayAttributesDialog)

        # OnSize called to make sure the buffer is initialized.
        # This might result in OnSize getting called twice on some
        # platforms at initialization, but little harm done.
        ### self.OnSize(None)
        if grassversion.rfind("6.4") != 0:
            self.DefinePseudoDC()
        else:
            self.pdc = wx.PseudoDC()
            # used for digitization tool
            self.pdcVector = None
            # decorations (region box, etc.)
            self.pdcDec = wx.PseudoDC()
            # pseudoDC for temporal objects (select box, measurement tool, etc.)
            self.pdcTmp = wx.PseudoDC()

        # redraw all pdc's, pdcTmp layer is redrawn always (speed issue)
        self.redrawAll = True

        # will store an off screen empty bitmap for saving to file
        self._buffer = ''

        self.Bind(wx.EVT_ERASE_BACKGROUND, lambda x: None)
        #        self.Bind(wx.EVT_KEY_DOWN , Bufferedwindow.OnKeyDown)

        # vars for handling mouse clicks
        self.dragid = -1
        self.lastpos = (0, 0)
Exemplo n.º 14
0
    def __init__(
        self,
        parent,
        id,
    ):
        wx.Panel.__init__(self, parent, id)

        self.SetBackgroundColour('#D18B3D')
        bmp = images.DartImage1.GetBitmap()
        mask = wx.Mask(bmp, '#010000')  #make transparent bg
        bmp.SetMask(mask)
        self.bmp = bmp

        self.boardDartsFlag = "p1"
        self.boardDarts = [None, None, None]

        font = wx.Font(30, wx.SWISS, wx.NORMAL, wx.FONTWEIGHT_BOLD, False,
                       u'Comic Sans MS')

        #score labels
        self.p1 = wx.StaticText(self, -1, str(0), (40, 80))
        self.p2 = wx.StaticText(self, -1, str(0), (790, 80))
        self.p1.SetFont(font)
        self.p1.SetForegroundColour((255, 255, 255))
        self.p1.SetBackgroundColour('#389442')
        self.p2.SetFont(font)
        self.p2.SetForegroundColour((255, 255, 255))
        self.p2.SetBackgroundColour('#389442')

        #score buttons
        self.buttons = []

        bp1ID = wx.NewId()
        bp1 = wx.Button(self, bp1ID, "Previous Dart Set", (30, 140))
        self.Bind(wx.EVT_BUTTON, self.OnClick, bp1)
        self.buttons.append(bp1ID)

        bp2ID = wx.NewId()
        bp2 = wx.Button(self, bp2ID, "Previous Dart Set", (780, 140))
        self.Bind(wx.EVT_BUTTON, self.OnClick, bp2)
        self.buttons.append(bp2ID)

        currID = wx.NewId()
        curr = wx.Button(self, currID, "Current Dart Set", (250, 0))
        self.Bind(wx.EVT_BUTTON, self.OnClick, curr)
        self.buttons.append(currID)

        missID = wx.NewId()
        missbtn = wx.Button(self, missID, "Missed Dart", (250, 25))
        self.Bind(wx.EVT_BUTTON, self.OnClick, missbtn)
        self.buttons.append(missbtn)

        # dart ids
        self.objids = []
        self.objmovable = []

        # create a PseudoDC to record our drawing
        self.pdc = wx.PseudoDC()
        self.DoDrawing(self.pdc)

        self.Bind(wx.EVT_PAINT, self.OnPaint)
        self.Bind(wx.EVT_ERASE_BACKGROUND, lambda x: None)
        self.Bind(wx.EVT_MOUSE_EVENTS, self.OnMouse)

        # vars for handling mouse clicks
        self.dragid = -1
        self.lastpos = (0, 0)
Exemplo n.º 15
0
    def StartEditing(self, mapLayer):
        """Start editing selected vector map layer.

        :param mapLayer: MapLayer to be edited
        """
        # check if topology is available (skip for hidden - temporary
        # maps, see iclass for details)
        if not mapLayer.IsHidden() and grass.vector_info(mapLayer.GetName())['level'] != 2:
            dlg = wx.MessageDialog(parent = self.MapWindow,
                                   message = _("Topology for vector map <%s> is not available. "
                                               "Topology is required by digitizer.\nDo you want to "
                                               "rebuild topology (takes some time) and open the vector map "
                                               "for editing?") % mapLayer.GetName(),
                                   caption=_("Digitizer error"),
                                   style = wx.YES_NO | wx.YES_DEFAULT | wx.ICON_QUESTION | wx.CENTRE)
            if dlg.ShowModal() == wx.ID_YES:
                RunCommand('v.build', map=mapLayer.GetName())
            else:
                return
        
        # deactive layer
        self.Map.ChangeLayerActive(mapLayer, False)
        
        # clean map canvas
        self.MapWindow.EraseMap()
        
        # unset background map if needed
        if mapLayer:
            if UserSettings.Get(group = 'vdigit', key = 'bgmap',
                                subkey = 'value', internal = True) == mapLayer.GetName():
                UserSettings.Set(group = 'vdigit', key = 'bgmap',
                                 subkey = 'value', value = '', internal = True)
            
            self.parent.SetStatusText(_("Please wait, "
                                        "opening vector map <%s> for editing...") % mapLayer.GetName(),
                                        0)
        
        self.MapWindow.pdcVector = wx.PseudoDC()
        self.digit = self.MapWindow.digit = self.digitClass(mapwindow = self.MapWindow)
        
        self.mapLayer = mapLayer
        # open vector map (assume that 'hidden' map layer is temporary vector map)
        if self.digit.OpenMap(mapLayer.GetName(), tmp = mapLayer.IsHidden()) is None:
            self.mapLayer = None
            self.StopEditing()
            return False
        
        # check feature type (only for OGR layers)
        self.fType = self.digit.GetFeatureType()
        self.EnableAll()
        self.EnableUndo(False)
        self.EnableRedo(False)
        
        if self.fType == 'point':
            for tool in (self.addLine, self.addArea, self.moveVertex, self.addVertex,
                         self.removeVertex, self.editLine):
                self.EnableTool(tool, False)
        elif self.fType == 'linestring':
            for tool in (self.addPoint, self.addArea):
                self.EnableTool(tool, False)
        elif self.fType == 'polygon':
            for tool in (self.addPoint, self.addLine):
                self.EnableTool(tool, False)
        elif self.fType:
            GError(parent = self,
                   message = _("Unsupported feature type '%(type)s'. Unable to edit "
                               "OGR layer <%(layer)s>.") % { 'type' : self.fType,
                                                             'layer' : mapLayer.GetName() })
            self.digit.CloseMap()
            self.mapLayer = None
            self.StopEditing()
            return False
        
        # update toolbar
        if self.combo:
            self.combo.SetValue(mapLayer.GetName())
        if 'map' in self.parent.toolbars:
            self.parent.toolbars['map'].combo.SetValue (_('Digitize'))
        
        # here was dead code to enable vdigit button in toolbar
        # with if to ignore iclass
        # some signal (DigitizerStarted) can be emitted here
        
        Debug.msg (4, "VDigitToolbar.StartEditing(): layer=%s" % mapLayer.GetName())
        
        # change cursor
        if self.MapWindow.mouse['use'] == 'pointer':
            self.MapWindow.SetNamedCursor('cross')
        
        if not self.MapWindow.resize:
            self.MapWindow.UpdateMap(render = True)
        
        # respect opacity
        opacity = mapLayer.GetOpacity()
        
        if opacity < 1.0:
            alpha = int(opacity * 255)
            self.digit.GetDisplay().UpdateSettings(alpha = alpha)

        # emit signal
        layerTree = self._giface.GetLayerTree()
        if layerTree:
            item = layerTree.FindItemByData('maplayer', self.mapLayer)
        else:
            item = None
        self.editingStarted.emit(vectMap = mapLayer.GetName(), digit = self.digit, layerItem = item)

        return True
Exemplo n.º 16
0
    def StartEditing(self, mapLayer):
        """!Start editing selected vector map layer.
        
        @param mapLayer MapLayer to be edited
        """
        # deactive layer
        self.mapcontent.ChangeLayerActive(mapLayer, False)

        # clean map canvas
        self.parent.MapWindow.EraseMap()

        # unset background map if needed
        if mapLayer:
            if UserSettings.Get(group='vdigit',
                                key='bgmap',
                                subkey='value',
                                internal=True) == mapLayer.GetName():
                UserSettings.Set(group='vdigit',
                                 key='bgmap',
                                 subkey='value',
                                 value='',
                                 internal=True)

            self.parent.SetStatusText(
                _("Please wait, "
                  "opening vector map <%s> for editing...") %
                mapLayer.GetName(), 0)

        self.parent.MapWindow.pdcVector = wx.PseudoDC()
        self.digit = self.parent.MapWindow.digit = VDigit(
            mapwindow=self.parent.MapWindow)

        self.mapLayer = mapLayer

        # open vector map
        if self.digit.OpenMap(mapLayer.GetName()) is None:
            self.mapLayer = None
            self.StopEditing()
            return False

        # update toolbar
        self.combo.SetValue(mapLayer.GetName())
        self.parent.toolbars['map'].combo.SetValue(_('Digitize'))
        lmgr = self.parent.GetLayerManager()
        if lmgr:
            lmgr.toolbars['tools'].Enable('vdigit', enable=False)

        Debug.msg(
            4, "VDigitToolbar.StartEditing(): layer=%s" % mapLayer.GetName())

        # change cursor
        if self.parent.MapWindow.mouse['use'] == 'pointer':
            self.parent.MapWindow.SetCursor(self.parent.cursors["cross"])

        if not self.parent.MapWindow.resize:
            self.parent.MapWindow.UpdateMap(render=True)

        # respect opacity
        opacity = mapLayer.GetOpacity(float=True)
        if opacity < 1.0:
            alpha = int(opacity * 255)
            self.digit.GetDisplay().UpdateSettings(alpha=alpha)

        return True