public class LatLngBounds extends Object implements Parcelable
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.
|
Parcelable.ClassLoaderCreator<T>, Parcelable.Creator<T>
Modifier and Type | Field and Description |
---|---|
static Parcelable.Creator<LatLngBounds> |
CREATOR
Inner class responsible for recreating Parcels into objects.
|
CONTENTS_FILE_DESCRIPTOR, PARCELABLE_WRITE_RETURN_VALUE
Modifier and Type | Method and Description |
---|---|
boolean |
contains(ILatLng 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(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 northLatitude,
double eastLongitude,
double southLatitude,
double westLongitude)
Returns a new LatLngBounds that is the intersection of this with another LatLngBounds
|
LatLngBounds |
intersect(LatLngBounds box)
Returns a new LatLngBounds that is the intersection of this with another box
|
boolean |
isEmptySpan()
Validate if LatLngBounds is empty, determined if absolute distance is
|
LatLng[] |
toLatLngs()
Return an array of LatLng objects resembling this bounds.
|
String |
toString()
Returns a string representaton of the object.
|
LatLngBounds |
union(double latNorth,
double lonEast,
double latSouth,
double lonWest)
Returns a new LatLngBounds that stretches to include another LatLngBounds,
given by corner points.
|
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 Parcelable.Creator<LatLngBounds> 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 String toString()
public LatLng[] toLatLngs()
public static LatLngBounds from(double latNorth, double lonEast, double latSouth, double lonWest)
GeometryConstants.MIN_LATITUDE
and GeometryConstants.MAX_LATITUDE
,
otherwise IllegalArgumentException will be thrown.
This method doesn't recalculate most east or most west boundaries.
Note that lonEast and lonWest will be wrapped to be in the range of [-180, 180],
see GeometryConstants.MIN_LONGITUDE
and GeometryConstants.MAX_LONGITUDE
public static LatLngBounds from(int z, int x, int y)
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(Object o)
public boolean contains(ILatLng 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 latNorth, double lonEast, double latSouth, double lonWest)
latNorth
- Northern LatitudelonEast
- Eastern LongitudelatSouth
- Southern LatitudelonWest
- Western Longitude@Nullable public LatLngBounds intersect(LatLngBounds box)
box
- LatLngBounds to intersect withpublic LatLngBounds intersect(double northLatitude, double eastLongitude, double southLatitude, double westLongitude)
northLatitude
- Northern LongitudeeastLongitude
- Eastern LatitudesouthLatitude
- Southern LongitudewestLongitude
- Western Latitudepublic int hashCode()
public int describeContents()
describeContents
in interface Parcelable
public void writeToParcel(Parcel out, int flags)
writeToParcel
in interface Parcelable
out
- The Parcel in which the object should be written.flags
- Additional flags about how the object should be written© 2015–2018 Mapbox. All rights reserved.