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

KDE's Doxygen guidelines are available online.