浏览代码

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 年之前
父节点
当前提交
0e4da4d0ef
共有 1 个文件被更改,包括 5 次插入0 次删除
  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):