libosmscout  0.1
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules
osmscout::MapService Class Reference

#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 &parameter, const Magnification &magnification, const TypeDefinition &typeDefinition, std::list< TileRef > &tiles) const
 
bool 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. More...
 
bool LoadMissingTileDataAsync (const AreaSearchParameter &parameter, const Magnification &magnification, const TypeDefinition &typeDefinition, std::list< TileRef > &tiles) const
 
bool 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. 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 ()
 

Detailed Description

MapService offers services for retrieving data in a way that is helpful for drawing maps.

Currently the following functionalities are supported:

  • Get objects of a certain type in a given area and impose certain limits on the resulting data (size of area, number of objects, low zoom optimizations,...).

Member Typedef Documentation

◆ CallbackId

◆ TileStateCallback

using osmscout::MapService::TileStateCallback = std::function<void (const TileRef &)>

◆ TypeDefinitionRef

Constructor & Destructor Documentation

◆ MapService()

osmscout::MapService::MapService ( const DatabaseRef database)
explicit

◆ ~MapService()

osmscout::MapService::~MapService ( )
virtual

Member Function Documentation

◆ AddTileDataToMapData() [1/2]

void osmscout::MapService::AddTileDataToMapData ( std::list< TileRef > &  route,
MapData data 
) const

◆ AddTileDataToMapData() [2/2]

◆ CleanupTileCache()

void osmscout::MapService::CleanupTileCache ( )

Evict tiles from cache until tile count <= cacheSize.

References osmscout::DataTileCache::CleanupCache().

◆ DeregisterTileStateCallback()

void osmscout::MapService::DeregisterTileStateCallback ( CallbackId  callbackId)

◆ FlushTileCache()

void osmscout::MapService::FlushTileCache ( )

Evict all tiles from cache (tile count == 0)

References osmscout::DataTileCache::GetSize(), and osmscout::DataTileCache::SetSize().

◆ GetCacheSize()

size_t osmscout::MapService::GetCacheSize ( ) const

◆ GetCurrentCacheSize()

size_t osmscout::MapService::GetCurrentCacheSize ( ) const

◆ GetGroundTiles() [1/2]

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.

Note
The returned ground tiles may result in a bigger area than given.
Parameters
boundingBoxBoundary coordinates
magnificationMagnification
tilesList of returned tiles
Returns
False, if there was an error, else true.

References osmscout::Log::Error(), osmscout::log, and osmscout::StopClock::Stop().

◆ GetGroundTiles() [2/2]

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).

Note
The returned ground tiles may result in a bigger area than given.
Parameters
projectionprojection defining bounding box and magnification
tilesList of returned tiles
Returns
False, if there was an error, else true.

References osmscout::Projection::GetDimensions(), and osmscout::Projection::GetMagnification().

◆ GetSRTMData() [1/2]

SRTMDataRef osmscout::MapService::GetSRTMData ( const GeoBox boundingBox) const

◆ GetSRTMData() [2/2]

SRTMDataRef osmscout::MapService::GetSRTMData ( const Projection projection) const

◆ InvalidateTileCache()

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().

◆ LoadMissingTileData() [1/2]

bool osmscout::MapService::LoadMissingTileData ( const AreaSearchParameter parameter,
const Magnification magnification,
const TypeDefinition typeDefinition,
std::list< TileRef > &  tiles 
) const

◆ LoadMissingTileData() [2/2]

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.

◆ LoadMissingTileDataAsync() [1/2]

bool osmscout::MapService::LoadMissingTileDataAsync ( const AreaSearchParameter parameter,
const Magnification magnification,
const TypeDefinition typeDefinition,
std::list< TileRef > &  tiles 
) const

◆ LoadMissingTileDataAsync() [2/2]

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.

◆ LookupTile()

TileRef osmscout::MapService::LookupTile ( const TileKey key) const

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().

◆ LookupTiles() [1/2]

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().

◆ LookupTiles() [2/2]

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().

◆ RegisterTileStateCallback()

MapService::CallbackId osmscout::MapService::RegisterTileStateCallback ( TileStateCallback  callback)

◆ SetCacheSize()

void osmscout::MapService::SetCacheSize ( size_t  cacheSize)

Set the size of the tile data cache.

References osmscout::DataTileCache::SetSize().


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