Class TLcdNVGModelDecoder
- All Implemented Interfaces:
ILcdInputStreamFactoryCapable
,ILcdModelDecoder
Input files
File | Required | Entry point | Description |
---|---|---|---|
*.xml, *.nvg | x | x |
NVG XML file |
Supported file transfer protocols
- This model decoder supports all transfer protocols that are supported by
the
ILcdInputStreamFactory
of this decoder.
Model structure
- This model decoder creates a model per file.
- All models returned by this model decoder implement
ILcd2DBoundsIndexedModel
. - NVG 1.4/1.5 models extend
TLcdNVG15Model
- NVG 2.0 models extend
TLcdNVG20FilteredModel
. This model wrapper provides a time-filtered view on theoriginal data
, which extendsTLcdNVG20Model
Model descriptor
- All models returned by this model decoder have a
TLcdNVGModelDescriptor
. - NVG 1.4/1.5 models have a
TLcdNVG15ModelDescriptor
- NVG 2.0 models have a
TLcdNVG20ModelDescriptor
Model reference
- All models returned by this model decoder have a default
WGS 84 georeference
Model elements
- Each decoded model contains elements that implement
ILcdShape
andILcdDataObject
- NVG 2.0 models contain either shapes (e.g. TLcdNVG20Circle),
text
,groups
andcomposites
, orsymbolized content
- NVG 1.4/1.5 models contain either shapes (e.g. TLcdNVG15Circle).
text
,groups
andanchors
, ordata objects
Sample code
// decode the model
TLcdNVGModelDecoder decoder = new TLcdNVGModelDecoder();
TLcdNVG20FilteredModel model = (TLcdNVG20FilteredModel)decoder.decode("nvg20file.xml");
// update the model to only expose elements of the given date
model.setDate(aDate);
// access all model elements, regardless of the date
TLcdNVG20Model modelWithAllElements = model.getUnfilteredModel()
Thread safety
- The decoding of models is thread-safe, as long as no properties are changed during the decoding.
- The decoded models are thread-safe for read access.
Supported versions and specifications
- NATO Vector Graphics Data Format 1.4
- NATO Vector Graphics Data Format 1.5
- NATO Vector Graphics Data Format 2.0
Known limitations
This decoder does not deal with the NATO Vector Graphics (NVG) Protocol web service.- Since:
- 2015.0
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
canDecodeSource
(String aSourceName) Checks whether this model decoder can decode the specified data source.Creates a new model from the given data source.Returns a short, displayable name for the format that is decoded by thisILcdModelDecoder
.Returns theorg.xml.sax.ext.EntityResolver2
that is used for creating input sources for XSD schemas.Get the input stream factory of this NVG model decoder.Returns thejavax.xml.stream.XMLInputFactory
that is used by this decoder for creatingjavax.xml.stream.XMLStreamReader
instances.boolean
Returns if application schemas are cached.void
setEntityResolver
(EntityResolver2 aEntityResolver) Sets theorg.xml.sax.ext.EntityResolver2
to be used for creating input sources for XSD schemas.void
setInputStreamFactory
(ILcdInputStreamFactory aInputStreamFactory) Set the input stream factory to this NVG model decoder.void
setUseApplicationSchemaCache
(boolean aUseCache) Enables or disables application schema caching depending on the parameter value.void
setXMLInputFactory
(XMLInputFactory aXMLInputFactory) Sets thejavax.xml.stream.XMLInputFactory
to be used by this decoder for creatingjavax.xml.stream.XMLStreamReader
instances.Methods inherited from class com.luciad.format.xml.bind.schema.ALcdXMLModelDecoder
decode
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
-
Constructor Details
-
TLcdNVGModelDecoder
public TLcdNVGModelDecoder()Creates a newTLcdNVGModelDecoder
, ready to use.
-
-
Method Details
-
getDisplayName
Returns a short, displayable name for the format that is decoded by thisILcdModelDecoder
.- Returns:
- the displayable name of this
ILcdModelDecoder
.
-
canDecodeSource
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.
- 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
Creates a new model from the given data source.- 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:
-
setInputStreamFactory
Set the input stream factory to this NVG model decoder.- Specified by:
setInputStreamFactory
in interfaceILcdInputStreamFactoryCapable
- Specified by:
setInputStreamFactory
in classALcdXMLModelDecoder
- Parameters:
aInputStreamFactory
- The input stream factory to set to this decoder.- See Also:
-
getXMLInputFactory
Description copied from class:ALcdXMLModelDecoder
Returns thejavax.xml.stream.XMLInputFactory
that is used by this decoder for creatingjavax.xml.stream.XMLStreamReader
instances.- Specified by:
getXMLInputFactory
in classALcdXMLModelDecoder
- Returns:
- the
javax.xml.stream.XMLInputFactory
that is used by this decoder for creatingjavax.xml.stream.XMLStreamReader
instances.
-
setXMLInputFactory
Description copied from class:ALcdXMLModelDecoder
Sets thejavax.xml.stream.XMLInputFactory
to be used by this decoder for creatingjavax.xml.stream.XMLStreamReader
instances.- Specified by:
setXMLInputFactory
in classALcdXMLModelDecoder
- Parameters:
aXMLInputFactory
- thejavax.xml.stream.XMLInputFactory
to be used by this decoder for creatingjavax.xml.stream.XMLStreamReader
instances.
-
getEntityResolver
Description copied from class:ALcdXMLModelDecoder
Returns theorg.xml.sax.ext.EntityResolver2
that is used for creating input sources for XSD schemas. This entity resolver will only be used to resolve extension schemas that are not already configured on this decoder.- Specified by:
getEntityResolver
in classALcdXMLModelDecoder
- Returns:
- the entity resolver to be used for creating input sources for XSD schemas.
-
setEntityResolver
Description copied from class:ALcdXMLModelDecoder
Sets the
org.xml.sax.ext.EntityResolver2
to be used for creating input sources for XSD schemas.When the entity resolver is unable to find a schema (i.e. the
resolveEntity
method returnsnull
), theALcdXMLModelDecoder.getInputStreamFactory()
is used to create an appropriate input stream for the given system id of the schema.- Specified by:
setEntityResolver
in classALcdXMLModelDecoder
- Parameters:
aEntityResolver
- the entity resolver to be used for creating input sources for XSD schemas.
-
isUseApplicationSchemaCache
public boolean isUseApplicationSchemaCache()Description copied from class:ALcdXMLModelDecoder
Returns if application schemas are cached. When application schemas are cached, the decoder caches all applications schemas it encounters. When a certain schema is referenced during decoding, only if the schema is not found in the cache, it will be resolved. The default is not to cache.
Note that in case multiple application schemas use the same namespace URI, it is not possible to turn on application schema caching because the decoder will not be able to discern between the different schemas.
- Specified by:
isUseApplicationSchemaCache
in classALcdXMLModelDecoder
- Returns:
- if application schemas are cached
-
setUseApplicationSchemaCache
public void setUseApplicationSchemaCache(boolean aUseCache) Description copied from class:ALcdXMLModelDecoder
Enables or disables application schema caching depending on the parameter value.- Specified by:
setUseApplicationSchemaCache
in classALcdXMLModelDecoder
- Parameters:
aUseCache
- if true, application schema caching is turned on. If false, caching is turned off.
-
getInputStreamFactory
Get the input stream factory of this NVG model decoder.- Specified by:
getInputStreamFactory
in interfaceILcdInputStreamFactoryCapable
- Specified by:
getInputStreamFactory
in classALcdXMLModelDecoder
- Returns:
- The input stream factory of this decoder.
- See Also:
-