Class TLcdAIXM51MessageUtil
The following operations are supported:
- separating a message containing multiple feature types in a list of messages that each only contain one feature type,
- merging unique features in a message,
- sorting the time slices in a message,
- snapshot message generation.
- Since:
- 10.0
-
Method Summary
Modifier and TypeMethodDescriptiongenerateSnapshot
(TLcdAIXM51AbstractAIXMMessage aMessage, Calendar aCalendar) Generates a message for which each feature has exactly one timeslice.generateSnapshot
(TLcdAIXM51AbstractAIXMMessage aMessage, Date aDate) This method behaves the same way asgenerateSnapshot(TLcdAIXM51AbstractAIXMMessage, Calendar)
except that it uses the first valid time zone found in the given message.Looks up feature instances inaMessage
that have the samegml:identifier
and merges them into a single new feature, with the samegml:identifier
.static void
originalModelHasChangedSFCT
(TLcdAIXM51AbstractAIXMMessage aOriginalMessage, TLcdAIXM51AbstractAIXMMessage aSnapshotMessage) Resets a snapshot message after the original message has changed.static List
<TLcdAIXM51AbstractAIXMMessage> Creates a list of messages by separating all the features found inaMessage
based on theirClass
.sortMessage
(TLcdAIXM51AbstractAIXMMessage aMessage) Sorts the list of timeslices for every feature found inaMessage
.static void
updateSnapshotSFCT
(TLcdAIXM51AbstractAIXMMessage aOriginalMessage, Calendar aCalendar, TLcdAIXM51AbstractAIXMMessage aSnapshotMessage) Updates a previously created snapshot message.static void
updateSnapshotSFCT
(TLcdAIXM51AbstractAIXMMessage aOriginalMessage, Date aDate, TLcdAIXM51AbstractAIXMMessage aSnapshotMessage) This method behaves the same way asupdateSnapshotSFCT(TLcdAIXM51AbstractAIXMMessage, Calendar, TLcdAIXM51AbstractAIXMMessage)
except that it uses the first valid time zone found in the given message.
-
Method Details
-
separateFeatureTypes
public static List<TLcdAIXM51AbstractAIXMMessage> separateFeatureTypes(TLcdAIXM51AbstractAIXMMessage aMessage) Creates a list of messages by separating all the features found inaMessage
based on theirClass
. The newly generated messages refer to the same feature instances as inaMessage
.The new messages have the same type as
aMessage
and a model descriptor of the typeTLcdAIXM51ModelDescriptor
. The model descriptor returns the type of feature contained in the message throughTLcdAIXM51ModelDescriptor#getFeatureTypes
.The returned list of messages will be ordered according to the following list of feature types.
- Airspace
- GeoBorder
- TouchDownLiftOffSafeArea
- RunwayProtectArea
- ApronElement
- RunwayBlastPad
- RunwayElement
- TaxiwayElement
- Apron
- Runway
- Taxiway
- TouchDownLiftOff
- DeicingArea
- WorkArea
- GuidanceLine
- AirportProtectionAreaMarking
- ApronMarking
- DeicingAreaMarking
- GuidanceLineMarking
- RunwayMarking
- StandMarking
- TaxiHoldingPositionMarking
- TaxiwayMarking
- TouchDownLiftOffMarking
- AirportSuppliesService
- PassengerService
- Unit
- TaxiHoldingPosition
- SurveyControlPoint
- RouteSegment
- InstrumentApproachProcedure
- StandardInstrumentDeparture
- StandardInstrumentArrival
- VerticalStructure
- RunwayCentreLinePoint
- DesignatedPoint
- Navaid
- AirportHeliport
- All other features that are not defined here, will appear on the end of the list (in random order)
- Parameters:
aMessage
- message containing features that will be separated.- Returns:
- A list of messages, where each message contains only a single type of feature.
-
mergeUniqueFeatures
public static TLcdAIXM51AbstractAIXMMessage mergeUniqueFeatures(TLcdAIXM51AbstractAIXMMessage aMessage) Looks up feature instances inaMessage
that have the samegml:identifier
and merges them into a single new feature, with the samegml:identifier
.The timeslices that belong to the same feature in
aMessage
are copied to the corresponding feature in the resulting message.- Parameters:
aMessage
- A valid AIXM 5.1 message for which each feature has agml:identifier
.- Returns:
- A message where each element is a
TLcdAIXM51AbstractAIXMFeature
, and the value of thegml:identifier
returned byTLcdAIXM51AbstractAIXMFeature#getIdentifier
is unique. That means no other element inILcdModel.elements()
has the same identifier The runtime type of the result is the same as the runtime type ofaMessage
. - Throws:
IllegalArgumentException
- is thrown in case a feature is detected which has no identifier, this avoids merging features that are actually not the same.
-
sortMessage
Sorts the list of timeslices for every feature found inaMessage
. The ordering is derived from the AIXM 5.1 specification and works as follows: Timeslices with a different interpretation are ordered according to the following rule:Baseline < Permdelta < Tempdelta
Sequence numbers are being used for timeslices with the same interpretation, correction numbers are used when the sequence numbers are equal. Numbers are also ordered using lesser then. In theory, the AIXM 5.1 specification does not allow timeslices within a feature to be "equal" with respect to these rules.- Parameters:
aMessage
- a message- Returns:
- A message containing the same elements as aMessage, the
List
returned byTLcdAIXM51AbstractAIXMFeature#getTimeSlice
will be ordered according to the rules described above such that each element in the list will be lesser then any subsequent element in the list.
-
generateSnapshot
public static TLcdAIXM51AbstractAIXMMessage generateSnapshot(TLcdAIXM51AbstractAIXMMessage aMessage, Calendar aCalendar) Generates a message for which each feature has exactly one timeslice. The timeslice is generated by merging the timeslices in the original feature into a snapshot timeslice which is valid at the given calendar's date. The merging of timeslices into a snapshot follows the rules specified in the AIXM 5.1 specification. Each timeslice will have its interpretation set to"SNAPSHOT"
. If a feature doesn't contain timeslices that are valid at the given date, it is omitted from the resulting message.The generated snapshot timeslices should be considered read-only; create a deep clone in case you want to modify the timeslice.
The specification requires that for every feature one valid baseline timeslice 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 timeslices of a feature is already a snapshot timeslice valid at the given calendar's date, this snapshot timeslice is used in the resulting message, regardless of any other timeslices. This behavior is correct in case you have a feature which only contains snapshots, and no other type of timeslices. The specification does not prescribe how to merge snapshot timeslices with other types of timeslices that possibly conflict with the snapshots.
PREREQUISITE: This method assumes that
aMessage
is a sorted message for which every feature is unique.- Parameters:
aMessage
- message for which a message containing snapshots will be generated. Timeslices should be sorted usingsortMessage(TLcdAIXM51AbstractAIXMMessage)
, and should only contain unique features (seemergeUniqueFeatures(TLcdAIXM51AbstractAIXMMessage)
).aCalendar
- calendar that indicates the date and the time zone at which the generated snapshots will be valid.- Returns:
- A message containing features which have exactly one SNAPSHOT timeslice. Each timeslice
will have its validtime set to a time instant equal to the given calendar's date. The sequence and
correction numbers will be set to
null
. - See Also:
-
generateSnapshot
public static TLcdAIXM51AbstractAIXMMessage generateSnapshot(TLcdAIXM51AbstractAIXMMessage aMessage, Date aDate) This method behaves the same way asgenerateSnapshot(TLcdAIXM51AbstractAIXMMessage, Calendar)
except that it uses the first valid time zone found in the given message. If no valid time zone is found, UTC will be used.- Parameters:
aMessage
- message for which a message containing snapshots will be generated. Timeslices should be sorted usingsortMessage(TLcdAIXM51AbstractAIXMMessage)
, and should only contain unique features (seemergeUniqueFeatures(TLcdAIXM51AbstractAIXMMessage)
).aDate
- date at which the generated snapshots will be valid.- Returns:
- A message containing features which have exactly one SNAPSHOT timeslice. Each timeslice
will have its validtime set to a time instant equal to aDate. The sequence and
correction numbers will be set to
null
. - See Also:
-
updateSnapshotSFCT
public static void updateSnapshotSFCT(TLcdAIXM51AbstractAIXMMessage aOriginalMessage, Calendar aCalendar, TLcdAIXM51AbstractAIXMMessage aSnapshotMessage) Updates a previously created snapshot message. This method assumes that the order of the elements in a message remains the same between subsequent calls togenerateSnapshot
andupdateSnapshotSFCT
. This means that the result of the methodssize()
andelementAt(int)
are invariant between calls to these methods. If this can no longer be guaranteed, create a new snapshot message usinggenerateSnapshot
or useoriginalModelHasChangedSFCT
to reset a snapshot message to be compatible with the original message. After updating the snapshot message, an event will be fired containing the changes in the message. In case the number of elements in the snapshot message and the original message do not match, an exception will be thrown, and the snapshot message will remain unchanged. Other incompatible changes to the models will not be detected by this method to improve performance. This might result in undetermined behavior if the snapshot message has not been notified of the change usingoriginalModelHasChangedSFCT
.- Parameters:
aOriginalMessage
- the original message with whichaSnapshotMessage
has been generated, and which will be used to generate the updated snapshots.aCalendar
- calendar that indicates the date and the time zone at which the generated snapshots will be valid.aSnapshotMessage
- A snapshot message that has been created usinggenerateSnapshot(TLcdAIXM51AbstractAIXMMessage, Calendar)
. This message will be updated to contain a snapshot which is valid at the given calendar's date.- Throws:
IllegalArgumentException
- in case aSnapshotMessage does not match aOriginalMessage- See Also:
-
updateSnapshotSFCT
public static void updateSnapshotSFCT(TLcdAIXM51AbstractAIXMMessage aOriginalMessage, Date aDate, TLcdAIXM51AbstractAIXMMessage aSnapshotMessage) This method behaves the same way asupdateSnapshotSFCT(TLcdAIXM51AbstractAIXMMessage, Calendar, TLcdAIXM51AbstractAIXMMessage)
except that it uses the first valid time zone found in the given message. If no valid time zone is found, UTC will be used.- Parameters:
aOriginalMessage
- the original message with whichaSnapshotMessage
has been generated, and which will be used to generate the updated snapshots.aDate
- date at which the generated snapshots will be valid.aSnapshotMessage
- A snapshot message that has been created usinggenerateSnapshot(TLcdAIXM51AbstractAIXMMessage, Date)
. This message will be updated to contain a snapshot which is valid at the given date.- Throws:
IllegalArgumentException
- in case aSnapshotMessage does not match aOriginalMessage- See Also:
-
originalModelHasChangedSFCT
public static void originalModelHasChangedSFCT(TLcdAIXM51AbstractAIXMMessage aOriginalMessage, TLcdAIXM51AbstractAIXMMessage aSnapshotMessage) Resets a snapshot message after the original message has changed. This ensures that the elements in the snapshot message match the elements in the original message so that any subsequent calls toupdateSnapshotSFCT
will not fail. This method will not preserve existing snapshots, nor create new snapshots. The following changes on the original model require this method to be called:
- Adding elements
- Removing elements
- Changing the order of elements as returned by the methods of the
ILcdIntegerIndexedModel
interface. - Changes to the properties of a
TLcdAIXM51AbstractAIXMFeature
like the gml:identifier
- Parameters:
aOriginalMessage
- message with which the snapshot message should match.aSnapshotMessage
- message which will be reset so that it can be used withupdateSnapshotSFCT
- See Also:
-