File indexing completed on 2025-01-05 03:59:28

0001 // SPDX-License-Identifier: LGPL-2.1-or-later
0002 //
0003 // SPDX-FileCopyrightText: 2010 Dennis Nienhüser <nienhueser@kde.org>
0004 //
0005 
0006 #ifndef MARBLE_OSMNOMINATIMREVERSEGEOCODINGRUNNER_H
0007 #define MARBLE_OSMNOMINATIMREVERSEGEOCODINGRUNNER_H
0008 
0009 #include "ReverseGeocodingRunner.h"
0010 #include "GeoDataCoordinates.h"
0011 
0012 #include <QString>
0013 #include <QNetworkAccessManager>
0014 #include <QNetworkRequest>
0015 
0016 class QNetworkReply;
0017 class QDomNode;
0018 
0019 namespace Marble
0020 {
0021 
0022 class GeoDataExtendedData;
0023 
0024 class OsmNominatimRunner : public ReverseGeocodingRunner
0025 {
0026     Q_OBJECT
0027 public:
0028     explicit OsmNominatimRunner(QObject *parent = nullptr);
0029 
0030     ~OsmNominatimRunner() override;
0031 
0032     // Overriding MarbleAbstractRunner
0033     void reverseGeocoding( const GeoDataCoordinates &coordinates ) override;
0034 
0035 private Q_SLOTS:
0036 
0037     // Forward a result to the search or reverse geocoding handler
0038     void handleResult( QNetworkReply* );
0039 
0040     void returnNoReverseGeocodingResult();
0041 
0042     void startReverseGeocoding();
0043 
0044 private:
0045 
0046     static void extractChildren(const QDomNode &node, GeoDataPlacemark &placemark);
0047 
0048     QNetworkAccessManager m_manager;
0049 
0050     QNetworkRequest       m_request;
0051 
0052     GeoDataCoordinates    m_coordinates;
0053 };
0054 
0055 } // namespace Marble
0056 
0057 #endif // MARBLE_OSMNOMINATIMREVERSEGEOCODINGRUNNER_H