@Test public void testInclude() throws Exception { assertEquals("unexpected bounds x min after include", 10, australia.x, 0); assertEquals("unexpected bounds y min after include", 110, australia.y, 0); assertEquals("unexpected bounds width after include", 30, australia.width, 0); assertEquals("unexpected bounds height after include", 40, australia.height, 0); try { australia.include(newZealand); fail("Expected a missmatch of CoordianteReferenceSystem"); } catch (MismatchedReferenceSystemException t) { } try { australia.include(this.envelope2D); assertEquals("unexpected bounds x min after include", -20, australia.x, 0); assertEquals("unexpected bounds y min after include", -20, australia.y, 0); assertEquals("unexpected bounds width after include", 60, australia.width, 0); assertEquals("unexpected bounds height after include", 170, australia.height, 0); } catch (MismatchedReferenceSystemException t) { fail("Expected a match of CoordianteReferenceSystem"); } }
public void include(BoundingBox bounds) { if (crs == null) { this.crs = bounds.getCoordinateReferenceSystem(); } else { ensureCompatibleReferenceSystem(bounds); } if (bounds.isEmpty()) { return; } if (isNull()) { setBounds(bounds); } else { if (bounds.getMinX() < getMinX()) { this.width = width + (getMinX() - bounds.getMinX()); this.x = bounds.getMinX(); } if (bounds.getMaxX() > getMaxX()) { this.width = width + (bounds.getMaxX() - getMaxX()); } if (bounds.getMinY() < getMinY()) { this.height = height + (getMinY() - bounds.getMinY()); this.y = bounds.getMinY(); } if (bounds.getMaxY() > getMaxY()) { this.height = height + (bounds.getMaxY() - getMaxY()); } } }
Envelope2D extends Rectangle2D.Double implements BoundingBox, Envelope, Cloneable { public void include(BoundingBox bounds) { if (crs == null) { this.crs = bounds.getCoordinateReferenceSystem(); } else { ensureCompatibleReferenceSystem(bounds); } if (bounds.isEmpty()) { return; } if (isNull()) { setBounds(bounds); } else { if (bounds.getMinX() < getMinX()) { this.width = width + (getMinX() - bounds.getMinX()); this.x = bounds.getMinX(); } if (bounds.getMaxX() > getMaxX()) { this.width = width + (bounds.getMaxX() - getMaxX()); } if (bounds.getMinY() < getMinY()) { this.height = height + (getMinY() - bounds.getMinY()); this.y = bounds.getMinY(); } if (bounds.getMaxY() > getMaxY()) { this.height = height + (bounds.getMaxY() - getMaxY()); } } } }
Envelope2D extends Rectangle2D.Double implements BoundingBox, Envelope, Cloneable { public void include(BoundingBox bounds) { if (crs == null) { this.crs = bounds.getCoordinateReferenceSystem(); } else { ensureCompatibleReferenceSystem(bounds); } if (bounds.isEmpty()) { return; } if (isNull()) { setBounds(bounds); } else { if (bounds.getMinX() < getMinX()) { this.width = width + (getMinX() - bounds.getMinX()); this.x = bounds.getMinX(); } if (bounds.getMaxX() > getMaxX()) { this.width = width + (bounds.getMaxX() - getMaxX()); } if (bounds.getMinY() < getMinY()) { this.height = height + (getMinY() - bounds.getMinY()); this.y = bounds.getMinY(); } if (bounds.getMaxY() > getMaxY()) { this.height = height + (bounds.getMaxY() - getMaxY()); } } } Envelope2D();  Envelope2D(final CoordinateReferenceSystem crs);  Envelope2D(final Envelope envelope);  Envelope2D(final CoordinateReferenceSystem crs, final Rectangle2D rect);  Envelope2D(final CoordinateReferenceSystem crs,
                      final double x, final double y, final double width, final double height);  Envelope2D(final DirectPosition2D minDP, final DirectPosition2D maxDP); }
Envelope2D extends Rectangle2D.Double implements BoundingBox, Envelope, Cloneable { public void include(BoundingBox bounds) { if (crs == null) { this.crs = bounds.getCoordinateReferenceSystem(); } else { ensureCompatibleReferenceSystem(bounds); } if (bounds.isEmpty()) { return; } if (isNull()) { setBounds(bounds); } else { if (bounds.getMinX() < getMinX()) { this.width = width + (getMinX() - bounds.getMinX()); this.x = bounds.getMinX(); } if (bounds.getMaxX() > getMaxX()) { this.width = width + (bounds.getMaxX() - getMaxX()); } if (bounds.getMinY() < getMinY()) { this.height = height + (getMinY() - bounds.getMinY()); this.y = bounds.getMinY(); } if (bounds.getMaxY() > getMaxY()) { this.height = height + (bounds.getMaxY() - getMaxY()); } } } Envelope2D();  Envelope2D(final CoordinateReferenceSystem crs);  Envelope2D(final Envelope envelope);  Envelope2D(final CoordinateReferenceSystem crs, final Rectangle2D rect);  Envelope2D(final CoordinateReferenceSystem crs,
                      final double x, final double y, final double width, final double height);  Envelope2D(final DirectPosition2D minDP, final DirectPosition2D maxDP); final CoordinateReferenceSystem getCoordinateReferenceSystem(); void setCoordinateReferenceSystem(final CoordinateReferenceSystem crs); final int getDimension(); DirectPosition getLowerCorner(); DirectPosition getUpperCorner(); final double getMinimum(final int dimension); final double getMaximum(final int dimension); @Deprecated final double getCenter(final int dimension); final double getMedian(final int dimension); @Deprecated final double getLength(final int dimension); final double getSpan(final int dimension); @Override int hashCode(); @Override boolean equals(final Object object); boolean boundsEquals(final Envelope that, final int xDim, final int yDim, double eps); @Override String toString(); void setBounds(BoundingBox bounds); void include(BoundingBox bounds); void include(double x, double y); boolean intersects(BoundingBox bounds); boolean contains(BoundingBox bounds); boolean contains(DirectPosition location); BoundingBox toBounds(CoordinateReferenceSystem targetCRS); }
Envelope2D extends Rectangle2D.Double implements BoundingBox, Envelope, Cloneable { public void include(BoundingBox bounds) { if (crs == null) { this.crs = bounds.getCoordinateReferenceSystem(); } else { ensureCompatibleReferenceSystem(bounds); } if (bounds.isEmpty()) { return; } if (isNull()) { setBounds(bounds); } else { if (bounds.getMinX() < getMinX()) { this.width = width + (getMinX() - bounds.getMinX()); this.x = bounds.getMinX(); } if (bounds.getMaxX() > getMaxX()) { this.width = width + (bounds.getMaxX() - getMaxX()); } if (bounds.getMinY() < getMinY()) { this.height = height + (getMinY() - bounds.getMinY()); this.y = bounds.getMinY(); } if (bounds.getMaxY() > getMaxY()) { this.height = height + (bounds.getMaxY() - getMaxY()); } } } Envelope2D();  Envelope2D(final CoordinateReferenceSystem crs);  Envelope2D(final Envelope envelope);  Envelope2D(final CoordinateReferenceSystem crs, final Rectangle2D rect);  Envelope2D(final CoordinateReferenceSystem crs,
                      final double x, final double y, final double width, final double height);  Envelope2D(final DirectPosition2D minDP, final DirectPosition2D maxDP); final CoordinateReferenceSystem getCoordinateReferenceSystem(); void setCoordinateReferenceSystem(final CoordinateReferenceSystem crs); final int getDimension(); DirectPosition getLowerCorner(); DirectPosition getUpperCorner(); final double getMinimum(final int dimension); final double getMaximum(final int dimension); @Deprecated final double getCenter(final int dimension); final double getMedian(final int dimension); @Deprecated final double getLength(final int dimension); final double getSpan(final int dimension); @Override int hashCode(); @Override boolean equals(final Object object); boolean boundsEquals(final Envelope that, final int xDim, final int yDim, double eps); @Override String toString(); void setBounds(BoundingBox bounds); void include(BoundingBox bounds); void include(double x, double y); boolean intersects(BoundingBox bounds); boolean contains(BoundingBox bounds); boolean contains(DirectPosition location); BoundingBox toBounds(CoordinateReferenceSystem targetCRS);  }