Class TLfnTileStoreModelDecoder

java.lang.Object
com.luciad.fusion.tilestore.model.TLfnTileStoreModelDecoder
All Implemented Interfaces:
ILcdDataSourceModelDecoder, ILcdModelDecoder

public class TLfnTileStoreModelDecoder extends Object implements ILcdModelDecoder, ILcdDataSourceModelDecoder
Decodes a Tile Store from a URI or directly from an ALfnTileStore into a tile set. A tile set defines a logical group of coverages, identified by their coverage IDs. The Tile Store model returned by this decoder is initially empty, a selection of coverages needs to be made by calling ALfnTileStoreModel.setCoverageId(String) on the Tile Store model. All coverages in the tile set must have equals bounds, structure and geographic reference.

Input files

The model decoder can recognize different sources:
  • a ALfnTileStore object: a Tile Store model is decoded directly from a Tile Store
  • a file system path: a Tile Store model is decoded using a file system path as Tile Store home directory. Note that the file "tile-store.xml" is checked for existence. This model decoder never automatically creates an empty Tile Store
  • a URI: a Tile Store model is decoded using a URI. In case of a URI with scheme "file", the URI is interpreted as Tile Store home. Other URI schemes are interpreted as service URIs and are passed to the client factory for interpretation. The client factory is optional and needs to be specified in the constructor. Typical URI schemes are "http" and "https". When no client factory is specified in the constructor, the only URIs that can be decoded are "file" URIs, which is often sufficient.
  • a TLfnTileStoreDataSource object: a Tile Store model is decoded directly from a Tile Store, with the specified coverages

Supported file transfer protocols

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

Model structure

All models returned by this model decoder extend ALfnTileStoreModel.
  • When decoded with a single coverage ID, the model contains:
  • When decoded without specifying a coverage ID, the model is initially empty, and must be populated by calling ALfnTileStoreModel#setCoverageIds(String...) before it can be used.
  • It is possible to decode a single model containing multiple coverage IDs, to support the legacy 3D use case where an image and elevation coverage are modeled as two ILcdEarthTileSetCoverages of a single ILcdEarthTileSet. In LuciadLightspeed applications, imagery and elevation should always be modeled as two separate models, and you should never decode multiple coverages into a single model.

Model descriptor

Model reference

Model elements

  • A decoded model contains:
    • A single element that implements ILcdEarthTileSet for raster coverages. When some conditions are met, the element also extends ALcdImageMosaic so it can integrate with the imaging API. These conditions are:
      • A single coverage per model. This condition is virtually always fulfilled. The only exception is the legacy 3D use case of multiple coverages per model.
      • An ILcdEarthTileDataCodec exist that has a decoded TLcdEarthTileFormat with RenderedImage (or a subclass thereof) as its format class. This condition is fulfilled for all built-in raster tile formats. If you have added any custom tile formats, you're responsible for adding the necessary codecs.
      If one of these conditions is not met, the model's element does not extend ALcdImageMosaic and the decoded model does not integrate with the imaging API.
    • A set of ILcdShape elements for vector coverages.

Useful settings

  • Tile data codecs: the codecs that are used to decode the tile data from the tile set can be changed. Additionally the tile sets created for raster coverages also support retrieving the raw tile data by using a format with byte[] as its class and the name of the coverage native format.

Sample code


 ILcdModelDecoder decoder = new TLfnTileStoreModelDecoder();
 ILcdModel model = decoder.decode("http://sampleservices.luciad.com/lts");
 

Thread safety

  • The decoding of models is thread-safe.
  • The decoded models are thread-safe for read access.

Example

Decode a specific coverage from a tile store and visualize it in a Lightspeed layer:
    //First create the model
    //Start by creating a TLcdCoverageDataSource for the coverage
    String tileStoreURL = "http://sampleservices.luciad.com/lts";
    String coverageID = "92c09725-a9c5-46fb-bffd-d9e23b4abbf2";
    TLcdCoverageDataSource dataSource = new TLcdCoverageDataSource(tileStoreURL, coverageID);

    //Decode the model by passing the datasource to the model decoder
    ILcdModelDecoder decoder =
        new TLcdCompositeModelDecoder(TLcdServiceLoader.getInstance(ILcdModelDecoder.class));
    ILcdModel model = decoder.decodeSource(dataSource);

    //Create a layer for the model with default styling
    ILspLayer layer = TLspRasterLayerBuilder.newBuilder()
                                            .model(model)
                                            .build();

    //Add the layer to the Lightspeed view (an ILspView)
    view.addLayer(layer);
Since:
10.0
See Also:
  • Constructor Details

    • TLfnTileStoreModelDecoder

      public TLfnTileStoreModelDecoder(ALfnEnvironment aEnvironment, ALfnTileStoreProvider aTileStoreProvider)
      Constructs a new Tile Store model decoder using a given Tile Store provider for decoding URIs.
      Parameters:
      aEnvironment - an environment, must not be null
      aTileStoreProvider - a Tile Store provider, must not be null
    • TLfnTileStoreModelDecoder

      public TLfnTileStoreModelDecoder(ALfnEnvironment aEnvironment, TLfnClientFactory aClientFactory)
      Constructs a new Tile Store model decoder.

      The client factory is needed to decode source names which denote URIs other than files. All URI schemes other than file will be passed to the client factory. The client factory may be null, but then the use of this model decoder can only be used to:

      1. decode models from source names which denote a file, for example /mnt/TileStore/tile-store.xml or file:///mnt/TileStore/tile-store.xml.
      2. decode models using decode(ALfnTileStore, String) and passing a Tile Store instance directly. Note that there is no 'canDecode' equivalent.
      Parameters:
      aEnvironment - an environment, must not be null
      aClientFactory - a client factory, may be null
    • TLfnTileStoreModelDecoder

      public TLfnTileStoreModelDecoder(ALfnEnvironment aEnvironment)
      Constructs a new Tile Store model decoder without a client factory, which can be used to decode file URIs. This constructor is equivalent to TLfnTileStoreModelDecoder(aEnvironment, null). You will not be able to use it to decode http. If you want to decode any
      Parameters:
      aEnvironment - an environment, must not be null
      See Also:
    • TLfnTileStoreModelDecoder

      public TLfnTileStoreModelDecoder()
      Constructs a new Tile Store model decoder with a default environment and client factory. Such a model decoder is capable of decoding file and http URIs.
      Since:
      2013.1
  • Method Details