Package com.luciad.earth.model
Class TLcdEarthTerrainRepositoryModelDecoder
java.lang.Object
com.luciad.earth.model.TLcdEarthTerrainRepositoryModelDecoder
- All Implemented Interfaces:
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
- All models returned by this model decoder implement
ILcd2DBoundsIndexedModel
.
Model descriptor
- All models returned by this model decoder have an
ILcdEarthAssetBasedModelDescriptor
.
Model reference
- All models returned by this model decoder have an
ILcdGridReference
or anILcdGeodeticReference
. - This model decoder retrieves its model references using the model reference decoder that is
currently set (a
TLcdModelReferenceDecoder
by default).
Model elements
- Each decoded model contains elements that implement
ILcdEarthTileSet
. - Each decoded model contains elements which are wrapped with a
TLcdEarthAsynchronousTileSet
.
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 Summary
ConstructorDescriptionConstructs a newTLcdEarthTerrainRepositoryModelDecoder
that uses the default model reference decoder and tile data codecs and does not allow fallback to default geometry or textures. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addAssetCodec
(ILcdEarthAssetCodec aCodec) Adds the specified asset codec.void
Adds the specified tile data codec for its encoded format.boolean
canDecodeSource
(String aSourceName) Checks whether this model decoder can decode the specified data source.Creates a new model from the given data source.Returns the current collection of asset codecs.Returns a short, displayable name for the format that is decoded by thisILcdModelDecoder
.Returns the model reference decoder used.Returns the current collection of tile data codecs.boolean
Returns whether a terrain may be created with default geometry if it cannot be derived from data in the repository.boolean
Returns whether a terrain may be created with default textures if it cannot be derived from data in the repository.boolean
removeAssetCodec
(ILcdEarthAssetCodec aCodec) Removes the specified asset codec.boolean
Removes the specified tile data codec for its encoded format.void
setAllowFallbackToDefaultGeometry
(boolean aAllowFallbackToDefaultGeometry) Sets whether a terrain may be created with default geometry.void
setAllowFallbackToDefaultTexture
(boolean aAllowFallbackToDefaultTexture) Sets whether a terrain may be created with default textures.void
setModelReferenceDecoder
(TLcdModelReferenceDecoder aModelReferenceDecoder) Sets the model reference decoder used.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.luciad.model.ILcdModelDecoder
canDecodeSource, decodeModelMetadata, decodeModelMetadata, decodeSource, discoverDataSources
-
Constructor Details
-
TLcdEarthTerrainRepositoryModelDecoder
public TLcdEarthTerrainRepositoryModelDecoder()Constructs a newTLcdEarthTerrainRepositoryModelDecoder
that uses the default model reference decoder and tile data codecs and does not allow fallback to default geometry or textures.
-
-
Method Details
-
addTileDataCodec
Adds the specified tile data codec for its encoded format.- Parameters:
aCodec
- the tile data codec that should be added
-
removeTileDataCodec
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
Returns the current collection of tile data codecs.- Returns:
- the current collection of tile data codecs
-
addAssetCodec
Adds the specified asset codec.- Parameters:
aCodec
- the asset codec that should be added
-
removeAssetCodec
Removes the specified asset codec.- Parameters:
aCodec
- the asset codec that should be removed- Returns:
- true if a codec was remove; false otherwise
-
getAssetCodecs
Returns the current collection of asset codecs.- Returns:
- the current collection of asset codecs
-
getModelReferenceDecoder
Returns the model reference decoder used.- Returns:
- the model reference decoder used.
-
setModelReferenceDecoder
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
Description copied from interface:ILcdModelDecoder
Returns a short, displayable name for the format that is decoded by thisILcdModelDecoder
.- Specified by:
getDisplayName
in interfaceILcdModelDecoder
- Returns:
- the displayable name of this
ILcdModelDecoder
.
-
canDecodeSource
Description copied from interface:ILcdModelDecoder
Checks whether this model decoder can decode the specified data source. It is acceptable for this method to returntrue
for a source name whiledecode
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 interfaceILcdModelDecoder
- 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
Description copied from interface:ILcdModelDecoder
Creates a new model from the given data source.- Specified by:
decode
in interfaceILcdModelDecoder
- 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:
-