public abstract class MapTileProviderBase extends Object implements IMapTileProviderCallback
MapTile
for an overview of how tiles are served by this provider.Modifier and Type | Field and Description |
---|---|
protected MapTileCache |
mTileCache |
protected Drawable |
mTileNotFoundImage |
protected Handler |
mTileRequestCompleteHandler |
protected boolean |
mUseDataConnection |
Constructor and Description |
---|
MapTileProviderBase(ITileSource pTileSource) |
MapTileProviderBase(ITileSource pTileSource,
Handler pDownloadFinishedListener) |
Modifier and Type | Method and Description |
---|---|
void |
clearTileCache()
purges the cache of all tiles (default is the in memory cache)
|
MapTileCache |
createTileCache()
Creates a
MapTileCache to be used to cache tiles in memory. |
void |
detach()
classes that extend MapTileProviderBase must call this method to prevent memory leaks.
|
void |
ensureCapacity(int pCapacity) |
abstract Drawable |
getMapTile(MapTile pTile)
Attempts to get a Drawable that represents a
MapTile . |
abstract int |
getMaximumZoomLevel()
Gets the maximum zoom level this tile provider can provide
|
abstract int |
getMinimumZoomLevel()
Gets the minimum zoom level this tile provider can provide
|
ITileSource |
getTileSource()
Gets the tile source for this tile provider.
|
abstract IFilesystemCache |
getTileWriter() |
void |
mapTileRequestCompleted(MapTileRequestState pState,
Drawable pDrawable)
Called by implementation class methods indicating that they have completed the request as
best it can.
|
void |
mapTileRequestExpiredTile(MapTileRequestState pState,
Drawable pDrawable)
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 pState)
Called by implementation class methods indicating that they have failed to retrieve the
requested map tile.
|
protected void |
putExpiredTileIntoCache(MapTileRequestState pState,
Drawable pDrawable) |
protected void |
putTileIntoCache(MapTileRequestState pState,
Drawable pDrawable) |
void |
rescaleCache(Projection pProjection,
int pNewZoomLevel,
int pOldZoomLevel,
Rect pViewPort)
Recreate the cache using scaled versions of the tiles currently in it
|
void |
setTileLoadFailureImage(Drawable drawable)
Sets the "sorry we can't load a tile for this location" image.
|
void |
setTileRequestCompleteHandler(Handler handler) |
void |
setTileSource(ITileSource pTileSource)
Sets the tile source for this tile provider.
|
void |
setUseDataConnection(boolean pMode)
Set whether to use the network connection if it's available.
|
boolean |
useDataConnection()
Whether to use the network connection if it's available.
|
protected final MapTileCache mTileCache
protected Handler mTileRequestCompleteHandler
protected boolean mUseDataConnection
protected Drawable mTileNotFoundImage
public MapTileProviderBase(ITileSource pTileSource)
public MapTileProviderBase(ITileSource pTileSource, Handler pDownloadFinishedListener)
public abstract Drawable getMapTile(MapTile pTile)
MapTile
. 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.ReusableBitmapDrawable
public void detach()
public abstract int getMinimumZoomLevel()
public abstract int getMaximumZoomLevel()
public void setTileSource(ITileSource pTileSource)
pTileSource
- the tile sourcepublic ITileSource getTileSource()
public MapTileCache createTileCache()
MapTileCache
to be used to cache tiles in memory.public void setTileLoadFailureImage(Drawable drawable)
TilesOverlay.setLoadingLineColor(int)
and
TilesOverlay.setLoadingBackgroundColor(int)
drawable
- public void mapTileRequestCompleted(MapTileRequestState pState, Drawable pDrawable)
mapTileRequestCompleted
in interface IMapTileProviderCallback
pState
- the map tile request state objectpDrawable
- the Drawable of the map tilepublic void mapTileRequestFailed(MapTileRequestState pState)
mapTileRequestFailed
in interface IMapTileProviderCallback
pState
- the map tile request state objectpublic void mapTileRequestExpiredTile(MapTileRequestState pState, Drawable pDrawable)
mapTileRequestExpiredTile
in interface IMapTileProviderCallback
pState
- the map tile request state objectpDrawable
- the Drawable of the map tileprotected void putTileIntoCache(MapTileRequestState pState, Drawable pDrawable)
protected void putExpiredTileIntoCache(MapTileRequestState pState, Drawable pDrawable)
public void setTileRequestCompleteHandler(Handler handler)
public void ensureCapacity(int pCapacity)
public void clearTileCache()
public boolean useDataConnection()
useDataConnection
in interface IMapTileProviderCallback
public void setUseDataConnection(boolean pMode)
pMode
- if true use the network connection if it's available. if false don't use the
network connection even if it's available.public void rescaleCache(Projection pProjection, int pNewZoomLevel, int pOldZoomLevel, Rect pViewPort)
pNewZoomLevel
- the zoom level that we need nowpOldZoomLevel
- the previous zoom level that we should get the tiles to rescalepViewPort
- the view port we need tiles forpublic abstract IFilesystemCache getTileWriter()