Class TLcdAIXM51ModelDecoder

java.lang.Object
com.luciad.format.xml.bind.schema.ALcdXMLModelDecoder
com.luciad.format.aixm51.xml.TLcdAIXM51ModelDecoder
All Implemented Interfaces:
ILcdInputStreamFactoryCapable, ILcdModelDecoder

@LcdService(service=ILcdModelDecoder.class, priority=20000) public class TLcdAIXM51ModelDecoder extends ALcdXMLModelDecoder
This model decoder decodes AIXM 5.1 data into ILcdModel objects.

Input files

File Required Entry point Description
*.xml x
An XML file containing AIXM 5.1 data.

Supported file transfer protocols

  • This model decoder supports all transfer protocols that are supported by the ILcdInputStreamFactory of this decoder.

Model structure

  • This model decoder creates a model per file.
  • If isSeparateFeatureTypes() is disabled (default), the returned model extends from TLcdAIXM51AbstractAIXMMessage, which is an implementation of ILcd2DBoundsIndexedModel and ILcdIntegerIndexedModel. This model contains all the feature types present in the data.
  • If isSeparateFeatureTypes() is enabled, the returned model is a model tree node. A child model is added to this model tree node for each separate feature type that is present in the data. Each child model is an extension of TLcdAIXM51AbstractAIXMMessage. The ordering of the child models is fixed; see the utility method separateFeatureTypes for additional information.

Model descriptor

  • All models returned by this model decoder have a TLcdAIXM51ModelDescriptor.
  • The type name of the model descriptor is the display name of this decoder.

Model reference

Model elements

  • Each decoded model contains elements that extend TLcdAIXM51AbstractAIXMFeature. This class gives access to the time slices, which in turn contain the feature's domain-specific properties. Example for an airspace:
    
         // Assume an AIXM 5.1 feature - for instance, obtained from a model.
         TLcdAIXM51AbstractAIXMFeature feature = ...
         // Through TLcdAIXM51AbstractAIXMFeature, we can access the feature's time slices (BASELINE, PERMDELTA,
         // TEMPDELTA). Note: alternatively, TLcdAIXM51MessageUtil, can be used to calculate a single SNAPSHOT time slice
         // for each feature in a model.
         List timeSlices = feature.getTimeSlices();
         // From the time slice, we can access domain-specific properties - such as the airspace type.
         TLcdAIXM51AirspaceTimeSlice timeSlice = (TLcdAIXM51AirspaceTimeSlice) timeSlices.get(0);
         TLcdAIXM51CodeAirspace type = timeSlice.getType();
       
    The full AIXM 5.1 domain model is defined in the com.luciad.format.aixm51.model package.
  • Next to using TLcdAIXM51AbstractAIXMFeature to access the feature and its time slices and properties, all model elements also implement ILcdDataObject to access properties in a generic way. Similarly, the geometry of a model element can be retrieved in a generic way using the ALcdShape.fromDomainObject(Object) method.
  • Elements that use a GML ArcByCenterPoint as part of their geometry will be automatically processed to ensure that the geometry that is used for visualization is correct. The methods of the ILcdCircularArcByCenterPoint interface in TLcdGML32ArcByCenterPoint will return corrected values while the methods that correspond to properties in the ArcByCenterPoint GML type will return the original values. More information about the correction can be found in TLcdGML32ArcByCenterPoint.connect(com.luciad.shape.ILcdPoint, com.luciad.shape.ILcdPoint)

Metadata decoding

The decodeModelMetadata method returns a metadata object with the following:
  • title
  • format
  • bounds and model reference if the message has an envelope

Sample code


 ILcdModelDecoder decoder = new TLcdAIXM51ModelDecoder();
 ILcdModel model = decoder.decode("aixm51_file.xml");
 

Performance tips

Thread safety

  • The decoding of models is thread-safe, as long as no properties are changed during the decoding.
  • The decoded models are thread-safe for read access.

Supported versions and specifications

  • This model decoder supports all data sources that comply with the AIXM 5.1 and 5.1.1 specifications. In case a custom AIXM data model is supplied to the constructor, it is required that the data model depends on AIXM 5.1. For more information about the AIXM specifications, please refer to http://www.aixm.aero.

