|
libosmscout 0.1
|
Cache have to be locked by its mutex() while access. More...
#include <TileCache.h>
Inheritance diagram for osmscout::TileCache:Signals | |
| void | tileRequested (uint32_t zoomLevel, uint32_t x, uint32_t y) |
Public Member Functions | |
| void | cleanupCache (uint32_t maxRemove, const std::chrono::milliseconds &maximumLifetime) |
| void | clearPendingRequests () |
| remove all pending requests TODO: in case of multiple map widgets, add some id to avoid removing requests of another widget | |
| bool | contains (uint32_t zoomLevel, uint32_t x, uint32_t y) |
| bool | containsRequest (uint32_t zoomLevel, uint32_t x, uint32_t y) |
| TileCacheVal | get (uint32_t zoomLevel, uint32_t x, uint32_t y) |
| size_t | getEpoch () const |
| void | incEpoch () |
| bool | invalidate (osmscout::GeoBox box=osmscout::GeoBox()) |
| bool | isRequestQueueEmpty () const |
| void | mergeAndStartRequests (uint32_t zoomLevel, uint32_t xtile, uint32_t ytile, uint32_t &xFrom, uint32_t &xTo, uint32_t &yFrom, uint32_t &yTo, uint32_t maxWidth, uint32_t maxHeight) |
| void | put (uint32_t zoomLevel, uint32_t x, uint32_t y, const QImage &image, size_t epoch=0) |
| bool | reemitRequests () |
| trigger request signal for all pending requests | |
| bool | removeRequest (uint32_t zoomLevel, uint32_t x, uint32_t y) |
| Remove pending request. | |
| bool | request (uint32_t zoomLevel, uint32_t x, uint32_t y) |
| try to create new tile request. | |
| bool | startRequestProcess (uint32_t zoomLevel, uint32_t x, uint32_t y) |
| TileCache (size_t cacheSize) | |
| ~TileCache () override=default | |
Cache have to be locked by its mutex() while access.
It owns all inserted tiles and it is responsible for its release
|
explicit |
|
overridedefault |
| void osmscout::TileCache::cleanupCache | ( | uint32_t | maxRemove, |
| const std::chrono::milliseconds & | maximumLifetime | ||
| ) |
first, we will iterate over all entries and remove up to maxRemove tiles older than maximumLifetime, if no such entry found and size is bigger than cacheSize, remove oldest tile
Goal is to remove more items at once and minimise frequency of this expensive cleaning
References osmscout::TileCacheVal::lastAccess.
Referenced by osmscout::TiledMapOverlay::FlushCaches(), osmscout::TiledMapRenderer::FlushVisualCaches(), put(), and osmscout::TiledMapOverlay::setEnabled().
| void osmscout::TileCache::clearPendingRequests | ( | ) |
remove all pending requests TODO: in case of multiple map widgets, add some id to avoid removing requests of another widget
Referenced by osmscout::TiledMapRenderer::onlineTilesEnabledChanged(), osmscout::TiledMapRenderer::onOfflineMapChanged(), osmscout::TileLoaderThread::onProviderChanged(), osmscout::TiledMapOverlay::paint(), and osmscout::TiledMapRenderer::RenderMap().
| bool osmscout::TileCache::contains | ( | uint32_t | zoomLevel, |
| uint32_t | x, | ||
| uint32_t | y | ||
| ) |
| bool osmscout::TileCache::containsRequest | ( | uint32_t | zoomLevel, |
| uint32_t | x, | ||
| uint32_t | y | ||
| ) |
| TileCacheVal osmscout::TileCache::get | ( | uint32_t | zoomLevel, |
| uint32_t | x, | ||
| uint32_t | y | ||
| ) |
References osmscout::TileCacheVal::lastAccess.
|
inline |
|
inline |
| bool osmscout::TileCache::invalidate | ( | osmscout::GeoBox | box = osmscout::GeoBox() | ) |
| box |
References osmscout::GeoBox::Intersects(), osmscout::GeoBox::IsValid(), osmscout::OSMTile::tileBoundingBox(), osmscout::TileCacheKey::xtile, osmscout::TileCacheKey::ytile, and osmscout::TileCacheKey::zoomLevel.
Referenced by osmscout::TiledMapRenderer::onDatabaseLoaded(), osmscout::TiledMapRenderer::onlineTileProviderChanged(), osmscout::TiledMapRenderer::onlineTilesEnabledChanged(), osmscout::TiledMapRenderer::onOfflineMapChanged(), and osmscout::TileLoaderThread::onProviderChanged().
| bool osmscout::TileCache::isRequestQueueEmpty | ( | ) | const |
Referenced by osmscout::TiledMapRenderer::RenderMap().
| void osmscout::TileCache::mergeAndStartRequests | ( | uint32_t | zoomLevel, |
| uint32_t | xtile, | ||
| uint32_t | ytile, | ||
| uint32_t & | xFrom, | ||
| uint32_t & | xTo, | ||
| uint32_t & | yFrom, | ||
| uint32_t & | yTo, | ||
| uint32_t | maxWidth, | ||
| uint32_t | maxHeight | ||
| ) |
| void osmscout::TileCache::put | ( | uint32_t | zoomLevel, |
| uint32_t | x, | ||
| uint32_t | y, | ||
| const QImage & | image, | ||
| size_t | epoch = 0 |
||
| ) |
References cleanupCache(), and removeRequest().
Referenced by osmscout::TiledMapRenderer::offlineTileRequest(), osmscout::TiledMapRenderer::onlineTileRequest(), osmscout::TiledMapRenderer::onLoadJobFinished(), osmscout::TileLoaderThread::tileDownloaded(), and osmscout::TiledMapRenderer::tileDownloaded().
| bool osmscout::TileCache::reemitRequests | ( | ) |
trigger request signal for all pending requests
References request(), and tileRequested().
Referenced by osmscout::TiledMapRenderer::onLoadJobFinished().
| bool osmscout::TileCache::removeRequest | ( | uint32_t | zoomLevel, |
| uint32_t | x, | ||
| uint32_t | y | ||
| ) |
Remove pending request.
| zoomLevel | |
| x | |
| y |
Referenced by put(), osmscout::TileLoaderThread::tileDownloadFailed(), and osmscout::TiledMapRenderer::tileDownloadFailed().
| bool osmscout::TileCache::request | ( | uint32_t | zoomLevel, |
| uint32_t | x, | ||
| uint32_t | y | ||
| ) |
try to create new tile request.
If this request don't exists already, it emit signal tileRequested and return true. Otherwise false.
References tileRequested().
Referenced by reemitRequests(), osmscout::TileLoaderThread::tileDownloadFailed(), and osmscout::TiledMapRenderer::tileDownloadFailed().
| bool osmscout::TileCache::startRequestProcess | ( | uint32_t | zoomLevel, |
| uint32_t | x, | ||
| uint32_t | y | ||
| ) |
|
signal |