/** * Include the provided bounding box, expanding as necessary. * * @since 2.4 */ public void include(final BoundingBox bbox) { if (crs == null) { this.crs = bbox.getCoordinateReferenceSystem(); } else { ensureCompatibleReferenceSystem(bbox); } super.expandToInclude(getJTSEnvelope(bbox)); }
/** Check if this bounding box intersects the provided bounds. */ @Override public Envelope intersection(Envelope env) { if (env instanceof BoundingBox) { BoundingBox bbox = (BoundingBox) env; ensureCompatibleReferenceSystem(bbox); } return super.intersection(env); }
/** Include the provided envelope, expanding as necessary. */ @Override public void expandToInclude(Envelope other) { if (other instanceof BoundingBox) { if (other.isNull()) { return; } BoundingBox bbox = (BoundingBox) other; ensureCompatibleReferenceSystem(bbox); expandToInclude(bbox.getLowerCorner()); expandToInclude(bbox.getUpperCorner()); } else { super.expandToInclude(other); } }
/** * Initialize the bounding box with another bounding box. * * @since 2.4 */ public void setBounds(final BoundingBox bbox) { ensureCompatibleReferenceSystem(bbox); super.init(getJTSEnvelope(bbox)); }
/** * Check if this bounding box intersects the provided bounds. * * @since 2.4 */ public boolean intersects(final BoundingBox bbox) { ensureCompatibleReferenceSystem(bbox); return super.intersects(getJTSEnvelope(bbox)); }
/** * Returns {@code true} if the provided location is contained by this bounding box. * * @since 2.4 */ public boolean contains(DirectPosition pos) { ensureCompatibleReferenceSystem(pos); return super.contains(pos.getOrdinate(0), pos.getOrdinate(1)); }