public class LatLngBounds
extends java.lang.Object
This class does not wrap values to the world bounds.
Modifier and Type | Class and Description |
---|---|
static class |
LatLngBounds.Builder
Builder for composing LatLngBounds objects.
|
Modifier and Type | Field and Description |
---|---|
static <any> |
CREATOR
Inner class responsible for recreating Parcels into objects.
|
Modifier and Type | Method and Description |
---|---|
boolean |
contains(LatLng latLng)
Determines whether this LatLngBounds contains a point.
|
boolean |
contains(LatLngBounds other)
Determines whether this LatLngBounds contains another bounds.
|
int |
describeContents()
Describe the kinds of special objects contained in this Parcelable instance's marshaled representation.
|
boolean |
equals(java.lang.Object o)
Determines whether this LatLngBounds matches another one via LatLng.
|
static LatLngBounds |
from(double latNorth,
double lonEast,
double latSouth,
double lonWest)
Constructs a LatLngBounds from doubles representing a LatLng pair.
|
static LatLngBounds |
from(int z,
int x,
int y)
Constructs a LatLngBounds from a Tile identifier.
|
LatLng |
getCenter()
Calculates the centerpoint of this LatLngBounds by simple interpolation and returns
it as a point.
|
double |
getLatitudeSpan()
Get the absolute distance, in degrees, between the north and
south boundaries of this LatLngBounds
|
double |
getLatNorth()
Get the north latitude value of this bounds.
|
double |
getLatSouth()
Get the south latitude value of this bounds.
|
double |
getLonEast()
Get the east longitude value of this bounds.
|
double |
getLongitudeSpan()
Get the absolute distance, in degrees, between the west and
east boundaries of this LatLngBounds
|
double |
getLonWest()
Get the west longitude value of this bounds.
|
LatLng |
getNorthEast()
Get the latitude-longitude paur if the north east corner of this bounds.
|
LatLng |
getNorthWest()
Get the latitude-longitude pair of the north west corner of this bounds.
|
LatLng |
getSouthEast()
Get the latitude-longitude pair of the south east corner of this bounds.
|
LatLng |
getSouthWest()
Get the latitude-longitude pair of the south west corner of this bounds.
|
LatLngSpan |
getSpan()
Get the area spanned by this LatLngBounds
|
int |
hashCode()
Returns a hash code value for the object.
|
LatLngBounds |
include(LatLng latLng)
Constructs a LatLngBounds from current bounds with an additional latitude-longitude pair.
|
LatLngBounds |
intersect(double northLat,
double eastLon,
double southLat,
double westLon)
Returns a new LatLngBounds that is the intersection of this with another box.
|
LatLngBounds |
intersect(LatLngBounds box)
Returns a new LatLngBounds that is the intersection of this with another LatLngBounds,
|
boolean |
isEmptySpan()
Validate if LatLngBounds is empty, determined if absolute distance is
|
LatLng[] |
toLatLngs()
Return an array of LatLng objects resembling this bounds.
|
java.lang.String |
toString()
Returns a string representaton of the object.
|
LatLngBounds |
union(double northLat,
double eastLon,
double southLat,
double westLon)
Returns a new LatLngBounds that stretches to contain both this and another LatLngBounds.
|
LatLngBounds |
union(LatLngBounds bounds)
Returns a new LatLngBounds that stretches to contain both this and another LatLngBounds.
|
static LatLngBounds |
world()
Returns the world bounds.
|
void |
writeToParcel(Parcel out,
int flags)
Flatten this object in to a Parcel.
|
public static final <any> CREATOR
public static LatLngBounds world()
public LatLng getCenter()
public double getLatNorth()
public double getLatSouth()
public double getLonEast()
public double getLonWest()
public LatLng getSouthWest()
public LatLng getNorthEast()
public LatLng getSouthEast()
public LatLng getNorthWest()
public LatLngSpan getSpan()
public double getLatitudeSpan()
public double getLongitudeSpan()
public boolean isEmptySpan()
public java.lang.String toString()
toString
in class java.lang.Object
public LatLng[] toLatLngs()
public static LatLngBounds from(double latNorth, double lonEast, double latSouth, double lonWest)
This values of latNorth and latSouth should be in the range of [-90, 90],
see GeometryConstants.MIN_LATITUDE
and GeometryConstants.MAX_LATITUDE
,
otherwise IllegalArgumentException will be thrown.
latNorth should be greater or equal latSouth, otherwise IllegalArgumentException will be thrown.
This method doesn't recalculate most east or most west boundaries.
Note @since 7.0.0 lonEast and lonWest will NOT be wrapped to be in the range of [-180, 180],
see GeometryConstants.MIN_LONGITUDE
and GeometryConstants.MAX_LONGITUDE
lonEast should be greater or equal lonWest, otherwise IllegalArgumentException will be thrown.
public static LatLngBounds from(int z, int x, int y)
Returned bounds will have latitude in the range of Mercator projection.
z
- Tile zoom level.x
- Tile X coordinate.y
- Tile Y coordinate.GeometryConstants.MIN_MERCATOR_LATITUDE
,
GeometryConstants.MAX_MERCATOR_LATITUDE
public LatLngBounds include(LatLng latLng)
latLng
- the latitude lognitude pair to include in the bounds.public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
o
- another objectpublic boolean contains(LatLng latLng)
latLng
- the point which may be containedpublic boolean contains(LatLngBounds other)
other
- the bounds which may be containedpublic LatLngBounds union(LatLngBounds bounds)
bounds
- LatLngBounds to addpublic LatLngBounds union(double northLat, double eastLon, double southLat, double westLon)
This values of northLat and southLat should be in the range of [-90, 90],
see GeometryConstants.MIN_LATITUDE
and GeometryConstants.MAX_LATITUDE
,
otherwise IllegalArgumentException will be thrown.
northLat should be greater or equal southLat, otherwise IllegalArgumentException will be thrown.
eastLon should be greater or equal westLon, otherwise IllegalArgumentException will be thrown.
northLat
- Northern Latitude corner pointeastLon
- Eastern Longitude corner pointsouthLat
- Southern Latitude corner pointwestLon
- Western Longitude corner pointpublic LatLngBounds intersect(LatLngBounds box)
box
- LatLngBounds to intersect withpublic LatLngBounds intersect(double northLat, double eastLon, double southLat, double westLon)
This values of northLat and southLat should be in the range of [-90, 90],
see GeometryConstants.MIN_LATITUDE
and GeometryConstants.MAX_LATITUDE
,
otherwise IllegalArgumentException will be thrown.
northLat should be greater or equal southLat, otherwise IllegalArgumentException will be thrown.
eastLon should be greater or equal westLon, otherwise IllegalArgumentException will be thrown.
northLat
- Northern Latitude corner pointeastLon
- Eastern Longitude corner pointsouthLat
- Southern Latitude corner pointwestLon
- Western Longitude corner pointpublic int hashCode()
hashCode
in class java.lang.Object
public int describeContents()
public void writeToParcel(Parcel out, int flags)
out
- The Parcel in which the object should be written.flags
- Additional flags about how the object should be written© 2015–2019 Mapbox. All rights reserved.