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
qgeotiledmapscene.cpp
Go to the documentation of this file.
1// Copyright (C) 2015 The Qt Company Ltd.
2// Copyright (C) 2014 Jolla Ltd, author: <gunnar.sletta@jollamobile.com>
3// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
4
7#include "qgeocameradata_p.h"
9#include "qgeotilespec_p.h"
10
11#include <QtQuick/QQuickWindow>
12#include <QtGui/QVector3D>
13
14#include <QtCore/private/qobject_p.h>
15#include <QtPositioning/private/qdoublevector3d_p.h>
16#include <QtPositioning/private/qlocationutils_p.h>
17#include <QtPositioning/private/qdoublematrix4x4_p.h>
18#include <QtPositioning/private/qwebmercator_p.h>
19
20#include <cmath>
21
23{
24 return QVector3D(in.x(), in.y(), in.z());
25}
26
28
33
37
39{
41 d->m_screenSize = size;
42}
43
44void QGeoTiledMapScene::updateSceneParameters()
45{
47 d->m_intZoomLevel = static_cast<int>(std::floor(d->m_cameraData.zoomLevel()));
48 const float delta = d->m_cameraData.zoomLevel() - d->m_intZoomLevel;
49 d->m_linearScaling = qAbs(delta) > 0.05 || d->isTiltedOrRotated();
50 d->m_sideLength = 1 << d->m_intZoomLevel;
51}
52
54{
56 if (d->m_tileSize == tileSize)
57 return;
58
59 d->m_tileSize = tileSize;
60 updateSceneParameters();
61}
62
64{
66 d->m_cameraData = cameraData;
67 updateSceneParameters();
68}
69
71{
73 if (d->m_visibleArea == visibleArea)
74 return;
75 d->m_visibleArea = visibleArea;
76 updateSceneParameters();
77}
78
79void QGeoTiledMapScene::setVisibleTiles(const QSet<QGeoTileSpec> &tiles)
80{
82 d->setVisibleTiles(tiles);
83}
84
85const QSet<QGeoTileSpec> &QGeoTiledMapScene::visibleTiles() const
86{
87 Q_D(const QGeoTiledMapScene);
88 return d->m_visibleTiles;
89}
90
91void QGeoTiledMapScene::addTile(const QGeoTileSpec &spec, QSharedPointer<QGeoTileTexture> texture)
92{
94 d->addTile(spec, texture);
95}
96
98{
100 QSet<QGeoTileSpec> textured;
101 for (auto it = d->m_textures.cbegin(); it != d->m_textures.cend(); ++it)
102 textured += it.value()->spec;
103
104 return textured;
105}
106
108{
110 d->m_textures.clear();
111 d->m_dropTextures = true;
112}
113
118
122
123bool QGeoTiledMapScenePrivate::buildGeometry(const QGeoTileSpec &spec, QSGImageNode *imageNode, bool &overzooming)
124{
125 overzooming = false;
126 int x = spec.x();
127
128 if (x < m_tileXWrapsBelow)
129 x += m_sideLength;
130
131 if ((x < m_minTileX)
132 || (m_maxTileX < x)
133 || (spec.y() < m_minTileY)
134 || (m_maxTileY < spec.y())
135 || (spec.zoom() != m_intZoomLevel)) {
136 return false;
137 }
138
139 double edge = m_scaleFactor * m_tileSize;
140
141 double x1 = (x - m_minTileX);
142 double x2 = x1 + 1.0;
143
144 double y1 = (m_minTileY - spec.y());
145 double y2 = y1 - 1.0;
146
147 x1 *= edge;
148 x2 *= edge;
149 y1 *= edge;
150 y2 *= edge;
151
152 imageNode->setRect(QRectF(QPointF(x1, y2), QPointF(x2, y1)));
154
155 // Calculate the texture mapping, in case we are magnifying some lower ZL tile
156 const auto it = m_textures.find(spec); // This should be always found, but apparently sometimes it isn't, possibly due to memory shortage
157 if (it != m_textures.end()) {
158 if (it.value()->spec.zoom() < spec.zoom()) {
159 // Currently only using lower ZL tiles for the overzoom.
160 const int tilesPerTexture = 1 << (spec.zoom() - it.value()->spec.zoom());
161 const int mappedSize = imageNode->texture()->textureSize().width() / tilesPerTexture;
162 const int x = (spec.x() % tilesPerTexture) * mappedSize;
163 const int y = (spec.y() % tilesPerTexture) * mappedSize;
164 imageNode->setSourceRect(QRectF(x, y, mappedSize, mappedSize));
165 overzooming = true;
166 } else {
167 imageNode->setSourceRect(QRectF(QPointF(0,0), imageNode->texture()->textureSize()));
168 }
169 } else {
170 qWarning() << "!! buildGeometry: tileSpec not present in m_textures !!";
171 imageNode->setSourceRect(QRectF(QPointF(0,0), imageNode->texture()->textureSize()));
172 }
173
174 return true;
175}
176
177void QGeoTiledMapScenePrivate::addTile(const QGeoTileSpec &spec, QSharedPointer<QGeoTileTexture> texture)
178{
179 if (!m_visibleTiles.contains(spec)) // Don't add the geometry if it isn't visible
180 return;
181
182 if (m_textures.contains(spec))
185}
186
187void QGeoTiledMapScenePrivate::setVisibleTiles(const QSet<QGeoTileSpec> &visibleTiles)
188{
189 // work out the tile bounds for the new scene
190 updateTileBounds(visibleTiles);
191
192 // set up the gl camera for the new scene
193 setupCamera();
194
195 QSet<QGeoTileSpec> toRemove = m_visibleTiles - visibleTiles;
196 if (!toRemove.isEmpty())
197 removeTiles(toRemove);
198
199 m_visibleTiles = visibleTiles;
200}
201
202void QGeoTiledMapScenePrivate::removeTiles(const QSet<QGeoTileSpec> &oldTiles)
203{
205 iter i = oldTiles.constBegin();
206 iter end = oldTiles.constEnd();
207
208 for (; i != end; ++i) {
209 QGeoTileSpec tile = *i;
210 m_textures.remove(tile);
211 }
212}
213
214void QGeoTiledMapScenePrivate::updateTileBounds(const QSet<QGeoTileSpec> &tiles)
215{
216 if (tiles.isEmpty()) {
217 m_minTileX = -1;
218 m_minTileY = -1;
219 m_maxTileX = -1;
220 m_maxTileY = -1;
221 return;
222 }
223
225 iter i = tiles.constBegin();
226 iter end = tiles.constEnd();
227
228 // determine whether the set of map tiles crosses the dateline.
229 // A gap in the tiles indicates dateline crossing
230 bool hasFarLeft = false;
231 bool hasFarRight = false;
232 bool hasMidLeft = false;
233 bool hasMidRight = false;
234
235 for (; i != end; ++i) {
236 if ((*i).zoom() != m_intZoomLevel)
237 continue;
238 int x = (*i).x();
239 if (x == 0)
240 hasFarLeft = true;
241 else if (x == (m_sideLength - 1))
242 hasFarRight = true;
243 else if (x == ((m_sideLength / 2) - 1)) {
244 hasMidLeft = true;
245 } else if (x == (m_sideLength / 2)) {
246 hasMidRight = true;
247 }
248 }
249
250 // if dateline crossing is detected we wrap all x pos of tiles
251 // that are in the left half of the map.
253
254 if (hasFarLeft && hasFarRight) {
255 if (!hasMidRight) {
257 } else if (!hasMidLeft) {
259 }
260 }
261
262 // finally, determine the min and max bounds
263 i = tiles.constBegin();
264
265 QGeoTileSpec tile = *i;
266
267 int x = tile.x();
268 if (tile.x() < m_tileXWrapsBelow)
269 x += m_sideLength;
270
271 m_minTileX = x;
272 m_maxTileX = x;
273 m_minTileY = tile.y();
274 m_maxTileY = tile.y();
275
276 ++i;
277
278 for (; i != end; ++i) {
279 tile = *i;
280 if (tile.zoom() != m_intZoomLevel)
281 continue;
282
283 int x = tile.x();
284 if (tile.x() < m_tileXWrapsBelow)
285 x += m_sideLength;
286
289 m_minTileY = qMin(m_minTileY, tile.y());
290 m_maxTileY = qMax(m_maxTileY, tile.y());
291 }
292}
293
295{
296 // NOTE: The following instruction is correct only because WebMercator is a square projection!
297 double f = m_screenSize.height();
298
299 // Using fraction of zoom level, z varies between [ m_tileSize , 2 * m_tileSize [
300 double z = std::pow(2.0, m_cameraData.zoomLevel() - m_intZoomLevel) * m_tileSize;
301
302 // calculate altitude that allows the visible map tiles
303 // to fit in the screen correctly (note that a larger f will cause
304 // the camera be higher, resulting in gray areas displayed around
305 // the tiles)
306 double altitude = f / (2.0 * z);
307
308 // calculate center
309 double edge = m_scaleFactor * m_tileSize;
310
311 // first calculate the camera center in map space in the range of 0 <-> sideLength (2^z)
313 QDoubleVector3D center = (m_sideLength * camCenterMercator);
314
315 // wrap the center if necessary (due to dateline crossing)
316 if (center.x() < m_tileXWrapsBelow)
317 center.setX(center.x() + 1.0 * m_sideLength);
318
319 // work out where the camera center is w.r.t minimum tile bounds
320 center.setX(center.x() - 1.0 * m_minTileX);
321 center.setY(1.0 * m_minTileY - center.y());
322
323 // apply necessary scaling to the camera center
324 center *= edge;
325
326 // calculate eye
327 double apertureSize = 1.0;
328 if (m_cameraData.fieldOfView() != 90.0) //aperture(90 / 2) = 1
329 apertureSize = tan(QLocationUtils::radians(m_cameraData.fieldOfView()) * 0.5);
330 QDoubleVector3D eye = center;
331 eye.setZ(altitude * edge / apertureSize);
332
333 // calculate up
334
335 QDoubleVector3D view = eye - center;
338
339 // old bearing, tilt and roll code.
340 // Now using double matrices until distilling the transformation to QMatrix4x4
341 QDoubleMatrix4x4 mBearing;
342 // -1.0 * bearing removed, now map north goes in the bearing direction
343 mBearing.rotate(-1.0 * m_cameraData.bearing(), view);
344 up = mBearing * up;
345
347 if (m_cameraData.tilt() > 0.01) {
348 QDoubleMatrix4x4 mTilt;
349 mTilt.rotate(m_cameraData.tilt(), side2);
350 eye = mTilt * view + center;
351 }
352
353 view = eye - center;
354 view.normalize();
355 side = QDoubleVector3D::normal(view, QDoubleVector3D(0.0, 1.0, 0.0));
356 up = QDoubleVector3D::normal(view, side2);
357
358 // QMatrix4x4 mRoll;
359 // mRoll.rotate(camera.roll(), view);
360 // up = mRoll * up;
361
362 // near plane and far plane
363
364 double nearPlane = 1.0;
365 // Clip plane. Used to be (altitude + 1.0) * edge. This does not affect the perspective. minimum value would be > 0.0
366 // Since, for some reasons possibly related to how QSG works, this clipping plane is unable to clip part of tiles,
367 // Instead of farPlane = (altitude + m_cameraData.clipDistance()) * edge , we use a fixed large clipDistance, and
368 // leave the clipping only in QGeoCameraTiles::createFrustum
369 double farPlane = (altitude + 10000.0) * edge;
370
371 m_cameraUp = up;
372 m_cameraCenter = center;
373 m_cameraEye = eye;
374
375 double aspectRatio = 1.0 * m_screenSize.width() / m_screenSize.height();
376 float halfWidth = 1 * apertureSize;
377 float halfHeight = 1 * apertureSize;
378 halfWidth *= aspectRatio;
379
380// m_projectionMatrix.setToIdentity();
381// m_projectionMatrix.frustum(-halfWidth, halfWidth, -halfHeight, halfHeight, nearPlane, farPlane);
382
384 if (va.isNull())
386
388 QPointF vaCenter = va.center();
389
390 QPointF screenCenter = screen.center();
391 QPointF diff = screenCenter - vaCenter;
392 float xdiffpct = diff.x() / m_screenSize.width();
393 float ydiffpct = -(diff.y() / m_screenSize.height());
394
396 float l = -halfWidth + (2 * halfWidth) * xdiffpct;
397 float r = halfWidth + (2 * halfWidth) * xdiffpct;
398 float t = halfHeight + (2 * halfHeight) * ydiffpct;
399 float b = -halfHeight + (2 * halfHeight) * ydiffpct;
400
402 r,
403 b,
404 t,
405 nearPlane, farPlane);
406}
407
409{
410 const QRectF boundingRect = QRectF(matrix.map(tileRect.topLeft()), matrix.map(tileRect.bottomRight()));
411 return QRectF(-1, -1, 2, 2).intersects(boundingRect);
412}
413
415{
416 // Transformed corners
417 const QPointF tlt = matrix.map(tileRect.topLeft());
418 const QPointF trt = matrix.map(tileRect.topRight());
419 const QPointF blt = matrix.map(tileRect.bottomLeft());
420 const QPointF brt = matrix.map(tileRect.bottomRight());
421
422 const QRectF boundingRect = QRectF(QPointF(qMin(qMin(qMin(tlt.x(), trt.x()), blt.x()), brt.x())
423 ,qMax(qMax(qMax(tlt.y(), trt.y()), blt.y()), brt.y()))
424 ,QPointF(qMax(qMax(qMax(tlt.x(), trt.x()), blt.x()), brt.x())
425 ,qMin(qMin(qMin(tlt.y(), trt.y()), blt.y()), brt.y()))
426 );
427 return QRectF(-1, -1, 2, 2).intersects(boundingRect);
428}
429
430static bool qgeotiledmapscene_isTileInViewport(const QRectF &tileRect, const QMatrix4x4 &matrix, const bool straight)
431{
432 if (straight)
435}
436
439 double camAdjust,
441{
442 // Set up the matrix...
443 QDoubleVector3D eye = d->m_cameraEye;
444 eye.setX(eye.x() + camAdjust);
445 QDoubleVector3D center = d->m_cameraCenter;
446 center.setX(center.x() + camAdjust);
447 QMatrix4x4 cameraMatrix;
448 cameraMatrix.lookAt(toVector3D(eye), toVector3D(center), toVector3D(d->m_cameraUp));
449 root->setMatrix(d->m_projectionMatrix * cameraMatrix);
450
451 QSet<QGeoTileSpec> tilesInSG;
452 for (auto it = root->tiles.cbegin(), end = root->tiles.cend(); it != end; ++it)
453 tilesInSG.insert(it.key());
454 const QSet<QGeoTileSpec> toRemove = tilesInSG - d->m_visibleTiles;
455 const QSet<QGeoTileSpec> toAdd = d->m_visibleTiles - tilesInSG;
456
457 for (const QGeoTileSpec &s : toRemove)
458 delete root->tiles.take(s);
459 bool straight = !d->isTiltedOrRotated();
460 bool overzooming;
461 qreal pixelRatio = window->effectiveDevicePixelRatio();
462#ifdef QT_LOCATION_DEBUG
463 QList<QGeoTileSpec> droppedTiles;
464#endif
466 it != root->tiles.end(); ) {
467 QSGImageNode *node = it.value();
468 bool ok = d->buildGeometry(it.key(), node, overzooming)
469 && qgeotiledmapscene_isTileInViewport(node->rect(), root->matrix(), straight);
470
471 QSGNode::DirtyState dirtyBits = {};
472
473 if (!ok) {
474#ifdef QT_LOCATION_DEBUG
475 droppedTiles.append(it.key());
476#endif
477 it = root->tiles.erase(it);
478 delete node;
479 } else {
480 if (isTextureLinear != d->m_linearScaling) {
481 if (node->texture()->textureSize().width() > d->m_tileSize * pixelRatio) {
482 node->setFiltering(QSGTexture::Linear); // With mipmapping QSGTexture::Nearest generates artifacts
484 } else {
485 node->setFiltering((d->m_linearScaling || overzooming) ? QSGTexture::Linear : QSGTexture::Nearest);
486 }
487 dirtyBits |= QSGNode::DirtyMaterial;
488 }
489 if (dirtyBits != 0)
490 node->markDirty(dirtyBits);
491 it++;
492 }
493 }
494
495 for (const QGeoTileSpec &s : toAdd) {
496 QGeoTileTexture *tileTexture = d->m_textures.value(s).data();
497 if (!tileTexture || tileTexture->image.isNull()) {
498#ifdef QT_LOCATION_DEBUG
499 droppedTiles.append(s);
500#endif
501 continue;
502 }
503 QSGImageNode *tileNode = window->createImageNode();
504 // note: setTexture will update coordinates so do it here, before we buildGeometry
505 tileNode->setTexture(textures.value(s));
506 if (d->buildGeometry(s, tileNode, overzooming)
507 && qgeotiledmapscene_isTileInViewport(tileNode->rect(), root->matrix(), straight)) {
508 if (tileNode->texture()->textureSize().width() > d->m_tileSize * pixelRatio) {
509 tileNode->setFiltering(QSGTexture::Linear); // with mipmapping QSGTexture::Nearest generates artifacts
510 tileNode->setMipmapFiltering(QSGTexture::Linear);
511 } else {
512 tileNode->setFiltering((d->m_linearScaling || overzooming) ? QSGTexture::Linear : QSGTexture::Nearest);
513 }
514 root->addChild(s, tileNode);
515 } else {
516#ifdef QT_LOCATION_DEBUG
517 droppedTiles.append(s);
518#endif
519 delete tileNode;
520 }
521 }
522
523#ifdef QT_LOCATION_DEBUG
524 m_droppedTiles[camAdjust] = droppedTiles;
525#endif
526}
527
529{
531 float w = d->m_screenSize.width();
532 float h = d->m_screenSize.height();
533 if (w <= 0 || h <= 0) {
534 delete oldNode;
535 return nullptr;
536 }
537
538 QGeoTiledMapRootNode *mapRoot = static_cast<QGeoTiledMapRootNode *>(oldNode);
539 if (!mapRoot)
540 mapRoot = new QGeoTiledMapRootNode();
541
542#ifdef QT_LOCATION_DEBUG
543 mapRoot->m_droppedTiles.clear();
544 d->m_mapRoot = mapRoot;
545#endif
546
547 // Setting clip rect to fullscreen, as now the map can never be smaller than the viewport.
548 mapRoot->setClipRect(QRect(0, 0, w, h));
549
550 QMatrix4x4 itemSpaceMatrix;
551 itemSpaceMatrix.scale(w / 2, h / 2);
552 itemSpaceMatrix.translate(1, 1);
553 itemSpaceMatrix.scale(1, -1);
554 mapRoot->root->setMatrix(itemSpaceMatrix);
555
556 if (d->m_dropTextures) {
557 for (const QGeoTileSpec &s : mapRoot->tiles->tiles.keys())
558 delete mapRoot->tiles->tiles.take(s);
559 for (const QGeoTileSpec &s : mapRoot->wrapLeft->tiles.keys())
560 delete mapRoot->wrapLeft->tiles.take(s);
561 for (const QGeoTileSpec &s : mapRoot->wrapRight->tiles.keys())
562 delete mapRoot->wrapRight->tiles.take(s);
563 for (const QGeoTileSpec &spec : mapRoot->textures.keys())
564 mapRoot->textures.take(spec)->deleteLater();
565 d->m_dropTextures = false;
566 }
567
568 // Evicting loZL tiles temporarily used in place of hiZL ones
569 if (d->m_updatedTextures.size()) {
570 const QList<QGeoTileSpec> &toRemove = d->m_updatedTextures;
571 for (const QGeoTileSpec &s : toRemove) {
572 if (mapRoot->tiles->tiles.contains(s))
573 delete mapRoot->tiles->tiles.take(s);
574
575 if (mapRoot->wrapLeft->tiles.contains(s))
576 delete mapRoot->wrapLeft->tiles.take(s);
577
578 if (mapRoot->wrapRight->tiles.contains(s))
579 delete mapRoot->wrapRight->tiles.take(s);
580
581 if (mapRoot->textures.contains(s))
582 mapRoot->textures.take(s)->deleteLater();
583 }
584 d->m_updatedTextures.clear();
585 }
586
587 QSet<QGeoTileSpec> textures;
588 for (auto it = mapRoot->textures.cbegin(), end = mapRoot->textures.cend(); it != end; ++it)
589 textures.insert(it.key());
590 const QSet<QGeoTileSpec> toRemove = textures - d->m_visibleTiles;
591 const QSet<QGeoTileSpec> toAdd = d->m_visibleTiles - textures;
592
593 for (const QGeoTileSpec &spec : toRemove)
594 mapRoot->textures.take(spec)->deleteLater();
595 for (const QGeoTileSpec &spec : toAdd) {
596 QGeoTileTexture *tileTexture = d->m_textures.value(spec).data();
597 if (!tileTexture || tileTexture->image.isNull())
598 continue;
599 mapRoot->textures.insert(spec, window->createTextureFromImage(tileTexture->image));
600 }
601
602 double sideLength = d->m_scaleFactor * d->m_tileSize * d->m_sideLength;
603#ifdef QT_LOCATION_DEBUG
604 d->m_sideLengthPixel = sideLength;
605#endif
606 mapRoot->updateTiles(mapRoot->tiles, d, 0, window);
607 mapRoot->updateTiles(mapRoot->wrapLeft, d, +sideLength, window);
608 mapRoot->updateTiles(mapRoot->wrapRight, d, -sideLength, window);
609
610 mapRoot->isTextureLinear = d->m_linearScaling;
611
612 return mapRoot;
613}
614
void rotate(double angle, const QDoubleVector3D &vector)
void setX(double x)
static QDoubleVector3D normal(const QDoubleVector3D &v1, const QDoubleVector3D &v2)
double zoomLevel() const
double tilt() const
double fieldOfView() const
double bearing() const
QGeoCoordinate center() const
int x() const
int zoom() const
int y() const
void updateTiles(QGeoTiledMapTileContainerNode *root, QGeoTiledMapScenePrivate *d, double camAdjust, QQuickWindow *window)
QHash< QGeoTileSpec, QSharedPointer< QGeoTileTexture > > m_textures
bool buildGeometry(const QGeoTileSpec &spec, QSGImageNode *imageNode, bool &overzooming)
QList< QGeoTileSpec > m_updatedTextures
void removeTiles(const QSet< QGeoTileSpec > &oldTiles)
void updateTileBounds(const QSet< QGeoTileSpec > &tiles)
void addTile(const QGeoTileSpec &spec, QSharedPointer< QGeoTileTexture > texture)
void setVisibleTiles(const QSet< QGeoTileSpec > &visibleTiles)
QSet< QGeoTileSpec > m_visibleTiles
const QSet< QGeoTileSpec > & visibleTiles() const
void setCameraData(const QGeoCameraData &cameraData)
QGeoTiledMapScene(QObject *parent=nullptr)
void setScreenSize(const QSize &size)
void addTile(const QGeoTileSpec &spec, QSharedPointer< QGeoTileTexture > texture)
QSet< QGeoTileSpec > texturedTiles()
void setVisibleTiles(const QSet< QGeoTileSpec > &tiles)
QSGNode * updateSceneGraph(QSGNode *oldNode, QQuickWindow *window)
void setTileSize(int tileSize)
void setVisibleArea(const QRectF &visibleArea)
\inmodule QtCore
Definition qhash.h:1103
bool remove(const Key &key)
Removes the item that has the key from the hash.
Definition qhash.h:958
iterator find(const Key &key)
Returns an iterator pointing to the item with the key in the hash.
Definition qhash.h:1291
bool contains(const Key &key) const noexcept
Returns true if the hash contains an item with the key; otherwise returns false.
Definition qhash.h:1007
iterator end() noexcept
Returns an \l{STL-style iterators}{STL-style iterator} pointing to the imaginary item after the last ...
Definition qhash.h:1216
iterator insert(const Key &key, const T &value)
Inserts a new item with the key and a value of value.
Definition qhash.h:1303
bool isNull() const
Returns true if it is a null image, otherwise returns false.
Definition qimage.cpp:1222
void append(parameter_type t)
Definition qlist.h:458
static double radians(double degrees)
The QMatrix4x4 class represents a 4x4 transformation matrix in 3D space.
Definition qmatrix4x4.h:25
void frustum(float left, float right, float bottom, float top, float nearPlane, float farPlane)
Multiplies this matrix by another that applies a perspective frustum projection for a window with low...
void lookAt(const QVector3D &eye, const QVector3D &center, const QVector3D &up)
Multiplies this matrix by a viewing matrix derived from an eye point.
void scale(const QVector3D &vector)
Multiplies this matrix by another that scales coordinates by the components of vector.
void setToIdentity()
Sets this matrix to the identity.
Definition qmatrix4x4.h:316
\inmodule QtCore
Definition qobject.h:103
\inmodule QtCore\reentrant
Definition qpoint.h:217
constexpr qreal x() const noexcept
Returns the x coordinate of this point.
Definition qpoint.h:343
constexpr qreal y() const noexcept
Returns the y coordinate of this point.
Definition qpoint.h:348
\qmltype Window \instantiates QQuickWindow \inqmlmodule QtQuick
\inmodule QtCore\reentrant
Definition qrect.h:484
bool intersects(const QRectF &r) const noexcept
Returns true if this rectangle intersects with the given rectangle (i.e.
Definition qrect.cpp:2271
constexpr bool isNull() const noexcept
Returns true if the rectangle is a null rectangle, otherwise returns false.
Definition qrect.h:658
constexpr QPointF center() const noexcept
Returns the center point of the rectangle.
Definition qrect.h:699
\inmodule QtCore\reentrant
Definition qrect.h:30
The QSGImageNode class is provided for convenience to easily draw textured content using the QML scen...
virtual void setSourceRect(const QRectF &r)=0
Sets the source rect of this image node to rect.
virtual void setFiltering(QSGTexture::Filtering filtering)=0
Sets the filtering to be used for this image node to filtering.
virtual void setTextureCoordinatesTransform(TextureCoordinatesTransformMode mode)=0
Sets the method used to generate texture coordinates to mode.
virtual QRectF rect() const =0
Returns the target rect of this image node.
virtual void setRect(const QRectF &rect)=0
Sets the target rect of this image node to rect.
virtual QSGTexture * texture() const =0
Returns the texture for this image node.
virtual void setMipmapFiltering(QSGTexture::Filtering filtering)=0
Sets the mipmap filtering to be used for this image node to filtering.
\group qtquick-scenegraph-nodes \title Qt Quick Scene Graph Node classes
Definition qsgnode.h:37
@ DirtyMaterial
Definition qsgnode.h:75
void markDirty(DirtyState bits)
Notifies all connected renderers that the node has dirty bits.
Definition qsgnode.cpp:624
void setMatrix(const QMatrix4x4 &matrix)
Sets this transform node's matrix to matrix.
Definition qsgnode.cpp:1162
const QMatrix4x4 & matrix() const
Returns this transform node's matrix.
Definition qsgnode.h:247
const_iterator cend() const noexcept
Definition qset.h:142
bool contains(const T &value) const
Definition qset.h:71
const_iterator cbegin() const noexcept
Definition qset.h:138
\inmodule QtCore
Definition qsize.h:25
constexpr int height() const noexcept
Returns the height.
Definition qsize.h:133
constexpr int width() const noexcept
Returns the width.
Definition qsize.h:130
The QVector3D class represents a vector or vertex in 3D space.
Definition qvectornd.h:171
static QDoubleVector2D coordToMercator(const QGeoCoordinate &coord)
QSet< QString >::iterator it
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 * iter
static QVector3D toVector3D(const QDoubleVector3D &in)
static bool qgeotiledmapscene_isTileInViewport_rotationTilt(const QRectF &tileRect, const QMatrix4x4 &matrix)
static bool qgeotiledmapscene_isTileInViewport(const QRectF &tileRect, const QMatrix4x4 &matrix, const bool straight)
static bool qgeotiledmapscene_isTileInViewport_Straight(const QRectF &tileRect, const QMatrix4x4 &matrix)
static QVector3D toVector3D(const QDoubleVector3D &in)
#define qWarning
Definition qlogging.h:166
static QT_BEGIN_NAMESPACE const int tileSize
Definition qmemrotate.cpp:9
constexpr const T & qMin(const T &a, const T &b)
Definition qminmax.h:40
constexpr const T & qMax(const T &a, const T &b)
Definition qminmax.h:42
constexpr T qAbs(const T &t)
Definition qnumeric.h:328
GLboolean GLboolean GLboolean b
GLuint GLfloat GLfloat GLfloat GLfloat GLfloat z
GLint GLint GLint GLint GLint x
[0]
GLfloat GLfloat GLfloat w
[0]
GLuint GLfloat GLfloat GLfloat GLfloat y1
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLboolean r
[2]
GLuint GLuint end
GLuint const GLuint GLuint const GLuint * textures
GLuint GLfloat GLfloat GLfloat x1
GLfloat GLfloat f
GLenum GLuint texture
GLint y
GLfloat GLfloat GLfloat GLfloat h
GLdouble s
[6]
Definition qopenglext.h:235
GLfixed GLfixed GLfixed y2
GLuint GLenum matrix
GLfixed GLfixed x2
GLdouble GLdouble t
Definition qopenglext.h:243
GLuint in
static const QRectF boundingRect(const QPointF *points, int pointCount)
QScreen * screen
[1]
Definition main.cpp:29
double qreal
Definition qtypes.h:187
aWidget window() -> setWindowTitle("New Window Title")
[2]
QQuickView * view
[0]