Class TemporalAccessor

java.lang.Object
org.apache.sis.internal.referencing.TemporalAccessor

public final class TemporalAccessor extends Object
Convenience methods for accessing the temporal component of an object (envelope, grid geometry…).
Since:
1.0
Version:
1.1
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    final int
    Dimension of the temporal component.
    static final Instant[]
    Empty array of instants.
    Converter from floating point numbers to dates.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    private
    TemporalAccessor(int dim, org.opengis.referencing.crs.TemporalCRS crs)
    Creates a new accessor for the given coordinate reference system.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the lower and upper values in the given envelope.
    getTimeRange(org.opengis.geometry.Envelope envelope)
    Returns the temporal range of given envelope.
    of(org.opengis.referencing.crs.CoordinateReferenceSystem crs, int dim)
    Creates a new temporal accessor for elements at the given dimensions.
    (package private) void
    setTemporalExtent(org.opengis.geometry.Envelope envelope, DefaultTemporalExtent target)
    Copies the temporal extent from an envelope to a metadata object.

    Methods inherited from class java.lang.Object

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

    • EMPTY

      public static final Instant[] EMPTY
      Empty array of instants.
    • dimension

      public final int dimension
      Dimension of the temporal component.
    • timeCRS

      public final DefaultTemporalCRS timeCRS
      Converter from floating point numbers to dates.
  • Constructor Details

    • TemporalAccessor

      private TemporalAccessor(int dim, org.opengis.referencing.crs.TemporalCRS crs)
      Creates a new accessor for the given coordinate reference system.
      Parameters:
      dim - the dimension of the temporal component.
      crs - the coordinate reference system.
  • Method Details

    • of

      public static TemporalAccessor of(org.opengis.referencing.crs.CoordinateReferenceSystem crs, int dim)
      Creates a new temporal accessor for elements at the given dimensions. This method searches for a temporal component in the given CRS.
      Parameters:
      crs - the coordinate reference system which may contain a temporal component, or null.
      dim - offset to add to the dimension indices. This is usually zero.
      Returns:
      the temporal accessor, or null if no temporal component has been found.
    • getTimeBounds

      public Instant[] getTimeBounds(AbstractEnvelope envelope)
      Returns the lower and upper values in the given envelope. It is caller's responsibility to ensure that the envelope CRS is the same than the one used for creating this TemporalAccessor.
      Parameters:
      envelope - the envelope from which to get the start time end end time.
      Returns:
      the start time and end time in an array of length 1 or 2, or an empty array if none.
    • getTimeRange

      public Range<Instant> getTimeRange(org.opengis.geometry.Envelope envelope)
      Returns the temporal range of given envelope. It is caller's responsibility to ensure that the envelope CRS is the same than the one used for creating this TemporalAccessor.
      Parameters:
      envelope - the envelope from which to get the start time end end time.
      Returns:
      the start time and end time.
      See Also:
    • setTemporalExtent

      void setTemporalExtent(org.opengis.geometry.Envelope envelope, DefaultTemporalExtent target)
      Copies the temporal extent from an envelope to a metadata object.
      Parameters:
      envelope - the source envelope.
      target - the target temporal extent.