QGIS API Documentation 3.99.0-Master (a8f284845db)
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
31#include <memory>
32
33#include "qgschunkedentity.h"
34#include "qgschunkqueuejob.h"
35
36#define SIP_NO_FILE
37
38namespace Qt3DCore
39{
40 class QTransform;
41}
42
44class QgsTerrainTextureGenerator;
46class QgsMapLayer;
48class TerrainMapUpdateJobFactory;
49
55class QgsTerrainEntity : public QgsChunkedEntity
56{
57 Q_OBJECT
58 public:
60 explicit QgsTerrainEntity( Qgs3DMapSettings *map, Qt3DCore::QNode *parent = nullptr );
61
62 ~QgsTerrainEntity() override;
63
65 QgsTerrainTextureGenerator *textureGenerator() { return mTextureGenerator; }
66
68 Qt3DCore::QTransform *transform() const { return mTerrainTransform; }
70 float terrainElevationOffset() const;
71
72 QList<QgsRayCastHit> rayIntersection( const QgsRay3D &ray, const QgsRayCastContext &context ) const override;
73
74 private slots:
75 void onShowBoundingBoxesChanged();
76 void invalidateMapImages();
77 void onLayersChanged();
78 void onTerrainElevationOffsetChanged();
79
80 private:
81 void connectToLayersRepaintRequest();
82
83 QgsTerrainTextureGenerator *mTextureGenerator = nullptr;
84 Qt3DCore::QTransform *mTerrainTransform = nullptr;
85
86 std::unique_ptr<TerrainMapUpdateJobFactory> mUpdateJobFactory;
87
89 QList<QgsMapLayer *> mLayers;
90};
91
92
94class TerrainMapUpdateJob : public QgsChunkQueueJob
95{
96 Q_OBJECT
97 public:
98 TerrainMapUpdateJob( QgsTerrainTextureGenerator *textureGenerator, QgsChunkNode *mNode );
99
100 void start() override;
101
102 void cancel() override;
103
104 private slots:
105 void onTileReady( int jobId, const QImage &image );
106
107 private:
108 QgsTerrainTextureGenerator *mTextureGenerator = nullptr;
109 int mJobId = -1;
110};
111
113
114#endif // QGSTERRAINENTITY_H
Definition of the world.
Handles coordinate transforms between two coordinate systems.
Base class for all map layer types.
Definition qgsmaplayer.h:83
Base class for generators of terrain.