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
qgeorectangle.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 QGEORECTANGLE_H
6#define QGEORECTANGLE_H
7
8#include <QtPositioning/QGeoShape>
9
11
12class QGeoRectanglePrivate;
13
14class Q_POSITIONING_EXPORT QGeoRectangle : public QGeoShape
15{
16 Q_GADGET
17 Q_PROPERTY(QGeoCoordinate bottomLeft READ bottomLeft WRITE setBottomLeft)
18 Q_PROPERTY(QGeoCoordinate bottomRight READ bottomRight WRITE setBottomRight)
19 Q_PROPERTY(QGeoCoordinate topLeft READ topLeft WRITE setTopLeft)
20 Q_PROPERTY(QGeoCoordinate topRight READ topRight WRITE setTopRight)
21 Q_PROPERTY(QGeoCoordinate center READ center WRITE setCenter)
22 Q_PROPERTY(double height READ height WRITE setHeight)
23 Q_PROPERTY(double width READ width WRITE setWidth)
24
25public:
26 QGeoRectangle();
27 QGeoRectangle(const QGeoCoordinate &center, double degreesWidth, double degreesHeight);
28 QGeoRectangle(const QGeoCoordinate &topLeft, const QGeoCoordinate &bottomRight);
29 QGeoRectangle(const QList<QGeoCoordinate> &coordinates);
30 QGeoRectangle(const QGeoRectangle &other);
31 QGeoRectangle(const QGeoShape &other);
32
33 ~QGeoRectangle();
34
35 QGeoRectangle &operator=(const QGeoRectangle &other);
36
37 void setTopLeft(const QGeoCoordinate &topLeft);
38 QGeoCoordinate topLeft() const;
39
40 void setTopRight(const QGeoCoordinate &topRight);
41 QGeoCoordinate topRight() const;
42
43 void setBottomLeft(const QGeoCoordinate &bottomLeft);
44 QGeoCoordinate bottomLeft() const;
45
46 void setBottomRight(const QGeoCoordinate &bottomRight);
47 QGeoCoordinate bottomRight() const;
48
49 void setCenter(const QGeoCoordinate &center);
50 QGeoCoordinate center() const;
51
52 void setWidth(double degreesWidth);
53 double width() const;
54
55 void setHeight(double degreesHeight);
56 double height() const;
57
58 using QGeoShape::contains;
59 bool contains(const QGeoRectangle &rectangle) const;
60 Q_INVOKABLE bool intersects(const QGeoRectangle &rectangle) const;
61
62 Q_INVOKABLE void translate(double degreesLatitude, double degreesLongitude);
63 Q_INVOKABLE QGeoRectangle translated(double degreesLatitude, double degreesLongitude) const;
64 Q_INVOKABLE void extendRectangle(const QGeoCoordinate &coordinate);
65
66 Q_INVOKABLE QGeoRectangle united(const QGeoRectangle &rectangle) const;
67 QGeoRectangle operator|(const QGeoRectangle &rectangle) const;
68 QGeoRectangle &operator|=(const QGeoRectangle &rectangle);
69
70 Q_INVOKABLE QString toString() const;
71
72private:
73 inline QGeoRectanglePrivate *d_func();
74 inline const QGeoRectanglePrivate *d_func() const;
75
76#ifndef QT_NO_DATASTREAM
77 friend QDataStream &operator<<(QDataStream &stream, const QGeoRectangle &rectangle)
78 {
79 return stream << static_cast<const QGeoShape &>(rectangle);
80 }
81 friend QDataStream &operator>>(QDataStream &stream, QGeoRectangle &rectangle)
82 {
83 return stream >> static_cast<QGeoShape &>(rectangle);
84 }
85#endif
86};
87
88Q_DECLARE_TYPEINFO(QGeoRectangle, Q_RELOCATABLE_TYPE);
89
90inline QGeoRectangle QGeoRectangle::operator|(const QGeoRectangle &rectangle) const
91{
92 return united(rectangle);
93}
94
95QT_END_NAMESPACE
96
97QT_DECL_METATYPE_EXTERN(QGeoRectangle, Q_POSITIONING_EXPORT)
98
99#endif
QGeoCodingManagerPrivate()=default
std::unique_ptr< QGeoCodingManagerEngine > engine
\inmodule QtLocation
\inmodule QtPositioning
Combined button and popup list for selecting options.
Q_DECLARE_TYPEINFO(QByteArrayView, Q_PRIMITIVE_TYPE)