public class MapTileProviderArray extends MapTileProviderBase implements MapTileContainer
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.Modifier and Type | Field and Description |
---|---|
protected List<MapTileModuleProviderBase> |
mTileProviderList |
MAPTILE_FAIL_ID, MAPTILE_SUCCESS_ID, mTileCache, mTileNotFoundImage, mUseDataConnection
Modifier | Constructor and Description |
---|---|
protected |
MapTileProviderArray(ITileSource pTileSource,
IRegisterReceiver pRegisterReceiver)
Creates an
MapTileProviderArray with no tile providers. |
|
MapTileProviderArray(ITileSource pTileSource,
IRegisterReceiver aRegisterReceiver,
MapTileModuleProviderBase[] pTileProviderArray)
Creates an
MapTileProviderArray with the specified tile providers. |
Modifier and Type | Method and Description |
---|---|
boolean |
contains(long pTileIndex) |
void |
detach()
classes that extend MapTileProviderBase must call this method to prevent memory leaks.
|
protected MapTileModuleProviderBase |
findNextAppropriateProvider(MapTileRequestState aState)
We want to not use a provider that doesn't exist anymore in the chain, and we want to not use
a provider that requires a data connection when one is not available.
|
Drawable |
getMapTile(long pMapTileIndex)
Attempts to get a Drawable that represents a
MapTileIndex . |
int |
getMaximumZoomLevel()
Gets the maximum zoom level this tile provider can provide
|
int |
getMinimumZoomLevel()
Gets the minimum zoom level this tile provider can provide
|
boolean |
getProviderExists(MapTileModuleProviderBase provider) |
long |
getQueueSize() |
IFilesystemCache |
getTileWriter() |
protected boolean |
isDowngradedMode()
Deprecated.
Not used anymore. Use
isDowngradedMode(long) instead |
protected boolean |
isDowngradedMode(long pMapTileIndex) |
void |
mapTileRequestCompleted(MapTileRequestState aState,
Drawable aDrawable)
Called by implementation class methods indicating that they have completed the request as
best it can.
|
void |
mapTileRequestExpiredTile(MapTileRequestState aState,
Drawable aDrawable)
Called by implementation class methods indicating that they have produced an expired result
that can be used but better results may be delivered later.
|
void |
mapTileRequestFailed(MapTileRequestState aState)
Called by implementation class methods indicating that they have failed to retrieve the
requested map tile.
|
void |
mapTileRequestFailedExceedsMaxQueueSize(MapTileRequestState aState)
Called by implementation class methods indicating that they have failed to retrieve the
requested map tile, because the max queue size has been reached
|
void |
setTileSource(ITileSource aTileSource)
Sets the tile source for this tile provider.
|
clearTileCache, createTileCache, ensureCapacity, expireInMemoryCache, getTileCache, getTileRequestCompleteHandlers, getTileSource, putExpiredTileIntoCache, putTileIntoCache, rescaleCache, setTileLoadFailureImage, setTileRequestCompleteHandler, setUseDataConnection, useDataConnection
protected final List<MapTileModuleProviderBase> mTileProviderList
protected MapTileProviderArray(ITileSource pTileSource, IRegisterReceiver pRegisterReceiver)
MapTileProviderArray
with no tile providers.pRegisterReceiver
- a IRegisterReceiver
public MapTileProviderArray(ITileSource pTileSource, IRegisterReceiver aRegisterReceiver, MapTileModuleProviderBase[] pTileProviderArray)
MapTileProviderArray
with the specified tile providers.aRegisterReceiver
- a IRegisterReceiver
pTileProviderArray
- an array of MapTileModuleProviderBase
public void detach()
MapTileProviderBase
detach
in class MapTileProviderBase
public boolean contains(long pTileIndex)
contains
in interface MapTileContainer
@Deprecated protected boolean isDowngradedMode()
isDowngradedMode(long)
insteadprotected boolean isDowngradedMode(long pMapTileIndex)
public Drawable getMapTile(long pMapTileIndex)
MapTileProviderBase
MapTileIndex
. If the tile is not immediately
available this will return null and attempt to get the tile from known tile sources for
subsequent future requests. Note that this may return a ReusableBitmapDrawable
in
which case you should follow proper handling procedures for using that Drawable or it may
reused while you are working with it.getMapTile
in class MapTileProviderBase
ReusableBitmapDrawable
public void mapTileRequestCompleted(MapTileRequestState aState, Drawable aDrawable)
MapTileProviderBase
mapTileRequestCompleted
in interface IMapTileProviderCallback
mapTileRequestCompleted
in class MapTileProviderBase
aState
- the map tile request state objectaDrawable
- the Drawable of the map tilepublic void mapTileRequestFailed(MapTileRequestState aState)
MapTileProviderBase
mapTileRequestFailed
in interface IMapTileProviderCallback
mapTileRequestFailed
in class MapTileProviderBase
aState
- the map tile request state objectpublic void mapTileRequestFailedExceedsMaxQueueSize(MapTileRequestState aState)
MapTileProviderBase
mapTileRequestFailedExceedsMaxQueueSize
in interface IMapTileProviderCallback
mapTileRequestFailedExceedsMaxQueueSize
in class MapTileProviderBase
aState
- the map tile request state objectpublic void mapTileRequestExpiredTile(MapTileRequestState aState, Drawable aDrawable)
MapTileProviderBase
mapTileRequestExpiredTile
in interface IMapTileProviderCallback
mapTileRequestExpiredTile
in class MapTileProviderBase
aState
- the map tile request state objectaDrawable
- the Drawable of the map tilepublic IFilesystemCache getTileWriter()
getTileWriter
in class MapTileProviderBase
public long getQueueSize()
getQueueSize
in class MapTileProviderBase
protected MapTileModuleProviderBase findNextAppropriateProvider(MapTileRequestState aState)
public boolean getProviderExists(MapTileModuleProviderBase provider)
public int getMinimumZoomLevel()
MapTileProviderBase
getMinimumZoomLevel
in class MapTileProviderBase
public int getMaximumZoomLevel()
MapTileProviderBase
getMaximumZoomLevel
in class MapTileProviderBase
public void setTileSource(ITileSource aTileSource)
MapTileProviderBase
setTileSource
in class MapTileProviderBase
aTileSource
- the tile source