[GRASS-SVN] r35911 - grass/branches/develbranch_6/gui/wxpython/gui_modules

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Feb 17 11:12:36 EST 2009


Author: martinl
Date: 2009-02-17 11:12:36 -0500 (Tue, 17 Feb 2009)
New Revision: 35911

Modified:
   grass/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp_window.py
   grass/branches/develbranch_6/gui/wxpython/gui_modules/vdigit.py
Log:
wxGUI/vdigit: select features from bgmap by bbox/point, multiple selection allowed
	      (merge from trunk, r35910)


Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp_window.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp_window.py	2009-02-17 16:08:24 UTC (rev 35910)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp_window.py	2009-02-17 16:12:36 UTC (rev 35911)
@@ -1291,8 +1291,9 @@
         digitToolbar = self.parent.toolbars['vdigit']
         digitClass   = self.parent.digit
         
-        self.copyIds = []
-        self.layerTmp = None
+        if not hasattr(self, "copyIds"):
+            self.copyIds = []
+            self.layerTmp = None
         
     def OnLeftDownVDigitBulkLine(self, event):
         """
@@ -1605,7 +1606,7 @@
                 self.UpdateMap(render=False, renderVector=False)
         else:
             # copy features from background map
-            self.copyIds = digitClass.SelectLinesFromBackgroundMap(pos1, pos2)
+            self.copyIds += digitClass.SelectLinesFromBackgroundMap(pos1, pos2)
             if len(self.copyIds) > 0:
                 color = UserSettings.Get(group='vdigit', key='symbol',
                                          subkey=['highlight', 'color'])
@@ -1622,9 +1623,13 @@
                             'type=point,line,boundary,centroid',
                             'width=2']
                         
-                self.layerTmp = self.Map.AddLayer(type='vector',
-                                                  name=globalvar.QUERYLAYER,
-                                                  command=dVectTmp)
+                if not self.layerTmp:
+                    self.layerTmp = self.Map.AddLayer(type='vector',
+                                                      name=globalvar.QUERYLAYER,
+                                                      command=dVectTmp)
+                else:
+                    self.layerTmp.SetCmd(dVectTmp)
+                
                 self.UpdateMap(render=True, renderVector=False)
             else:
                 self.UpdateMap(render=False, renderVector=False)

Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/vdigit.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/vdigit.py	2009-02-17 16:08:24 UTC (rev 35910)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/vdigit.py	2009-02-17 16:12:36 UTC (rev 35911)
@@ -175,7 +175,7 @@
     def SelectLinesFromBackgroundMap(self, pos1, pos2):
         """Select features from background map
 
-        @param pos1,pos2 bounding box defifinition
+        @param pos1,pos2 bounding box
         """
         bgmap = str(UserSettings.Get(group='vdigit', key='bgmap', subkey='value',
                                      internal=True))
@@ -186,16 +186,26 @@
 
         x1, y1 = pos1
         x2, y2 = pos2
-
         ret = gcmd.RunCommand('v.edit',
                               parent = self,
                               quiet = True,
                               read = True,
                               map = bgmap,
                               tool = 'select',
-                              bbox= '%f,%f,%f,%f' % (pos1[0], pos1[1], pos2[0], pos2[1]))
-                              
+                              bbox = '%f,%f,%f,%f' % (x1, y1, x2, y2))
+
         if not ret:
+            x, y = pos1
+            ret = gcmd.RunCommand('v.edit',
+                                  parent = self,
+                                  quiet = True,
+                                  read = True,
+                                  map = bgmap,
+                                  tool = 'select',
+                                  coords = '%f,%f' % (x, y),
+                                  thresh = self.driver.GetThreshold(type='selectThresh'))
+        
+        if not ret:
             return []
         
         output = ret.splitlines()[0] # first line



More information about the grass-commit mailing list