Files
qad/libs/map/osm_downloader_p.h
peri4 d200dbdab5 version 2.21.1
Map download API
mapviewer download feature
2023-11-11 23:01:21 +03:00

69 lines
1.5 KiB
C++

/*
QAD - Qt ADvanced
Ivan Pelipenko peri4ko@yandex.ru
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef osm_downloader_h
#define osm_downloader_h
#include "osm_types_p.h"
#include <QMutex>
#include <QNetworkAccessManager>
#include <QNetworkReply>
#include <QNetworkRequest>
#include <QPixmap>
#include <QQueue>
#include <QThread>
#include <QWaitCondition>
class MapView;
class OSMDownloader: public QThread {
Q_OBJECT
public:
explicit OSMDownloader(MapView * p);
~OSMDownloader();
bool queueTile(OSM::TileIndex index, bool force = false);
void queueTiles(QList<OSM::TileIndex> indeces);
void clearQueue();
private:
void run() override;
void requestTile(OSM::TileIndex index);
MapView * parent;
QNetworkAccessManager * nam = nullptr;
QString provider;
QWaitCondition cond;
QMutex cond_mutex;
QQueue<OSM::TileIndex> queue;
QSet<quint64> in_progress;
public slots:
private slots:
signals:
void tileDone();
};
#endif