[GRASS-SVN] r33589 - in grass/trunk/gui/wxpython: gui_modules vdigit

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Sep 29 05:18:16 EDT 2008


Author: martinl
Date: 2008-09-29 05:18:16 -0400 (Mon, 29 Sep 2008)
New Revision: 33589

Modified:
   grass/trunk/gui/wxpython/gui_modules/dbm.py
   grass/trunk/gui/wxpython/gui_modules/goutput.py
   grass/trunk/gui/wxpython/gui_modules/mapdisp.py
   grass/trunk/gui/wxpython/gui_modules/preferences.py
   grass/trunk/gui/wxpython/gui_modules/render.py
   grass/trunk/gui/wxpython/gui_modules/toolbars.py
   grass/trunk/gui/wxpython/gui_modules/vdigit.py
   grass/trunk/gui/wxpython/gui_modules/wxgui_utils.py
   grass/trunk/gui/wxpython/vdigit/cats.cpp
   grass/trunk/gui/wxpython/vdigit/digit.cpp
   grass/trunk/gui/wxpython/vdigit/digit.h
   grass/trunk/gui/wxpython/vdigit/digit.i
   grass/trunk/gui/wxpython/vdigit/driver.h
   grass/trunk/gui/wxpython/vdigit/driver_draw.cpp
   grass/trunk/gui/wxpython/vdigit/driver_select.cpp
   grass/trunk/gui/wxpython/vdigit/line.cpp
   grass/trunk/gui/wxpython/vdigit/message.cpp
   grass/trunk/gui/wxpython/vdigit/select.cpp
   grass/trunk/gui/wxpython/vdigit/undo.cpp
   grass/trunk/gui/wxpython/vdigit/vertex.cpp
Log:
wxGUI: major vdigit updates
       * vedit component removed
       * various fixes (e.g. move vertex fn)
       * toolbars fixes (avoid multiple selection)
(merge from devbr6, r33588)


Modified: grass/trunk/gui/wxpython/gui_modules/dbm.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/dbm.py	2008-09-29 09:10:48 UTC (rev 33588)
+++ grass/trunk/gui/wxpython/gui_modules/dbm.py	2008-09-29 09:18:16 UTC (rev 33589)
@@ -3011,7 +3011,10 @@
                 idx = 0
                 for layer in data['Layer']:
                     layer = int(layer)
-                    tfid = int(data['Id'][idx])
+                    if data.has_key('Id'):
+                        tfid = int(data['Id'][idx])
+                    else:
+                        tfid = 0 # Area / Volume
                     if not self.cats.has_key(tfid):
                         self.cats[tfid] = {}
                     if not self.cats[tfid].has_key(layer):
@@ -3032,7 +3035,10 @@
         if len(self.cats.keys()) == 1:
             self.fidMulti.Show(False)
             self.fidText.Show(True)
-            self.fidText.SetLabel("%d" % self.fid)
+            if self.fid > 0:
+                self.fidText.SetLabel("%d" % self.fid)
+            else:
+                self.fidText.SetLabel(_("Unknown"))
         else:
             self.fidMulti.Show(True)
             self.fidText.Show(False)

Modified: grass/trunk/gui/wxpython/gui_modules/goutput.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/goutput.py	2008-09-29 09:10:48 UTC (rev 33588)
+++ grass/trunk/gui/wxpython/gui_modules/goutput.py	2008-09-29 09:18:16 UTC (rev 33589)
@@ -198,7 +198,7 @@
         """
         if Debug.get_level() == 0:
             # don't redirect when debugging is enabled
-            sys.stdout = self.cmd_stdout
+            # sys.stdout = self.cmd_stdout
             sys.stderr = self.cmd_stderr
             
             return True

Modified: grass/trunk/gui/wxpython/gui_modules/mapdisp.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/mapdisp.py	2008-09-29 09:10:48 UTC (rev 33588)
+++ grass/trunk/gui/wxpython/gui_modules/mapdisp.py	2008-09-29 09:18:16 UTC (rev 33589)
@@ -1,28 +1,30 @@
 """
-MODULE:    mapdisp.py
+ at package mapdisp.py
 
-CLASSES:
+ at brief GIS map display canvas, with toolbar for various display
+management functions, and second toolbar for vector
+digitizing. 
+
+Can be used either from GIS Manager or as p.mon backend.
+
+Classes:
  - Command
  - MapWindow
  - BufferedWindow
  - MapFrame
  - MapApp
 
-PURPOSE:   GIS map display canvas, with toolbar for various display
-           management functions, and second toolbar for vector
-           digitizing. Can be used either from GIS Manager or as p.mon backend
+Usage:
+ python mapdisp.py monitor-identifier /path/to/command/file
 
-           Usage:
-            python mapdisp.py monitor-identifier /path/to/command/file
+(C) 2006-2008 by the GRASS Development Team
+This program is free software under the GNU General Public
+License (>=v2). Read the file COPYING that comes with GRASS
+for details.
 
