Class TLcdGMLApplicationModelDecoder

java.lang.Object
com.luciad.format.gmlcommon.transformation.TLcdGMLApplicationModelDecoder
All Implemented Interfaces:
ILcdModelDecoder

public class TLcdGMLApplicationModelDecoder extends Object implements 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 Details

    • TLcdGMLApplicationModelDecoder

      public TLcdGMLApplicationModelDecoder(TLcdGMLTransformer aTransformer)
      Constructs a new instance based on the given TLcdGMLTransformer and a new TLcdXMLSchemaBasedDecoder.
      Parameters:
      aTransformer - the transformer to use to transform the decoded GML objects
    • TLcdGMLApplicationModelDecoder

      public TLcdGMLApplicationModelDecoder(TLcdXMLSchemaBasedDecoder aDecoder, TLcdGMLTransformer aTransformer)
      Constructs a new instance. The given TLcdXMLSchemaBasedDecoder is used to decode GML documents. The given TLcdGMLTransformer 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 documents
      aTransformer - the transformer to use to transform the GML objects into the source data model
  • Method Details

    • getDisplayName

      public String getDisplayName()
      Description copied from interface: ILcdModelDecoder
      Returns a short, displayable name for the format that is decoded by this ILcdModelDecoder.
      Specified by:
      getDisplayName in interface ILcdModelDecoder
      Returns:
      the displayable name of this ILcdModelDecoder.
    • canDecodeSource

      public boolean canDecodeSource(String aSourceName)
      Checks whether this model decoder can decode the specified data source. It is acceptable for this method to return 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.

      This implementation accepts the default extensions of the used GML data model (see the corresponding GML32, GML31, and GML2 decoders).
      Specified by:
      canDecodeSource in interface ILcdModelDecoder
      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

      public ILcdModel decode(String aSourceName) throws IOException
      Description copied from interface: ILcdModelDecoder
      Creates a new model from the given data source.
      Specified by:
      decode in interface ILcdModelDecoder
      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

      public ILcdModel decode(Source aSource, ILcdXMLDocumentContext aDocumentContext) throws IOException
      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 collection
      aDocumentContext - 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

      public TLcdXMLSchemaBasedDecoder getDecoder()
      Returns the TLcdXMLSchemaBasedDecoder that this object uses to decode the GML documents.
      Returns:
      the decoder that is used to decode the GML
    • getModelReferenceParser

      public ILcdModelReferenceParser getModelReferenceParser()
      Returns the model reference parser used by the decoder to turn srsNames into ILcdModelReference objects.
      Returns:
      the model reference parser used during decoding
    • setModelReferenceParser

      public void setModelReferenceParser(ILcdModelReferenceParser aModelReferenceParser)
      Sets the model reference parser.
      Parameters:
      aModelReferenceParser - the model reference parser to use during decoding
    • getModelFactory

      public ILcdModelFactory 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

      public void setModelFactory(ILcdModelFactory aModelFactory)
      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