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 "marble_export.h"
10#include "RoutingProfile.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
32 /** Constructor */
33 explicit RouteRequest( QObject *parent = nullptr );
34
35 /** Destructor */
36 ~RouteRequest() override;
37
38 /** The first point, or a default constructed if empty */
39 GeoDataCoordinates source() const;
40
41 /** The last point, or a default constructed if empty */
42 GeoDataCoordinates destination() const;
43
44 /** Number of points in the route */
45 int size() const;
46
47 /** Accessor for the n-th position */
48 GeoDataCoordinates at( int index ) const;
49
50 /** Add the given element to the end */
51 void append( const GeoDataCoordinates &coordinates, const QString &name = QString() );
52
53 void append( const GeoDataPlacemark &placemark );
54
55 /** Add the given element at the given position */
56 void insert( int index, const GeoDataCoordinates &coordinates, const QString &name = QString() );
57
58 void insert(int index, const GeoDataPlacemark &placemark);
59
60 /** Swaps the given elements at the given positions*/
61 void swap( int index1, int index2 );
62
63 /** Change the value of the element at the given position */
64 void setPosition( int index, const GeoDataCoordinates &position, const QString &name = QString() );
65
66 /** Remove the element at the given position */
67 void remove( int index );
68
69 /** Remove all elements */
70 void clear();
71
72 /**
73 * Insert a via point. Order will be chosen such that the via point is not before
74 * the start or after the destination. Furthermore the distance between neighboring
75 * route points is minimized
76 *
77 * @note: This does not trigger an update of the route. It becomes "dirty"
78 *
79 * @todo: Minimizing the distance might not always be what the user wants
80 */
81 void addVia( const GeoDataCoordinates &position );
82 void addVia( const GeoDataPlacemark &placemark );
83
84 /** Returns a pixmap which indicates the position of the element */
85 QPixmap pixmap( int index, int size=-1, int margin=2 ) const;
86
87 void setName( int index, const QString &name );
88
89 QString name( int index ) const;
90
91 void setVisited( int index, bool visited );
92
93 bool visited( int index ) const;
94
95 void reverse();
96
97 void setRoutingProfile( const RoutingProfile &profile );
98
99 RoutingProfile routingProfile() const;
100
101 GeoDataPlacemark & operator[] ( int index );
102
103 GeoDataPlacemark const & operator[] ( int index ) const;
104
105Q_SIGNALS:
106 /** The value of the n-th element was changed */
107 void positionChanged( int index, const GeoDataCoordinates &position );
108
109 /** An element was added at the given position */
110 void positionAdded( int index );
111
112 /** The element at the given position was removed */
113 void positionRemoved( int index );
114
115 /** The routing profile was changed */
117
118private:
119 RouteRequestPrivate *const d;
120};
121
122} // namespace Marble
123
124#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 Sat Apr 27 2024 22:12:41 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.