Class DefaultTemporalCRS

All Implemented Interfaces:
Serializable, Formattable, Deprecable, Lenient­Comparable, Coordinate­Reference­System, Single­CRS, Temporal­CRS, Identified­Object, Reference­System

public class DefaultTemporalCRS extends AbstractCRS implements TemporalCRS
A 1-dimensional coordinate reference system used for the recording of time. The Apache SIS implementation provides the following methods in addition to the OGC/ISO properties:

Used with datum type: Temporal.
Used with coordinate system type: Time.

Immutability and thread safety

This class is immutable and thus thread-safe if the property values (not necessarily the map itself), the coordinate system and the datum instances given to the constructor are also immutable. Unless otherwise noted in the javadoc, this condition holds if all components were created using only SIS factories and static constants.
Since:
0.4
See Also:

Defined in the sis-referencing module

  • Constructor Details

  • Method Details

    • castOrCopy

      public static DefaultTemporalCRS castOrCopy(TemporalCRS object)
      Returns a SIS coordinate reference system implementation with the same values than the given arbitrary implementation. If the given object is null, then this method returns null. Otherwise if the given object is already a SIS implementation, then the given object is returned unchanged. Otherwise a new SIS implementation is created and initialized to the attribute values of the given object.
      Parameters:
      object - the object to get as a SIS implementation, or null if none.
      Returns:
      a SIS implementation containing the values of the given object (may be the given object itself), or null if the argument was null.
    • getInterface

      public Class<? extends TemporalCRS> getInterface()
      Returns the GeoAPI interface implemented by this class. The SIS implementation returns Temporal­CRS​.class.
      Note for implementers: Subclasses usually do not need to override this method since GeoAPI does not define Temporal­CRS sub-interface. Overriding possibility is left mostly for implementers who wish to extend GeoAPI with their own set of interfaces.
      Overrides:
      get­Interface in class Abstract­CRS
      Returns:
      Temporal­CRS​.class or a user-defined sub-interface.
    • getDatum

      public TemporalDatum getDatum()
      Returns the datum.
      Specified by:
      get­Datum in interface Single­CRS
      Specified by:
      get­Datum in interface Temporal­CRS
      Returns:
      the datum.
    • getCoordinateSystem

      public TimeCS getCoordinateSystem()
      Returns the coordinate system.
      Specified by:
      get­Coordinate­System in interface Coordinate­Reference­System
      Specified by:
      get­Coordinate­System in interface Single­CRS
      Specified by:
      get­Coordinate­System in interface Temporal­CRS
      Overrides:
      get­Coordinate­System in class Abstract­CRS
      Returns:
      the coordinate system.
    • getUnit

      public final Unit<Time> getUnit()
      Returns the unit of measurement of temporal measurement in the coordinate reference system. This is a convenience method for Coordinate­System­Axis​.get­Unit() on the unique axis of this coordinate reference system. The unit of measurement returned by this method is the unit of the value expected in argument by to­Instant(double) and to­Date(double), and the unit of the value returned by to­Value(…) methods.
      Implementation note: this method is declared final and does not invoke overridden get­Coordinate­System() method because this get­Unit() method is invoked indirectly by constructors. Another reason is that the overriding point is the Coordinate­System­Axis​.get­Unit() method and we want to avoid introducing another overriding point that could be inconsistent with above method.
      Returns:
      the temporal unit of measurement of coordinates in this CRS.
      Since:
      1.0
    • forConvention

      public DefaultTemporalCRS forConvention(AxesConvention convention)
      Returns a coordinate reference system equivalent to this one but with axes rearranged according the given convention. If this CRS is already compatible with the given convention, then this method returns this.
      Overrides:
      for­Convention in class Abstract­CRS
      Parameters:
      convention - the axes convention for which a coordinate reference system is desired.
      Returns:
      a coordinate reference system compatible with the given convention (may be this).
      See Also:
    • toInstant

      public Instant toInstant(double value)
      Converts the given value into an instant object. If the given value is NaN or infinite, then this method returns null. This method is the converse of to­Value(Instant).
      Parameters:
      value - a value in this axis. Unit of measurement is given by get­Unit().
      Returns:
      the value as an instant, or null if the given value is NaN or infinite.
      Since:
      1.0
    • toDate

      public Date toDate(double value)
      Converts the given value into a Date object. If the given value is is NaN or infinite, then this method returns null. This method is the converse of to­Value(Date).

      This method is provided for interoperability with legacy java​.util​.Date object. New code should use to­Instant(double) instead.

      Parameters:
      value - a value in this axis unit. Unit of measurement is given by get­Unit().
      Returns:
      the value as a date, or null if the given value is NaN or infinite.
    • toValue

      public double toValue(Instant time)
      Converts the given instant into a value in this axis unit. If the given instant is null, then this method returns Double​.Na­N. This method is the converse of to­Instant(double).
      Parameters:
      time - the value as an instant, or null.
      Returns:
      the value in this axis unit, or Double​.Na­N if the given instant is null. Unit of measurement is given by get­Unit().
      Since:
      1.0
    • toValue

      public double toValue(Date time)
      Converts the given date into a value in this axis unit. If the given time is null, then this method returns Double​.Na­N. This method is the converse of to­Date(double).

      This method is provided for interoperability with legacy java​.util​.Date object. New code should use to­Value(Instant) instead.

      Parameters:
      time - the value as a date, or null.
      Returns:
      the value in this axis unit, or Double​.Na­N if the given time is null. Unit of measurement is given by get­Unit().
    • formatTo

      protected String formatTo(Formatter formatter)
      Formats this CRS as a Well Known Text Time­CRS[…] element.
      Compatibility note: Time­CRS is defined in the WKT 2 specification only.
      Overrides:
      format­To in class Abstract­CRS
      Parameters:
      formatter - the formatter where to format the inner content of this WKT element.
      Returns:
      "Time­CRS".
      See Also: