public class TileStore extends java.lang.Object implements TileCache
| Constructor and Description |
|---|
TileStore(java.io.File rootDirectory,
java.lang.String suffix,
org.mapsforge.core.graphics.GraphicFactory graphicFactory) |
| Modifier and Type | Method and Description |
|---|---|
void |
addObserver(Observer observer) |
boolean |
containsKey(Job key) |
void |
destroy()
Destroys this cache.
|
protected java.io.File |
findFile(Job key) |
org.mapsforge.core.graphics.TileBitmap |
get(Job key) |
int |
getCapacity() |
int |
getCapacityFirstLevel() |
org.mapsforge.core.graphics.TileBitmap |
getImmediately(Job key)
Returns tileBitmap only if available at fastest cache in case of multi-layered cache, null otherwise.
|
void |
purge()
Purges this cache.
|
void |
put(Job key,
org.mapsforge.core.graphics.TileBitmap bitmap) |
void |
removeObserver(Observer observer) |
void |
setWorkingSet(java.util.Set<Job> key)
Reserves a working set in this cache, for multi-level caches this means bringing the elements in workingSet into
the fastest cache.
|
public TileStore(java.io.File rootDirectory,
java.lang.String suffix,
org.mapsforge.core.graphics.GraphicFactory graphicFactory)
rootDirectory - the directory where cached tiles will be stored.suffix - the suffix for stored tiles.graphicFactory - the mapsforge graphic factory to create tile data instances.java.lang.IllegalArgumentException - if the root directory cannot be a tile storepublic boolean containsKey(Job key)
containsKey in interface TileCacheMap.containsKey(java.lang.Object)public void destroy()
TileCacheTileCache.purge() should be used for this purpose. The earlier practice is now discouraged and may lead to
unexpected results when used with features introduced in 0.5.1 or later.public org.mapsforge.core.graphics.TileBitmap get(Job key)
public int getCapacity()
getCapacity in interface TileCachepublic int getCapacityFirstLevel()
getCapacityFirstLevel in interface TileCachepublic org.mapsforge.core.graphics.TileBitmap getImmediately(Job key)
TileCachegetImmediately in interface TileCachepublic void purge()
TileCacheTileCache.get(Job) issued after purging will not return any tiles added before the purge operation.
Applications should purge the tile cache when map model parameters change, such as the render style for locally
rendered tiles, or the source for downloaded tiles. Applications which frequently alternate between a limited
number of map model configurations may want to consider using a different cache for each.public void put(Job key, org.mapsforge.core.graphics.TileBitmap bitmap)
protected java.io.File findFile(Job key)
public void setWorkingSet(java.util.Set<Job> key)
TileCachesetWorkingSet in interface TileCachepublic void addObserver(Observer observer)
addObserver in interface ObservableInterfacepublic void removeObserver(Observer observer)
removeObserver in interface ObservableInterface