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
qdeclarativegeomapquickitem_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// Qt-Security score:significant reason:default
4
5#ifndef QDECLARATIVEGEOMAPQUICKITEM_H
6#define QDECLARATIVEGEOMAPQUICKITEM_H
7
8//
9// W A R N I N G
10// -------------
11//
12// This file is not part of the Qt API. It exists purely as an
13// implementation detail. This header file may change from version to
14// version without notice, or even be removed.
15//
16// We mean it.
17//
18
19#include <QtLocation/private/qlocationglobal_p.h>
20
21#include <QtQuick/QQuickItem>
22#include <QtQuick/QSGNode>
23
24#include <QtLocation/private/qdeclarativegeomap_p.h>
25#include <QtLocation/private/qdeclarativegeomapitembase_p.h>
26#include <QtPositioning/qgeoshape.h>
27
28#include <QtCore/qpointer.h>
29
30QT_BEGIN_NAMESPACE
31
32class QMapQuickItemMatrix4x4 : public QQuickTransform
33{
34public:
35 QMapQuickItemMatrix4x4(QObject *parent = nullptr);
36
37 void setMatrix(const QMatrix4x4& matrix);
38 void applyTo(QMatrix4x4 *matrix) const override;
39
40 QMatrix4x4 m_matrix;
41};
42
43class Q_LOCATION_EXPORT QDeclarativeGeoMapQuickItem : public QDeclarativeGeoMapItemBase
44{
45 Q_OBJECT
46 QML_NAMED_ELEMENT(MapQuickItem)
47 QML_ADDED_IN_VERSION(5, 0)
48 Q_PROPERTY(QGeoCoordinate coordinate READ coordinate WRITE setCoordinate NOTIFY coordinateChanged)
49 Q_PROPERTY(QPointF anchorPoint READ anchorPoint WRITE setAnchorPoint NOTIFY anchorPointChanged)
50 Q_PROPERTY(qreal zoomLevel READ zoomLevel WRITE setZoomLevel NOTIFY zoomLevelChanged)
51 Q_PROPERTY(QQuickItem *sourceItem READ sourceItem WRITE setSourceItem NOTIFY sourceItemChanged)
52
53public:
54 explicit QDeclarativeGeoMapQuickItem(QQuickItem *parent = nullptr);
55 ~QDeclarativeGeoMapQuickItem();
56
57 void setMap(QDeclarativeGeoMap *quickMap, QGeoMap *map) override;
58
59 void setCoordinate(const QGeoCoordinate &coordinate);
60 QGeoCoordinate coordinate();
61
62 void setSourceItem(QQuickItem *sourceItem);
63 QQuickItem *sourceItem();
64
65 void setAnchorPoint(const QPointF &anchorPoint);
66 QPointF anchorPoint() const;
67
68 void setZoomLevel(qreal zoomLevel);
69 qreal zoomLevel() const;
70
71 const QGeoShape &geoShape() const override;
72 void setGeoShape(const QGeoShape &shape) override;
73
74 bool contains(const QPointF &point) const override;
75
76Q_SIGNALS:
77 void coordinateChanged();
78 void sourceItemChanged();
79 void anchorPointChanged();
80 void zoomLevelChanged();
81
82protected:
83 void geometryChange(const QRectF &newGeometry, const QRectF &oldGeometry) override;
84 void updatePolish() override;
85
86protected Q_SLOTS:
87 void afterChildrenChanged() override;
88 void afterViewportChanged(const QGeoMapViewportChangeEvent &event) override;
89
90private:
91 qreal scaleFactor();
92 QGeoCoordinate coordinate_;
93 QGeoRectangle geoshape_;
94 QPointer<QQuickItem> sourceItem_;
95 QQuickItem *opacityContainer_ = nullptr;
96 QPointF anchorPoint_;
97 qreal zoomLevel_ = 0.0;
98 bool mapAndSourceItemSet_ = false;
99 bool updatingGeometry_ = false;
100 QMapQuickItemMatrix4x4 *matrix_ = nullptr;
101
102 friend class QDeclarativeGeoMap;
103};
104
105QT_END_NAMESPACE
106
107QML_DECLARE_TYPE(QDeclarativeGeoMapQuickItem)
108
109#endif
#define M_PI
Definition qmath.h:201