libosmscout 0.1
Loading...
Searching...
No Matches
osmscout::OSMScoutQt Class Reference

Singleton that provides access to high level modules of OSMScout library. More...

#include <OSMScoutQt.h>

Inheritance diagram for osmscout::OSMScoutQt:

Public Slots

void threadFinished ()

Public Member Functions

QString GetCacheLocation () const
DBThreadRef GetDBThread () const
QString GetEspeakDataDir () const
QString GetIconDirectory () const
MapDownloaderRef GetMapDownloader ()
MapManagerRef GetMapManager () const
QString GetNavigationTranslationDir () const
size_t GetOnlineTileCacheSize () const
SettingsRef GetSettings () const
QString GetUserAgent () const
VoiceManagerRef GetVoiceManager ()
ElevationModule * MakeElevationModule ()
IconLookup * MakeIconLookup ()
LookupModule * MakeLookupModule ()
MapRenderer * MakeMapRenderer (RenderingType type)
NavigationModule * MakeNavigation ()
POILookupModule * MakePOILookupModule ()
Router * MakeRouter ()
SearchModule * MakeSearchModule ()
StyleModule * MakeStyleModule ()
QThread * makeThread (QString name)
 Create new background thread with given name.
bool waitForReleasingResources (unsigned long mSleep, unsigned long maxCount) const
 Wait for releasing of dbThread shared pointer from other threads and terminating all created service threads.
 ~OSMScoutQt () override

Static Public Member Functions

static void FreeInstance ()
static OSMScoutQt & GetInstance ()
static OSMScoutQtBuilder NewInstance ()
static void RegisterQmlTypes (const char *uri="net.sf.libosmscout.map", int versionMajor=1, int versionMinor=0)

Friends

class OSMScoutQtBuilder

Detailed Description

Singleton that provides access to high level modules of OSMScout library.

On application start should be registered Qt types by static method RegisterQmlTypes(). OSMScoutQt instance may be created by NewInstance() and accessed by GetInstance() then. To free resources should be called FreeInstance() before program exits.

Example:

.WithStyleSheetDirectory(stylesheetDir)
.WithStyleSheetFile(stylesheetFileName)
.WithIconDirectory(iconDirectory)
.WithMapLookupDirectories(mapLookupDirectories)
.AddOnlineTileProviders(":/resources/online-tile-providers.json")
.AddMapProviders(":/resources/map-providers.json")
.Init();
if (!success){
// terminate program, or just report error - something is really bad
}
// now it is possible to access OSMScoutQt by OSMScoutQt::GetInstance()
OSMScoutQtBuilder & WithBasemapLookupDirectory(const QString &basemapLookupDirectory)
Definition OSMScoutQt.h:130
OSMScoutQtBuilder & WithStyleSheetDirectory(const QString &styleSheetDirectory)
Definition OSMScoutQt.h:172
OSMScoutQtBuilder & WithIconDirectory(const QString &iconDirectory)
Definition OSMScoutQt.h:166
bool Init()
Definition OSMScoutQt.cpp:85
OSMScoutQtBuilder & WithMapLookupDirectories(const QStringList &mapLookupDirectories)
Definition OSMScoutQt.h:124
OSMScoutQtBuilder & WithStyleSheetFile(QString styleSheetFile)
Definition OSMScoutQt.h:179
OSMScoutQtBuilder & AddMapProviders(const QString &mapProviders)
Definition OSMScoutQt.h:112
OSMScoutQtBuilder & AddOnlineTileProviders(const QString &onlineTileProviders)
Definition OSMScoutQt.h:106
static OSMScoutQtBuilder NewInstance()
Definition OSMScoutQt.cpp:279
static void RegisterQmlTypes(const char *uri="net.sf.libosmscout.map", int versionMajor=1, int versionMinor=0)
Definition OSMScoutQt.cpp:197
static void FreeInstance()
Definition OSMScoutQt.cpp:290

Constructor & Destructor Documentation

◆ ~OSMScoutQt()

osmscout::OSMScoutQt::~OSMScoutQt ( )
override

Member Function Documentation

◆ FreeInstance()

void osmscout::OSMScoutQt::FreeInstance ( )
static

◆ GetCacheLocation()

QString osmscout::OSMScoutQt::GetCacheLocation ( ) const

◆ GetDBThread()

◆ GetEspeakDataDir()

QString osmscout::OSMScoutQt::GetEspeakDataDir ( ) const

Referenced by OSMScoutQtBuilder.

◆ GetIconDirectory()

QString osmscout::OSMScoutQt::GetIconDirectory ( ) const

Referenced by OSMScoutQtBuilder.

◆ GetInstance()

OSMScoutQt & osmscout::OSMScoutQt::GetInstance ( )
static

References osmscout::osmScoutInstance.

Referenced by osmscout::AvailableMapsModel::AvailableMapsModel(), osmscout::AvailableVoicesModel::AvailableVoicesModel(), osmscout::OsmTileDownloader::download(), osmscout::ElevationChartWidget::ElevationChartWidget(), osmscout::MapWidget::firstStylesheetErrorColumn(), osmscout::MapWidget::firstStylesheetErrorDescription(), osmscout::MapWidget::firstStylesheetErrorLine(), osmscout::MapDownloadsModel::getLookupDirectories(), osmscout::MapStyleModel::getStyle(), osmscout::MapWidget::GetStylesheetFilename(), osmscout::TileLoaderThread::init(), osmscout::InstalledMapsModel::InstalledMapsModel(), osmscout::InstalledVoicesModel::InstalledVoicesModel(), osmscout::MapWidget::isDatabaseLoaded(), osmscout::MapWidget::isInDatabaseBoundingBox(), osmscout::AvailableVoicesModel::listDownloaded(), osmscout::LocationInfoModel::LocationInfoModel(), osmscout::LocationListModel::LocationListModel(), osmscout::MapDownloadsModel::MapDownloadsModel(), osmscout::MapObjectInfoModel::MapObjectInfoModel(), osmscout::MapStyleModel::MapStyleModel(), osmscout::MapWidget::MapWidget(), osmscout::NavigationModel::NavigationModel(), osmscout::NearPOIModel::NearPOIModel(), osmscout::OnlineTileProviderModel::OnlineTileProviderModel(), OSMScoutQtBuilder, osmscout::InstalledVoicesModel::playTTSSample(), osmscout::QmlSettings::QmlSettings(), osmscout::MapWidget::recenter(), osmscout::AvailableMapsModel::reload(), osmscout::AvailableVoicesModel::reload(), osmscout::VoiceManager::reload(), osmscout::MapWidget::reloadStyle(), osmscout::MapWidget::reloadTmpStyle(), osmscout::LookupModule::requestLocationDescription(), osmscout::LookupModule::requestRegionLookup(), osmscout::RoutingListModel::RoutingListModel(), osmscout::SearchModule::SearchForLocations(), osmscout::StyleFlagsModel::setFlag(), osmscout::MapWidget::setInteractiveIcons(), osmscout::MapStyleModel::setStyle(), osmscout::FileDownloader::startDownload(), osmscout::StyleFlagsModel::StyleFlagsModel(), osmscout::MapWidget::stylesheetHasErrors(), osmscout::MapDownloadsModel::suggestedDirectory(), osmscout::TiledMapOverlay::TiledMapOverlay(), osmscout::MapWidget::toggleDaylight(), and osmscout::VoiceManager::VoiceManager().

◆ GetMapDownloader()

MapDownloaderRef osmscout::OSMScoutQt::GetMapDownloader ( )

◆ GetMapManager()

◆ GetNavigationTranslationDir()

QString osmscout::OSMScoutQt::GetNavigationTranslationDir ( ) const

◆ GetOnlineTileCacheSize()

size_t osmscout::OSMScoutQt::GetOnlineTileCacheSize ( ) const

Referenced by OSMScoutQtBuilder.

◆ GetSettings()

◆ GetUserAgent()

QString osmscout::OSMScoutQt::GetUserAgent ( ) const

Referenced by OSMScoutQtBuilder.

◆ GetVoiceManager()

◆ MakeElevationModule()

ElevationModule * osmscout::OSMScoutQt::MakeElevationModule ( )

◆ MakeIconLookup()

IconLookup * osmscout::OSMScoutQt::MakeIconLookup ( )

◆ MakeLookupModule()

◆ MakeMapRenderer()

MapRenderer * osmscout::OSMScoutQt::MakeMapRenderer ( RenderingType type)

References makeThread(), and osmscout::TiledRendering.

Referenced by OSMScoutQtBuilder.

◆ MakeNavigation()

NavigationModule * osmscout::OSMScoutQt::MakeNavigation ( )

◆ MakePOILookupModule()

POILookupModule * osmscout::OSMScoutQt::MakePOILookupModule ( )

◆ MakeRouter()

Router * osmscout::OSMScoutQt::MakeRouter ( )

◆ MakeSearchModule()

SearchModule * osmscout::OSMScoutQt::MakeSearchModule ( )

◆ MakeStyleModule()

StyleModule * osmscout::OSMScoutQt::MakeStyleModule ( )

◆ makeThread()

QThread * osmscout::OSMScoutQt::makeThread ( QString name)

Create new background thread with given name.

Usage:

QThread *t=OSMScoutQt::GetInstance().makeThread("OverlayTileLoader"); Service *service=new Service(t); service->moveToThread(thread); connect(thread, SIGNAL(started()), service, SLOT(init())); thread->start();

Service should stop thread in own destructor: QThread::quit()

Parameters
name
Returns
thread

References threadFinished().

Referenced by MakeElevationModule(), MakeIconLookup(), MakeLookupModule(), MakeMapRenderer(), MakeNavigation(), MakeRouter(), MakeSearchModule(), MakeStyleModule(), OSMScoutQtBuilder, and osmscout::TiledMapOverlay::TiledMapOverlay().

◆ NewInstance()

OSMScoutQtBuilder osmscout::OSMScoutQt::NewInstance ( )
static

References OSMScoutQtBuilder.

Referenced by OSMScoutQtBuilder.

◆ RegisterQmlTypes()

void osmscout::OSMScoutQt::RegisterQmlTypes ( const char * uri = "net.sf.libosmscout.map",
int versionMajor = 1,
int versionMinor = 0 )
static

Referenced by OSMScoutQtBuilder.

◆ threadFinished

void osmscout::OSMScoutQt::threadFinished ( )
slot

Referenced by makeThread(), and OSMScoutQtBuilder.

◆ waitForReleasingResources()

bool osmscout::OSMScoutQt::waitForReleasingResources ( unsigned long mSleep,
unsigned long maxCount ) const

Wait for releasing of dbThread shared pointer from other threads and terminating all created service threads.

This waiting has configurable timeout, up to [mSleep * maxCount] milliseconds.

Note that on success, this method don't guarantee that dbThread is not used from another thread, see std::shared_ptr::use_count() documentation.

Parameters
mSleepwait period between checks (in milliseconds)
maxCountmaximul count
Returns
true if dbThread is holding just from current thread (dbThread.use_count() == 1) and all previously created service threads are terminated.

Referenced by OSMScoutQtBuilder.

◆ OSMScoutQtBuilder


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