Marble

RouteRequest.h
1// SPDX-License-Identifier: LGPL-2.1-or-later
2//
3// SPDX-FileCopyrightText: 2010 Dennis Nienhüser <nienhueser@kde.org>
4//
5
6#ifndef MARBLE_ROUTEREQUEST_H
7#define MARBLE_ROUTEREQUEST_H
8
9#include "RoutingProfile.h"
10#include "marble_export.h"
11
12#include <QObject>
13
14namespace Marble
15{
16
17class GeoDataCoordinates;
18class GeoDataPlacemark;
19class RouteRequestPrivate;
20
21/**
22 * @brief Points to be included in a route. An ordered list of
23 * GeoDataCoordinates with change notification and Pixmap access, similar
24 * to QAbstractItemModel.
25 */
26class MARBLE_EXPORT RouteRequest : public QObject
27{
28 Q_OBJECT
29
30public:
31 /** Constructor */
32 explicit RouteRequest(QObject *parent = nullptr);
33
34 /** Destructor */
35 ~RouteRequest() override;
36
37 /** The first point, or a default constructed if empty */
38 GeoDataCoordinates source() const;
39
40 /** The last point, or a default constructed if empty */
41 GeoDataCoordinates destination() const;
42
43 /** Number of points in the route */
44 int size() const;
45
46 /** Accessor for the n-th position */
47 GeoDataCoordinates at(int index) const;
48
49 /** Add the given element to the end */
50 void append(const GeoDataCoordinates &coordinates, const QString &name = QString());
51
52 void append(const GeoDataPlacemark &placemark);
53
54 /** Add the given element at the given position */
55 void insert(int index, const GeoDataCoordinates &coordinates, const QString &name = QString());
56
57 void insert(int index, const GeoDataPlacemark &placemark);
58
59 /** Swaps the given elements at the given positions*/
60 void swap(int index1, int index2);
61
62 /** Change the value of the element at the given position */
63 void setPosition(int index, const GeoDataCoordinates &position, const QString &name = QString());
64
65 /** Remove the element at the given position */
66 void remove(int index);
67
68 /** Remove all elements */
69 void clear();
70
71 /**
72 * Insert a via point. Order will be chosen such that the via point is not before
73 * the start or after the destination. Furthermore the distance between neighboring
74 * route points is minimized
75 *
76 * @note: This does not trigger an update of the route. It becomes "dirty"
77 *
78 * @todo: Minimizing the distance might not always be what the user wants
79 */
80 void addVia(const GeoDataCoordinates &position);
81 void addVia(const GeoDataPlacemark &placemark);
82
83 /** Returns a pixmap which indicates the position of the element */
84 QPixmap pixmap(int index, int size = -1, int margin = 2) const;
85
86 void setName(int index, const QString &name);
87
88 QString name(int index) const;
89
90 void setVisited(int index, bool visited);
91
92 bool visited(int index) const;
93
94 void reverse();
95
96 void setRoutingProfile(const RoutingProfile &profile);
97
98 RoutingProfile routingProfile() const;
99
100 GeoDataPlacemark &operator[](int index);
101
102 GeoDataPlacemark const &operator[](int index) const;
103
104Q_SIGNALS:
105 /** The value of the n-th element was changed */
106 void positionChanged(int index, const GeoDataCoordinates &position);
107
108 /** An element was added at the given position */
109 void positionAdded(int index);
110
111 /** The element at the given position was removed */
112 void positionRemoved(int index);
113
114 /** The routing profile was changed */
116
117private:
118 RouteRequestPrivate *const d;
119};
120
121} // namespace Marble
122
123#endif
A 3d point representation.
a class representing a point of interest on the map
Points to be included in a route.
void positionAdded(int index)
An element was added at the given position.
void positionChanged(int index, const GeoDataCoordinates &position)
The value of the n-th element was changed.
void routingProfileChanged()
The routing profile was changed.
void positionRemoved(int index)
The element at the given position was removed.
Binds a QML item to a specific geodetic location in screen coordinates.
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.