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
qgeomaneuver.h
Go to the documentation of this file.
1// Copyright (C) 2015 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 QGEOMANEUVER_H
5#define QGEOMANEUVER_H
6
7#include <QtCore/QObject>
8#include <QtCore/qshareddata.h>
9#include <QtLocation/qlocationglobal.h>
10#include <QtQml/qqml.h>
11
12QT_BEGIN_NAMESPACE
13
14class QString;
15class QGeoCoordinate;
16class QGeoManeuverPrivate;
17QT_DECLARE_QSDP_SPECIALIZATION_DTOR_WITH_EXPORT(QGeoManeuverPrivate, Q_LOCATION_EXPORT)
18
19class Q_LOCATION_EXPORT QGeoManeuver
20{
21 Q_GADGET
22 QML_VALUE_TYPE(routeManeuver)
23 QML_STRUCTURED_VALUE
24 Q_ENUMS(InstructionDirection)
25
26 Q_PROPERTY(bool valid READ isValid CONSTANT)
27 Q_PROPERTY(QGeoCoordinate position READ position CONSTANT)
28 Q_PROPERTY(QString instructionText READ instructionText CONSTANT)
29 Q_PROPERTY(InstructionDirection direction READ direction CONSTANT)
30 Q_PROPERTY(int timeToNextInstruction READ timeToNextInstruction CONSTANT)
31 Q_PROPERTY(qreal distanceToNextInstruction READ distanceToNextInstruction CONSTANT)
32 Q_PROPERTY(QGeoCoordinate waypoint READ waypoint CONSTANT)
33 Q_PROPERTY(QVariantMap extendedAttributes READ extendedAttributes CONSTANT)
34
35public:
36 enum InstructionDirection {
37 NoDirection,
38 DirectionForward,
39 DirectionBearRight,
40 DirectionLightRight,
41 DirectionRight,
42 DirectionHardRight,
43 DirectionUTurnRight,
44 DirectionUTurnLeft,
45 DirectionHardLeft,
46 DirectionLeft,
47 DirectionLightLeft,
48 DirectionBearLeft
49 };
50
51 QGeoManeuver();
52 QGeoManeuver(const QGeoManeuver &other) noexcept;
53 QGeoManeuver(QGeoManeuver &&other) noexcept = default;
54 ~QGeoManeuver();
55
56 QGeoManeuver &operator= (const QGeoManeuver &other);
57 QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_MOVE_AND_SWAP(QGeoManeuver)
58
59 void swap(QGeoManeuver &other) noexcept { d_ptr.swap(other.d_ptr); }
60
61 friend inline bool operator==(const QGeoManeuver &lhs, const QGeoManeuver &rhs) noexcept
62 { return lhs.isEqual(rhs); }
63 friend inline bool operator!=(const QGeoManeuver &lhs, const QGeoManeuver &rhs) noexcept
64 { return !lhs.isEqual(rhs); }
65
66 bool isValid() const;
67
68 void setPosition(const QGeoCoordinate &position);
69 QGeoCoordinate position() const;
70
71 void setInstructionText(const QString &instructionText);
72 QString instructionText() const;
73
74 void setDirection(InstructionDirection direction);
75 InstructionDirection direction() const;
76
77 void setTimeToNextInstruction(int secs);
78 int timeToNextInstruction() const;
79
80 void setDistanceToNextInstruction(qreal distance);
81 qreal distanceToNextInstruction() const;
82
83 void setWaypoint(const QGeoCoordinate &coordinate);
84 QGeoCoordinate waypoint() const;
85
86 void setExtendedAttributes(const QVariantMap &extendedAttributes);
87 QVariantMap extendedAttributes() const;
88
89private:
90 QSharedDataPointer<QGeoManeuverPrivate> d_ptr;
91
92 bool isEqual(const QGeoManeuver &other) const;
93};
94
96
97QT_END_NAMESPACE
98
99Q_DECLARE_METATYPE(QGeoManeuver)
100Q_DECLARE_METATYPE(QGeoManeuver::InstructionDirection)
101
102#endif
\inmodule QtLocation