Marble

Routing.h
1// SPDX-License-Identifier: LGPL-2.1-or-later
2//
3// SPDX-FileCopyrightText: 2011 Dennis Nienhüser <nienhueser@kde.org>
4//
5
6#ifndef MARBLE_DECLARATIVE_ROUTING_H
7#define MARBLE_DECLARATIVE_ROUTING_H
8
9#include <QQuickItem>
10
11#include <Placemark.h>
12#include <routing/RoutingModel.h>
13#include <RouteRequestModel.h>
14
15namespace Marble {
16
17class MarbleMap;
18class RoutingPrivate;
19
20class Routing : public QQuickItem
21{
23 Q_PROPERTY( MarbleMap* marbleMap READ marbleMap WRITE setMarbleMap NOTIFY marbleMapChanged)
24 Q_PROPERTY( QString routingProfile READ routingProfile WRITE setRoutingProfile NOTIFY routingProfileChanged )
25 Q_PROPERTY( bool hasRoute READ hasRoute NOTIFY hasRouteChanged )
26 Q_PROPERTY( bool hasWaypoints READ hasWaypoints NOTIFY hasWaypointsChanged )
27 Q_PROPERTY( RoutingModel* routingModel READ routingModel NOTIFY routingModelChanged)
28 Q_PROPERTY( QQmlComponent* waypointDelegate READ waypointDelegate WRITE setWaypointDelegate NOTIFY waypointDelegateChanged)
29 Q_PROPERTY( RouteRequestModel* routeRequestModel READ routeRequestModel NOTIFY routeRequestModelChanged)
30
31public:
32 enum RoutingProfile { Motorcar, Bicycle, Pedestrian };
33
34 explicit Routing( QQuickItem* parent = nullptr );
35
36 ~Routing() override;
37
38 void setMarbleMap( MarbleMap* marbleMap );
39
40 MarbleMap *marbleMap();
41
42 QString routingProfile() const;
43
44 void setRoutingProfile( const QString & profile );
45
46 bool hasRoute() const;
47
48 bool hasWaypoints() const;
49
50 RoutingModel *routingModel();
51
52 QQmlComponent * waypointDelegate() const;
53
54 Q_INVOKABLE int waypointCount() const;
55
56 RouteRequestModel* routeRequestModel();
57
58public Q_SLOTS:
59 void addVia( qreal lon, qreal lat );
60
61 void addViaAtIndex( int index, qreal lon, qreal lat );
62
63 void addViaByPlacemark( Placemark * placemark );
64
65 void addViaByPlacemarkAtIndex( int index, Placemark * placemark );
66
67 void setVia( int index, qreal lon, qreal lat );
68
69 void removeVia( int index );
70
71 void swapVias( int index1, int index2 );
72
73 void reverseRoute();
74
75 void clearRoute();
76
77 void updateRoute();
78
79 void openRoute( const QString &filename );
80
81 void saveRoute( const QString &filename );
82
83 QObject* waypointModel();
84
85 void setWaypointDelegate(QQmlComponent * waypointDelegate);
86
87 int addSearchResultPlacemark( Placemark * placemark );
88
89 void clearSearchResultPlacemarks();
90
92 void marbleMapChanged();
93
94 void routingProfileChanged();
95
96 void hasRouteChanged();
97
98 void hasWaypointsChanged();
99
100 void routingModelChanged();
101
102 void waypointDelegateChanged(QQmlComponent * waypointDelegate);
103
104 void routeRequestModelChanged(RouteRequestModel* routeRequestModel);
105
106protected:
107 // Implements QQuickItem interface
108 QSGNode * updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *) override;
109
110private Q_SLOTS:
111 void updateWaypointItems();
112
113 void updateSearchResultPlacemarks();
114
115private:
116 RoutingPrivate* const d;
117};
118
119}
120
121#endif
Binds a QML item to a specific geodetic location in screen coordinates.
Q_INVOKABLEQ_INVOKABLE
Q_OBJECTQ_OBJECT
Q_PROPERTY(...)
Q_SIGNALSQ_SIGNALS
Q_SLOTSQ_SLOTS
T qobject_cast(QObject *object)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Jun 7 2024 12:03:11 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.