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

svn_grass at osgeo.org svn_grass at osgeo.org
Sun Mar 27 02:52:49 EDT 2011


Author: martinl
Date: 2011-03-26 23:52:49 -0700 (Sat, 26 Mar 2011)
New Revision: 45780

Modified:
   grass/branches/develbranch_6/gui/wxpython/gui_modules/nviz_tools.py
Log:
#1126: 3D view crashing when started with vector data (was: 3D view
crashing)
(merge r45779 from trunk)


Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/nviz_tools.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/nviz_tools.py	2011-03-27 06:49:01 UTC (rev 45779)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/nviz_tools.py	2011-03-27 06:52:49 UTC (rev 45780)
@@ -32,6 +32,8 @@
 except ImportError:
     import wx.lib.flatnotebook as FN
 
+import grass.script as grass
+
 import globalvar
 import gselect
 import gcmd
@@ -2603,34 +2605,23 @@
         @return num of points/features (expect of points)
         @return None
         """
-        vInfo = gcmd.RunCommand('v.info',
-                                parent = self,
-                                read = True,
-                                flags = 't',
-                                map = layer.GetName())
+        vInfo = grass.vector_info_topo(layer.GetName())
         
         if not vInfo:
             return None
-            
-        npoints = nlines = nprimitives = 0
-        for line in vInfo.splitlines():
-            key, value = line.split('=')
-            if key == 'map3d':
-                mapIs3D = int(value)
-            elif key == 'points':
-                npoints = int(value)
-                nprimitives += npoints
-            elif key == 'lines':
-                nlines = int(value)
-                nprimitives += nlines
-            elif key in ('boundaries',
-                         'centroids',
-                         'faces',
-                         'kernels'):
-                nprimitives += int(value)
         
-        return (npoints, nlines, nprimitives, mapIs3D)
+        nprimitives = 0
+        for key, value in vInfo.iteritems():
+            if key in ('points',
+                       'lines',
+                       'boundaries',
+                       'centroids',
+                       'faces',
+                       'kernels'):
+                nprimitives += value
         
+        return (vInfo['points'], vInfo['lines'], nprimitives, vInfo['map3d'])
+        
     def UpdateVectorPage(self, layer, data, updateName = True):
         """!Update vector page"""
         npoints, nlines, nfeatures, mapIs3D = self.VectorInfo(layer)



More information about the grass-commit mailing list