public abstract class BoundingBox
extends java.lang.Object
implements java.io.Serializable
This class simplifies the build process for creating a bounding box and working with them when
deserialized. specific parameter naming helps define which coordinates belong where when a
bounding box instance is being created. Note that since GeoJson objects only have the option of
including a bounding box JSON element, the bbox
value returned by a GeoJson object might
be null.
At a minimum, a bounding box will have two Point
s or four coordinates which define the
box. A 3rd dimensional bounding box can be produced if elevation or altitude is defined.
Constructor and Description |
---|
BoundingBox() |
Modifier and Type | Method and Description |
---|---|
double |
east()
Convenience method for getting the bounding box most easterly point (longitude) as a double
coordinate.
|
static BoundingBox |
fromCoordinates(double west,
double south,
double east,
double north)
Define a new instance of this class by passing in four coordinates in the same order they would
appear in the serialized GeoJson form.
|
static BoundingBox |
fromCoordinates(double west,
double south,
double southwestAltitude,
double east,
double north,
double northEastAltitude)
Define a new instance of this class by passing in four coordinates in the same order they would
appear in the serialized GeoJson form.
|
static BoundingBox |
fromJson(java.lang.String json) |
static BoundingBox |
fromPoints(Point southwest,
Point northeast)
Define a new instance of this class by passing in two
Point s, representing both the
southwest and northwest corners of the bounding box. |
double |
north()
Convenience method for getting the bounding box most westerly point (longitude) as a double
coordinate.
|
abstract Point |
northeast()
Provides the
Point which represents the northeast corner of this bounding box when the
map is facing due north. |
double |
south()
Convenience method for getting the bounding box most southerly point (latitude) as a double
coordinate.
|
abstract Point |
southwest()
Provides the
Point which represents the southwest corner of this bounding box when the
map is facing due north. |
java.lang.String |
toJson()
This takes the currently defined values found inside this instance and converts it to a GeoJson
string.
|
static com.google.gson.TypeAdapter<BoundingBox> |
typeAdapter(com.google.gson.Gson gson) |
double |
west()
Convenience method for getting the bounding box most westerly point (longitude) as a double
coordinate.
|
public static BoundingBox fromJson(java.lang.String json)
public static BoundingBox fromPoints(@NonNull Point southwest, @NonNull Point northeast)
Point
s, representing both the
southwest and northwest corners of the bounding box.southwest
- represents the bottom left corner of the bounding box when the camera is
pointing due northnortheast
- represents the top right corner of the bounding box when the camera is
pointing due northpublic static BoundingBox fromCoordinates(double west, double south, double east, double north)
west
- the left side of the bounding box when the map is facing due northsouth
- the bottom side of the bounding box when the map is facing due northeast
- the right side of the bounding box when the map is facing due northnorth
- the top side of the bounding box when the map is facing due northpublic static BoundingBox fromCoordinates(double west, double south, double southwestAltitude, double east, double north, double northEastAltitude)
west
- the left side of the bounding box when the map is facing due northsouth
- the bottom side of the bounding box when the map is facing due northsouthwestAltitude
- the southwest corner altitude or elevation when the map is facing due
northeast
- the right side of the bounding box when the map is facing due northnorth
- the top side of the bounding box when the map is facing due northnorthEastAltitude
- the northeast corner altitude or elevation when the map is facing due
north@NonNull public abstract Point southwest()
Point
which represents the southwest corner of this bounding box when the
map is facing due north.Point
which defines this bounding boxes southwest corner@NonNull public abstract Point northeast()
Point
which represents the northeast corner of this bounding box when the
map is facing due north.Point
which defines this bounding boxes northeast cornerpublic final double west()
public final double south()
public final double east()
public final double north()
public static com.google.gson.TypeAdapter<BoundingBox> typeAdapter(com.google.gson.Gson gson)
public final java.lang.String toJson()