[GRASS-SVN] r54593 - grass/trunk/lib/python/pygrass/vector

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Jan 11 08:38:22 PST 2013


Author: zarch
Date: 2013-01-11 08:38:21 -0800 (Fri, 11 Jan 2013)
New Revision: 54593

Modified:
   grass/trunk/lib/python/pygrass/vector/basic.py
Log:
Add a new method to the Bbox class that check if a Point is inside or not

Modified: grass/trunk/lib/python/pygrass/vector/basic.py
===================================================================
--- grass/trunk/lib/python/pygrass/vector/basic.py	2013-01-11 16:38:12 UTC (rev 54592)
+++ grass/trunk/lib/python/pygrass/vector/basic.py	2013-01-11 16:38:21 UTC (rev 54593)
@@ -97,7 +97,12 @@
         return "Bbox({n}, {s}, {e}, {w})".format(n=self.north, s=self.south,
                                                  e=self.east, w=self.west)
 
+    def contains(self, point):
+        return bool(libvect.Vect_point_in_box(point.x, point.y,
+                                              point.z if point.z else 0,
+                                              self.c_bbox))
 
+
 class BoxList(object):
     def __init__(self, boxlist=None):
         self.c_boxlist = ctypes.pointer(libvect.boxlist())



More information about the grass-commit mailing list