Since:
10.0
  • Constructor Details

    • TLcdAIXM51ModelDecoder

      public TLcdAIXM51ModelDecoder(TLcdDataModel aDataModel)
      Constructs a new TLcdAIXM51ModelDecoder for the given data model.
      Parameters:
      aDataModel - the data model for which this decoder should be configured
      Throws:
      IllegalArgumentException - if the data model does not depend on the AIXM 5.1 data model
    • TLcdAIXM51ModelDecoder

      public TLcdAIXM51ModelDecoder()
      Constructs a new TLcdAIXM51ModelDecoder.
    • TLcdAIXM51ModelDecoder

      public TLcdAIXM51ModelDecoder(ILcdXLinkExpressionFactory aXLink)
      Constructs a new TLcdAIXM51ModelDecoder with custom xlink resolution.
      Parameters:
      aXLink - the factory that is to be used to create xlink expressions
    • TLcdAIXM51ModelDecoder

      public TLcdAIXM51ModelDecoder(TLcdDataModel aDataModel, ILcdXLinkExpressionFactory aXLink)
      Constructs a new TLcdAIXM51ModelDecoder for a custom data model with custom xlink resolution. The given data model must depend on the AIXM 5.1 data model.
      Parameters:
      aDataModel - the data model for which this decoder should be configured
      aXLink - the factory that is to be used to create xlink expressions
  • Method Details

    • decodeFeature

      public TLcdAIXM51AbstractAIXMFeature decodeFeature(String aSource) throws IOException
      Decodes a data source representing an AIXM 5.1 Feature into a TLcdAIXM51AbstractAIXMFeature. A Feature corresponds to a real object in the aeronautical environment, such as an aerodrome, runway, navaid, or any other extension of a Feature.

      To distinguish between the different Feature types, TLcdDataObject.getDataType() can be used to retrieve the type of the feature. For example, in case of an airspace feature, the type is the AirspaceType in the http://www.aixm.aero/schema/5.1 data model.

      Note that this method does not return an ILcdModel. The feature returned by this method should be wrapped in a model explicitly.
      Parameters:
      aSource - a data source representing an AIXM 5.1 Feature
      Returns:
      a TLcdAIXM51AbstractAIXMFeature representing the decoded AIXM 5.1 Feature
      Throws:
      IOException - if the data source is not recognized as an AIXM 5.1 Feature
    • canDecodeSource

      public boolean canDecodeSource(String aSourceName)
      Description copied from interface: ILcdModelDecoder
      Checks whether this model decoder can decode the specified data source. It is acceptable for this method to return true for a source name while decode throws an exception for that same source name.

      For performance reasons, we strongly recommend that this will only be a simple test. For example: check the file extension of a file, but not that the file exists or contains expected content.

      Parameters:
      aSourceName - the data source to be verified; typically a file name or a URL.
      Returns:
      true if this decoder can likely decode the data specified by the source name, false otherwise.
      See Also:
    • decode

      public ILcdModel decode(String aSourceName) throws IOException
      Decodes a data source representing an AIXM 5.1 Message into a TLcdAIXM51AbstractAIXMMessage. Such a Message can be a Basic Message, a Digital NOTAM, or any other extension of an Abstract Message.

      To distinguish between the different Message types, TLcdDataObject.getDataType() can be used to retrieve the type of the message. For example, in case of a Basic Message or Digital NOTAM, this is respectively AIXMBasicMessage in the http://www.aixm.aero/schema/5.1/message namespace or Event in the http://www.aixm.aero/schema/5.1/event/0.1 namespace.

      This method can also decode AIXM features that are not wrapped in a message. In this case, the feature is inserted into a wrapper model that is also a TLcdAIXM51AbstractAIXMMessage. Use the decodeFeature method to avoid this behavior.
      Parameters:
      aSourceName - a data source representing an AIXM 5.1 Message
      Returns:
      a TLcdAIXM51AbstractAIXMMessage representing the decoded AIXM 5.1 Message
      Throws:
      IOException - if the data source is not recognized as an AIXM 5.1 Message
      See Also:
    • decode

      public ILcdModel decode(Source aSource) throws IOException
      Description copied from class: ALcdXMLModelDecoder

      Creates a new model from the given data source.

      Note that the default implementation throws UnsupportedOperationException. Extensions from this class should provide a more appropriate implementation.

      Overrides:
      decode in class ALcdXMLModelDecoder
      Parameters:
      aSource - the source to read the model from
      Throws:
      IOException
      See Also:
    • getDisplayName

      public String getDisplayName()
      Description copied from interface: ILcdModelDecoder
      Returns a short, displayable name for the format that is decoded by this ILcdModelDecoder.
      Returns:
      the displayable name of this ILcdModelDecoder.
    • getEntityResolver

      public EntityResolver2 getEntityResolver()
      Description copied from class: ALcdXMLModelDecoder
      Returns the org.xml.sax.ext.EntityResolver2 that is used for creating input sources for XSD schemas. This entity resolver will only be used to resolve extension schemas that are not already configured on this decoder.
      Specified by:
      getEntityResolver in class ALcdXMLModelDecoder
      Returns:
      the entity resolver to be used for creating input sources for XSD schemas.
    • setEntityResolver

      public void setEntityResolver(EntityResolver2 aEntityResolver)
      Description copied from class: ALcdXMLModelDecoder

      Sets the org.xml.sax.ext.EntityResolver2 to be used for creating input sources for XSD schemas.

      When the entity resolver is unable to find a schema (i.e. the resolveEntity method returns null), the ALcdXMLModelDecoder.getInputStreamFactory() is used to create an appropriate input stream for the given system id of the schema.

      Specified by:
      setEntityResolver in class ALcdXMLModelDecoder
      Parameters:
      aEntityResolver - the entity resolver to be used for creating input sources for XSD schemas.
    • getInputStreamFactory

      public ILcdInputStreamFactory getInputStreamFactory()
      Description copied from class: ALcdXMLModelDecoder
      Returns the ILcdInputStreamFactory that is used for creating input streams.
      Specified by:
      getInputStreamFactory in interface ILcdInputStreamFactoryCapable
      Specified by:
      getInputStreamFactory in class ALcdXMLModelDecoder
      Returns:
      the ILcdInputStreamFactory that is used for creating input streams.
      See Also:
    • setInputStreamFactory

      public void setInputStreamFactory(ILcdInputStreamFactory aInputStreamFactory)
      Description copied from class: ALcdXMLModelDecoder
      Sets the ILcdInputStreamFactory to be used for creating input streams. If the configured entity resolver implements ILcdInputStreamFactoryCapable, it is also configured with this factory.
      Specified by:
      setInputStreamFactory in interface ILcdInputStreamFactoryCapable
      Specified by:
      setInputStreamFactory in class ALcdXMLModelDecoder
      Parameters:
      aInputStreamFactory - the input stream factory to be used by this model decoder.
      See Also:
    • getXMLInputFactory

      public XMLInputFactory getXMLInputFactory()
      Description copied from class: ALcdXMLModelDecoder
      Returns the javax.xml.stream.XMLInputFactory that is used by this decoder for creating javax.xml.stream.XMLStreamReader instances.
      Specified by:
      getXMLInputFactory in class ALcdXMLModelDecoder
      Returns:
      the javax.xml.stream.XMLInputFactory that is used by this decoder for creating javax.xml.stream.XMLStreamReader instances.
    • setXMLInputFactory

      public void setXMLInputFactory(XMLInputFactory aXMLInputFactory)
      Description copied from class: ALcdXMLModelDecoder
      Sets the javax.xml.stream.XMLInputFactory to be used by this decoder for creating javax.xml.stream.XMLStreamReader instances.
      Specified by:
      setXMLInputFactory in class ALcdXMLModelDecoder
      Parameters:
      aXMLInputFactory - the javax.xml.stream.XMLInputFactory to be used by this decoder for creating javax.xml.stream.XMLStreamReader instances.
    • isUseApplicationSchemaCache

      public boolean isUseApplicationSchemaCache()
      Description copied from class: ALcdXMLModelDecoder

      Returns if application schemas are cached. When application schemas are cached, the decoder caches all applications schemas it encounters. When a certain schema is referenced during decoding, only if the schema is not found in the cache, it will be resolved. The default is not to cache.

      Note that in case multiple application schemas use the same namespace URI, it is not possible to turn on application schema caching because the decoder will not be able to discern between the different schemas.

      Specified by:
      isUseApplicationSchemaCache in class ALcdXMLModelDecoder
      Returns:
      if application schemas are cached
    • setUseApplicationSchemaCache

      public void setUseApplicationSchemaCache(boolean aUseCache)
      Description copied from class: ALcdXMLModelDecoder
      Enables or disables application schema caching depending on the parameter value.
      Specified by:
      setUseApplicationSchemaCache in class ALcdXMLModelDecoder
      Parameters:
      aUseCache - if true, application schema caching is turned on. If false, caching is turned off.
    • isAutoMergeFeatures

      public boolean isAutoMergeFeatures()
      Returns whether features in a message are automatically merged based on their identifier, during the decoding process. By default, this is set to true.
      Returns:
      true if feature merging is enabled
    • setAutoMergeFeatures

      public void setAutoMergeFeatures(boolean aAutoMergeFeaturesEnabled)
      Sets whether features in a message should automatically be merged based on their identifier. By default, this is set to true.
      Parameters:
      aAutoMergeFeaturesEnabled - True to enable merging of features, false otherwise.
      See Also:
    • isAutoSortTimeSlices

      public boolean isAutoSortTimeSlices()
      Returns whether time slices in a feature are automatically sorted by sequence and correction number, during the decoding process. By default, this is set to true.
      Returns:
      true if time slice sorting is enabled
    • setAutoSortTimeSlices

      public void setAutoSortTimeSlices(boolean aAutoSortTimeSlicesEnabled)
      Sets whether time slices in a feature should automatically be sorted by sequence and correction number. By default, this is set to true.
      Parameters:
      aAutoSortTimeSlicesEnabled - True to enable sorting of time slices, false otherwise.
      See Also:
    • isSeparateFeatureTypes

      public final boolean isSeparateFeatureTypes()
      Returns whether different feature types (airspace, airport/heliport, ...) are decoded into separate models.
      Returns:
      true if different feature types are decoded into separate models.
      Since:
      2019.0
      See Also:
    • setSeparateFeatureTypes

      public final void setSeparateFeatureTypes(boolean aSeparateFeatureTypes)
      Sets whether different feature types (airspace, airport/heliport, ...) are decoded into separate models.

      When set to true, a decoded model is a ILcdModelTreeNode model tree node. A child model is added to this model tree node for each separate feature type that is present in the data. Each child model is an extension of TLcdAIXM51AbstractAIXMMessage. When set to false, a decoded model is an extension of TLcdAIXM51AbstractAIXMMessage, containing all the feature types present in the data. By default, this is set to false.

      The ordering of the models inside the model tree node is fixed: see the utility method separateFeatureTypes for additional information.

      Parameters:
      aSeparateFeatureTypes - true to decode different feature types into separate models, false otherwise
      Since:
      2019.0
      See Also:
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getModelReferenceParser

      public ILcdModelReferenceParser getModelReferenceParser()
      Returns the model reference parser that is used to create ILcdModelReference instances when decoding an srsName.
      Returns:
      the model reference parser of this decoder
    • setModelReferenceParser

      public void setModelReferenceParser(ILcdModelReferenceParser aModelReferenceParser)
      Sets the parser that is used to create ILcdModelReference instances given an srsName.
      Parameters:
      aModelReferenceParser - the model reference parser for this decoder
    • getDefaultSrsName

      public String getDefaultSrsName()
      Get the default srsName for this instance.
      Returns:
      the default srsName.
      See Also:
    • setDefaultSrsName

      public void setDefaultSrsName(String aDefaultSrsName)
      Set the default srsName that will be used to determine the model reference if neither the first message member, its possible envelope or the possible envelope of the AIXM Message has a srsName attribute set. Further elements with no srsName will be assumed to be in the same reference as the model.

      By default, the model decoder uses CRS84.

      Parameters:
      aDefaultSrsName - the default srsName
      Throws:
      IllegalArgumentException - if the srsName can not be parsed.
    • decodeModelMetadata

      public TLcdModelMetadata decodeModelMetadata(String aSourceName) throws IOException
      Decodes metadata for the specified data source. This method first attempts to decode only the envelope of the given AIXM 5.1 Message and use that information to generate the metadata. If no envelope is present, the whole model is decoded and the metadata is extracted from that decoded model with ILcdModel.getModelMetadata().
      Parameters:
      aSourceName - a data source representing an AIXM 5.1 Message.
      Returns:
      the model metadata for the data source, never null.
      Throws:
      IOException - if the metadata cannot be decoded for some reason.
      See Also:
    • setLinearElementsUseGeodesicInterpolationForGeodeticSrs

      public void setLinearElementsUseGeodesicInterpolationForGeodeticSrs(boolean aUseGeodesicInterpolationForGeodeticSrs)
      Sets whether a geodesic interpolation needs to be used for linear GML elements in case of a geodetic reference. This applies to the following linear GML elements that are compatible with AIXM 5.1: LinearRing and LineStringSegment.

      Although these GML elements conceptually represent geometries with a linear interpolation, they are often used in AIXM 5.1 to represent geometries with lon/lat coordinates and a geodesic interpolation. Setting this flag to true enables this use case by determining the interpolation based on the coordinate reference.

      Parameters:
      aUseGeodesicInterpolationForGeodeticSrs - whether a geodesic interpolation needs to be used in case of a geodetic reference
      Since:
      2022.0
      See Also:
    • isLinearElementsUseGeodesicInterpolationForGeodeticSrs

      public boolean isLinearElementsUseGeodesicInterpolationForGeodeticSrs()
      Returns true if a geodesic interpolation needs to be used for linear GML elements in case of a geodetic reference. By default, true is returned.
      Returns:
      true if a geodesic interpolation needs to be used for linear GML elements in case of a geodetic reference.
      Since:
      2022.0
      See Also: