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
qgeoshape.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// Qt-Security score:significant reason:default
4
5#ifndef QGEOSHAPE_H
6#define QGEOSHAPE_H
7
8#include <QtCore/QSharedDataPointer>
9#include <QtPositioning/QGeoCoordinate>
10
12
13class QDebug;
14class QGeoShapePrivate;
15class QGeoRectangle;
16
17class Q_POSITIONING_EXPORT QGeoShape
18{
19 Q_GADGET
20 Q_PROPERTY(ShapeType type READ type)
21 Q_PROPERTY(bool isValid READ isValid)
22 Q_PROPERTY(bool isEmpty READ isEmpty)
23 Q_PROPERTY(QGeoCoordinate center READ center)
24
25public:
26 QGeoShape();
27 Q_INVOKABLE QGeoShape(const QGeoShape &other);
28 ~QGeoShape();
29
30 enum ShapeType {
31 UnknownType,
32 RectangleType,
33 CircleType,
34 PathType,
35 PolygonType
36 };
37 Q_ENUM(ShapeType)
38
39 ShapeType type() const;
40
41 bool isValid() const;
42 bool isEmpty() const;
43 Q_INVOKABLE bool contains(const QGeoCoordinate &coordinate) const;
44 Q_INVOKABLE QGeoRectangle boundingGeoRectangle() const;
45 QGeoCoordinate center() const;
46
47 friend bool operator==(const QGeoShape &lhs, const QGeoShape &rhs)
48 {
49 return equals(lhs, rhs);
50 }
51 friend bool operator!=(const QGeoShape &lhs, const QGeoShape &rhs)
52 {
53 return !equals(lhs, rhs);
54 }
55
56 QGeoShape &operator=(const QGeoShape &other);
57
58 Q_INVOKABLE QString toString() const;
59protected:
60 QGeoShape(QGeoShapePrivate *d);
61
62 QSharedDataPointer<QGeoShapePrivate> d_ptr;
63
64private:
65 static bool equals(const QGeoShape &lhs, const QGeoShape &rhs);
66 inline QGeoShapePrivate *d_func();
67 inline const QGeoShapePrivate *d_func() const;
68#ifndef QT_NO_DEBUG_STREAM
69 friend QDebug operator<<(QDebug dbg, const QGeoShape &shape)
70 {
71 return debugStreaming(dbg, shape);
72 }
73 static QDebug debugStreaming(QDebug dbg, const QGeoShape &shape);
74#endif
75#ifndef QT_NO_DATASTREAM
76 friend QDataStream &operator<<(QDataStream &stream, const QGeoShape &shape)
77 {
78 return dataStreamOut(stream, shape);
79 }
80 friend QDataStream &operator>>(QDataStream &stream, QGeoShape &shape)
81 {
82 return dataStreamIn(stream, shape);
83 }
84 static QDataStream &dataStreamOut(QDataStream &stream, const QGeoShape &shape);
85 static QDataStream &dataStreamIn(QDataStream &stream, QGeoShape &shape);
86#endif
87 friend Q_POSITIONING_EXPORT size_t qHash(const QGeoShape &key, size_t seed) noexcept;
88};
89
90Q_POSITIONING_EXPORT size_t qHash(const QGeoShape &shape, size_t seed = 0) noexcept;
91
92Q_DECLARE_TYPEINFO(QGeoShape, Q_RELOCATABLE_TYPE);
93
94QT_END_NAMESPACE
95
96QT_DECL_METATYPE_EXTERN(QGeoShape, Q_POSITIONING_EXPORT)
97
98#endif
\inmodule QtLocation
\inmodule QtPositioning
Definition qgeoshape.h:18
Combined button and popup list for selecting options.
Q_DECLARE_TYPEINFO(QByteArrayView, Q_PRIMITIVE_TYPE)