public class CacheManager extends Object
Modifier and Type | Class and Description |
---|---|
static interface |
CacheManager.CacheManagerAction
Action to perform on a tile within a CacheManagerTask
|
static interface |
CacheManager.CacheManagerCallback |
static class |
CacheManager.CacheManagerDialog |
static class |
CacheManager.CacheManagerTask
generic class for common code related to AsyncTask management
- performing an action
- within a manager
- on a list of tiles (potentially sorted by ascending zoom level)
- and with callbacks for task progression
|
Modifier and Type | Field and Description |
---|---|
protected int |
mMaxZoomLevel |
protected int |
mMinZoomLevel |
protected Set<CacheManager.CacheManagerTask> |
mPendingTasks |
protected ITileSource |
mTileSource |
protected IFilesystemCache |
mTileWriter |
protected boolean |
verifyCancel |
Constructor and Description |
---|
CacheManager(ITileSource pTileSource,
IFilesystemCache pWriter,
int pMinZoomLevel,
int pMaxZoomLevel) |
CacheManager(MapTileProviderBase pTileProvider,
IFilesystemCache pWriter,
int pMinZoomLevel,
int pMaxZoomLevel)
See https://github.com/osmdroid/osmdroid/issues/619
|
CacheManager(MapView mapView) |
CacheManager(MapView mapView,
IFilesystemCache writer) |
Modifier and Type | Method and Description |
---|---|
long |
cacheCapacity() |
void |
cancelAllJobs()
cancels all tasks
|
boolean |
checkTile(long pMapTileIndex) |
CacheManager.CacheManagerTask |
cleanAreaAsync(Context ctx,
ArrayList<GeoPoint> geoPoints,
int zoomMin,
int zoomMax)
Remove all cached tiles covered by the GeoPoints list.
|
CacheManager.CacheManagerTask |
cleanAreaAsync(Context ctx,
BoundingBox bb,
int zoomMin,
int zoomMax)
Remove all cached tiles in the specified area.
|
CacheManager.CacheManagerTask |
cleanAreaAsync(Context ctx,
List<Long> tiles,
int zoomMin,
int zoomMax)
Remove all cached tiles in the specified area.
|
long |
currentCacheUsage() |
boolean |
deleteTile(long pMapTileIndex) |
long |
directorySize(File pDirectory) |
CacheManager.CacheManagerTask |
downloadAreaAsync(Context ctx,
ArrayList<GeoPoint> geoPoints,
int zoomMin,
int zoomMax)
Download in background all tiles of the specified area in osmdroid cache.
|
CacheManager.CacheManagerTask |
downloadAreaAsync(Context ctx,
ArrayList<GeoPoint> geoPoints,
int zoomMin,
int zoomMax,
CacheManager.CacheManagerCallback callback)
Download in background all tiles covered by the GePoints list in osmdroid cache.
|
CacheManager.CacheManagerTask |
downloadAreaAsync(Context ctx,
BoundingBox bb,
int zoomMin,
int zoomMax)
Download in background all tiles of the specified area in osmdroid cache.
|
CacheManager.CacheManagerTask |
downloadAreaAsync(Context ctx,
BoundingBox bb,
int zoomMin,
int zoomMax,
CacheManager.CacheManagerCallback callback)
Download in background all tiles of the specified area in osmdroid cache.
|
CacheManager.CacheManagerTask |
downloadAreaAsync(Context ctx,
List<Long> pTiles,
int zoomMin,
int zoomMax)
Download in background all tiles of the specified area in osmdroid cache.
|
CacheManager.CacheManagerTask |
downloadAreaAsyncNoUI(Context ctx,
ArrayList<GeoPoint> geoPoints,
int zoomMin,
int zoomMax,
CacheManager.CacheManagerCallback callback)
Download in background all tiles covered by the GeoPoints list in osmdroid cache without a user interface.
|
CacheManager.CacheManagerTask |
downloadAreaAsyncNoUI(Context ctx,
BoundingBox bb,
int zoomMin,
int zoomMax,
CacheManager.CacheManagerCallback callback)
Download in background all tiles of the specified area in osmdroid cache without a user interface.
|
CacheManager.CacheManagerTask |
execute(CacheManager.CacheManagerTask pTask) |
BoundingBox |
extendedBoundsFromGeoPoints(ArrayList<GeoPoint> geoPoints,
int minZoomLevel) |
boolean |
forceLoadTile(OnlineTileSourceBase tileSource,
long pMapTileIndex)
Actual tile download, regardless of the tile being already present in the cache
|
CacheManager.CacheManagerAction |
getCleaningAction() |
CacheManager.CacheManagerDialog |
getCleaningDialog(Context pCtx,
CacheManager.CacheManagerTask pTask) |
static GeoPoint |
getCoordinatesFromMapTile(int x,
int y,
int zoom)
Deprecated.
|
CacheManager.CacheManagerAction |
getDownloadingAction() |
CacheManager.CacheManagerDialog |
getDownloadingDialog(Context pCtx,
CacheManager.CacheManagerTask pTask) |
static File |
getFileName(ITileSource tileSource,
long pMapTileIndex) |
static Point |
getMapTileFromCoordinates(double aLat,
double aLon,
int zoom)
Deprecated.
|
int |
getPendingJobs() |
static Collection<Long> |
getTilesCoverage(ArrayList<GeoPoint> pGeoPoints,
int pZoomLevel)
Computes the theoretical tiles covered by the list of points
Calculation done based on http://www.movable-type.co.uk/scripts/latlong.html
|
static List<Long> |
getTilesCoverage(ArrayList<GeoPoint> pGeoPoints,
int pZoomMin,
int pZoomMax)
Computes the theoretical tiles covered by the list of points
|
static Collection<Long> |
getTilesCoverage(BoundingBox pBB,
int pZoomLevel)
Computes the theoretical tiles covered by the bounding box
|
static List<Long> |
getTilesCoverage(BoundingBox pBB,
int pZoomMin,
int pZoomMax)
Computes the theoretical tiles covered by the bounding box
|
(package private) static IterableWithSize<Long> |
getTilesCoverageIterable(BoundingBox pBB,
int pZoomMin,
int pZoomMax)
Iterable returning tiles covered by the bounding box sorted by ascending zoom level
|
static Rect |
getTilesRect(BoundingBox pBB,
int pZoomLevel)
Retrieve upper left and lower right points(exclusive) corresponding to the tiles coverage for
the selected zoom level.
|
boolean |
getVerifyCancel() |
boolean |
isTileToBeDownloaded(ITileSource pTileSource,
long pMapTileIndex)
"Should we download this tile?", either because it's not cached yet or because it's expired
|
boolean |
loadTile(OnlineTileSourceBase tileSource,
long pMapTileIndex) |
int |
possibleTilesCovered(ArrayList<GeoPoint> pGeoPoints,
int pZoomMin,
int pZoomMax) |
int |
possibleTilesInArea(BoundingBox pBB,
int pZoomMin,
int pZoomMax) |
void |
setTileDownloader(TileDownloader pTileDownloader) |
void |
setVerifyCancel(boolean state) |
protected final ITileSource mTileSource
protected final IFilesystemCache mTileWriter
protected final int mMinZoomLevel
protected final int mMaxZoomLevel
protected Set<CacheManager.CacheManagerTask> mPendingTasks
protected boolean verifyCancel
public CacheManager(MapView mapView) throws TileSourcePolicyException
TileSourcePolicyException
public CacheManager(MapView mapView, IFilesystemCache writer) throws TileSourcePolicyException
TileSourcePolicyException
public CacheManager(MapTileProviderBase pTileProvider, IFilesystemCache pWriter, int pMinZoomLevel, int pMaxZoomLevel) throws TileSourcePolicyException
TileSourcePolicyException
public CacheManager(ITileSource pTileSource, IFilesystemCache pWriter, int pMinZoomLevel, int pMaxZoomLevel) throws TileSourcePolicyException
TileSourcePolicyException
public int getPendingJobs()
@Deprecated public static Point getMapTileFromCoordinates(double aLat, double aLon, int zoom)
TileSystem.getTileXFromLongitude(double, int)
and
TileSystem.getTileYFromLatitude(double, int)
instead@Deprecated public static GeoPoint getCoordinatesFromMapTile(int x, int y, int zoom)
TileSystem.getLatitudeFromTileY(int, int)
and
TileSystem.getLongitudeFromTileX(int, int)
insteadpublic static File getFileName(ITileSource tileSource, long pMapTileIndex)
public boolean loadTile(OnlineTileSourceBase tileSource, long pMapTileIndex)
public boolean forceLoadTile(OnlineTileSourceBase tileSource, long pMapTileIndex)
public boolean deleteTile(long pMapTileIndex)
public boolean checkTile(long pMapTileIndex)
public boolean isTileToBeDownloaded(ITileSource pTileSource, long pMapTileIndex)
public static List<Long> getTilesCoverage(BoundingBox pBB, int pZoomMin, int pZoomMax)
public static Collection<Long> getTilesCoverage(BoundingBox pBB, int pZoomLevel)
static IterableWithSize<Long> getTilesCoverageIterable(BoundingBox pBB, int pZoomMin, int pZoomMax)
pBB
- the given bounding boxpZoomMin
- the given minimum zoom levelpZoomMax
- the given maximum zoom levelpublic static Rect getTilesRect(BoundingBox pBB, int pZoomLevel)
pBB
- the given bounding boxpZoomLevel
- the given zoom levelRect
reflecting the tiles coveragepublic static List<Long> getTilesCoverage(ArrayList<GeoPoint> pGeoPoints, int pZoomMin, int pZoomMax)
public static Collection<Long> getTilesCoverage(ArrayList<GeoPoint> pGeoPoints, int pZoomLevel)
public int possibleTilesInArea(BoundingBox pBB, int pZoomMin, int pZoomMax)
public int possibleTilesCovered(ArrayList<GeoPoint> pGeoPoints, int pZoomMin, int pZoomMax)
public CacheManager.CacheManagerTask execute(CacheManager.CacheManagerTask pTask)
public CacheManager.CacheManagerTask downloadAreaAsync(Context ctx, BoundingBox bb, int zoomMin, int zoomMax)
ctx
- bb
- zoomMin
- zoomMax
- public CacheManager.CacheManagerTask downloadAreaAsync(Context ctx, ArrayList<GeoPoint> geoPoints, int zoomMin, int zoomMax)
ctx
- geoPoints
- zoomMin
- zoomMax
- public CacheManager.CacheManagerTask downloadAreaAsync(Context ctx, BoundingBox bb, int zoomMin, int zoomMax, CacheManager.CacheManagerCallback callback)
ctx
- bb
- zoomMin
- zoomMax
- public CacheManager.CacheManagerTask downloadAreaAsync(Context ctx, ArrayList<GeoPoint> geoPoints, int zoomMin, int zoomMax, CacheManager.CacheManagerCallback callback)
ctx
- geoPoints
- zoomMin
- zoomMax
- public CacheManager.CacheManagerTask downloadAreaAsyncNoUI(Context ctx, ArrayList<GeoPoint> geoPoints, int zoomMin, int zoomMax, CacheManager.CacheManagerCallback callback)
ctx
- geoPoints
- zoomMin
- zoomMax
- public CacheManager.CacheManagerTask downloadAreaAsyncNoUI(Context ctx, BoundingBox bb, int zoomMin, int zoomMax, CacheManager.CacheManagerCallback callback)
ctx
- bb
- zoomMin
- zoomMax
- public void cancelAllJobs()
public CacheManager.CacheManagerTask downloadAreaAsync(Context ctx, List<Long> pTiles, int zoomMin, int zoomMax)
ctx
- pTiles
- zoomMin
- zoomMax
- public void setVerifyCancel(boolean state)
public boolean getVerifyCancel()
public CacheManager.CacheManagerDialog getDownloadingDialog(Context pCtx, CacheManager.CacheManagerTask pTask)
public CacheManager.CacheManagerDialog getCleaningDialog(Context pCtx, CacheManager.CacheManagerTask pTask)
public CacheManager.CacheManagerAction getDownloadingAction()
public CacheManager.CacheManagerAction getCleaningAction()
public CacheManager.CacheManagerTask cleanAreaAsync(Context ctx, BoundingBox bb, int zoomMin, int zoomMax)
ctx
- bb
- zoomMin
- zoomMax
- public CacheManager.CacheManagerTask cleanAreaAsync(Context ctx, ArrayList<GeoPoint> geoPoints, int zoomMin, int zoomMax)
ctx
- geoPoints
- zoomMin
- zoomMax
- public CacheManager.CacheManagerTask cleanAreaAsync(Context ctx, List<Long> tiles, int zoomMin, int zoomMax)
public BoundingBox extendedBoundsFromGeoPoints(ArrayList<GeoPoint> geoPoints, int minZoomLevel)
public long currentCacheUsage()
public long cacheCapacity()
public long directorySize(File pDirectory)
public void setTileDownloader(TileDownloader pTileDownloader)