Class TLcdAIXM51ModelDecoder
- All Implemented Interfaces:
ILcdInputStreamFactoryCapable,ILcdModelDecoder
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
ILcdInputStreamFactoryof this decoder.
Model structure
- This model decoder creates a model per file.
- If
isSeparateFeatureTypes()is disabled (default), the returned model extends fromTLcdAIXM51AbstractAIXMMessage, which is an implementation ofILcd2DBoundsIndexedModelandILcdIntegerIndexedModel. This model contains all the feature types present in the data. - If
isSeparateFeatureTypes()is enabled, the returned model is amodel 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 ofTLcdAIXM51AbstractAIXMMessage. The ordering of the child models is fixed; see the utility methodseparateFeatureTypesfor 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
- All models returned by this model decoder have an
ILcdGridReferenceor anILcdGeodeticReference.
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:
The full AIXM 5.1 domain model is defined in the// 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. ListtimeSlices = 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(); com.luciad.format.aixm51.modelpackage. - Next to using
TLcdAIXM51AbstractAIXMFeatureto access the feature and its time slices and properties, all model elements also implementILcdDataObjectto access properties in a generic way. Similarly, the geometry of a model element can be retrieved in a generic way using theALcdShape.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
ILcdCircularArcByCenterPointinterface inTLcdGML32ArcByCenterPointwill 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 inTLcdGML32ArcByCenterPoint.connect(com.luciad.shape.ILcdPoint, com.luciad.shape.ILcdPoint)
Metadata decoding
ThedecodeModelMetadata 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 Summary
ConstructorsConstructorDescriptionConstructs a newTLcdAIXM51ModelDecoder.TLcdAIXM51ModelDecoder(TLcdDataModel aDataModel) Constructs a newTLcdAIXM51ModelDecoderfor the given data model.TLcdAIXM51ModelDecoder(TLcdDataModel aDataModel, ILcdXLinkExpressionFactory aXLink) Constructs a newTLcdAIXM51ModelDecoderfor a custom data model with custom xlink resolution.Constructs a newTLcdAIXM51ModelDecoderwith custom xlink resolution. -
Method Summary
Modifier and TypeMethodDescriptionbooleancanDecodeSource(String aSourceName) Checks whether this model decoder can decode the specified data source.Decodes a data source representing an AIXM 5.1 Message into aTLcdAIXM51AbstractAIXMMessage.Creates a new model from the given data source.decodeFeature(String aSource) Decodes a data source representing an AIXM 5.1 Feature into aTLcdAIXM51AbstractAIXMFeature.decodeModelMetadata(String aSourceName) Decodes metadata for the specified data source.Get the default srsName for this instance.Returns a short, displayable name for the format that is decoded by thisILcdModelDecoder.Returns theorg.xml.sax.ext.EntityResolver2that is used for creating input sources for XSD schemas.Returns theILcdInputStreamFactorythat is used for creating input streams.Returns the model reference parser that is used to createILcdModelReferenceinstances when decoding an srsName.Returns thejavax.xml.stream.XMLInputFactorythat is used by this decoder for creatingjavax.xml.stream.XMLStreamReaderinstances.booleanReturns whether features in a message are automatically merged based on their identifier, during the decoding process.booleanReturns whether time slices in a feature are automatically sorted by sequence and correction number, during the decoding process.booleanReturns true if a geodesic interpolation needs to be used for linear GML elements in case of a geodetic reference.final booleanReturns whether different feature types (airspace, airport/heliport, ...) are decoded into separate models.booleanReturns if application schemas are cached.voidsetAutoMergeFeatures(boolean aAutoMergeFeaturesEnabled) Sets whether features in a message should automatically be merged based on their identifier.voidsetAutoSortTimeSlices(boolean aAutoSortTimeSlicesEnabled) Sets whether time slices in a feature should automatically be sorted by sequence and correction number.voidsetDefaultSrsName(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.voidsetEntityResolver(EntityResolver2 aEntityResolver) Sets theorg.xml.sax.ext.EntityResolver2to be used for creating input sources for XSD schemas.voidsetInputStreamFactory(ILcdInputStreamFactory aInputStreamFactory) Sets theILcdInputStreamFactoryto be used for creating input streams.voidsetLinearElementsUseGeodesicInterpolationForGeodeticSrs(boolean aUseGeodesicInterpolationForGeodeticSrs) Sets whether a geodesic interpolation needs to be used for linear GML elements in case of a geodetic reference.voidsetModelReferenceParser(ILcdModelReferenceParser aModelReferenceParser) Sets the parser that is used to createILcdModelReferenceinstances given an srsName.final voidsetSeparateFeatureTypes(boolean aSeparateFeatureTypes) Sets whether different feature types (airspace, airport/heliport, ...) are decoded into separate models.voidsetUseApplicationSchemaCache(boolean aUseCache) Enables or disables application schema caching depending on the parameter value.voidsetXMLInputFactory(XMLInputFactory aXMLInputFactory) Sets thejavax.xml.stream.XMLInputFactoryto be used by this decoder for creatingjavax.xml.stream.XMLStreamReaderinstances.toString()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.luciad.model.ILcdModelDecoder
canDecodeSource, decodeModelMetadata, decodeSource, discoverDataSources
-
Constructor Details
-
TLcdAIXM51ModelDecoder
Constructs a newTLcdAIXM51ModelDecoderfor 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 newTLcdAIXM51ModelDecoder. -
TLcdAIXM51ModelDecoder
Constructs a newTLcdAIXM51ModelDecoderwith custom xlink resolution.- Parameters:
aXLink- the factory that is to be used to create xlink expressions
-
TLcdAIXM51ModelDecoder
Constructs a newTLcdAIXM51ModelDecoderfor 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 configuredaXLink- the factory that is to be used to create xlink expressions
-
-
Method Details
-
decodeFeature
Decodes a data source representing an AIXM 5.1 Feature into aTLcdAIXM51AbstractAIXMFeature. 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,
Note that this method does not return anTLcdDataObject.getDataType()can be used to retrieve the type of the feature. For example, in case of an airspace feature, the type is theAirspaceTypein thehttp://www.aixm.aero/schema/5.1data model.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
TLcdAIXM51AbstractAIXMFeaturerepresenting the decoded AIXM 5.1 Feature - Throws:
IOException- if the data source is not recognized as an AIXM 5.1 Feature
-
canDecodeSource
Description copied from interface:ILcdModelDecoderChecks whether this model decoder can decode the specified data source. It is acceptable for this method to returntruefor a source name whiledecodethrows 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:
trueif this decoder can likely decode the data specified by the source name,falseotherwise.- See Also:
-
decode
Decodes a data source representing an AIXM 5.1 Message into aTLcdAIXM51AbstractAIXMMessage. 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,
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 aTLcdDataObject.getDataType()can be used to retrieve the type of the message. For example, in case of a Basic Message or Digital NOTAM, this is respectivelyAIXMBasicMessagein thehttp://www.aixm.aero/schema/5.1/messagenamespace orEventin thehttp://www.aixm.aero/schema/5.1/event/0.1namespace.TLcdAIXM51AbstractAIXMMessage. Use thedecodeFeaturemethod to avoid this behavior.- Parameters:
aSourceName- a data source representing an AIXM 5.1 Message- Returns:
- a
TLcdAIXM51AbstractAIXMMessagerepresenting the decoded AIXM 5.1 Message - Throws:
IOException- if the data source is not recognized as an AIXM 5.1 Message- See Also:
-
decode
Description copied from class:ALcdXMLModelDecoderCreates 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:
decodein classALcdXMLModelDecoder- Parameters:
aSource- the source to read the model from- Throws:
IOException- See Also:
-
getDisplayName
Description copied from interface:ILcdModelDecoderReturns a short, displayable name for the format that is decoded by thisILcdModelDecoder.- Returns:
- the displayable name of this
ILcdModelDecoder.
-
getEntityResolver
Description copied from class:ALcdXMLModelDecoderReturns theorg.xml.sax.ext.EntityResolver2that 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:
getEntityResolverin classALcdXMLModelDecoder- Returns:
- the entity resolver to be used for creating input sources for XSD schemas.
-
setEntityResolver
Description copied from class:ALcdXMLModelDecoderSets the
org.xml.sax.ext.EntityResolver2to be used for creating input sources for XSD schemas.When the entity resolver is unable to find a schema (i.e. the
resolveEntitymethod returnsnull), theALcdXMLModelDecoder.getInputStreamFactory()is used to create an appropriate input stream for the given system id of the schema.- Specified by:
setEntityResolverin classALcdXMLModelDecoder- Parameters:
aEntityResolver- the entity resolver to be used for creating input sources for XSD schemas.
-
getInputStreamFactory
Description copied from class:ALcdXMLModelDecoderReturns theILcdInputStreamFactorythat is used for creating input streams.- Specified by:
getInputStreamFactoryin interfaceILcdInputStreamFactoryCapable- Specified by:
getInputStreamFactoryin classALcdXMLModelDecoder- Returns:
- the
ILcdInputStreamFactorythat is used for creating input streams. - See Also:
-
setInputStreamFactory
Description copied from class:ALcdXMLModelDecoderSets theILcdInputStreamFactoryto be used for creating input streams. If the configuredentity resolverimplementsILcdInputStreamFactoryCapable, it is also configured with this factory.- Specified by:
setInputStreamFactoryin interfaceILcdInputStreamFactoryCapable- Specified by:
setInputStreamFactoryin classALcdXMLModelDecoder- Parameters:
aInputStreamFactory- the input stream factory to be used by this model decoder.- See Also:
-
getXMLInputFactory
Description copied from class:ALcdXMLModelDecoderReturns thejavax.xml.stream.XMLInputFactorythat is used by this decoder for creatingjavax.xml.stream.XMLStreamReaderinstances.- Specified by:
getXMLInputFactoryin classALcdXMLModelDecoder- Returns:
- the
javax.xml.stream.XMLInputFactorythat is used by this decoder for creatingjavax.xml.stream.XMLStreamReaderinstances.
-
setXMLInputFactory
Description copied from class:ALcdXMLModelDecoderSets thejavax.xml.stream.XMLInputFactoryto be used by this decoder for creatingjavax.xml.stream.XMLStreamReaderinstances.- Specified by:
setXMLInputFactoryin classALcdXMLModelDecoder- Parameters:
aXMLInputFactory- thejavax.xml.stream.XMLInputFactoryto be used by this decoder for creatingjavax.xml.stream.XMLStreamReaderinstances.
-
isUseApplicationSchemaCache
public boolean isUseApplicationSchemaCache()Description copied from class:ALcdXMLModelDecoderReturns 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:
isUseApplicationSchemaCachein classALcdXMLModelDecoder- Returns:
- if application schemas are cached
-
setUseApplicationSchemaCache
public void setUseApplicationSchemaCache(boolean aUseCache) Description copied from class:ALcdXMLModelDecoderEnables or disables application schema caching depending on the parameter value.- Specified by:
setUseApplicationSchemaCachein classALcdXMLModelDecoder- 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:
trueif 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 totrue, a decoded model is aILcdModelTreeNode 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 ofTLcdAIXM51AbstractAIXMMessage. When set tofalse, a decoded model is an extension ofTLcdAIXM51AbstractAIXMMessage, containing all the feature types present in the data. By default, this is set tofalse. The ordering of the models inside the model tree node is fixed: see the utility methodseparateFeatureTypesfor additional information.- Parameters:
aSeparateFeatureTypes-trueto decode different feature types into separate models,falseotherwise- Since:
- 2019.0
- See Also:
-
toString
-
getModelReferenceParser
Returns the model reference parser that is used to createILcdModelReferenceinstances when decoding an srsName.- Returns:
- the model reference parser of this decoder
-
setModelReferenceParser
Sets the parser that is used to createILcdModelReferenceinstances given an srsName.- Parameters:
aModelReferenceParser- the model reference parser for this decoder
-
getDefaultSrsName
Get the default srsName for this instance.- Returns:
- the default srsName.
- See Also:
-
setDefaultSrsName
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
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 withILcdModel.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:LinearRingandLineStringSegment.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
trueenables 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,trueis 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:
-