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