Class TLcdMGCPModelDecoder

java.lang.Object
com.luciad.format.mgcp.TLcdMGCPModelDecoder
All Implemented Interfaces:
ILcdModelDecoder, ILcdStatusSource

@LcdService(service=ILcdModelDecoder.class, priority=20000) public final class TLcdMGCPModelDecoder extends Object implements ILcdModelDecoder, ILcdStatusSource
This model decoder decodes MGCP. MGCP is a multinational program to collect geospatial data worldwide. MGCP data is vector data describing features in a 1x1 degree cell, exchanged using the ESRI Shapefile specification. Each Shapefile (+ according database file) contains features of a single type and geometry. There is an overall metadata file (*.xml) linking all shp files for the cell, but also describing general things like the character encoding used for labels. We also support a .zip file containing both the metadata file (*.xml) and the shapefiles. Note that for large datasets we advise to unzip the data first even though .zip files are supported.

Input

File Required Entry point Description
*.zip x x A .zip file containing both the metadata file (*.xml) and the shapefiles.
*.xml x x An xml-file with top level MGCP_Cell tag, containing references to SHP files according to the MGCP Data Packaging (TRD4 v4.5 20190208) specs.
*.shp x The SHP-files, referenced by the xml, containing shapes for a single MGCP feature.

Supported transfer protocols

  • This model decoder supports only direct file access.

Model structure

Model descriptor

Model reference

  • This model decoder retrieves its model references from the xml-file.

Model elements

  • This model decoder creates a model containing ILcdDataObjects.
  • Domain objects can have different data types, each based on the data type of the delegate shp file.

Sample code

    ILcdModelDecoder decoder = new TLcdMGCPModelDecoder();
    ILcdModel model = decoder.decode("file.xml");

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

Since:
2020.0
  • Field Details

  • Constructor Details

    • TLcdMGCPModelDecoder

      public TLcdMGCPModelDecoder()
  • Method Details

    • getDisplayName

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

      public boolean canDecodeSource(String aSourceName)
      Description copied from interface: ILcdModelDecoder
      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.

      Specified by:
      canDecodeSource in interface ILcdModelDecoder
      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
      Description copied from interface: ILcdModelDecoder
      Creates a new model from the given data source.
      Specified by:
      decode in interface ILcdModelDecoder
      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:
    • decodeModelMetadata

      public TLcdModelMetadata decodeModelMetadata(String aSourceName) throws IOException
      Description copied from interface: ILcdModelDecoder
      Decodes metadata for the specified data source. By default, this decodes the model and returns the model metadata found on that model. Implementations can override this method to speed up the retrieval.
      Specified by:
      decodeModelMetadata in interface ILcdModelDecoder
      Parameters:
      aSourceName - the data source to be decoded; typically a file name or a URL.
      Returns:
      the model metadata for the data source, never null.
      Throws:
      IOException - if the metadata cannot be decoded for some reason.
      See Also:
    • addStatusListener

      public void addStatusListener(ILcdStatusListener aListener)
      Description copied from interface: ILcdStatusSource

      Registers the given listener so it will receive status events from this source.

      In case you need to register a listener which keeps a reference to an object with a shorter life-time than this status source, you can use a ALcdWeakStatusListener instance as status listener.

      Specified by:
      addStatusListener in interface ILcdStatusSource
      Parameters:
      aListener - The listener to be notified when the status has changed.
    • removeStatusListener

      public void removeStatusListener(ILcdStatusListener aListener)
      Description copied from interface: ILcdStatusSource
      Removes the specified listener so it is no longer notified.
      Specified by:
      removeStatusListener in interface ILcdStatusSource
      Parameters:
      aListener - The listener to remove.