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

86 lines
1.9 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_geocoding_h
#define osm_geocoding_h
#include "qad_map_export.h"
#include <QGeoCoordinate>
#include <QJsonDocument>
#include <QObject>
#include <QPointF>
class QNetworkReply;
class QNetworkAccessManager;
class QAD_MAP_EXPORT OSMGeocodingResult: public QObject {
Q_OBJECT
friend class OSMGeocoding;
public:
void abort();
bool isEmpty() const { return res.isEmpty(); }
QJsonDocument result() const { return res; }
QString displayName() const;
QPointF resultCoordinate() const;
private:
OSMGeocodingResult(QObject * parent);
~OSMGeocodingResult();
void requestDone();
QJsonDocument res;
QNetworkReply * reply = nullptr;
signals:
void ready(OSMGeocodingResult *);
};
class QAD_MAP_EXPORT OSMGeocoding: public QObject {
Q_OBJECT
public:
static OSMGeocodingResult * queue(QPointF coord);
static OSMGeocodingResult * queue(QGeoCoordinate coord) { return queue(QPointF(coord.latitude(), coord.longitude())); }
private:
explicit OSMGeocoding();
~OSMGeocoding();
static OSMGeocoding * instance();
OSMGeocodingResult * reverseCoding(QPointF coord);
QNetworkAccessManager * nam = nullptr;
QString provider;
public slots:
private slots:
signals:
};
#endif