@LcdService(service=ILcdModelDecoder.class, priority=20000) public final class TLcdCoverageModelDecoder extends java.lang.Object implements ILcdModelDecoder
File | Required | Entry point | Description |
---|---|---|---|
${name}.xml | X | X | The Fusion Coverage description (metadata) |
${name}/*.ctr | X | The Fusion Coverage tile data |
TLcdCoverageDataSource
. ILcdModel
.
TLcdCoverageModelDescriptor
.
The model descriptor indicates it is suitable for use with the imaging API (ILcdImageModelDescriptor
).
ALcdImage.fromDomainObject(Object)
if you need access to it.
TLcdCoverageModelDecoder modelDecoder = new TLcdCoverageModelDecoder();
ILcdModel model = modelDecoder.decode("Data/LuciadFusion/Coverages/earth__image.xml");
TLcdCoverageDataSource coverageDataSource = new TLcdCoverageDataSource("http://sampleservices.luciad.com/lts", "92c09725-a9c5-46fb-bffd-d9e23b4abbf2");
TLcdCoverageModelDecoder modelDecoder = new TLcdCoverageModelDecoder();
ILcdModel model = modelDecoder.decodeSource(coverageDataSource);
Constructor and Description |
---|
TLcdCoverageModelDecoder()
Constructs the coverage model decoder.
|
TLcdCoverageModelDecoder(ALfnEnvironment aEnvironment,
ALfnTileStoreProvider aTileStoreProvider,
TLfnClientFactory aClientFactory)
Constructs a new coverage model decoder instance which uses the specified Fusion environment, client factory and tile store provider.
|
Modifier and Type | Method and Description |
---|---|
boolean |
canDecodeSource(ILcdDataSource aDataSource)
Checks whether this model decoder can decode the data source(s), identified by the passed
ILcdDataSource . |
boolean |
canDecodeSource(java.lang.String aSource)
Checks whether this model decoder can decode the specified data source.
|
ILcdModel |
decode(java.lang.String aSource)
Creates a new model from the given data source.
|
ILcdModel |
decodeSource(ILcdDataSource aDataSource)
Creates a new model from the given data source.
|
java.util.List<ILcdDataSource> |
discoverDataSources(java.lang.String aTileStoreSource)
Discovers all the coverages of a given Luciad Tile Store source has to offer and returns them as a list of
data sources.
|
java.lang.String |
getDisplayName()
Returns a short, displayable name for the format that is decoded by this
ILcdModelDecoder . |
ILcdTransportFactory |
getTransportFactory()
Returns the transport factory that will construct the
ILcdTransport used for
communicating with Luciad tile server. |
void |
setTransportFactory(ILcdTransportFactory aTransportFactory)
Sets the transport factory that will construct the
ILcdTransport used for
communicating with Luciad tile server. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
decodeModelMetadata, decodeModelMetadata
public TLcdCoverageModelDecoder()
public TLcdCoverageModelDecoder(ALfnEnvironment aEnvironment, ALfnTileStoreProvider aTileStoreProvider, TLfnClientFactory aClientFactory)
aEnvironment
- The fusion environmentaTileStoreProvider
- The tile store provideraClientFactory
- The client factorypublic java.lang.String getDisplayName()
ILcdModelDecoder
ILcdModelDecoder
.getDisplayName
in interface ILcdModelDecoder
ILcdModelDecoder
.public ILcdTransportFactory getTransportFactory()
ILcdTransport
used for
communicating with Luciad tile server.setTransportFactory(com.luciad.io.transport.ILcdTransportFactory)
public void setTransportFactory(ILcdTransportFactory aTransportFactory)
ILcdTransport
used for
communicating with Luciad tile server.
The default transport factory creates ILcdTransport
s based on the Apache HttpClient
library. This factory uses the proxy configuration from
the system-wide proxy selector
The transports created by the factory should implement ILcdDisposable
if they hold any
resources (ex. network connections).
This setter does not affect already decoded models.aTransportFactory
- the transport factory, must not be null
public boolean canDecodeSource(java.lang.String aSource)
Data/LuciadFusion/Coverages/earth__image.xml
canDecodeSource
in interface ILcdModelDecoder
aSource
- the data source to be verified; typically a file name or a URL.true
if this decoder can likely decode the data specified by the source name, false
otherwise.public boolean canDecodeSource(ILcdDataSource aDataSource)
ILcdModelDecoder
Checks whether this model decoder can decode the data source(s), identified by the passed ILcdDataSource
.
Often this will only be a simple test, for example checking the instance class of aDataSource
,
or for example checking the file extension if it is a TLcdDataSource
.
The default implementation of this method will check if the given ILcdDataSource
is a
TLcdDataSource
. If not, this method returns false. Otherwise, it delegates
the source to the ILcdModelDecoder.canDecodeSource(String)
method.
canDecodeSource
in interface ILcdModelDecoder
aDataSource
- the ILcdModelSource
to be verified.true
if this decoder can likely decode the data specified by aDataSource
, false
otherwise.public ILcdModel decode(java.lang.String aSource) throws java.io.IOException
ILcdModelDecoder
decode
in interface ILcdModelDecoder
aSource
- the data source to be decoded; typically a file name or a URL.null
is allowed, implementors are advised to throw an error instead.java.io.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);
}
}
java.io.InterruptedIOException
- When the thread on which this method is called is interrupted: it is recommended to stop the decoding
and throw an InterruptedIOException
.
This same exception can also be used if the decoder shows UI to the user, and the user cancels the decoding
through the UI.public ILcdModel decodeSource(ILcdDataSource aDataSource) throws java.io.IOException
ILcdModelDecoder
Creates a new model from the given data source.
By default, this method:
NullPointerException
when a null
data source is passed.ILcdModelDecoder.decode(String)
method when a TLcdDataSource
is passed.decodeSource
in interface ILcdModelDecoder
aDataSource
- the ILcdDataSource
to be decoded.null
is allowed, implementors are advised to throw an error instead.java.io.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 decodeSource(ILcdDataSource aDataSource) throws IOException {
try {
// Perform decoding ...
} catch (RuntimeException e) {
throw new IOException(e);
}
}
public java.util.List<ILcdDataSource> discoverDataSources(java.lang.String aTileStoreSource) throws java.io.IOException
Once you have the list of data sources, you can select and decode them using decodeSource(com.luciad.model.ILcdDataSource)
.
discoverDataSources
in interface ILcdModelDecoder
aTileStoreSource
- the source, which must be a valid LuciadFusion LTS URI, e.g., http://sampleservices.luciad.com/lts
.null
java.io.IOException
- if the given source is not a valid LuciadFusion LTS URI, or if something goes wrong connecting to the URI