@Override public SpatialRelation relate(Shape other) { // ** NOTE ** the overall order of logic is kept consistent here with simple.PointImpl. if (isEmpty() || other.isEmpty()) return SpatialRelation.DISJOINT; if (other instanceof org.locationtech.spatial4j.shape.Point) return this.equals(other) ? SpatialRelation.INTERSECTS : SpatialRelation.DISJOINT; return other.relate(this).transpose(); }
@Override public SpatialRelation relate(Shape other) { if (isEmpty() || other.isEmpty()) return SpatialRelation.DISJOINT; if (other instanceof Point) return this.equals(other) ? SpatialRelation.INTERSECTS : SpatialRelation.DISJOINT; return other.relate(this).transpose(); }
@Override public SpatialRelation relate(Shape other) { if (isEmpty() || other.isEmpty()) return SpatialRelation.DISJOINT; if (other instanceof Point) { return relate((Point) other); } if (other instanceof Rectangle) { return relate((Rectangle) other); } return other.relate(this).transpose(); }
@Override public SpatialRelation relate(Shape other) { //This shortcut was problematic in testing due to distinctions of CONTAINS/WITHIN for no-area shapes (lines, points). // if (distance == 0) { // return point.relate(other,ctx).intersects() ? SpatialRelation.WITHIN : SpatialRelation.DISJOINT; // } if (isEmpty() || other.isEmpty()) return SpatialRelation.DISJOINT; if (other instanceof Point) { return relate((Point) other); } if (other instanceof Rectangle) { return relate((Rectangle) other); } if (other instanceof Circle) { return relate((Circle) other); } return other.relate(this).transpose(); }
@Override public boolean isEmpty() { return s.isEmpty(); }
@Override public String toWkt(Shape shape) throws IOException { if (shape.isEmpty()) { if (shape instanceof Point) { return "POINT EMPTY"; } else if (shape instanceof ShapeCollection) { return "GEOMETRYCOLLECTION EMPTY"; } } return wktWriter.toString(shape); } }
@Override public String toWkt(Shape shape) throws IOException { if (shape.isEmpty()) { if (shape instanceof Point) { return "POINT EMPTY"; } else if (shape instanceof ShapeCollection) { return "GEOMETRYCOLLECTION EMPTY"; } } return wktWriter.toString(shape); } }