@LcdService(service=ILcdModelDecoder.class, priority=20000) public class TLcdAIXMModelDecoder extends Object implements ILcdModelDecoder, ILcdInputStreamFactoryCapable
ILcdModelDecoder
implementation represents an AIXM data source decoder.
This decoder allows configuration of the types of AIS objects to be decoded.
For each type of object, a specific ILcdAIXMHandler
implementation
must be added to the decoder by invoking addHandlerForTypeToBeDecoded(ILcdAIXMHandler)
.
If no handlers are added, all available handers are automatically added.
File | Required | Entry point | Description |
---|---|---|---|
*.xml | x | x |
XML file containing a AIXM data |
ILcdInputStreamFactory
of this decoder.TLcdModelList
, that will contain
a submodel for each handler added to the decoder. If necessary, this model list
can be decomposed back into a set of individual models.TLcdAIXMModelListDescriptor
.TLcdGeodeticReference
.TLcdGeodeticDatum
(WGS-84).AIXM data type
.
For more information about the model and its elements, see the com.luciad.format.aixm.model
package
and its sub-packages.
ILcdModelDecoder decoder = new TLcdAIXMModelDecoder();
ILcdModel model = decoder.decode( "aixm_data.xml" );
TLcdAIXM51ModelDecoder
.ILcdAIXMHandler
Constructor and Description |
---|
TLcdAIXMModelDecoder()
Constructs a new
TLcdAIXMModelDecoder object with all of the default
ILcdAIXMHandler s installed. |
Modifier and Type | Method and Description |
---|---|
void |
addHandlerForTypeToBeDecoded(ILcdAIXMHandler aHandler)
Adds an
ILcdAIXMHandler to the decoder. |
boolean |
canDecodeSource(String aSourceName)
Checks whether the supplied file or data source is recognized as
a decodable AIXM format; this can be either an AIXM-Snapshot or AIXM-Update file.
|
boolean |
canUpdateFromSource(String aSourceName)
Checks whether the supplied file or data source is recognized as
a decodable AIXM update format.
|
ILcdModel |
decode(String aSource)
Decodes the given source and returns an
ILcdModel containing the decoded AIXM objects. |
ILcdBounds |
getBoundsToFilterOn()
Returns the bounds to filter on.
|
String |
getDisplayName()
Returns a short, displayable name for the format that is decoded by this
ILcdModelDecoder . |
String |
getErrorMessage()
Returns the error message of the last decode call (when an error occurred).
|
ILcdAIXMHandler |
getHandlerForTypeToBeDecoded(int aIndex)
Returns the handler with the given index.
|
int |
getHandlerForTypeToBeDecodedCount()
Returns the number of handlers set on this decoder.
|
ILcdBounds |
getInitialBounds()
Returns the initial bounds for each model created
in the
decode method. |
ILcdInputStreamFactory |
getInputStreamFactory()
Returns the input stream factory that is currently used for creating input streams
given source names.
|
static boolean |
isTraceOn()
Deprecated.
This method has been deprecated. It is recommended to use the
standard Java logging framework directly.
|
void |
removeAllHandlersForTypeToBeDecoded()
Removes all handlers from this decoder.
|
void |
setBoundsToFilterOn(ILcdBounds aBoundsToFilterOn)
Specifies the bounds that will be used as a filter on each model
created in the
decode method. |
void |
setInitialBounds(ILcdBounds aInitialBounds)
Specifies the bounds to be used as initial bounds for each model created
in the
decode method. |
void |
setInputStreamFactory(ILcdInputStreamFactory aInputStreamFactory)
Sets the input stream factory that will be used for creating input streams
given source names.
|
static void |
setTraceOn(boolean aTraceOn)
Deprecated.
This method has been deprecated. It is recommended to use the
standard Java logging framework directly.
|
void |
updateSFCT(String aSource,
ILcdModel aModel)
Updates the supplied model with the given source containing AIXM update data.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
canDecodeSource, decodeModelMetadata, decodeModelMetadata, decodeSource, discoverDataSources
public TLcdAIXMModelDecoder()
TLcdAIXMModelDecoder
object with all of the default
ILcdAIXMHandler
s installed.
You can decode one or more specific AIXM domain objects (e.g. navaids, routes, airspaces, ...),
by registering one or more ILcdAIXMHandler
objects through
addHandlerForTypeToBeDecoded(ILcdAIXMHandler)
.
In this case, the default handlers will not be used.public String getDisplayName()
ILcdModelDecoder
ILcdModelDecoder
.getDisplayName
in interface ILcdModelDecoder
ILcdModelDecoder
.public boolean canUpdateFromSource(String aSourceName)
aSourceName
- a data source; typically a file name or a URL.public boolean canDecodeSource(String aSourceName)
canDecodeSource
in interface ILcdModelDecoder
aSourceName
- a data source; typically a file name or a URL.ILcdModelDecoder.decode(String)
,
ILcdModelDecoder.decodeModelMetadata(String)
public void updateSFCT(String aSource, ILcdModel aModel) throws IOException
TLcdModelList
.
Each model for which a corresponding handler (ILcdAIXMHandler
) has been registered
will be updated if there is update data available. A handler is considered suitable for updating
a model if it uses the same model descriptor.aSource
- the full path to the file containing AIXM update data, including the file name.aModel
- a model containing AIXM data that must be updated.IOException
- thrown if an error occurs during the read process.public ILcdModel decode(String aSource) throws IOException
ILcdModel
containing the decoded AIXM objects.
By default, all available handlers
are registered.
Otherwise, before invoking this method, a handler (ILcdAIXMHandler
) can be registered on this decoder
for each type of object that must be decoded, through addHandlerForTypeToBeDecoded(ILcdAIXMHandler)
.
For example, a TLcdAIXMAerodromeHandler
can be registered to decode Aerodrome objects.
In this case, the default handlers are ignored.
For each handler registered on this decoder, a new model will be created. When multiple
handlers are registered, a TLcdModelList
is returned containing all the created models.
If necessary, this model list can be decomposed back into a set of individual models
If no handlers are registered at all, an empty model will be returned.decode
in interface ILcdModelDecoder
aSource
- the full path to the file to be decoded, including the file name.IOException
- thrown if an error occurs during the read process.ILcdModelDecoder.canDecodeSource(String)
public void setInputStreamFactory(ILcdInputStreamFactory aInputStreamFactory)
setInputStreamFactory
in interface ILcdInputStreamFactoryCapable
aInputStreamFactory
- the input stream factory to be used.public ILcdInputStreamFactory getInputStreamFactory()
getInputStreamFactory
in interface ILcdInputStreamFactoryCapable
public void addHandlerForTypeToBeDecoded(ILcdAIXMHandler aHandler)
ILcdAIXMHandler
to the decoder.
This is optional, if none is added, all the default handlers are used. Once you add one specific handler,
the default handlers will never be used.
Each handler will generate an ILcdModel
containing one specific kind of domain
object. At the end of the decode process, the models created by the available handlers
will be brought together in a TLcdModelList
.aHandler
- an ILcdAIXMHandler
implementationgetHandlerForTypeToBeDecoded(int)
,
getHandlerForTypeToBeDecodedCount()
public ILcdAIXMHandler getHandlerForTypeToBeDecoded(int aIndex)
aIndex
- the index in the list of handlersaddHandlerForTypeToBeDecoded(com.luciad.format.aixm.decoder.ILcdAIXMHandler)
,
getHandlerForTypeToBeDecodedCount()
public int getHandlerForTypeToBeDecodedCount()
addHandlerForTypeToBeDecoded(com.luciad.format.aixm.decoder.ILcdAIXMHandler)
,
getHandlerForTypeToBeDecoded(int)
public void removeAllHandlersForTypeToBeDecoded()
public String getErrorMessage()
public void setInitialBounds(ILcdBounds aInitialBounds)
decode
method.
This bounds should be large enough to enclose (most of) the model objects. This option
can improve performance by avoiding too many expansions of the model bounds.
This parameter may be null.
Note: This bounds is not a filter! If a model objects bounds does not interact
with aInitialBounds, aInitialBounds will be enlarged to enclose the object.aInitialBounds
- the initial bounds for each model created in the decode
methodpublic void setBoundsToFilterOn(ILcdBounds aBoundsToFilterOn)
decode
method. Note that all
necessary ILcdAIXMHandler
instances
should be registered before calling this method. A bounds filter
can also be set on separate ILcdAIXMHandler
instances.
If this bounds is null, all objects found in the input file will
be inserted into the model.
If this bounds is not null, only the objects whose bounds interact with
the specified bounds will be inserted into the model.aBoundsToFilterOn
- the bounds to be used as a filterpublic ILcdBounds getInitialBounds()
decode
method.decode
methodsetInitialBounds(com.luciad.shape.ILcdBounds)
public ILcdBounds getBoundsToFilterOn()
setBoundsToFilterOn(com.luciad.shape.ILcdBounds)
public static boolean isTraceOn()
true
if tracing is enabled for this class.public static void setTraceOn(boolean aTraceOn)
true
then all log messages are recorded, otherwise only
the informative, warning and error messages are recorded.aTraceOn
- if true then all log messages are recorded,
otherwise only the informative, warning and error messages are recorded.