File indexing completed on 2024-04-28 15:16:06

0001 // SPDX-License-Identifier: LGPL-2.1-or-later
0002 //
0003 // SPDX-FileCopyrightText: 2010 Dennis Nienhüser <nienhueser@kde.org>
0004 // SPDX-FileCopyrightText: 2011 Thibaut Gridel <tgridel@free.fr>
0005 // SPDX-FileCopyrightText: 2012, 2013 Bernhard Beschow <bbeschow@cs.tu-berlin.de>
0006 
0007 #ifndef MARBLE_ROUTINGRUNNER_H
0008 #define MARBLE_ROUTINGRUNNER_H
0009 
0010 #include <QObject>
0011 #include "marble_export.h"
0012 
0013 class QTime;
0014 
0015 namespace Marble
0016 {
0017 
0018 class GeoDataExtendedData;
0019 class GeoDataDocument;
0020 class RouteRequest;
0021 
0022 class MARBLE_EXPORT RoutingRunner : public QObject
0023 {
0024     Q_OBJECT
0025 
0026 public:
0027     explicit RoutingRunner( QObject *parent );
0028 
0029     /**
0030      * Start a route download orw calculation. Called by MarbleRunnerManager, runners
0031      * are expected to return the result via the routeCalculated signal.
0032      * If implemented in a plugin, make sure to include Routing in the
0033      * plugin capabilities, otherwise MarbleRunnerManager will ignore the plugin
0034      */
0035     virtual void retrieveRoute( const RouteRequest *request ) = 0;
0036 
0037 Q_SIGNALS:
0038     /**
0039      * Route download/calculation is finished, result in the given route object.
0040      * To be emitted by runners after a @see retrieveRoute call.
0041      */
0042     void routeCalculated( GeoDataDocument* route );
0043 
0044 protected:
0045     const QString nameString( const QString &name, qreal length, const QTime &duration ) const;
0046     const QString lengthString( qreal length ) const;
0047     const QString durationString( const QTime &duration ) const;
0048     const GeoDataExtendedData routeData( qreal length, const QTime &duration ) const;
0049 };
0050 
0051 }
0052 
0053 #endif