public final class GeoCoordinate
extends java.lang.Object
GeoCoordinate
encapsulates a
latitude and longitude value, plus an optional altitude value.Modifier and Type | Field and Description |
---|---|
static int |
UNKNOWN_ALTITUDE
Definition of an unknown altitude.
|
Constructor and Description |
---|
GeoCoordinate(double latitude,
double longitude)
Creates a
GeoCoordinate with specified latitude and longitude values. |
GeoCoordinate(double latitude,
double longitude,
double altitude)
Creates a
GeoCoordinate with specified latitude, longitude and altitude values. |
GeoCoordinate(GeoCoordinate coordinate)
Creates a copy of an existing
GeoCoordinate object. |
Modifier and Type | Method and Description |
---|---|
double |
distanceTo(GeoCoordinate coord)
Calculates the distance (using the Haversine formula), as measured in meters, between this
GeoCoordinate and the specified GeoCoordinate . |
boolean |
equals(java.lang.Object other) |
double |
getAltitude()
Gets the current altitude, as measured in meters above sea level, of the
GeoCoordinate (z-axis on a map). |
double |
getHeading(GeoCoordinate coord)
Returns heading from this point to the given coordinate in degrees.
|
double |
getLatitude()
Gets the current latitude, as measured in degrees, of the
GeoCoordinate . |
double |
getLongitude()
Gets the current longitude, as measured in degrees, of the
GeoCoordinate . |
int |
hashCode() |
java.lang.String |
toString() |
public static final int UNKNOWN_ALTITUDE
public GeoCoordinate(double latitude, double longitude)
GeoCoordinate
with specified latitude and longitude values.latitude
- Initial latitude value, in degrees, between -90.0 and 90.0 inclusive.longitude
- Initial longitude value, in degrees, greater than or equal to -180.0 and less than
180.0.GeoCoordinate(double, double, double)
public GeoCoordinate(double latitude, double longitude, double altitude)
GeoCoordinate
with specified latitude, longitude and altitude values.latitude
- Initial latitude value, in degrees, between -90.0 and 90.0 inclusive.longitude
- Initial longitude value, in degrees, greater than or equal to -180.0 and less than
180.0.altitude
- Initial altitude value, in meters, between -10000.0 and 10000.0 inclusive.java.lang.IllegalArgumentException
- If the arguments constructs an invalid GeoCoordinate
.GeoCoordinate(double, double)
,
GeoCoordinate(GeoCoordinate)
public GeoCoordinate(GeoCoordinate coordinate)
GeoCoordinate
object.coordinate
- A GeoCoordinate
object used to initialize the new GeoCoordinate
GeoCoordinate(double, double, double)
,
GeoCoordinate(double, double)
public double getLatitude()
GeoCoordinate
. Latitude
represents the north-south coordinate, or the y-axis on a map.public double getLongitude()
GeoCoordinate
. Longitude
represents the east-west coordinate, or the x-axis on a map.public double getAltitude()
GeoCoordinate
(z-axis on a map).public double distanceTo(GeoCoordinate coord)
GeoCoordinate
and the specified GeoCoordinate
.coord
- A second GeoCoordinate
some distance awaypublic double getHeading(GeoCoordinate coord)
coord
- A second GeoCoordinate
to which the heading is calculatedpublic boolean equals(java.lang.Object other)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object