Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qgeoroute_p.h
Go to the documentation of this file.
1// Copyright (C) 2022 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3// Qt-Security score:significant reason:default
4
5#ifndef QGEOROUTE_P_H
6#define QGEOROUTE_P_H
7
8//
9// W A R N I N G
10// -------------
11//
12// This file is not part of the Qt API. It exists purely as an
13// implementation detail. This header file may change from version to
14// version without notice, or even be removed.
15//
16// We mean it.
17//
18
19#include <QtLocation/private/qlocationglobal_p.h>
20#include "qgeoroute.h"
22#include "qgeorectangle.h"
24
25#include <QSharedData>
26#include <QVariantMap>
27#include <QScopedPointer>
28
30
31class QGeoCoordinate;
32
33class Q_LOCATION_EXPORT QGeoRoutePrivate : public QSharedData
34{
35public:
36 bool operator==(const QGeoRoutePrivate &other) const;
37 bool equals(const QGeoRoutePrivate &other) const;
38
39 void setId(const QString &id);
40 QString id() const;
41
42 void setRequest(const QGeoRouteRequest &request);
43 QGeoRouteRequest request() const;
44
45 void setBounds(const QGeoRectangle &bounds);
46 QGeoRectangle bounds() const;
47
48 void setTravelTime(int travelTime);
49 int travelTime() const;
50
51 void setDistance(qreal distance);
52 qreal distance() const;
53
54 void setTravelMode(QGeoRouteRequest::TravelMode mode);
55 QGeoRouteRequest::TravelMode travelMode() const;
56
57 void setPath(const QList<QGeoCoordinate> &path);
58 QList<QGeoCoordinate> path() const;
59
60 void setFirstSegment(const QGeoRouteSegment &firstSegment);
61 QGeoRouteSegment firstSegment() const;
62
63 int segmentsCount() const;
64 QList<QGeoRouteSegment> segments() const;
65
66 void setRouteLegs(const QList<QGeoRoute> &legs);
67 QList<QGeoRoute> routeLegs() const;
68
69 void setExtendedAttributes(const QVariantMap &extendedAttributes);
70 QVariantMap extendedAttributes() const;
71
72 // QGeoRouteLeg API
73 void setLegIndex(int idx);
74 int legIndex() const;
75 void setContainingRoute(const QGeoRoute &route);
76 QGeoRoute containingRoute() const;
77
78private:
79 template<typename Functor>
80 inline void forEachSegment(Functor &&functor) const {
81 QGeoRouteSegment segment = m_firstSegment;
82 while (segment.isValid()) {
83 functor(segment);
84 // if containing route, this is a leg
85 if (segment.isLegLastSegment() && m_containingRoute)
86 break;
87 segment = segment.nextRouteSegment();
88 }
89 }
90 QString m_id;
91 QGeoRouteRequest m_request;
92
93 QGeoRectangle m_bounds;
94 mutable QList<QGeoRouteSegment> m_routeSegments;
95
96 int m_travelTime = 0;
97 qreal m_distance = 0.0;
98
99 QGeoRouteRequest::TravelMode m_travelMode;
100
101 QList<QGeoCoordinate> m_path;
102 QList<QGeoRoute> m_legs;
103 QGeoRouteSegment m_firstSegment;
104 mutable int m_numSegments = -1;
105 std::unique_ptr<QGeoRoute> m_containingRoute;
106 QVariantMap m_extendedAttributes;
107 int m_legIndex = -1;
108};
109
110QT_END_NAMESPACE
111
112#endif
\inmodule QtLocation
Definition qgeoroute.h:25
Combined button and popup list for selecting options.