File indexing completed on 2024-07-21 09:27:05

0001 // SPDX-License-Identifier: LGPL-2.1-or-later
0002 //
0003 // SPDX-FileCopyrightText: 2013 Mihail Ivchenko <ematirov@gmail.com>
0004 //
0005 
0006 
0007 #ifndef MARBLE_CYCLESTREETSRUNNER_H
0008 #define MARBLE_CYCLESTREETSRUNNER_H
0009 
0010 #include "RoutingRunner.h"
0011 
0012 #include <QNetworkAccessManager>
0013 #include <QNetworkReply>
0014 
0015 namespace Marble
0016 {
0017 
0018 class CycleStreetsRunner : public RoutingRunner
0019 {
0020     Q_OBJECT
0021 
0022 public:
0023     explicit CycleStreetsRunner(QObject *parent = nullptr);
0024 
0025     ~CycleStreetsRunner() 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 
0041     GeoDataDocument *parse( const QByteArray &content ) const;
0042 
0043     int maneuverType( QString& cycleStreetsName ) const;
0044 
0045     QNetworkAccessManager m_networkAccessManager;
0046 
0047     QNetworkRequest m_request;
0048 
0049     QMap<QString,int> turns;
0050 };
0051 
0052 }
0053 
0054 #endif