Class TLcdAIXM51SnapshotTimeSliceProvider
- All Implemented Interfaces:
ILcdAIXM51TimeSliceProvider
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 Summary
-
Method Summary
Modifier and TypeMethodDescriptiongetTime()
Returns theDate
that is set on this provider.<T extends TLcdAIXM51AbstractAIXMTimeSlice>
TgetTimeSlice
(TLcdAIXM51Feature<T> aFeature) Returns a time slice that is selected or computed by this provider from the time slices of the given feature.<T extends TLcdAIXM51AbstractAIXMTimeSlice>
TgetTimeSliceSFCT
(TLcdAIXM51Feature<T> aFeature, ILcdEditableTimeBounds aTimeBoundsSFCT) Returns a snapshot time slice that is valid for the time instant that is set on this provider.void
Sets the time instant for which snapshots should be created by this provider.
-
Constructor Details
-
TLcdAIXM51SnapshotTimeSliceProvider
public TLcdAIXM51SnapshotTimeSliceProvider()
-
-
Method Details
-
setTime
Sets the time instant for which snapshots should be created by this provider.- Parameters:
aDate
- A valid date
-
getTime
Returns theDate
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. IfaTimeBoundsSFCT
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() ) && featureBounds.getBeginTime() > intersectedBounds.getBeginTime() ) { intersectedBounds.setBeginTime( featureBounds.getBeginTime() ); intersectedBounds.setBeginTimeBoundedness( Boundedness.BOUNDED ); } if ( ILcdTimeBounds.Boundedness.BOUNDED.equals( featureBounds.getEndTimeBoundedness() ) && featureBounds.getEndTime() < intersectedBounds.getEndTime() ) { intersectedBounds.setEndTime( featureBounds.getEndTime() ); intersectedBounds.setEndTimeBoundedness( Boundedness.BOUNDED ); } return timeSlice;
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 returnedaTimeBoundsSFCT
- 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
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 interfaceILcdAIXM51TimeSliceProvider
- 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.
-