Class TLcdEarthRepositoryModelDecoder

java.lang.Object
com.luciad.earth.model.TLcdEarthRepositoryModelDecoder
All Implemented Interfaces:
ILcdModelDecoder

@LcdService(service=ILcdModelDecoder.class, priority=20000) public class TLcdEarthRepositoryModelDecoder extends Object implements ILcdModelDecoder
This model decoder decodes tile repositories.

Input files

File Required Entry point Description
tilerepository.cfg x
x The root file of an Earth tile repository.
tilerepository.ref x
The model reference of an Earth tile repository.
tilerepository_metadata.xml
The asset model of an Earth tile repository that describes its contents.

Supported file transfer protocols

As random access to the data is required, this decoder only reads from files. So it can for example not read from an InputStream, from a http connection or from a file inside a jar file.

Model structure

Model descriptor

Model reference

Model elements

Sample code


 ILcdModelDecoder decoder = new TLcdEarthRepositoryModelDecoder();
 ILcdModel model = decoder.decode("mydirectory/tilerepository.cfg");
 

Thread safety

  • The decoded models are thread-safe for read access.
Since:
9.1
See Also:
  • Constructor Details

    • TLcdEarthRepositoryModelDecoder

      public TLcdEarthRepositoryModelDecoder()
      Constructs a new TLcdEarthTileRepositoryModelDecoder with the default asset and tile data codecs. The repositories will be opened in read-only mode.
  • Method Details

    • isOpenRepositoriesReadOnly

      public boolean isOpenRepositoriesReadOnly()
      Returns whether the repositories will be opened in read-only mode. If this is true it will not be possible to edit the decoded repositories (e.g. the methods in the ILcdEarthEditableTileSet interface will not be usable).

      The default value is true.

      Returns:
      true if the repositories will be opened in read-only mode, false if they will be opened in read-write mode.
    • setOpenRepositoriesReadOnly

      public void setOpenRepositoriesReadOnly(boolean aOpenRepositoriesReadOnly)
      Sets whether the repositories will be opened in read-only mode.
      Parameters:
      aOpenRepositoriesReadOnly - true if the repositories should be opened in read-only mode, false if they should be opened in read-write mode.
      See Also:
    • addTileDataCodec

      public void addTileDataCodec(ILcdEarthTileDataCodec aCodec)
      Adds the specified tile data codec for its encoded format.
      Parameters:
      aCodec - the tile data codec that should be added
    • removeTileDataCodec

      public boolean removeTileDataCodec(ILcdEarthTileDataCodec aCodec)
      Removes the specified tile data codec for its encoded format.
      Parameters:
      aCodec - the tile data codec that should be removed
      Returns:
      true if a codec was remove; false otherwise
    • getTileDataCodecs

      public Collection<ILcdEarthTileDataCodec> getTileDataCodecs()
      Returns the current collection of tile data codecs.
      Returns:
      the current collection of tile data codecs
    • addAssetCodec

      public void addAssetCodec(ILcdEarthAssetCodec aCodec)
      Adds the specified asset codec.
      Parameters:
      aCodec - the asset codec that should be added
    • removeAssetCodec

      public boolean removeAssetCodec(ILcdEarthAssetCodec aCodec)
      Removes the specified asset codec.
      Parameters:
      aCodec - the asset codec that should be removed
      Returns:
      true if a codec was remove; false otherwise
    • getAssetCodecs

      public Collection<ILcdEarthAssetCodec> getAssetCodecs()
      Returns the current collection of asset codecs.
      Returns:
      the current collection of asset codecs
    • 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:
    • createRepository

      protected TLcdEarthTileRepository createRepository(String aRepositoryName, boolean aReadOnly) throws IOException
      Creates a repository instance by opening the tile repository with the given name.

      The default implementation creates a TLcdEarthTileRepository instance.

      Parameters:
      aRepositoryName - the name of the repository to open
      aReadOnly - true if the repository should be opened in read-only mode, false if it should be opened in read-write mode
      Returns:
      a repository
      Throws:
      IOException - if the repository could not be opened
      See Also: