-
- All Implemented Interfaces:
-
org.osmdroid.tileprovider.IMapTileProviderCallback,org.osmdroid.util.MapTileContainer
public class MapTileProviderArray extends MapTileProviderBase implements MapTileContainer
This top-level tile provider allows a consumer to provide an array of modular asynchronous tile providers to be used to obtain map tiles. When a tile is requested, the MapTileProviderArray first checks the MapTileCache (synchronously) and returns the tile if available. If not, then the MapTileProviderArray returns null and sends the tile request through the asynchronous tile request chain. Each asynchronous tile provider returns success/failure to the MapTileProviderArray. If successful, the MapTileProviderArray passes the result to the base class. If failed, then the next asynchronous tile provider is called in the chain. If there are no more asynchronous tile providers in the chain, then the failure result is passed to the base class. The MapTileProviderArray provides a mechanism so that only one unique tile-request can be in the map tile request chain at a time.
-
-
Constructor Summary
Constructors Constructor Description MapTileProviderArray(ITileSource pTileSource, IRegisterReceiver aRegisterReceiver, Array<MapTileModuleProviderBase> pTileProviderArray)Creates an MapTileProviderArray with the specified tile providers.
-
Method Summary
Modifier and Type Method Description voiddetach()classes that extend MapTileProviderBase must call this method to prevent memory leaks.Updated 5. booleancontains(long pTileIndex)DrawablegetMapTile(long pMapTileIndex)Attempts to get a Drawable that represents a MapTileIndex. voidmapTileRequestCompleted(MapTileRequestState aState, Drawable aDrawable)Called by implementation class methods indicating that they have completed the request asbest it can. voidmapTileRequestFailed(MapTileRequestState aState)Called by implementation class methods indicating that they have failed to retrieve therequested map tile. voidmapTileRequestFailedExceedsMaxQueueSize(MapTileRequestState aState)Called by implementation class methods indicating that they have failed to retrieve therequested map tile, because the max queue size has been reached voidmapTileRequestExpiredTile(MapTileRequestState aState, Drawable aDrawable)Called by implementation class methods indicating that they have produced an expired resultthat can be used but better results may be delivered later. IFilesystemCachegetTileWriter()longgetQueueSize()booleangetProviderExists(MapTileModuleProviderBase provider)intgetMinimumZoomLevel()Gets the minimum zoom level this tile provider can provide intgetMaximumZoomLevel()Gets the maximum zoom level this tile provider can provide voidsetTileSource(ITileSource aTileSource)Sets the tile source for this tile provider. -
Methods inherited from class org.osmdroid.tileprovider.MapTileProviderBase
clearTileCache, createTileCache, ensureCapacity, expireInMemoryCache, getTileCache, getTileRequestCompleteHandlers, getTileSource, mapTileRequestCompleted, mapTileRequestExpiredTile, mapTileRequestFailed, mapTileRequestFailedExceedsMaxQueueSize, rescaleCache, setApproximationBackgroundColor, setTileLoadFailureImage, setTileRequestCompleteHandler, setTileSource, setUseDataConnection, useDataConnection -
Methods inherited from class org.osmdroid.tileprovider.IMapTileProviderCallback
mapTileRequestCompleted, mapTileRequestExpiredTile, mapTileRequestFailed, mapTileRequestFailedExceedsMaxQueueSize -
Methods inherited from class org.osmdroid.util.MapTileContainer
contains -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Constructor Detail
-
MapTileProviderArray
MapTileProviderArray(ITileSource pTileSource, IRegisterReceiver aRegisterReceiver, Array<MapTileModuleProviderBase> pTileProviderArray)
Creates an MapTileProviderArray with the specified tile providers.- Parameters:
aRegisterReceiver- a IRegisterReceiverpTileProviderArray- an array of MapTileModuleProviderBase
-
-
Method Detail
-
detach
void detach()
classes that extend MapTileProviderBase must call this method to prevent memory leaks.Updated 5.2+
-
contains
boolean contains(long pTileIndex)
-
getMapTile
Drawable getMapTile(long pMapTileIndex)
Attempts to get a Drawable that represents a MapTileIndex. If the tile is not immediatelyavailable this will return null and attempt to get the tile from known tile sources forsubsequent future requests. Note that this may return a ReusableBitmapDrawable inwhich case you should follow proper handling procedures for using that Drawable or it mayreused while you are working with it.
-
mapTileRequestCompleted
void mapTileRequestCompleted(MapTileRequestState aState, Drawable aDrawable)
Called by implementation class methods indicating that they have completed the request asbest it can. The tile is added to the cache, and a MAPTILE_SUCCESS_ID message is sent.
-
mapTileRequestFailed
void mapTileRequestFailed(MapTileRequestState aState)
Called by implementation class methods indicating that they have failed to retrieve therequested map tile. a MAPTILE_FAIL_ID message is sent.
-
mapTileRequestFailedExceedsMaxQueueSize
void mapTileRequestFailedExceedsMaxQueueSize(MapTileRequestState aState)
Called by implementation class methods indicating that they have failed to retrieve therequested map tile, because the max queue size has been reached
-
mapTileRequestExpiredTile
void mapTileRequestExpiredTile(MapTileRequestState aState, Drawable aDrawable)
Called by implementation class methods indicating that they have produced an expired resultthat can be used but better results may be delivered later. The tile is added to the cache,and a MAPTILE_SUCCESS_ID message is sent.
-
getTileWriter
IFilesystemCache getTileWriter()
-
getQueueSize
long getQueueSize()
-
getProviderExists
boolean getProviderExists(MapTileModuleProviderBase provider)
-
getMinimumZoomLevel
int getMinimumZoomLevel()
Gets the minimum zoom level this tile provider can provide
-
getMaximumZoomLevel
int getMaximumZoomLevel()
Gets the maximum zoom level this tile provider can provide
-
setTileSource
void setTileSource(ITileSource aTileSource)
Sets the tile source for this tile provider.
-
-
-
-