Qt 6.x
The Qt SDK
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
12
13class Q_POSITIONING_EXPORT QGeoRectangle : public QGeoShape
14{
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:
26 QGeoRectangle(const QGeoCoordinate &center, double degreesWidth, double degreesHeight);
27 QGeoRectangle(const QGeoCoordinate &topLeft, const QGeoCoordinate &bottomRight);
28 QGeoRectangle(const QList<QGeoCoordinate> &coordinates);
31
33
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
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
70
71private:
72 inline QGeoRectanglePrivate *d_func();
73 inline const QGeoRectanglePrivate *d_func() const;
74
75#ifndef QT_NO_DATASTREAM
77 {
78 return stream << static_cast<const QGeoShape &>(rectangle);
79 }
81 {
82 return stream >> static_cast<QGeoShape &>(rectangle);
83 }
84#endif
85};
86
88
90{
91 return united(rectangle);
92}
93
95
96QT_DECL_METATYPE_EXTERN(QGeoRectangle, Q_POSITIONING_EXPORT)
97
98#endif
\inmodule QtCore\reentrant
Definition qdatastream.h:30
\inmodule QtPositioning
\inmodule QtPositioning
friend QDataStream & operator<<(QDataStream &stream, const QGeoRectangle &rectangle)
QGeoRectangle operator|(const QGeoRectangle &rectangle) const
Returns the smallest geo rectangle which contains both this geo rectangle and rectangle.
Q_INVOKABLE QGeoRectangle united(const QGeoRectangle &rectangle) const
Returns the smallest geo rectangle which contains both this geo rectangle and rectangle.
friend QDataStream & operator>>(QDataStream &stream, QGeoRectangle &rectangle)
\inmodule QtPositioning
Definition qgeoshape.h:17
QGeoShape & operator=(const QGeoShape &other)
Assigns other to this geo shape and returns a reference to this geo shape.
Q_INVOKABLE bool contains(const QGeoCoordinate &coordinate) const
Returns whether the coordinate coordinate is contained within this geo shape.
Q_INVOKABLE QString toString() const
Returns a string representation of this geo shape.
QGeoCoordinate center
Definition qgeoshape.h:22
Definition qlist.h:74
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:127
Combined button and popup list for selecting options.
EGLStreamKHR stream
#define QT_DECL_METATYPE_EXTERN(TYPE, EXPORT)
Definition qmetatype.h:1367
constexpr QKeyCombination operator|(Qt::Modifier modifier, Qt::Key key) noexcept
GLint GLsizei GLsizei height
GLint GLsizei width
#define Q_PROPERTY(...)
#define Q_INVOKABLE
#define Q_GADGET
@ Q_RELOCATABLE_TYPE
Definition qtypeinfo.h:145
#define Q_DECLARE_TYPEINFO(TYPE, FLAGS)
Definition qtypeinfo.h:163
QUrl::FormattingOptions & operator|=(QUrl::FormattingOptions &i, QUrl::ComponentFormattingOptions f)
Definition qurl.h:294
static bool translate(xcb_connection_t *connection, xcb_window_t child, xcb_window_t parent, int *x, int *y)
QSharedPointer< T > other(t)
[5]