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
73Q_SIGNALS:
74 void coordinateChanged();
75 void sourceItemChanged();
76 void anchorPointChanged();
77 void zoomLevelChanged();
78
79protected:
80 void geometryChange(const QRectF &newGeometry, const QRectF &oldGeometry) override;
81 void updatePolish() override;
82
83protected Q_SLOTS:
84 void afterChildrenChanged() override;
85 void afterViewportChanged(const QGeoMapViewportChangeEvent &event) override;
86
87private:
88 qreal scaleFactor();
89 QGeoCoordinate coordinate_;
90 QGeoRectangle geoshape_;
91 QPointer<QQuickItem> sourceItem_;
92 QQuickItem *opacityContainer_ = nullptr;
93 QPointF anchorPoint_;
94 qreal zoomLevel_ = 0.0;
95 bool mapAndSourceItemSet_ = false;
96 bool updatingGeometry_ = false;
97 QMapQuickItemMatrix4x4 *matrix_ = nullptr;
98
99 friend class QDeclarativeGeoMap;
100};
101
102QT_END_NAMESPACE
103
104QML_DECLARE_TYPE(QDeclarativeGeoMapQuickItem)
105
106#endif
#define M_PI
Definition qmath.h:200