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
qdeclarativerectanglemapitem_p.h
Go to the documentation of this file.
1// Copyright (C) 2022 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 QDECLARATIVERECTANGLEMAPITEM_H_
5#define QDECLARATIVERECTANGLEMAPITEM_H_
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <QtLocation/private/qlocationglobal_p.h>
19#include <QtLocation/private/qdeclarativegeomapitembase_p.h>
20#include <QtLocation/private/qgeomapitemgeometry_p.h>
21#include <QtLocation/private/qdeclarativepolylinemapitem_p.h>
22#include <QtLocation/private/qdeclarativepolygonmapitem_p_p.h>
23#include <QtPositioning/private/qdoublevector2d_p.h>
24
25#include <QSGGeometryNode>
26#include <QSGFlatColorMaterial>
27
28QT_BEGIN_NAMESPACE
29
30class QDeclarativeRectangleMapItemPrivate;
31class Q_LOCATION_EXPORT QDeclarativeRectangleMapItem: public QDeclarativeGeoMapItemBase
32{
33 Q_OBJECT
34 QML_NAMED_ELEMENT(MapRectangle)
35 QML_ADDED_IN_VERSION(5, 0)
36
37 Q_PROPERTY(QGeoCoordinate topLeft READ topLeft WRITE setTopLeft NOTIFY topLeftChanged)
38 Q_PROPERTY(QGeoCoordinate bottomRight READ bottomRight WRITE setBottomRight NOTIFY bottomRightChanged)
39 Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged)
40 Q_PROPERTY(QDeclarativeMapLineProperties *border READ border CONSTANT)
41
42public:
43 explicit QDeclarativeRectangleMapItem(QQuickItem *parent = nullptr);
44 ~QDeclarativeRectangleMapItem() override;
45
46 void setMap(QDeclarativeGeoMap *quickMap, QGeoMap *map) override;
47 //from QuickItem
48 QSGNode *updateMapItemPaintNode(QSGNode *, UpdatePaintNodeData *) override;
49
50 QGeoCoordinate topLeft();
51 void setTopLeft(const QGeoCoordinate &center);
52
53 QGeoCoordinate bottomRight();
54 void setBottomRight(const QGeoCoordinate &center);
55
56 QColor color() const;
57 void setColor(const QColor &color);
58
59 QDeclarativeMapLineProperties *border();
60
61 bool contains(const QPointF &point) const override;
62 const QGeoShape &geoShape() const override;
63 void setGeoShape(const QGeoShape &shape) override;
64
65Q_SIGNALS:
66 void topLeftChanged(const QGeoCoordinate &topLeft);
67 void bottomRightChanged(const QGeoCoordinate &bottomRight);
68 void colorChanged(const QColor &color);
69
70protected:
71 void geometryChange(const QRectF &newGeometry, const QRectF &oldGeometry) override;
72 void updatePolish() override;
73
74protected Q_SLOTS:
75 void markSourceDirtyAndUpdate();
76 void onLinePropertiesChanged();
77 void afterViewportChanged(const QGeoMapViewportChangeEvent &event) override;
78
79private:
80 QGeoRectangle m_rectangle;
81 QDeclarativeMapLineProperties m_border;
82 QColor m_color = Qt::transparent;
83
84 bool m_updatingGeometry = false;
85
86 std::unique_ptr<QDeclarativeRectangleMapItemPrivate> m_d;
87
88 friend class QDeclarativeRectangleMapItemPrivate;
89 friend class QDeclarativeRectangleMapItemPrivateCPU;
90};
91
92//////////////////////////////////////////////////////////////////////
93
94QT_END_NAMESPACE
95
96QML_DECLARE_TYPE(QDeclarativeRectangleMapItem)
97
98#endif /* QDECLARATIVERECTANGLEMAPITEM_H_ */