QGIS API Documentation 3.41.0-Master (cea29feecf2)
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 "qgschunkedentity.h"
33#include "qgschunkqueuejob.h"
34
35#include <memory>
36
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 QVector<QgsRayCastingUtils::RayHit> rayIntersection( const QgsRayCastingUtils::Ray3D &ray, const QgsRayCastingUtils::RayCastContext &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 cancel() override;
101
102 private slots:
103 void onTileReady( int jobId, const QImage &image );
104
105 private:
106 QgsTerrainTextureGenerator *mTextureGenerator = nullptr;
107 int mJobId;
108};
109
111
112#endif // QGSTERRAINENTITY_H
Class for doing transforms between two map coordinate systems.
Base class for all map layer types.
Definition qgsmaplayer.h:76
Helper struct to store ray casting parameters.