@Override public SpatialRelation relate(Shape other) { final SpatialRelation bboxSect = bbox.relate(other); if (bboxSect == SpatialRelation.DISJOINT || bboxSect == SpatialRelation.WITHIN) return bboxSect; final boolean containsWillShortCircuit = (other instanceof Point) || relateContainsShortCircuits(); SpatialRelation sect = null; for (Shape shape : shapes) { SpatialRelation nextSect = shape.relate(other); if (sect == null) {//first pass sect = nextSect; } else { sect = sect.combine(nextSect); } if (sect == INTERSECTS) return INTERSECTS; if (sect == CONTAINS && containsWillShortCircuit) return CONTAINS; } return sect; }
result[0] = rel.combine(result[0]); } else if (geom instanceof LineString) { LineString lineString = (LineString) geom; SpatialRelation rel = relateLineString(lineString); result[0] = rel.combine(result[0]); } else if (geom instanceof org.locationtech.jts.geom.Point) { org.locationtech.jts.geom.Point point = (org.locationtech.jts.geom.Point) geom; calcSqd.distance(circle.getCenter(), point.getX(), point.getY()) > radiusSquared ? SpatialRelation.DISJOINT : SpatialRelation.WITHIN; result[0] = rel.combine(result[0]);
return SpatialRelation.WITHIN.combine(result[0]);