[GRASS-SVN] r73397 - grass/branches/releasebranch_7_4/lib/python/pygrass/vector

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Sep 25 09:42:51 PDT 2018


Author: martinl
Date: 2018-09-25 09:42:51 -0700 (Tue, 25 Sep 2018)
New Revision: 73397

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

Modified: grass/branches/releasebranch_7_4/lib/python/pygrass/vector/__init__.py
===================================================================
--- grass/branches/releasebranch_7_4/lib/python/pygrass/vector/__init__.py	2018-09-25 16:39:34 UTC (rev 73396)
+++ grass/branches/releasebranch_7_4/lib/python/pygrass/vector/__init__.py	2018-09-25 16:42:51 UTC (rev 73397)
@@ -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