public class TLfnTileStoreModelDecoder extends Object implements ILcdModelDecoder,ILcdDataSourceModelDecoder
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.
ALfnTileStore
object: a Tile Store model is decoded directly from a Tile Store"tile-store.xml"
is checked for existence. This model decoder never
automatically creates an empty Tile Store"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.TLfnTileStoreDataSource
object: a Tile Store model is decoded directly from a Tile Store,
with the specified coveragesFile
.ALfnTileStoreModel
.
ILcdEarthTileSet
for raster coverages.ILcdShape
elements for vector coverages.ALfnTileStoreModel#setCoverageIds(String...)
before it can be used.
ILcdEarthTileSetCoverage
s 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.
TLfnRasterTileStoreModelDescriptor
: for raster coverages.TLfnVectorTileStoreModelDescriptor
: for vector coverages.ILcdGridReference
or ILcdGeodeticReference
.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:
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.
ALcdImageMosaic
and the
decoded model does not integrate with the imaging API.
ILcdShape
elements for vector coverages.byte[]
as its class and the name of the coverage native format.
ILcdModelDecoder decoder = new TLfnTileStoreModelDecoder();
ILcdModel model = decoder.decode("http://sampleservices.luciad.com/lts");
//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);
ILcdEarthTileSet
,
ALfnTileStoreModel
Constructor and Description |
---|
TLfnTileStoreModelDecoder()
Constructs a new Tile Store model decoder with a default environment and client factory.
|
TLfnTileStoreModelDecoder(ALfnEnvironment aEnvironment)
Constructs a new Tile Store model decoder without a client factory, which can be used to decode
file URIs. |
TLfnTileStoreModelDecoder(ALfnEnvironment aEnvironment,
ALfnTileStoreProvider aTileStoreProvider)
Constructs a new Tile Store model decoder using a given Tile Store provider for decoding URIs.
|
TLfnTileStoreModelDecoder(ALfnEnvironment aEnvironment,
TLfnClientFactory aClientFactory)
Constructs a new Tile Store model decoder.
|
Modifier and Type | Method and Description |
---|---|
void |
addTileDataCodec(ILcdEarthTileDataCodec aCodec,
ELfnDataType aDataType)
Adds (registers) a codec.
|
boolean |
canDecodeSource(ILcdDataSource aDataSource)
Indicates whether a given source can be decoded as a Tile Store model.
|
boolean |
canDecodeSource(String aSourceName)
Indicates whether or not a given source name can be decoded as a Tile Store.
|
boolean |
canDecodeTileStore(String aSourceName)
Indicates whether or not a given source name can be decoded as a Tile Store.
|
ALfnTileStoreModel |
decode(ALfnTileStore aTileStore,
String aCoverageId)
Decodes a model of given a Tile Store and sets the coverage ID on it.
|
ALfnTileStoreModel |
decode(String aSourceName)
Decodes a Tile Store model given a source URI or file path.
|
ALfnTileStoreModel |
decodeSource(ILcdDataSource aDataSource)
Decodes a model for a given Tile Store data source.
|
ALfnTileStore |
decodeTileStore(String aSourceName)
Decodes a Tile Store from a given source name, throwing an exception in case of failure.
|
List<TLfnTileStoreDataSource> |
discoverDataSources(String aSource)
Discovers all the coverages a given source has to offer and returns them as a list of data sources.
|
String |
getDisplayName()
Returns
"LuciadFusion Tile Store" as display name. |
Collection<ILcdEarthTileDataCodec> |
getTileDataCodecs(ELfnDataType aDataType)
Gets the registered tile data codecs.
|
boolean |
removeTileDataCodec(ILcdEarthTileDataCodec aCodec,
ELfnDataType aDataType)
Removes a tile data codec.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
decodeModelMetadata, decodeModelMetadata
public TLfnTileStoreModelDecoder(ALfnEnvironment aEnvironment, ALfnTileStoreProvider aTileStoreProvider)
aEnvironment
- an environment, must not be null
aTileStoreProvider
- a Tile Store provider, must not be null
public TLfnTileStoreModelDecoder(ALfnEnvironment aEnvironment, TLfnClientFactory aClientFactory)
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:
/mnt/TileStore/tile-store.xml
or
file:///mnt/TileStore/tile-store.xml
.decode(ALfnTileStore, String)
and passing a Tile Store instance directly.
Note that there is no 'canDecode' equivalent.aEnvironment
- an environment, must not be null
aClientFactory
- a client factory, may be null
public TLfnTileStoreModelDecoder(ALfnEnvironment aEnvironment)
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 anyaEnvironment
- an environment, must not be null
TLfnTileStoreModelDecoder(com.luciad.fusion.core.ALfnEnvironment, com.luciad.fusion.client.TLfnClientFactory)
public TLfnTileStoreModelDecoder()
file
and http
URIs.public void addTileDataCodec(ILcdEarthTileDataCodec aCodec, ELfnDataType aDataType)
null
if it is not relevant.aCodec
- the codec to be addedaDataType
- the data typepublic boolean removeTileDataCodec(ILcdEarthTileDataCodec aCodec, ELfnDataType aDataType)
aCodec
- the codec to be removedaDataType
- the data type or null
if it is not relevanttrue
if the codec was removed successfully, false
otherwisepublic Collection<ILcdEarthTileDataCodec> getTileDataCodecs(ELfnDataType aDataType)
aDataType
- the data type or null
if it is not relevantpublic String getDisplayName()
"LuciadFusion Tile Store"
as display name.getDisplayName
in interface ILcdModelDecoder
"LuciadFusion Tile Store"
as display namepublic boolean canDecodeSource(String aSourceName)
true
in any of the following cases:
tile-store.xml
file exists.tile-store.xml
file.tile-store.xml
file.path/to/tile-store.xml
/path/to/tile-store-directory
file:/path/to/tile-store-directory
http://server:8080/LuciadFusion/lts
false
.canDecodeSource
in interface ILcdModelDecoder
aSourceName
- the source name to decode as Tile Storetrue
if the given source name can be decoded as a Tile Store, false
otherwiseILcdModelDecoder.decode(String)
,
ILcdModelDecoder.decodeModelMetadata(String)
public ALfnTileStoreModel decode(String aSourceName) throws IOException
"file"
or another scheme that is supported by the client factory.
The returned model will have an TLfnTileStoreModelDescriptor
or a subclass thereof.
See TLfnRasterTileStoreModelDescriptor
and TLfnVectorTileStoreModelDescriptor
for an explanation of
the model's structure.decode
in interface ILcdModelDecoder
aSourceName
- the source to decode as Tile StoreIOException
- when a Tile Store cannot be decoded from the given sourcecanDecodeSource(java.lang.String)
,
TLfnTileStoreModelDescriptor
,
TLfnRasterTileStoreModelDescriptor
,
TLfnVectorTileStoreModelDescriptor
public ALfnTileStoreModel decode(ALfnTileStore aTileStore, String aCoverageId) throws IOException
TLfnTileStoreModelDescriptor
or a subclass thereof.
See TLfnRasterTileStoreModelDescriptor
and TLfnVectorTileStoreModelDescriptor
for an explanation of
the model's structure.aTileStore
- the Tile Store to create a model ofaCoverageId
- the coverage ID to set on the model before returning itIOException
- when a Tile Store with given coverages cannot be decodedIllegalArgumentException
- if the coverages are not compatibleNullPointerException
- if the given tile store is nullALfnTileStoreModel.setCoverageId(String)
,
TLfnTileStoreModelDescriptor
,
TLfnRasterTileStoreModelDescriptor
,
TLfnVectorTileStoreModelDescriptor
public List<TLfnTileStoreDataSource> discoverDataSources(String aSource) throws IOException
canDecodeSource(String)
.
Once you have the list of data sources, you can select and decode them using decodeSource(com.luciad.model.ILcdDataSource)
.
If an ALfnTileStoreProvider
was set on this decoder, the ALfnTileStore
on the
returned TLfnTileStoreDataSource
does not need to be closed. Instead the ALfnTileStoreProvider
is responsible for the disposal of the tile store.
discoverDataSources
in interface ILcdModelDecoder
aSource
- the source, which must be a valid LuciadFusion LTS URInull
IOException
- if the given source is not a valid LuciadFusion LTS URI, or if something goes wrong connecting to the URIpublic boolean canDecodeSource(ILcdDataSource aDataSource)
true
if the data source is a TLfnTileStoreDataSource
.canDecodeSource
in interface ILcdModelDecoder
aDataSource
- the data source to decodetrue
when the given data source source is Tile Store data source, false
otherwiseILcdModelDecoder.decodeSource(ILcdDataSource)
,
ILcdModelDecoder.decodeModelMetadata(ILcdDataSource)
public ALfnTileStoreModel decodeSource(ILcdDataSource aDataSource) throws IOException
TLfnTileStoreModelDescriptor
or a subclass thereof.
See TLfnRasterTileStoreModelDescriptor
and TLfnVectorTileStoreModelDescriptor
for an explanation of
the model's structure.decodeSource
in interface ILcdModelDecoder
aDataSource
- a Tile Store data sourceIOException
- if a Tile Store with given coverages cannot be decodedIllegalArgumentException
- if the data source cannot be handled or the coverages are not
compatibleTLfnTileStoreModelDescriptor
,
TLfnRasterTileStoreModelDescriptor
,
TLfnVectorTileStoreModelDescriptor
public boolean canDecodeTileStore(String aSourceName)
true
in any of the following cases:
tile-store.xml
file exists.tile-store.xml
file.tile-store.xml
file.path/to/tile-store.xml
/path/to/tile-store-directory
file:/path/to/tile-store-directory
http://server:8080/LuciadFusion/lts
false
.aSourceName
- the source name to decode as Tile Storetrue
if the given source name can be decoded as a Tile Store, false
otherwisepublic ALfnTileStore decodeTileStore(String aSourceName) throws IOException
Decodes a Tile Store from a given source name, throwing an exception in case of failure.
If an ALfnTileStoreProvider
was set on this decoder, the returned ALfnTileStore
does
not need to be closed. Instead the ALfnTileStoreProvider
is
responsible for closing the tile store.
aSourceName
- the source name to decode as Tile StoreIOException
- if no Tile Store could be decoded from the given source namecanDecodeTileStore(java.lang.String)