libosmscout
0.1
|
#include <MapService.h>
Classes | |
class | TypeDefinition |
Public Types | |
using | CallbackId = size_t |
using | TileStateCallback = std::function< void(const TileRef &)> |
using | TypeDefinitionRef = std::shared_ptr< TypeDefinition > |
Public Member Functions | |
void | AddTileDataToMapData (std::list< TileRef > &route, MapData &data) const |
Convert the data hold by the given tiles to the given MapData class instance. More... | |
void | AddTileDataToMapData (std::list< TileRef > &tiles, const TypeDefinition &typeDefinition, MapData &data) const |
Convert the data hold by the given tiles to the given MapData class instance. More... | |
void | CleanupTileCache () |
Evict tiles from cache until tile count <= cacheSize. More... | |
void | DeregisterTileStateCallback (CallbackId callbackId) |
void | FlushTileCache () |
Evict all tiles from cache (tile count == 0) More... | |
size_t | GetCacheSize () const |
size_t | GetCurrentCacheSize () const |
bool | GetGroundTiles (const GeoBox &boundingBox, const Magnification &magnification, std::list< GroundTile > &tiles) const |
Return all ground tiles for the given area and the given magnification. More... | |
bool | GetGroundTiles (const Projection &projection, std::list< GroundTile > &tiles) const |
Return all ground tiles for the given projection data (bounding box and magnification). More... | |
SRTMDataRef | GetSRTMData (const GeoBox &boundingBox) const |
SRTMDataRef | GetSRTMData (const Projection &projection) const |
void | InvalidateTileCache () |
Mark all tiles in cache as incomplete, while keeping all data and type information stored in it. More... | |
bool | LoadMissingTileData (const AreaSearchParameter ¶meter, const Magnification &magnification, const TypeDefinition &typeDefinition, std::list< TileRef > &tiles) const |
bool | LoadMissingTileData (const AreaSearchParameter ¶meter, const StyleConfig &styleConfig, std::list< TileRef > &tiles) const |
Load all missing data for the given tiles based on the given style config. More... | |
bool | LoadMissingTileDataAsync (const AreaSearchParameter ¶meter, const Magnification &magnification, const TypeDefinition &typeDefinition, std::list< TileRef > &tiles) const |
bool | LoadMissingTileDataAsync (const AreaSearchParameter ¶meter, const StyleConfig &styleConfig, std::list< TileRef > &tiles) const |
Load all missing data for the given tiles based on the given style config. More... | |
TileRef | LookupTile (const TileKey &key) const |
Return the given tile. More... | |
void | LookupTiles (const Magnification &magnification, const GeoBox &boundingBox, std::list< TileRef > &tiles) const |
Return all tiles with the given covering the region given by the boundingBox. More... | |
void | LookupTiles (const Projection &projection, std::list< TileRef > &tiles) const |
Return all tiles with the magnification defined by the projection that cover the region covered by the projection. More... | |
MapService (const DatabaseRef &database) | |
CallbackId | RegisterTileStateCallback (TileStateCallback callback) |
void | SetCacheSize (size_t cacheSize) |
Set the size of the tile data cache. More... | |
virtual | ~MapService () |
MapService offers services for retrieving data in a way that is helpful for drawing maps.
Currently the following functionalities are supported:
using osmscout::MapService::CallbackId = size_t |
using osmscout::MapService::TileStateCallback = std::function<void (const TileRef &)> |
using osmscout::MapService::TypeDefinitionRef = std::shared_ptr<TypeDefinition> |
|
explicit |
|
virtual |
void osmscout::MapService::AddTileDataToMapData | ( | std::list< TileRef > & | route, |
MapData & | data | ||
) | const |
Convert the data hold by the given tiles to the given MapData class instance.
References osmscout::MapData::areas, osmscout::StopClock::GetMilliseconds(), osmscout::log, osmscout::MapData::nodes, osmscout::StopClock::ResultString(), osmscout::MapData::routes, osmscout::StopClock::Stop(), osmscout::Log::Warn(), and osmscout::MapData::ways.
void osmscout::MapService::AddTileDataToMapData | ( | std::list< TileRef > & | tiles, |
const TypeDefinition & | typeDefinition, | ||
MapData & | data | ||
) | const |
Convert the data hold by the given tiles to the given MapData class instance.
References osmscout::MapData::areas, osmscout::MapService::TypeDefinition::areaTypes, osmscout::StopClock::GetMilliseconds(), osmscout::TypeInfoSet::IsSet(), osmscout::log, osmscout::MapData::nodes, osmscout::MapService::TypeDefinition::nodeTypes, osmscout::MapService::TypeDefinition::optimizedAreaTypes, osmscout::MapService::TypeDefinition::optimizedWayTypes, osmscout::StopClock::ResultString(), osmscout::StopClock::Stop(), osmscout::Log::Warn(), osmscout::MapData::ways, and osmscout::MapService::TypeDefinition::wayTypes.
void osmscout::MapService::CleanupTileCache | ( | ) |
Evict tiles from cache until tile count <= cacheSize.
References osmscout::DataTileCache::CleanupCache().
void osmscout::MapService::DeregisterTileStateCallback | ( | CallbackId | callbackId | ) |
void osmscout::MapService::FlushTileCache | ( | ) |
Evict all tiles from cache (tile count == 0)
References osmscout::DataTileCache::GetSize(), and osmscout::DataTileCache::SetSize().
size_t osmscout::MapService::GetCacheSize | ( | ) | const |
References osmscout::DataTileCache::GetSize().
size_t osmscout::MapService::GetCurrentCacheSize | ( | ) | const |
References osmscout::DataTileCache::GetCurrentSize().
bool osmscout::MapService::GetGroundTiles | ( | const GeoBox & | boundingBox, |
const Magnification & | magnification, | ||
std::list< GroundTile > & | tiles | ||
) | const |
Return all ground tiles for the given area and the given magnification.
boundingBox | Boundary coordinates |
magnification | Magnification |
tiles | List of returned tiles |
References osmscout::Log::Error(), osmscout::log, and osmscout::StopClock::Stop().
bool osmscout::MapService::GetGroundTiles | ( | const Projection & | projection, |
std::list< GroundTile > & | tiles | ||
) | const |
Return all ground tiles for the given projection data (bounding box and magnification).
projection | projection defining bounding box and magnification |
tiles | List of returned tiles |
References osmscout::Projection::GetDimensions(), and osmscout::Projection::GetMagnification().
SRTMDataRef osmscout::MapService::GetSRTMData | ( | const GeoBox & | boundingBox | ) | const |
References osmscout::Log::Error(), osmscout::log, and osmscout::StopClock::Stop().
SRTMDataRef osmscout::MapService::GetSRTMData | ( | const Projection & | projection | ) | const |
References osmscout::Projection::GetDimensions().
void osmscout::MapService::InvalidateTileCache | ( | ) |
Mark all tiles in cache as incomplete, while keeping all data and type information stored in it.
References osmscout::DataTileCache::InvalidateCache().
bool osmscout::MapService::LoadMissingTileData | ( | const AreaSearchParameter & | parameter, |
const Magnification & | magnification, | ||
const TypeDefinition & | typeDefinition, | ||
std::list< TileRef > & | tiles | ||
) | const |
bool osmscout::MapService::LoadMissingTileData | ( | const AreaSearchParameter & | parameter, |
const StyleConfig & | styleConfig, | ||
std::list< TileRef > & | tiles | ||
) | const |
Load all missing data for the given tiles based on the given style config.
The method returns, either after an error occurred or all tiles have been successfully loaded.
bool osmscout::MapService::LoadMissingTileDataAsync | ( | const AreaSearchParameter & | parameter, |
const Magnification & | magnification, | ||
const TypeDefinition & | typeDefinition, | ||
std::list< TileRef > & | tiles | ||
) | const |
bool osmscout::MapService::LoadMissingTileDataAsync | ( | const AreaSearchParameter & | parameter, |
const StyleConfig & | styleConfig, | ||
std::list< TileRef > & | tiles | ||
) | const |
Load all missing data for the given tiles based on the given style config.
This method just triggers the loading but may return before all data has been loaded. Loading of tile data happens in the background. You have to register a callback to get notified about tile loading state.Dr
You can be sure, that callbacks are not called in the context of the calling thread.
Return the given tile.
Note, that tiles may be partially prefilled or empty, if not already cached.
References osmscout::DataTileCache::GetTile(), and osmscout::StopClock::Stop().
void osmscout::MapService::LookupTiles | ( | const Magnification & | magnification, |
const GeoBox & | boundingBox, | ||
std::list< TileRef > & | tiles | ||
) | const |
Return all tiles with the given covering the region given by the boundingBox.
Note, that tiles may be partially prefill or empty, if not already cached.
References osmscout::DataTileCache::GetTilesForBoundingBox(), and osmscout::StopClock::Stop().
void osmscout::MapService::LookupTiles | ( | const Projection & | projection, |
std::list< TileRef > & | tiles | ||
) | const |
Return all tiles with the magnification defined by the projection that cover the region covered by the projection.
Note, that tiles may be partially prefill or empty, if not already cached.
References osmscout::Projection::GetDimensions(), osmscout::Projection::GetMagnification(), osmscout::DataTileCache::GetTilesForBoundingBox(), and osmscout::StopClock::Stop().
MapService::CallbackId osmscout::MapService::RegisterTileStateCallback | ( | TileStateCallback | callback | ) |
void osmscout::MapService::SetCacheSize | ( | size_t | cacheSize | ) |
Set the size of the tile data cache.
References osmscout::DataTileCache::SetSize().