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

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Jan 21 13:29:06 EST 2008


Author: martinl
Date: 2008-01-21 13:29:06 -0500 (Mon, 21 Jan 2008)
New Revision: 29789

Modified:
   grass/trunk/gui/wxpython/gui_modules/dbm.py
   grass/trunk/gui/wxpython/gui_modules/digit.py
   grass/trunk/gui/wxpython/gui_modules/gcmd.py
   grass/trunk/gui/wxpython/gui_modules/mapdisp.py
   grass/trunk/gui/wxpython/gui_modules/toolbars.py
   grass/trunk/gui/wxpython/vdigit/Makefile.in
   grass/trunk/gui/wxpython/vdigit/dig_types.i
   grass/trunk/gui/wxpython/vdigit/digit.h
   grass/trunk/gui/wxpython/vdigit/line.cpp
Log:
wxGUI: vdigit interface improved (vedit is still default). Basic exceptions defined (vdigit, gcmd).

Modified: grass/trunk/gui/wxpython/gui_modules/dbm.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/dbm.py	2008-01-21 18:20:44 UTC (rev 29788)
+++ grass/trunk/gui/wxpython/gui_modules/dbm.py	2008-01-21 18:29:06 UTC (rev 29789)
@@ -2670,9 +2670,12 @@
 
             wx.MessageBox(parent=self.parent,
                           message=_("No attribute table linked to "
-                                    "vector map <%s> found.%s"
-                                    "%s") % (self.map, os.linesep, label),
-                          caption=_("Error"), style=wx.OK | wx.ICON_ERROR | wx.CENTRE)
+                                    "vector map <%s> found. %s "
+                                    "%sYou can disable this message from digitization settings. Or "
+                                    "you can create and link attribute table to the vector map "
+                                    "using Attribute Table Manager.") % \
+                              (self.map, label, os.linesep),
+                          caption=_("Message"), style=wx.OK | wx.ICON_EXCLAMATION | wx.CENTRE)
             self.mapDBInfo = None
             return
 
@@ -2994,8 +2997,8 @@
         """Check DB connection"""
         layerCommand = gcmd.Command(cmd=["v.db.connect",
                                          "-g", "--q",
-                                        "map=%s" % self.map,],
-                                    log=None)
+                                         "map=%s" % self.map,],
+                                    rerr=None, stderr=None)
         if layerCommand.returncode != 0:
             return False
 

Modified: grass/trunk/gui/wxpython/gui_modules/digit.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/digit.py	2008-01-21 18:20:44 UTC (rev 29788)
+++ grass/trunk/gui/wxpython/gui_modules/digit.py	2008-01-21 18:29:06 UTC (rev 29789)
@@ -59,18 +59,6 @@
 #
 USEVEDIT = True
 
-class DigitError(Exception):
-    def __init__(self, message):
-        self.message = message
-
-    def __str__(self):
-        wx.MessageBox(parent=None,
-                      caption=_("Error in digitization tool"),
-                      message=self.message,
-                      style=wx.ICON_ERROR)
-
-        return ''
-
 class AbstractDigit:
     """
     Abstract digitization class
@@ -181,10 +169,10 @@
 
         ret = self.driver.Reset(self.map)
         if map and ret == -1:
-            raise DigitError(_('Unable to open vector map <%s> for editing. The vector map is probably broken. '
+            raise gcmd.DigitError(_('Unable to open vector map <%s> for editing. The vector map is probably broken. '
                                'Try to run v.build for rebuilding the topology.') % map)
         if not map and ret != 0:
-            raise DigitError(_('Closing vector map <%s> failed. The vector map is probably broken. '
+            raise gcmd.DigitError(_('Closing vector map <%s> failed. The vector map is probably broken. '
                                'Try to run v.build for rebuilding the topology.') % map)
             
         if not USEVEDIT:
@@ -192,7 +180,22 @@
                 self.digit.InitCats()
             except:
                 pass
-        
+
+    def SelectLinesByQueryThresh(self):
+        """Generic method used for SelectLinesByQuery()
+        -- to get threshold value"""
+        thresh = 0.0
+        if self.settings['query'][0] == "length":
+            thresh = self.settings['queryLength'][1]
+            if self.settings["queryLength"][0] == "shorter than":
+                thresh = -1 * thresh
+        else:
+            thresh = self.settings['queryDangle'][1]
+            if self.settings["queryDangle"][0] == "shorter than":
+                thresh = -1 * thresh
+
+        return thresh
+
 class VEdit(AbstractDigit):
     """
     Prototype of digitization class based on v.edit command
