@Extension public interface BoundingBox extends Envelope
GeographicBoundingBox
with those of Envelope
. It provides convenience methods to
assist in accessing the formal properties of this object. Those methods (for example getMinX()
) match common usage in existing libraries like Java2D.
This object contains no additional information beyond that provided by Envelope
.
Modifier and Type  Method and Description 

boolean 
contains(BoundingBox bounds)
Returns
true if the provided bounds are contained by this bounding box. 
boolean 
contains(DirectPosition location)
Returns
true if the provided location is contained by this bounding box. 
boolean 
contains(double x,
double y)
Returns
true if the provided location is contained by this bounding box. 
double 
getHeight()

double 
getMaxX()
Provides the maximum ordinate along the first axis.

double 
getMaxY()
Provides the maximum ordinate along the second axis.

double 
getMinX()
Provides the minimum ordinate along the first axis.

double 
getMinY()
Provides the minimum ordinate along the second axis.

double 
getWidth()

void 
include(BoundingBox bounds)
Includes the provided bounding box, expanding as necesary.

void 
include(double x,
double y)
Includes the provided coordinates, expanding as necessary.

boolean 
intersects(BoundingBox bounds)
Returns
true if the interior of this bounds intersects the interior of the provided
bounds. 
boolean 
isEmpty()
Returns
true if spans along all dimension are zero or negative. 
void 
setBounds(BoundingBox bounds)
Sets this bounding box to be the same as the specified box.

BoundingBox 
toBounds(CoordinateReferenceSystem targetCRS)
Transforms this box to the specified CRS and returns a new bounding box for the transformed
shape.

getCoordinateReferenceSystem, getDimension, getLowerCorner, getMaximum, getMedian, getMinimum, getSpan, getUpperCorner
void setBounds(BoundingBox bounds)
bounds
 The new bounds.double getMinX()
getMinimum(0)
. There is no guarantee that this axis is
oriented toward East.double getMaxX()
getMaximum(0)
. There is no guarantee that this axis is
oriented toward East.double getMinY()
getMinimum(1)
. There is no guarantee that this axis is
oriented toward North.double getMaxY()
getMaximum(1)
. There is no guarantee that this axis is
oriented toward North.double getWidth()
getLength(0)
. There is no guarantee that this axis is oriented
toward East.double getHeight()
getLength(1)
. There is no guarantee that this axis is oriented
toward North.boolean isEmpty()
true
if spans along all dimension are zero or negative.true
if this bounding box is empty.void include(BoundingBox bounds)
bounds
 The bounds to add to this geographic bounding box.void include(double x, double y)
x
 The first ordinate value.y
 The second ordinate value.boolean intersects(BoundingBox bounds)
true
if the interior of this bounds intersects the interior of the provided
bounds.bounds
 The bounds to test for intersection.true
if the two bounds intersect.boolean contains(BoundingBox bounds)
true
if the provided bounds are contained by this bounding box.bounds
 The bounds to test for inclusion.true
if the given bounds is inside this bounds.boolean contains(DirectPosition location)
true
if the provided location is contained by this bounding box.location
 The direct position to test for inclusion.true
if the given position is inside this bounds.boolean contains(double x, double y)
true
if the provided location is contained by this bounding box. Note that
there is no guarantee that the (x, x) values are oriented toward
(East, North), since it
depends on the envelope CRS.x
 The first ordinate value.y
 The second ordinate value.true
if the given position is inside this bounds.BoundingBox toBounds(CoordinateReferenceSystem targetCRS) throws TransformException
Example: if box
is a bounding box using a geographic CRS with WGS84 datum, then one can write:
Be aware thatGeographicCRS targetCRS = crsAuthorityFactory.createGeographicCRS("EPSG:4326"); BoundingBox targetBox = box.toBounds(targetCRS); double minEasting = targetBox.getMinY(); double minNorthing = targetBox.getMinX();
"EPSG:4326"
has (latitude, longitude) axis order,
thus the inversion of X and Y in the above code.
Sophesticated applications will typically provide more efficient way to perform similar transformations in their context. For example Canvas store precomputed objective to display transforms.
targetCRS
 The target CRS for the bounding box to be returned.TransformException
 if no transformation path has been found from this box CRS to the specified target CRS, or if the
transformation failed for an other reason.Copyright © 1996–2018 Geotools. All rights reserved.