Class TLcdGML3ModelDecoder

java.lang.Object
com.luciad.format.gml3.TLcdGML3ModelDecoder
All Implemented Interfaces:
ILcdInputStreamFactoryCapable, ILcdModelDecoder

@Deprecated public class TLcdGML3ModelDecoder extends Object implements ILcdModelDecoder, ILcdInputStreamFactoryCapable
Deprecated.
This class has been deprecated. The GML decoders and encoders in the com.luciad.format.gml3.* packages are replaced by new decoders and encoders in the packages com.luciad.format.gml2.xml, com.luciad.format.gml31.xml and com.luciad.format.gml32.xml.
Decoder for GML documents. Current document requirements and limitations:
  • The document must be based on GML 2.1.2 or higher.
  • All XML document contents are read, but interpretation is only done for the following elements:
    • elements of the base schema,
    • elements of the feature schema, and
    • all geometries from the GML Simple Features Profile.
    All other XML elements will still be available as generic ILcdXMLElement objects.
  • XLINK references are currently not supported.
  • A valid XML Schema must be available.
  • GML allows individual features to have their own, local coordinate reference system, different from its container's reference (i.e., the global crs of the feature collection). LuciadLightspeed models and modellist can only have one model reference. All features having a local crs differing from the global one, will be transformed to the global crs. The global crs will be the first one that is read (typically the crs of the feature collection's envelope).
  • Currently, the following coordinate reference systems are supported:
    • All EPSG reference systems, supported by the TLcdEPSGReferenceParser class, and
    • the following reference systems, using the URN's (Uniform Resource Names), defined by the OGC: WGS84, NAD83 and NAD27.
A sample GML document looks as follows:

   <gml:FeatureCollection>
     <gml:boundedBy> .. </gml:boundedBy>
     <gml:featureMember>
       <myns:MyFeature>
         <gml:boundedBy> ... <gml:boundedBy>
         <myns:geomProperty>
           <gml:Polygon> ... </gml:Polygon>
         <t;/myns:geomProperty>
         <myns:customProperty>customValue</myns:customProperty>
       </myns:MyFeature>
     </gml:featureMember>
   </gml:FeatureCollection>
 
The corresponding decoded model can be accessed in three different ways:
  • via the com.luciad.format.gml3.model domain model interface, to explore the original GML content:
     ILcdGML3FeatureCollection (gml:FeatureCollection)
       |
       +-- ILcdGML3BoundingShape (gml:boundedBy)
       |
       +-- ILcdGML3FeatureProperty (gml:featureMember)
           |
           +-- ILcdGML3AbstractFeature/ILcdXMLElement (myns:MyFeature)
               |
               +-- ILcdGML3BoundingShape (gml:boundedBy)
               |
               +-- ILcdGML3SurfaceProperty (myns:geomProperty)
                   |
                   +-- ILcdGML3Polygon (gml:Polygon)
     
  • via common LuciadLightspeed model and shape interfaces, to use the data within other LuciadLightspeed components. Note that not all GML contents are available via this interface:
     ILcd(2DBoundsIndexed)Model (gml:FeatureCollection)
       |
       +-- ILcdBounded/ILcdXMLElement (myns:MyFeature)
           |
           +--  ILcdGML3SurfaceProperty (myns:geomProperty)
                |
                +-- ILcdPolygon (gml:Polygon)
    
     
  • or via the ILcdXMLElement interface, to access the complete XML structure of the document, including namespaces:
     ILcdXMLElement (gml:FeatureCollection)
       |
       +-- ILcdXMLElement (gml:boundedBy)
       |
       +-- ILcdXMLElement (gml:featureMember)
           |
           +-- ILcdXMLElement (myns:MyFeature)
               |
               +-- ILcdXMLElement (gml:boundedBy)
               |
               +-- ILcdXMLElement (myns:geomProperty)
               |   |
               |   +-- ILcdXMLElement (gml:Polygon)
               |
               +-- ILcdXMLElement (myns:customProperty)
     
Custom-defined XML data is handled as follows:
  • All domain model implementations generated by this decoder shall implement the ILcdXMLElement interface. All child elements of an element will be available via this interface, both standard GML elements that are also available via GML domain model interfaces, and custom-defined elements that were added.
  • All custom XML elements, or standard GML elements for which no handler and/or domain model interface are available, are decoded using a standard XML handler, and put into an ILcdXMLElement object.

E.g., the myns:MyFeature element extends the gml:AbstractGMLFeature type, and adds a new element, myns:geomProperty. This property cannot be accessed via the ILcdGML3AbstractFeature interface, but can be reached via the ILcdXMLElement interface of the feature.
The myns:customProperty is a custom defined element for which no handler is available. It will be decoded using the default XML handler, put into a ILcdXMLElement object, and will be available in the model through the ILcdXMLElement interface of its parent element.

The ILcdXMLElement interface is the only interface through which the original document's content is always fully reachable, while the other two interfaces offer only limited views on the document for specific purposes, related to GML or LuciadLightspeed.

