[GRASS-SVN] r73395 - grass/branches/releasebranch_7_6/lib/python/pygrass/vector

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Sep 25 09:36:06 PDT 2018


Author: martinl
Date: 2018-09-25 09:36:06 -0700 (Tue, 25 Sep 2018)
New Revision: 73395

Modified:
   grass/branches/releasebranch_7_6/lib/python/pygrass/vector/__init__.py
Log:
pygrass wrongly reports lines for point vector maps, see #3549 (g76: merge r73393 from trunk)

Modified: grass/branches/releasebranch_7_6/lib/python/pygrass/vector/__init__.py
===================================================================
--- grass/branches/releasebranch_7_6/lib/python/pygrass/vector/__init__.py	2018-09-25 16:07:41 UTC (rev 73394)
+++ grass/branches/releasebranch_7_6/lib/python/pygrass/vector/__init__.py	2018-09-25 16:36:06 UTC (rev 73395)
@@ -27,8 +27,8 @@
           "holes": libvect.Vect_get_num_holes,
           "islands": libvect.Vect_get_num_islands,
           "kernels": libvect.Vect_get_num_kernels,
-          "points": libvect.Vect_get_num_lines,
-          "lines": libvect.Vect_get_num_lines,
+          "points": (libvect.Vect_get_num_primitives, libvect.GV_POINT),
+          "lines": (libvect.Vect_get_num_primitives, libvect.GV_LINE),
           "nodes": libvect.Vect_get_num_nodes,
           "updated_lines": libvect.Vect_get_num_updated_lines,
           "updated_nodes": libvect.Vect_get_num_updated_nodes,
@@ -370,7 +370,11 @@
         ..
         """
         if vtype in _NUMOF.keys():
-            return _NUMOF[vtype](self.c_mapinfo)
+            if isinstance(_NUMOF[vtype], tuple):
+                fn, ptype = _NUMOF[vtype]
+                return fn(self.c_mapinfo, ptype)
+            else:
+                return _NUMOF[vtype](self.c_mapinfo)
         else:
             keys = "', '".join(sorted(_NUMOF.keys()))
             raise ValueError("vtype not supported, use one of: '%s'" % keys)



More information about the grass-commit mailing list