@@ -640,15 +643,8 @@
 
         @param pos1, pos2 bounding box definition
         """
-        if self.settings['query'][0] == "length":
-            thresh = self.settings['queryLength'][1]
-            if self.settings["queryLength"][0] == "shorter than":
-                thresh = -1 * thresh
-        else:
-            thresh = self.settings['queryDangle'][1]
-            if self.settings["queryDangle"][0] == "shorter than":
-                thresh = -1 * thresh
-
+        thresh = self.SelectLinesByQueryThresh()
+        
         w, n = pos1
         e, s = pos2
 
@@ -674,10 +670,6 @@
                   'query=%s' % self.settings['query'][0],
                   'thresh=%f' % thresh])
 
-        if self.settings['query'] == "length" and \
-                self.settings['queryLength'][0] == "longer than":
-            vEdit.append('-r') # FIXBUG: reverse selection regardless of bbox
-
         vEditCmd = gcmd.Command(vEdit)
         
         try:
@@ -736,7 +728,7 @@
                                      str(self.settings["backgroundMap"]), snap, thresh)
 
         if ret == -1:
-            raise DigitError, _("Adding new feature to vector map <%s> failed.") % map
+            raise gcmd.DigitError, _("Adding new feature to vector map <%s> failed.") % map
         
     def AddLine (self, map, line, coords):
         """Add line/boundary
@@ -767,7 +759,7 @@
                                  str(self.settings["backgroundMap"]), snap, thresh)
 
         if ret == -1:
-            raise DigitError, _("Adding new feature to vector map <%s> failed.") % map
+            raise gcmd.DigitError, _("Adding new feature to vector map <%s> failed.") % map
 
 
     def DeleteSelectedLines(self):
@@ -840,8 +832,18 @@
         @param line id of line to be modified
         @param coords list of coordinates of modified line
         """
-        return self.digit.RewriteLine(line, coords)
+        try:
+            lineid = line[0]
+        except:
+            lineid = -1
 
+        listCoords = []
+        for c in coords:
+            for x in c:
+                listCoords.append(x)
+
+        return self.digit.RewriteLine(lineid, listCoords)
+
     def FlipLine(self):
         """Flip selected lines/boundaries"""
         return self.digit.FlipLines()
@@ -856,11 +858,13 @@
 
     def SnapLine(self):
         """Snap selected lines/boundaries"""
-        return self.digit.SnapLines()
+        snap, thresh = self.__getSnapThreshold()
+        return self.digit.SnapLines(thresh)
 
     def ConnectLine(self):
         """Connect selected lines/boundaries"""
-        return self.digit.ConnectLines()
+        snap, thresh = self.__getSnapThreshold()
+        return self.digit.ConnectLines(thresh)
 
     def CopyLine(self, ids=None):
         """Copy features from (background) vector map
@@ -880,6 +884,32 @@
 
         return self.digit.CopyCats(cats, ids)
 