-AUTHORS:   Michael Barton
-           Jachym Cepicky
-           Martin Landa <landa.martin gmail.com>
-
-COPYRIGHT: (C) 2006-2008 by the GRASS Development Team
-           This program is free software under the GNU General Public
-           License (>=v2). Read the file COPYING that comes with GRASS
-           for details.
+ at author Michael Barton
+ at author Jachym Cepicky
+ at author Martin Landa <landa.martin gmail.com>
 """
 
 import os
@@ -493,7 +495,7 @@
         if self.redrawAll is None:
             self.redrawAll = True
             switchDraw = True
-
+        
         if self.redrawAll: # redraw pdc and pdcVector
             # draw to the dc using the calculated clipping rect
             self.pdc.DrawToDCClipped(dc, rgn)
@@ -664,7 +666,6 @@
             
         # reset flag for auto-rendering
         self.tree.rerender = False
-            
         if render:
             # update display size
             self.Map.ChangeMapSize(self.GetClientSize())
@@ -677,7 +678,7 @@
                                            windres=windres)
         else:
             self.mapfile = self.Map.Render(force=False, mapWindow=self.parent)
-            
+        
         self.img = self.GetImage() # id=99
             
         #
@@ -1181,22 +1182,24 @@
                     self.polycoords.append(self.Pixel2Cell(event.GetPositionTuple()[:]))
                     self.DrawLines(pdc=self.pdcTmp)
 
-            elif digitToolbar.GetAction() == "editLine" and hasattr(self, "moveIds"):
+            elif digitToolbar.GetAction() == "editLine" and hasattr(self, "vdigitMove"):
                 self.polycoords.append(self.Pixel2Cell(self.mouse['begin']))
-                self.moveIds.append(wx.NewId())
+                self.vdigitMove['id'].append(wx.NewId())
                 self.DrawLines(pdc=self.pdcTmp)
 
             elif digitToolbar.GetAction() == "deleteLine":
                 pass
 
             elif digitToolbar.GetAction() in ["moveLine", "moveVertex", "editLine"] and \
-                    not hasattr(self, "moveBegin"):
-                # incremental value
-                self.moveBegin = [0, 0] 
-                # geographic coordinates of initial position (self.mouse['end'])
-                self.moveCoords = []
+                    not hasattr(self, "vdigitMove"):
+                self.vdigitMove = {}
+                # geographic coordinates of initial position (left-down)
+                self.vdigitMove['begin'] = None
                 # list of ids to modify    
-                self.moveIds   = [] 
+                self.vdigitMove['id'] = []
+                # ids geographic coordinates
+                self.vdigitMove['coord'] = {}
+                
                 if digitToolbar.GetAction() in ["moveVertex", "editLine"]:
                     # set pen
                     pcolor = UserSettings.Get(group='vdigit', key="symbol",
@@ -1402,15 +1405,14 @@
             pos1 = self.Pixel2Cell(self.mouse['begin'])
             pos2 = self.Pixel2Cell(self.mouse['end'])
 
-            if hasattr(self, "moveBegin"):
+            if hasattr(self, "vdigitMove"):
                 if len(digitClass.driver.GetSelected()) == 0:
-                    self.moveCoords = pos1 # left down
-                    self.moveBegin = pos2 # left up
+                    self.vdigitMove['begin'] = pos1 # left down
                 else:
                     dx = pos2[0] - pos1[0] ### ???
                     dy = pos2[1] - pos1[1]
-                    self.moveCoords = (self.moveCoords[0] + dx,
-                                       self.moveCoords[1] + dy)
+                    self.vdigitMove = (self.vdigitMove['begin'][0] + dx,
+                                       self.vdigitMove['begin'][1] + dy)
                 
                 # eliminate initial mouse moving efect
                 self.mouse['begin'] = self.mouse['end'] 
@@ -1437,7 +1439,6 @@
                                 self.polycoords = []
                                 for id in ids:
                                     if id % 2: # register only vertices
-                                        self.moveIds.append(id)
                                         e, n = self.Pixel2Cell(self.pdcVector.GetIdBounds(id)[0:2])
                                         self.polycoords.append((e, n))
                                     # self.pdcVector.RemoveId(id)
@@ -1445,38 +1446,22 @@
                                 
                                 if selVertex < ids[-1] / 2:
                                     # choose first or last node of line
-                                    self.moveIds.reverse()
+                                    self.vdigitMove['id'].reverse()
                                     self.polycoords.reverse()
                             else:
                                 # unselect
                                 digitClass.driver.SetSelected([])
-                                del self.moveBegin
-                                del self.moveCoords
-                                del self.moveIds
-
+                                del self.vdigitMove
+                                
                             self.UpdateMap(render=False)
 
+                        
                 elif digitToolbar.GetAction() in ("copyCats", "copyAttrs"):
                     if not hasattr(self, "copyCatsIds"):
                         # 'from' -> select by point
                         nselected = digitClass.driver.SelectLineByPoint(pos1, digitClass.GetSelectType())
                         if nselected:
-                            if UserSettings.Get(group='advanced', key='digitInterface', subkey='type') == 'vedit':
-                                qdist = 10.0 * ((self.Map.region['e'] - self.Map.region['w']) / \
-                                                    self.Map.width)
-                                vWhat = gcmd.Command(['v.what',
-                                                      '--q',
-                                                      'map=%s' % digitClass.map,
-                                                      'east_north=%f,%f' % \
-                                                          (float(pos1[0]), float(pos1[1])),
-                                                      'distance=%f' % qdist])
-                                
-                                for line in vWhat.ReadStdOutput():
-                                    if "Category:" in line:
-                                        cat = int(line.split(':')[1].strip())
-                                        self.copyCatsList.append(cat)
-                            else:
-                                self.copyCatsList = digitClass.driver.GetSelected()
+                            self.copyCatsList = digitClass.driver.GetSelected()
                     else:
                         # -> 'to' -> select by bbox
                         digitClass.driver.SetSelected([])
@@ -1503,8 +1488,13 @@
                            len(digitClass.driver.GetSelected()) > 0:
                         nselected = 0
                     else:
+                        if digitToolbar.GetAction() == 'moveLine':
+                            drawSeg = True
+                        else:
+                            drawSeg = False
                         nselected = digitClass.driver.SelectLinesByBox(pos1, pos2,
-                                                                       digitClass.GetSelectType())
+                                                                       digitClass.GetSelectType(),
+                                                                       drawSeg)
                         
                         if nselected == 0:
                             if digitClass.driver.SelectLineByPoint(pos1,
@@ -1516,12 +1506,12 @@
                         # get pseudoDC id of objects which should be redrawn
                         if digitToolbar.GetAction() == "moveLine":
                             # -> move line
-                            self.moveIds = digitClass.driver.GetSelected(grassId=False)
-
+                            self.vdigitMove['id'] = digitClass.driver.GetSelected(grassId=False)
+                            self.vdigitMove['coord'] = digitClass.driver.GetSelectedCoord()
                         elif digitToolbar.GetAction() == "moveVertex":
                             # -> move vertex
-                            self.moveIds = digitClass.driver.GetSelectedVertex(pos1)
-                            if len(self.moveIds) == 0: # no vertex found
+                            self.vdigitMove['id'] = digitClass.driver.GetSelectedVertex(pos1)
+                            if len(self.vdigitMove['id']) == 0: # no vertex found
                                 digitClass.driver.SetSelected([])
 
                                    
@@ -1577,7 +1567,8 @@
                             self.UpdateMap(render=False)
                             
             elif digitToolbar.GetAction() == "copyLine":
-                if UserSettings.Get(group='vdigit', key='backgroundMap', subkey='value') == '':
+                if UserSettings.Get(group='vdigit', key='bgmap',
+                                    subkey='value', internal=True) == '':
                     # no background map -> copy from current vector map layer
                     nselected = digitClass.driver.SelectLinesByBox(pos1, pos2,
                                                                    digitClass.GetSelectType())
@@ -1595,21 +1586,24 @@
                                                  subkey=['highlight', 'color'])
                         colorStr = str(color[0]) + ":" + \
                             str(color[1]) + ":" + \
-                            str(color[2]) + ":"
+                            str(color[2])
                         dVectTmp = ['d.vect',
-                                    'map=%s' % UserSettings.Get(group='vdigit', key='backgroundMap', subkey='value'),
+                                    'map=%s' % UserSettings.Get(group='vdigit', key='bgmap',
+                                                                subkey='value', internal=True),
                                     'cats=%s' % utils.ListOfCatsToRange(self.copyIds),
                                     '-i',
                                     'color=%s' % colorStr,
                                     'fcolor=%s' % colorStr,
                                     'type=point,line,boundary,centroid',
                                     'width=2']
+                        
                         self.layerTmp = self.Map.AddLayer(type='vector',
                                                           name=globalvar.QUERYLAYER,
                                                           command=dVectTmp)
                         self.UpdateMap(render=True, renderVector=False)
                     else:
                         self.UpdateMap(render=False, renderVector=False)
+                    self.redrawAll = None
 
             elif digitToolbar.GetAction() == "zbulkLine" and len(self.polycoords) == 2:
                 # select lines to be labeled
@@ -1632,7 +1626,7 @@
             if len(digitClass.driver.GetSelected()) > 0:
                 self.redrawAll = None
                 ### self.OnPaint(None)
-            
+                
         elif self.dragid != None:
             # end drag of overlay decoration
             if self.overlays.has_key(self.dragid):
@@ -1719,14 +1713,13 @@
             digitClass = self.parent.digit
             # digitization tool (confirm action)
             if digitToolbar.GetAction() in ["moveLine", "moveVertex"] and \
-                    hasattr(self, "moveBegin"):
+                    hasattr(self, "vdigitMove"):
 
-                pFrom = self.moveCoords
-                pBegin = self.moveBegin
+                pFrom = self.vdigitMove['begin']
                 pTo = self.Pixel2Cell(event.GetPositionTuple())
                 
-                move = (pTo[0]-pFrom[0]-(pBegin[0]-pFrom[0]),
-                        pTo[1]-pFrom[1]-(pBegin[1]-pFrom[1]))
+                move = (pTo[0] - pFrom[0],
+                        pTo[1] - pFrom[1])
                 
                 if digitToolbar.GetAction() == "moveLine":
                     # move line
@@ -1737,10 +1730,8 @@
                     if digitClass.MoveSelectedVertex(pFrom, move) < 0:
                         return
                 
-                del self.moveBegin
-                del self.moveCoords
-                del self.moveIds
-
+                del self.vdigitMove
+                
         event.Skip()
 
     def OnRightUp(self, event):
@@ -1842,14 +1833,14 @@
                     del self.copyCatsIds
                 except AttributeError:
                     pass
-            elif digitToolbar.GetAction() == "editLine" and hasattr(self, "moveBegin"):
+            elif digitToolbar.GetAction() == "editLine" and \
+                    hasattr(self, "vdigitMove"):
                 line = digitClass.driver.GetSelected()
                 if digitClass.EditLine(line, self.polycoords) < 0:
                     return
-
-                del self.moveBegin
-                del self.moveCoords
-                del self.moveIds
+                
+                del self.vdigitMove
+                
             elif digitToolbar.GetAction() == "flipLine":
                 if digitClass.FlipLine() < 0:
                     return
@@ -1924,8 +1915,8 @@
 
                 if digitToolbar.GetAction() == "editLine":
                     # remove last vertex & line
-                    if len(self.moveIds) > 1:
-                        self.moveIds.pop()
+                    if len(self.vdigitMove['id']) > 1:
+                        self.vdigitMove['id'].pop()
 
                 self.UpdateMap(render=False, renderVector=False)
 
@@ -1937,11 +1928,10 @@
                 # varios tools -> unselected selected features
                 digitClass.driver.SetSelected([])
                 if digitToolbar.GetAction() in ["moveLine", "moveVertex", "editLine"] and \
-                        hasattr(self, "moveBegin"):
+                        hasattr(self, "vdigitMove"):
 
-                    del self.moveBegin
-                    del self.moveCoords
-                    del self.moveIds
+                    del self.vdigitMove
+                    
                 elif digitToolbar.GetAction() == "copyCats":
                     try:
                         del self.copyCatsList
@@ -1979,16 +1969,20 @@
                 if len(self.polycoords) > 0:
                     self.MouseDraw(pdc=self.pdcTmp, begin=self.Cell2Pixel(self.polycoords[-1]))
             elif digitToolbar.GetAction() in ["moveLine", "moveVertex", "editLine"] \
-                    and hasattr(self, "moveBegin"):
+                    and hasattr(self, "vdigitMove"):
                 dx = self.mouse['end'][0] - self.mouse['begin'][0]
                 dy = self.mouse['end'][1] - self.mouse['begin'][1]
-                ### self.moveBegin[0] += dx
-                ### self.moveBegin[1] += dy
-                if len(self.moveIds) > 0:
+                if self.vdigitMove.has_key('beginDiff'):
+                    if digitToolbar.GetAction() == 'moveLine':
+                        dx += self.vdigitMove['beginDiff'][0]
+                        dy += self.vdigitMove['beginDiff'][1]
+                    del self.vdigitMove['beginDiff']
+                
+                if len(self.vdigitMove['id']) > 0:
                     # draw lines on new position
                     if digitToolbar.GetAction() == "moveLine":
                         # move line
-                        for id in self.moveIds:
+                        for id in self.vdigitMove['id']:
                             self.pdcTmp.TranslateId(id, dx, dy)
                     elif digitToolbar.GetAction() in ["moveVertex", "editLine"]:
                         # move vertex ->
@@ -1998,16 +1992,17 @@
                         # do not draw static lines
                         if digitToolbar.GetAction() == "moveVertex":
                             self.polycoords = []
-                            self.pdcTmp.TranslateId(self.moveIds[0], dx, dy)
-                            if self.moveIds[1] > 0: # previous vertex
-                                x, y = self.Pixel2Cell(self.pdcVector.GetIdBounds(self.moveIds[1])[0:2])
-                                self.pdcVector.RemoveId(self.moveIds[1]+1)
+                            ### self.pdcTmp.TranslateId(self.vdigitMove['id'][0], dx, dy)
+                            self.pdcTmp.RemoveId(self.vdigitMove['id'][0])
+                            if self.vdigitMove['id'][1] > 0: # previous vertex
+                                x, y = self.Pixel2Cell(self.pdcTmp.GetIdBounds(self.vdigitMove['id'][1])[0:2])
+                                self.pdcTmp.RemoveId(self.vdigitMove['id'][1]+1)
                                 self.polycoords.append((x, y))
-                            x, y = self.Pixel2Cell(self.pdcVector.GetIdBounds(self.moveIds[0])[0:2])
-                            self.polycoords.append((x, y))
-                            if self.moveIds[2] > 0: # next vertex
-                                x, y = self.Pixel2Cell(self.pdcVector.GetIdBounds(self.moveIds[2])[0:2])
-                                self.pdcVector.RemoveId(self.moveIds[2]-1)
+                            ### x, y = self.Pixel2Cell(self.pdcTmp.GetIdBounds(self.vdigitMove['id'][0])[0:2])
+                            self.polycoords.append(self.Pixel2Cell(self.mouse['end']))
+                            if self.vdigitMove['id'][2] > 0: # next vertex
+                                x, y = self.Pixel2Cell(self.pdcTmp.GetIdBounds(self.vdigitMove['id'][2])[0:2])
+                                self.pdcTmp.RemoveId(self.vdigitMove['id'][2]-1)
                                 self.polycoords.append((x, y))
 
                             self.ClearLines(pdc=self.pdcTmp)
@@ -2015,11 +2010,11 @@
 
                         else: # edit line
                             try:
-                                if self.moveIds[-1] > 0: # previous vertex
+                                if self.vdigitMove['id'][-1] > 0: # previous vertex
                                     self.MouseDraw(pdc=self.pdcTmp,
                                                    begin=self.Cell2Pixel(self.polycoords[-1]))
                             except: # no line
-                                self.moveIds    = []
+                                self.vdigitMove['id'] = []
                                 self.polycoords = []
 
                 self.Refresh() # TODO: use RefreshRect()
@@ -2158,11 +2153,18 @@
 
         # if new region has been calculated, set the values
         if newreg != {}:
+            ce = newreg['w'] + (newreg['e'] - newreg['w']) / 2
+            cn = newreg['s'] + (newreg['n'] - newreg['s']) / 2
+            if hasattr(self, "vdigitMove"):
+                xo = self.Cell2Pixel((self.Map.region['center_easting'], self.Map.region['center_northing']))
+                xn = self.Cell2Pixel((ce, cn))
+                self.vdigitMove['beginDiff'] = (xn[0] - xo[0], xn[1] - xo[1])
+                for id in self.vdigitMove['id']:
+                    self.pdcTmp.RemoveId(id)
+                
             # calculate new center point and display resolution
-            self.Map.region['center_easting'] = newreg['w'] + \
-                (newreg['e'] - newreg['w']) / 2
-            self.Map.region['center_northing'] = newreg['s'] + \
-                (newreg['n'] - newreg['s']) / 2
+            self.Map.region['center_easting'] = ce
+            self.Map.region['center_northing'] = cn
             self.Map.region["ewres"] = (newreg['e'] - newreg['w']) / self.Map.width
             self.Map.region["nsres"] = (newreg['n'] - newreg['s']) / self.Map.height
             self.Map.AlignExtentFromDisplay()

Modified: grass/trunk/gui/wxpython/gui_modules/preferences.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/preferences.py	2008-09-29 09:10:48 UTC (rev 33588)
+++ grass/trunk/gui/wxpython/gui_modules/preferences.py	2008-09-29 09:18:16 UTC (rev 33589)
@@ -108,9 +108,6 @@
                 'settingsFile' : {
                     'type' : 'home'
                     }, # home, gisdbase, location, mapset
-                'digitInterface' : {
-                    'type' : 'vdigit'
-                    }, # vedit, vdigit
                 'iconTheme' : {
                     'type' : 'grass'
                     }, # grass, silk
@@ -266,9 +263,6 @@
                 'snapToVertex' : {
                     'enabled' : False
                     },
-                'backgroundMap' : {
-                    'value' : ''
-                    },
                 # digitize new record
                 'addRecord' : {
                     'enabled' : True
@@ -486,8 +480,6 @@
         #
         self.internalSettings = {}
         for group in self.userSettings.keys():
-            if group == 'vdigit':
-                continue # skip digitization settings (separate window frame)
             self.internalSettings[group] = {}
             for key in self.userSettings[group].keys():
                 self.internalSettings[group][key] = {}
@@ -505,8 +497,6 @@
                                                                         'mapset')
         self.internalSettings['advanced']['iconTheme']['choices'] = ('grass',
                                                                      'silk')
-        self.internalSettings['advanced']['digitInterface']['choices'] = ('vedit',
-                                                                          'vdigit')
         self.internalSettings['cmd']['verbosity']['choices'] = ('grassenv',
                                                                 'verbose',
                                                                 'quiet')
@@ -534,6 +524,8 @@
                                                                        _("aster"),
                                                                        _("gyro"),
                                                                        _("histogram"))
+        self.internalSettings['vdigit']['bgmap'] = {}
+        self.internalSettings['vdigit']['bgmap']['value'] = ''
         
     def ReadSettingsFile(self, settings=None):
         """Reads settings file (mapset, location, gisdbase)"""
@@ -1398,42 +1390,6 @@
                       pos=(row, 0), span=(1, 2))
         row += 1
         
-        #
-        # digitization interface
-        #
-        gridSizer.Add(item=wx.StaticText(parent=panel, id=wx.ID_ANY,
-                                         label=_("Vector digitizer interface:")),
-                       flag=wx.ALIGN_LEFT |
-                       wx.ALIGN_CENTER_VERTICAL,
-                       pos=(row, 0))
-        digitInterface = wx.Choice(parent=panel, id=wx.ID_ANY, size=(125, -1),
-                                   choices=self.settings.Get(group='advanced', key='digitInterface',
-                                                             subkey='choices', internal=True),
-                                   name="GetStringSelection")
-        digitInterface.SetStringSelection(self.settings.Get(group='advanced', key='digitInterface',
-                                                            subkey='type'))
-        self.winId['advanced:digitInterface:type'] = digitInterface.GetId()
-
-        gridSizer.Add(item=digitInterface,
-                      flag=wx.ALIGN_RIGHT |
-                      wx.ALIGN_CENTER_VERTICAL,
-                      pos=(row, 1))
-        row += 1
-
-        digitNote = wordwrap(_("Note: User can choose from two interfaces for digitization. "
-                               "The simple one uses v.edit command on the background. "
-                               "Map topology is rebuild on each operation which can "
-                               "significantly slow-down response. The vdigit is a native "
-                               "interface which uses v.edit functionality, but doesn't "
-                               "call the module itself."),
-                             self.GetSize()[0]-50, wx.ClientDC(self))
-
-        gridSizer.Add(item=wx.StaticText(parent=panel, id=wx.ID_ANY,
-                                         label=digitNote),
-                      flag=wx.ALIGN_LEFT |
-                      wx.ALIGN_CENTER_VERTICAL,
-                      pos=(row, 0), span=(1, 2))
-
         sizer.Add(item=gridSizer, proportion=1, flag=wx.ALL | wx.EXPAND, border=5)
         border.Add(item=sizer, proportion=1, flag=wx.ALL | wx.EXPAND, border=3)
 

Modified: grass/trunk/gui/wxpython/gui_modules/render.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/render.py	2008-09-29 09:10:48 UTC (rev 33588)
+++ grass/trunk/gui/wxpython/gui_modules/render.py	2008-09-29 09:18:16 UTC (rev 33589)
@@ -825,7 +825,7 @@
             
             if mapWindow:
                 # update progress bar
-                wx.SafeYield(mapWindow)
+                ### wx.SafeYield(mapWindow)
                 event = wxUpdateProgressBar(value=ilayer)
                 wx.PostEvent(mapWindow, event)
             
@@ -904,8 +904,7 @@
                     "width=%s" % str(self.width),
                     "height=%s" % str(self.height),
                     "output=%s" % self.mapfile]
-
-
+        
         # render overlays
         if tmp_region:
             os.environ["GRASS_REGION"] = tmp_region

Modified: grass/trunk/gui/wxpython/gui_modules/toolbars.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/toolbars.py	2008-09-29 09:10:48 UTC (rev 33588)
+++ grass/trunk/gui/wxpython/gui_modules/toolbars.py	2008-09-29 09:18:16 UTC (rev 33589)
@@ -54,6 +54,8 @@
         self._toolbar = toolbar
         self._data = toolData
         
+        self.parent = parent
+        
     def ToolbarData(self):
         """Toolbar data"""
         return None
@@ -99,6 +101,11 @@
 
     def OnTool(self, event):
         """Tool selected"""
+        if self.parent.toolbars['vdigit']:
+            # update vdigit toolbar (unselect currently selected tool)
+            id = self.parent.toolbars['vdigit'].GetAction(type='id')
+            self.parent.toolbars['vdigit'].GetToolbar().ToggleTool(id, False)
+        
         if event:
             # deselect previously selected tool
             id = self.action.get('id', -1)
@@ -532,13 +539,17 @@
 
     def OnTool(self, event):
         """Tool selected -> disable selected tool in map toolbar"""
+        # update map toolbar (unselect currently selected tool)
         id = self.parent.toolbars['map'].GetAction(type='id')
-        # update map toolbar
         self.parent.toolbars['map'].toolbar.ToggleTool(id, False)
+
         # set cursor
         cursor = self.parent.cursors["cross"]
         self.parent.MapWindow.SetCursor(cursor)
-        
+
+        # pointer
+        self.parent.OnPointer(None)
+
         if event:
             # deselect previously selected tool
             id = self.action.get('id', -1)
@@ -682,8 +693,6 @@
                             text=_('Duplicate attributes'),
                             kind=wx.ITEM_CHECK)
         toolMenu.AppendItem(attrb)
-        if UserSettings.Get(group='advanced', key='digitInterface', subkey='type') == 'vedit':
-            attrb.Enable(False) # Not implemeneted for vedit
         self.parent.MapWindow.Bind(wx.EVT_MENU, self.OnCopyAttrb, attrb)
         if self.action['desc'] == "copyAttrs":
             attrb.Check(True)
@@ -1017,6 +1026,23 @@
 
         @param mapLayer reference to MapLayer instance
         """
+        # deactive layer
+        self.mapcontent.ChangeLayerActive(mapLayer, False)
+
+        # clean map canvas
+        ### self.parent.MapWindow.EraseMap()
+
+        # unset background map if needed
+        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.statusbar.SetStatusText(_("Please wait, "
+                                              "opening vector map <%s> for editing...") % \
+                                                mapLayer.GetName(),
+                                            0)
+        
         # reload vdigit module
         reload(vdigit)
         from vdigit import Digit as Digit
@@ -1034,13 +1060,10 @@
         
         # update toolbar
         self.combo.SetValue(mapLayer.GetName())
-        self.parent.toolbars['map'].combo.SetValue ('Digitize')
+        self.parent.toolbars['map'].combo.SetValue (_('Digitize'))
         
         Debug.msg (4, "VDigitToolbar.StartEditing(): layer=%s" % mapLayer.GetName())
         
-        # deactive layer
-        self.mapcontent.ChangeLayerActive(mapLayer, False)
-
         # change cursor
         if self.parent.MapWindow.mouse['use'] == 'pointer':
             self.parent.MapWindow.SetCursor(self.parent.cursors["cross"])
@@ -1048,7 +1071,6 @@
         # create pseudoDC for drawing the map
         self.parent.MapWindow.pdcVector = wx.PseudoDC()
         self.parent.digit.driver.SetDevice(self.parent.MapWindow.pdcVector)
-        # self.parent.MapWindow.UpdateMap()
 
         if not self.parent.MapWindow.resize:
             self.parent.MapWindow.UpdateMap(render=True)
@@ -1072,19 +1094,24 @@
         Debug.msg (4, "VDigitToolbar.StopEditing(): layer=%s" % self.mapLayer.GetName())
         self.combo.SetValue (_('Select vector map'))
         
-        # save changes (only for vdigit)
-        if UserSettings.Get(group='advanced', key='digitInterface', subkey='type') == 'vdigit':
-            if UserSettings.Get(group='vdigit', key='saveOnExit', subkey='enabled') is False:
-                if self.parent.digit.GetUndoLevel() > 0:
-                    dlg = wx.MessageDialog(parent=self.parent, message=_("Do you want to save changes "
-                                                                         "in vector map <%s>?") % self.mapLayer.GetName(),
-                                           caption=_("Save changes?"),
-                                           style=wx.YES_NO | wx.YES_DEFAULT | wx.ICON_QUESTION)
-                    if dlg.ShowModal() == wx.ID_NO:
-                        # revert changes
-                        self.parent.digit.Undo(0)
-                    dlg.Destroy()
+        # save changes
+        if UserSettings.Get(group='vdigit', key='saveOnExit', subkey='enabled') is False:
+            if self.parent.digit.GetUndoLevel() > 0:
+                dlg = wx.MessageDialog(parent=self.parent,
+                                       message=_("Do you want to save changes "
+                                                 "in vector map <%s>?") % self.mapLayer.GetName(),
+                                       caption=_("Save changes?"),
+                                       style=wx.YES_NO | wx.YES_DEFAULT | wx.ICON_QUESTION)
+                if dlg.ShowModal() == wx.ID_NO:
+                    # revert changes
+                    self.parent.digit.Undo(0)
+                dlg.Destroy()
         
+        self.parent.statusbar.SetStatusText(_("Please wait, "
+                                              "closing and rebuilding topology of "
+                                              "vector map <%s>...") % self.mapLayer.GetName(),
+                                            0)
+        
         self.parent.digit.SetMapName(None) # -> close map
         
         # re-active layer 

Modified: grass/trunk/gui/wxpython/gui_modules/vdigit.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/vdigit.py	2008-09-29 09:10:48 UTC (rev 33588)
+++ grass/trunk/gui/wxpython/gui_modules/vdigit.py	2008-09-29 09:18:16 UTC (rev 33589)
@@ -4,7 +4,7 @@
 @brief Vector digitizer extension
 
 Progress:
- (1) v.edit called on the background (class VEdit)
+ (1) v.edit called on the background (class VEdit) (removed in r?)
  (2) Reimplentation of v.digit (VDigit)
 
 Import:
@@ -13,7 +13,6 @@
 
 Classes:
  - AbstractDigit 
- - VEdit
  - VDigit
  - AbstractDisplayDriver
  - CDisplayDriver
@@ -62,15 +61,6 @@
     #          "Detailed information in README file." % \
     #          (os.linesep, err)
 
-# which interface to use?
-if UserSettings.Get(group='advanced', key='digitInterface', subkey='type') == 'vedit' and GV_LINES is not None:
-    print >> sys.stderr, "%sWARNING: Digitization tool uses v.edit interface. " \
-        "This can significantly slow down some operations especially for " \
-        "middle-large vector maps. "\
-        "You can change the digitization interface in 'User preferences' " \
-        "(menu 'Config'->'Preferences')." % \
-          os.linesep
-
 class AbstractDigit:
     """
     Abstract digitization class
@@ -104,30 +94,11 @@
         UserSettings.Set(group='vdigit', key='category', subkey='value', value=1)
 
         if self.map:
-            if UserSettings.Get(group='advanced', key='digitInterface', subkey='type') == 'vedit':
-                categoryCmd = gcmd.Command(cmd=["v.category", "-g", "--q",
-                                                "input=%s" % self.map, 
-                                                "option=report"])
-
-                if categoryCmd.returncode != 0:
-                    return False
+            cat = self.digit.GetCategory(UserSettings.Get(group='vdigit', key='layer', subkey='value'))
+            cat += 1
+            UserSettings.Set(group='vdigit', key='category', subkey='value',
+                             value=cat)
         
-                for line in categoryCmd.ReadStdOutput():
-                    if "all" in line:
-                        if UserSettings.Get(group='vdigit', key='layer', subkey='value') != int(line.split(' ')[0]):
-                            continue
-                        try:
-                            maxCat = int(line.split(' ')[-1]) + 1
-                            UserSettings.Set(group='vdigit', key='category', subkey='value', value=maxCat)
-                        except:
-                            return False
-                        return True
-            else:
-                cat = self.digit.GetCategory(UserSettings.Get(group='vdigit', key='layer', subkey='value'))
-                cat += 1
-                UserSettings.Set(group='vdigit', key='category', subkey='value',
-                                 value=cat)
-    
     def SetCategory(self):
         """Return category number to use (according Settings)"""
         if UserSettings.Get(group='vdigit', key="categoryMode", subkey='selection') == 0:
@@ -166,16 +137,8 @@
                                             'the topology (Vector->Develop vector map->'
                                             'Create/rebuild topology).') % map)
             
-        if UserSettings.Get(group='advanced', key='digitInterface', subkey='type') != 'v.edit':
-            try:
-                self.digit.InitCats()
-            except:
-                pass
-
-        # avoid using current vector map as background map
-        if self.map == UserSettings.Get(group='vdigit', key='backgroundMap', subkey='value'):
-            UserSettings.Set(group='vdigit', key='backgroundMap', subkey='value', value='')
-
+        self.digit.InitCats()
+        
     def SelectLinesByQueryThresh(self):
         """Generic method used for SelectLinesByQuery()
         -- to get threshold value"""
@@ -212,8 +175,10 @@
 
         @param pos1,pos2 bounding box defifinition
         """
-
-        if UserSettings.Get(group='vdigit', key='backgroundMap', subkey='value') == '':
+        bgmap = str(UserSettings.Get(group='vdigit', key='bgmap', subkey='value',
+                                     internal=True))
+        
+        if bgmap == '':
             Debug.msg(4, "VEdit.SelectLinesFromBackgroundMap(): []")
             return []
 
@@ -222,565 +187,21 @@
 
         vEditCmd = gcmd.Command(['v.edit',
                                  '--q',
-                                 'map=%s' % UserSettings.Get(group='vdigit', key='backgroundMap', subkey='value'),
+                                 'map=%s' % bgmap,
                                  'tool=select',
                                  'bbox=%f,%f,%f,%f' % (pos1[0], pos1[1], pos2[0], pos2[1])])
                                  #'polygon=%f,%f,%f,%f,%f,%f,%f,%f,%f,%f' % \
                                  #    (x1, y1, x2, y1, x2, y2, x1, y2, x1, y1)])
                                              
-        try:
-            output = vEditCmd.ReadStdOutput()[0] # first line
-            ids = output.split(',') 
-            ids = map(int, ids) # str -> int
-        except:
-            return []
-
+        output = vEditCmd.ReadStdOutput()[0] # first line
+        ids = output.split(',') 
+        ids = map(int, ids) # str -> int
+        
         Debug.msg(4, "VEdit.SelectLinesFromBackgroundMap(): %s" % \
                       ",".join(["%d" % v for v in ids]))
         
         return ids
 
-class VEdit(AbstractDigit):
-    """
-    Prototype of digitization class based on v.edit command
-
-    Note: This should be replaced by VDigit class.
-    """
-    def __init__(self, mapwindow):
-        """Initialization
-
-        @param mapwindow reference to mapwindow (MapFrame) instance
-        @param settings  initial settings of digitization tool
-        """
-        AbstractDigit.__init__(self, mapwindow)
-
-    def AddPoint (self, map, point, x, y, z=None):
-        """Add point/centroid
-
-        @param map   map name
-        @param point feature type (True for point, otherwise centroid)
-        @param x,y,z coordinates
-        """
-        if point:
-            key = "P"
-        else:
-            key = "C"
-
-        if UserSettings.Get(group='vdigit', key="categoryMode", subkey='selection') == 2:
-            layer = -1 # -> no category
-            cat   = -1
-        else:
-            layer = UserSettings.Get(group='vdigit', key="layer", subkey='value')
-            cat   = self.SetCategory()
-
-        if layer > 0 and cat != "None":
-            addstring =  "%s 1 1\n" % (key)
-        else:
-            addstring =  "%s 1\n" % (key)
-
-        addstring += "%f %f\n" % (x, y)
-
-        if layer > 0 and cat != "None":
-            addstring += "%d %d\n" % (layer, cat)
-            Debug.msg (3, "VEdit.AddPoint(): map=%s, type=%s, layer=%d, cat=%d, x=%f, y=%f" % \
-                           (map, type, layer, cat, x, y))
-        else:
-            Debug.msg (3, "VEdit.AddPoint(): map=%s, type=%s, x=%f, y=%f" % \
-                           (map, type, x, y))
-
-        Debug.msg (4, "Vline.AddPoint(): input=%s" % addstring)
-                
-        self.__AddFeature (map=map, input=addstring)
-
-    def AddLine (self, map, line, coords):
-        """Add line/boundary
-
-        @param map  map name
-        @param line feature type (True for line, otherwise boundary)
-        @param list of coordinates
-        """
-        if len(coords) < 2:
-            return
-
-        if UserSettings.Get(group='vdigit', key="categoryMode", subkey='selection') == 2:
-            layer = -1 # -> no category
-            cat   = -1
-        else:
-            layer = UserSettings.Get(group='vdigit', key="layer", subkey='value')
-            cat   = self.SetCategory()
-
-        if line:
-            key = "L"
-            flags = []
-        else:
-            key = "B"
-            flags = ['-c'] # close boundaries
-            
-        if layer > 0 and cat != "None":
-            addstring = "%s %d 1\n" % (key, len(coords))
-        else:
-            addstring = "%s %d\n" % (key, len(coords))
-
-        for point in coords:
-            addstring += "%f %f\n" % \
-                (float(point[0]), float(point [1]))
-
-        if layer > 0 and cat != "None":
-            addstring += "%d %d\n" % (layer, cat)
-            Debug.msg (3, "Vline.AddLine(): type=%s, layer=%d, cat=%d coords=%s" % \
-                           (key, layer, cat, coords))
-        else:
-            Debug.msg (3, "Vline.AddLine(): type=%s, coords=%s" % \
-                           (key, coords))
-
-        Debug.msg (4, "VEdit.AddLine(): input=%s" % addstring)
-
-        self.__AddFeature (map=map, input=addstring, flags=flags)
-
-    def __AddFeature (self, map, input, flags=[]):
-        """Generic method to add new vector feature
-
-        @param map   map name
-        @param input feature definition in GRASS ASCII format
-        @param flags additional flags
-        """
-        if UserSettings.Get(group='vdigit', key='snapping', subkey='value') <= 0.0:
-            snap = "no"
-        else:
-            if UserSettings.Get(group='vdigit', key='snapToVertex', subkey='enabled') is True:
-                snap = "vertex"
-            else:
-                snap = "node"
-
-        command = ["v.edit", "-n", "--q", 
-                   "map=%s" % map,
-                   "tool=add",
-                   "thresh=%f,%f" % (self.driver.GetThreshold(type='selectThresh'), self.driver.GetThreshold(type='snapping')),
-                   "snap=%s" % snap]
-
-        if UserSettings.Get(group='vdigit', key='backgroundMap', subkey='value') != '':
-            command.append("bgmap=%s" % UserSettings.Get(group='vdigit', key='backgroundMap', subkey='value'))
-
-        # additional flags
-        for flag in flags:
-            command.append(flag)
-
-        # run the command
-        Debug.msg(4, "VEdit.AddFeature(): input=%s" % input)
-        vedit = gcmd.Command(cmd=command, stdin=input, stderr=None)
-
-        # reload map (needed for v.edit)
-        self.driver.ReloadMap()
-        
-    def DeleteSelectedLines(self):
-        """Delete selected features"""
-        selected = self.driver.GetSelected() # grassId
-
-        if len(selected) <= 0:
-            return False
-
-        ids = ",".join(["%d" % v for v in selected])
-
-        Debug.msg(4, "Digit.DeleteSelectedLines(): ids=%s" % \
-                      ids)
-
-        # delete also attributes if requested
-        if UserSettings.Get(group='vdigit', key='delRecord', subkey='enabled') is True:
-            layerCommand = gcmd.Command(cmd=["v.db.connect",
-                                             "-g", "--q",
-                                             "map=%s" % self.map],
-                                        rerr=None, stderr=None)
-            if layerCommand.returncode == 0:
-                layers = {}
-                for line in layerCommand.ReadStdOutput():
-                    lineList = line.split(' ')
-                    layers[int(lineList[0])] = { "table"    : lineList[1],
-                                                 "key"      : lineList[2],
-                                                 "database" : lineList[3],
-                                                 "driver"   : lineList[4] }
-                for layer in layers.keys():
-                    printCats = gcmd.Command(['v.category',
-                                              '--q',
-                                              'input=%s' % self.map,
-                                              'layer=%d' % layer,
-                                              'option=print',
-                                              'id=%s' % ids])
-                    sql = 'DELETE FROM %s WHERE' % layers[layer]['table']
-                    n_cats = 0
-                    for cat in printCats.ReadStdOutput():
-                        for c in cat.split('/'):
-                            sql += ' cat = %d or' % int(c)
-                            n_cats += 1
-                    sql = sql.rstrip(' or')
-                    if n_cats > 0:
-                        gcmd.Command(['db.execute',
-                                      '--q',
-                                      'driver=%s' % layers[layer]['driver'],
-                                      'database=%s' % layers[layer]['database']],
-                                     stdin=sql,
-                                     rerr=None, stderr=None)
-
-        command = [ "v.edit",
-                    "map=%s" % self.map,
-                    "tool=delete",
-                    "ids=%s" % ids]
-
-        # run the command
-        vedit = gcmd.Command(cmd=command, stderr=None)
-
-        # reload map (needed for v.edit)
-        self.driver.ReloadMap()
-
-        return True
-
-    def MoveSelectedLines(self, move):
-        """Move selected features
-
-        @param move X,Y direction
-        """
-        return self.__MoveFeature("move", None, move)
-
-    def MoveSelectedVertex(self, coords, move):
-        """Move selected vertex
-
-        Feature geometry is changed.
-
-        @param coords click coordinates
-        @param move   X,Y direction
-        """
-        return self.__MoveFeature("vertexmove", coords, move)
-
-    def __MoveFeature(self, tool, coords, move):
-        """Move selected vector feature (line, vertex)
-
-        @param tool   tool for v.edit
-        @param coords click coordinates
-        @param move   direction (x, y)
-        """
-        selected = self.driver.GetSelected()
-
-        if len(selected) <= 0:
-            return False
-
-        ids = ",".join(["%d" % v for v in selected])
-
-        Debug.msg(4, "Digit.MoveSelectedLines(): ids=%s, move=%s" % \
-                      (ids, move))
-
-        if UserSettings.Get(group='vdigit', key='snapping', subkey='value') <= 0.0:
-            snap = "no"
-        else:
-            if UserSettings.Get(group='vdigit', key='snapToVertex', subkey='enabled') is True:
-                snap = "vertex"
-            else:
-                snap = "node"
-
-
-        command = ["v.edit", "--q", 
-                   "map=%s" % self.map,
-                   "tool=%s" % tool,
-                   "ids=%s" % ids,
-                   "move=%f,%f" % (float(move[0]),float(move[1])),
-                   "thresh=%f,%f" % (self.driver.GetThreshold(type='selectThresh'), self.driver.GetThreshold(type='snapping')),
-                   "snap=%s" % snap]
-
-        if tool == "vertexmove":
-            command.append("coords=%f,%f" % (float(coords[0]), float(coords[1])))
-            command.append("-1") # modify only first selected
-                         
-        if UserSettings.Get(group='vdigit', key='backgroundMap', subkey='value') != '':
-            command.append("bgmap=%s" % UserSettings.Get(group='vdigit', key='backgroundMap', subkey='value'))
-                    
-        # run the command
-        vedit = gcmd.Command(cmd=command, stderr=None)
-        
-        # reload map (needed for v.edit)
-        self.driver.ReloadMap()
-
-        return True
-
-    def AddVertex(self, coords):
-        """Add new vertex to the selected line/boundary on position 'coords'
-
-        @param coords coordinates to add vertex
-        """
-        return self.__ModifyVertex(coords, "vertexadd")
-
-    def RemoveVertex(self, coords):
-        """Remove vertex from the selected line/boundary on position 'coords'
-
-        @param coords coordinates to remove vertex
-        """
-        return self.__ModifyVertex(coords, "vertexdel")
-    
-    def __ModifyVertex(self, coords, action):
-        """Generic method for vertex manipulation
-
-        @param coords coordinates
-        @param action operation to perform
-        """
-        try:
-            line = self.driver.GetSelected()[0]
-        except:
-            return False
-
-        command = ["v.edit", "--q",
-                   "map=%s" % self.map,
-                   "tool=%s" % action,
-                   "ids=%s" % line,
-                   "coords=%f,%f" % (float(coords[0]),float(coords[1])),
-                   "thresh=%f,%f" % (self.driver.GetThreshold(type='selectThresh'), self.driver.GetThreshold(type='snapping'))]
-
-        # run the command
-        vedit = gcmd.Command(cmd=command, stderr=None)
-
-        # reload map (needed for v.edit)
-        self.driver.ReloadMap()
-        
-        return True
-
-    def SplitLine(self, coords):
-        """Split selected line/boundary on position 'coords'
-
-        @param coords coordinates to split line
-        """
-        try:
-            line = self.driver.GetSelected()[0]
-        except:
-            return False
-
-        command = ["v.edit", "--q",
-                   "map=%s" % self.map,
-                   "tool=break",
-                   "ids=%s" % line,
-                   "coords=%f,%f" % (float(coords[0]),float(coords[1])),
-                   "thresh=%f" % self.driver.GetThreshold(type='selectThresh')]
-
-        # run the command
-        vedit = gcmd.Command(cmd=command, stderr=None)
-
-        # redraw map
-        self.driver.ReloadMap()
-        
-        return True
-
-    def EditLine(self, line, coords):
-        """Edit existing line/boundary
-
-        @param line id of line to be modified
-        @param coords list of coordinates of modified line
-        """
-        # remove line
-        vEditDelete = gcmd.Command(['v.edit',
-                                   '--q',
-                                   'map=%s' % self.map,
-                                   'tool=delete',
-                                   'ids=%s' % line], stderr=None)
-
-        # add line
-        if len(coords) > 0:
-            self.AddLine(self.map, "line", coords)
-
-        # reload map (needed for v.edit)
-        self.driver.ReloadMap()
-
-    def __ModifyLines(self, tool):
-        """Generic method to modify selected lines/boundaries
-
-        @param tool operation to be performed by v.edit
-        """
-        ids = self.driver.GetSelected()
-
-        if len(ids) <= 0:
-            return False
-
-        vEdit = ['v.edit',
-                 '--q',
-                 'map=%s' % self.map,
-                 'tool=%s' % tool,
-                 'ids=%s' % ",".join(["%d" % v for v in ids])]
-
-        if tool in ['snap', 'connect']:
-            vEdit.append("thresh=%f,%f" % (self.driver.GetThreshold(type='selectThresh'), self.driver.GetThreshold(type='snapping')))
-
-        runCmd = gcmd.Command(vEdit)
-
-        # reload map (needed for v.edit)
-        self.driver.ReloadMap()
-                        
-        return True
-
-    def FlipLine(self):
-        """Flip selected lines/boundaries"""
-        return self.__ModifyLines('flip')
-
-    def MergeLine(self):
-        """Merge selected lines/boundaries"""
-        return self.__ModifyLines('merge')
-
-    def BreakLine(self):
-        """Break selected lines/boundaries"""
-        return self.__ModifyLines('break')
-
-    def SnapLine(self):
-        """Snap selected lines/boundaries"""
-        return self.__ModifyLines('snap')
-
-    def ConnectLine(self):
-        """Connect selected lines/boundaries"""
-        return self.__ModifyLines('connect')
-
-    def TypeConvForSelectedLines(self):
-        """Feature type conversion for selected objects.
-
-        Supported conversions:
-         - point <-> centroid
-         - line <-> boundary
-        """
-        return self.__ModifyLines('chtype')
-
-    def ZBulkLine(self, pos1, pos2, value, step):
-        """Provide z bulk-labeling (automated assigment of z coordinate
-        to 3d lines
-
-        @param pos1,pos2 bounding box definition for selecting lines to be labeled
-        @param value starting value
-        @param step  step value
-        """
-        gcmd.Command(['v.edit',
-                      '--q',
-                      'map=%s' % self.map,
-                      'tool=zbulk',
-                      'bbox=%f,%f,%f,%f' % (pos1[0], pos1[1], pos2[0], pos2[1]),
-                      'zbulk=%f,%f' % (value, step)])
-
-
-    def CopyLine(self, ids=None):
-        """Copy features from (background) vector map
-
-        @param ids list of line ids to be copied
-        """
-        if not ids:
-            ids = self.driver.GetSelected()
-
-        if len(ids) <= 0:
-            return False
-
-        vEdit = ['v.edit',
-                 '--q',
-                 'map=%s' % self.map,
-                 'tool=copy',
-                 'ids=%s' % ",".join(["%d" % v for v in ids])]
-
-        if UserSettings.Get(group='vdigit', key='backgroundMap', subkey='value') != '':
-            vEdit.append('bgmap=%s' % UserSettings.Get(group='vdigit', key='backgroundMap', subkey='value'))
-
-        runCmd = gcmd.Command(vEdit)
-
-        # reload map (needed for v.edit)
-        self.driver.ReloadMap()
-                        
-        return True
-
-    def CopyCats(self, cats, ids, copyAttrb=False):
-        """Copy given categories to objects with id listed in ids
-
-        @param cats list of cats to be copied
-        @param ids  ids of lines to be modified
-        """
-        if len(cats) == 0 or len(ids) == 0:
-            return False
-
-        # collect cats
-        # FIXME: currently layer is ignored...
-        gcmd.Command(['v.edit',
-                     '--q',
-                     'map=%s' % self.map,
-                     'tool=catadd',
-                     'cats=%s' % ",".join(["%d" % v for v in cats]),
-                     'ids=%s' % ",".join(["%d" % v for v in ids])])
-        
-        # reload map (needed for v.edit)
-        self.driver.ReloadMap()
-
-        return True
-
-    def SelectLinesByQuery(self, pos1, pos2):
-        """Select features by query
-
-        @param pos1, pos2 bounding box definition
-        """
-        thresh = self.SelectLinesByQueryThresh()
-        
-        w, n = pos1
-        e, s = pos2
-
-        if UserSettings.Get(group='vdigit', key='query', subkey='box') == False: # select globaly
-            vInfo = gcmd.Command(['v.info',
-                                  'map=%s' % self.map,
-                                  '-g'])
-            for item in vInfo.ReadStdOutput():
-                if 'north' in item:
-                    n = float(item.split('=')[1])
-                elif 'south' in item:
-                    s = float(item.split('=')[1])
-                elif 'east' in item:
-                    e = float(item.split('=')[1])
-                elif 'west' in item:
-                    w = float(item.split('=')[1])
-
-        if UserSettings.Get(group='vdigit', key='query', subkey='selection') == 0:
-            qtype = 'length'
-        else:
-            qtype = 'dangle'
-
-        vEdit = (['v.edit',
-                  '--q',
-                  'map=%s' % self.map,
-                  'tool=select',
-                  'bbox=%f,%f,%f,%f' % (w, n, e, s),
-                  'query=%s' % qtype,
-                  'thresh=0,0,%f' % thresh])
-
-        vEditCmd = gcmd.Command(vEdit)
-        
-        try:
-            output = vEditCmd.ReadStdOutput()[0] # first line
-            ids = output.split(',') 
-            ids = map(int, ids) # str -> int
-        except:
-            return []
-
-        Debug.msg(4, "VEdit.SelectLinesByQuery(): %s" % \
-                      ",".join(["%d" % v for v in ids]))
-        
-        return ids
-
-    def GetLayers(self):
-        """Return list of layers"""
-        layerCommand = gcmd.Command(cmd=["v.db.connect",
-                                         "-g", "--q",
-                                         "map=%s" % self.map],
-                                    rerr=None, stderr=None)
-        if layerCommand.returncode == 0:
-            layers = []
-            for line in layerCommand.ReadStdOutput():
-                lineList = line.split(' ')
-                layers.append(int(lineList[0]))
-            return layers
-
-        return [1,]
-
-    def Undo(self, level=-1):
-        """Undo not implemented here"""
-        wx.MessageBox(parent=self.mapWindow, message=_("Undo is not implemented in vedit component. "
-                                                    "Use vdigit instead."),
-                      caption=_("Message"), style=wx.ID_OK | wx.ICON_INFORMATION | wx.CENTRE)
-
-    def UpdateSettings(self):
-        """Update digit settigs"""
-        pass
-    
 class VDigit(AbstractDigit):
     """
     Prototype of digitization class based on v.digit reimplementation
@@ -829,14 +250,14 @@
 
         snap, thresh = self.__getSnapThreshold()
 
+        bgmap = str(UserSettings.Get(group='vdigit', key="bgmap",
+                                     subkey='value', internal=True))
         if z:
             ret = self.digit.AddLine(type, [x, y, z], layer, cat,
-                                     str(UserSettings.Get(group='vdigit', key="backgroundMap",
-                                                          subkey='value')), snap, thresh)
+                                     bgmap, snap, thresh)
         else:
             ret = self.digit.AddLine(type, [x, y], layer, cat,
-                                     str(UserSettings.Get(group='vdigit', key="backgroundMap",
-                                                          subkey='value')), snap, thresh)
+                                     bgmap, snap, thresh)
         self.toolbar.EnableUndo()
 
         return ret
@@ -870,8 +291,11 @@
         
         snap, thresh = self.__getSnapThreshold()
         
+        bgmap = str(UserSettings.Get(group='vdigit', key="bgmap",
+                                     subkey='value', internal=True))
+        
         ret = self.digit.AddLine(type, listCoords, layer, cat,
-                                 str(UserSettings.Get(group='vdigit', key="backgroundMap", subkey='value')), snap, thresh)
+                                 bgmap, snap, thresh)
 
         self.toolbar.EnableUndo()
         
@@ -896,10 +320,12 @@
         """
         snap, thresh = self.__getSnapThreshold()
         
-        bgmap = UserSettings.Get(group='vdigit', key="backgroundMap", subkey='value')
+        bgmap = str(UserSettings.Get(group='vdigit', key="bgmap",
+                                     subkey='value', internal=True))
+        
         try:
             nlines = self.digit.MoveLines(move[0], move[1], 0.0, # TODO 3D
-                                          str(bgmap), snap, thresh)
+                                          bgmap, snap, thresh)
         except SystemExit:
             pass
         
@@ -919,9 +345,12 @@
         """
         snap, thresh = self.__getSnapThreshold()
 
+        bgmap = str(UserSettings.Get(group='vdigit', key="bgmap",
+                                     subkey='value', internal=True))
+        
         moved = self.digit.MoveVertex(coords[0], coords[1], 0.0, # TODO 3D
                                       move[0], move[1], 0.0,
-                                      str(UserSettings.Get(group='vdigit', key="backgroundMap", subkey='value')), snap,
+                                      bgmap, snap,
                                       self.driver.GetThreshold(type='selectThresh'), thresh)
 
         if moved:
@@ -1006,10 +435,12 @@
 
         snap, thresh = self.__getSnapThreshold()
         
+        bgmap = str(UserSettings.Get(group='vdigit', key="bgmap",
+                                     subkey='value', internal=True))
+        
         try:
             ret = self.digit.RewriteLine(lineid, listCoords,
-                                         str(UserSettings.Get(group='vdigit', key="backgroundMap", subkey='value')),
-                                         snap, thresh)
+                                         bgmap, snap, thresh)
         except SystemExit:
             pass
 
@@ -1094,7 +525,9 @@
         @return number of copied features
         @return -1 on error
         """
-        bgmap = str(UserSettings.Get(group='vdigit', key='backgroundMap', subkey='value'))
+        bgmap = str(UserSettings.Get(group='vdigit', key='bgmap',
+                                     subkey='value', internal=True))
+        
         if len(bgmap) > 0:
             ret = self.digit.CopyLines(ids, bgmap)
         else:
@@ -1244,22 +677,15 @@
 
         return (snap, thresh)
 
-if UserSettings.Get(group='advanced', key='digitInterface', subkey='type') == 'vedit':
-    class Digit(VEdit):
-        """Default digit class"""
-        def __init__(self, mapwindow):
-            VEdit.__init__(self, mapwindow)
-            self.type = 'vedit'
-else:
-    class Digit(VDigit):
-        """Default digit class"""
-        def __init__(self, mapwindow):
-            VDigit.__init__(self, mapwindow)
-            self.type = 'vdigit'
-            
-        def __del__(self):
-            VDigit.__del__(self)
-            
+class Digit(VDigit):
+    """Default digit class"""
+    def __init__(self, mapwindow):
+        VDigit.__init__(self, mapwindow)
+        self.type = 'vdigit'
+        
+    def __del__(self):
+        VDigit.__del__(self)
+        
 class AbstractDisplayDriver:
     """Abstract classs for display driver"""
     def __init__(self, parent, mapwindow):
@@ -1354,10 +780,7 @@
         if map:
             name, mapset = map.split('@')
             try:
-                if UserSettings.Get(group='advanced', key='digitInterface', subkey='type') == 'vedit':
-                    ret = self.__display.OpenMap(str(name), str(mapset), False)
-                else:
-                    ret = self.__display.OpenMap(str(name), str(mapset), True)
+                ret = self.__display.OpenMap(str(name), str(mapset), True)
             except SystemExit:
                 ret = -1
         else:
@@ -1378,13 +801,12 @@
 
         @return wx.Image instance
         """
-        print 'd'
         nlines = self.__display.DrawMap(True) # force
         Debug.msg(3, "CDisplayDriver.DrawMap(): nlines=%d" % nlines)
 
         return nlines
 
-    def SelectLinesByBox(self, begin, end, type=0):
+    def SelectLinesByBox(self, begin, end, type=0, drawSeg=False):
         """Select vector features by given bounding box.
 
         If type is given, only vector features of given type are selected.
@@ -1395,9 +817,11 @@
         x1, y1 = begin
         x2, y2 = end
 
+        inBox = UserSettings.Get(group='vdigit', key='selectInside', subkey='enabled')
+        
         nselected = self.__display.SelectLinesByBox(x1, y1, -1.0 * wxvdigit.PORT_DOUBLE_MAX,
                                                     x2, y2, wxvdigit.PORT_DOUBLE_MAX,
-                                                    type, UserSettings.Get(group='vdigit', key='selectInside', subkey='enabled'))
+                                                    type, inBox, drawSeg)
         
         Debug.msg(4, "CDisplayDriver.SelectLinesByBox(): selected=%d" % \
                       nselected)
@@ -1439,6 +863,10 @@
             
         return selected
 
+    def GetSelectedCoord(self):
+        """Return ids of selected vector features and their coordinates"""
+        return dict(self.__display.GetSelectedCoord())
+        
     def GetRegionSelected(self):
         """Get minimal region extent of selected features (ids/cats)"""
         return self.__display.GetRegionSelected()
@@ -1449,27 +877,23 @@
         # -> id : (list of ids)
         dupl = dict(self.__display.GetDuplicates())
 
-        vdigitComp = UserSettings.Get(group='advanced', key='digitInterface', subkey='type')
-
         # -> id : ((id, cat), ...)
         dupl_full = {}
         for key in dupl.keys():
             dupl_full[key] = []
             for id in dupl[key]:
                 catStr = ''
-
-                # categories not supported for v.edit !
-                if vdigitComp == 'vdigit':
-                    cats = self.parent.GetLineCats(line=id)
-
-                    for layer in cats.keys():
-                        if len(cats[layer]) > 0:
-                            catStr = "%d: (" % layer
-                            for cat in cats[layer]:
-                                catStr += "%d," % cat
-                            catStr = catStr.rstrip(',')
-                            catStr += ')'
-
+                
+                cats = self.parent.GetLineCats(line=id)
+                
+                for layer in cats.keys():
+                    if len(cats[layer]) > 0:
+                        catStr = "%d: (" % layer
+                        for cat in cats[layer]:
+                            catStr += "%d," % cat
+                        catStr = catStr.rstrip(',')
+                        catStr += ')'
+                
                 dupl_full[key].append([id, catStr])
 
         return dupl_full
@@ -1777,28 +1201,6 @@
         border.Add(item=sizer, proportion=0, flag=wx.LEFT | wx.RIGHT | wx.BOTTOM | wx.EXPAND, border=5)
 
         #
-        # background vector map
-        #
-        box   = wx.StaticBox (parent=panel, id=wx.ID_ANY, label=" %s " % _("Background vector map"))
-        sizer = wx.StaticBoxSizer(box, wx.VERTICAL)
-
-        boxSizer = wx.BoxSizer(wx.VERTICAL)
-
-        self.backgroundMap = gselect.Select(parent=panel, id=wx.ID_ANY, size=globalvar.DIALOG_GSELECT_SIZE,
-                                           type="vector", exceptOf=[self.parent.digit.map])
-        self.backgroundMap.SetValue(UserSettings.Get(group='vdigit', key="backgroundMap", subkey='value'))
-        self.backgroundMap.Bind(wx.EVT_TEXT, self.OnChangeBackgroundMap)
-        boxSizer.Add(item=self.backgroundMap, proportion=0,
-                     flag=wx.EXPAND | wx.ALL, border=5)
-        boxSizer.Add(item=wx.StaticText(parent=panel, id=wx.ID_ANY,
-                                        label=_("This vector map is used for snapping and copying features.")),
-                     proportion=0,
-                     flag=wx.EXPAND | wx.ALL, border=5)
-
-        sizer.Add(item=boxSizer, proportion=1, flag=wx.TOP | wx.LEFT | wx.EXPAND, border=1)
-        border.Add(item=sizer, proportion=0, flag=wx.LEFT | wx.RIGHT | wx.BOTTOM | wx.EXPAND, border=5)
-        
-        #
         # select box
         #
         box   = wx.StaticBox (parent=panel, id=wx.ID_ANY, label=" %s " % _("Select vector features"))
@@ -1853,8 +1255,6 @@
 
         self.intersect = wx.CheckBox(parent=panel, label=_("Break lines at intersection"))
         self.intersect.SetValue(UserSettings.Get(group='vdigit', key='breakLines', subkey='enabled'))
-        if UserSettings.Get(group='advanced', key='digitInterface', subkey='type') == 'vedit':
-            self.intersect.Enable(False)
         
         sizer.Add(item=self.intersect, proportion=0, flag=wx.ALL | wx.EXPAND, border=1)
 
@@ -2141,12 +1541,6 @@
             
         event.Skip()
 
-    def OnChangeBackgroundMap(self, event):
-        """Change background map"""
-        map = self.backgroundMap.GetValue()
-        
-        UserSettings.Set(group='vdigit', key='backgroundMap', subkey='value', value=map)
-        
     def OnChangeQuery(self, event):
         """Change query"""
         if self.queryLength.GetValue():
@@ -2655,42 +2049,29 @@
                             cat not in catsCurr[1][layer]:
                         catList.append(cat)
                 if catList != []:
-                    if UserSettings.Get(group='advanced', key='digitInterface', subkey='type') == 'vedit':
-                        vEditCmd = ['v.edit', '--q',
-                                    'map=%s' % self.map,
-                                    'layer=%d' % layer,
-                                    'tool=%s' % action,
-                                    'cats=%s' % ",".join(["%d" % v for v in catList]),
-                                    'id=%d' % self.line]
-            
-                        gcmd.Command(vEditCmd)
+                    if action == 'catadd':
+                        add = True
                     else:
-                        if action == 'catadd':
-                            add = True
-                        else:
-                            add = False
+                        add = False
                         
-                        newfid = self.parent.parent.digit.SetLineCats(fid, layer,
+                    newfid = self.parent.parent.digit.SetLineCats(fid, layer,
                                                                       catList, add)
-                        if len(self.cats.keys()) == 1:
-                            self.fidText.SetLabel("%d" % newfid)
-                        else:
-                            choices = self.fidMulti.GetItems()
-                            choices[choices.index(str(fid))] = str(newfid)
-                            self.fidMulti.SetItems(choices)
-                            self.fidMulti.SetStringSelection(str(newfid))
-                            
-                        self.cats[newfid] = self.cats[fid]
-                        del self.cats[fid]
-                        
-                        fid = newfid
-                        if self.fid < 0:
-                            wx.MessageBox(parent=self, message=_("Unable to update vector map."),
-                                          caption=_("Error"), style=wx.OK | wx.ICON_ERROR)
-        if UserSettings.Get(group='advanced', key='digitInterface', subkey='type') == 'vedit':           
-            # reload map (needed for v.edit)
-            self.parent.parent.digit.driver.ReloadMap()
-
+                    if len(self.cats.keys()) == 1:
+                        self.fidText.SetLabel("%d" % newfid)
+                    else:
+                        choices = self.fidMulti.GetItems()
+                        choices[choices.index(str(fid))] = str(newfid)
+                        self.fidMulti.SetItems(choices)
+                        self.fidMulti.SetStringSelection(str(newfid))
+                    
+                    self.cats[newfid] = self.cats[fid]
+                    del self.cats[fid]
+                    
+                    fid = newfid
+                    if self.fid < 0:
+                        wx.MessageBox(parent=self, message=_("Unable to update vector map."),
+                                      caption=_("Error"), style=wx.OK | wx.ICON_ERROR)
+        
         self.cats_orig[fid] = copy.deepcopy(cats)
         
         return newfid

Modified: grass/trunk/gui/wxpython/gui_modules/wxgui_utils.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/wxgui_utils.py	2008-09-29 09:10:48 UTC (rev 33588)
+++ grass/trunk/gui/wxpython/gui_modules/wxgui_utils.py	2008-09-29 09:18:16 UTC (rev 33589)
@@ -244,7 +244,8 @@
             self.popupID11 = wx.NewId() # nviz
             self.popupID12 = wx.NewId()
             self.popupID13 = wx.NewId()
-            
+            self.popupID14 = wx.NewId()
+
         self.popupMenu = wx.Menu()
         # general item
         self.popupMenu.Append(self.popupID1, text=_("Remove"))
@@ -294,14 +295,34 @@
                 self.popupMenu.Enable (self.popupID5, False)
                 self.popupMenu.Enable (self.popupID6, False)
             elif digitToolbar and digitToolbar.GetLayer():
+                # background vector map
+                self.popupMenu.Append(self.popupID14,
+                                      text=_("Use as background vector map"),
+                                      kind=wx.ITEM_CHECK)
+                self.Bind(wx.EVT_MENU, self.OnSetBgMap, id=self.popupID14)
+
                 # vector map already edited
-                if digitToolbar.GetLayer() is layer:
+                vdigitLayer = digitToolbar.GetLayer()
+                if vdigitLayer is layer:
+                    # disable 'start editing'
                     self.popupMenu.Enable (self.popupID5, False)
+                    # enable 'stop editing'
                     self.popupMenu.Enable(self.popupID6, True)
+                    # disable 'remove'
                     self.popupMenu.Enable(self.popupID1, False)
+                    # disable 'bgmap'
+                    self.popupMenu.Enable(self.popupID14, False)
                 else:
+                    # disable 'start editing'
                     self.popupMenu.Enable(self.popupID5, False)
+                    # disable 'stop editing'
                     self.popupMenu.Enable(self.popupID6, False)
+                    # enable 'bgmap'
+                    self.popupMenu.Enable(self.popupID14, True)
+                    if UserSettings.Get(group='vdigit', key='bgmap', subkey='value',
+                                        internal=True) == layer.GetName():
+                        self.popupMenu.Check(self.popupID14, True)
+                
             self.popupMenu.Append(self.popupID7, _("Metadata"))
             self.Bind (wx.EVT_MENU, self.OnMetadata, id=self.popupID7)
 
@@ -431,7 +452,7 @@
 
         return True
 
-    def OnStartEditing (self, event):
+    def OnStartEditing(self, event):
         """
         Start editing vector map layer requested by the user
         """
@@ -449,7 +470,7 @@
         # mark layer as 'edited'
         self.mapdisplay.toolbars['vdigit'].StartEditing (maplayer)
 
-    def OnStopEditing (self, event):
+    def OnStopEditing(self, event):
         """
         Stop editing the current vector map layer
         """
@@ -462,6 +483,16 @@
         self.mapdisplay.toolbars['vdigit'].OnExit()
         self.mapdisplay.imgVectorMap = None
 
+    def OnSetBgMap(self, event):
+        """Set background vector map for editing sesstion"""
+        if event.IsChecked():
+            mapName = self.GetPyData(self.layer_selected)[0]['maplayer'].GetName()
+            UserSettings.Set(group='vdigit', key='bgmap', subkey='value',
+                             value=str(mapName), internal=True)
+        else:
+            UserSettings.Set(group='vdigit', key='bgmap', subkey='value',
+                             value='', internal=True)
+        
     def OnPopupProperties (self, event):
         """Popup properties dialog"""
         self.PropertiesDialog(self.layer_selected)

Modified: grass/trunk/gui/wxpython/vdigit/cats.cpp
===================================================================
--- grass/trunk/gui/wxpython/vdigit/cats.cpp	2008-09-29 09:10:48 UTC (rev 33588)
+++ grass/trunk/gui/wxpython/vdigit/cats.cpp	2008-09-29 09:18:16 UTC (rev 33589)
@@ -162,7 +162,7 @@
     struct line_cats *Cats;
 
     if (!display->mapInfo) {
-	DisplayMsg();
+	display->DisplayMsg();
 	return lc;
     }
 
@@ -177,7 +177,7 @@
     }
 
     if (!Vect_line_alive(display->mapInfo, line)) {
-	DeadLineMsg(line);
+	display->DeadLineMsg(line);
 	return lc;
     }
 
@@ -185,7 +185,7 @@
 
     if (Vect_read_line(display->mapInfo, NULL, Cats, line) < 0) {
 	Vect_destroy_cats_struct(Cats);
-	ReadLineMsg(line);
+	display->ReadLineMsg(line);
 	return lc;
     }
     
@@ -220,12 +220,12 @@
     struct line_cats *Cats;
 
     if (!display->mapInfo) {
-	DisplayMsg();
+	display->DisplayMsg();
 	return -1;
     }
 
     if (line_id == -1 && display->selected.values->n_values < 1) {
-	GetLineCatsMsg(line_id);
+	display->GetLineCatsMsg(line_id);
 	return -1;
     }
     
@@ -237,7 +237,7 @@
     }
 
     if (!Vect_line_alive(display->mapInfo, line)) {
-	DeadLineMsg(line);
+	display->DeadLineMsg(line);
 	return -1;
     }
 
@@ -247,7 +247,7 @@
     if (type < 0) {
 	Vect_destroy_line_struct(Points);
 	Vect_destroy_cats_struct(Cats);
-	ReadLineMsg(line);
+	display->ReadLineMsg(line);
 	return -1;
     }
 
@@ -324,7 +324,7 @@
 
 	type = Vect_read_line(display->mapInfo, NULL, Cats_from, fline);
 	if (type < 0) {
-	    ReadLineMsg(fline);
+	    display->ReadLineMsg(fline);
 	    return -1;
 	}
 
@@ -337,7 +337,7 @@
 
 	    type = Vect_read_line(display->mapInfo, Points, Cats_to, tline);
 	    if (type < 0) {
-		ReadLineMsg(tline);
+		display->ReadLineMsg(tline);
 		return -1;
 	    }
 
@@ -364,13 +364,13 @@
 		    fi = Vect_get_field(display->mapInfo, Cats_from->field[i]);
 
 		    if (fi == NULL) {
-			DblinkMsg(Cats_from->field[i]);
+			display->DblinkMsg(Cats_from->field[i]);
 			return -1;
 		    }
 		    
 		    driver = db_start_driver(fi->driver);
 		    if (driver == NULL) {
-			DbDriverMsg(fi->driver);
+			display->DbDriverMsg(fi->driver);
 			return -1;
 		    }
 		    
@@ -378,7 +378,7 @@
 		    db_set_handle (&handle, fi->database, NULL);
 		    if (db_open_database(driver, &handle) != DB_OK) {
 			db_shutdown_driver(driver);
-			DbDatabaseMsg(fi->driver, fi->database);
+			display->DbDatabaseMsg(fi->driver, fi->database);
 			return -1;
 		    }
 
@@ -390,7 +390,7 @@
 		    if (db_open_select_cursor(driver, &stmt, &cursor, DB_SEQUENTIAL) != DB_OK) {
 			db_close_database(driver);
 			db_shutdown_driver(driver);
-			DbSelectCursorMsg(db_get_string(&stmt));
+			display->DbSelectCursorMsg(db_get_string(&stmt));
 			return -1;
 		    }
 
@@ -442,7 +442,7 @@
 		    if (db_execute_immediate (driver, &stmt) != DB_OK ) {
 			db_close_database(driver);
 			db_shutdown_driver(driver);
-			DbExecuteMsg(db_get_string(&stmt));
+			display->DbExecuteMsg(db_get_string(&stmt));
 			return -1;
 		    }
 		    
@@ -456,7 +456,7 @@
 	    }
 	    
 	    if (Vect_rewrite_line(display->mapInfo, tline, type, Points, Cats_to) < 0) {
-		WriteLineMsg();
+		display->WriteLineMsg();
 		return -1;
 	    }
 	

Modified: grass/trunk/gui/wxpython/vdigit/digit.cpp
===================================================================
--- grass/trunk/gui/wxpython/vdigit/digit.cpp	2008-09-29 09:10:48 UTC (rev 33588)
+++ grass/trunk/gui/wxpython/vdigit/digit.cpp	2008-09-29 09:18:16 UTC (rev 33589)
@@ -26,7 +26,7 @@
 Digit::Digit(DisplayDriver *ddriver, void *window)
 {
     display = ddriver;
-    parentWin = (wxWindow *) window;
+    display->parentWin = (wxWindow *) window;
 
     if (display->mapInfo) {
 	InitCats();
@@ -34,7 +34,7 @@
 
     changesetCurrent = -1; // initial value for undo/redo
 
-    msgCaption = _("Digitization error");
+    display->msgCaption = _("Digitization error");
     
     // avoid GUI crash
     // Vect_set_fatal_error(GV_FATAL_PRINT);

Modified: grass/trunk/gui/wxpython/vdigit/digit.h
===================================================================
--- grass/trunk/gui/wxpython/vdigit/digit.h	2008-09-29 09:10:48 UTC (rev 33588)
+++ grass/trunk/gui/wxpython/vdigit/digit.h	2008-09-29 09:18:16 UTC (rev 33589)
@@ -13,7 +13,6 @@
     std::map<int, int> cats;
 
     DisplayDriver *display;
-    wxWindow *parentWin;
     
     int SetCategory(int, int);
     struct Map_info** OpenBackgroundVectorMap(const char *);
@@ -43,21 +42,6 @@
     void FreeChangeset(int);
     int RemoveActionFromChangeset(int, action_type, int);
 
-    /* message dialogs */
-    wxString msgCaption;
-    void DisplayMsg(void);
-    void Only2DMsg(void);
-    void ReadLineMsg(int);
-    void DeadLineMsg(int);
-    void WriteLineMsg(void);
-    void BackgroundMapMsg(const char *);
-    void DblinkMsg(int);
-    void DbDriverMsg(const char *);
-    void DbDatabaseMsg(const char *, const char *);
-    void DbExecuteMsg(const char *);
-    void DbSelectCursorMsg(const char *);
-    void GetLineCatsMsg(int);
-
 public:
     Digit(DisplayDriver *, void *);
     ~Digit();

Modified: grass/trunk/gui/wxpython/vdigit/digit.i
===================================================================
--- grass/trunk/gui/wxpython/vdigit/digit.i	2008-09-29 09:10:48 UTC (rev 33588)
+++ grass/trunk/gui/wxpython/vdigit/digit.i	2008-09-29 09:18:16 UTC (rev 33589)
@@ -19,5 +19,9 @@
 namespace std { 
    %template(IntVecIntMap) map<int, vector<int> >;
 }
+namespace std { 
+   %template(DoubleVecIntMap) map<int, vector<double> >;
+}
+
 %include "driver.h"
 %include "digit.h"
\ No newline at end of file

Modified: grass/trunk/gui/wxpython/vdigit/driver.h
===================================================================
--- grass/trunk/gui/wxpython/vdigit/driver.h	2008-09-29 09:10:48 UTC (rev 33588)
+++ grass/trunk/gui/wxpython/vdigit/driver.h	2008-09-29 09:18:16 UTC (rev 33589)
@@ -35,7 +35,8 @@
 private:
     friend class Digit;
     wxPseudoDC *dc, *dcTmp;  // device content
-
+    wxWindow *parentWin;
+    
     /* disabled due to expensive calling dc->SetId()
      *
      * currently all objects are drawn without id
@@ -56,7 +57,7 @@
     bool drawSelected;
 
     bool drawSegments;         // draw segments of selected line
-
+    
     struct Map_info  *mapInfo;
     struct line_pnts *points;       // east, north, depth
     wxList           *pointsScreen; // x, y, z
@@ -157,6 +158,21 @@
 
     void ResetTopology();
 
+    /* message dialogs */
+    wxString msgCaption;
+    void DisplayMsg(void);
+    void Only2DMsg(void);
+    void ReadLineMsg(int);
+    void DeadLineMsg(int);
+    void WriteLineMsg(void);
+    void BackgroundMapMsg(const char *);
+    void DblinkMsg(int);
+    void DbDriverMsg(const char *);
+    void DbDatabaseMsg(const char *, const char *);
+    void DbExecuteMsg(const char *);
+    void DbSelectCursorMsg(const char *);
+    void GetLineCatsMsg(int);
+    
 public:
     /* constructor */
     DisplayDriver(void *, void *);
@@ -168,11 +184,12 @@
 
     /* select */
     int SelectLinesByBox(double, double, double, double,
-			 double, double, int, bool);
+			 double, double, int, bool, bool);
     std::vector<double> SelectLineByPoint(double, double, double,
 					  double, int, int);
 
     std::vector<int> GetSelected(bool);
+    std::map<int, std::vector<double> > GetSelectedCoord();
     std::map<int, std::vector <int> > GetDuplicates();
     std::vector<double> GetRegionSelected();
     int SetSelected(std::vector<int>, bool);

Modified: grass/trunk/gui/wxpython/vdigit/driver_draw.cpp
===================================================================
--- grass/trunk/gui/wxpython/vdigit/driver_draw.cpp	2008-09-29 09:10:48 UTC (rev 33588)
+++ grass/trunk/gui/wxpython/vdigit/driver_draw.cpp	2008-09-29 09:18:16 UTC (rev 33589)
@@ -23,7 +23,7 @@
 /**
    \brief Draw content of the vector map to device
    
-   \return number of lines which were drawn
+   \return number of drawn features
    \return -1 on error
  */
 int DisplayDriver::DrawMap(bool force)

Modified: grass/trunk/gui/wxpython/vdigit/driver_select.cpp
===================================================================
--- grass/trunk/gui/wxpython/vdigit/driver_select.cpp	2008-09-29 09:10:48 UTC (rev 33588)
+++ grass/trunk/gui/wxpython/vdigit/driver_select.cpp	2008-09-29 09:18:16 UTC (rev 33589)
@@ -37,7 +37,7 @@
 */
 int DisplayDriver::SelectLinesByBox(double x1, double y1, double z1, 
 				    double x2, double y2, double z2,
-				    int type, bool onlyInside)
+				    int type, bool onlyInside, bool drawSeg)
 {
     if (!mapInfo)
 	return -1;
@@ -47,7 +47,7 @@
     struct ilist *list;
     struct line_pnts *bbox;
 
-    drawSegments = false;
+    drawSegments = drawSeg;
     drawSelected = true;
 
     selected.isId = true;
@@ -167,7 +167,9 @@
     }
 	
     Vect_destroy_list(found);
-    
+
+    // drawing segments can be very expensive
+    // only one features selected
     drawSegments = true;
 
     return p;
@@ -217,9 +219,11 @@
 	dc_ids.push_back(1);
     }
     else {
+	// only first selected feature !
 	int npoints;
 	Vect_read_line(mapInfo, points, NULL, selected.values->value[0]);
 	npoints = points->n_points;
+	// node - segment - vertex - segment - node
 	for (int i = 1; i < 2 * npoints; i++) {
 	  dc_ids.push_back(i);
 	}
@@ -228,6 +232,34 @@
     return dc_ids;
 }
 
+std::map<int, std::vector<double> > DisplayDriver::GetSelectedCoord()
+{
+  std::map<int, std::vector<double> > ret;
+  int id, npoints;
+
+  id = 1;
+  
+  for (int is = 0; is < selected.values->n_values; is++) {
+      if (Vect_read_line(mapInfo, points, NULL, selected.values->value[is]) < 0) {
+	  ReadLineMsg(selected.values->value[is]);
+	  return ret;
+      }
+      
+      npoints = points->n_points;
+      for (int i = 0; i < points->n_points; i++, id += 2) {
+	  std::vector<double> c;
+	  c.push_back(points->x[i]);
+	  c.push_back(points->y[i]);
+	  c.push_back(points->z[i]);
+	  ret[id] = c;
+      }
+      id--;
+  }
+  
+  return ret;
+}
+
+
 /**
    \brief Get feature (grass) ids of duplicated objects
 

Modified: grass/trunk/gui/wxpython/vdigit/line.cpp
===================================================================
--- grass/trunk/gui/wxpython/vdigit/line.cpp	2008-09-29 09:10:48 UTC (rev 33588)
+++ grass/trunk/gui/wxpython/vdigit/line.cpp	2008-09-29 09:18:16 UTC (rev 33589)
@@ -51,7 +51,7 @@
     int nbgmaps;             /* number of registrated background maps */
 
     if (!display->mapInfo) {
-	DisplayMsg();
+	display->DisplayMsg();
 	return -1;
     }
 
@@ -59,8 +59,8 @@
     if (coords.size() != npoints * (Vect_is_3d(display->mapInfo) ? 3 : 2)) {
 	wxString msg;
 	msg.Printf(_("Incorrent number of points (%d)"), coords.size());
-	wxMessageDialog dlg(parentWin, msg,
-			    msgCaption, wxOK | wxICON_ERROR | wxCENTRE);
+	wxMessageDialog dlg(display->parentWin, msg,
+			    display->msgCaption, wxOK | wxICON_ERROR | wxCENTRE);
 	dlg.ShowModal();
 	return -1;
     }
@@ -70,7 +70,7 @@
 
     /* TODO: 3D */
     if (!(type & (GV_POINTS | GV_LINES))) {
-	Only2DMsg();
+	display->Only2DMsg();
 	return -1;
     }
 
@@ -79,7 +79,7 @@
     if (bgmap && strlen(bgmap) > 0) {
 	BgMap = OpenBackgroundVectorMap(bgmap);
 	if (!BgMap) {
-	    BackgroundMapMsg(bgmap);
+	    display->BackgroundMapMsg(bgmap);
 	    return -1;
 	}
 	else {
@@ -130,7 +130,7 @@
 
     newline = Vect_write_line(display->mapInfo, type, Points, Cats);
     if (newline < 0) {
-	WriteLineMsg();
+	display->WriteLineMsg();
 	return -1;
     }
 
@@ -178,13 +178,13 @@
     int nbgmaps;             /* number of registrated background maps */
 
     if (!display->mapInfo) {
-	DisplayMsg();
+	display->DisplayMsg();
 	return -1;
     }
 
     /* line alive ? */
     if (!Vect_line_alive(display->mapInfo, line)) {
-	WriteLineMsg();
+	display->WriteLineMsg();
 	return -1;
     }
 
@@ -193,7 +193,7 @@
     if (bgmap && strlen(bgmap) > 0) {
 	BgMap = OpenBackgroundVectorMap(bgmap);
 	if (!BgMap) {
-	    BackgroundMapMsg(bgmap);
+	    display->BackgroundMapMsg(bgmap);
 	    return -1;
 	}
 	else {
@@ -211,7 +211,7 @@
 	    Vect_close(BgMap[0]);
 	}
 	
-	ReadLineMsg(line);
+	display->ReadLineMsg(line);
 	
 	return -1;
     }
@@ -256,7 +256,7 @@
     }
 
     if (newline < 0)
-	WriteLineMsg();
+	display->WriteLineMsg();
     
     Vect_destroy_line_struct(points);
     Vect_destroy_cats_struct(cats);
@@ -289,7 +289,7 @@
     struct ilist *list;
 
     if (!display->mapInfo) {
-	DisplayMsg();
+	display->DisplayMsg();
 	return -1;
     }
 
@@ -335,7 +335,7 @@
     struct line_cats *Cats, *Cats_del;
 
     if (!display->mapInfo) {
-	DisplayMsg();
+	display->DisplayMsg();
 	return -1;
     }
 
@@ -349,7 +349,7 @@
 	for (int i = 0; i < display->selected.values->n_values; i++) {
 	    if (Vect_read_line(display->mapInfo, NULL, Cats, display->selected.values->value[i]) < 0) {
 		Vect_destroy_cats_struct(Cats_del);
-		ReadLineMsg(display->selected.values->value[i]);
+		display->ReadLineMsg(display->selected.values->value[i]);
 		return -1;
 	    }
 	    for (int j = 0; j < Cats->n_cats; j++) {
@@ -390,20 +390,20 @@
 	for (int dblink = 0; dblink < n_dblinks; dblink++) {
 	    fi = Vect_get_dblink(display->mapInfo, dblink);
 	    if (fi == NULL) {
-		DblinkMsg(dblink+1);
+		display->DblinkMsg(dblink+1);
 		return -1;
 	    }
 
 	    driver = db_start_driver(fi->driver);
 	    if (driver == NULL) {
-		DbDriverMsg(fi->driver);
+		display->DbDriverMsg(fi->driver);
 		return -1;
 	    }
 
 	    db_init_handle (&handle);
 	    db_set_handle (&handle, fi->database, NULL);
 	    if (db_open_database(driver, &handle) != DB_OK) {
-		DbDatabaseMsg(fi->driver, fi->database);
+		display->DbDatabaseMsg(fi->driver, fi->database);
 		return -1;
 	    }
 
@@ -427,7 +427,7 @@
 
 	    if (n_cats &&
 		db_execute_immediate (driver, &stmt) != DB_OK ) {
-		DbExecuteMsg(db_get_string(&stmt));
+		display->DbExecuteMsg(db_get_string(&stmt));
 		return -1;
 	    }
 	    
@@ -467,7 +467,7 @@
     int nbgmaps;             /* number of registrated background maps */
 
     if (!display->mapInfo) {
-	DisplayMsg();
+	display->DisplayMsg();
 	return -1;
     }
 
@@ -476,7 +476,7 @@
     if (bgmap && strlen(bgmap) > 0) {
 	BgMap = OpenBackgroundVectorMap(bgmap);
 	if (!BgMap) {
-	    BackgroundMapMsg(bgmap);
+	    display->BackgroundMapMsg(bgmap);
 	    return -1;
 	}
 	else {
@@ -526,7 +526,7 @@
     int changeset, nlines;
 
     if (!display->mapInfo) {
-	DisplayMsg();
+	display->DisplayMsg();
 	return -1;
     }
 
@@ -560,7 +560,7 @@
     int changeset, nlines;
 
     if (!display->mapInfo) {
-	DisplayMsg();
+	display->DisplayMsg();
 	return -1;
     }
 
@@ -594,7 +594,7 @@
     int changeset, nlines;
 
     if (!display->mapInfo) {
-	DisplayMsg();
+	display->DisplayMsg();
 	return -1;
     }
 
@@ -630,7 +630,7 @@
     int changeset, nlines;
     
     if (!display->mapInfo) {
-	DisplayMsg();
+	display->DisplayMsg();
 	return -1;
     }
 
@@ -663,7 +663,7 @@
     int changeset, nlines;
 
     if (!display->mapInfo) {
-	DisplayMsg();
+	display->DisplayMsg();
 	return -1;
     }
 
@@ -706,7 +706,7 @@
     int changeset, nlines;
 
     if (!display->mapInfo) {
-	DisplayMsg();
+	display->DisplayMsg();
 	return -1;
     }
 
@@ -748,7 +748,7 @@
     list = NULL;
 
     if (!display->mapInfo) {
-	DisplayMsg();
+	display->DisplayMsg();
 	return -1;
     }
 
@@ -869,7 +869,7 @@
     int changeset, nlines;
 
     if (!display->mapInfo) {
-	DisplayMsg();
+	display->DisplayMsg();
 	return -1;
     }
 
@@ -914,7 +914,7 @@
     if (!points_line) {
 	points = Vect_new_line_struct();
 	if (Vect_read_line(display->mapInfo, points, NULL, line) < 0) {
-	    ReadLineMsg(line);
+	    display->ReadLineMsg(line);
 	    return -1;
 	}
     }

Modified: grass/trunk/gui/wxpython/vdigit/message.cpp
===================================================================
--- grass/trunk/gui/wxpython/vdigit/message.cpp	2008-09-29 09:10:48 UTC (rev 33588)
+++ grass/trunk/gui/wxpython/vdigit/message.cpp	2008-09-29 09:18:16 UTC (rev 33589)
@@ -20,7 +20,7 @@
 /**
    \brief Error message - no display driver available
 */
-void Digit::DisplayMsg(void)
+void DisplayDriver::DisplayMsg(void)
 {
     wxMessageDialog dlg(parentWin, _("Display driver not available."),
 			msgCaption, wxOK | wxICON_ERROR | wxCENTRE);
@@ -32,7 +32,7 @@
 /**
    \brief Error message - cannot edit 3d features
 */
-void Digit::Only2DMsg(void)
+void DisplayDriver::Only2DMsg(void)
 {
     wxMessageDialog dlg(parentWin, _("3D vector features are not currently supported."),
 			msgCaption, wxOK | wxICON_ERROR | wxCENTRE);
@@ -44,7 +44,7 @@
 /**
    \brief Error message - unable to write line
 */
-void Digit::WriteLineMsg(void)
+void DisplayDriver::WriteLineMsg(void)
 {
     wxMessageDialog dlg(parentWin, _("Unable to write new line"),
 			msgCaption, wxOK | wxICON_ERROR | wxCENTRE);
@@ -58,7 +58,7 @@
 
    \param line line id
 */
-void Digit::ReadLineMsg(int line)
+void DisplayDriver::ReadLineMsg(int line)
 {
     wxString msg;
     msg.Printf(_("Unable to read line %d"), line);
@@ -74,7 +74,7 @@
 
    \param line line id
 */
-void Digit::DeadLineMsg(int line)
+void DisplayDriver::DeadLineMsg(int line)
 {
     wxString msg;
     msg.Printf(_("Unable to read line %d, line is dead"), line);
@@ -90,7 +90,7 @@
 
    \param bgmap map name
 */
-void Digit::BackgroundMapMsg(const char *bgmap)
+void DisplayDriver::BackgroundMapMsg(const char *bgmap)
 {
     wxString msg;
     msg.Printf(_("Unable to open background vector map <%s>. "
@@ -108,7 +108,7 @@
 
    \param layer layer id
 */
-void Digit::DblinkMsg(int layer)
+void DisplayDriver::DblinkMsg(int layer)
 {
     wxString msg;
     msg.Printf(_("Database connection not defined for layer %d"), layer);
@@ -124,7 +124,7 @@
 
    \param driver driver name
 */
-void Digit::DbDriverMsg(const char *driver)
+void DisplayDriver::DbDriverMsg(const char *driver)
 {
     wxString msg;
     msg.Printf(_("Unable to start driver <%s>"),
@@ -142,7 +142,7 @@
    \param driver driver name
    \param database database name
 */
-void Digit::DbDatabaseMsg(const char *driver, const char *database)
+void DisplayDriver::DbDatabaseMsg(const char *driver, const char *database)
 {
     wxString msg;
     msg.Printf(_("Unable to open database <%s> by driver <%s>"),
@@ -160,7 +160,7 @@
 
    \param sql sql command
 */
-void Digit::DbExecuteMsg(const char *sql)
+void DisplayDriver::DbExecuteMsg(const char *sql)
 {
     wxString msg;
     msg.Printf(_("Unable to execute: '%s'"),
@@ -177,7 +177,7 @@
 
    \param sql sql command
 */
-void Digit::DbSelectCursorMsg(const char *sql)
+void DisplayDriver::DbSelectCursorMsg(const char *sql)
 {
     wxString msg;
     msg.Printf(_("Unable to open select cursor: '%s'"),
@@ -194,7 +194,7 @@
 
    \param line line id
 */
-void Digit::GetLineCatsMsg(int line)
+void DisplayDriver::GetLineCatsMsg(int line)
 {
     wxString msg;
     msg.Printf(_("Unable to get feature (%d) categories"), line);

Modified: grass/trunk/gui/wxpython/vdigit/select.cpp
===================================================================
--- grass/trunk/gui/wxpython/vdigit/select.cpp	2008-09-29 09:10:48 UTC (rev 33588)
+++ grass/trunk/gui/wxpython/vdigit/select.cpp	2008-09-29 09:18:16 UTC (rev 33589)
@@ -49,7 +49,7 @@
     struct line_pnts *bbox;
 
     if (!display->mapInfo) {
-	DisplayMsg();
+	display->DisplayMsg();
 	return ids;
     }
 

Modified: grass/trunk/gui/wxpython/vdigit/undo.cpp
===================================================================
--- grass/trunk/gui/wxpython/vdigit/undo.cpp	2008-09-29 09:10:48 UTC (rev 33588)
+++ grass/trunk/gui/wxpython/vdigit/undo.cpp	2008-09-29 09:18:16 UTC (rev 33589)
@@ -146,12 +146,12 @@
     long offset;
 
     if (!display->mapInfo) {
-	DisplayMsg();
+	display->DisplayMsg();
 	return -1;
     }
 
     if (!Vect_line_alive(display->mapInfo, line)) {
-	// DeadLineMsg(line);
+	// display->DeadLineMsg(line);
 	return -1;
     }
 

Modified: grass/trunk/gui/wxpython/vdigit/vertex.cpp
===================================================================
--- grass/trunk/gui/wxpython/vdigit/vertex.cpp	2008-09-29 09:10:48 UTC (rev 33588)
+++ grass/trunk/gui/wxpython/vdigit/vertex.cpp	2008-09-29 09:18:16 UTC (rev 33589)
@@ -40,12 +40,13 @@
 		      double thresh_coords, double thresh_snap) {
 
     int ret;
+    int changeset, nlines;
     struct line_pnts *point;
     struct Map_info **BgMap; /* backgroud vector maps */
     int nbgmaps;             /* number of registrated background maps */
 
     if (!display->mapInfo) {
-	DisplayMsg();
+	display->DisplayMsg();
 	return -1;
     }
 
@@ -57,7 +58,7 @@
     if (bgmap && strlen(bgmap) > 0) {
 	BgMap = OpenBackgroundVectorMap(bgmap);
 	if (!BgMap) {
-	    BackgroundMapMsg(bgmap);
+	    display->BackgroundMapMsg(bgmap);
 	    return -1;
 	}
 	else {
@@ -68,9 +69,10 @@
     point = Vect_new_line_struct();
     Vect_append_point(point, x, y, z);
 
-    /* register changeset */
-    // AddActionToChangeset(changesets.size(), REWRITE, display->selected.values->value[0]);
+    nlines = Vect_get_num_lines(display->mapInfo);
 
+    changeset = AddActionsBefore();
+
     /* move only first found vertex in bbox */
     ret = Vedit_move_vertex(display->mapInfo, BgMap, nbgmaps, 
 			    display->selected.values,
@@ -78,19 +80,17 @@
 			    move_x, move_y, move_z,
 			    1, snap);
 
-    if (settings.breakLines && ret > 0) {
-	BreakLineAtIntersection(Vect_get_num_lines(display->mapInfo), NULL, 1);
-    }
-
-    /* TODO
     if (ret > 0) {
-	changesets[changesets.size()-1][0].line = Vect_get_num_lines(display->mapInfo);
+	AddActionsAfter(changeset, nlines);
     }
     else {
-	changesets.erase(changesets.size()-1);
+	changesets.erase(changeset);
     }
-    */
     
+    if (ret > 0 && settings.breakLines) {
+	BreakLineAtIntersection(Vect_get_num_lines(display->mapInfo), NULL, changeset);
+    }
+
     if (BgMap && BgMap[0]) {
 	Vect_close(BgMap[0]);
     }
@@ -117,10 +117,11 @@
 			    double thresh)
 {
     int ret;
+    int changeset, nlines;
     struct line_pnts *point;
 
     if (!display->mapInfo) {
-	DisplayMsg();
+	display->DisplayMsg();
 	return -1;
     }
 
@@ -130,9 +131,10 @@
     point = Vect_new_line_struct();
     Vect_append_point(point, x, y, z);
 
-    /* register changeset */
-    // AddActionToChangeset(changesets.size(), REWRITE, display->selected.values->value[0]);
+    nlines = Vect_get_num_lines(display->mapInfo);
 
+    changeset = AddActionsBefore();
+
     if (add) {
 	ret = Vedit_add_vertex(display->mapInfo, display->selected.values,
 			       point, thresh);
@@ -142,15 +144,17 @@
 				  point, thresh);
     }
 
-    /* TODO 
     if (ret > 0) {
-	changesets[changesets.size()-1][0].line = Vect_get_num_lines(display->mapInfo);
+	AddActionsAfter(changeset, nlines);
     }
     else {
-	changesets.erase(changesets.size()-1);
+	changesets.erase(changeset);
     }
-    */
     
+    if (!add && ret > 0 && settings.breakLines) {
+	BreakLineAtIntersection(Vect_get_num_lines(display->mapInfo), NULL, changeset);
+    }
+
     Vect_destroy_line_struct(point);
 
     return ret;



More information about the grass-commit mailing list