Class DefaultTimeCS

  • All Implemented Interfaces:
    Serializable, CoordinateSystem, TimeCS, IdentifiedObject

    public class DefaultTimeCS
    extends AbstractCS
    implements TimeCS
    A one-dimensional coordinate system containing a single time axis, used to describe the temporal position of a point in the specified time units from a specified time origin. A TimeCS shall have one axis.
    Used with CRS type(s)
    Temporal
    Since:
    2.1
    Author:
    Martin Desruisseaux (IRD)
    See Also:
    Serialized Form
    • Constructor Detail

      • DefaultTimeCS

        public DefaultTimeCS​(TimeCS cs)
        Constructs a new coordinate system with the same values than the specified one. This copy constructor provides a way to wrap an arbitrary implementation into a Geotools one or a user-defined one (as a subclass), usually in order to leverage some implementation-specific API. This constructor performs a shallow copy, i.e. the properties are not cloned.
        Parameters:
        cs - The coordinate system to copy.
        Since:
        2.2
      • DefaultTimeCS

        public DefaultTimeCS​(String name,
                             CoordinateSystemAxis axis)
        Constructs a coordinate system from a name.
        Parameters:
        name - The coordinate system name.
        axis - The axis.
      • DefaultTimeCS

        public DefaultTimeCS​(Map<String,​?> properties,
                             CoordinateSystemAxis axis)
        Constructs a coordinate system from a set of properties. The properties map is given unchanged to the super-class constructor.
        Parameters:
        properties - Set of properties. Should contains at least "name".
        axis - The axis.
    • Method Detail

      • isCompatibleDirection

        protected boolean isCompatibleDirection​(AxisDirection direction)
        Returns true if the specified axis direction is allowed for this coordinate system. The default implementation accepts only temporal directions (i.e. FUTURE and PAST).
        Overrides:
        isCompatibleDirection in class AbstractCS
        Parameters:
        direction - The direction to test for compatibility.
        Returns:
        true if the given direction is compatible with this coordinate system.
      • isCompatibleUnit

        protected boolean isCompatibleUnit​(AxisDirection direction,
                                           Unit<?> unit)
        Returns true if the specified unit is compatible with seconds. This method is invoked at construction time for checking units compatibility.
        Overrides:
        isCompatibleUnit in class AbstractCS
        Parameters:
        direction - The direction of the axis having the given unit.
        unit - The unit to test for compatibility.
        Returns:
        true if the given unit is compatible with this coordinate system.
        Since:
        2.2
      • distance

        public Measure distance​(double[] coord1,
                                double[] coord2)
                         throws MismatchedDimensionException
        Computes the time difference between two points.
        Overrides:
        distance in class AbstractCS
        Parameters:
        coord1 - Coordinates of the first point.
        coord2 - Coordinates of the second point.
        Returns:
        The time difference between coord1 and coord2.
        Throws:
        MismatchedDimensionException - if a coordinate doesn't have the expected dimension.