+    def SelectLinesByQuery(self, pos1, pos2):
+        """Select features by query
+
+        @param pos1, pos2 bounding box definition
+        """
+        thresh = self.SelectLinesByQueryThresh()
+        
+        w, n = pos1
+        e, s = pos2
+
+        query = vdigit.QUERY_UNKNOWN
+        if self.settings['query'][0] == 'length':
+            query = vdigit.QUERY_LENGTH
+        elif self.settings['query'][0] == 'dangle':
+            query = vdigit.QUERY_DANGLE
+
+        type = vdigit.GV_POINTS | vdigit.GV_LINES # TODO: 3D
+        
+        ids = self.digit.SelectLinesByQuery(w, n, 0.0, e, s, 1000.0, self.settings['query'][1],
+                                            query, type, thresh)
+
+        Debug.msg(4, "VDigit.SelectLinesByQuery(): %s" % \
+                      ",".join(["%d" % v for v in ids]))
+        
+        return ids
+    
     def __getSnapThreshold(self):
         """Get snap mode and threshold value
 
@@ -998,10 +1028,13 @@
         """
         if map:
             name, mapset = map.split('@')
-            if USEVEDIT:
-                ret = self.__display.OpenMap(str(name), str(mapset), False)
-            else:
-                ret = self.__display.OpenMap(str(name), str(mapset), True)
+            try:
+                if USEVEDIT:
+                    ret = self.__display.OpenMap(str(name), str(mapset), False)
+                else:
+                    ret = self.__display.OpenMap(str(name), str(mapset), True)
+            except SystemExit:
+                ret = -1
         else:
             ret = self.__display.CloseMap()
 
@@ -1108,7 +1141,8 @@
 
         @param id line id to be selected
         """
-        Debug.msg(4, "CDisplayDriver.SetSelected(): id=%s" % id)
+        Debug.msg(4, "CDisplayDriver.SetSelected(): id=%s" % \
+                  ",".join(["%d" % v for v in id]))
 
         self.__display.SetSelected(id)
 

Modified: grass/trunk/gui/wxpython/gui_modules/gcmd.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/gcmd.py	2008-01-21 18:20:44 UTC (rev 29788)
+++ grass/trunk/gui/wxpython/gui_modules/gcmd.py	2008-01-21 18:29:06 UTC (rev 29789)
@@ -1,21 +1,24 @@
 """
-MODULE: gcmd
+ at package gcmd
 
-CLASSES:
-    * Popen
-    * Command
-    * CommandThread
+ at brief GRASS command interface
 
-PURPOSE:   GRASS command interface
+Classes:
+ * GException
+ * DigitError
+ * Popen
+ * Command
+ * CommandThread
 
-AUTHORS:   The GRASS Development Team
-           Original author: Jachym Cepicky
-           Various updates: Martin Landa <landa.martin gmail.com>
+(C) 2007-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.
 
-COPYRIGHT: (C) 2007 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 Jachym Cepicky
+Martin Landa <landa.martin gmail.com>
+
+ at date 2007-2008
 """
 
 import os
@@ -25,8 +28,8 @@
 try:
     import subprocess
 except:
-    CompatPath = os.path.join(os.getenv("GISBASE"), "etc", "wx", "compat")
-    sys.path.append(CompatPath)
+    compatPath = os.path.join(os.getenv("GISBASE"), "etc", "wx", "compat")
+    sys.path.append(compatPath)
     import subprocess
 if subprocess.mswindows:
     from win32file import ReadFile, WriteFile
@@ -37,14 +40,55 @@
     import fcntl
 from threading import Thread
 
-import wx # GUI dialogs...
+import wx
 
-GuiModulePath = os.path.join(os.getenv("GISBASE"), "etc", "wx", "gui_modules")
-sys.path.append(GuiModulePath)
-# debugging & log window
-import wxgui_utils
+guiModulePath = os.path.join(os.getenv("GISBASE"), "etc", "wx", "gui_modules")
+sys.path.append(guiModulePath)
+import wxgui_utils # log window
 from debug import Debug as Debug
 
+class GException(Exception):
+    """Generic exception"""
+    def __init__(self, message):
+        self.message = message
+
+    def __str__(self):
+        wx.MessageBox(parent=None,
+                      caption=_("Error"),
+                      message=self.message,
+                      style=wx.ICON_ERROR)
+
+        return ''
+
+class CmdError(GException):
+    """Exception used for GRASS commands.
+
+    See Command class (command exits with EXIT_FAILURE,
+    G_fatal_error() is called)."""
+    def __init(self, cmd, message):
+        GException.__init__(message)
+
+    def __str__(self):
+        wx.MessageBox(parent=None,
+                      caption=_("Error in command execution"),
+                      message=self.message,
+                      style=wx.ICON_ERROR)
+        
+        return ''  
+
+class DigitError(GException):
+    """Exception raised during digitization session"""
+    def __init(self, message):
+        GException.__init__(message)
+
+    def __str__(self):
+        wx.MessageBox(parent=None,
+                      caption=_("Error in digitization tool"),
+                      message=self.message,
+                      style=wx.ICON_ERROR)
+
+        return ''
+
 class Popen(subprocess.Popen):
     """Subclass subprocess.Popen"""
     def recv(self, maxsize=None):
@@ -152,9 +196,10 @@
     """
     Run GRASS command in separate thread
 
-    If stdout/err is redirected, write() method is required for the given classes
+    If stdout/err is redirected, write() method is required for the
+    given classes.
 
-    Usage:
+    @code
         cmd = Command(cmd=['d.rast', 'elevation.dem'], verbose=3, wait=True)
 
         if cmd.returncode == None:
@@ -163,20 +208,24 @@
             print 'SUCCESS'
         else:
             print 'FAILURE (%d)' % cmd.returncode
+    @endcode
 
     @param cmd     command given as list
     @param stdin   standard input stream
     @param verbose verbose level [0, 3] (--q, --v)
     @param wait    wait for child execution terminated
-    @param log     logging type (None, gui, txt), only if wait is True
+    @param rerr    error handling (when CmdError raised).
+    True for redirection to stderr, False for GUI dialog,
+    None for no operation (quiet mode)
     @param stdout  redirect standard output or None
     @param stderr  redirect standard error output or None
     """
     def __init__ (self, cmd, stdin=None,
-                  verbose=None, wait=True, log='gui',
+                  verbose=None, wait=True, rerr=False,
                   stdout=None, stderr=sys.stderr):
 
         self.cmd = cmd
+        self.stderr = stderr
 
         #
         # set verbosity level
@@ -221,20 +270,23 @@
         if self.returncode is not None:
             Debug.msg (3, "Command(): cmd='%s', wait=%s, returncode=%d, alive=%s" % \
                            (' '.join(cmd), wait, self.returncode, self.cmdThread.isAlive()))
-            if log and self.returncode != 0:
-                if log == 'gui': # GUI dialog
-                    dlg = wx.MessageDialog(None,
-                                           ("Execution failed: '%s'\n\n" 
-                                            "Details:\n%s") % (' '.join(self.cmd),
-                                                               self.PrintModuleOutput()),
-                                           ("Error"), wx.OK | wx.ICON_ERROR)
-                    dlg.ShowModal()
-                    dlg.Destroy()
-                else: # otherwise 'txt'
-                    print >> sys.stderr, "Execution failed: '%s'" % (' '.join(self.cmd))
-                    print >> sys.stderr, "\nDetails:\n%s" % self.PrintModuleOutput()
+            if rerr is not None and self.returncode != 0:
+                if rerr is False: # GUI dialog
+                    try:
+                        raise CmdError, _("Execution failed: '%s'%s%s" 
+                                          "Details:%s%s") % (' '.join(self.cmd),
+                                                             os.linesep, os.linesep,
+                                                             os.linesep,
+                                                             self.PrintModuleOutput())
+                    except CmdError, e:
+                        print e
+                elif rerr == sys.stderr: # redirect message to sys
+                    stderr.write("Execution failed: '%s'" % (' '.join(self.cmd)))
+                    stderr.write("%sDetails:%s%s" % (os.linesep,
+                                                     self.PrintModuleOutput(),
+                                                     os.linesep))
             else:
-                pass
+                pass # nop
         else:
             Debug.msg (3, "Command(): cmd='%s', wait=%s, returncode=?, alive=%s" % \
                            (' '.join(cmd), wait, self.cmdThread.isAlive()))
@@ -254,6 +306,8 @@
         """Read stream and return list of lines
 
         Note: Remove os.linesep from output
+
+        @param stream stream to be read
         """
         lineList = []
 
@@ -270,8 +324,7 @@
         return lineList
                     
     def ReadStdOutput(self):
-        """Read standard output and return list"""
-
+        """Read standard output and return list of lines"""
         if self.cmdThread.stdout:
             stream = self.cmdThread.stdout # use redirected stream instead
             stream.seek(0)
@@ -281,16 +334,21 @@
         return self.__ReadOutput(stream)
     
     def ReadErrOutput(self):
-        """Read standard error output and return list"""
-        
+        """Read standard error output and return list of lines"""
         return self.__ReadOutput(self.cmdThread.module.stderr)
 
     def __ProcessStdErr(self):
         """
         Read messages/warnings/errors from stderr
+
+        @return list of (type, message)
         """
-        lines = self.ReadErrOutput()
-
+        if self.stderr is None:
+            lines = self.ReadErrOutput()
+        else:
+            lines = self.cmdThread.rerr.strip('%s' % os.linesep). \
+                split('%s' % os.linesep)
+        
         msg = []
 
         type    = None
@@ -316,25 +374,38 @@
         return msg
 
     def PrintModuleOutput(self, error=True, warning=True, message=True):
-        """Store module errors, warnings, messages to output string"""
+        """Print module errors, warnings, messages to output
 
