Class TLcdS57DirectoryModelDecoder

java.lang.Object
com.luciad.format.s57.TLcdS57DirectoryModelDecoder
All Implemented Interfaces:
ILcdInputStreamFactoryCapable, ILcdModelDecoder

public class TLcdS57DirectoryModelDecoder extends Object implements ILcdModelDecoder, ILcdInputStreamFactoryCapable
Model decoder that can decode all ECDIS S-57 cells in a directory into an ILcdModel.

This model decoder can be used to decode sets of S-57 cells in case no catalogue (.031) file is available. Note however that, since there is no information available about the cell bounds (these are normally provided by the catalogue file), this decoder does not support on-the-fly loading.

Model information

Model organization

  • This model decoder creates a model list per ENC directory ('catalogue') that is decoded. Each catalogue model list on itself contains another list of model lists, one per level (=navigation purpose). Each of these level model lists contains a model per ENC cell in that level.
    
     TLcdModelList (catalogue) --> TLcdS57CatalogueModelDescriptor
       |
       +-- TLcdModelList (one for each level) --> TLcdS57LevelModelDescriptor
             |
             +-- ILcdModel (one for each ENC cell) --> TLcdS57ModelDescriptor
     
  • The individual ENC cells are decoded using the TLcdS57ModelDecoder. See the documentation of the TLcdS57ModelDecoder for more information on the structure of the individual cell models.

Model descriptor

  • All models returned by this model decoder have a TLcdS57CatalogueModelDescriptor.

Model types

  • All models returned by this model decoder implement ILcd2DBoundsIndexedModel, the catalogue and level model lists as well as the individual cell models.

Domain object types

  • See the documentation of TLcdS57ModelDecoder for more information on domain objects.

Data information

Entry point

  • The directory containing the S-57 cells is used as the entry point for the catalogue.

Required files

  • This decoder only requires S-57 cells, decodable by the TLcdS57ModelDecoder. A catalogue (.031) file is not needed.

Supported file transfer protocols

  • This model decoder supports any transfer protocol, supported by the ILcdInputStreamFactory that is set on this decoder.

Performance tips

  • When a catalogue is used, the presence of the M_COVR class can have a small impact on the rendering performance. See the performance tips of the TLcdS57ModelDecoder for more information on this topic.

Supported versions and flavors

  • This model decoder supports all S-57 cells, supported by the TLcdS57ModelDecoder
  • In case of S-63, a TLcdS63ModelDecoder instance should be provided to the constructor of this model decoder.

Known limitiations and issues

  • All limitations for the TLcdS57ModelDecoder apply to this decoder as well.

Notes on thread safety

  • This model decoder should not be used in a multi-threaded environment.

Since:
9.1
See Also:
  • Field Details

  • Constructor Details

    • TLcdS57DirectoryModelDecoder

      public TLcdS57DirectoryModelDecoder()
    • TLcdS57DirectoryModelDecoder

      public TLcdS57DirectoryModelDecoder(TLcdS57ModelDecoder aS57ModelDecoder)
  • Method Details

    • setInputStreamFactory

      public void setInputStreamFactory(ILcdInputStreamFactory aInputStreamFactory)
      Sets the factory that will create input streams from which models can be decoded.
      Specified by:
      setInputStreamFactory in interface ILcdInputStreamFactoryCapable
      Parameters:
      aInputStreamFactory - the factory that creates an input stream based on a source name.
      See Also:
    • getInputStreamFactory

      public ILcdInputStreamFactory getInputStreamFactory()
      Returns the factory that will create input streams from which models can be decoded.
      Specified by:
      getInputStreamFactory in interface ILcdInputStreamFactoryCapable
      Returns:
      the factory that creates an input stream based on a source name.
      See Also:
    • setIgnoreInvalidCells

      public void setIgnoreInvalidCells(boolean aIgnoreInvalidCells)
      Specifies whether to ignore invalid cells or not.

      See class javadoc section "Error handling" for details.

      Parameters:
      aIgnoreInvalidCells - whether to ignore invalid cells or not
      See Also:
    • isIgnoreInvalidCells

      public boolean isIgnoreInvalidCells()
      Returns whether to ignore invalid cells or not.
      Returns:
      true if invalid cells have to be ignored, false otherwise.
      See Also:
    • setInvalidCellExceptionHandler

      public void setInvalidCellExceptionHandler(ILcdS57InvalidCellExceptionHandler aHandler)
      Sets the cell exception handler to be used when decoding individual cells. This exception handler will be called whenever a cell could not be decoded correctly.

      See class javadoc section "Error handling" for details.

      Parameters:
      aHandler - the exception handler to be used when decoding individual cells.
      See Also:
    • getInvalidCellExceptionHandler

      public ILcdS57InvalidCellExceptionHandler getInvalidCellExceptionHandler()
      Return the cell exception handler to be used when decoding individual cells.
      See Also:
    • resetObjectClassSelection

      public void resetObjectClassSelection()
      Resets the list of object classes that is included into decoded models. All object classes will now be included in the models when decoding S-57 files.
      See Also:
    • setObjectClassSelection

      public void setObjectClassSelection(int[] aObjectClasses)
      Sets the list of object classes that is included into decoded models. By default, all object classes are decoded.
      Parameters:
      aObjectClasses - the object classes to be included in the decoded models. They can be listed in any order, and duplicate entries are allowed.
      See Also:
    • resetExcludedObjectClasses

      public void resetExcludedObjectClasses()
      Resets the list of object classes that is excluded from decoded models. No object classes will now be excluded from the models when decoding S-57 files.
      See Also:
    • setExcludedObjectClasses

      public void setExcludedObjectClasses(int[] aExcludedObjectClasses)
      Sets the list of object classes that is excluded from decoded models. By default, no object classes are excluded. This list has precedence over the list of classes that is included, if specified.
      Parameters:
      aExcludedObjectClasses - the object classes to be excluded from the decoded models. They can be listed in any order, and duplicate entries are allowed.
      See Also:
    • setObjectClassMap

      public void setObjectClassMap(TLcdS57ObjectClassMap aObjectClassMap)
      Sets the object class map to be used by this model decoder. The object class map is used for retrieving the definitions of object classes and initializing the decoded S-57 objects with their correct datatype.
      Parameters:
      aObjectClassMap - the object class map to be used by this model decoder.
    • getObjectClassMap

      public TLcdS57ObjectClassMap getObjectClassMap()
      Returns the object class map that is used by this model decoder.
      Returns:
      the object class map that is used by this model decoder.
    • setAttributeClassMap

      public void setAttributeClassMap(TLcdS57AttributeClassMap aAttributeClassMap)
      Sets the attribute class map to be used by this model decoder. The attribute class map is used for retrieving the definitions of attributes and initializing the decoded S-57 objects with their correct datatype.
      Parameters:
      aAttributeClassMap - the attribute class map to be used by this model decoder.
    • getAttributeClassMap

      public TLcdS57AttributeClassMap getAttributeClassMap()
      Returns the attribute class map that is used by this model decoder.
      Returns:
      the attribute class map that is used by this model decoder.
    • 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: