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