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
4#ifndef QDECLARATIVEGEOMAPQUICKITEM_H
5#define QDECLARATIVEGEOMAPQUICKITEM_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
20#include <QtQuick/QQuickItem>
21#include <QtQuick/QSGNode>
22
23#include <QtLocation/private/qdeclarativegeomap_p.h>
24#include <QtLocation/private/qdeclarativegeomapitembase_p.h>
25#include <QtPositioning/qgeoshape.h>
26
27#include <QtCore/qpointer.h>
28
29QT_BEGIN_NAMESPACE
30
31class QMapQuickItemMatrix4x4 : public QQuickTransform
32{
33public:
34 QMapQuickItemMatrix4x4(QObject *parent = nullptr);
35
36 void setMatrix(const QMatrix4x4& matrix);
37 void applyTo(QMatrix4x4 *matrix) const override;
38
39 QMatrix4x4 m_matrix;
40};
41
42class Q_LOCATION_EXPORT QDeclarativeGeoMapQuickItem : public QDeclarativeGeoMapItemBase
43{
44 Q_OBJECT
45 QML_NAMED_ELEMENT(MapQuickItem)
46 QML_ADDED_IN_VERSION(5, 0)
47 Q_PROPERTY(QGeoCoordinate coordinate READ coordinate WRITE setCoordinate NOTIFY coordinateChanged)
48 Q_PROPERTY(QPointF anchorPoint READ anchorPoint WRITE setAnchorPoint NOTIFY anchorPointChanged)
49 Q_PROPERTY(qreal zoomLevel READ zoomLevel WRITE setZoomLevel NOTIFY zoomLevelChanged)
50 Q_PROPERTY(QQuickItem *sourceItem READ sourceItem WRITE setSourceItem NOTIFY sourceItemChanged)
51
52public:
53 explicit QDeclarativeGeoMapQuickItem(QQuickItem *parent = nullptr);
54 ~QDeclarativeGeoMapQuickItem();
55
56 void setMap(QDeclarativeGeoMap *quickMap, QGeoMap *map) override;
57
58 void setCoordinate(const QGeoCoordinate &coordinate);
59 QGeoCoordinate coordinate();
60
61 void setSourceItem(QQuickItem *sourceItem);
62 QQuickItem *sourceItem();
63
64 void setAnchorPoint(const QPointF &anchorPoint);
65 QPointF anchorPoint() const;
66
67 void setZoomLevel(qreal zoomLevel);
68 qreal zoomLevel() const;
69
70 const QGeoShape &geoShape() const override;
71 void setGeoShape(const QGeoShape &shape) override;
72
73 bool contains(const QPointF &point) const override;
74
75Q_SIGNALS:
76 void coordinateChanged();
77 void sourceItemChanged();
78 void anchorPointChanged();
79 void zoomLevelChanged();
80
81protected:
82 void geometryChange(const QRectF &newGeometry, const QRectF &oldGeometry) override;
83 void updatePolish() override;
84
85protected Q_SLOTS:
86 void afterChildrenChanged() override;
87 void afterViewportChanged(const QGeoMapViewportChangeEvent &event) override;
88
89private:
90 qreal scaleFactor();
91 QGeoCoordinate coordinate_;
92 QGeoRectangle geoshape_;
93 QPointer<QQuickItem> sourceItem_;
94 QQuickItem *opacityContainer_ = nullptr;
95 QPointF anchorPoint_;
96 qreal zoomLevel_ = 0.0;
97 bool mapAndSourceItemSet_ = false;
98 bool updatingGeometry_ = false;
99 QMapQuickItemMatrix4x4 *matrix_ = nullptr;
100
101 friend class QDeclarativeGeoMap;
102};
103
104QT_END_NAMESPACE
105
106QML_DECLARE_TYPE(QDeclarativeGeoMapQuickItem)
107
108#endif
#define M_PI
Definition qmath.h:200