java.lang.Object | |
↳ | com.neomades.location.Location |
A data class representing a geographic location.
It consists of a latitude, longitude, altitude, speed, bearing and accuracy information.
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Location(double latitude, double longitude)
Constructs a new location object with the attributes specified in parameters.
|
Protected Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Location()
Constructs a new Location object.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
float |
distanceTo(Location dest)
Returns the approximate distance in meters between this location and the
given location.
| ||||||||||
float |
getAccuracy()
Returns the estimated accuracy of this location, in meters.
| ||||||||||
double |
getAltitude()
Returns the altitude if available, in meters above sea level.
| ||||||||||
float |
getBearing()
Returns the bearing, in degrees.
| ||||||||||
double |
getLatitude()
Returns the latitude, in degrees.
| ||||||||||
double |
getLongitude()
Returns the longitude, in degrees.
| ||||||||||
float |
getSpeed()
Returns the speed if it is available, in meters/second over ground.
| ||||||||||
long |
getTime()
Returns the UTC time of this fix, in milliseconds since January 1, 1970.
| ||||||||||
void |
setAccuracy(float accuracy)
Sets the estimated accuracy of this location, in meters.
| ||||||||||
void |
setAltitude(double altitude)
Sets the altitude, in meters above sea level.
| ||||||||||
void |
setBearing(float bearing)
Sets the bearing, in degrees.
| ||||||||||
void |
setLatitude(double latitude)
Sets the latitude, in degrees.
| ||||||||||
void |
setLongitude(double longitude)
Sets the longitude, in degrees.
| ||||||||||
void |
setProvider(String provider)
Sets the name of the provider that generated this fix.
| ||||||||||
void |
setSpeed(float speed)
Sets the speed, in meters/second over ground.
| ||||||||||
void |
setTime(long time)
Sets the UTC time of this fix, in milliseconds since January 1, 1970.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
Constructs a new location object with the attributes specified in parameters.
latitude | Represents the location's latitude. Must be between -90 and 90 |
---|---|
longitude | Represents the location's longitude. Must be between -180 and 180 |
IllegalArgumentException | if the given latitude or longitude is invalid |
---|
Constructs a new Location object.
This constructor is for internal use only.
Returns the approximate distance in meters between this location and the given location.
dest | Represents the given location |
---|
Returns the estimated accuracy of this location, in meters.
Returns the altitude if available, in meters above sea level.
Returns the bearing, in degrees.
Returns the latitude, in degrees.
Returns the longitude, in degrees.
Returns the speed if it is available, in meters/second over ground.
Returns the UTC time of this fix, in milliseconds since January 1, 1970.
Sets the estimated accuracy of this location, in meters.
accuracy | the accuracy in meters |
---|
Sets the altitude, in meters above sea level.
altitude | the altitude in meters |
---|
Sets the bearing, in degrees.
bearing | the bearing in degrees |
---|
Sets the latitude, in degrees.
latitude | the latitude in degrees. Must be between -90 and 90 |
---|
IllegalArgumentException | if the given latitude is invalid |
---|
Sets the longitude, in degrees.
longitude | the longitude in degrees. Must be between -180 and 180 |
---|
IllegalArgumentException | if the given longitude is invalid |
---|
Sets the name of the provider that generated this fix.
provider | the name of the provider |
---|
Sets the speed, in meters/second over ground.
speed | the speedi in meters/second |
---|
Sets the UTC time of this fix, in milliseconds since January 1, 1970.
time | the time in milliseconds since January 1, 1970 |
---|