Class CoordinateSystem

java.lang.Object
uk.co.mccombe.mapping.CoordinateSystem
Direct Known Subclasses:
Projection, Spherical

public abstract class CoordinateSystem extends 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.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected Position
    The Position of this Coordinate
    protected Datum
    The Datum for this point
    protected Ellipsoid
    The Ellipsoid for this point
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    Creates a new instance of CoordinateSystem using the default Ellipsoid and Datum
     
    Create a new instance of CoordinateSystem for a specific Position, Ellipsoid and Datum
  • Method Summary

    Modifier and Type
    Method
    Description
    abstract Datum
    Get the defaul Datum for an instance of CoordinateSystem.
    abstract Ellipsoid
    The default Ellipsoid used by instances of this CoordinateSystem For example, a CoordinateSystem of type OSGB has the AirySphere as its default Ellipsoid
    Get the Datum used by this point
    Get the Ellipsoid used by this point
    Get the name of this CoordinateSystem.
    Get the Position of this point
    Get the "absolute" cartesian coordinates for this location.
    protected static double
     
    Get the Latitude and Longitude for this point.
    Return a String containing values of Latitude and Longitude.referred to the current Ellipsoid and Datum
    abstract String
    Provide a String representing the position in a correct format for the CoordinateSystem

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • locus

      protected Position locus
      The Position of this Coordinate
    • sph

      protected Ellipsoid sph
      The Ellipsoid for this point
    • ref

      protected Datum ref
      The Datum for this point
  • Constructor Details

    • 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 CoordinateSystem
      e - Ellipsoid to be used in this CoordinateSystem
      d - Datum for this instance of CopordinateSystem
  • Method Details

    • 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 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 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 String toString()
      Provide a String representing the position in a correct format for the CoordinateSystem
      Overrides:
      toString in class Object
      Returns:
      String
    • parseDouble

      protected static double parseDouble(String s) throws ParseException
      Throws:
      ParseException