|
libosmscout
1.1.1
|
#include <libosmscout-client-qt/include/osmscout/DBThread.h>


Public Types | |
| using | SynchronousDBJob = std::function< void(const std::list< DBInstanceRef > &)> |
Public Slots | |
| void | ToggleDaylight () |
| void | onMapDPIChange (double dpi) |
| void | SetStyleFlag (const QString &key, bool value) |
| void | ReloadStyle (const QString &suffix="") |
| void | LoadStyle (QString stylesheetFilename, std::unordered_map< std::string, bool > stylesheetFlags, const QString &suffix="") |
| void | Initialize () |
| void | onDatabaseListChanged (QList< QDir > databaseDirectories) |
| void | FlushCaches (qint64 idleMs) |
Signals | |
| void | initialisationFinished (const DatabaseLoadedResponse &response) |
| void | stylesheetFilenameChanged () |
| void | databaseLoadFinished (osmscout::GeoBox boundingBox) |
| void | styleErrorsChanged () |
Public Member Functions | |
| DBThread (QThread *backgroundThread, QString basemapLookupDirectory, QString iconDirectory, SettingsRef settings, MapManagerRef mapManager, const std::vector< std::string > &customPoiTypes) | |
| ~DBThread () override | |
| bool | isInitialized () |
| const DatabaseLoadedResponse | loadedResponse () const |
| DatabaseCoverage | databaseCoverage (const osmscout::Magnification &magnification, const osmscout::GeoBox &bbox) |
| double | GetMapDpi () const |
| double | GetPhysicalDpi () const |
| QString | GetStylesheetFilename () const |
| const QList< StyleError > & | GetStyleErrors () const |
| const QMap< QString, bool > | GetStyleFlags () const |
| void | RunJob (DBJob *job) |
| void | RunSynchronousJob (SynchronousDBJob job) |
Protected Member Functions | |
| bool | isInitializedInternal () |
Protected Attributes | |
| QThread * | backgroundThread |
| MapManagerRef | mapManager |
| QString | basemapLookupDirectory |
| SettingsRef | settings |
| double | mapDpi |
| double | physicalDpi |
| QReadWriteLock | lock |
| osmscout::BasemapDatabaseParameter | basemapDatabaseParameter |
| osmscout::BasemapDatabaseRef | basemapDatabase |
| osmscout::DatabaseParameter | databaseParameter |
| std::list< DBInstanceRef > | databases |
| QString | iconDirectory |
| std::unordered_map< std::string, bool > | stylesheetFlags |
| bool | daylight |
| bool | renderError |
| QList< StyleError > | styleErrors |
| std::vector< std::string > | customPoiTypes |
Properties | |
| QString | stylesheetFilename |
Friends | |
| class | OSMScoutQt |
Central object that manage database instances (DBInstance), its map styles (there is one global map style now) and provides simple thread-safe, asynchronous api for accessing it.
DBThread is de facto singleton, that is created and accessible by OSMScoutQt.
List of databases is protected by read-write lock. There may be multiple readers at one time. DBThread warrants that none database will be closed or modified (except thread-safe caches) when read lock is hodl. Databases may be accessed via
| using osmscout::DBThread::SynchronousDBJob = std::function<void (const std::list<DBInstanceRef> &)> |
| osmscout::DBThread::DBThread | ( | QThread * | backgroundThread, |
| QString | basemapLookupDirectory, | ||
| QString | iconDirectory, | ||
| SettingsRef | settings, | ||
| MapManagerRef | mapManager, | ||
| const std::vector< std::string > & | customPoiTypes | ||
| ) |
|
override |
| DatabaseCoverage osmscout::DBThread::databaseCoverage | ( | const osmscout::Magnification & | magnification, |
| const osmscout::GeoBox & | bbox | ||
| ) |
Test if some bounding box is covered by databases - fully, partially or not covered. Database bounding box combined with water-index is used.
| magnification | |
| bbox |
|
signal |
|
slot |
Flush all caches for database that was not used in recent idleMs
| double osmscout::DBThread::GetMapDpi | ( | ) | const |
| double osmscout::DBThread::GetPhysicalDpi | ( | ) | const |
|
inline |
| const QMap<QString,bool> osmscout::DBThread::GetStyleFlags | ( | ) | const |
|
inline |
|
signal |
|
slot |
| bool osmscout::DBThread::isInitialized | ( | ) |
|
protected |
| const DatabaseLoadedResponse osmscout::DBThread::loadedResponse | ( | ) | const |
|
slot |
|
slot |
|
slot |
|
slot |
| void osmscout::DBThread::RunJob | ( | DBJob * | job | ) |
Submit asynchronous job that will retrieve list of initialized databases and pointer to QReadLocker. Job is responsible for releasing lock when its task is finished.
| job |
| void osmscout::DBThread::RunSynchronousJob | ( | SynchronousDBJob | job | ) |
Submit synchronous job (simple lambda function) that will get access to list of initialized databases. Database read lock is hold until job is running. Lock is released automatically then. Database instances should not be accessed after it.
Example:
| job |
|
slot |
|
signal |
|
signal |
|
slot |
|
friend |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
mutableprotected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
read |
1.8.14