QGIS API Documentation 4.3.0-Master (3b7b3208a79)
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#include "qgschunkloader.h"
38#include "qgsdistancearea.h"
39#include "qgs3drendercontext.h"
41#include "qgsvector3d.h"
42#include "qobjectuniqueptr.h"
43
44#include <QImage>
45
46class QgsMapLayer;
47class QgsGlobeMapUpdateJobFactory;
48class QgsTerrainTextureGenerator;
49class QgsLayerStyleWatcher;
50
51class QgsGlobeChunkLoader : public QgsChunkLoader
52{
53 Q_OBJECT
54 public:
55 QgsGlobeChunkLoader( QgsChunkNode *node, const Qgs3DRenderContext &context, QgsTerrainTextureGenerator *textureGenerator, const QgsCoordinateTransform &globeCrsToLatLon );
56 void start() override;
57
58 Qt3DCore::QEntity *createEntity( Qt3DCore::QEntity *parent ) override;
59
60 private:
61 Qgs3DRenderContext mRenderContext;
62 QgsTerrainTextureGenerator *mTextureGenerator;
63 QgsCoordinateTransform mGlobeCrsToLatLon;
64 int mJobId = -1;
65 QImage mTexture;
66};
67
68
70class QgsGlobeMapUpdateJob : public QgsChunkQueueJob
71{
72 Q_OBJECT
73 public:
74 QgsGlobeMapUpdateJob( QgsTerrainTextureGenerator *textureGenerator, QgsChunkNode *node );
75 void start() override;
76
77 void cancel() override;
78
79 private:
80 QgsTerrainTextureGenerator *mTextureGenerator = nullptr;
81 int mJobId = -1;
82};
83
84class QgsGlobeChunkLoaderFactory : public QgsChunkLoaderFactory
85{
86 Q_OBJECT
87 public:
88 QgsGlobeChunkLoaderFactory( Qgs3DMapSettings *mapSettings );
89
90 ~QgsGlobeChunkLoaderFactory() override;
91
92 QgsChunkLoader *createChunkLoader( QgsChunkNode *node ) const override;
93
94 QgsChunkNode *createRootNode() const override;
95
96 QVector<QgsChunkNode *> createChildren( QgsChunkNode *node ) const override;
97
98 private:
99 Qgs3DMapSettings *mMapSettings = nullptr;
100 std::unique_ptr<QgsTerrainTextureGenerator> mTextureGenerator;
101 QgsDistanceArea mDistanceArea;
102 QgsCoordinateTransform mGlobeCrsToLatLon;
103 QgsVector3D mRadius;
104};
105
111class _3D_EXPORT QgsGlobeEntity : public QgsChunkedEntity
112{
113 Q_OBJECT
114
115 public:
116 QgsGlobeEntity( Qgs3DMapSettings *mapSettings );
117 ~QgsGlobeEntity() override;
118
119 QList<QgsRayCastHit> rayIntersection( const QgsRay3D &ray, const QgsRayCastContext &context ) const override;
120
121 private slots:
122 void invalidateMapImages();
123
124 private:
125 std::unique_ptr<QgsGlobeMapUpdateJobFactory> mUpdateJobFactory;
126 QObjectUniquePtr<QgsLayerStyleWatcher> mLayerWatcher = nullptr;
127};
128
129
131
132#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