@Override public int getDimension() { int maxDim = 0; for (Geometry part : this) { maxDim = Math.max(maxDim, part.getDimension()); } return maxDim; }
@Override public <P extends C2D> boolean overlaps(final Geometry<P> geometry, final Geometry<P> other) { if (geometry.isEmpty() || other.isEmpty()) return Boolean.FALSE; checkCompatibleCRS(geometry, other); if (!envelopeIntersect(geometry, other)) return Boolean.FALSE; final RelateOp relateOp = new RelateOp(JTS.to(geometry), JTS.to(other)); return relateOp.getIntersectionMatrix().isOverlaps(geometry.getDimension(), other.getDimension()); }
@Override public <P extends C2D> boolean touches(final Geometry<P> geometry, final Geometry<P> other) { if (geometry.isEmpty() || other.isEmpty()) return Boolean.FALSE; checkCompatibleCRS(geometry, other); if (!envelopeIntersect(geometry, other)) return Boolean.FALSE; final RelateOp relateOp = new RelateOp(JTS.to(geometry), JTS.to(other)); return relateOp.getIntersectionMatrix().isTouches(geometry.getDimension(), other.getDimension()); }
@Override public <P extends C2D> boolean crosses(final Geometry<P> geometry, final Geometry<P> other) { if (geometry.isEmpty() || other.isEmpty()) return Boolean.FALSE; checkCompatibleCRS(geometry, other); if (!envelopeIntersect(geometry, other)) return Boolean.FALSE; final RelateOp relateOp = new RelateOp(JTS.to(geometry), JTS.to(other)); return relateOp.getIntersectionMatrix().isCrosses(geometry.getDimension(), other.getDimension()); }