Class TLcdAIXM51MessageUtil

java.lang.Object
com.luciad.format.aixm51.util.TLcdAIXM51MessageUtil

public class TLcdAIXM51MessageUtil extends Object
This class contains various utility methods to process AIXM 5.1 messages.

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 Details

    • separateFeatureTypes

      public static List<TLcdAIXM51AbstractAIXMMessage> separateFeatureTypes(TLcdAIXM51AbstractAIXMMessage aMessage)
      Creates a list of messages by separating all the features found in aMessage based on their Class. The newly generated messages refer to the same feature instances as in aMessage.

      The new messages have the same type as aMessage and a model descriptor of the type TLcdAIXM51ModelDescriptor. The model descriptor returns the type of feature contained in the message through TLcdAIXM51ModelDescriptor#getFeatureTypes.

      The returned list of messages will be ordered according to the following list of feature types.

      1. Airspace
      2. GeoBorder
      3. TouchDownLiftOffSafeArea
      4. RunwayProtectArea
      5. ApronElement
      6. RunwayBlastPad
      7. RunwayElement
      8. TaxiwayElement
      9. Apron
      10. Runway
      11. Taxiway
      12. TouchDownLiftOff
      13. DeicingArea
      14. WorkArea
      15. GuidanceLine
      16. AirportProtectionAreaMarking
      17. ApronMarking
      18. DeicingAreaMarking
      19. GuidanceLineMarking
      20. RunwayMarking
      21. StandMarking
      22. TaxiHoldingPositionMarking
      23. TaxiwayMarking
      24. TouchDownLiftOffMarking
      25. AirportSuppliesService
      26. PassengerService
      27. Unit
      28. TaxiHoldingPosition
      29. SurveyControlPoint
      30. RouteSegment
      31. InstrumentApproachProcedure
      32. StandardInstrumentDeparture
      33. StandardInstrumentArrival
      34. VerticalStructure
      35. RunwayCentreLinePoint
      36. DesignatedPoint
      37. Navaid
      38. AirportHeliport
      39. 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 in aMessage that have the same gml:identifier and merges them into a single new feature, with the same gml: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 a gml:identifier.
      Returns:
      A message where each element is a TLcdAIXM51AbstractAIXMFeature , and the value of the gml:identifier returned by TLcdAIXM51AbstractAIXMFeature#getIdentifier is unique. That means no other element in ILcdModel.elements() has the same identifier

      The runtime type of the result is the same as the runtime type of aMessage.

      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

      public static TLcdAIXM51AbstractAIXMMessage sortMessage(TLcdAIXM51AbstractAIXMMessage aMessage)
      Sorts the list of timeslices for every feature found in aMessage. 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 by TLcdAIXM51AbstractAIXMFeature#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 using sortMessage(TLcdAIXM51AbstractAIXMMessage), and should only contain unique features (see mergeUniqueFeatures(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 as generateSnapshot(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 using sortMessage(TLcdAIXM51AbstractAIXMMessage), and should only contain unique features (see mergeUniqueFeatures(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 to generateSnapshot and updateSnapshotSFCT. This means that the result of the methods size() and elementAt(int) are invariant between calls to these methods. If this can no longer be guaranteed, create a new snapshot message using generateSnapshot or use originalModelHasChangedSFCT 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 using originalModelHasChangedSFCT.

      Parameters:
      aOriginalMessage - the original message with which aSnapshotMessage 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 using generateSnapshot(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 as updateSnapshotSFCT(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 which aSnapshotMessage 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 using generateSnapshot(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 to updateSnapshotSFCT 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

      After updating the snapshot message, an event will be fired containing the changes in the message.

      Parameters:
      aOriginalMessage - message with which the snapshot message should match.
      aSnapshotMessage - message which will be reset so that it can be used with updateSnapshotSFCT
      See Also: