Class TLcdEarthTerrainRepositoryModelDecoder

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

public class TLcdEarthTerrainRepositoryModelDecoder extends Object implements ILcdModelDecoder
This model decoder decodes 3D terrain tile repositories.

In most cases the more general TLcdEarthRepositoryModelDecoder should be preferred over this model decoder. The difference is that the terrain repository model decoder adds some painter specific tile set wrappers. These tile set wrappers are not necessary in the model any more because the painters will also create these if necessary.

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

  • This model decoder supports all transfer protocols that are supported by java.io.File.

Model structure

Model descriptor

Model reference

Model elements

Sample code


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

Thread safety

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

    • TLcdEarthTerrainRepositoryModelDecoder

      public TLcdEarthTerrainRepositoryModelDecoder()
      Constructs a new TLcdEarthTerrainRepositoryModelDecoder that uses the default model reference decoder and tile data codecs and does not allow fallback to default geometry or textures.
  • Method Details

    • 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
    • getModelReferenceDecoder

      public TLcdModelReferenceDecoder getModelReferenceDecoder()
      Returns the model reference decoder used.
      Returns:
      the model reference decoder used.
    • setModelReferenceDecoder

      public void setModelReferenceDecoder(TLcdModelReferenceDecoder aModelReferenceDecoder)
      Sets the model reference decoder used.
      Parameters:
      aModelReferenceDecoder - the new model reference decoder that should be used.
    • isAllowFallbackToDefaultGeometry

      public boolean isAllowFallbackToDefaultGeometry()
      Returns whether a terrain may be created with default geometry if it cannot be derived from data in the repository.

      If this is allowed and the textures can be derived from the repository the geometry will be generated on-the-fly at sealevel if it cannot be derived from data in the repository. Otherwise the decoding will fail if the geometry cannot be derived from data in the repository.

      Returns:
      true if fallback to default geometry is allowed, false otherwise.
    • setAllowFallbackToDefaultGeometry

      public void setAllowFallbackToDefaultGeometry(boolean aAllowFallbackToDefaultGeometry)
      Sets whether a terrain may be created with default geometry.
      Parameters:
      aAllowFallbackToDefaultGeometry - true if fallback to default geometry is allowed, false otherwise.
      See Also:
    • isAllowFallbackToDefaultTexture

      public boolean isAllowFallbackToDefaultTexture()
      Returns whether a terrain may be created with default textures if it cannot be derived from data in the repository.

      If this is allowed and the geometry can be derived from the repository the white textures will be generated on-the-fly if it cannot be derived from data in the repository. Otherwise the decoding will fail if the textures cannot be derived from data in the repository.

      Returns:
      true if fallback to default texures is allowed, false otherwise.
    • setAllowFallbackToDefaultTexture

      public void setAllowFallbackToDefaultTexture(boolean aAllowFallbackToDefaultTexture)
      Sets whether a terrain may be created with default textures.
      Parameters:
      aAllowFallbackToDefaultTexture - true if fallback to default textures is allowed, false otherwise.
      See Also:
    • 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: