public class Position
extends java.lang.Object
The org.osgi.util.measurement.Measurement class is used to represent
the values that make up a position.
A given position object may lack any of it's components, i.e. the altitude may not be known. Such missing values will be represented by null.
Position does not override the implementation of either equals() or
hashCode() because it is not clear how missing values should be handled. It
is up to the user of a position to determine how best to compare two position
objects. A Position object is immutable.
| Modifier and Type | Field and Description |
|---|---|
private Measurement |
altitude |
private static double |
LAT_RANGE |
private Measurement |
latitude |
private static double |
LON_RANGE |
private Measurement |
longitude |
private Measurement |
speed |
private Measurement |
track |
private static double |
TRACK_RANGE |
| Constructor and Description |
|---|
Position(Measurement lat,
Measurement lon,
Measurement alt,
Measurement speed,
Measurement track)
Constructs a
Position object with the given values. |
| Modifier and Type | Method and Description |
|---|---|
Measurement |
getAltitude()
Returns the altitude of this position in meters.
|
Measurement |
getLatitude()
Returns the latitude of this position in radians.
|
Measurement |
getLongitude()
Returns the longitude of this position in radians.
|
Measurement |
getSpeed()
Returns the ground speed of this position in meters per second.
|
Measurement |
getTrack()
Returns the track of this position in radians as a compass heading.
|
private static double |
normalize(double value,
double range)
This function normalizes the a value according to a range.
|
private final Measurement altitude
private final Measurement longitude
private final Measurement latitude
private final Measurement speed
private final Measurement track
private static final double LON_RANGE
private static final double LAT_RANGE
private static final double TRACK_RANGE
public Position(Measurement lat, Measurement lon, Measurement alt, Measurement speed, Measurement track)
Position object with the given values.lat - a Measurement object specifying the latitude in
radians, or nulllon - a Measurement object specifying the longitude in
radians, or nullalt - a Measurement object specifying the altitude in
meters, or nullspeed - a Measurement object specifying the speed in meters
per second, or nulltrack - a Measurement object specifying the track in
radians, or nullpublic Measurement getAltitude()
Measurement object in Unit.m representing the
altitude in meters above the ellipsoid null if the
altitude is not known.public Measurement getLongitude()
Measurement object in Unit.rad representing the
longitude, or null if the longitude is not known.public Measurement getLatitude()
Measurement object in Unit.rad representing the
latitude, or null if the latitude is not known..public Measurement getSpeed()
Measurement object in Unit.m_s representing the
speed, or null if the speed is not known..public Measurement getTrack()
Measurement object in Unit.rad representing the
track, or null if the track is not known..private static double normalize(double value,
double range)
value - The value that needs adjustingrange - -range = < value < range