QGIS API Documentation 3.99.0-Master (2fe06baccd8)
Loading...
Searching...
No Matches
qgsterrainentity.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsterrainentity.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_H
17#define QGSTERRAINENTITY_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 <memory>
33
34#include "qgschunkedentity.h"
35#include "qgschunkqueuejob.h"
36
37namespace Qt3DCore
38{
39 class QTransform;
40}
41
43class QgsTerrainTextureGenerator;
45class QgsMapLayer;
47class TerrainMapUpdateJobFactory;
48
54class QgsTerrainEntity : public QgsChunkedEntity
55{
56 Q_OBJECT
57 public:
59 explicit QgsTerrainEntity( Qgs3DMapSettings *map, Qt3DCore::QNode *parent = nullptr );
60
61 ~QgsTerrainEntity() override;
62
64 QgsTerrainTextureGenerator *textureGenerator() { return mTextureGenerator; }
65
67 Qt3DCore::QTransform *transform() const { return mTerrainTransform; }
69 float terrainElevationOffset() const;
70
71 QList<QgsRayCastHit> rayIntersection( const QgsRay3D &ray, const QgsRayCastContext &context ) const override;
72
73 private slots:
74 void onShowBoundingBoxesChanged();
75 void invalidateMapImages();
76 void onLayersChanged();
77 void onTerrainElevationOffsetChanged();
78
79 private:
80 void connectToLayersRepaintRequest();
81
82 QgsTerrainTextureGenerator *mTextureGenerator = nullptr;
83 Qt3DCore::QTransform *mTerrainTransform = nullptr;
84
85 std::unique_ptr<TerrainMapUpdateJobFactory> mUpdateJobFactory;
86
88 QList<QgsMapLayer *> mLayers;
89};
90
91
93class TerrainMapUpdateJob : public QgsChunkQueueJob
94{
95 Q_OBJECT
96 public:
97 TerrainMapUpdateJob( QgsTerrainTextureGenerator *textureGenerator, QgsChunkNode *mNode );
98
99 void start() override;
100
101 void cancel() override;
102
103 private slots:
104 void onTileReady( int jobId, const QImage &image );
105
106 private:
107 QgsTerrainTextureGenerator *mTextureGenerator = nullptr;
108 int mJobId = -1;
109};
110
112
113#endif // QGSTERRAINENTITY_H
Definition of the world.
Handles coordinate transforms between two coordinate systems.
Base class for all map layer types.
Definition qgsmaplayer.h:80
Base class for generators of terrain.