Class TLcdNVGModelDecoder

java.lang.Object
com.luciad.format.xml.bind.schema.ALcdXMLModelDecoder
com.luciad.format.nvg.xml.TLcdNVGModelDecoder
All Implemented Interfaces:
ILcdInputStreamFactoryCapable, ILcdModelDecoder

@LcdService(service=ILcdModelDecoder.class, priority=20000) public class TLcdNVGModelDecoder extends ALcdXMLModelDecoder
Model decoder for Nato Vector Graphics that are encoded in XML. The decoder supports both NVG 1.4, 1.5 or 2.0.

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 the original data, which extends TLcdNVG20Model

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

Model elements

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
For more information, refer to the TIDE project (Technology for Information, Decision and Execution superiority).

Known limitations

This decoder does not deal with the NATO Vector Graphics (NVG) Protocol web service.
Since:
2015.0
  • Constructor Details

    • TLcdNVGModelDecoder

      public TLcdNVGModelDecoder()
      Creates a new TLcdNVGModelDecoder , ready to use.
  • Method Details

    • getDisplayName

      public String getDisplayName()
      Returns a short, displayable name for the format that is decoded by this ILcdModelDecoder.
      Returns:
      the displayable name of this ILcdModelDecoder.
    • canDecodeSource

      public boolean canDecodeSource(String aSourceName)
      Checks whether this model decoder can decode the specified data source. It is acceptable for this method to return 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.

      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

      public ILcdModel decode(String aSourceName) throws IOException
      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

      public void setInputStreamFactory(ILcdInputStreamFactory aInputStreamFactory)
      Set the input stream factory to this NVG model decoder.
      Specified by:
      setInputStreamFactory in interface ILcdInputStreamFactoryCapable
      Specified by:
      setInputStreamFactory in class ALcdXMLModelDecoder
      Parameters:
      aInputStreamFactory - The input stream factory to set to this decoder.
      See Also:
    • getXMLInputFactory

      public XMLInputFactory getXMLInputFactory()
      Description copied from class: ALcdXMLModelDecoder
      Returns the javax.xml.stream.XMLInputFactory that is used by this decoder for creating javax.xml.stream.XMLStreamReader instances.
      Specified by:
      getXMLInputFactory in class ALcdXMLModelDecoder
      Returns:
      the javax.xml.stream.XMLInputFactory that is used by this decoder for creating javax.xml.stream.XMLStreamReader instances.
    • setXMLInputFactory

      public void setXMLInputFactory(XMLInputFactory aXMLInputFactory)
      Description copied from class: ALcdXMLModelDecoder
      Sets the javax.xml.stream.XMLInputFactory to be used by this decoder for creating javax.xml.stream.XMLStreamReader instances.
      Specified by:
      setXMLInputFactory in class ALcdXMLModelDecoder
      Parameters:
      aXMLInputFactory - the javax.xml.stream.XMLInputFactory to be used by this decoder for creating javax.xml.stream.XMLStreamReader instances.
    • getEntityResolver

      public EntityResolver2 getEntityResolver()
      Description copied from class: ALcdXMLModelDecoder
      Returns the org.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 class ALcdXMLModelDecoder
      Returns:
      the entity resolver to be used for creating input sources for XSD schemas.
    • setEntityResolver

      public void setEntityResolver(EntityResolver2 aEntityResolver)
      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 returns null), the ALcdXMLModelDecoder.getInputStreamFactory() is used to create an appropriate input stream for the given system id of the schema.

      Specified by:
      setEntityResolver in class ALcdXMLModelDecoder
      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 class ALcdXMLModelDecoder
      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 class ALcdXMLModelDecoder
      Parameters:
      aUseCache - if true, application schema caching is turned on. If false, caching is turned off.
    • getInputStreamFactory

      public ILcdInputStreamFactory getInputStreamFactory()
      Get the input stream factory of this NVG model decoder.
      Specified by:
      getInputStreamFactory in interface ILcdInputStreamFactoryCapable
      Specified by:
      getInputStreamFactory in class ALcdXMLModelDecoder
      Returns:
      The input stream factory of this decoder.
      See Also: