QGIS API Documentation 3.32.0-Lima (311a8cb8a6)
qgsterrainentity_p.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsterrainentity_p.h
3 --------------------------------------
4 Date : July 2017
5 Copyright : (C) 2017 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 QGSTERRAINENTITY_P_H
17#define QGSTERRAINENTITY_P_H
18
20
21//
22// W A R N I N G
23// -------------
24//
25// This file is not part of the QGIS API. It exists purely as an
26// implementation detail. This header file may change from version to
27// version without notice, or even be removed.
28//
29
30#define SIP_NO_FILE
31
32#include "qgschunkedentity_p.h"
33#include "qgschunkqueuejob_p.h"
34
35#include <memory>
36
37
38namespace Qt3DCore
39{
40 class QTransform;
41}
42
44class QgsTerrainTextureGenerator;
46class QgsMapLayer;
48class TerrainMapUpdateJobFactory;
49
56class QgsTerrainEntity : public QgsChunkedEntity
57{
58 Q_OBJECT
59 public:
61 explicit QgsTerrainEntity( const Qgs3DMapSettings &map, Qt3DCore::QNode *parent = nullptr );
62
63 ~QgsTerrainEntity() override;
64
66 const Qgs3DMapSettings &map3D() const { return mMap; }
68 QgsTerrainTextureGenerator *textureGenerator() { return mTextureGenerator; }
69
71 Qt3DCore::QTransform *transform() const { return mTerrainTransform; }
73 float terrainElevationOffset() const;
74
75 QVector<QgsRayCastingUtils::RayHit> rayIntersection( const QgsRayCastingUtils::Ray3D &ray, const QgsRayCastingUtils::RayCastContext &context ) const override;
76
77 private slots:
78 void onShowBoundingBoxesChanged();
79 void invalidateMapImages();
80 void onLayersChanged();
81 void onTerrainElevationOffsetChanged( float newOffset );
82
83 private:
84
85 void connectToLayersRepaintRequest();
86
87 const Qgs3DMapSettings &mMap;
88 QgsTerrainTextureGenerator *mTextureGenerator = nullptr;
89 Qt3DCore::QTransform *mTerrainTransform = nullptr;
90
91 std::unique_ptr<TerrainMapUpdateJobFactory> mUpdateJobFactory;
92
94 QList<QgsMapLayer *> mLayers;
95};
96
97
98
100class TerrainMapUpdateJob : public QgsChunkQueueJob
101{
102 Q_OBJECT
103 public:
104 TerrainMapUpdateJob( QgsTerrainTextureGenerator *textureGenerator, QgsChunkNode *mNode );
105
106 void cancel() override;
107
108 private slots:
109 void onTileReady( int jobId, const QImage &image );
110
111 private:
112 QgsTerrainTextureGenerator *mTextureGenerator = nullptr;
113 int mJobId;
114};
115
117
118#endif // QGSTERRAINENTITY_P_H
Class for doing transforms between two map coordinate systems.
Base class for all map layer types.
Definition: qgsmaplayer.h:73