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.
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.
- 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.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)
- 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 Summary
-
Constructor Summary
ConstructorDescriptionDeprecated.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 TypeMethodDescriptionboolean
canDecodeSource
(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 theILcdXMLTypedElementReaderProvider
that is used by this decoder.Deprecated.Returns theILcdInputStreamFactory
that is used by this model decoder.Deprecated.Returns theILcdXMLObjectFactoryProvider
that 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 theILcdXMLSchemaProvider
that is used by this decoder.void
registerFactory
(TLcdXMLName aTypeName, ILcdXMLObjectFactory aTypeFactory) Deprecated.Registers an object factory for the given typename.void
registerReader
(TLcdXMLName aTypeName, ILcdXMLElementReader aReader) Deprecated.Registers an element reader for the given typename.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.void
setInputStreamFactory
(ILcdInputStreamFactory aInputStreamFactory) Deprecated.Sets theILcdInputStreamFactory
to be used by this model decoder.void
setPrefixMap
(ILcdXMLPrefixMap aPrefixMap) Deprecated.Sets the prefix map to be used by this decoder.void
setSchemaLocationsMap
(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, wait
Methods 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 theILcdXMLSchemaLocationsMap
provided by this decoder to retrieve additional locations declared in the XML documents.- Parameters:
aSchemaProvider
- the schema provider to use.
-
-
Method Details
-
setInputStreamFactory
Deprecated.Sets theILcdInputStreamFactory
to be used by this model decoder.- Specified by:
setInputStreamFactory
in interfaceILcdInputStreamFactoryCapable
- Parameters:
aInputStreamFactory
- the input stream factory to be used by this model decoder.- Throws:
NullPointerException
- ifaInputStreamFactory == null
.
-
getInputStreamFactory
Deprecated.Returns theILcdInputStreamFactory
that is used by this model decoder.- Specified by:
getInputStreamFactory
in interfaceILcdInputStreamFactoryCapable
- Returns:
- the
ILcdInputStreamFactory
that 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 theILcdXMLObjectFactoryProvider
that is used by this decoder.- Returns:
- the
ILcdXMLObjectFactoryProvider
that is used by this decoder.
-
getElementReaderProvider
Deprecated.Returns theILcdXMLTypedElementReaderProvider
that is used by this decoder.- Returns:
- the
ILcdXMLTypedElementReaderProvider
that is used by this decoder.
-
getSchemaProvider
Deprecated.Returns theILcdXMLSchemaProvider
that is used by this decoder.- Returns:
- the
ILcdXMLSchemaProvider
that 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: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
Deprecated.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:
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
Deprecated.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:
-
com.luciad.format.gml3.*
packages are replaced by new decoders and encoders in the packagescom.luciad.format.gml2.xml
,com.luciad.format.gml31.xml
andcom.luciad.format.gml32.xml
.