public class BoundingBox
extends java.lang.Object
implements java.io.Serializable
| Modifier and Type | Field and Description |
|---|---|
double |
maxLatitude
The maximum latitude coordinate of this BoundingBox in degrees.
|
double |
maxLongitude
The maximum longitude coordinate of this BoundingBox in degrees.
|
double |
minLatitude
The minimum latitude coordinate of this BoundingBox in degrees.
|
double |
minLongitude
The minimum longitude coordinate of this BoundingBox in degrees.
|
| Constructor and Description |
|---|
BoundingBox(double minLatitude,
double minLongitude,
double maxLatitude,
double maxLongitude) |
BoundingBox(java.util.List<LatLong> latLongs) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
contains(double latitude,
double longitude) |
boolean |
contains(LatLong latLong) |
boolean |
equals(java.lang.Object obj) |
BoundingBox |
extendBoundingBox(BoundingBox boundingBox) |
BoundingBox |
extendCoordinates(double latitude,
double longitude)
Creates a BoundingBox extended up to coordinates (but does not cross date line/poles).
|
BoundingBox |
extendCoordinates(LatLong latLong)
Creates a BoundingBox extended up to
LatLong (but does not cross date line/poles). |
BoundingBox |
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).
|
BoundingBox |
extendMargin(float margin)
Creates a BoundingBox that is a fixed margin factor larger on all sides (but does not cross date line/poles).
|
BoundingBox |
extendMeters(int meters)
Creates a BoundingBox that is a fixed meter amount larger on all sides (but does not cross date line/poles).
|
static BoundingBox |
fromString(java.lang.String boundingBoxString)
Creates a new BoundingBox from a comma-separated string of coordinates in the order minLat, minLon, maxLat,
maxLon.
|
LatLong |
getCenterPoint() |
double |
getLatitudeSpan() |
double |
getLongitudeSpan() |
Rectangle |
getPositionRelativeToTile(Tile tile)
Computes the coordinates of this bounding box relative to a tile.
|
int |
hashCode() |
boolean |
intersects(BoundingBox boundingBox) |
boolean |
intersectsArea(LatLong[][] latLongs)
Returns if an area built from the latLongs intersects with a bias towards
returning true.
|
java.lang.String |
toString() |
public final double maxLatitude
public final double maxLongitude
public final double minLatitude
public final double minLongitude
public BoundingBox(double minLatitude,
double minLongitude,
double maxLatitude,
double maxLongitude)
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.java.lang.IllegalArgumentException - if a coordinate is invalid.public BoundingBox(java.util.List<LatLong> latLongs)
latLongs - the coordinates list.public static BoundingBox fromString(java.lang.String boundingBoxString)
boundingBoxString - the string that describes the BoundingBox.java.lang.IllegalArgumentException - if the string cannot be parsed or describes an invalid BoundingBox.public boolean contains(double latitude,
double longitude)
latitude - the latitude coordinate in degrees.longitude - the longitude coordinate in degrees.public boolean contains(LatLong latLong)
latLong - the LatLong whose coordinates should be checked.public boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic BoundingBox extendBoundingBox(BoundingBox boundingBox)
boundingBox - the BoundingBox which this BoundingBox should be extended if it is largerpublic BoundingBox extendCoordinates(double latitude, double longitude)
latitude - up to the extensionlongitude - up to the extensionpublic BoundingBox extendCoordinates(LatLong latLong)
LatLong (but does not cross date line/poles).latLong - coordinates up to the extensionpublic BoundingBox extendDegrees(double verticalExpansion, double horizontalExpansion)
verticalExpansion - degree extension (must be >= 0)horizontalExpansion - degree extension (must be >= 0)public BoundingBox extendMargin(float margin)
margin - extension (must be > 0)public BoundingBox extendMeters(int meters)
meters - extension (must be >= 0)public LatLong getCenterPoint()
public double getLatitudeSpan()
public double getLongitudeSpan()
public Rectangle getPositionRelativeToTile(Tile tile)
tile - the tile to compute the relative position for.public int hashCode()
hashCode in class java.lang.Objectpublic boolean intersects(BoundingBox boundingBox)
boundingBox - the BoundingBox which should be checked for intersection with this BoundingBox.public boolean intersectsArea(LatLong[][] latLongs)
latLongs - the points that define an areapublic java.lang.String toString()
toString in class java.lang.Object