Class TLcdGML3ModelDecoder
- All Implemented Interfaces:
ILcdInputStreamFactoryCapable,ILcdModelDecoder
- 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.
ILcdXMLElementobjects. - 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
TLcdEPSGReferenceParserclass, and - the following reference systems, using the URN's (Uniform Resource Names), defined by the OGC: WGS84, NAD83 and NAD27.
- All EPSG reference systems, supported by the
<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.modeldomain 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)
- All domain model implementations generated by this decoder shall implement the
ILcdXMLElementinterface. 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
ILcdXMLElementobject.
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 Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionDeprecated.Creates a new GML3 model decoder, initialized with appropriate GML element reader and object factory providers, and schema locations.TLcdGML3ModelDecoder(ILcdXMLSchemaProvider aSchemaProvider) Deprecated.Creates a new GML3 model decoder, initialized with appropriate GML element reader and object factory providers, and schema locations. -
Method Summary
Modifier and TypeMethodDescriptionbooleancanDecodeSource(String aSourceAsString) Deprecated.Checks whether this model decoder can decode the specified data source.Deprecated.Creates a new model from the given data source.Deprecated.Returns a short, displayable name for the format that is decoded by thisILcdModelDecoder.Deprecated.Returns theILcdXMLTypedElementReaderProviderthat is used by this decoder.Deprecated.Returns theILcdInputStreamFactorythat is used by this model decoder.Deprecated.Returns theILcdXMLObjectFactoryProviderthat is used by this decoder.Deprecated.Returns the prefix map that is used by this decoder.Deprecated.Returns the schema locations map used by this decoder.Deprecated.Returns theILcdXMLSchemaProviderthat is used by this decoder.voidregisterFactory(TLcdXMLName aTypeName, ILcdXMLObjectFactory aTypeFactory) Deprecated.Registers an object factory for the given typename.voidregisterReader(TLcdXMLName aTypeName, ILcdXMLElementReader aReader) Deprecated.Registers an element reader for the given typename.voidregisterReader(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.voidsetInputStreamFactory(ILcdInputStreamFactory aInputStreamFactory) Deprecated.Sets theILcdInputStreamFactoryto be used by this model decoder.voidsetPrefixMap(ILcdXMLPrefixMap aPrefixMap) Deprecated.Sets the prefix map to be used by this decoder.voidsetSchemaLocationsMap(ILcdXMLSchemaLocationsMap aSchemaLocationsMap) Deprecated.Sets the schema locations map to be used by this decoder.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.luciad.model.ILcdModelDecoder
canDecodeSource, decodeModelMetadata, decodeModelMetadata, decodeSource, discoverDataSources
-
Field Details
-
GML_NAMESPACE_URI
Deprecated.- See Also:
-
GML_32_NAMESPACE_URI
Deprecated.- See Also:
-
-
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
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 theILcdXMLSchemaLocationsMapprovided by this decoder to retrieve additional locations declared in the XML documents.- Parameters:
aSchemaProvider- the schema provider to use.
-
-
Method Details
-
setInputStreamFactory
Deprecated.Sets theILcdInputStreamFactoryto be used by this model decoder.- Specified by:
setInputStreamFactoryin interfaceILcdInputStreamFactoryCapable- Parameters:
aInputStreamFactory- the input stream factory to be used by this model decoder.- Throws:
NullPointerException- ifaInputStreamFactory == null.
-
getInputStreamFactory
Deprecated.Returns theILcdInputStreamFactorythat is used by this model decoder.- Specified by:
getInputStreamFactoryin interfaceILcdInputStreamFactoryCapable- Returns:
- the
ILcdInputStreamFactorythat is used by this model decoder.
-
setSchemaLocationsMap
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
Deprecated.Returns the schema locations map used by this decoder.- Returns:
- the schema locations map used by this decoder.
- See Also:
-
setPrefixMap
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
Deprecated.Returns the prefix map that is used by this decoder.- Returns:
- the prefix map that is used by this decoder.
- See Also:
-
getObjectFactoryProvider
Deprecated.Returns theILcdXMLObjectFactoryProviderthat is used by this decoder.- Returns:
- the
ILcdXMLObjectFactoryProviderthat is used by this decoder.
-
getElementReaderProvider
Deprecated.Returns theILcdXMLTypedElementReaderProviderthat is used by this decoder.- Returns:
- the
ILcdXMLTypedElementReaderProviderthat is used by this decoder.
-
getSchemaProvider
Deprecated.Returns theILcdXMLSchemaProviderthat is used by this decoder.- Returns:
- the
ILcdXMLSchemaProviderthat is used by this decoder.
-
registerFactory
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
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- ifaReader == null.
-
getDisplayName
Deprecated.Description copied from interface:ILcdModelDecoderReturns a short, displayable name for the format that is decoded by thisILcdModelDecoder.- Specified by:
getDisplayNamein interfaceILcdModelDecoder- Returns:
- the displayable name of this
ILcdModelDecoder.
-
canDecodeSource
Deprecated.Description copied from interface:ILcdModelDecoderChecks whether this model decoder can decode the specified data source. It is acceptable for this method to returntruefor a source name whiledecodethrows 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:
canDecodeSourcein interfaceILcdModelDecoder- Parameters:
aSourceAsString- the data source to be verified; typically a file name or a URL.- Returns:
trueif this decoder can likely decode the data specified by the source name,falseotherwise.- See Also:
-
decode
Deprecated.Description copied from interface:ILcdModelDecoderCreates a new model from the given data source.- Specified by:
decodein interfaceILcdModelDecoder- Parameters:
aSourceName- the data source to be decoded; typically a file name or a URL.- Returns:
- A model containing the decoded data. While
nullis 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:
-
com.luciad.format.gml3.*packages are replaced by new decoders and encoders in the packagescom.luciad.format.gml2.xml,com.luciad.format.gml31.xmlandcom.luciad.format.gml32.xml.