Class TLcdAIXM51SnapshotTimeSliceProvider

java.lang.Object
com.luciad.format.aixm51.model.TLcdAIXM51SnapshotTimeSliceProvider
All Implemented Interfaces:
ILcdAIXM51TimeSliceProvider

public class TLcdAIXM51SnapshotTimeSliceProvider extends Object implements ILcdAIXM51TimeSliceProvider
This time slice provider returns a snapshot time slice for a given Date. The snapshot is derived from the time slices in the feature based on the algorithm that is defined in the AIXM 5.1 specification.

The specification requires that for every feature one valid baseline time slice should be present. This method however still tries to generate a snapshot from the available data, but it can not be guaranteed that the result is correct, as specified by the AIXM 5.1 specification.

If one of the time slices of a feature is already a snapshot time slice valid at the given date, this snapshot time slice is used in the resulting message, regardless of any other time slices. This behavior is correct in case you have a feature which only contains snapshots, and no other type of time slices. The specification does not prescribe how to merge snapshot time slices with other types of time slices that possibly conflict with the snapshots.

PREREQUISITE: This class assumes that the time slices in the features are sorted. Sorting is automatically done by the AIXM 5 decoder by default, or can also be done with the TLcdAIXM51MessageUtil.

Since:
10.1
See Also:
  • Constructor Details

    • TLcdAIXM51SnapshotTimeSliceProvider

      public TLcdAIXM51SnapshotTimeSliceProvider()
  • Method Details

    • setTime

      public void setTime(Date aDate)
      Sets the time instant for which snapshots should be created by this provider.

      Parameters:
      aDate - A valid date
    • getTime

      public Date getTime()
      Returns the Date that is set on this provider. By default this returns null.
      Returns:
      The currently set date or null.
      See Also:
    • getTimeSliceSFCT

      public <T extends TLcdAIXM51AbstractAIXMTimeSlice> T getTimeSliceSFCT(TLcdAIXM51Feature<T> aFeature, ILcdEditableTimeBounds aTimeBoundsSFCT)
      Returns a snapshot time slice that is valid for the time instant that is set on this provider. If aTimeBoundsSFCT is not null, it will be set to the interval for which the returned time slice will remain valid, assuming that the feature does not change. This interval can be used to check whether an application needs to update its views.

      This method can be used by extensions of this time slice provider to construct the intersection of time bounds for all features for which a time slice has been requested. This intersection can than be used to check whether changing the time will affect previously computed time slices.

      The following sample shows how to combine the time bounds for each feature in an intersected bounds:

       
         ILcdEditableTimeBounds featureBounds = new TLcdTimeBounds();
         T timeSlice = getTimeSlice( aFeature, featureBounds );
         if ( ILcdTimeBounds.Boundedness.BOUNDED.equals( featureBounds.getBeginTimeBoundedness() ) &amp;&amp; featureBounds.getBeginTime() &gt; intersectedBounds.getBeginTime() ) {
           intersectedBounds.setBeginTime( featureBounds.getBeginTime() );
           intersectedBounds.setBeginTimeBoundedness( Boundedness.BOUNDED );
         }
       
         if ( ILcdTimeBounds.Boundedness.BOUNDED.equals( featureBounds.getEndTimeBoundedness() ) &amp;&amp; featureBounds.getEndTime() &lt; intersectedBounds.getEndTime() ) {
           intersectedBounds.setEndTime( featureBounds.getEndTime() );
           intersectedBounds.setEndTimeBoundedness( Boundedness.BOUNDED );
         }
         return timeSlice;
       
       

      The following check can be used to compare the intersection with a new date:

       if ( intersectedBounds.getBeginTime() > aDate.getTime() 
                 || intersectedBounds.getEndTime() < aDate.getTime() )
                 //the date is outside the intersection, new snapshots will need to be generated
                 
       
      Parameters:
      aFeature - the feature for which a time slice needs to be returned
      aTimeBoundsSFCT - A parameter that will be initialized with the bounds for which the returned time slice will be valid, can be null.
      Returns:
      A valid time slice, can only be null in case the feature does not contain time slices.
    • getTimeSlice

      public <T extends TLcdAIXM51AbstractAIXMTimeSlice> T getTimeSlice(TLcdAIXM51Feature<T> aFeature)
      Description copied from interface: ILcdAIXM51TimeSliceProvider
      Returns a time slice that is selected or computed by this provider from the time slices of the given feature. This time slice can be one of the original time slices of the feature, for instance a baseline time slice, or a computed time slice such as a snapshot that is computed for a specific date.

      The returned time slice can change between consecutive calls.

      Specified by:
      getTimeSlice in interface ILcdAIXM51TimeSliceProvider
      Parameters:
      aFeature - the feature for which a time slice needs to be returned
      Returns:
      A valid time slice, can only be null in case the feature does not contain time slices.