[GRASS-SVN] r44913 - grass/trunk/gui/wxpython/gui_modules

svn_grass at osgeo.org svn_grass at osgeo.org
Sun Jan 9 09:54:57 EST 2011


Author: martinl
Date: 2011-01-09 06:54:57 -0800 (Sun, 09 Jan 2011)
New Revision: 44913

Modified:
   grass/trunk/gui/wxpython/gui_modules/toolbars.py
   grass/trunk/gui/wxpython/gui_modules/wxvdigit.py
Log:
wxGUI/vdigit pythonization: zbulk & feat conversion implemeneted


Modified: grass/trunk/gui/wxpython/gui_modules/toolbars.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/toolbars.py	2011-01-09 14:35:52 UTC (rev 44912)
+++ grass/trunk/gui/wxpython/gui_modules/toolbars.py	2011-01-09 14:54:57 UTC (rev 44913)
@@ -15,7 +15,7 @@
  - HistogramToolbar
  - LayerManagerToolbar
 
-(C) 2007-2010 by the GRASS Development Team
+(C) 2007-2011 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.
 
@@ -1173,10 +1173,9 @@
 
     def OnZBulk(self, event):
         """!Z bulk-labeling selected lines/boundaries"""
-        if not self.parent.digit.driver.Is3D():
-            wx.MessageBox(parent = self.parent,
-                          message = _("Vector map is not 3D. Operation canceled."),
-                          caption = _("Error"), style = wx.OK | wx.ICON_ERROR | wx.CENTRE)
+        if not self.parent.digit.IsVector3D():
+            gcmd.GError(parent = self.parent,
+                        message = _("Vector map is not 3D. Operation canceled."))
             return
         
         if self.action['desc'] == 'zbulkLine': # select previous action

Modified: grass/trunk/gui/wxpython/gui_modules/wxvdigit.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/wxvdigit.py	2011-01-09 14:35:52 UTC (rev 44912)
+++ grass/trunk/gui/wxpython/gui_modules/wxvdigit.py	2011-01-09 14:54:57 UTC (rev 44913)
@@ -873,6 +873,14 @@
         
         return ids
 
+    def IsVector3D(self):
+        """!Check if open vector map is 3D
+        """
+        if not self._checkMap():
+            return False
+        
+        return Vect_is_3d(self.poMapInfo)
+    
     def GetLineCats(self, line=-1):
         """!Get layer/category pairs from given (selected) line
         
@@ -942,14 +950,27 @@
         @return number of modified features
         @return -1 on error
         """
-        ret = self.digit.TypeConvLines()
-
+        if not self._checkMap():
+            return -1
+        
+        nlines = Vect_get_num_lines(self.poMapInfo)
+        
+        # register changeset
+        changeset = self._addActionsBefore()
+        
+        poList = self._display.GetSelectedIList()
+        ret = Vedit_chtype_lines(self.poMapInfo, poList)
+        Vect_destroy_list(poList)
+        
         if ret > 0:
+            self._addActionsAfter(changeset, nlines)
             self.toolbar.EnableUndo()
-
+        else:
+            del self.changesets[changeset]
+        
         return ret
 
-    def Undo(self, level=-1):
+    def Undo(self, level = -1):
         """!Undo action
 
         @param level levels to undo (0 to revert all)
@@ -980,11 +1001,25 @@
         @return number of modified lines
         @return -1 on error
         """
-        ret = self.digit.ZBulkLabeling(pos1[0], pos1[1], pos2[0], pos2[1],
-                                       start, step)
+        if not self._checkMap():
+            return -1
         
+        nlines = Vect_get_num_lines(self.poMapInfo)
+        
+        # register changeset
+        changeset = self._addActionsBefore()
+        
+        poList = self._display.GetSelectedIList()
+        ret = Vedit_bulk_labeling(self.poMapInfo, poList,
+                                  pos1[0], pos1[1], pos2[0], pos2[1],
+                                  start, step)
+        Vect_destroy_list(poList)
+        
         if ret > 0:
+            self._addActionsAfter(changeset, nlines)
             self.toolbar.EnableUndo()
+        else:
+            del self.changesets[changeset]
         
         return ret
     



More information about the grass-commit mailing list