Marble

Routing.h
1 // SPDX-License-Identifier: LGPL-2.1-or-later
2 //
3 // SPDX-FileCopyrightText: 2011 Dennis Nienhüser <[email protected]>
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 
15 namespace Marble {
16 
17 class MarbleMap;
18 class RoutingPrivate;
19 
20 class Routing : public QQuickItem
21 {
22  Q_OBJECT
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 
31 public:
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 
58 public 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 
91 Q_SIGNALS:
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 
106 protected:
107  // Implements QQuickItem interface
108  QSGNode * updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *) override;
109 
110 private Q_SLOTS:
111  void updateWaypointItems();
112 
113  void updateSearchResultPlacemarks();
114 
115 private:
116  RoutingPrivate* const d;
117 };
118 
119 }
120 
121 #endif
Q_OBJECTQ_OBJECT
Q_PROPERTY(...)
Q_SLOTSQ_SLOTS
Binds a QML item to a specific geodetic location in screen coordinates.
Q_INVOKABLEQ_INVOKABLE
Q_SIGNALSQ_SIGNALS
virtual QSGNode * updatePaintNode(QSGNode *oldNode, QQuickItem::UpdatePaintNodeData *updatePaintNodeData)
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Oct 2 2023 03:52:09 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.