def including(self, *others) -> Predicate: others = flatten_sequence(others) visited = set() deduplicated = [] for obj in others: if is_resource(obj): if obj._id not in visited: visited.add(obj._id) deduplicated.append(obj._id) else: if obj not in visited: visited.add(obj) deduplicated.append(obj) return ConditionalPredicate(OP_CODE.INCLUDING, self, deduplicated)
def is_contained_by(self, polygon: 'PolygonGeometry') -> Predicate: return ConditionalPredicate(POSTGIS_OP_CODE.CONTAINED_BY, self, polygon)
def is_within_radius_of(self, point, radius): value = {'center': PointGeometry(point).vertex, 'radius': radius} return ConditionalPredicate(POSTGIS_OP_CODE.WITHIN_RADIUS, self, value, ignore_field_adapter=True)
def contains(self, geometry: 'GeometryObject') -> Predicate: return ConditionalPredicate(POSTGIS_OP_CODE.CONTAINS, self, geometry)
def excluding(self, *others) -> Predicate: others = flatten_sequence(others) others = {obj._id if is_resource(obj) else obj for obj in others} return ConditionalPredicate(OP_CODE.EXCLUDING, self, others)
def __ge__(self, other: Predicate) -> Predicate: return ConditionalPredicate(OP_CODE.GEQ, self, other)
def __lt__(self, other: Predicate) -> Predicate: return ConditionalPredicate(OP_CODE.LT, self, other)