@LcdService(service=ILcdModelDecoder.class, priority=20000) public class TLcdBingMapsModelDecoder extends Object implementsILcdDataSourceModelDecoder
ILcdModel
containing high resolution, multi-level Bing Maps imagery.
ILcdBingMapsDataSource
, created by either a TLcdBingMapsDataSourceBuilder
or a
TLcdCustomBingMapsDataSourceBuilder
.
This implementation doesn't support Strings
as input.
TLcdBingMapsModelDescriptor
.TLcdGridReference
.TLcdGeodeticDatum
(WGS-84).TLcdPseudoMercator
.ILcdGXYView
performance will be greatly improved if the
world reference of the view is equal to this model reference.ALcdImage
and ILcdEarthTileSet
.
TLcdBingMapsModelDecoder decoder = new TLcdBingMapsModelDecoder();
ILcdBingMapsDataSource source =
new TLcdBingMapsDataSourceBuilder( application_id ).build();
ILcdModel model = decoder.decode( source );
configured transport factory
.
Transport Factory
, but when that one is replaced,
it must be configured. See TLcdBingMapsTransportFactory
for more information on how to
enable Http caching.
ILcdBingMapsDataSource
,
TLcdBingMapsDataSourceBuilder
,
TLcdCustomBingMapsDataSourceBuilder
Constructor and Description |
---|
TLcdBingMapsModelDecoder() |
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(String aSourceName)
Checks whether this model decoder can decode the specified data source.
|
ILcdModel |
decode(String aSourceName)
This model decoder only supports sources that are an instance of ILcdBingMapsDataSource, not String.
|
ILcdModel |
decodeSource(ILcdDataSource aDataSource)
Creates a new model from the given data source.
|
String |
getDisplayName()
Returns a short, displayable name for the format that is decoded by this
ILcdModelDecoder . |
ILcdTransportFactory |
getTransportFactory()
Returns the used transport factory, determining the communication with
the Bing Maps servers.
|
void |
setTransportFactory(ILcdTransportFactory aTransportFactory)
Changes the used transport factory, determining the communication with
the Bing Maps servers.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
decodeModelMetadata, decodeModelMetadata, discoverDataSources
public ILcdTransportFactory getTransportFactory()
public void setTransportFactory(ILcdTransportFactory aTransportFactory)
aTransportFactory
- the transport factory. Note that the transport factory
is responsible for caching.TLcdBingMapsTransportFactory
public boolean canDecodeSource(ILcdDataSource aDataSource)
Checks whether this model decoder can decode the data source(s), identified by the passed ILcdDataSource
.
For performance reasons, we strongly recommend that this will only be a simple test.
For example: check the instance class of aDataSource
,
or check 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.
This implementation can decode ILcdBingMapsDataSource
objects. See
TLcdBingMapsDataSourceBuilder
and TLcdCustomBingMapsDataSourceBuilder
for info
on how to create a ILcdBingMapsDataSource
.
canDecodeSource
in interface ILcdModelDecoder
aDataSource
- the ILcdModelSource
to be verified.true
if this decoder can likely decode the data specified by aDataSource
, false
otherwise.ILcdModelDecoder.decodeSource(ILcdDataSource)
,
ILcdModelDecoder.decodeModelMetadata(ILcdDataSource)
public ILcdModel decodeSource(ILcdDataSource aDataSource) throws 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.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);
}
}
ILcdModelDecoder.canDecodeSource(ILcdDataSource)
public String getDisplayName()
ILcdModelDecoder
ILcdModelDecoder
.getDisplayName
in interface ILcdModelDecoder
ILcdModelDecoder
.public boolean canDecodeSource(String aSourceName)
ILcdModelDecoder
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.
canDecodeSource
in interface ILcdModelDecoder
aSourceName
- 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.ILcdModelDecoder.decode(String)
,
ILcdModelDecoder.decodeModelMetadata(String)
public ILcdModel decode(String aSourceName) throws IOException
decodeSource(com.luciad.model.ILcdDataSource)
instead.decode
in interface ILcdModelDecoder
aSourceName
- the data source to be decoded; typically a file name or a URL.UnsupportedOperationException
- always.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);
}
}
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.ILcdModelDecoder.canDecodeSource(String)