Class TLcdBingMapsModelDecoder
- All Implemented Interfaces:
ILcdDataSourceModelDecoder,ILcdModelDecoder
ILcdModel containing high resolution, multi-level Bing Maps imagery.
Input files
The decoder only accepts aILcdBingMapsDataSource, created by either a TLcdBingMapsDataSourceBuilder or a
TLcdCustomBingMapsDataSourceBuilder.
This implementation doesn't support Strings as input.
Model structure
- This model decoder creates a model per data source.
Model descriptor
- All models returned by this model decoder have a
TLcdBingMapsModelDescriptor. - The type name of the model descriptor is the display name of this decoder.
Model reference
- All models returned by this model decoder have a
TLcdGridReference. - The used datum is a standard
TLcdGeodeticDatum(WGS-84). - The used projection is
TLcdPseudoMercator. - Note that when visualizing the model in a
ILcdGXYViewperformance will be greatly improved if the world reference of the view is equal to this model reference.
Model elements
- Each decoded model contains a single implementation of
ALcdImageandILcdEarthTileSet.
Sample code
TLcdBingMapsModelDecoder decoder = new TLcdBingMapsModelDecoder();
ILcdBingMapsDataSource source =
new TLcdBingMapsDataSourceBuilder( application_id ).build();
ILcdModel model = decoder.decode( source );
Supported file transfer protocols
This decoder makes use of the http/https protocols using theconfigured transport factory.
Performance tips
-
To reduce network latency, enabling Http caching is recommended. Http caching is supported
by the default
Transport Factory, but when that one is replaced, it must be configured. SeeTLcdTransportFactoryfor more information on how to enable Http caching.
Thread safety
- The decoding of models is thread-safe.
- The decoded models are thread-safe for read access.
Limitations
Currently, Bing Maps support in LuciadLightspeed has the following limitations:- "Birds Eye" imagery is not supported. This type of imagery requires a different way of interaction and does not offer continuous map coverage.
- The Bing Maps imagery service does not cover the whole world, so no imagery will be displayed near the poles. This will be especially noticeable on a 3D map.
- Since:
- 11.0
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancanDecodeSource(ILcdDataSource aDataSource) Checks whether this model decoder can decode the data source(s), identified by the passedILcdDataSource.booleancanDecodeSource(String aSourceName) Checks whether this model decoder can decode the specified data source.This model decoder only supports sources that are an instance of ILcdBingMapsDataSource, not String.decodeSource(ILcdDataSource aDataSource) Creates a new model from the given data source.Returns a short, displayable name for the format that is decoded by thisILcdModelDecoder.Returns the used transport factory, determining the communication with the Bing Maps servers.voidsetTransportFactory(ILcdTransportFactory aTransportFactory) Changes the used transport factory, determining the communication with the Bing Maps servers.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.luciad.model.ILcdModelDecoder
decodeModelMetadata, decodeModelMetadata, discoverDataSources
-
Constructor Details
-
TLcdBingMapsModelDecoder
public TLcdBingMapsModelDecoder()
-
-
Method Details
-
getTransportFactory
Returns the used transport factory, determining the communication with the Bing Maps servers.- Returns:
- the transport factory
-
setTransportFactory
Changes the used transport factory, determining the communication with the Bing Maps servers.
The default value is a standard
TLcdTransportFactorywith HTTP caching and automatic HTTP request retry enabled.The following code snippet illustrates how to configure caching and automatic HTTP request retry on a
TLcdTransportFactoryinstance that can later be passed as an argument to this method call:TLcdTransportFactory transportFactory = new TLcdTransportFactory(); transportFactory.setCaching(true); transportFactory.setMaxCacheEntries(500); transportFactory.setRetryCount(5);- Parameters:
aTransportFactory- the transport factory. Note that the transport factory is responsible for caching.- See Also:
-
canDecodeSource
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 aTLcdDataSource.The default implementation of this method will check if the given
ILcdDataSourceis aTLcdDataSource. If not, this method returns false. Otherwise, it delegates the source to theILcdModelDecoder.canDecodeSource(String)method.This implementation can decode
ILcdBingMapsDataSourceobjects. SeeTLcdBingMapsDataSourceBuilderandTLcdCustomBingMapsDataSourceBuilderfor info on how to create aILcdBingMapsDataSource.- Specified by:
canDecodeSourcein interfaceILcdModelDecoder- Parameters:
aDataSource- theILcdModelSourceto be verified.- Returns:
trueif this decoder can likely decode the data specified byaDataSource,falseotherwise.- See Also:
-
decodeSource
Description copied from interface:ILcdModelDecoderCreates a new model from the given data source.
By default, this method:
- Throws a
NullPointerExceptionwhen anulldata source is passed. - Delegates to the
ILcdModelDecoder.decode(String)method when aTLcdDataSourceis passed. - Throws an IOException in other case.
- Specified by:
decodeSourcein interfaceILcdModelDecoder- Parameters:
aDataSource- theILcdDataSourceto be decoded.- Returns:
- a model containing the decoded data. While
nullis 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 decodeSource(ILcdDataSource aDataSource) throws IOException { try { // Perform decoding ... } catch (RuntimeException e) { throw new IOException(e); } }- See Also:
- Throws a
-
getDisplayName
Description copied from interface:ILcdModelDecoderReturns a short, displayable name for the format that is decoded by thisILcdModelDecoder.- Specified by:
getDisplayNamein interfaceILcdModelDecoder- Returns:
- the displayable name of this
ILcdModelDecoder.
-
canDecodeSource
Description copied from interface:ILcdModelDecoderChecks whether this model decoder can decode the specified data source. It is acceptable for this method to returntruefor a source name whiledecodethrows 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:
canDecodeSourcein interfaceILcdModelDecoder- Parameters:
aSourceName- the data source to be verified; typically a file name or a URL.- Returns:
trueif this decoder can likely decode the data specified by the source name,falseotherwise.- See Also:
-
decode
This model decoder only supports sources that are an instance of ILcdBingMapsDataSource, not String. Use the methoddecodeSource(com.luciad.model.ILcdDataSource)instead.- Specified by:
decodein interfaceILcdModelDecoder- Parameters:
aSourceName- the data source to be decoded; typically a file name or a URL.- Returns:
- not applicable.
- Throws:
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); } }- See Also:
-