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