libosmscout 1.1.1
Loading...
Searching...
No Matches
DBLoadJob.h
Go to the documentation of this file.
1#ifndef OSMSCOUT_CLIENT_QT_DBLOADJOB_H
2#define OSMSCOUT_CLIENT_QT_DBLOADJOB_H
3
4/*
5 OSMScout - a Qt backend for libosmscout and libosmscout-map
6 Copyright (C) 2017 Lukas Karas
7
8 This library is free software; you can redistribute it and/or
9 modify it under the terms of the GNU Lesser General Public
10 License as published by the Free Software Foundation; either
11 version 2.1 of the License, or (at your option) any later version.
12
13 This library is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 Lesser General Public License for more details.
17
18 You should have received a copy of the GNU Lesser General Public
19 License along with this library; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */
22
23#include <QObject>
24#include <QHash>
25#include <QList>
26#include <QThread>
27#include <QMap>
28
30
32
34
35#include <osmscoutclient/DBInstance.h>
36#include <osmscoutclient/DBJob.h>
37
39
40#include <shared_mutex>
41
42namespace osmscout {
43
47class OSMSCOUT_CLIENT_QT_API DBLoadJob : public QObject, public DBJob {
48 Q_OBJECT
49
50private:
51 bool closeOnFinish;
53 osmscout::MercatorProjection lookupProjection;
54 osmscout::AreaSearchParameter searchParameter;
55 QMap<QString,osmscout::MapService::CallbackId> callbacks;
56
57 QMap<QString,QMap<osmscout::TileKey,osmscout::TileRef>> allTiles;
58 QMap<QString,QMap<osmscout::TileKey,osmscout::TileRef>> loadingTiles;
59 QMap<QString,QMap<osmscout::TileKey,osmscout::TileRef>> loadedTiles;
60
61protected slots:
62 void onTileStateChanged(QString dbPath,const osmscout::TileRef tile);
63
64signals:
68 void tileStateChanged(QString dbPath,const osmscout::TileRef tile);
69
70 void databaseLoaded(QString dbPath,QList<osmscout::TileRef> tiles);
71
72 void finished(QMap<QString,QMap<osmscout::TileKey,osmscout::TileRef>> tiles);
73
74public:
76 unsigned long maximumAreaLevel,
77 bool lowZoomOptimization,
78 bool closeOnFinish=true);
79
80 ~DBLoadJob() override;
81
82 void Run(const osmscout::BasemapDatabaseRef& basemapDatabase,
83 const std::list<DBInstanceRef> &databases,
84 ReadLock &&locker) override;
85
86 void Close() override;
87
88 bool IsFinished() const;
89 QMap<QString,QMap<osmscout::TileKey,osmscout::TileRef>> GetAllTiles() const;
90
100 bool AddTileDataToMapData(QString dbPath,
101 const QList<osmscout::TileRef> &tiles,
102 osmscout::MapData &data);
103};
104
105}
106
107#endif /* OSMSCOUT_CLIENT_QT_DBLOADJOB_H */
#define OSMSCOUT_CLIENT_QT_API
Definition ClientQtImportExport.h:45
Definition MapService.h:54
DBLoadJob(osmscout::MercatorProjection lookupProjection, unsigned long maximumAreaLevel, bool lowZoomOptimization, bool closeOnFinish=true)
void databaseLoaded(QString dbPath, QList< osmscout::TileRef > tiles)
QMap< QString, QMap< osmscout::TileKey, osmscout::TileRef > > GetAllTiles() const
~DBLoadJob() override
void tileStateChanged(QString dbPath, const osmscout::TileRef tile)
void Close() override
void Run(const osmscout::BasemapDatabaseRef &basemapDatabase, const std::list< DBInstanceRef > &databases, ReadLock &&locker) override
bool IsFinished() const
void finished(QMap< QString, QMap< osmscout::TileKey, osmscout::TileRef > > tiles)
bool AddTileDataToMapData(QString dbPath, const QList< osmscout::TileRef > &tiles, osmscout::MapData &data)
void onTileStateChanged(QString dbPath, const osmscout::TileRef tile)
Definition MercatorProjection.h:40
Definition ReadWriteLock.h:115
std::shared_ptr< Tile > TileRef
Definition DataTileCache.h:443
Definition Area.h:39
std::shared_ptr< Breaker > BreakerRef
Definition Breaker.h:64
std::shared_ptr< BasemapDatabase > BasemapDatabaseRef
Reference counted reference to an Database instance.
Definition BasemapDatabase.h:88