20 #include <unordered_map> 25 #include <boost/optional.hpp> 39 template <
typename TileCache>
60 template <
typename Tile>
75 if (cached_tiles.find(tile_id) == cached_tiles.end())
77 cached_tiles.emplace(std::make_pair(tile_id, std::move(image)));
83 : downloader([this](
TileId tile_id, QImage image) { loadedTile(std::move(tile_id), std::move(image)); }){};
100 if (cached_tiles.find(to_find) == cached_tiles.end())
114 auto const it = cached_tiles.find(to_find);
116 if (it == cached_tiles.cend())
130 for (
auto it = cached_tiles.begin(); it != cached_tiles.end();)
134 it = cached_tiles.erase(it);
166 if (cached_tiles.find(to_find) == cached_tiles.end())
bool areaContainsTile(Area const &haystack, TileId const &needle)
void request(Area const &area)
float calculate(T const &id) const
std::unordered_map< TileId, Tile > cached_tiles
detail::ErrorRateManager< std::string > error_rates
void loadTile(TileId const &tile_id)
Load a specific tile.
float getTileServerErrorRate(std::string const &tile_server) const
Calculate the error rate of a tile server.
detail::TileDownloader downloader
TileCacheGuard(TileCache const &cache_)
TileCoordinate right_bottom
void loadedTile(TileId tile_id, QImage image)
bool isAreaReady(Area const &area) const
std::mutex cachedTilesLock
void purge(Area const &area)
Tile const * ready(TileId const &to_find) const