Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
TileCache< Tile > Class Template Reference

A cache for tiles. More...

#include <tile_cache.h>

Inheritance diagram for TileCache< Tile >:
Inheritance graph
[legend]

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
 

Detailed Description

template<typename Tile>
class TileCache< Tile >

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.

Constructor & Destructor Documentation

◆ TileCache()

template<typename Tile>
TileCache< Tile >::TileCache ( )
inline

Definition at line 82 of file tile_cache.h.

Member Function Documentation

◆ getTileServerErrorRate()

template<typename Tile>
float TileCache< Tile >::getTileServerErrorRate ( std::string const &  tile_server) const
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.

◆ isAreaReady()

template<typename Tile>
bool TileCache< Tile >::isAreaReady ( Area const &  area) const
inlineprotected

Are all tiles in the area cached?

Note
You have to use TileCacheGuard to guard this function call.

Definition at line 158 of file tile_cache.h.

◆ loadedTile()

template<typename Tile>
void TileCache< Tile >::loadedTile ( TileId  tile_id,
QImage  image 
)
inlineprivate

Callback for downloader

Definition at line 71 of file tile_cache.h.

◆ purge()

template<typename Tile>
void TileCache< Tile >::purge ( Area const &  area)
inline

Remove tiles from cache that are not in the area (anymore)

Note
You have to use TileCacheGuard to guard this function call.

Definition at line 128 of file tile_cache.h.

◆ ready()

template<typename Tile>
Tile const* TileCache< Tile >::ready ( TileId const &  to_find) const
inline

Is the tile to_find cached? If yes, return the associated Tile.

Note
You have to use TileCacheGuard to guard this function call and the returned tile.

Definition at line 112 of file tile_cache.h.

◆ request()

template<typename Tile>
void TileCache< Tile >::request ( Area const &  area)
inline

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.

Member Data Documentation

◆ cached_tiles

template<typename Tile>
std::unordered_map<TileId, Tile> TileCache< Tile >::cached_tiles
private

Definition at line 64 of file tile_cache.h.

◆ cachedTilesLock

template<typename Tile>
std::mutex TileCache< Tile >::cachedTilesLock
mutableprivate

Definition at line 65 of file tile_cache.h.

◆ downloader

template<typename Tile>
detail::TileDownloader TileCache< Tile >::downloader
private

Definition at line 66 of file tile_cache.h.

◆ TileCacheGuard

template<typename Tile>
friend TileCache< Tile >::TileCacheGuard
private

Definition at line 63 of file tile_cache.h.


The documentation for this class was generated from the following file:


rviz_satellite
Author(s): Gareth Cross , Andre Schröder
autogenerated on Thu May 4 2023 02:31:43