For more information about the default implementations of the GML domain model, see the default GML object factory's documentation.

  • Field Details

  • Constructor Details

    • TLcdGML3ModelDecoder

      public TLcdGML3ModelDecoder()
      Deprecated.
      Creates a new GML3 model decoder, initialized with appropriate GML element reader and object factory providers, and schema locations.
    • TLcdGML3ModelDecoder

      public TLcdGML3ModelDecoder(ILcdXMLSchemaProvider aSchemaProvider)
      Deprecated.
      Creates a new GML3 model decoder, initialized with appropriate GML element reader and object factory providers, and schema locations. The given schema provider will be used for the decoding of schemas. If the given schema provider doesn't contain all schemas that can be expected in the application, it can use the ILcdXMLSchemaLocationsMap provided by this decoder to retrieve additional locations declared in the XML documents.
      Parameters:
      aSchemaProvider - the schema provider to use.
  • Method Details

    • setInputStreamFactory

      public void setInputStreamFactory(ILcdInputStreamFactory aInputStreamFactory)
      Deprecated.
      Sets the ILcdInputStreamFactory to be used by this model decoder.
      Specified by:
      setInputStreamFactory in interface ILcdInputStreamFactoryCapable
      Parameters:
      aInputStreamFactory - the input stream factory to be used by this model decoder.
      Throws:
      NullPointerException - if aInputStreamFactory == null.
    • getInputStreamFactory

      public ILcdInputStreamFactory getInputStreamFactory()
      Deprecated.
      Returns the ILcdInputStreamFactory that is used by this model decoder.
      Specified by:
      getInputStreamFactory in interface ILcdInputStreamFactoryCapable
      Returns:
      the ILcdInputStreamFactory that is used by this model decoder.
    • setSchemaLocationsMap

      public void setSchemaLocationsMap(ILcdXMLSchemaLocationsMap aSchemaLocationsMap)
      Deprecated.
      Sets the schema locations map to be used by this decoder.
      Parameters:
      aSchemaLocationsMap - the schema locations map in which to store new locations.
      See Also:
    • getSchemaLocationsMap

      public ILcdXMLSchemaLocationsMap getSchemaLocationsMap()
      Deprecated.
      Returns the schema locations map used by this decoder.
      Returns:
      the schema locations map used by this decoder.
      See Also:
    • setPrefixMap

      public void setPrefixMap(ILcdXMLPrefixMap aPrefixMap)
      Deprecated.
      Sets the prefix map to be used by this decoder.
      Parameters:
      aPrefixMap - the prefix map to be used by this decoder.
      See Also:
    • getPrefixMap

      public ILcdXMLPrefixMap getPrefixMap()
      Deprecated.
      Returns the prefix map that is used by this decoder.
      Returns:
      the prefix map that is used by this decoder.
      See Also:
    • getObjectFactoryProvider

      public ILcdXMLObjectFactoryProvider getObjectFactoryProvider()
      Deprecated.
      Returns the ILcdXMLObjectFactoryProvider that is used by this decoder.
      Returns:
      the ILcdXMLObjectFactoryProvider that is used by this decoder.
    • getElementReaderProvider

      public ILcdXMLTypedElementReaderProvider getElementReaderProvider()
      Deprecated.
      Returns the ILcdXMLTypedElementReaderProvider that is used by this decoder.
      Returns:
      the ILcdXMLTypedElementReaderProvider that is used by this decoder.
    • getSchemaProvider

      public ILcdXMLSchemaProvider getSchemaProvider()
      Deprecated.
      Returns the ILcdXMLSchemaProvider that is used by this decoder.
      Returns:
      the ILcdXMLSchemaProvider that is used by this decoder.
    • registerFactory

      public void registerFactory(TLcdXMLName aTypeName, ILcdXMLObjectFactory aTypeFactory)
      Deprecated.
      Registers an object factory for the given typename.
      Parameters:
      aTypeName - the typename for which to register the given object factory.
      aTypeFactory - the object factory to be registered.
    • registerReader

      public void registerReader(TLcdXMLName aTypeName, ILcdXMLElementReader aReader)
      Deprecated.
      Registers an element reader for the given typename.
      Parameters:
      aTypeName - the typename for which to register the given element reader.
      aReader - the element reader to be registered.
    • registerReader

      public void registerReader(TLcdXMLName aTypeName, TLcdXMLName[] aElementNameStack, ILcdXMLElementReader aReader)
      Deprecated.
      Registers the given reader for the anonymous XML type, identified by the given element name stack, and, if the element name stack is contained within a named type, the name of that type.
      Parameters:
      aTypeName - The XML type name from which the specified element name stack is part of.
      aElementNameStack - The element name stack, identifying the XML type within the provided XML type.
      aReader - A reader to process the given element.
      Throws:
      NullPointerException - if aReader == null.
    • getDisplayName

      public String getDisplayName()
      Deprecated.
      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 aSourceAsString)
      Deprecated.
      Description copied from interface: ILcdModelDecoder
      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.

      Specified by:
      canDecodeSource in interface ILcdModelDecoder
      Parameters:
      aSourceAsString - 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
      Deprecated.
      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: