Package uk.ac.rdg.resc.edal.geometry
Class BoundingBoxImpl
- java.lang.Object
-
- uk.ac.rdg.resc.edal.geometry.AbstractPolygon
-
- uk.ac.rdg.resc.edal.geometry.BoundingBoxImpl
-
- All Implemented Interfaces:
Serializable
,Domain<HorizontalPosition>
,BoundingBox
,Polygon
public final class BoundingBoxImpl extends AbstractPolygon implements BoundingBox
Immutable implementation of aBoundingBox
.- Author:
- Guy Griffiths, Jon
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description BoundingBoxImpl(double minx, double miny, double maxx, double maxy)
Creates aBoundingBox
from the minimum and maximum axis values, with the default CRSBoundingBoxImpl(double minx, double miny, double maxx, double maxy, org.opengis.referencing.crs.CoordinateReferenceSystem crs)
Creates aBoundingBox
from the minimum and maximum axis valuesBoundingBoxImpl(org.opengis.metadata.extent.GeographicBoundingBox gbb)
Creates aBoundingBox
from an existingGeographicBoundingBox
BoundingBoxImpl(org.opengis.referencing.crs.CoordinateReferenceSystem crs)
Creates aBoundingBox
from aCoordinateReferenceSystem
, where the bounds are the limits of validity of the CRSBoundingBoxImpl(Extent<Double> xExtent, Extent<Double> yExtent, org.opengis.referencing.crs.CoordinateReferenceSystem crs)
Creates aBoundingBox
from the x- and y- extents
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
contains(double x, double y)
Provides a more efficient contains() method than the one in AbstractPolygonboolean
equals(Object obj)
BoundingBox
getBoundingBox()
org.opengis.referencing.crs.CoordinateReferenceSystem
getCoordinateReferenceSystem()
Returns the two-dimensional horizontal coordinate reference system to which thevertices
are referenced.double
getHeight()
Gets the height of the bounding box, i.e.HorizontalPosition
getLowerCorner()
Gets the position (getMinX(), getMinY())double
getMaxX()
Gets the maximum ordinate along the first axis, equivalent togetMaximum(0)
.double
getMaxY()
Gets the maximum ordinate along the second axis, equivalent togetMaximum(1)
.double
getMinX()
Gets the minimum ordinate along the first axis, equivalent togetMinimum(0)
.double
getMinY()
Gets the minimum ordinate along the second axis, equivalent togetMinimum(1)
.HorizontalPosition
getUpperCorner()
Gets the position (getMaxX(), getMaxY())List<HorizontalPosition>
getVertices()
Returns a list of vertices in anticlockwise order starting at minx, minydouble
getWidth()
Gets the width of the bounding box, i.e.static BoundingBoxImpl
global()
int
hashCode()
String
toString()
-
Methods inherited from class uk.ac.rdg.resc.edal.geometry.AbstractPolygon
contains, getBoundaryPath
-
-
-
-
Constructor Detail
-
BoundingBoxImpl
public BoundingBoxImpl(double minx, double miny, double maxx, double maxy)
Creates aBoundingBox
from the minimum and maximum axis values, with the default CRS
-
BoundingBoxImpl
public BoundingBoxImpl(double minx, double miny, double maxx, double maxy, org.opengis.referencing.crs.CoordinateReferenceSystem crs)
Creates aBoundingBox
from the minimum and maximum axis values
-
BoundingBoxImpl
public BoundingBoxImpl(Extent<Double> xExtent, Extent<Double> yExtent, org.opengis.referencing.crs.CoordinateReferenceSystem crs)
Creates aBoundingBox
from the x- and y- extents
-
BoundingBoxImpl
public BoundingBoxImpl(org.opengis.metadata.extent.GeographicBoundingBox gbb)
Creates aBoundingBox
from an existingGeographicBoundingBox
- Parameters:
gbb
- TheGeographicBoundingBox
defining thisBoundingBox
-
BoundingBoxImpl
public BoundingBoxImpl(org.opengis.referencing.crs.CoordinateReferenceSystem crs)
Creates aBoundingBox
from aCoordinateReferenceSystem
, where the bounds are the limits of validity of the CRS- Parameters:
crs
-
-
-
Method Detail
-
global
public static BoundingBoxImpl global()
-
getCoordinateReferenceSystem
public org.opengis.referencing.crs.CoordinateReferenceSystem getCoordinateReferenceSystem()
Description copied from interface:Polygon
Returns the two-dimensional horizontal coordinate reference system to which thevertices
are referenced.- Specified by:
getCoordinateReferenceSystem
in interfacePolygon
- Returns:
- the two-dimensional horizontal coordinate reference system to which the vertices are referenced.
-
getMinX
public double getMinX()
Description copied from interface:BoundingBox
Gets the minimum ordinate along the first axis, equivalent togetMinimum(0)
.- Specified by:
getMinX
in interfaceBoundingBox
-
getMaxX
public double getMaxX()
Description copied from interface:BoundingBox
Gets the maximum ordinate along the first axis, equivalent togetMaximum(0)
.- Specified by:
getMaxX
in interfaceBoundingBox
-
getMinY
public double getMinY()
Description copied from interface:BoundingBox
Gets the minimum ordinate along the second axis, equivalent togetMinimum(1)
.- Specified by:
getMinY
in interfaceBoundingBox
-
getMaxY
public double getMaxY()
Description copied from interface:BoundingBox
Gets the maximum ordinate along the second axis, equivalent togetMaximum(1)
.- Specified by:
getMaxY
in interfaceBoundingBox
-
getWidth
public double getWidth()
Description copied from interface:BoundingBox
Gets the width of the bounding box, i.e.getMaxX() - getMinX()
.- Specified by:
getWidth
in interfaceBoundingBox
-
getHeight
public double getHeight()
Description copied from interface:BoundingBox
Gets the height of the bounding box, i.e.getMaxY() - getMinY()
.- Specified by:
getHeight
in interfaceBoundingBox
-
getLowerCorner
public HorizontalPosition getLowerCorner()
Description copied from interface:BoundingBox
Gets the position (getMinX(), getMinY())- Specified by:
getLowerCorner
in interfaceBoundingBox
-
getUpperCorner
public HorizontalPosition getUpperCorner()
Description copied from interface:BoundingBox
Gets the position (getMaxX(), getMaxY())- Specified by:
getUpperCorner
in interfaceBoundingBox
-
getVertices
public List<HorizontalPosition> getVertices()
Returns a list of vertices in anticlockwise order starting at minx, miny- Specified by:
getVertices
in interfacePolygon
- Returns:
- the list of vertices that define this polygon in the horizontal plane.
-
contains
public boolean contains(double x, double y)
Provides a more efficient contains() method than the one in AbstractPolygon- Overrides:
contains
in classAbstractPolygon
-
getBoundingBox
public BoundingBox getBoundingBox()
- Specified by:
getBoundingBox
in interfacePolygon
- Overrides:
getBoundingBox
in classAbstractPolygon
- Returns:
- The MBR of this
Polygon
-
hashCode
public int hashCode()
- Specified by:
hashCode
in interfaceBoundingBox
- Overrides:
hashCode
in classAbstractPolygon
-
equals
public boolean equals(Object obj)
- Specified by:
equals
in interfaceBoundingBox
- Overrides:
equals
in classAbstractPolygon
-
-