QGIS API Documentation 3.37.0-Master (df6056bf1be)
Loading...
Searching...
No Matches
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
55class QgsTerrainEntity : public QgsChunkedEntity
56{
57 Q_OBJECT
58 public:
60 explicit QgsTerrainEntity( const Qgs3DMapSettings &map, Qt3DCore::QNode *parent = nullptr );
61
62 ~QgsTerrainEntity() override;
63
65 const Qgs3DMapSettings &map3D() const { return mMap; }
67 QgsTerrainTextureGenerator *textureGenerator() { return mTextureGenerator; }
68
70 Qt3DCore::QTransform *transform() const { return mTerrainTransform; }
72 float terrainElevationOffset() const;
73
74 QVector<QgsRayCastingUtils::RayHit> rayIntersection( const QgsRayCastingUtils::Ray3D &ray, const QgsRayCastingUtils::RayCastContext &context ) const override;
75
76 private slots:
77 void onShowBoundingBoxesChanged();
78 void invalidateMapImages();
79 void onLayersChanged();
80 void onTerrainElevationOffsetChanged( float newOffset );
81
82 private:
83
84 void connectToLayersRepaintRequest();
85
86 const Qgs3DMapSettings &mMap;
87 QgsTerrainTextureGenerator *mTextureGenerator = nullptr;
88 Qt3DCore::QTransform *mTerrainTransform = nullptr;
89
90 std::unique_ptr<TerrainMapUpdateJobFactory> mUpdateJobFactory;
91
93 QList<QgsMapLayer *> mLayers;
94};
95
96
97
99class TerrainMapUpdateJob : public QgsChunkQueueJob
100{
101 Q_OBJECT
102 public:
103 TerrainMapUpdateJob( QgsTerrainTextureGenerator *textureGenerator, QgsChunkNode *mNode );
104
105 void cancel() override;
106
107 private slots:
108 void onTileReady( int jobId, const QImage &image );
109
110 private:
111 QgsTerrainTextureGenerator *mTextureGenerator = nullptr;
112 int mJobId;
113};
114
116
117#endif // QGSTERRAINENTITY_P_H
Class for doing transforms between two map coordinate systems.
Base class for all map layer types.
Definition qgsmaplayer.h:75
Helper struct to store ray casting parameters.