add Map inverse geocoding

add minimum/maximum to ScrollSpinBox
This commit is contained in:
2023-02-05 21:24:30 +03:00
parent 29aa0bda29
commit 3c29b7b566
9 changed files with 238 additions and 5 deletions

84
libs/map/osm_geocoding.h Normal file
View File

@@ -0,0 +1,84 @@
/*
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 <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();
};
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