## org.opengis.geometry
Interface BoundingBox

All Superinterfaces:
  Envelope

    @Extension
    public interface BoundingBox

extends Envelope

Represents a two-dimensional envelope. This interface combines the ideas of `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`.

Since:
  GeoAPI 2.1

Method Summary
`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()` Provides the difference between minimum and maximum ordinate along the second axis.
`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()` Provides the difference between minimum and maximum ordinate along the first axis.
`void` `include(BoundingBox bounds)` Include the provided bounding box, expanding as necesary.
`void` `include(double x, double y)` Include 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 lengths along all dimension are zero.
`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.

Methods inherited from interface Envelope
`getCenter, getCoordinateReferenceSystem, getDimension, getLength, getLowerCorner, getMaximum, getMinimum, getUpperCorner`

Method Detail

### setBounds

    void setBounds(BoundingBox bounds)

  Sets this bounding box to be the same as the specified box.

### getMinX

    double getMinX()

  Provides the minimum ordinate along the first axis. This is equivalent to `getMinimum(0)`. There is no guarantee that this axis is oriented toward East.

### getMaxX

    double getMaxX()

  Provides the maximum ordinate along the first axis. This is equivalent to `getMaximum(0)`. There is no guarantee that this axis is oriented toward East.

### getMinY

    double getMinY()

  Provides the minimum ordinate along the second axis. This is equivalent to `getMinimum(1)`. There is no guarantee that this axis is oriented toward North.

### getMaxY

    double getMaxY()

  Provides the maximum ordinate along the second axis. This is equivalent to `getMaximum(1)`. There is no guarantee that this axis is oriented toward North.

### getWidth

    double getWidth()

  Provides the difference between minimum and maximum ordinate along the first axis. This is equivalent to `getLength(0)`. There is no guarantee that this axis is oriented toward East.

### getHeight

    double getHeight()

  Provides the difference between minimum and maximum ordinate along the second axis. This is equivalent to `getLength(1)`. There is no guarantee that this axis is oriented toward North.

### isEmpty

    boolean isEmpty()

  Returns `true` if lengths along all dimension are zero.

### include

    void include(BoundingBox bounds)

  Include the provided bounding box, expanding as necesary.

### include

    void include(double x,
                 double y)

  Include the provided coordinates, expanding as necessary.

### intersects

    boolean intersects(BoundingBox bounds)

  Returns `true` if the interior of this bounds intersects the interior of the provided bounds.

### contains

    boolean contains(BoundingBox bounds)

  Returns `true` if the provided bounds are contained by this bounding box.

### contains

    boolean contains(DirectPosition location)

  Returns `true` if the provided location is contained by this bounding box.

### contains

    boolean contains(double x,
                     double y)

  Returns `true` if the provided location is contained by this bounding box.

### toBounds

    BoundingBox toBounds(CoordinateReferenceSystem targetCRS)
                         throws TransformException

  Transforms this box to the specified CRS and returns a new bounding box for the transformed shape. This method provides a convenient (while not always efficient) way to get minimum and maximum ordinate values toward some specific axis directions, typically East and North.

  Example: if `box` is a bounding box using a geographic CRS with WGS84 datum, then one can write:

  >      GeographicCRS targetCRS   = crsAuthorityFactory.createGeographicCRS("EPSG:4326");
  >      BoundingBox   targetBox   = box.toBounds(targetCRS);
  >      double        minEasting  = targetBox.getMinY();
  >      double        minNorthing = targetBox.getMinX();

  Be aware that `"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.

  Parameters:
    `targetCRS` - The target CRS for the bounding box to be returned.
  Returns:
    A new bounding box wich includes the shape of this box transformed to the specified target CRS.
  Throws:
    `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 © 1994-2008 Open Geospatial Consortium. All Rights Reserved.