Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qdeclarativegeomapitembase_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 QDECLARATIVEGEOMAPITEMBASE_H
5#define QDECLARATIVEGEOMAPITEMBASE_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 <QtPositioning/QGeoShape>
22
23#include <QtLocation/qlocation.h>
24#include <QtLocation/private/qdeclarativegeomap_p.h>
25#include <QtLocation/private/qlocationglobal_p.h>
26#include <QtLocation/private/qgeomap_p.h>
27#include <QtLocation/private/qdeclarativegeomapitemtransitionmanager_p.h>
28#include <QScopedPointer>
29#include <QtQuickShapes/private/qquickshape_p.h>
30
32
33struct Q_LOCATION_EXPORT QGeoMapViewportChangeEvent
34{
37
38 bool zoomLevelChanged = false;
39 bool centerChanged = false;
40 bool mapSizeChanged = false;
41 bool tiltChanged = false;
42 bool bearingChanged = false;
43 bool rollChanged = false;
44};
45
46class Q_LOCATION_EXPORT QDeclarativeGeoMapItemBase : public QQuickItem
47{
49 QML_NAMED_ELEMENT(GeoMapItemBase)
51 QML_UNCREATABLE("GeoMapItemBase is not intended instantiable by developer.")
52 Q_ENUMS(ReferenceSurface)
53
54 Q_PROPERTY(QGeoShape geoShape READ geoShape WRITE setGeoShape STORED false )
55 Q_PROPERTY(bool autoFadeIn READ autoFadeIn WRITE setAutoFadeIn REVISION(5, 14))
56 Q_PROPERTY(QLocation::ReferenceSurface referenceSurface READ referenceSurface WRITE setReferenceSurface NOTIFY referenceSurfaceChanged REVISION(6, 6))
57 Q_PROPERTY(int lodThreshold READ lodThreshold WRITE setLodThreshold NOTIFY lodThresholdChanged REVISION(5, 15))
58
59public:
62
63
64 virtual void setMap(QDeclarativeGeoMap *quickMap, QGeoMap *map);
65 virtual void setPositionOnMap(const QGeoCoordinate &coordinate, const QPointF &offset);
66
67 QDeclarativeGeoMap *quickMap() const { return quickMap_; }
68 QGeoMap *map() const { return map_; }
69 virtual const QGeoShape &geoShape() const = 0;
70 virtual void setGeoShape(const QGeoShape &shape) = 0;
71
72 bool autoFadeIn() const;
73 void setAutoFadeIn(bool fadeIn);
74
75 QLocation::ReferenceSurface referenceSurface() const;
76 void setReferenceSurface(QLocation::ReferenceSurface referenceSurface);
77
78 int lodThreshold() const;
79 void setLodThreshold(int lt);
80 unsigned int zoomForLOD(int zoom) const;
81
82 QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *) override;
83 virtual QSGNode *updateMapItemPaintNode(QSGNode *, UpdatePaintNodeData *);
84
85 inline QGeoMap::ItemType itemType() const { return m_itemType; }
86 qreal mapItemOpacity() const;
87
88 void setParentGroup(QDeclarativeGeoMapItemGroup &parentGroup);
89
90 template <typename T = QObject>
91 QList<T*> quickChildren() const
92 {
93 QList<T*> res;
94 QObjectList kids = children();
95 const QList<QQuickItem *> quickKids = childItems();
96 for (const auto &quickKid : quickKids)
97 kids.append(quickKid);
98 for (auto *kid : std::as_const(kids)) {
99 if (auto *val = qobject_cast<T*>(kid))
100 res.push_back(val);
101 }
102 return res;
103 }
104
105 void setShapeTriangulationScale(QQuickShape *shape, qreal maxCoord) const;
106
109 Q_REVISION(12) void addTransitionFinished();
110 Q_REVISION(12) void removeTransitionFinished();
111 void referenceSurfaceChanged();
112 void lodThresholdChanged();
113
114protected Q_SLOTS:
115 virtual void afterChildrenChanged();
116 virtual void afterViewportChanged(const QGeoMapViewportChangeEvent &event) = 0;
117 void polishAndUpdate();
118
119protected:
120 float zoomLevelOpacity() const;
121 bool isPolishScheduled() const;
122
123 QGeoMap::ItemType m_itemType = QGeoMap::NoItem;
124
126 void baseCameraDataChanged(const QGeoCameraData &camera);
127 void visibleAreaChanged();
128
129private:
130 QPointer<QGeoMap> map_;
131 QDeclarativeGeoMap *quickMap_ = nullptr;
132
133 QSizeF lastMapSize_;
134 QGeoCameraData lastCameraData_;
135
136 QDeclarativeGeoMapItemGroup *parentGroup_ = nullptr;
137
138 std::unique_ptr<QDeclarativeGeoMapItemTransitionManager> m_transitionManager;
139 bool m_autoFadeIn = true;
140 QLocation::ReferenceSurface m_referenceSurface = QLocation::ReferenceSurface::Map;
141 int m_lodThreshold = 0;
142
143 friend class QDeclarativeGeoMap;
146};
147
149{
151public:
152 QDeclarativeGeoMapPainterPath(QObject *parent = nullptr) : QQuickCurve(parent) {}
154 {
155 return m_path;
156 }
158 {
159 m_path = path;
160 emit changed();
161 }
162 void addToPath(QPainterPath &path, const QQuickPathData &) override
163 {
164 path.addPath(m_path);
165 }
166private:
167 QPainterPath m_path;
168};
169
171
172#endif
virtual const QGeoShape & geoShape() const =0
Q_REVISION(12) void addTransitionFinished()
virtual void setGeoShape(const QGeoShape &shape)=0
void setPath(const QPainterPath &path)
void addToPath(QPainterPath &path, const QQuickPathData &) override
QDeclarativeGeoMapPainterPath(QObject *parent=nullptr)
\inmodule QtPositioning
\inmodule QtPositioning
Definition qgeoshape.h:17
\inmodule QtCore
Definition qobject.h:103
\inmodule QtGui
\inmodule QtCore\reentrant
Definition qpoint.h:217
The QQuickItem class provides the most basic of all visual items in \l {Qt Quick}.
Definition qquickitem.h:63
\group qtquick-scenegraph-nodes \title Qt Quick Scene Graph Node classes
Definition qsgnode.h:37
\inmodule QtCore
Definition qsize.h:208
QCamera * camera
Definition camera.cpp:19
QMap< QString, QString > map
[6]
\inmodule QtLocation \keyword QLocation Namespace
Definition qlocation.cpp:8
Combined button and popup list for selecting options.
DBusConnection const char DBusError DBusBusType DBusError return DBusConnection DBusHandleMessageFunction void DBusFreeFunction return DBusConnection return DBusConnection return const char DBusError return DBusConnection DBusMessage dbus_uint32_t return DBusConnection dbus_bool_t DBusConnection DBusAddWatchFunction DBusRemoveWatchFunction DBusWatchToggledFunction void DBusFreeFunction return DBusConnection DBusDispatchStatusFunction void DBusFreeFunction DBusTimeout return DBusTimeout return DBusWatch return DBusWatch unsigned int return DBusError const DBusError return const DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessageIter int const void return DBusMessageIter DBusMessageIter return DBusMessageIter void DBusMessageIter void int return DBusMessage DBusMessageIter return DBusMessageIter return DBusMessageIter DBusMessageIter const char const char const char const char return DBusMessage return DBusMessage const char return DBusMessage dbus_bool_t return DBusMessage dbus_uint32_t return DBusMessage void
GLenum GLuint GLintptr offset
struct _cl_event * event
GLuint res
GLuint GLfloat * val
GLsizei const GLchar *const * path
#define QML_UNCREATABLE(REASON)
#define QML_NAMED_ELEMENT(NAME)
#define QML_ADDED_IN_VERSION(MAJOR, MINOR)
#define Q_PROPERTY(...)
#define Q_OBJECT
#define Q_REVISION(...)
#define Q_SLOTS
#define Q_ENUMS(x)
#define Q_SIGNALS
#define emit
double qreal
Definition qtypes.h:187
#define explicit