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
qgeocoordinate.h
Go to the documentation of this file.
1// Copyright (C) 2016 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 QGEOCOORDINATE_H
5#define QGEOCOORDINATE_H
6
7#include <QtCore/QMetaType>
8#include <QtCore/QString>
9#include <QtCore/QSharedDataPointer>
10#include <QtCore/QDebug>
11#include <QtPositioning/qpositioningglobal.h>
12
14
15class QDebug;
16class QDataStream;
17
20
21class Q_POSITIONING_EXPORT QGeoCoordinate
22{
25
26 Q_PROPERTY(double latitude READ latitude WRITE setLatitude)
27 Q_PROPERTY(double longitude READ longitude WRITE setLongitude)
28 Q_PROPERTY(double altitude READ altitude WRITE setAltitude)
29 Q_PROPERTY(bool isValid READ isValid)
30
31public:
32
38
47
49 QGeoCoordinate(double latitude, double longitude);
50 QGeoCoordinate(double latitude, double longitude, double altitude);
52 QGeoCoordinate(QGeoCoordinate &&other) noexcept = default;
54
56 QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QGeoCoordinate)
57
58 void swap(QGeoCoordinate &other) noexcept { d.swap(other.d); }
59
60 friend bool operator==(const QGeoCoordinate &lhs, const QGeoCoordinate &rhs)
61 {
62 return equals(lhs, rhs);
63 }
64 friend bool operator!=(const QGeoCoordinate &lhs, const QGeoCoordinate &rhs)
65 {
66 return !equals(lhs, rhs);
67 }
68
69 bool isValid() const;
70 CoordinateType type() const;
71
72 void setLatitude(double latitude);
73 double latitude() const;
74
75 void setLongitude(double longitude);
76 double longitude() const;
77
78 void setAltitude(double altitude);
79 double altitude() const;
80
81 Q_INVOKABLE qreal distanceTo(const QGeoCoordinate &other) const;
82 Q_INVOKABLE qreal azimuthTo(const QGeoCoordinate &other) const;
83
85
86 Q_INVOKABLE QString toString(CoordinateFormat format = DegreesMinutesSecondsWithHemisphere) const;
87
88private:
89 static bool equals(const QGeoCoordinate &lhs, const QGeoCoordinate &rhs);
91 QSharedDataPointer<QGeoCoordinatePrivate> d;
94#ifndef QT_NO_DEBUG_STREAM
96 {
97 return debugStreaming(dbg, coord);
98 }
99 static QDebug debugStreaming(QDebug dbg, const QGeoCoordinate &coord);
100#endif
101#ifndef QT_NO_DATASTREAM
103 {
104 return dataStreamOut(stream, coordinate);
105 }
107 {
108 return dataStreamIn(stream, coordinate);
109 }
110 static QDataStream &dataStreamOut(QDataStream &stream, const QGeoCoordinate &coordinate);
111 static QDataStream &dataStreamIn(QDataStream &stream, QGeoCoordinate &coordinate);
112#endif
113};
114
115Q_DECLARE_SHARED(QGeoCoordinate)
116
117
118Q_POSITIONING_EXPORT size_t qHash(const QGeoCoordinate &coordinate, size_t seed = 0);
119
120
122
123QT_DECL_METATYPE_EXTERN(QGeoCoordinate, Q_POSITIONING_EXPORT)
124
125#endif
\inmodule QtCore\reentrant
Definition qdatastream.h:46
\inmodule QtCore
static void atDistanceAndAzimuth(const QGeoCoordinate &coord, qreal distance, qreal azimuth, double *lon, double *lat)
\inmodule QtPositioning
friend bool operator==(const QGeoCoordinate &lhs, const QGeoCoordinate &rhs)
Returns true if the latitude, longitude and altitude of the lhs coordinate are the same as those of t...
QGeoCoordinate(QGeoCoordinate &&other) noexcept=default
friend bool operator!=(const QGeoCoordinate &lhs, const QGeoCoordinate &rhs)
Returns true if latitude, longitude, or altitude of the lhs coordinate are not identical to those of ...
CoordinateFormat
Defines the possible formatting options for toString().
friend QDataStream & operator<<(QDataStream &stream, const QGeoCoordinate &coordinate)
Writes the given coordinate to the specified stream.
friend QDataStream & operator>>(QDataStream &stream, QGeoCoordinate &coordinate)
Reads a coordinate from the specified stream into the given coordinate.
friend QDebug operator<<(QDebug dbg, const QGeoCoordinate &coord)
CoordinateType
Defines the types of a coordinate.
QSharedData & operator=(const QSharedData &)=delete
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
Combined button and popup list for selecting options.
DBusConnection const char DBusError DBusBusType DBusError return DBusConnection DBusHandleMessageFunction void DBusFreeFunction return DBusConnection return DBusConnection return const char DBusError return DBusConnection DBusMessage dbus_uint32_t return DBusConnection dbus_bool_t DBusConnection DBusAddWatchFunction DBusRemoveWatchFunction DBusWatchToggledFunction void DBusFreeFunction return DBusConnection DBusDispatchStatusFunction void DBusFreeFunction DBusTimeout return DBusTimeout return DBusWatch return DBusWatch unsigned int return DBusError const DBusError return const DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessageIter int const void return DBusMessageIter DBusMessageIter return DBusMessageIter void DBusMessageIter void int return DBusMessage DBusMessageIter return DBusMessageIter return DBusMessageIter DBusMessageIter const char const char const char const char return DBusMessage return DBusMessage const char return DBusMessage dbus_bool_t return DBusMessage dbus_uint32_t return DBusMessage void
EGLStreamKHR stream
Q_POSITIONING_EXPORT size_t qHash(const QGeoCoordinate &coordinate, size_t seed=0)
#define QT_DECL_METATYPE_EXTERN(TYPE, EXPORT)
Definition qmetatype.h:1388
GLsizei GLsizei GLfloat distance
GLenum type
GLint GLsizei GLsizei GLenum format
GLuint coord
static Q_CONSTINIT QBasicAtomicInteger< unsigned > seed
Definition qrandom.cpp:196
#define QT_DECLARE_QSDP_SPECIALIZATION_DTOR_WITH_EXPORT(Class, ExportMacro)
#define Q_PROPERTY(...)
#define Q_INVOKABLE
#define Q_GADGET
#define Q_ENUMS(x)
double qreal
Definition qtypes.h:187
QSharedPointer< T > other(t)
[5]
this swap(other)
char * toString(const MyType &t)
[31]