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
.@Deprecated public class TLcdGML3ModelDecoder extends Object implements ILcdModelDecoder, ILcdInputStreamFactoryCapable
ILcdXMLElement
objects.
TLcdEPSGReferenceParser
class, and
<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:
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)
ILcd(2DBoundsIndexed)Model (gml:FeatureCollection) | +-- ILcdBounded/ILcdXMLElement (myns:MyFeature) | +-- ILcdGML3SurfaceProperty (myns:geomProperty) | +-- ILcdPolygon (gml:Polygon)
ILcdXMLElement (gml:FeatureCollection) | +-- ILcdXMLElement (gml:boundedBy) | +-- ILcdXMLElement (gml:featureMember) | +-- ILcdXMLElement (myns:MyFeature) | +-- ILcdXMLElement (gml:boundedBy) | +-- ILcdXMLElement (myns:geomProperty) | | | +-- ILcdXMLElement (gml:Polygon) | +-- ILcdXMLElement (myns:customProperty)
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.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.
Modifier and Type | Field and Description |
---|---|
static String |
GML_32_NAMESPACE_URI
Deprecated.
|
static String |
GML_NAMESPACE_URI
Deprecated.
|
Constructor and Description |
---|
TLcdGML3ModelDecoder()
Deprecated.
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.
|
Modifier and Type | Method and Description |
---|---|
boolean |
canDecodeSource(String aSourceAsString)
Deprecated.
Checks whether this model decoder can decode the specified data source.
|
ILcdModel |
decode(String aSourceName)
Deprecated.
Creates a new model from the given data source.
|
String |
getDisplayName()
Deprecated.
Returns a short, displayable name for the format that is decoded by this
ILcdModelDecoder . |
ILcdXMLTypedElementReaderProvider |
getElementReaderProvider()
Deprecated.
Returns the
ILcdXMLTypedElementReaderProvider that is used by this decoder. |
ILcdInputStreamFactory |
getInputStreamFactory()
Deprecated.
Returns the
ILcdInputStreamFactory that is used by this model decoder. |
ILcdXMLObjectFactoryProvider |
getObjectFactoryProvider()
Deprecated.
Returns the
ILcdXMLObjectFactoryProvider that is used by this decoder. |
ILcdXMLPrefixMap |
getPrefixMap()
Deprecated.
Returns the prefix map that is used by this decoder.
|
ILcdXMLSchemaLocationsMap |
getSchemaLocationsMap()
Deprecated.
Returns the schema locations map used by this decoder.
|
ILcdXMLSchemaProvider |
getSchemaProvider()
Deprecated.
Returns the
ILcdXMLSchemaProvider 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 the
ILcdInputStreamFactory 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.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
canDecodeSource, decodeModelMetadata, decodeModelMetadata, decodeSource, discoverDataSources
public static final String GML_NAMESPACE_URI
public static final String GML_32_NAMESPACE_URI
public TLcdGML3ModelDecoder()
public TLcdGML3ModelDecoder(ILcdXMLSchemaProvider aSchemaProvider)
ILcdXMLSchemaLocationsMap
provided by this decoder to retrieve additional locations declared in the XML documents.aSchemaProvider
- the schema provider to use.public void setInputStreamFactory(ILcdInputStreamFactory aInputStreamFactory)
ILcdInputStreamFactory
to be used by this model decoder.setInputStreamFactory
in interface ILcdInputStreamFactoryCapable
aInputStreamFactory
- the input stream factory to be used by this model decoder.NullPointerException
- if aInputStreamFactory == null
.public ILcdInputStreamFactory getInputStreamFactory()
ILcdInputStreamFactory
that is used by this model decoder.getInputStreamFactory
in interface ILcdInputStreamFactoryCapable
ILcdInputStreamFactory
that is used by this model decoder.public void setSchemaLocationsMap(ILcdXMLSchemaLocationsMap aSchemaLocationsMap)
aSchemaLocationsMap
- the schema locations map in which to store new locations.TLcdXMLDecoder.setSchemaLocationsMap(com.luciad.format.xml.schema.ILcdXMLSchemaLocationsMap)
public ILcdXMLSchemaLocationsMap getSchemaLocationsMap()
setSchemaLocationsMap(com.luciad.format.xml.schema.ILcdXMLSchemaLocationsMap)
public void setPrefixMap(ILcdXMLPrefixMap aPrefixMap)
aPrefixMap
- the prefix map to be used by this decoder.TLcdXMLDecoder.setPrefixMap(com.luciad.format.xml.ILcdXMLPrefixMap)
public ILcdXMLPrefixMap getPrefixMap()
setPrefixMap(com.luciad.format.xml.ILcdXMLPrefixMap)
public ILcdXMLObjectFactoryProvider getObjectFactoryProvider()
ILcdXMLObjectFactoryProvider
that is used by this decoder.ILcdXMLObjectFactoryProvider
that is used by this decoder.public ILcdXMLTypedElementReaderProvider getElementReaderProvider()
ILcdXMLTypedElementReaderProvider
that is used by this decoder.ILcdXMLTypedElementReaderProvider
that is used by this decoder.public ILcdXMLSchemaProvider getSchemaProvider()
ILcdXMLSchemaProvider
that is used by this decoder.ILcdXMLSchemaProvider
that is used by this decoder.public void registerFactory(TLcdXMLName aTypeName, ILcdXMLObjectFactory aTypeFactory)
aTypeName
- the typename for which to register the given object factory.aTypeFactory
- the object factory to be registered.public void registerReader(TLcdXMLName aTypeName, ILcdXMLElementReader aReader)
aTypeName
- the typename for which to register the given element reader.aReader
- the element reader to be registered.public void registerReader(TLcdXMLName aTypeName, TLcdXMLName[] aElementNameStack, ILcdXMLElementReader aReader)
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.NullPointerException
- if aReader == null
.public String getDisplayName()
ILcdModelDecoder
ILcdModelDecoder
.getDisplayName
in interface ILcdModelDecoder
ILcdModelDecoder
.public boolean canDecodeSource(String aSourceAsString)
ILcdModelDecoder
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.
canDecodeSource
in interface ILcdModelDecoder
aSourceAsString
- the data source to be verified; typically a file name or a URL.true
if this decoder can likely decode the data specified by the source name, false
otherwise.ILcdModelDecoder.decode(String)
,
ILcdModelDecoder.decodeModelMetadata(String)
public ILcdModel decode(String aSourceName) throws IOException
ILcdModelDecoder
decode
in interface ILcdModelDecoder
aSourceName
- the data source to be decoded; typically a file name or a URL.null
is allowed, implementors are advised to throw an error instead.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);
}
}
InterruptedIOException
- When the thread on which this method is called is interrupted: it is recommended to stop the decoding
and throw an InterruptedIOException
.
This same exception can also be used if the decoder shows UI to the user, and the user cancels the decoding
through the UI.ILcdModelDecoder.canDecodeSource(String)