@Test public void testIntersectsBoundingBox() { boolean testIntersects; try { australia.intersects((BoundingBox) newZealand); fail("Expected a missmatch of CoordianteReferenceSystem"); } catch (MismatchedReferenceSystemException t) { } try { testIntersects = australia.intersects((BoundingBox) envelope2D); assertFalse(testIntersects); } catch (MismatchedReferenceSystemException t) { fail("Expected a match of CoordianteReferenceSystem"); } try { testIntersects = australia.intersects((BoundingBox) somewhereIntersectingAustralia); assertTrue(testIntersects); } catch (MismatchedReferenceSystemException t) { fail("Expected a match of CoordianteReferenceSystem"); } }
public boolean intersects(BoundingBox bounds) { ensureCompatibleReferenceSystem(bounds); if (isNull() || bounds.isEmpty()) { return false; } return !(bounds.getMinX() > this.getMaxX() || bounds.getMaxX() < this.getMinX() || bounds.getMinY() > this.getMaxY() || bounds.getMaxY() < this.getMinY()); }
Envelope2D extends Rectangle2D.Double implements BoundingBox, Envelope, Cloneable { public boolean intersects(BoundingBox bounds) { ensureCompatibleReferenceSystem(bounds); if (isNull() || bounds.isEmpty()) { return false; } return !(bounds.getMinX() > this.getMaxX() || bounds.getMaxX() < this.getMinX() || bounds.getMinY() > this.getMaxY() || bounds.getMaxY() < this.getMinY()); } }
Envelope2D extends Rectangle2D.Double implements BoundingBox, Envelope, Cloneable { public boolean intersects(BoundingBox bounds) { ensureCompatibleReferenceSystem(bounds); if (isNull() || bounds.isEmpty()) { return false; } return !(bounds.getMinX() > this.getMaxX() || bounds.getMaxX() < this.getMinX() || bounds.getMinY() > this.getMaxY() || bounds.getMaxY() < this.getMinY()); } 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 boolean intersects(BoundingBox bounds) { ensureCompatibleReferenceSystem(bounds); if (isNull() || bounds.isEmpty()) { return false; } return !(bounds.getMinX() > this.getMaxX() || bounds.getMaxX() < this.getMinX() || bounds.getMinY() > this.getMaxY() || bounds.getMaxY() < this.getMinY()); } 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 boolean intersects(BoundingBox bounds) { ensureCompatibleReferenceSystem(bounds); if (isNull() || bounds.isEmpty()) { return false; } return !(bounds.getMinX() > this.getMaxX() || bounds.getMaxX() < this.getMinX() || bounds.getMinY() > this.getMaxY() || bounds.getMaxY() < this.getMinY()); } 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);  }