File indexing completed on 2024-06-23 03:50:27

0001 // SPDX-License-Identifier: LGPL-2.1-or-later
0002 //
0003 // SPDX-FileCopyrightText: 2012 Dennis Nienhüser <nienhueser@kde.org>
0004 //
0005 
0006 
0007 #ifndef MARBLE_OSMMAPQUESTRUNNER_H
0008 #define MARBLE_OSMMAPQUESTRUNNER_H
0009 
0010 #include "RoutingRunner.h"
0011 
0012 #include <QNetworkAccessManager>
0013 #include <QNetworkReply>
0014 
0015 namespace Marble
0016 {
0017 
0018 class MapQuestRunner : public RoutingRunner
0019 {
0020     Q_OBJECT
0021 
0022 public:
0023     explicit MapQuestRunner(QObject *parent = nullptr);
0024 
0025     ~MapQuestRunner() override;
0026 
0027     // Overriding MarbleAbstractRunner
0028     void retrieveRoute( const RouteRequest *request ) override;
0029 
0030 private Q_SLOTS:
0031     void get();
0032 
0033     /** Route data was retrieved via http */
0034     void retrieveData( QNetworkReply *reply );
0035 
0036     /** A network error occurred */
0037     void handleError( QNetworkReply::NetworkError );
0038 
0039 private:
0040     static void append( QString* input, const QString &key, const QString &value );
0041 
0042     static int maneuverType( int mapQuestId );
0043 
0044     GeoDataDocument* parse( const QByteArray &input ) const;
0045 
0046     QNetworkAccessManager m_networkAccessManager;
0047 
0048     QNetworkRequest m_request;
0049 };
0050 
0051 }
0052 
0053 #endif