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