瀏覽代碼

https://trac.osgeo.org/grass/ticket/1126: 3D view crashing when started with vector data (was: 3D view
crashing)


git-svn-id: https://svn.osgeo.org/grass/grass/trunk@45779 15284696-431f-4ddb-bdfa-cd5b030d7da7

Martin Landa 14 年之前
父節點
當前提交
5e96d598ae
共有 1 個文件被更改,包括 15 次插入24 次删除
  1. 15 24
      gui/wxpython/gui_modules/nviz_tools.py

+ 15 - 24
gui/wxpython/gui_modules/nviz_tools.py

@@ -32,6 +32,8 @@ try:
 except ImportError:
     import wx.lib.flatnotebook as FN
 
+import grass.script as grass
+
 import globalvar
 import gselect
 import gcmd
@@ -2602,33 +2604,22 @@ class NvizToolWindow(FN.FlatNotebook):
         @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"""