ReferencedEnvelope extends Envelope implements org.opengis.geometry.Envelope,
    BoundingBox { public boolean boundsEquals2D(final org.opengis.geometry.Envelope other, double eps) { eps *= 0.5*(getWidth() + getHeight()); double[] delta = new double[4]; delta[0] = getMinimum(0) - other.getMinimum(0); delta[1] = getMaximum(0) - other.getMaximum(0); delta[2] = getMinimum(1) - other.getMinimum(1); delta[3] = getMaximum(1) - other.getMaximum(1); for (int i = 0; i < delta.length; i++) { if (!(Math.abs(delta[i]) <= eps)) { return false; } } return true; } 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); void expandToInclude(DirectPosition pt ); @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 create( ReferencedEnvelope origional ); static ReferencedEnvelope create(CoordinateReferenceSystem crs); static ReferencedEnvelope create(org.opengis.geometry.Envelope env,
            CoordinateReferenceSystem crs); static ReferencedEnvelope create(ReferencedEnvelope env, CoordinateReferenceSystem crs); static ReferencedEnvelope create(Envelope env, CoordinateReferenceSystem crs); static ReferencedEnvelope reference(Envelope e); static ReferencedEnvelope reference(BoundingBox e); static ReferencedEnvelope reference(ReferencedEnvelope e); static ReferencedEnvelope reference(org.opengis.geometry.Envelope env); static ReferencedEnvelope EVERYTHING; }
@Test public void testBoundsEquals2D() { Rectangle2D bounds = new Rectangle2D.Double(-20.0, -20.0, 40.0, 40.0); ReferencedEnvelope env1 = new ReferencedEnvelope(bounds, null); ReferencedEnvelope env2 = new ReferencedEnvelope(bounds, null); double eps = 1.0e-4d; assertTrue(env1.boundsEquals2D(env2, eps)); bounds = new Rectangle2D.Double(-20.01, -20.01, 40.0, 40.0); env2 = new ReferencedEnvelope(bounds, null); assertFalse(env1.boundsEquals2D(env2, eps)); }