|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.j4me.bluetoothgps.Coordinates
public class Coordinates
The Coordinates
class represents coordinates as
latitude-longitude-altitude values. The latitude and longitude values are
expressed in degrees using floating point values. The degrees are in decimal
values (rather than minutes/seconds). The coordinates are given using the
WGS84 datum.
This class also provides convenience methods for converting between a string
coordinate representation and the double
representation used in this
class.
Field Summary | |
---|---|
static int |
DD_MM
Identifier for string coordinate representation Degrees, Minutes, decimal fractions of a minute. |
static int |
DD_MM_SS
Identifier for string coordinate representation Degrees, Minutes, Seconds and decimal fractions of a second. |
Constructor Summary | |
---|---|
Coordinates(double latitude,
double longitude,
float altitude)
Constructs a new Coordinates object with the values specified. |
Method Summary | |
---|---|
float |
azimuthTo(Coordinates to)
Calculates the azimuth between the two points according to the ellipsoid model of WGS84. |
float |
distance(Coordinates to)
Calculates the geodetic distance between the two points according to the ellipsoid model of WGS84. |
boolean |
equals(java.lang.Object other)
Compares if two Coordinates object reference the same location. |
float |
getAltitude()
Returns the altitude component of this coordinate. |
double |
getLatitude()
Returns the latitude component of this coordinate. |
double |
getLongitude()
Returns the longitude component of this coordinate. |
void |
setAltitude(float altitude)
Sets the geodetic altitude for this point. |
void |
setLatitude(double latitude)
Sets the geodetic latitude for this point. |
void |
setLongitude(double longitude)
Sets the geodetic longitude for this point. |
java.lang.String |
toString()
Provides a string representation of the coordinates. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int DD_MM_SS
public static final int DD_MM
Constructor Detail |
---|
public Coordinates(double latitude, double longitude, float altitude)
Coordinates
object with the values specified.
The latitude and longitude parameters are expressed in degrees using
floating point values. The degrees are in decimal values (rather than
minutes/seconds).
The coordinate values always apply to the WGS84 datum.
The Float.NaN
value can be used for altitude to indicate that
altitude is not known.
latitude
- - the latitude of the location. Valid range: [-90.0,
90.0]. Positive values indicate northern latitude and negative
values southern latitude.longitude
- - the longitude of the location. Valid range: [-180.0,
180.0). Positive values indicate eastern longitude and negative
values western longitude.altitude
- - the altitude of the location in meters, defined as
height above WGS84 ellipsoid. Float.Nan
can be used to
indicate that altitude is not known.
java.lang.IllegalArgumentException
- - if an input parameter is out
of the valid range.Method Detail |
---|
public double getLatitude()
The latitude is given in WGS84 datum.
setLatitude(double)
public double getLongitude()
The longitude is given in WGS84 datum.
setLongitude(double)
public float getAltitude()
Float.Nan
that no altitude is not available.
setAltitude(float)
public void setAltitude(float altitude)
altitude
- - the altitude of the location in meters, defined as
height above the WGS84 ellipsoid. 0.0 means a location at the
ellipsoid surface, negative values mean the location is below the
ellipsoid surface, Float.Nan
that no altitude is not
availablegetAltitude()
public void setLatitude(double latitude)
latitude
- - the latitude component of this location in degrees.
Valid range: [-90.0, 90.0].
java.lang.IllegalArgumentException
- - if latitude is out of the
valid rangegetLatitude()
public void setLongitude(double longitude)
longitude
- - the longitude of the location in degrees. Valid range:
[-180.0, 180.0)
java.lang.IllegalArgumentException
- - if longitude is out of the
valid rangegetLongitude()
public float azimuthTo(Coordinates to)
to
- - the Coordinates
of the destination
java.lang.NullPointerException
- - if the parameter is null
public float distance(Coordinates to)
The implementation shall calculate this as exactly as it can. However, it is required that the result is within 0.35% of the correct result.
to
- - the Coordinates
of the destination
java.lang.NullPointerException
- - if the parameter is null
public boolean equals(java.lang.Object other)
Coordinates
object reference the same location.
equals
in class java.lang.Object
other
- is another Coordinates
object.
true
if the two reference the same location;
false
otherwise.public java.lang.String toString()
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |