Class TLcdGMLApplicationModelDecoder
java.lang.Object
com.luciad.format.gmlcommon.transformation.TLcdGMLApplicationModelDecoder
- All Implemented Interfaces:
ILcdModelDecoder
Decodes GML documents into custom
ILcdDataObject
-enabled models.
The important difference with the other GML decoders (such as e.g. TLcdGML32ModelDecoder
) is that the
elements of the resulting model are not GML abstract features.
They are the result of applying the inverse of the specified GML transformation
on the abstract features contained in the source document.
The transformation does not specify the model implementation class and/or model descriptor of the decoded models.
This is configured separately
.
- Since:
- 11.0
- See Also:
-
Constructor Summary
ConstructorDescriptionTLcdGMLApplicationModelDecoder
(TLcdGMLTransformer aTransformer) Constructs a new instance based on the givenTLcdGMLTransformer
and a newTLcdXMLSchemaBasedDecoder
.TLcdGMLApplicationModelDecoder
(TLcdXMLSchemaBasedDecoder aDecoder, TLcdGMLTransformer aTransformer) Constructs a new instance. -
Method Summary
Modifier and TypeMethodDescriptionboolean
canDecodeSource
(String aSourceName) Checks whether this model decoder can decode the specified data source.Creates a new model from the given data source.decode
(Source aSource, ILcdXMLDocumentContext aDocumentContext) Decodes the given source, transforms the GML features that are contained within it and adds these to the returned model.Returns theTLcdXMLSchemaBasedDecoder
that this object uses to decode the GML documents.Returns a short, displayable name for the format that is decoded by thisILcdModelDecoder
.Returns the model factory that is used to create the new model that is returned as the decoding result.Returns the model reference parser used by the decoder to turn srsNames intoILcdModelReference
objects.void
setModelFactory
(ILcdModelFactory aModelFactory) Sets the model factory that should be used to create the models that are returned by this decoder.void
setModelReferenceParser
(ILcdModelReferenceParser aModelReferenceParser) Sets the model reference parser.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
-
TLcdGMLApplicationModelDecoder
Constructs a new instance based on the givenTLcdGMLTransformer
and a newTLcdXMLSchemaBasedDecoder
.- Parameters:
aTransformer
- the transformer to use to transform the decoded GML objects
-
TLcdGMLApplicationModelDecoder
public TLcdGMLApplicationModelDecoder(TLcdXMLSchemaBasedDecoder aDecoder, TLcdGMLTransformer aTransformer) Constructs a new instance. The givenTLcdXMLSchemaBasedDecoder
is used to decode GML documents. The givenTLcdGMLTransformer
is used to transform the GML object back into the source data model. Note that the transformer's target data model is expected to be dependent on GML; as such the inverse transformations of the transformer will be used to create instances of the source data model.- Parameters:
aDecoder
- the decoder to use for decoding the GML documentsaTransformer
- the transformer to use to transform the GML objects into the source data model
-
-
Method Details
-
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
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.
This implementation accepts the default extensions of the used GML data model (see the correspondingGML32
,GML31
, andGML2
decoders).- 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
Description copied from interface:ILcdModelDecoder
Creates a new model from the given data source.- Specified by:
decode
in interfaceILcdModelDecoder
- Parameters:
aSourceName
- the data source to be decoded; typically a file name or a URL.- Returns:
- A model containing the decoded data. While
null
is allowed, implementors are advised to throw an error instead. - Throws:
IOException
- for any exceptions caused by IO problems or invalid data. Since decoding invalid data almost always results in RunTimeExceptions (NullPointerException, IndexOutOfBoundsException, IllegalArgumentException, ...) on unexpected places, implementations are advised to catch RuntimeExceptions in their decode() method, and wrap them into an IOException, as illustrated in the code snippet below.public ILcdModel decode( String aSourceName ) throws IOException { try (InputStream input = fInputStreamFactory.createInputStream(aSourceName)) { // Perform decoding ... } catch (RuntimeException e) { throw new IOException(e); } }
- See Also:
-
decode
Decodes the given source, transforms the GML features that are contained within it and adds these to the returned model.- Parameters:
aSource
- a source containing a GML feature collectionaDocumentContext
- the document context to use during decoding- Returns:
- a new model containing elements from this object's gml transformer's source data model
- Throws:
IOException
-
getDecoder
Returns theTLcdXMLSchemaBasedDecoder
that this object uses to decode the GML documents.- Returns:
- the decoder that is used to decode the GML
-
getModelReferenceParser
Returns the model reference parser used by the decoder to turn srsNames intoILcdModelReference
objects.- Returns:
- the model reference parser used during decoding
-
setModelReferenceParser
Sets the model reference parser.- Parameters:
aModelReferenceParser
- the model reference parser to use during decoding
-
getModelFactory
Returns the model factory that is used to create the new model that is returned as the decoding result.- Returns:
- the model factory of this object
-
setModelFactory
Sets the model factory that should be used to create the models that are returned by this decoder.- Parameters:
aModelFactory
- the model factory to use for creating models
-