Class SkyUnits

java.lang.Object
uk.ac.starlink.ttools.convert.SkyUnits

public abstract class SkyUnits extends Object
Class defining units used for a two-coordinate sky coordinate system. Each coordinate represents an angle.
  • Field Details

    • DEGREES

      public static final SkyUnits DEGREES
      Degrees.
    • RADIANS

      public static final SkyUnits RADIANS
      Radians.
    • SEXAGESIMAL

      public static final SkyUnits SEXAGESIMAL
      Sexagesimal (hh:mm:ss.s, dd:mm:ss.s).
    • DEFAULT_UNIT

      public static final SkyUnits DEFAULT_UNIT
      Default unit (DEGREES).
  • Constructor Details

    • SkyUnits

      protected SkyUnits(String name)
      Constructor.
  • Method Details

    • decode

      public abstract double[] decode(Object c1, Object c2)
      Takes a pair of objects representing coordinates in these units, and converts them to radians.
      Parameters:
      c1 - first input coordinate, in these units
      c2 - second input coordinate, in these units
      Returns:
      array of two output coordinates, in radians
    • encode

      public abstract Object[] encode(double c1, double c2)
      Takes a pair of coordinates in radians and converts them to these units.
      Parameters:
      c1 - first input coordinate, in radians
      c2 - second input coordinate, in radians
      Returns:
      array of two output coordinates, in these units
    • getUnitStrings

      public abstract String[] getUnitStrings()
      Returns a pair of descriptions for the units of the first and second coordinates represented by these units. Tries to stick to the VOUnits standard.
      Returns:
      array of two unit names
    • getUnitTypes

      public abstract Class<?>[] getUnitTypes()
      Returns a pair of classes for the first and second coordinates represented by these units.
      Returns:
      array of two classes, the types which should be presented to the decode method and will be returned from the encode method
    • getName

      public String getName()
      Returns the name of this unit system.
      Returns:
      name
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getKnownUnits

      public static SkyUnits[] getKnownUnits()
      Returns a list of all the available instances of this class.
      Returns:
      array of known unit systems
    • getUnitsFor

      public static SkyUnits getUnitsFor(String unitName)
      Returns a unit as specified by a name. Name may be abbreviated. Returns a suitable unit or throws an IllegalArgumentException.