Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
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
// Qt-Security score:significant reason:default
4
#
ifndef
QGEOTILEDMAPSCENE_P_P_H
5
#
define
QGEOTILEDMAPSCENE_P_P_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
"qgeotiledmapscene_p.h"
19
#
include
"qgeocameradata_p.h"
20
#
include
"qgeotilespec_p.h"
21
22
#
include
<
QtQuick
/
QSGImageNode
>
23
#
include
<
QtQuick
/
QQuickWindow
>
24
25
#
include
<
QtCore
/
private
/
qobject_p
.
h
>
26
#
include
<
QtPositioning
/
private
/
qdoublevector3d_p
.
h
>
27
28
QT_BEGIN_NAMESPACE
29
30
class
Q_LOCATION_EXPORT QGeoTiledMapTileContainerNode :
public
QSGTransformNode
31
{
32
public
:
33
void
addChild(
const
QGeoTileSpec &spec, QSGImageNode *node)
34
{
35
tiles.insert(spec, node);
36
appendChildNode(node);
37
}
38
QHash<QGeoTileSpec, QSGImageNode *> tiles;
39
};
40
41
class
Q_LOCATION_EXPORT
QGeoTiledMapRootNode
:
public
QSGClipNode
42
{
43
public
:
44
QGeoTiledMapRootNode()
45
: isTextureLinear(
false
)
46
, geometry(QSGGeometry::defaultAttributes_Point2D(), 4)
47
, root(
new
QSGTransformNode())
48
, tiles(
new
QGeoTiledMapTileContainerNode())
49
, wrapLeft(
new
QGeoTiledMapTileContainerNode())
50
, wrapRight(
new
QGeoTiledMapTileContainerNode())
51
{
52
setIsRectangular(
true
);
53
setGeometry(&geometry);
54
root->appendChildNode(tiles);
55
root->appendChildNode(wrapLeft);
56
root->appendChildNode(wrapRight);
57
appendChildNode(root);
58
}
59
60
~QGeoTiledMapRootNode()
61
{
62
qDeleteAll(textures);
63
}
64
65
void
setClipRect(
const
QRect &rect)
66
{
67
if
(rect != clipRect) {
68
QSGGeometry::updateRectGeometry(&geometry, rect);
69
QSGClipNode::setClipRect(rect);
70
clipRect = rect;
71
markDirty(DirtyGeometry);
72
}
73
}
74
75
void
updateTiles(QGeoTiledMapTileContainerNode *root,
76
QGeoTiledMapScenePrivate *d,
77
double
camAdjust,
78
QQuickWindow *window);
79
80
bool
isTextureLinear;
81
82
QSGGeometry geometry;
83
QRect clipRect;
84
85
QSGTransformNode *root;
86
87
QGeoTiledMapTileContainerNode *tiles;
// The majority of the tiles
88
QGeoTiledMapTileContainerNode *wrapLeft;
// When zoomed out, the tiles that wrap around on the left.
89
QGeoTiledMapTileContainerNode *wrapRight;
// When zoomed out, the tiles that wrap around on the right
90
91
QHash<QGeoTileSpec, QSGTexture *> textures;
92
93
#
ifdef
QT_LOCATION_DEBUG
94
double
m_sideLengthPixel;
95
QMap<
double
, QList<QGeoTileSpec>> m_droppedTiles;
96
#
endif
97
};
98
99
class
Q_LOCATION_EXPORT
QGeoTiledMapScenePrivate
:
public
QObjectPrivate
100
{
101
Q_DECLARE_PUBLIC(QGeoTiledMapScene)
102
public
:
103
QGeoTiledMapScenePrivate();
104
~QGeoTiledMapScenePrivate();
105
106
void
addTile(
const
QGeoTileSpec &spec, QSharedPointer<QGeoTileTexture> texture);
107
108
void
setVisibleTiles(
const
QSet<QGeoTileSpec> &visibleTiles);
109
void
removeTiles(
const
QSet<QGeoTileSpec> &oldTiles);
110
bool
buildGeometry(
const
QGeoTileSpec &spec, QSGImageNode *imageNode,
bool
&overzooming);
111
void
updateTileBounds(
const
QSet<QGeoTileSpec> &tiles);
112
void
setupCamera();
113
inline
bool
isTiltedOrRotated()
const
{
return
(m_cameraData.tilt() > 0.0) || (m_cameraData.bearing() > 0.0); }
114
115
public
:
116
117
QSize m_screenSize;
// in pixels
118
int
m_tileSize = 0;
// the pixel resolution for each tile
119
QGeoCameraData m_cameraData;
120
QRectF m_visibleArea;
121
QSet<QGeoTileSpec> m_visibleTiles;
122
123
QDoubleVector3D m_cameraUp;
124
QDoubleVector3D m_cameraEye;
125
QDoubleVector3D m_cameraCenter;
126
QMatrix4x4 m_projectionMatrix;
127
128
// scales up the tile geometry and the camera altitude, resulting in no visible effect
129
// other than to control the accuracy of the render by keeping the values in a sensible range
130
double
m_scaleFactor =
131
#
ifdef
QT_LOCATION_DEBUG
132
1.0;
133
#
else
134
10.0;
135
#
endif
136
137
// rounded down, positive zoom is zooming in, corresponding to reduced altitude
138
int
m_intZoomLevel = 0;
139
140
// mercatorToGrid transform
141
// the number of tiles in each direction for the whole map (earth) at the current zoom level.
142
// it is 1<<zoomLevel
143
int
m_sideLength = 0;
144
145
QHash<QGeoTileSpec, QSharedPointer<QGeoTileTexture> > m_textures;
146
QList<QGeoTileSpec> m_updatedTextures;
147
148
// tilesToGrid transform
149
int
m_minTileX = -1;
// the minimum tile index, i.e. 0 to sideLength which is 1<< zoomLevel
150
int
m_minTileY = -1;
151
int
m_maxTileX = -1;
152
int
m_maxTileY = -1;
153
int
m_tileXWrapsBelow = 0;
// the wrap point as a tile index
154
bool
m_linearScaling =
false
;
155
bool
m_dropTextures =
false
;
156
157
#
ifdef
QT_LOCATION_DEBUG
158
double
m_sideLengthPixel;
159
QGeoTiledMapRootNode *m_mapRoot =
nullptr
;
160
#
endif
161
};
162
163
QT_END_NAMESPACE
164
165
#
endif
// QGEOTILEDMAPSCENE_P_P_H
QGeoTiledMapRootNode
Definition
qgeotiledmapscene_p_p.h:42
QGeoTiledMapScenePrivate
Definition
qgeotiledmapscene_p_p.h:100
qgeotiledmapscene_isTileInViewport_rotationTilt
static bool qgeotiledmapscene_isTileInViewport_rotationTilt(const QRectF &tileRect, const QMatrix4x4 &matrix)
Definition
qgeotiledmapscene.cpp:415
qgeotiledmapscene_isTileInViewport
static bool qgeotiledmapscene_isTileInViewport(const QRectF &tileRect, const QMatrix4x4 &matrix, const bool straight)
Definition
qgeotiledmapscene.cpp:431
qgeotiledmapscene_isTileInViewport_Straight
static bool qgeotiledmapscene_isTileInViewport_Straight(const QRectF &tileRect, const QMatrix4x4 &matrix)
Definition
qgeotiledmapscene.cpp:409
toVector3D
static QVector3D toVector3D(const QDoubleVector3D &in)
Definition
qgeotiledmapscene.cpp:23
qtlocation
src
location
maps
qgeotiledmapscene_p_p.h
Generated on
for Qt by
1.18.0