libosmscout
0.1
|
#include <DataTileCache.h>
Public Member Functions | |
void | CleanupCache () |
Cleanup the cache. More... | |
DataTileCache (size_t cacheSize) | |
Create a new tile cache with the given cache size. More... | |
TileRef | GetCachedTile (const TileKey &id) const |
Return the cache tiles with the given id. More... | |
size_t | GetCurrentSize () const |
size_t | GetSize () const |
TileRef | GetTile (const TileKey &id) const |
Return the tile with the given id. More... | |
void | GetTilesForBoundingBox (const Magnification &magnification, const GeoBox &boundingBox, std::list< TileRef > &tiles) const |
Return all tile necessary for covering the given boundingbox using the given magnification. More... | |
void | InvalidateCache () |
Mark all tiles as in cache as "incomplete". More... | |
void | PrefillDataFromCache (Tile &tile, const TypeInfoSet &nodeTypes, const TypeInfoSet &wayTypes, const TypeInfoSet &areaTypes, const TypeInfoSet &routeTypes, const TypeInfoSet &optimizedWayTypes, const TypeInfoSet &optimizedAreaTypes) |
(Partially) prefill the given tiles with data already cached with data of the given types. More... | |
void | SetSize (size_t cacheSize) |
Change the size of the cache. More... | |
Data cache using tile based cache pages. The cache holds a number of of tiles. The maximum number of tiles hold can be configured. Tiles however will only be freed if a cleanup is explicitely triggered. So temporary overbooking can happen. This should assure that prefilling of tiles is possible even with a very low limit.
The cache will free least recently used tiles first,
|
explicit |
Create a new tile cache with the given cache size.
void osmscout::DataTileCache::CleanupCache | ( | ) |
Cleanup the cache.
Free least recently used tiles until the given maximum cache size is reached again.
Referenced by osmscout::MapService::CleanupTileCache(), and SetSize().
Return the cache tiles with the given id.
If the tiles is not cache, an empty reference will be returned.
|
inline |
Referenced by osmscout::MapService::GetCurrentCacheSize().
|
inline |
Referenced by osmscout::MapService::FlushTileCache(), and osmscout::MapService::GetCacheSize().
Return the tile with the given id.
If the tile is not currently cached return an empty and unassigned tile and move it to the front of the cache.
Referenced by GetTilesForBoundingBox(), and osmscout::MapService::LookupTile().
void osmscout::DataTileCache::GetTilesForBoundingBox | ( | const Magnification & | magnification, |
const GeoBox & | boundingBox, | ||
std::list< TileRef > & | tiles | ||
) | const |
Return all tile necessary for covering the given boundingbox using the given magnification.
References osmscout::GeoBox::GetMaxCoord(), osmscout::GeoBox::GetMinCoord(), osmscout::TileId::GetTile(), and GetTile().
Referenced by osmscout::MapService::LookupTiles().
void osmscout::DataTileCache::InvalidateCache | ( | ) |
Mark all tiles as in cache as "incomplete".
Referenced by osmscout::MapService::InvalidateTileCache().
void osmscout::DataTileCache::PrefillDataFromCache | ( | Tile & | tile, |
const TypeInfoSet & | nodeTypes, | ||
const TypeInfoSet & | wayTypes, | ||
const TypeInfoSet & | areaTypes, | ||
const TypeInfoSet & | routeTypes, | ||
const TypeInfoSet & | optimizedWayTypes, | ||
const TypeInfoSet & | optimizedAreaTypes | ||
) |
(Partially) prefill the given tiles with data already cached with data of the given types.
Currently prefill is done by looking for the parent tile in the cache and copying data that intersects the bounding box of the given tile.
References osmscout::Tile::GetBoundingBox(), osmscout::Tile::GetKey(), osmscout::Tile::GetLevel(), and osmscout::TileKey::GetParent().
void osmscout::DataTileCache::SetSize | ( | size_t | cacheSize | ) |
Change the size of the cache.
Cache will be cleaned immediately.
References CleanupCache().
Referenced by osmscout::MapService::FlushTileCache(), and osmscout::MapService::SetCacheSize().