public class LatLng
extends java.lang.Object
implements java.io.Serializable
Constructor and Description |
---|
LatLng(double latitude,
double longitude)
Instantiates a new LatNng object based on latitude and longitude and default values of bearing(0.0) and radius(0).
|
LatLng(double latitude,
double longitude,
float bearing)
Instantiates a new LatLng object based on latitude, longitude, bearing and default values of radius(0)
|
LatLng(double latitude,
double longitude,
int radius)
Instantiates a new LatLng object based on latitude, longitude, radius and default values of bearing(0.0)
|
LatLng(double latitude,
double longitude,
int radius,
float bearing)
Instantiates a new LatLng object based on latitude, longitude, bearing and radius.
|
LatLng(android.location.Location location)
Instantiates a new LatLng object based on data from Location object
|
Modifier and Type | Method and Description |
---|---|
double |
distanceTo(LatLng other)
Calculate the great-circle distance between two points.
|
boolean |
equals(java.lang.Object other) |
double |
getBearing() |
double |
getLatitude() |
java.lang.String |
getLatitudeAsString() |
double |
getLongitude() |
java.lang.String |
getLongitudeAsString() |
float |
getRadius() |
int |
hashCode() |
boolean |
hasRadius() |
boolean |
isNear(LatLng that)
Check if two locations are near each other (almost equal).
|
boolean |
isNear(LatLng that,
double tolerance)
Check if two locations are near each other (almost equal within given tolerance).
|
static double[] |
toArrayCoordinateSystem(java.util.List<LatLng> locations)
This method flats coordinates,
[0] == lat, [1] == lon, [2] == lat, [3] == lon, ...
|
java.lang.String |
toSimplerString()
Formatted string representation of the LatLng object in simpler way.
|
java.lang.String |
toSimpleString()
Formatted string representation of the LatLng object.
|
java.lang.String |
toString() |
public LatLng(double latitude, double longitude)
latitude
- the latitude part of the coordinateslongitude
- the longitude part of the coordinatespublic LatLng(@NonNull android.location.Location location)
location
- the default android location objectpublic LatLng(double latitude, double longitude, int radius)
latitude
- the latitude part of the coordinateslongitude
- the longitude part of the coordinatesradius
- the radiuspublic LatLng(double latitude, double longitude, float bearing)
latitude
- the latitude part of the coordinateslongitude
- the longitude part of the coordinatesbearing
- the bearingpublic LatLng(double latitude, double longitude, int radius, float bearing)
latitude
- the latitude part of the coordinateslongitude
- the longitude part of the coordinatesradius
- the radiusbearing
- the bearingpublic double getLongitude()
public double getLatitude()
public double getBearing()
public float getRadius()
public boolean hasRadius()
public boolean equals(java.lang.Object other)
equals
in class java.lang.Object
public boolean isNear(LatLng that)
that
- the other locationpublic boolean isNear(LatLng that, double tolerance)
that
- the other locationtolerance
- criteria for coordinate equalitypublic int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String toSimpleString()
public java.lang.String toSimplerString()
public double distanceTo(LatLng other)
other
- locationpublic static double[] toArrayCoordinateSystem(java.util.List<LatLng> locations)
locations
- list of Locationspublic java.lang.String getLongitudeAsString()
public java.lang.String getLatitudeAsString()