Class TLcdOpenFlightModelDecoder
java.lang.Object
com.luciad.format.object3d.openflight.TLcdOpenFlightModelDecoder
- All Implemented Interfaces:
ILcdInputStreamFactoryCapable
,ILcdModelDecoder
@LcdService(service=ILcdModelDecoder.class,
priority=20000)
public class TLcdOpenFlightModelDecoder
extends Object
implements ILcdModelDecoder, ILcdInputStreamFactoryCapable
Decoder for OpenFlight scene databases. This decoder generates a model which
contains a single ILcdOpenFlightNode object. This object represents the scene graph
as described in the OpenFlight database.
The current implementation only supports databases with the "flat earth" projection type.
The model reference is obtained from an ILcdModelReferenceDecoder
. The default reference decoder set on this
model decoder is based on all model reference decoders annotated with the LcdService
annotation, and can handle
- EPSG references (
<filename>.epsg
): seeTLcdEPSGModelReferenceDecoder
for more info. - WKT references (
<filename>.prj
): seeTLcdWKTModelReferenceDecoder
for more info. - Luciad encoded model references (
<filename>.ref
): seeTLcdModelReferenceDecoder
for more info.
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addStatusListener
(ILcdStatusListener aStatusListener) Adds a status listener to be notified of decoding progress.boolean
canDecodeSource
(String aSourceName) Checks whether this model decoder can decode the specified data source.protected ILcdModelReference
Creates anILcdModelReference
for the OpenFlight scene being decoded.Decodes an OpenFlight database from the specified source.Returns a short, displayable name for the format that is decoded by thisILcdModelDecoder
.Returns the input stream factory that is used.Returns the model reference decoder that is used for creating model references for decoded models.boolean
removeStatusListener
(ILcdStatusListener aStatusListener) Removes a previously registered status listenervoid
setInputStreamFactory
(ILcdInputStreamFactory aILcdInputStreamFactory) Sets the input stream factory to be used.void
setModelReferenceDecoder
(ILcdModelReferenceDecoder aModelReferenceDecoder) Sets the model reference decoder to be used when decoding an OpenFlight model.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.luciad.model.ILcdModelDecoder
canDecodeSource, decodeModelMetadata, decodeModelMetadata, decodeSource, discoverDataSources
-
Constructor Details
-
TLcdOpenFlightModelDecoder
public TLcdOpenFlightModelDecoder()
-
-
Method Details
-
setInputStreamFactory
Description copied from interface:ILcdInputStreamFactoryCapable
Sets the input stream factory to be used.- Specified by:
setInputStreamFactory
in interfaceILcdInputStreamFactoryCapable
- Parameters:
aILcdInputStreamFactory
- the input stream factory to be used.
-
getInputStreamFactory
Description copied from interface:ILcdInputStreamFactoryCapable
Returns the input stream factory that is used.- Specified by:
getInputStreamFactory
in interfaceILcdInputStreamFactoryCapable
- Returns:
- the input stream factory that is used.
-
addStatusListener
Adds a status listener to be notified of decoding progress.- Parameters:
aStatusListener
- an ILcdStatusListener
-
removeStatusListener
Removes a previously registered status listener- Parameters:
aStatusListener
- an ILcdStatusListener- Returns:
- true if the status listener was successfully removed
-
getModelReferenceDecoder
Returns the model reference decoder that is used for creating model references for decoded models. The default value supports WKT (*.prj), REF (*.ref), and EPSG (*.epsg).- Returns:
- the model reference decoder used by this decoder
- See Also:
-
setModelReferenceDecoder
Sets the model reference decoder to be used when decoding an OpenFlight model. If the model reference decoder is null or fails to decode a model reference for the given source name, the model's georeference is constructed from the information present in the header of the .FLT file. Otherwise, the model reference returned by the model reference decoder is used.- Parameters:
aModelReferenceDecoder
- a model reference decoder- See Also:
-
getDisplayName
Description copied from interface:ILcdModelDecoder
Returns a short, displayable name for the format that is decoded by thisILcdModelDecoder
.- Specified by:
getDisplayName
in interfaceILcdModelDecoder
- Returns:
- the displayable name of this
ILcdModelDecoder
.
-
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.
- Specified by:
canDecodeSource
in interfaceILcdModelDecoder
- 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 an OpenFlight database from the specified source. Returns a model containing a TLcdOpenFlightHeaderNode object.- Specified by:
decode
in interfaceILcdModelDecoder
- Parameters:
aSourceName
- the OpenFlight file to be decoded- Returns:
- an ILcdModel
- Throws:
IOException
- if the file cannot be decoded- See Also:
-
createModelReference
protected ILcdModelReference createModelReference(TLcdOpenFlightHeaderNode aRoot) throws IOException Creates anILcdModelReference
for the OpenFlight scene being decoded. The information describing the geographic reference of the scene is available in the suppliedTLcdOpenFlightHeaderNode
. If a model reference decoder has been set on this OpenFlight decoder, however, it takes precedence over the information present in the file itself.- Parameters:
aRoot
- the OpenFlight root node for which to create a model reference- Returns:
- a model reference for the current OpenFlight scene
- Throws:
IOException
- in case the model reference decoder throws anInterruptedIOException
- See Also:
-