@Test public void intersection() throws Exception { ReferencedEnvelope australia = new ReferencedEnvelope( DefaultGeographicCRS.WGS84 ); australia.include( 40, 110); australia.include( 10, 150); ReferencedEnvelope newZealand = new ReferencedEnvelope( DefaultEngineeringCRS.CARTESIAN_2D ); newZealand.include( 50, 165); newZealand.include( 33, 180); try { australia.intersection(newZealand); fail( "Expected a missmatch of CoordianteReferenceSystem"); } catch (MismatchedReferenceSystemException t){ } }
@Override public Envelope intersection(Envelope env) { if( env instanceof BoundingBox ){ BoundingBox bbox = (BoundingBox) env; ensureCompatibleReferenceSystem( bbox ); } return super.intersection(env); }
ReferencedEnvelope extends Envelope implements org.opengis.geometry.Envelope,
    BoundingBox { @Override public Envelope intersection(Envelope env) { if( env instanceof BoundingBox ){ BoundingBox bbox = (BoundingBox) env; ensureCompatibleReferenceSystem( bbox ); } return super.intersection(env); } }
ReferencedEnvelope extends Envelope implements org.opengis.geometry.Envelope,
    BoundingBox { @Override public Envelope intersection(Envelope env) { if( env instanceof BoundingBox ){ BoundingBox bbox = (BoundingBox) env; ensureCompatibleReferenceSystem( bbox ); } return super.intersection(env); } ReferencedEnvelope();  ReferencedEnvelope(CoordinateReferenceSystem crs);  ReferencedEnvelope(final double x1, final double x2, final double y1, final double y2,
        final CoordinateReferenceSystem crs);  ReferencedEnvelope(final Rectangle2D rectangle, final CoordinateReferenceSystem crs);  ReferencedEnvelope(final ReferencedEnvelope envelope);  ReferencedEnvelope(final BoundingBox bbox);  ReferencedEnvelope(final org.opengis.geometry.Envelope envelope);  ReferencedEnvelope(final Envelope envelope, final CoordinateReferenceSystem crs); }
ReferencedEnvelope extends Envelope implements org.opengis.geometry.Envelope,
    BoundingBox { @Override public Envelope intersection(Envelope env) { if( env instanceof BoundingBox ){ BoundingBox bbox = (BoundingBox) env; ensureCompatibleReferenceSystem( bbox ); } return super.intersection(env); } ReferencedEnvelope();  ReferencedEnvelope(CoordinateReferenceSystem crs);  ReferencedEnvelope(final double x1, final double x2, final double y1, final double y2,
        final CoordinateReferenceSystem crs);  ReferencedEnvelope(final Rectangle2D rectangle, final CoordinateReferenceSystem crs);  ReferencedEnvelope(final ReferencedEnvelope envelope);  ReferencedEnvelope(final BoundingBox bbox);  ReferencedEnvelope(final org.opengis.geometry.Envelope envelope);  ReferencedEnvelope(final Envelope envelope, final CoordinateReferenceSystem crs); void init(BoundingBox bounds); CoordinateReferenceSystem getCoordinateReferenceSystem(); CoordinateReferenceSystem crs(); int getDimension(); double getMinimum(final int dimension); double minX(); double minY(); double getMaximum(final int dimension); double maxX(); double maxY(); double getCenter(final int dimension); double getMedian(final int dimension); double getLength(final int dimension); double getSpan(final int dimension); DirectPosition getLowerCorner(); DirectPosition getUpperCorner(); boolean isEmpty(); boolean contains(DirectPosition pos); boolean contains(final BoundingBox bbox); boolean intersects(final BoundingBox bbox); @Override Envelope intersection(Envelope env); void include(final BoundingBox bbox); @Override void expandToInclude(Envelope other); void include(double x, double y); void setBounds(final BoundingBox bbox); BoundingBox toBounds(final CoordinateReferenceSystem targetCRS); ReferencedEnvelope transform(CoordinateReferenceSystem targetCRS, boolean lenient); ReferencedEnvelope transform(final CoordinateReferenceSystem targetCRS,
        final boolean lenient, final int numPointsForTransformation); @Override int hashCode(); @Override boolean equals(final Object object); boolean boundsEquals2D(final org.opengis.geometry.Envelope other, double eps); @Override String toString(); static ReferencedEnvelope reference(Envelope e); static ReferencedEnvelope reference(BoundingBox e); }
ReferencedEnvelope extends Envelope implements org.opengis.geometry.Envelope,
    BoundingBox { @Override public Envelope intersection(Envelope env) { if( env instanceof BoundingBox ){ BoundingBox bbox = (BoundingBox) env; ensureCompatibleReferenceSystem( bbox ); } return super.intersection(env); } ReferencedEnvelope();  ReferencedEnvelope(CoordinateReferenceSystem crs);  ReferencedEnvelope(final double x1, final double x2, final double y1, final double y2,
        final CoordinateReferenceSystem crs);  ReferencedEnvelope(final Rectangle2D rectangle, final CoordinateReferenceSystem crs);  ReferencedEnvelope(final ReferencedEnvelope envelope);  ReferencedEnvelope(final BoundingBox bbox);  ReferencedEnvelope(final org.opengis.geometry.Envelope envelope);  ReferencedEnvelope(final Envelope envelope, final CoordinateReferenceSystem crs); void init(BoundingBox bounds); CoordinateReferenceSystem getCoordinateReferenceSystem(); CoordinateReferenceSystem crs(); int getDimension(); double getMinimum(final int dimension); double minX(); double minY(); double getMaximum(final int dimension); double maxX(); double maxY(); double getCenter(final int dimension); double getMedian(final int dimension); double getLength(final int dimension); double getSpan(final int dimension); DirectPosition getLowerCorner(); DirectPosition getUpperCorner(); boolean isEmpty(); boolean contains(DirectPosition pos); boolean contains(final BoundingBox bbox); boolean intersects(final BoundingBox bbox); @Override Envelope intersection(Envelope env); void include(final BoundingBox bbox); @Override void expandToInclude(Envelope other); void include(double x, double y); void setBounds(final BoundingBox bbox); BoundingBox toBounds(final CoordinateReferenceSystem targetCRS); ReferencedEnvelope transform(CoordinateReferenceSystem targetCRS, boolean lenient); ReferencedEnvelope transform(final CoordinateReferenceSystem targetCRS,
        final boolean lenient, final int numPointsForTransformation); @Override int hashCode(); @Override boolean equals(final Object object); boolean boundsEquals2D(final org.opengis.geometry.Envelope other, double eps); @Override String toString(); static ReferencedEnvelope reference(Envelope e); static ReferencedEnvelope reference(BoundingBox e); static ReferencedEnvelope EVERYTHING; }