+        @param error print errors
+        @param warning print warnings
+        @param message print messages
+
+        @return string
+        """
+
         msgString = ""
         for type, msg in self.__ProcessStdErr():
             if type:
                 if (type == 'ERROR' and error) or \
                         (type == 'WARNING' and warning) or \
                         (type == 'MESSAGE' and message):
-                    msgString += " " + type + ": " + msg + "\n"
+                    msgString += " " + type + ": " + msg + "%s" % os.linesep
             else:
-                msgString += " " + msg + "\n"
+                msgString += " " + msg + "%s" % os.linesep
 
         return msgString
 
 
 class CommandThread(Thread):
-    """Run command in separate thread"""
+    """Run command in separate thread
+
+    @param cmd GRASS command (given as list)
+    @param stdin standard input stream 
+    @param stdout  redirect standard output or None
+    @param stderr  redirect standard error output or None
+    """
     def __init__ (self, cmd, stdin=None,
-                  stdout=None, stderr=None):
+                  stdout=None, stderr=sys.stderr):
 
         Thread.__init__(self)
         
@@ -344,6 +415,7 @@
         self.stderr       = stderr
 
         self.module       = None
+        self.rerr         = ''
 
     def run(self):
         """Run command"""
@@ -383,7 +455,9 @@
             # wx.PostEvent(self.stdout, evt)
             # wx.PostEvent(self.stderr, evt)
             try:
-                streamTo.write(streamFrom.read())
+                line = streamFrom.read()
+                # self.rerr = self.__parseString(line)
+                streamTo.write(line)
             except IOError:
                 pass
                 
@@ -391,10 +465,30 @@
             
         # get the last output
         try:
-            streamTo.write(streamFrom.read())
+            line = streamFrom.read()
+            self.rerr = self.__parseString(line)
+            streamTo.write(line)
         except IOError:
             pass
 
+    def __parseString(self, string):
+        """Parse line
+
+        @param line line to parsed, all GRASS_INFO
+        messages are removed from line
+        
+        @return string with GRASS_INFO messages
+        """
+        err = ''
+        for line in string.split('%s' % os.linesep):
+            if 'GRASS_INFO_ERROR' in line:
+                err += line + '%s' % os.linesep
+            elif err != '' and 'GRASS_INFO_END' in line:
+                err += line
+                
+        return err
+        
+        
 # testing ...
 if __name__ == "__main__":
     SEP = "-----------------------------------------------------------------------------"
@@ -404,7 +498,7 @@
     # d.rast verbosely, wait for process termination
     print "Running d.rast..."
 
-    cmd = Command(cmd=["d.rast", "elevation.dem"], verbose=True, wait=True, log='txt')
+    cmd = Command(cmd=["d.rast", "elevation.dem"], verbose=True, wait=True, rerr=True)
 
     if cmd.returncode == None:
         print "RUNNING"
@@ -421,7 +515,7 @@
     cmd = Command(cmd=["v.net.path", "in=roads at PERMANENT", "out=tmp", "dmax=100000", "--o"],
                   stdin="0 593527.6875 4925297.0625 602083.875 4917545.8125",
                   verbose=False,
-                  wait=True, log='txt')
+                  wait=True, rerr=None)
 
     if cmd.returncode == None:
         print "RUNNING"
@@ -436,7 +530,7 @@
     # returncode will be None
     print "Running d.vect tmp..."
 
-    cmd = Command(["d.vect", "tmp"], verbose=False, wait=False, log='txt')
+    cmd = Command(["d.vect", "tmp"], verbose=False, wait=False, rerr=None)
 
     if cmd.returncode == None:
         print "RUNNING"

Modified: grass/trunk/gui/wxpython/gui_modules/mapdisp.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/mapdisp.py	2008-01-21 18:20:44 UTC (rev 29788)
+++ grass/trunk/gui/wxpython/gui_modules/mapdisp.py	2008-01-21 18:29:06 UTC (rev 29789)
@@ -910,6 +910,7 @@
                         point = True
                     else:
                         point = False
+
                     digitClass.AddPoint(map, point, east, north)
 
                     self.UpdateMap(render=False) # redraw map
@@ -1179,7 +1180,7 @@
                         self.UpdateMap(render=False)
 
                 else: # no vector object found
-                    #self.UpdateMap(render=False)
+                    self.UpdateMap(render=False, renderVector=False)
                     pass
 
             elif digitToolbar.action in ["splitLine", "addVertex", "removeVertex"]:

Modified: grass/trunk/gui/wxpython/gui_modules/toolbars.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/toolbars.py	2008-01-21 18:20:44 UTC (rev 29788)
+++ grass/trunk/gui/wxpython/gui_modules/toolbars.py	2008-01-21 18:29:06 UTC (rev 29789)
@@ -23,10 +23,9 @@
 gmpath = os.path.join( os.getenv("GISBASE"),"etc","wx","icons")
 sys.path.append(gmpath)
 
-import gcmd as cmd
+import gcmd
 import grassenv
 from digit import Digit as Digit
-from digit import DigitError as DigitError
 from digit import DigitSettingsDialog as DigitSettingsDialog
 from debug import Debug as Debug
 from icon import Icons as Icons
@@ -582,7 +581,7 @@
 
         try:
             self.parent.digit.SetMapName(mapLayer.name)
-        except DigitError, e:
+        except gcmd.DigitError, e:
             self.layerSelectedID = None
             print e # wxMessageBox
             return False

Modified: grass/trunk/gui/wxpython/vdigit/Makefile.in
===================================================================
--- grass/trunk/gui/wxpython/vdigit/Makefile.in	2008-01-21 18:20:44 UTC (rev 29788)
+++ grass/trunk/gui/wxpython/vdigit/Makefile.in	2008-01-21 18:29:06 UTC (rev 29789)
@@ -15,7 +15,7 @@
 LDFLAGS=-shared -fpic -L$(ARCH_LIBDIR) $(VECTLIB) $(GISLIB) $(GDALLIBS) $(VEDITLIB) `wx-config --libs` -lgdi
 
 LOCAL_HEADERS=digit.h driver.h
-SOURCES=driver.cpp digit.cpp cats.cpp line.cpp vertex.cpp
+SOURCES=driver.cpp digit.cpp cats.cpp line.cpp vertex.cpp select.cpp
 
 OBJARCH=OBJ.$(ARCH)
 OBJ := $(patsubst %.cpp, $(OBJARCH)/%.o, $(SOURCES))

Modified: grass/trunk/gui/wxpython/vdigit/dig_types.i
===================================================================
--- grass/trunk/gui/wxpython/vdigit/dig_types.i	2008-01-21 18:20:44 UTC (rev 29788)
+++ grass/trunk/gui/wxpython/vdigit/dig_types.i	2008-01-21 18:29:06 UTC (rev 29789)
@@ -17,3 +17,7 @@
 #define NO_SNAP    0 /* snapping disabled */
 #define SNAP       1 /* snapping enabled for nodes */
 #define SNAPVERTEX 2 /* snapping enabled for vertex also */
+
+#define QUERY_UNKNOWN -1
+#define QUERY_LENGTH   0 /* select by line length */
+#define QUERY_DANGLE   1 /* select dangles */

Modified: grass/trunk/gui/wxpython/vdigit/digit.h
===================================================================
--- grass/trunk/gui/wxpython/vdigit/digit.h	2008-01-21 18:20:44 UTC (rev 29788)
+++ grass/trunk/gui/wxpython/vdigit/digit.h	2008-01-21 18:29:06 UTC (rev 29789)
@@ -43,6 +43,10 @@
     int ModifyLineVertex(int, double, double, double,
 			 double);
 
+    std::vector<int> SelectLinesByQuery(double, double, double,
+					double, double, double, bool,
+					int, int, double);
+
     int CopyCats(std::vector<std::vector<int> >, std::vector<int>);
 
     int GetCategory(int);

Modified: grass/trunk/gui/wxpython/vdigit/line.cpp
===================================================================
--- grass/trunk/gui/wxpython/vdigit/line.cpp	2008-01-21 18:20:44 UTC (rev 29788)
+++ grass/trunk/gui/wxpython/vdigit/line.cpp	2008-01-21 18:29:06 UTC (rev 29789)
@@ -321,9 +321,7 @@
 	return -1;
     }
 
-    /*
-      ret = Vedit_merge_lines(display->mapInfo, display->selected);
-    */
+    ret = Vedit_merge_lines(display->mapInfo, display->selected);
 
     return ret;
 }
@@ -342,10 +340,8 @@
 	return -1;
     }
 
-    /*
     ret = Vect_break_lines_list(display->mapInfo, display->selected,
 				GV_LINES, NULL, NULL);
-    */
 
     return ret;
 }
@@ -366,10 +362,9 @@
 	return -1;
     }
 
-    /*
     Vect_snap_lines_list (display->mapInfo, display->selected,
-    thresh, NULL, NULL);
-    */
+			  thresh, NULL, NULL);
+
     return ret;
 }
 
@@ -388,10 +383,9 @@
 	return -1;
     }
 
-    /*
-    ret = Vedit_connect_lines(&Map, List,
+    ret = Vedit_connect_lines(display->mapInfo, display->selected,
 			      thresh);
-    */
+
     return ret;
 }
 
@@ -416,10 +410,8 @@
 	return -1;
     }
 
-    /*
     ret = Vedit_bulk_labeling (display->mapInfo, display->selected,
 			       x1, y1, x2, y2, start, step);
-    */
 
     return ret;
 }
@@ -454,21 +446,23 @@
 	Vect_open_old(bgMap, (char *) bgmap_name, (char *) mapset); /* TODO */
     }
 
-/*
-    if (!ids.empty) {
-	list = Vect_new_list_struct();
+    if (!ids.empty()) {
+	list = Vect_new_list();
+	for (std::vector<int>::const_iterator b = ids.begin(), e = ids.end();
+	     b != e; ++b) {
+	    Vect_list_append(list, *b);
+	}
     }
     else {
 	list = display->selected;
     }
 
-    int Vedit_copy_lines (display->mapInfo, bgMap,
-			  list);
+    Vedit_copy_lines (display->mapInfo, bgMap,
+		      list);
 
     if (list != display->selected) {
-	Vect_destroy_list_struct(list);
+	Vect_destroy_list(list);
     }
-*/
 
     if (bgMap) {
 	Vect_close(bgMap);
@@ -476,5 +470,4 @@
     }
 
     return ret;
-    
 }



More information about the grass-commit mailing list