#include <tile_cache.h>
Public Member Functions | |
float | getTileServerErrorRate (std::string const &tile_server) const |
Calculate the error rate of a tile server. More... | |
void | purge (Area const &area) |
Tile const * | ready (TileId const &to_find) const |
void | request (Area const &area) |
TileCache () | |
Protected Member Functions | |
bool | isAreaReady (Area const &area) const |
Private Member Functions | |
void | loadedTile (TileId tile_id, QImage image) |
Private Attributes | |
std::unordered_map< TileId, Tile > | cached_tiles |
std::mutex | cachedTilesLock |
detail::TileDownloader | downloader |
friend | TileCacheGuard |
A cache for tiles.
The main purpose of this class is to synchronize the GPS nav fix callback with the rendering callback. They both happen in parallel - therefore we have to cache the tiles when we request them until they are drawn. This class provides an interface to request tiles and then access them later on (when they are drawn).
Tiles will be either loaded from the file system (after they have been cached) or from a tile server.
Definition at line 61 of file tile_cache.h.
Definition at line 82 of file tile_cache.h.
|
inline |
Calculate the error rate of a tile server.
error rate = number of HTTP requests that resulted in an error / total number of HTTP requests
Definition at line 148 of file tile_cache.h.
|
inlineprotected |
Are all tiles in the area cached?
Definition at line 158 of file tile_cache.h.
|
inlineprivate |
Callback for downloader
Definition at line 71 of file tile_cache.h.
Remove tiles from cache that are not in the area
(anymore)
Definition at line 128 of file tile_cache.h.
Is the tile to_find
cached? If yes, return the associated Tile.
Definition at line 112 of file tile_cache.h.
Load a rectangular area of tiles
The requested tiles will be loaded into this cache from either the file system or an online tile server.
Definition at line 90 of file tile_cache.h.
Definition at line 64 of file tile_cache.h.
|
mutableprivate |
Definition at line 65 of file tile_cache.h.
|
private |
Definition at line 66 of file tile_cache.h.
|
private |
Definition at line 63 of file tile_cache.h.