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

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


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

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


Modified: grass/trunk/gui/wxpython/gui_modules/nviz_tools.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/nviz_tools.py	2011-03-27 06:10:18 UTC (rev 45778)
+++ grass/trunk/gui/wxpython/gui_modules/nviz_tools.py	2011-03-27 06:49:01 UTC (rev 45779)
@@ -32,6 +32,8 @@
 except ImportError:
     import wx.lib.flatnotebook as FN
 
+import grass.script as grass
+
 import globalvar
 import gselect
 import gcmd
@@ -2602,34 +2604,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