QGIS API Documentation 3.38.0-Grenoble (exported)
Loading...
Searching...
No Matches
qgstiledscenelayerrenderer.h
Go to the documentation of this file.
1/***************************************************************************
2 qgstiledscenelayerrenderer.h
3 --------------------
4 begin : June 2023
5 copyright : (C) 2023 by Nyall Dawson
6 email : nyall dot dawson at gmail dot com
7 ***************************************************************************/
8
9/***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
17
18#ifndef QGSTILEDSCENELAYERRENDERER_H
19#define QGSTILEDSCENELAYERRENDERER_H
20
21#include "qgis_core.h"
22#include "qgsmaplayerrenderer.h"
25#include "qgstiledsceneindex.h"
26
27#include <memory>
28#include <QElapsedTimer>
29#include <QSet>
30#include <QImage>
31#include <QHash>
32
33#define SIP_NO_FILE
34
36class QgsFeedback;
40
41namespace tinygltf
42{
43 struct Image;
44 class Model;
45 class Node;
46 class TinyGLTF;
47 struct Primitive;
48}
49
61{
62 public:
63
67
68 bool render() override;
69 Qgis::MapLayerRendererFlags flags() const override;
70 bool forceRasterRender() const override;
71 QgsFeedback *feedback() const override { return mFeedback.get(); }
72
73 private:
74
75 QgsTiledSceneRequest createBaseRequest();
76
77 bool renderTiles( QgsTiledSceneRenderContext &context );
78
79 void renderTile( const QgsTiledSceneTile &tile, QgsTiledSceneRenderContext &context );
80
86 bool renderTileContent( const QgsTiledSceneTile &tile, QgsTiledSceneRenderContext &context );
87
88 void renderPrimitive( const tinygltf::Model &model,
89 const tinygltf::Primitive &primitive,
90 const QgsTiledSceneTile &tile,
91 const QgsVector3D &tileTranslationEcef,
92 const QMatrix4x4 *gltfLocalTransform,
93 const QString &contentUri,
95
96 void renderTrianglePrimitive( const tinygltf::Model &model,
97 const tinygltf::Primitive &primitive,
98 const QgsTiledSceneTile &tile,
99 const QgsVector3D &tileTranslationEcef,
100 const QMatrix4x4 *gltfLocalTransform,
101 const QString &contentUri,
103
104 void renderLinePrimitive( const tinygltf::Model &model,
105 const tinygltf::Primitive &primitive,
106 const QgsTiledSceneTile &tile,
107 const QgsVector3D &tileTranslationEcef,
108 const QMatrix4x4 *gltfLocalTransform,
109 const QString &contentUri,
111
112 QString mLayerName;
113
114 std::unique_ptr< QgsTiledSceneRenderer > mRenderer;
115 bool mRenderTileBorders = false;
116
117 QList< QgsMapClippingRegion > mClippingRegions;
118
120 QgsTiledSceneBoundingVolume mLayerBoundingVolume;
121 QgsTiledSceneIndex mIndex;
122
123 QgsCoordinateTransform mSceneToMapTransform;
124
125 enum class PrimitiveType
126 {
127 Line,
128 Triangle
129 };
130
131 struct PrimitiveData
132 {
133 PrimitiveType type;
134 QPolygonF coordinates;
135 float z;
136 QPair< int, int > textureId { -1, -1 };
137 float textureCoords[6];
138 };
139
140 QVector< PrimitiveData > mPrimitiveData;
141
142 int mCurrentModelId = 0;
143 QHash< QPair< int, int >, QImage > mTextures;
144
145 struct TileDetails
146 {
147 QPolygonF boundary;
148 bool hasContent = false;
149 QString id;
150 };
151 QVector< TileDetails > mTileDetails;
152
153 std::unique_ptr<QgsFeedback> mFeedback;
154 QSet< int > mWarnedPrimitiveTypes;
155
156 QElapsedTimer mElapsedTimer;
157
158 bool mEnableProfile = false;
159 quint64 mPreparationTime = 0;
160};
161
162#endif // QGSTILEDSCENELAYERRENDERER_H
QFlags< MapLayerRendererFlag > MapLayerRendererFlags
Flags which control how map layer renderers behave.
Definition qgis.h:2393
This class represents a coordinate reference system (CRS).
Class for doing transforms between two map coordinate systems.
Base class for feedback objects to be used for cancellation of something running in a worker thread.
Definition qgsfeedback.h:44
A map clipping region (in map coordinates and CRS).
Base class for utility classes that encapsulate information necessary for rendering of map layers.
virtual bool render()=0
Do the rendering (based on data stored in the class).
virtual bool forceRasterRender() const
Returns true if the renderer must be rendered to a raster paint device (e.g.
virtual Qgis::MapLayerRendererFlags flags() const
Returns flags which control how the map layer rendering behaves.
Contains information about the context of a rendering operation.
Represents a bounding volume for a tiled scene.
An index for tiled scene data providers.
Implementation of threaded 2D rendering for tiled scene layers.
QgsFeedback * feedback() const override
Access to feedback object of the layer renderer (may be nullptr)
Represents a map layer supporting display of tiled scene objects.
Encapsulates the render context for a 2D tiled scene rendering operation.
Abstract base class for 2d tiled scene renderers.
Tiled scene data request.
Represents an individual tile from a tiled scene data source.
Class for storage of 3D vectors similar to QVector3D, with the difference that it uses double precisi...
Definition qgsvector3d.h:31