Bladeren bron

Add a new method to the Bbox class that check if a Point is inside or not

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@54593 15284696-431f-4ddb-bdfa-cd5b030d7da7
Pietro Zambelli 12 jaren geleden
bovenliggende
commit
0e4da4d0ef
1 gewijzigde bestanden met toevoegingen van 5 en 0 verwijderingen
  1. 5 0
      lib/python/pygrass/vector/basic.py

+ 5 - 0
lib/python/pygrass/vector/basic.py

@@ -97,6 +97,11 @@ class Bbox(object):
         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):