Package org.oscim.core
Class BoundingBox
java.lang.Object
org.oscim.core.BoundingBox
A BoundingBox represents an immutable set of two latitude and two longitude
coordinates.
-
Field Summary
FieldsModifier and TypeFieldDescriptionintThe maximum latitude value of this BoundingBox in microdegrees (degrees * 10^6).intThe maximum longitude value of this BoundingBox in microdegrees (degrees * 10^6).intThe minimum latitude value of this BoundingBox in microdegrees (degrees * 10^6).intThe minimum longitude value of this BoundingBox in microdegrees (degrees * 10^6). -
Constructor Summary
ConstructorsConstructorDescriptionBoundingBox(double minLatitude, double minLongitude, double maxLatitude, double maxLongitude) BoundingBox(int minLatitudeE6, int minLongitudeE6, int maxLatitudeE6, int maxLongitudeE6) BoundingBox(List<GeoPoint> geoPoints) -
Method Summary
Modifier and TypeMethodDescriptionbooleanbooleanextendBoundingBox(BoundingBox boundingBox) extendCoordinates(GeoPoint geoPoint) Creates a BoundingBox extended up toGeoPoint(but does not cross date line/poles).extendDegrees(double verticalExpansion, double horizontalExpansion) Creates a BoundingBox that is a fixed degree amount larger on all sides (but does not cross date line/poles).extendMargin(float margin) Creates a BoundingBox that is a fixed margin factor larger on all sides (but does not cross date line/poles).extendMeters(int meters) Creates a BoundingBox that is a fixed meter amount larger on all sides (but does not cross date line/poles).format()doubledoubledoubledoubledoubledoubleinthashCode()booleanintersects(BoundingBox boundingBox) booleanintersectsArea(GeoPoint[][] geoPoints) Returns if an area built from the geoPoints intersects with a bias towards returning true.toString()
-
Field Details
-
maxLatitudeE6
public int maxLatitudeE6The maximum latitude value of this BoundingBox in microdegrees (degrees * 10^6). -
maxLongitudeE6
public int maxLongitudeE6The maximum longitude value of this BoundingBox in microdegrees (degrees * 10^6). -
minLatitudeE6
public int minLatitudeE6The minimum latitude value of this BoundingBox in microdegrees (degrees * 10^6). -
minLongitudeE6
public int minLongitudeE6The minimum longitude value of this BoundingBox in microdegrees (degrees * 10^6).
-
-
Constructor Details
-
BoundingBox
public BoundingBox(int minLatitudeE6, int minLongitudeE6, int maxLatitudeE6, int maxLongitudeE6) - Parameters:
minLatitudeE6- the minimum latitude in microdegrees (degrees * 10^6).minLongitudeE6- the minimum longitude in microdegrees (degrees * 10^6).maxLatitudeE6- the maximum latitude in microdegrees (degrees * 10^6).maxLongitudeE6- the maximum longitude in microdegrees (degrees * 10^6).
-
BoundingBox
public BoundingBox(double minLatitude, double minLongitude, double maxLatitude, double maxLongitude) - Parameters:
minLatitude- the minimum latitude coordinate in degrees.minLongitude- the minimum longitude coordinate in degrees.maxLatitude- the maximum latitude coordinate in degrees.maxLongitude- the maximum longitude coordinate in degrees.
-
BoundingBox
- Parameters:
geoPoints- the coordinates list.
-
-
Method Details
-
contains
- Parameters:
geoPoint- the point whose coordinates should be checked.- Returns:
- true if this BoundingBox contains the given GeoPoint, false otherwise.
-
equals
-
extendBoundingBox
- Parameters:
boundingBox- the BoundingBox which this BoundingBox should be extended if it is larger- Returns:
- a BoundingBox that covers this BoundingBox and the given BoundingBox.
-
extendCoordinates
Creates a BoundingBox extended up toGeoPoint(but does not cross date line/poles).- Parameters:
geoPoint- coordinates up to the extension- Returns:
- an extended BoundingBox or this (if contains coordinates)
-
extendDegrees
Creates a BoundingBox that is a fixed degree amount larger on all sides (but does not cross date line/poles).- Parameters:
verticalExpansion- degree extension (must be >= 0)horizontalExpansion- degree extension (must be >= 0)- Returns:
- an extended BoundingBox or this (if degrees == 0)
-
extendMargin
Creates a BoundingBox that is a fixed margin factor larger on all sides (but does not cross date line/poles).- Parameters:
margin- extension (must be > 0)- Returns:
- an extended BoundingBox or this (if margin == 1)
-
extendMeters
Creates a BoundingBox that is a fixed meter amount larger on all sides (but does not cross date line/poles).- Parameters:
meters- extension (must be >= 0)- Returns:
- an extended BoundingBox or this (if meters == 0)
-
format
-
getCenterPoint
- Returns:
- the GeoPoint at the horizontal and vertical center of this BoundingBox.
-
getLatitudeSpan
public double getLatitudeSpan()- Returns:
- the latitude span of this BoundingBox in degrees.
-
getLongitudeSpan
public double getLongitudeSpan()- Returns:
- the longitude span of this BoundingBox in degrees.
-
getMaxLatitude
public double getMaxLatitude()- Returns:
- the maximum latitude value of this BoundingBox in degrees.
-
getMaxLongitude
public double getMaxLongitude()- Returns:
- the maximum longitude value of this BoundingBox in degrees.
-
getMinLatitude
public double getMinLatitude()- Returns:
- the minimum latitude value of this BoundingBox in degrees.
-
getMinLongitude
public double getMinLongitude()- Returns:
- the minimum longitude value of this BoundingBox in degrees.
-
hashCode
public int hashCode() -
intersects
- Parameters:
boundingBox- the BoundingBox which should be checked for intersection with this BoundingBox.- Returns:
- true if this BoundingBox intersects with the given BoundingBox, false otherwise.
-
intersectsArea
Returns if an area built from the geoPoints intersects with a bias towards returning true. The method returns fast if any of the points lie within the bbox. If none of the points lie inside the box, it constructs the outer bbox for all the points and tests for intersection (so it is possible that the area defined by the points does not actually intersect)- Parameters:
geoPoints- the points that define an area- Returns:
- false if there is no intersection, true if there could be an intersection
-
toString
-