Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
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
4#ifndef QGEOROUTE_P_H
5#define QGEOROUTE_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <QtLocation/private/qlocationglobal_p.h>
19#include "qgeoroute.h"
20#include "qgeorouterequest.h"
21#include "qgeorectangle.h"
22#include "qgeoroutesegment.h"
23
24#include <QSharedData>
25#include <QVariantMap>
26#include <QScopedPointer>
27
29
30class QGeoCoordinate;
31
32class Q_LOCATION_EXPORT QGeoRoutePrivate : public QSharedData
33{
34public:
35 bool operator==(const QGeoRoutePrivate &other) const;
36 bool equals(const QGeoRoutePrivate &other) const;
37
38 void setId(const QString &id);
39 QString id() const;
40
41 void setRequest(const QGeoRouteRequest &request);
43
44 void setBounds(const QGeoRectangle &bounds);
45 QGeoRectangle bounds() const;
46
47 void setTravelTime(int travelTime);
48 int travelTime() const;
49
50 void setDistance(qreal distance);
51 qreal distance() const;
52
53 void setTravelMode(QGeoRouteRequest::TravelMode mode);
54 QGeoRouteRequest::TravelMode travelMode() const;
55
56 void setPath(const QList<QGeoCoordinate> &path);
57 QList<QGeoCoordinate> path() const;
58
59 void setFirstSegment(const QGeoRouteSegment &firstSegment);
60 QGeoRouteSegment firstSegment() const;
61
62 int segmentsCount() const;
63 QList<QGeoRouteSegment> segments() const;
64
65 void setRouteLegs(const QList<QGeoRoute> &legs);
66 QList<QGeoRoute> routeLegs() const;
67
68 void setExtendedAttributes(const QVariantMap &extendedAttributes);
69 QVariantMap extendedAttributes() const;
70
71 // QGeoRouteLeg API
72 void setLegIndex(int idx);
73 int legIndex() const;
74 void setContainingRoute(const QGeoRoute &route);
75 QGeoRoute containingRoute() const;
76
77private:
78 template<typename Functor>
79 inline void forEachSegment(Functor &&functor) const {
80 QGeoRouteSegment segment = m_firstSegment;
81 while (segment.isValid()) {
82 functor(segment);
83 // if containing route, this is a leg
84 if (segment.isLegLastSegment() && m_containingRoute)
85 break;
86 segment = segment.nextRouteSegment();
87 }
88 }
89 QString m_id;
90 QGeoRouteRequest m_request;
91
92 QGeoRectangle m_bounds;
93 mutable QList<QGeoRouteSegment> m_routeSegments;
94
95 int m_travelTime = 0;
96 qreal m_distance = 0.0;
97
99
100 QList<QGeoCoordinate> m_path;
101 QList<QGeoRoute> m_legs;
102 QGeoRouteSegment m_firstSegment;
103 mutable int m_numSegments = -1;
104 std::unique_ptr<QGeoRoute> m_containingRoute;
105 QVariantMap m_extendedAttributes;
106 int m_legIndex = -1;
107};
108
110
111#endif
\inmodule QtPositioning
\inmodule QtPositioning
\inmodule QtLocation
TravelMode
Defines modes of travel to be used for a route.
\inmodule QtLocation
\inmodule QtLocation
Definition qgeoroute.h:24
\inmodule QtCore
Definition qshareddata.h:19
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
employee setId(37)
Combined button and popup list for selecting options.
GLenum mode
GLenum GLuint id
[7]
GLsizei GLsizei GLfloat distance
GLuint segment
GLsizei const GLchar *const * path
GLuint segments
bool operator==(const QRandomGenerator &rng1, const QRandomGenerator &rng2)
Definition qrandom.cpp:1220
double qreal
Definition qtypes.h:187
QSharedPointer< T > other(t)
[5]
QNetworkRequest request(url)