QGIS API Documentation 3.41.0-Master (d5b93354e9c)
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( float newOffset );
79
80 private:
81
82 void connectToLayersRepaintRequest();
83
84 QgsTerrainTextureGenerator *mTextureGenerator = nullptr;
85 Qt3DCore::QTransform *mTerrainTransform = nullptr;
86
87 std::unique_ptr<TerrainMapUpdateJobFactory> mUpdateJobFactory;
88
90 QList<QgsMapLayer *> mLayers;
91};
92
93
94
96class TerrainMapUpdateJob : public QgsChunkQueueJob
97{
98 Q_OBJECT
99 public:
100 TerrainMapUpdateJob( QgsTerrainTextureGenerator *textureGenerator, QgsChunkNode *mNode );
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;
110};
111
113
114#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.