Package mil.nga.geopackage
Class BoundingBox
- java.lang.Object
-
- mil.nga.geopackage.BoundingBox
-
public class BoundingBox extends Object
Bounding Box with longitude and latitude ranges in degrees- Author:
- osbornb
-
-
Constructor Summary
Constructors Constructor Description BoundingBox()ConstructorBoundingBox(double minLongitude, double minLatitude, double maxLongitude, double maxLatitude)ConstructorBoundingBox(BoundingBox boundingBox)ConstructorBoundingBox(GeometryEnvelope envelope)Constructor
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description BoundingBoxboundCoordinates(double maxProjectionLongitude)Bound the bounding box longitudes within the min and max possible projection values.BoundingBoxboundWebMercatorCoordinates()Bound the bounding box coordinates within Web Mercator range valuesBoundingBoxboundWgs84Coordinates()Bound the bounding box coordinates within WGS84 range valuesGeometryEnvelopebuildEnvelope()Build a Geometry Envelope from the bounding boxstatic GeometryEnvelopebuildEnvelope(BoundingBox boundingBox)Build a Geometry Envelope from the bounding boxBoundingBoxcomplementary(double maxProjectionLongitude)If the bounding box spans the Anti-Meridian, attempt to get a complementary bounding box using the max longitude of the unit projectionBoundingBoxcomplementaryWebMercator()If the bounding box spans the Anti-Meridian, attempt to get a complementary Web Mercator bounding boxBoundingBoxcomplementaryWgs84()If the bounding box spans the Anti-Meridian, attempt to get a complementary WGS84 bounding boxbooleancontains(BoundingBox boundingBox)Determine if inclusively contains the provided bounding boxbooleanequals(Object obj)BoundingBoxexpandCoordinates(double maxProjectionLongitude)Expand the bounding box max longitude above the max possible projection value if needed to create a bounding box where the max longitude is numerically larger than the min longitude.BoundingBoxexpandWebMercatorCoordinates()Expand the bounding box max longitude above the max Web Mercator projection value if needed to create a bounding box where the max longitude is numerically larger than the min longitude.BoundingBoxexpandWgs84Coordinates()Expand the bounding box max longitude above the max WGS84 projection value if needed to create a bounding box where the max longitude is numerically larger than the min longitude.doublegetLatitudeRange()Get the latitude rangedoublegetLongitudeRange()Get the longitude rangedoublegetMaxLatitude()Get the max latitudedoublegetMaxLongitude()Get the max longitudedoublegetMinLatitude()Get the min latitudedoublegetMinLongitude()Get the min longitudeinthashCode()booleanintersects(BoundingBox boundingBox)Determine if intersects with the provided bounding boxbooleanintersects(BoundingBox boundingBox, boolean allowEmpty)Determine if intersects with the provided bounding boxbooleanisPoint()Determine if the bounding box is of a single pointBoundingBoxoverlap(BoundingBox boundingBox)Get the overlapping bounding box with the provided bounding boxBoundingBoxoverlap(BoundingBox boundingBox, boolean allowEmpty)Get the overlapping bounding box with the provided bounding boxvoidsetMaxLatitude(double maxLatitude)Set the max latitudevoidsetMaxLongitude(double maxLongitude)Set the max longitudevoidsetMinLatitude(double minLatitude)Set the min latitudevoidsetMinLongitude(double minLongitude)Set the min longitudeBoundingBoxsquareExpand()Expand the bounding box to an equally sized width and height bounding boxBoundingBoxsquareExpand(double bufferPercentage)Expand the bounding box to an equally sized width and height bounding box with optional empty edge bufferBoundingBoxtransform(ProjectionTransform transform)Transform the bounding box using the provided projection transformBoundingBoxtransform(GeometryTransform transform)Transform the bounding box using the provided projection transformBoundingBoxunion(BoundingBox boundingBox)Get the union bounding box with the provided bounding box
-
-
-
Constructor Detail
-
BoundingBox
public BoundingBox()
Constructor
-
BoundingBox
public BoundingBox(double minLongitude, double minLatitude, double maxLongitude, double maxLatitude)Constructor- Parameters:
minLongitude- min longitudeminLatitude- min latitudemaxLongitude- max longitudemaxLatitude- max latitude- Since:
- 2.0.0
-
BoundingBox
public BoundingBox(BoundingBox boundingBox)
Constructor- Parameters:
boundingBox- bounding box- Since:
- 1.1.6
-
BoundingBox
public BoundingBox(GeometryEnvelope envelope)
Constructor- Parameters:
envelope- geometry envelope- Since:
- 2.0.0
-
-
Method Detail
-
getMinLongitude
public double getMinLongitude()
Get the min longitude- Returns:
- min longitude
-
setMinLongitude
public void setMinLongitude(double minLongitude)
Set the min longitude- Parameters:
minLongitude- min longitude
-
getMaxLongitude
public double getMaxLongitude()
Get the max longitude- Returns:
- max longitude
-
setMaxLongitude
public void setMaxLongitude(double maxLongitude)
Set the max longitude- Parameters:
maxLongitude- max longitude
-
getMinLatitude
public double getMinLatitude()
Get the min latitude- Returns:
- min latitude
-
setMinLatitude
public void setMinLatitude(double minLatitude)
Set the min latitude- Parameters:
minLatitude- min latitude
-
getMaxLatitude
public double getMaxLatitude()
Get the max latitude- Returns:
- max latitude
-
setMaxLatitude
public void setMaxLatitude(double maxLatitude)
Set the max latitude- Parameters:
maxLatitude- max latitude
-
getLongitudeRange
public double getLongitudeRange()
Get the longitude range- Returns:
- longitude range
- Since:
- 3.5.0
-
getLatitudeRange
public double getLatitudeRange()
Get the latitude range- Returns:
- latitude range
- Since:
- 3.5.0
-
buildEnvelope
public GeometryEnvelope buildEnvelope()
Build a Geometry Envelope from the bounding box- Returns:
- geometry envelope
- Since:
- 1.1.0
-
buildEnvelope
public static GeometryEnvelope buildEnvelope(BoundingBox boundingBox)
Build a Geometry Envelope from the bounding box- Parameters:
boundingBox- bounding box- Returns:
- geometry envelope
- Since:
- 3.2.0
-
complementary
public BoundingBox complementary(double maxProjectionLongitude)
If the bounding box spans the Anti-Meridian, attempt to get a complementary bounding box using the max longitude of the unit projection- Parameters:
maxProjectionLongitude- max longitude of the world for the current bounding box units- Returns:
- complementary bounding box or nil if none
- Since:
- 2.0.0
-
complementaryWgs84
public BoundingBox complementaryWgs84()
If the bounding box spans the Anti-Meridian, attempt to get a complementary WGS84 bounding box- Returns:
- complementary bounding box or nil if none
- Since:
- 2.0.0
-
complementaryWebMercator
public BoundingBox complementaryWebMercator()
If the bounding box spans the Anti-Meridian, attempt to get a complementary Web Mercator bounding box- Returns:
- complementary bounding box or nil if none
- Since:
- 2.0.0
-
boundCoordinates
public BoundingBox boundCoordinates(double maxProjectionLongitude)
Bound the bounding box longitudes within the min and max possible projection values. This may result in a max longitude numerically lower than the min longitude.- Parameters:
maxProjectionLongitude- max longitude of the world for the current bounding box units- Returns:
- bounded bounding box
- Since:
- 2.0.0
-
boundWgs84Coordinates
public BoundingBox boundWgs84Coordinates()
Bound the bounding box coordinates within WGS84 range values- Returns:
- bounded bounding box
- Since:
- 2.0.0
-
boundWebMercatorCoordinates
public BoundingBox boundWebMercatorCoordinates()
Bound the bounding box coordinates within Web Mercator range values- Returns:
- bounded bounding box
- Since:
- 2.0.0
-
expandCoordinates
public BoundingBox expandCoordinates(double maxProjectionLongitude)
Expand the bounding box max longitude above the max possible projection value if needed to create a bounding box where the max longitude is numerically larger than the min longitude.- Parameters:
maxProjectionLongitude- max longitude of the world for the current bounding box units- Returns:
- expanded bounding box
- Since:
- 2.0.0
-
expandWgs84Coordinates
public BoundingBox expandWgs84Coordinates()
Expand the bounding box max longitude above the max WGS84 projection value if needed to create a bounding box where the max longitude is numerically larger than the min longitude.- Returns:
- expanded bounding box
- Since:
- 2.0.0
-
expandWebMercatorCoordinates
public BoundingBox expandWebMercatorCoordinates()
Expand the bounding box max longitude above the max Web Mercator projection value if needed to create a bounding box where the max longitude is numerically larger than the min longitude.- Returns:
- expanded bounding box
- Since:
- 2.0.0
-
transform
public BoundingBox transform(ProjectionTransform transform)
Transform the bounding box using the provided projection transform- Parameters:
transform- projection transform- Returns:
- transformed bounding box
- Since:
- 3.0.0
-
transform
public BoundingBox transform(GeometryTransform transform)
Transform the bounding box using the provided projection transform- Parameters:
transform- geometry transform- Returns:
- transformed bounding box
- Since:
- 6.0.0
-
intersects
public boolean intersects(BoundingBox boundingBox)
Determine if intersects with the provided bounding box- Parameters:
boundingBox- bounding box- Returns:
- true if intersects
- Since:
- 3.1.0
-
intersects
public boolean intersects(BoundingBox boundingBox, boolean allowEmpty)
Determine if intersects with the provided bounding box- Parameters:
boundingBox- bounding boxallowEmpty- allow empty ranges when determining intersection- Returns:
- true if intersects
- Since:
- 3.1.0
-
overlap
public BoundingBox overlap(BoundingBox boundingBox)
Get the overlapping bounding box with the provided bounding box- Parameters:
boundingBox- bounding box- Returns:
- bounding box
- Since:
- 3.1.0
-
overlap
public BoundingBox overlap(BoundingBox boundingBox, boolean allowEmpty)
Get the overlapping bounding box with the provided bounding box- Parameters:
boundingBox- bounding boxallowEmpty- allow empty ranges when determining overlap- Returns:
- bounding box
- Since:
- 3.1.0
-
union
public BoundingBox union(BoundingBox boundingBox)
Get the union bounding box with the provided bounding box- Parameters:
boundingBox- bounding box- Returns:
- bounding box
- Since:
- 3.1.0
-
contains
public boolean contains(BoundingBox boundingBox)
Determine if inclusively contains the provided bounding box- Parameters:
boundingBox- bounding box- Returns:
- true if contains
- Since:
- 3.1.0
-
squareExpand
public BoundingBox squareExpand()
Expand the bounding box to an equally sized width and height bounding box- Returns:
- new square expanded bounding box
- Since:
- 3.5.0
-
squareExpand
public BoundingBox squareExpand(double bufferPercentage)
Expand the bounding box to an equally sized width and height bounding box with optional empty edge buffer- Parameters:
bufferPercentage- bounding box edge buffer percentage. A value of 0.1 adds a 10% buffer on each side of the squared bounding box.- Returns:
- new square expanded bounding box
- Since:
- 3.5.0
-
isPoint
public boolean isPoint()
Determine if the bounding box is of a single point- Returns:
- true if a single point bounds
- Since:
- 3.5.0
-
-