QGIS API Documentation 3.27.0-Master (a46f227e17)
quantizedmeshgeometry.h
Go to the documentation of this file.
1/***************************************************************************
2 quantizedmeshgeometry.h
3 ---------------------
4 begin : July 2017
5 copyright : (C) 2017 by Martin Dobias
6 email : wonder dot sk at gmail dot com
7 ***************************************************************************
8 * *
9 * This program is free software; you can redistribute it and/or modify *
10 * it under the terms of the GNU General Public License as published by *
11 * the Free Software Foundation; either version 2 of the License, or *
12 * (at your option) any later version. *
13 * *
14 ***************************************************************************/
15#ifndef QUANTIZEDMESHGEOMETRY_H
16#define QUANTIZEDMESHGEOMETRY_H
17
18#include <QtGui/QTransform>
19
20#include <Qt3DRender/QGeometry>
21#include <Qt3DRender/QBuffer>
22#include <Qt3DRender/QAttribute>
23
24
25
27{
28 // The center of the tile in Earth-centered Fixed coordinates.
29 double CenterX;
30 double CenterY;
31 double CenterZ;
32
33 // The minimum and maximum heights in the area covered by this tile.
34 // The minimum may be lower and the maximum may be higher than
35 // the height of any vertex in this tile in the case that the min/max vertex
36 // was removed during mesh simplification, but these are the appropriate
37 // values to use for analysis or visualization.
40
41 // The tile’s bounding sphere. The X,Y,Z coordinates are again expressed
42 // in Earth-centered Fixed coordinates, and the radius is in meters.
47
48 // The horizon occlusion point, expressed in the ellipsoid-scaled Earth-centered Fixed frame.
49 // If this point is below the horizon, the entire tile is below the horizon.
50 // See http://cesiumjs.org/2013/04/25/Horizon-culling/ for more information.
54};
55
56#include "qgsrectangle.h"
57
59{
60 QgsRectangle extent; // extent in WGS coordinates
62 QVector<qint16> uvh; // each coordinate 0-32767. u=lon, v=lat (within tile). not interleaved: first u, then v, then h
63 QVector<quint16> indices; // indices of triangles (length = 3*triangle count)
64};
65
67class QgsMapToPixel;
68
69class Map3D;
70
76class QuantizedMeshGeometry : public Qt3DRender::QGeometry
77{
78 public:
80 QuantizedMeshGeometry( QuantizedMeshTile *t, const Map3D &map, const QgsMapToPixel &mapToPixel, const QgsCoordinateTransform &terrainToMap, QNode *parent = nullptr );
81
83 static QuantizedMeshTile *readTile( int tx, int ty, int tz, const QgsRectangle &extent );
85 static void downloadTileIfMissing( int tx, int ty, int tz );
86
87 private:
88 Qt3DRender::QBuffer *mVertexBuffer = nullptr;
89 Qt3DRender::QBuffer *mIndexBuffer = nullptr;
90 Qt3DRender::QAttribute *mPositionAttribute = nullptr;
91 Qt3DRender::QAttribute *mTexCoordAttribute = nullptr;
92 Qt3DRender::QAttribute *mIndexAttribute = nullptr;
93};
94
95#endif // QUANTIZEDMESHGEOMETRY_H
Class for doing transforms between two map coordinate systems.
Perform transforms between map coordinates and device coordinates.
Definition: qgsmaptopixel.h:39
A rectangle specified with double values.
Definition: qgsrectangle.h:42
static void downloadTileIfMissing(int tx, int ty, int tz)
Downloads a tile to to a file in the local disk cache.
QuantizedMeshGeometry(QuantizedMeshTile *t, const Map3D &map, const QgsMapToPixel &mapToPixel, const QgsCoordinateTransform &terrainToMap, QNode *parent=nullptr)
Constructs geometry based on the loaded tile data.
static QuantizedMeshTile * readTile(int tx, int ty, int tz, const QgsRectangle &extent)
Reads a tile from a file in the local disk cache.
QVector< quint16 > indices
QuantizedMeshHeader header
QVector< qint16 > uvh