|
libosmscout 0.1
|
Cache have to be locked by its mutex() while access. More...
#include <TileCache.h>
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 |
Referenced by tileRequested().
|
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(), put(), osmscout::TiledMapOverlay::setEnabled(), and ~TileCache().
| 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::TiledMapOverlay::paint(), and ~TileCache().
| bool osmscout::TileCache::contains | ( | uint32_t | zoomLevel, |
| uint32_t | x, | ||
| uint32_t | y ) |
Referenced by ~TileCache().
| bool osmscout::TileCache::containsRequest | ( | uint32_t | zoomLevel, |
| uint32_t | x, | ||
| uint32_t | y ) |
Referenced by ~TileCache().
| TileCacheVal osmscout::TileCache::get | ( | uint32_t | zoomLevel, |
| uint32_t | x, | ||
| uint32_t | y ) |
References osmscout::TileCacheVal::lastAccess.
Referenced by ~TileCache().
|
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 ~TileCache().
| bool osmscout::TileCache::isRequestQueueEmpty | ( | ) | const |
Referenced by ~TileCache().
| 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 ) |
References osmscout::RequestState::pending, osmscout::TileCacheKey::xtile, osmscout::TileCacheKey::ytile, and osmscout::TileCacheKey::zoomLevel.
Referenced by ~TileCache().
| 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 ~TileCache().
| bool osmscout::TileCache::reemitRequests | ( | ) |
trigger request signal for all pending requests
References request(), and tileRequested().
Referenced by ~TileCache().
| bool osmscout::TileCache::removeRequest | ( | uint32_t | zoomLevel, |
| uint32_t | x, | ||
| uint32_t | y ) |
Remove pending request.
| zoomLevel | |
| x | |
| y |
Referenced by put(), and ~TileCache().
| 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(), and ~TileCache().
| bool osmscout::TileCache::startRequestProcess | ( | uint32_t | zoomLevel, |
| uint32_t | x, | ||
| uint32_t | y ) |
References osmscout::RequestState::pending.
Referenced by ~TileCache().
|
signal |
References TileCache().
Referenced by osmscout::TileLoaderThread::init(), reemitRequests(), request(), and osmscout::TiledMapRenderer::TiledMapRenderer().