@Test public void testToBounds() { BoundingBox testBox; try { newZealand.toBounds(crs); fail("Expected a missmatch of CoordianteReferenceSystem"); } catch (TransformException t) { } try { testBox = australia.toBounds(crs); assertEquals("unexpected bounds x min after toBounds", 10, testBox.getMinX(), 0); assertEquals("unexpected bounds y min after toBounds", 110, testBox.getMinY(), 0); assertEquals("unexpected bounds x max after toBounds", 40, testBox.getMaxX(), 0); assertEquals("unexpected bounds y max after toBounds", 150, testBox.getMaxY(), 0); } catch (TransformException t) { fail("Missmatch of CoordianteReferenceSystem"); } }
public BoundingBox toBounds(CoordinateReferenceSystem targetCRS) throws TransformException { Envelope transformed = new GeneralEnvelope((BoundingBox) this); transformed = CRS.transform(transformed, targetCRS); return new Envelope2D(transformed); }
Envelope2D extends Rectangle2D.Double implements BoundingBox, Envelope, Cloneable { public BoundingBox toBounds(CoordinateReferenceSystem targetCRS) throws TransformException { Envelope transformed = new GeneralEnvelope((BoundingBox) this); transformed = CRS.transform(transformed, targetCRS); return new Envelope2D(transformed); } }
Envelope2D extends Rectangle2D.Double implements BoundingBox, Envelope, Cloneable { public BoundingBox toBounds(CoordinateReferenceSystem targetCRS) throws TransformException { Envelope transformed = new GeneralEnvelope((BoundingBox) this); transformed = CRS.transform(transformed, targetCRS); return new Envelope2D(transformed); } 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 BoundingBox toBounds(CoordinateReferenceSystem targetCRS) throws TransformException { Envelope transformed = new GeneralEnvelope((BoundingBox) this); transformed = CRS.transform(transformed, targetCRS); return new Envelope2D(transformed); } 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 BoundingBox toBounds(CoordinateReferenceSystem targetCRS) throws TransformException { Envelope transformed = new GeneralEnvelope((BoundingBox) this); transformed = CRS.transform(transformed, targetCRS); return new Envelope2D(transformed); } 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);  }