def contains(self, other): if not isinstance(other, MapExtent): raise NotImplemented if self.is_default: # DefaultMapExtent contains everything return True return bbox_contains(self.bbox, other.bbox_for(self.srs))
def contains(self, bbox, srs): bbox = self._bbox_in_coverage_srs(bbox, srs) return bbox_contains(self.bbox, bbox)
def test_no_intersect_only_vertical(self): b1 = (0, 0, 10, 10) b2 = (20, 0, 30, 10) assert not bbox_contains(b1, b2) assert not bbox_contains(b2, b1)
def test_overlap(self): b1 = (0, 0, 10, 10) b2 = (-5, -5, 5, 5) assert not bbox_contains(b1, b2) assert not bbox_contains(b2, b1)
def test_contains_touch(self): b1 = (0, 0, 10, 10) b2 = (0, 0, 8, 8) assert bbox_contains(b1, b2) assert not bbox_contains(b2, b1)
def test_full_contains(self): b1 = (0, 0, 10, 10) b2 = (2, 2, 8, 8) assert bbox_contains(b1, b2) assert not bbox_contains(b2, b1)
def test_no_intersect_touch_side(self): b1 = (0, 0, 10, 10) b2 = (0, 10, 10, 20) assert not bbox_contains(b1, b2) assert not bbox_contains(b2, b1)
def contains(self, other): if not isinstance(other, MapExtent): raise NotImplemented return bbox_contains(self.bbox, other.bbox_for(self.srs))