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
ILcdInputStreamFactoryof 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
ILcdShapeandILcdDataObject - NVG 2.0 models contain either shapes (e.g. TLcdNVG20Circle),
text,groupsandcomposites, orsymbolized content - NVG 1.4/1.5 models contain either shapes (e.g. TLcdNVG15Circle).
text,groupsandanchors, 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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancanDecodeSource(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.EntityResolver2that is used for creating input sources for XSD schemas.Get the input stream factory of this NVG model decoder.Returns thejavax.xml.stream.XMLInputFactorythat is used by this decoder for creatingjavax.xml.stream.XMLStreamReaderinstances.booleanReturns if application schemas are cached.voidsetEntityResolver(EntityResolver2 aEntityResolver) Sets theorg.xml.sax.ext.EntityResolver2to be used for creating input sources for XSD schemas.voidsetInputStreamFactory(ILcdInputStreamFactory aInputStreamFactory) Set the input stream factory to this NVG model decoder.voidsetUseApplicationSchemaCache(boolean aUseCache) Enables or disables application schema caching depending on the parameter value.voidsetXMLInputFactory(XMLInputFactory aXMLInputFactory) Sets thejavax.xml.stream.XMLInputFactoryto be used by this decoder for creatingjavax.xml.stream.XMLStreamReaderinstances.Methods inherited from class com.luciad.format.xml.bind.schema.ALcdXMLModelDecoder
decodeMethods 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
-
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 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.
- Parameters:
aSourceName- 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
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
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:
-
setInputStreamFactory
Set the input stream factory to this NVG model decoder.- Specified by:
setInputStreamFactoryin interfaceILcdInputStreamFactoryCapable- Specified by:
setInputStreamFactoryin classALcdXMLModelDecoder- Parameters:
aInputStreamFactory- The input stream factory to set to this decoder.- See Also:
-
getXMLInputFactory
Description copied from class:ALcdXMLModelDecoderReturns thejavax.xml.stream.XMLInputFactorythat is used by this decoder for creatingjavax.xml.stream.XMLStreamReaderinstances.- Specified by:
getXMLInputFactoryin classALcdXMLModelDecoder- Returns:
- the
javax.xml.stream.XMLInputFactorythat is used by this decoder for creatingjavax.xml.stream.XMLStreamReaderinstances.
-
setXMLInputFactory
Description copied from class:ALcdXMLModelDecoderSets thejavax.xml.stream.XMLInputFactoryto be used by this decoder for creatingjavax.xml.stream.XMLStreamReaderinstances.- Specified by:
setXMLInputFactoryin classALcdXMLModelDecoder- Parameters:
aXMLInputFactory- thejavax.xml.stream.XMLInputFactoryto be used by this decoder for creatingjavax.xml.stream.XMLStreamReaderinstances.
-
getEntityResolver
Description copied from class:ALcdXMLModelDecoderReturns theorg.xml.sax.ext.EntityResolver2that 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:
getEntityResolverin classALcdXMLModelDecoder- Returns:
- the entity resolver to be used for creating input sources for XSD schemas.
-
setEntityResolver
Description copied from class:ALcdXMLModelDecoderSets the
org.xml.sax.ext.EntityResolver2to be used for creating input sources for XSD schemas.When the entity resolver is unable to find a schema (i.e. the
resolveEntitymethod returnsnull), theALcdXMLModelDecoder.getInputStreamFactory()is used to create an appropriate input stream for the given system id of the schema.- Specified by:
setEntityResolverin classALcdXMLModelDecoder- Parameters:
aEntityResolver- the entity resolver to be used for creating input sources for XSD schemas.
-
isUseApplicationSchemaCache
public boolean isUseApplicationSchemaCache()Description copied from class:ALcdXMLModelDecoderReturns 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:
isUseApplicationSchemaCachein classALcdXMLModelDecoder- Returns:
- if application schemas are cached
-
setUseApplicationSchemaCache
public void setUseApplicationSchemaCache(boolean aUseCache) Description copied from class:ALcdXMLModelDecoderEnables or disables application schema caching depending on the parameter value.- Specified by:
setUseApplicationSchemaCachein 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:
getInputStreamFactoryin interfaceILcdInputStreamFactoryCapable- Specified by:
getInputStreamFactoryin classALcdXMLModelDecoder- Returns:
- The input stream factory of this decoder.
- See Also:
-