@LcdService(service=ILcdModelDecoder.class, priority=20000) public class TLcdAIXM51ModelDecoder extends ALcdXMLModelDecoder
ILcdModel
objects.
File | Required | Entry point | Description |
---|---|---|---|
*.xml | x | An XML file containing AIXM 5.1 data. |
ILcdInputStreamFactory
of this decoder.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.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.TLcdAIXM51ModelDescriptor
.ILcdGridReference
or
an ILcdGeodeticReference
.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.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.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)
decodeModelMetadata
method returns a metadata object with the
following:
ILcdModelDecoder decoder = new TLcdAIXM51ModelDecoder();
ILcdModel model = decoder.decode("aixm51_file.xml");
Constructor and Description |
---|
TLcdAIXM51ModelDecoder()
Constructs a new
TLcdAIXM51ModelDecoder . |
TLcdAIXM51ModelDecoder(ILcdXLinkExpressionFactory aXLink)
Constructs a new
TLcdAIXM51ModelDecoder with custom xlink resolution. |
TLcdAIXM51ModelDecoder(TLcdDataModel aDataModel)
Constructs a new
TLcdAIXM51ModelDecoder for the given data model. |
TLcdAIXM51ModelDecoder(TLcdDataModel aDataModel,
ILcdXLinkExpressionFactory aXLink)
Constructs a new
TLcdAIXM51ModelDecoder for a custom data model
with custom xlink resolution. |
Modifier and Type | Method and Description |
---|---|
boolean |
canDecodeSource(String aSourceName)
Checks whether this model decoder can decode the specified data source.
|
ILcdModel |
decode(Source aSource)
Creates a new model from the given data source.
|
ILcdModel |
decode(String aSourceName)
Decodes a data source representing an AIXM 5.1 Message into a
TLcdAIXM51AbstractAIXMMessage . |
TLcdAIXM51AbstractAIXMFeature |
decodeFeature(String aSource)
Decodes a data source representing an AIXM 5.1 Feature into a
TLcdAIXM51AbstractAIXMFeature . |
TLcdModelMetadata |
decodeModelMetadata(String aSourceName)
Decodes metadata for the specified data source.
|
String |
getDefaultSrsName()
Get the default srsName for this instance.
|
String |
getDisplayName()
Returns a short, displayable name for the format that is decoded by this
ILcdModelDecoder . |
EntityResolver2 |
getEntityResolver()
Returns the
org.xml.sax.ext.EntityResolver2 that is used for creating input sources for
XSD schemas. |
ILcdInputStreamFactory |
getInputStreamFactory()
Returns the
ILcdInputStreamFactory that is used for creating input streams. |
ILcdModelReferenceParser |
getModelReferenceParser()
Returns the model reference parser that is used to create
ILcdModelReference
instances when decoding an srsName. |
XMLInputFactory |
getXMLInputFactory()
Returns the
javax.xml.stream.XMLInputFactory that is used by this decoder for creating
javax.xml.stream.XMLStreamReader instances. |
boolean |
isAutoMergeFeatures()
Returns whether features in a message are automatically merged based on their identifier,
during the decoding process.
|
boolean |
isAutoSortTimeSlices()
Returns whether time slices in a feature are automatically sorted by
sequence and correction number, during the decoding process.
|
boolean |
isLinearElementsUseGeodesicInterpolationForGeodeticSrs()
Returns true if a geodesic interpolation needs to be used for linear GML elements in case of a geodetic reference.
|
boolean |
isSeparateFeatureTypes()
Returns whether different feature types (airspace, airport/heliport, ...) are decoded into separate models.
|
boolean |
isUseApplicationSchemaCache()
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 the
org.xml.sax.ext.EntityResolver2 to be used for creating input sources for
XSD schemas. |
void |
setInputStreamFactory(ILcdInputStreamFactory aInputStreamFactory)
Sets the
ILcdInputStreamFactory 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 create
ILcdModelReference instances
given an srsName. |
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 the
javax.xml.stream.XMLInputFactory to be used by this decoder for creating
javax.xml.stream.XMLStreamReader instances. |
String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
canDecodeSource, decodeModelMetadata, decodeSource, discoverDataSources
public TLcdAIXM51ModelDecoder(TLcdDataModel aDataModel)
TLcdAIXM51ModelDecoder
for the given data model.aDataModel
- the data model for which this decoder should be configuredIllegalArgumentException
- if the data model does not depend on the AIXM 5.1 data modelpublic TLcdAIXM51ModelDecoder()
TLcdAIXM51ModelDecoder
.public TLcdAIXM51ModelDecoder(ILcdXLinkExpressionFactory aXLink)
TLcdAIXM51ModelDecoder
with custom xlink resolution.aXLink
- the factory that is to be used to create xlink expressionspublic TLcdAIXM51ModelDecoder(TLcdDataModel aDataModel, ILcdXLinkExpressionFactory aXLink)
TLcdAIXM51ModelDecoder
for a custom data model
with custom xlink resolution. The given data model must depend on the
AIXM 5.1 data model.aDataModel
- the data model for which this decoder should be configuredaXLink
- the factory that is to be used to create xlink expressionspublic TLcdAIXM51AbstractAIXMFeature decodeFeature(String aSource) throws IOException
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.
ILcdModel
. The feature returned by this method should
be wrapped in a model explicitly.aSource
- a data source representing an AIXM 5.1 FeatureTLcdAIXM51AbstractAIXMFeature
representing the decoded AIXM 5.1 FeatureIOException
- if the data source is not recognized as an AIXM 5.1 Featurepublic boolean canDecodeSource(String aSourceName)
ILcdModelDecoder
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.
aSourceName
- the data source to be verified; typically a file name or a URL.true
if this decoder can likely decode the data specified by the source name, false
otherwise.ILcdModelDecoder.decode(String)
,
ILcdModelDecoder.decodeModelMetadata(String)
public ILcdModel decode(String aSourceName) throws IOException
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.
TLcdAIXM51AbstractAIXMMessage
. Use the decodeFeature
method to avoid
this behavior.aSourceName
- a data source representing an AIXM 5.1 MessageTLcdAIXM51AbstractAIXMMessage
representing the decoded AIXM 5.1 MessageIOException
- if the data source is not recognized as an AIXM 5.1 MessageILcdModelDecoder.canDecodeSource(String)
public ILcdModel decode(Source aSource) throws IOException
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.
decode
in class ALcdXMLModelDecoder
aSource
- the source to read the model fromIOException
ILcdModelDecoder.decode(String)
public String getDisplayName()
ILcdModelDecoder
ILcdModelDecoder
.ILcdModelDecoder
.public EntityResolver2 getEntityResolver()
ALcdXMLModelDecoder
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.getEntityResolver
in class ALcdXMLModelDecoder
public void setEntityResolver(EntityResolver2 aEntityResolver)
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.
setEntityResolver
in class ALcdXMLModelDecoder
aEntityResolver
- the entity resolver to be used for creating input sources for XSD schemas.public ILcdInputStreamFactory getInputStreamFactory()
ALcdXMLModelDecoder
ILcdInputStreamFactory
that is used for creating input streams.getInputStreamFactory
in interface ILcdInputStreamFactoryCapable
getInputStreamFactory
in class ALcdXMLModelDecoder
ILcdInputStreamFactory
that is used for creating input streams.ALcdXMLModelDecoder.setInputStreamFactory(com.luciad.io.ILcdInputStreamFactory)
public void setInputStreamFactory(ILcdInputStreamFactory aInputStreamFactory)
ALcdXMLModelDecoder
ILcdInputStreamFactory
to be used for creating input streams.
If the configured entity resolver
implements ILcdInputStreamFactoryCapable
,
it is also configured with this factory.setInputStreamFactory
in interface ILcdInputStreamFactoryCapable
setInputStreamFactory
in class ALcdXMLModelDecoder
aInputStreamFactory
- the input stream factory to be used by this model decoder.ALcdXMLModelDecoder.getInputStreamFactory()
public XMLInputFactory getXMLInputFactory()
ALcdXMLModelDecoder
javax.xml.stream.XMLInputFactory
that is used by this decoder for creating
javax.xml.stream.XMLStreamReader
instances.getXMLInputFactory
in class ALcdXMLModelDecoder
javax.xml.stream.XMLInputFactory
that is used by this decoder for creating
javax.xml.stream.XMLStreamReader
instances.public void setXMLInputFactory(XMLInputFactory aXMLInputFactory)
ALcdXMLModelDecoder
javax.xml.stream.XMLInputFactory
to be used by this decoder for creating
javax.xml.stream.XMLStreamReader
instances.setXMLInputFactory
in class ALcdXMLModelDecoder
aXMLInputFactory
- the javax.xml.stream.XMLInputFactory
to be used by this decoder
for creating javax.xml.stream.XMLStreamReader
instances.public boolean isUseApplicationSchemaCache()
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.
isUseApplicationSchemaCache
in class ALcdXMLModelDecoder
public void setUseApplicationSchemaCache(boolean aUseCache)
ALcdXMLModelDecoder
setUseApplicationSchemaCache
in class ALcdXMLModelDecoder
aUseCache
- if true, application schema caching is turned on. If false,
caching is turned off.public boolean isAutoMergeFeatures()
public void setAutoMergeFeatures(boolean aAutoMergeFeaturesEnabled)
aAutoMergeFeaturesEnabled
- True to enable merging of features, false otherwise.TLcdAIXM51MessageUtil.mergeUniqueFeatures(com.luciad.format.aixm51.model.abstractfeature.TLcdAIXM51AbstractAIXMMessage)
public boolean isAutoSortTimeSlices()
public void setAutoSortTimeSlices(boolean aAutoSortTimeSlicesEnabled)
aAutoSortTimeSlicesEnabled
- True to enable sorting of time slices, false otherwise.TLcdAIXM51MessageUtil.sortMessage(com.luciad.format.aixm51.model.abstractfeature.TLcdAIXM51AbstractAIXMMessage)
public final boolean isSeparateFeatureTypes()
true
if different feature types are decoded into separate models.setSeparateFeatureTypes(boolean)
public final void setSeparateFeatureTypes(boolean aSeparateFeatureTypes)
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.aSeparateFeatureTypes
- true
to decode different feature types into separate models, false
otherwiseTLcdAIXM51MessageUtil.separateFeatureTypes(TLcdAIXM51AbstractAIXMMessage)
,
isSeparateFeatureTypes()
public ILcdModelReferenceParser getModelReferenceParser()
ILcdModelReference
instances when decoding an srsName.public void setModelReferenceParser(ILcdModelReferenceParser aModelReferenceParser)
ILcdModelReference
instances
given an srsName.aModelReferenceParser
- the model reference parser for this decoderpublic String getDefaultSrsName()
setDefaultSrsName(String)
public void setDefaultSrsName(String aDefaultSrsName)
By default, the model decoder uses CRS84.
aDefaultSrsName
- the default srsNameIllegalArgumentException
- if the srsName can not be parsed.public TLcdModelMetadata decodeModelMetadata(String aSourceName) throws IOException
ILcdModel.getModelMetadata()
.aSourceName
- a data source representing an AIXM 5.1 Message.IOException
- if the metadata cannot be decoded for some reason.ILcdModelDecoder.canDecodeSource(String)
public void setLinearElementsUseGeodesicInterpolationForGeodeticSrs(boolean aUseGeodesicInterpolationForGeodeticSrs)
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.
aUseGeodesicInterpolationForGeodeticSrs
- whether a geodesic interpolation needs to be used in case of a geodetic referenceisLinearElementsUseGeodesicInterpolationForGeodeticSrs()
public boolean isLinearElementsUseGeodesicInterpolationForGeodeticSrs()
true
is returned.setLinearElementsUseGeodesicInterpolationForGeodeticSrs(boolean)