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
ILcdInputStreamFactory
of 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 ofILcd2DBoundsIndexedModel
andILcdIntegerIndexedModel
. 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 methodseparateFeatureTypes
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
- All models returned by this model decoder have an
ILcdGridReference
or 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. 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(); com.luciad.format.aixm51.model
package. - Next to using
TLcdAIXM51AbstractAIXMFeature
to access the feature and its time slices and properties, all model elements also implementILcdDataObject
to 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
ILcdCircularArcByCenterPoint
interface inTLcdGML32ArcByCenterPoint
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 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
ConstructorDescriptionConstructs a newTLcdAIXM51ModelDecoder
.TLcdAIXM51ModelDecoder
(TLcdDataModel aDataModel) Constructs a newTLcdAIXM51ModelDecoder
for the given data model.TLcdAIXM51ModelDecoder
(TLcdDataModel aDataModel, ILcdXLinkExpressionFactory aXLink) Constructs a newTLcdAIXM51ModelDecoder
for a custom data model with custom xlink resolution.Constructs a newTLcdAIXM51ModelDecoder
with custom xlink resolution. -
Method Summary
Modifier and TypeMethodDescriptionboolean
canDecodeSource
(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.EntityResolver2
that is used for creating input sources for XSD schemas.Returns theILcdInputStreamFactory
that is used for creating input streams.Returns the model reference parser that is used to createILcdModelReference
instances when decoding an srsName.Returns thejavax.xml.stream.XMLInputFactory
that is used by this decoder for creatingjavax.xml.stream.XMLStreamReader
instances.boolean
Returns whether features in a message are automatically merged based on their identifier, during the decoding process.boolean
Returns whether time slices in a feature are automatically sorted by sequence and correction number, during the decoding process.boolean
Returns true if a geodesic interpolation needs to be used for linear GML elements in case of a geodetic reference.final boolean
Returns whether different feature types (airspace, airport/heliport, ...) are decoded into separate models.boolean
Returns if application schemas are cached.void
setAutoMergeFeatures
(boolean aAutoMergeFeaturesEnabled) Sets whether features in a message should automatically be merged based on their identifier.void
setAutoSortTimeSlices
(boolean aAutoSortTimeSlicesEnabled) Sets whether time slices in a feature should automatically be sorted by sequence and correction number.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.void
setEntityResolver
(EntityResolver2 aEntityResolver) Sets theorg.xml.sax.ext.EntityResolver2
to be used for creating input sources for XSD schemas.void
setInputStreamFactory
(ILcdInputStreamFactory aInputStreamFactory) Sets theILcdInputStreamFactory
to be used for creating input streams.void
setLinearElementsUseGeodesicInterpolationForGeodeticSrs
(boolean aUseGeodesicInterpolationForGeodeticSrs) Sets whether a geodesic interpolation needs to be used for linear GML elements in case of a geodetic reference.void
setModelReferenceParser
(ILcdModelReferenceParser aModelReferenceParser) Sets the parser that is used to createILcdModelReference
instances given an srsName.final void
setSeparateFeatureTypes
(boolean aSeparateFeatureTypes) Sets whether different feature types (airspace, airport/heliport, ...) are decoded into separate models.void
setUseApplicationSchemaCache
(boolean aUseCache) Enables or disables application schema caching depending on the parameter value.void
setXMLInputFactory
(XMLInputFactory aXMLInputFactory) Sets thejavax.xml.stream.XMLInputFactory
to be used by this decoder for creatingjavax.xml.stream.XMLStreamReader
instances.toString()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.luciad.model.ILcdModelDecoder
canDecodeSource, decodeModelMetadata, decodeSource, discoverDataSources
-
Constructor Details
-
TLcdAIXM51ModelDecoder
Constructs a newTLcdAIXM51ModelDecoder
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 newTLcdAIXM51ModelDecoder
. -
TLcdAIXM51ModelDecoder
Constructs a newTLcdAIXM51ModelDecoder
with custom xlink resolution.- Parameters:
aXLink
- the factory that is to be used to create xlink expressions
-
TLcdAIXM51ModelDecoder
Constructs a newTLcdAIXM51ModelDecoder
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 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 theAirspaceType
in thehttp://www.aixm.aero/schema/5.1
data 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
TLcdAIXM51AbstractAIXMFeature
representing 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:ILcdModelDecoder
Checks whether this model decoder can decode the specified data source. It is acceptable for this method to returntrue
for a source name whiledecode
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
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 respectivelyAIXMBasicMessage
in thehttp://www.aixm.aero/schema/5.1/message
namespace orEvent
in thehttp://www.aixm.aero/schema/5.1/event/0.1
namespace.TLcdAIXM51AbstractAIXMMessage
. Use thedecodeFeature
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
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 classALcdXMLModelDecoder
- Parameters:
aSource
- the source to read the model from- Throws:
IOException
- See Also:
-
getDisplayName
Description copied from interface:ILcdModelDecoder
Returns a short, displayable name for the format that is decoded by thisILcdModelDecoder
.- Returns:
- the displayable name of this
ILcdModelDecoder
.
-
getEntityResolver
Description copied from class:ALcdXMLModelDecoder
Returns theorg.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 classALcdXMLModelDecoder
- Returns:
- the entity resolver to be used for creating input sources for XSD schemas.
-
setEntityResolver
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 returnsnull
), theALcdXMLModelDecoder.getInputStreamFactory()
is used to create an appropriate input stream for the given system id of the schema.- Specified by:
setEntityResolver
in classALcdXMLModelDecoder
- Parameters:
aEntityResolver
- the entity resolver to be used for creating input sources for XSD schemas.
-
getInputStreamFactory
Description copied from class:ALcdXMLModelDecoder
Returns theILcdInputStreamFactory
that is used for creating input streams.- Specified by:
getInputStreamFactory
in interfaceILcdInputStreamFactoryCapable
- Specified by:
getInputStreamFactory
in classALcdXMLModelDecoder
- Returns:
- the
ILcdInputStreamFactory
that is used for creating input streams. - See Also:
-
setInputStreamFactory
Description copied from class:ALcdXMLModelDecoder
Sets theILcdInputStreamFactory
to be used for creating input streams. If the configuredentity resolver
implementsILcdInputStreamFactoryCapable
, it is also configured with this factory.- Specified by:
setInputStreamFactory
in interfaceILcdInputStreamFactoryCapable
- Specified by:
setInputStreamFactory
in classALcdXMLModelDecoder
- Parameters:
aInputStreamFactory
- the input stream factory to be used by this model decoder.- See Also:
-
getXMLInputFactory
Description copied from class:ALcdXMLModelDecoder
Returns thejavax.xml.stream.XMLInputFactory
that is used by this decoder for creatingjavax.xml.stream.XMLStreamReader
instances.- Specified by:
getXMLInputFactory
in classALcdXMLModelDecoder
- Returns:
- the
javax.xml.stream.XMLInputFactory
that is used by this decoder for creatingjavax.xml.stream.XMLStreamReader
instances.
-
setXMLInputFactory
Description copied from class:ALcdXMLModelDecoder
Sets thejavax.xml.stream.XMLInputFactory
to be used by this decoder for creatingjavax.xml.stream.XMLStreamReader
instances.- Specified by:
setXMLInputFactory
in classALcdXMLModelDecoder
- Parameters:
aXMLInputFactory
- thejavax.xml.stream.XMLInputFactory
to be used by this decoder for creatingjavax.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 classALcdXMLModelDecoder
- 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 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:
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 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 methodseparateFeatureTypes
for additional information.- Parameters:
aSeparateFeatureTypes
-true
to decode different feature types into separate models,false
otherwise- Since:
- 2019.0
- See Also:
-
toString
-
getModelReferenceParser
Returns the model reference parser that is used to createILcdModelReference
instances when decoding an srsName.- Returns:
- the model reference parser of this decoder
-
setModelReferenceParser
Sets the parser that is used to createILcdModelReference
instances 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:LinearRing
andLineStringSegment
.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:
-