Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
qgeotiledmapscene_p_p.h
Go to the documentation of this file.
1// Copyright (C) 2018 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#ifndef QGEOTILEDMAPSCENE_P_P_H
4#define QGEOTILEDMAPSCENE_P_P_H
5
6//
7// W A R N I N G
8// -------------
9//
10// This file is not part of the Qt API. It exists purely as an
11// implementation detail. This header file may change from version to
12// version without notice, or even be removed.
13//
14// We mean it.
15//
16
17#include "qgeotiledmapscene_p.h"
18#include "qgeocameradata_p.h"
19#include "qgeotilespec_p.h"
20
21#include <QtQuick/QSGImageNode>
22#include <QtQuick/QQuickWindow>
23
24#include <QtCore/private/qobject_p.h>
25#include <QtPositioning/private/qdoublevector3d_p.h>
26
28
29class Q_LOCATION_PRIVATE_EXPORT QGeoTiledMapTileContainerNode : public QSGTransformNode
30{
31public:
32 void addChild(const QGeoTileSpec &spec, QSGImageNode *node)
33 {
34 tiles.insert(spec, node);
35 appendChildNode(node);
36 }
38};
39
40class Q_LOCATION_PRIVATE_EXPORT QGeoTiledMapRootNode : public QSGClipNode
41{
42public:
44 : isTextureLinear(false)
45 , geometry(QSGGeometry::defaultAttributes_Point2D(), 4)
46 , root(new QSGTransformNode())
48 , wrapLeft(new QGeoTiledMapTileContainerNode())
49 , wrapRight(new QGeoTiledMapTileContainerNode())
50 {
51 setIsRectangular(true);
52 setGeometry(&geometry);
53 root->appendChildNode(tiles);
54 root->appendChildNode(wrapLeft);
55 root->appendChildNode(wrapRight);
56 appendChildNode(root);
57 }
58
60 {
62 }
63
64 void setClipRect(const QRect &rect)
65 {
66 if (rect != clipRect) {
69 clipRect = rect;
70 markDirty(DirtyGeometry);
71 }
72 }
73
74 void updateTiles(QGeoTiledMapTileContainerNode *root,
76 double camAdjust,
78
80
83
85
86 QGeoTiledMapTileContainerNode *tiles; // The majority of the tiles
87 QGeoTiledMapTileContainerNode *wrapLeft; // When zoomed out, the tiles that wrap around on the left.
88 QGeoTiledMapTileContainerNode *wrapRight; // When zoomed out, the tiles that wrap around on the right
89
91
92#ifdef QT_LOCATION_DEBUG
93 double m_sideLengthPixel;
95#endif
96};
97
98class Q_LOCATION_PRIVATE_EXPORT QGeoTiledMapScenePrivate : public QObjectPrivate
99{
100 Q_DECLARE_PUBLIC(QGeoTiledMapScene)
101public:
104
105 void addTile(const QGeoTileSpec &spec, QSharedPointer<QGeoTileTexture> texture);
106
107 void setVisibleTiles(const QSet<QGeoTileSpec> &visibleTiles);
108 void removeTiles(const QSet<QGeoTileSpec> &oldTiles);
109 bool buildGeometry(const QGeoTileSpec &spec, QSGImageNode *imageNode, bool &overzooming);
110 void updateTileBounds(const QSet<QGeoTileSpec> &tiles);
111 void setupCamera();
112 inline bool isTiltedOrRotated() const { return (m_cameraData.tilt() > 0.0) || (m_cameraData.bearing() > 0.0); }
113
114public:
115
116 QSize m_screenSize; // in pixels
117 int m_tileSize = 0; // the pixel resolution for each tile
121
126
127 // scales up the tile geometry and the camera altitude, resulting in no visible effect
128 // other than to control the accuracy of the render by keeping the values in a sensible range
129 double m_scaleFactor =
130#ifdef QT_LOCATION_DEBUG
131 1.0;
132#else
133 10.0;
134#endif
135
136 // rounded down, positive zoom is zooming in, corresponding to reduced altitude
137 int m_intZoomLevel = 0;
138
139 // mercatorToGrid transform
140 // the number of tiles in each direction for the whole map (earth) at the current zoom level.
141 // it is 1<<zoomLevel
142 int m_sideLength = 0;
143
146
147 // tilesToGrid transform
148 int m_minTileX = -1; // the minimum tile index, i.e. 0 to sideLength which is 1<< zoomLevel
149 int m_minTileY = -1;
150 int m_maxTileX = -1;
151 int m_maxTileY = -1;
152 int m_tileXWrapsBelow = 0; // the wrap point as a tile index
153 bool m_linearScaling = false;
154 bool m_dropTextures = false;
155
156#ifdef QT_LOCATION_DEBUG
157 double m_sideLengthPixel;
158 QGeoTiledMapRootNode *m_mapRoot = nullptr;
159#endif
160};
161
163
164#endif // QGEOTILEDMAPSCENE_P_P_H
QGeoTiledMapTileContainerNode * wrapRight
QHash< QGeoTileSpec, QSGTexture * > textures
QGeoTiledMapTileContainerNode * wrapLeft
QGeoTiledMapTileContainerNode * tiles
void setClipRect(const QRect &rect)
QHash< QGeoTileSpec, QSharedPointer< QGeoTileTexture > > m_textures
QList< QGeoTileSpec > m_updatedTextures
QSet< QGeoTileSpec > m_visibleTiles
void addChild(const QGeoTileSpec &spec, QSGImageNode *node)
QHash< QGeoTileSpec, QSGImageNode * > tiles
\inmodule QtCore
Definition qhash.h:818
Definition qlist.h:74
Definition qmap.h:186
The QMatrix4x4 class represents a 4x4 transformation matrix in 3D space.
Definition qmatrix4x4.h:25
\qmltype Window \instantiates QQuickWindow \inqmlmodule QtQuick
\inmodule QtCore\reentrant
Definition qrect.h:483
\inmodule QtCore\reentrant
Definition qrect.h:30
The QSGClipNode class implements the clipping functionality in the scene graph.
Definition qsgnode.h:224
void setClipRect(const QRectF &)
Sets the clip rect of this clip node to rect.
Definition qsgnode.cpp:1099
The QSGGeometry class provides low-level storage for graphics primitives in the \l{Qt Quick Scene Gra...
Definition qsggeometry.h:15
static void updateRectGeometry(QSGGeometry *g, const QRectF &rect)
Updates the geometry g with the coordinates in rect.
The QSGImageNode class is provided for convenience to easily draw textured content using the QML scen...
void appendChildNode(QSGNode *node)
Appends node to this node's list of children.
Definition qsgnode.cpp:396
void markDirty(DirtyState bits)
Notifies all connected renderers that the node has dirty bits.
Definition qsgnode.cpp:622
The QSGTransformNode class implements transformations in the scene graph.
Definition qsgnode.h:244
Definition qset.h:18
\inmodule QtCore
\inmodule QtCore
Definition qsize.h:25
qDeleteAll(list.begin(), list.end())
rect
[4]
Combined button and popup list for selecting options.
GLuint const GLuint GLuint const GLuint * textures
GLenum GLuint texture
aWidget window() -> setWindowTitle("New Window Title")
[2]