QGIS API Documentation 4.1.0-Master (64dc32379c2)
Loading...
Searching...
No Matches
qgsglobechunkedentity.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsglobechunkedentity.h
3 --------------------------------------
4 Date : March 2025
5 Copyright : (C) 2025 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
16#ifndef QGSGLOBECHUNKEDENTITY_H
17#define QGSGLOBECHUNKEDENTITY_H
18
19#include "qgis_3d.h"
20
21#define SIP_NO_FILE
22
24
25//
26// W A R N I N G
27// -------------
28//
29// This file is not part of the QGIS API. It exists purely as an
30// implementation detail. This header file may change from version to
31// version without notice, or even be removed.
32//
33
34
35#include "qgschunkedentity.h"
36
37#include "qgschunkloader.h"
39#include "qgsdistancearea.h"
40#include "qgs3drendercontext.h"
41
42#include <QImage>
43
44class QgsMapLayer;
45class QgsGlobeMapUpdateJobFactory;
46class QgsTerrainTextureGenerator;
47
48class QgsGlobeChunkLoader : public QgsChunkLoader
49{
50 Q_OBJECT
51 public:
52 QgsGlobeChunkLoader( QgsChunkNode *node, const Qgs3DRenderContext &context, QgsTerrainTextureGenerator *textureGenerator, const QgsCoordinateTransform &globeCrsToLatLon );
53 void start() override;
54
55 Qt3DCore::QEntity *createEntity( Qt3DCore::QEntity *parent ) override;
56
57 private:
58 Qgs3DRenderContext mRenderContext;
59 QgsTerrainTextureGenerator *mTextureGenerator;
60 QgsCoordinateTransform mGlobeCrsToLatLon;
61 int mJobId = -1;
62 QImage mTexture;
63};
64
65
67class QgsGlobeMapUpdateJob : public QgsChunkQueueJob
68{
69 Q_OBJECT
70 public:
71 QgsGlobeMapUpdateJob( QgsTerrainTextureGenerator *textureGenerator, QgsChunkNode *node );
72 void start() override;
73
74 void cancel() override;
75
76 private:
77 QgsTerrainTextureGenerator *mTextureGenerator = nullptr;
78 int mJobId = -1;
79};
80
81class QgsGlobeChunkLoaderFactory : public QgsChunkLoaderFactory
82{
83 Q_OBJECT
84 public:
85 QgsGlobeChunkLoaderFactory( Qgs3DMapSettings *mapSettings );
86
87 ~QgsGlobeChunkLoaderFactory() override;
88
89 QgsChunkLoader *createChunkLoader( QgsChunkNode *node ) const override;
90
91 QgsChunkNode *createRootNode() const override;
92
93 QVector<QgsChunkNode *> createChildren( QgsChunkNode *node ) const override;
94
95 private:
96 Qgs3DMapSettings *mMapSettings = nullptr;
97 QgsTerrainTextureGenerator *mTextureGenerator = nullptr; // owned by the factory
98 QgsDistanceArea mDistanceArea;
99 QgsCoordinateTransform mGlobeCrsToLatLon;
100 double mRadiusX, mRadiusY, mRadiusZ;
101};
102
108class _3D_EXPORT QgsGlobeEntity : public QgsChunkedEntity
109{
110 Q_OBJECT
111
112 public:
113 QgsGlobeEntity( Qgs3DMapSettings *mapSettings );
114 ~QgsGlobeEntity() override;
115
116 QList<QgsRayCastHit> rayIntersection( const QgsRay3D &ray, const QgsRayCastContext &context ) const override;
117
118 private slots:
119 void invalidateMapImages();
120 void onLayersChanged();
121
122 private:
123 void connectToLayersRepaintRequest();
124
125 private:
126 std::unique_ptr<QgsGlobeMapUpdateJobFactory> mUpdateJobFactory;
127
129 QList<QgsMapLayer *> mLayers;
130};
131
132
134
135#endif // QGSGLOBECHUNKEDENTITY_H
Rendering context for preparation of 3D entities.
Handles coordinate transforms between two coordinate systems.
Base class for all map layer types.
Definition qgsmaplayer.h:83