Class MovingFeatures

java.lang.Object
org.apache.sis.internal.feature.MovingFeatures
Direct Known Subclasses:
MovingFeatureBuilder

public class MovingFeatures extends Object
Utility methods for instantiating features where the geometry is a trajectory and some property values may change with time. This class is not thread-safe.
Since:
0.8
Version:
1.1
  • Field Details

    • TIME_AS_INSTANTS

      public static final DefaultAttributeType<Instant> TIME_AS_INSTANTS
      Definition of characteristics containing a list of instants, without duplicates. Should be in chronological order, but this is not verified.
    • TIME_AS_NUMBERS

      private static final DefaultAttributeType<Number> TIME_AS_NUMBERS
      An alternative to TIME_AS_INSTANTS used when times cannot be mapped to calendar dates. This characteristic uses the same name than TIME_AS_INSTANTS. Consequently, at most one of TIME_AS_INSTANTS and TIME_AS_NUMBERS can be used on the same property.
    • cache

      private final Map<Vector,InstantList> cache
      Caches of list of times or instants, used for sharing existing instances. We do this sharing because it is common to have many properties having the same time characteristics.
  • Constructor Details

    • MovingFeatures

      public MovingFeatures(MovingFeatures share)
      Creates a new builder.
      Parameters:
      share - other builder that may share time vectors, or null if none.
  • Method Details

    • characteristic

      public static DefaultAttributeType<?> characteristic(boolean hasCRS)
      Returns the "datetimes" characteristic to add on an attribute type. The characteristic will expect either Instant or Number values, depending on whether a temporal CRS is available or not.
      Parameters:
      hasCRS - whether a temporal CRS is available.
      Returns:
      the "datetimes" characteristic.
    • setInstants

      public final void setInstants(AbstractAttribute<?> dest, long[] millis)
      Sets the "datetimes" characteristic on the given attribute as a list of Instant instances. Should be in chronological order, but this is not verified.
      Parameters:
      dest - the attribute on which to set time characteristic.
      millis - times in milliseconds since the epoch.
    • setTimes

      public static void setTimes(AbstractAttribute<?> dest, Vector values, DefaultTemporalCRS converter)
      Sets the "datetimes" characteristic on the given attribute. If the converter is non-null, it will be used for converting values to Instant instances. Otherwise values are stored as-is as time elapsed in arbitrary units since an arbitrary epoch.

      Values should be in chronological order, but this is not verified. Current implementation does not cache the values, but this policy may be revisited in a future version.

      Parameters:
      dest - the attribute on which to set time characteristic.
      values - times in arbitrary units since an arbitrary epoch.
      converter - the CRS to use for converting values to Instant instances, or null.