public final class GeoBox extends Object implements Parcelable
GeoBox
es are immutable.
The valid ranges of the meridians and latitudes are the same as in LatLng
.
The southern latitude must always be less than or equal to the northern latitude.
The "western" meridian, however, can be greater than the "eastern" meridian, allowing
geo-boxes to cross the ±180 longitude line.Parcelable.ClassLoaderCreator<T>, Parcelable.Creator<T>
Modifier and Type | Field and Description |
---|---|
static Parcelable.Creator<GeoBox> |
CREATOR
Parcelable implementation. |
CONTENTS_FILE_DESCRIPTOR, PARCELABLE_WRITE_RETURN_VALUE
Modifier and Type | Method and Description |
---|---|
boolean |
contains(HasLatLng location)
Returns whether this box contains the given location.
|
boolean |
containsDeg(double lat,
double lng)
Returns whether this box contains the given coordinates, in degrees.
|
int |
describeContents()
Parcelable implementation. |
boolean |
equals(Object obj) |
static GeoBox |
fromDegrees(double south,
double north,
double west,
double east)
Returns a
GeoBox with the given bounds, in degrees. |
static GeoBox |
fromRadians(double south,
double north,
double west,
double east)
Returns a
GeoBox with the given bounds, in radians. |
static GeoBox |
getBounds(Collection<? extends HasLatLng> locations,
double uncrossedLongitude)
Returns the smallest bounding box of the given locations that does not cross the given
longitude line.
|
static GeoBox |
getBounds(HasLatLng l1,
HasLatLng l2)
Returns the smallest bounding box of the two given locations that does not cross the ±180
longitude line.
|
static GeoBox |
getBounds(HasLatLng loc1,
HasLatLng loc2,
double uncrossedLongitude)
Returns the smallest bounding box of the two given locations that does not cross the given
longitude line.
|
double |
getEastDeg()
Returns the eastern boundary of the box, in degrees.
|
double |
getEastRad()
Returns the eastern boundary of the box, in radians.
|
double |
getNorthDeg()
Returns the northern boundary of the box, in degrees.
|
LatLng |
getNorthEast()
Returns the north eastern corner.
|
double |
getNorthRad()
Returns the northern boundary of the box, in radians.
|
LatLng |
getNorthWest()
Returns the north western corner.
|
static GeoBox |
getPoint(HasLatLng location)
Returns a
GeoBox that contains only the specified location. |
double |
getSouthDeg()
Returns the southern boundary of the box, in degrees.
|
LatLng |
getSouthEast()
Returns the south eastern corner.
|
double |
getSouthRad()
Returns the southern boundary of the box, in radians.
|
LatLng |
getSouthWest()
Returns the south western corner.
|
double |
getWestDeg()
Returns the western boundary of the box, in degrees.
|
double |
getWestRad()
Returns the western boundary of the box, in radians.
|
int |
hashCode() |
String |
toString()
Returns a textual representation of this box.
|
void |
writeToParcel(Parcel target,
int flags)
Parcelable implementation. |
public static final Parcelable.Creator<GeoBox> CREATOR
Parcelable
implementation.public static GeoBox fromDegrees(double south, double north, double west, double east)
GeoBox
with the given bounds, in degrees. If west is greater than east, the
box is considered to cross the ±180 longitude line.public static GeoBox fromRadians(double south, double north, double west, double east)
GeoBox
with the given bounds, in radians. If west is greater than east, the
box is considered to cross the ±180 longitude line.public static GeoBox getPoint(HasLatLng location)
GeoBox
that contains only the specified location.public static GeoBox getBounds(HasLatLng loc1, HasLatLng loc2, double uncrossedLongitude)
public static GeoBox getBounds(HasLatLng l1, HasLatLng l2)
public static GeoBox getBounds(Collection<? extends HasLatLng> locations, double uncrossedLongitude)
public double getSouthDeg()
public double getNorthDeg()
public double getWestDeg()
public double getEastDeg()
public double getSouthRad()
public double getNorthRad()
public double getWestRad()
public double getEastRad()
public LatLng getSouthEast()
public LatLng getSouthWest()
public LatLng getNorthEast()
public LatLng getNorthWest()
public boolean contains(HasLatLng location)
public boolean containsDeg(double lat, double lng)
public int describeContents()
Parcelable
implementation.describeContents
in interface Parcelable
public void writeToParcel(Parcel target, int flags)
Parcelable
implementation.writeToParcel
in interface Parcelable