Package mccombe.mapping
Class CoordinateSystem
- java.lang.Object
-
- mccombe.mapping.CoordinateSystem
-
- Direct Known Subclasses:
Projection
,Spherical
public abstract class CoordinateSystem extends java.lang.Object
Abstract base class for coordinate systems in general. Each instance of CoordinateSystem contains a Position and references to the Ellipsoid and Datum from which the coordinates are derived. The position itself is independent of Ellipsoid and Datum.
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
CoordinateSystem()
Creates a new instance of CoordinateSystem using the default Ellipsoid and DatumCoordinateSystem(Position pos, Ellipsoid e, Datum d)
Create a new instance of CoordinateSystem for a specific Position, Ellipsoid and Datum
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract Datum
defaultDatum()
Get the defaul Datum for an instance of CoordinateSystem.abstract Ellipsoid
defaultEllipsoid()
The default Ellipsoid used by instances of this CoordinateSystem For example, a CoordinateSystem of type OSGB has the AirySphere as its default EllipsoidDatum
getDatum()
Get the Datum used by this pointEllipsoid
getEllipsoid()
Get the Ellipsoid used by this pointjava.lang.String
getName()
Get the name of this CoordinateSystem.Position
getPosition()
Get the Position of this pointXYZ
getWGS84()
Get the "absolute" cartesian coordinates for this location.protected static double
parseDouble(java.lang.String s)
LatLong
toLatLong()
Get the Latitude and Longitude for this point.java.lang.String
toLatLongString()
Return a String containing values of Latitude and Longitude.referred to the current Ellipsoid and Datumabstract java.lang.String
toString()
Provide a String representing the position in a correct format for the CoordinateSystem
-
-
-
Constructor Detail
-
CoordinateSystem
protected CoordinateSystem()
Creates a new instance of CoordinateSystem using the default Ellipsoid and Datum
-
CoordinateSystem
public CoordinateSystem(Position pos, Ellipsoid e, Datum d)
Create a new instance of CoordinateSystem for a specific Position, Ellipsoid and Datum
- Parameters:
pos
- Position of the point in this CoordinateSysteme
- Ellipsoid to be used in this CoordinateSystemd
- Datum for this instance of CopordinateSystem
-
-
Method Detail
-
toLatLong
public LatLong toLatLong()
Get the Latitude and Longitude for this point. Note the result is referred to the current datum and ellipsoid- Returns:
- LatLong object containing latitude and longitude
-
toLatLongString
public java.lang.String toLatLongString()
Return a String containing values of Latitude and Longitude.referred to the current Ellipsoid and Datum- Returns:
- String containing Latitude and Longitude in degrees. North or East are represented by positive values, South or West are negative.
-
getDatum
public Datum getDatum()
Get the Datum used by this point- Returns:
- The Datum associated with this point
-
getEllipsoid
public Ellipsoid getEllipsoid()
Get the Ellipsoid used by this point- Returns:
- Ellipsoid
-
getName
public java.lang.String getName()
Get the name of this CoordinateSystem. By default, this method returns the short name of the class. For example, an instance of
mccombe.mapping.IrishGrid
returns the name "IrishGrid".Implementers of sub-classes of CoordinateSystem are encouraged to override this method if a more descriptive name is needed
- Returns:
- The name of the CoordinateSystem
-
getPosition
public Position getPosition()
Get the Position of this point- Returns:
- The Position of this point
-
getWGS84
public XYZ getWGS84()
Get the "absolute" cartesian coordinates for this location. These are based on the WGS-84 datum and coordinate system.- Returns:
- XYZ object containing the cartesian coordinates for this point.
-
defaultEllipsoid
public abstract Ellipsoid defaultEllipsoid()
The default Ellipsoid used by instances of this CoordinateSystem For example, a CoordinateSystem of type OSGB has the AirySphere as its default Ellipsoid- Returns:
- The Ellipsoid used as the deafult for this CoordinateSystem
-
defaultDatum
public abstract Datum defaultDatum()
Get the defaul Datum for an instance of CoordinateSystem. For example, instances of OSGB usually use the OSGB 1936 datum.- Returns:
- The default Datum used by this instance of CoordinateSystem
-
toString
public abstract java.lang.String toString()
Provide a String representing the position in a correct format for the CoordinateSystem- Overrides:
toString
in classjava.lang.Object
- Returns:
- String
-
parseDouble
protected static double parseDouble(java.lang.String s) throws java.text.ParseException
- Throws:
java.text.ParseException
-
-