Provides linear or angular {@link javax.measure.quantity quantities} which
designate the position that a point occupies in a given reference frame or system.
Coordinates are unambigous only when the {@link org.jscience.geography.coordinates.crs
coordinates reference system} to which those coordinates are related has
been fully defined.
Applications may create new types of coordinates either by extending
{@link org.jscience.geography.coordinates.Coordinates Coordinates}
(in which case they must provide a coordinates reference system) or simply by
{@link org.jscience.geography.coordinates.CompoundCoordinates combining}
existing coordinates together. For example:[code]
// High-Precision Coordinates.
class Position3D extends Coordinates {
public static final GeocentricCRS CRS = ...;
public GeocentricCRS getCoordinateReferenceSystem {
return CRS; // All instances use the same reference system.
}
public Real getX(Unit u) { ... }
public Real getY(Unit u) { ... }
public Real getZ(Unit u) { ... }
...
}
// Combining existing coordinates.
class LatLongHeight extends CompoundCoordinates { }
class HeightTime extends CompoundCoordinates { }
class UtmHeightTime extends CompoundCoordinates, Time> { }
[/code]
Conversion between coordinates is achieved through their coordinates
reference system. For example:[code]
// Converts UTM coordinates to Latitude/Longitude.
UTM utm = UTM.valueOf(17, 'E', 444.5, 556.44, METRE);
CoordinatesConverter utmToLatLong = UTM.CRS.getConverterTo(LatLong.CRS);
LatLong latLong = utmToLatLong.convert(utm);
// Converts compound coordinates to X/Y/Z geocentric coordinates.
CompoundCoordinates utmHeight = new CompoundCoordinates(utm, new Height(2330.55, FOOT));
XYZ xyz = new CompoundCRS(UTM.CRS, Height.CRS).getConverterTo(XYZ.CRS).convert(utmHeight);
// Converts any projected coordinates to Latitude/Longitude.
Coordinates coord2d;
LatLong latLong = coord2d.getCoordinateReferenceSystem().getConverterTo(LatLong.CRS).convert(coord2d);
[/code]
|