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 aBoundingBoxfrom 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 aBoundingBoxfrom the minimum and maximum axis valuesBoundingBoxImpl(org.opengis.metadata.extent.GeographicBoundingBox gbb)Creates aBoundingBoxfrom an existingGeographicBoundingBoxBoundingBoxImpl(org.opengis.referencing.crs.CoordinateReferenceSystem crs)Creates aBoundingBoxfrom 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 aBoundingBoxfrom the x- and y- extents
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancontains(double x, double y)Provides a more efficient contains() method than the one in AbstractPolygonbooleanequals(Object obj)BoundingBoxgetBoundingBox()org.opengis.referencing.crs.CoordinateReferenceSystemgetCoordinateReferenceSystem()Returns the two-dimensional horizontal coordinate reference system to which theverticesare referenced.doublegetHeight()Gets the height of the bounding box, i.e.HorizontalPositiongetLowerCorner()Gets the position (getMinX(), getMinY())doublegetMaxX()Gets the maximum ordinate along the first axis, equivalent togetMaximum(0).doublegetMaxY()Gets the maximum ordinate along the second axis, equivalent togetMaximum(1).doublegetMinX()Gets the minimum ordinate along the first axis, equivalent togetMinimum(0).doublegetMinY()Gets the minimum ordinate along the second axis, equivalent togetMinimum(1).HorizontalPositiongetUpperCorner()Gets the position (getMaxX(), getMaxY())List<HorizontalPosition>getVertices()Returns a list of vertices in anticlockwise order starting at minx, minydoublegetWidth()Gets the width of the bounding box, i.e.static BoundingBoxImplglobal()inthashCode()StringtoString()-
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 aBoundingBoxfrom 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 aBoundingBoxfrom the minimum and maximum axis values
-
BoundingBoxImpl
public BoundingBoxImpl(Extent<Double> xExtent, Extent<Double> yExtent, org.opengis.referencing.crs.CoordinateReferenceSystem crs)
Creates aBoundingBoxfrom the x- and y- extents
-
BoundingBoxImpl
public BoundingBoxImpl(org.opengis.metadata.extent.GeographicBoundingBox gbb)
Creates aBoundingBoxfrom an existingGeographicBoundingBox- Parameters:
gbb- TheGeographicBoundingBoxdefining thisBoundingBox
-
BoundingBoxImpl
public BoundingBoxImpl(org.opengis.referencing.crs.CoordinateReferenceSystem crs)
Creates aBoundingBoxfrom 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:PolygonReturns the two-dimensional horizontal coordinate reference system to which theverticesare referenced.- Specified by:
getCoordinateReferenceSystemin interfacePolygon- Returns:
- the two-dimensional horizontal coordinate reference system to which the vertices are referenced.
-
getMinX
public double getMinX()
Description copied from interface:BoundingBoxGets the minimum ordinate along the first axis, equivalent togetMinimum(0).- Specified by:
getMinXin interfaceBoundingBox
-
getMaxX
public double getMaxX()
Description copied from interface:BoundingBoxGets the maximum ordinate along the first axis, equivalent togetMaximum(0).- Specified by:
getMaxXin interfaceBoundingBox
-
getMinY
public double getMinY()
Description copied from interface:BoundingBoxGets the minimum ordinate along the second axis, equivalent togetMinimum(1).- Specified by:
getMinYin interfaceBoundingBox
-
getMaxY
public double getMaxY()
Description copied from interface:BoundingBoxGets the maximum ordinate along the second axis, equivalent togetMaximum(1).- Specified by:
getMaxYin interfaceBoundingBox
-
getWidth
public double getWidth()
Description copied from interface:BoundingBoxGets the width of the bounding box, i.e.getMaxX() - getMinX().- Specified by:
getWidthin interfaceBoundingBox
-
getHeight
public double getHeight()
Description copied from interface:BoundingBoxGets the height of the bounding box, i.e.getMaxY() - getMinY().- Specified by:
getHeightin interfaceBoundingBox
-
getLowerCorner
public HorizontalPosition getLowerCorner()
Description copied from interface:BoundingBoxGets the position (getMinX(), getMinY())- Specified by:
getLowerCornerin interfaceBoundingBox
-
getUpperCorner
public HorizontalPosition getUpperCorner()
Description copied from interface:BoundingBoxGets the position (getMaxX(), getMaxY())- Specified by:
getUpperCornerin interfaceBoundingBox
-
getVertices
public List<HorizontalPosition> getVertices()
Returns a list of vertices in anticlockwise order starting at minx, miny- Specified by:
getVerticesin 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:
containsin classAbstractPolygon
-
getBoundingBox
public BoundingBox getBoundingBox()
- Specified by:
getBoundingBoxin interfacePolygon- Overrides:
getBoundingBoxin classAbstractPolygon- Returns:
- The MBR of this
Polygon
-
hashCode
public int hashCode()
- Specified by:
hashCodein interfaceBoundingBox- Overrides:
hashCodein classAbstractPolygon
-
equals
public boolean equals(Object obj)
- Specified by:
equalsin interfaceBoundingBox- Overrides:
equalsin classAbstractPolygon
-
-