QGIS API Documentation 4.1.0-Master (9af12b5a203)
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"
36#include "qobjectuniqueptr.h"
37
38#define SIP_NO_FILE
39
40namespace Qt3DCore
41{
42 class QTransform;
43}
44
46class QgsTerrainTextureGenerator;
48class QgsMapLayer;
50class TerrainMapUpdateJobFactory;
51class QgsLayerStyleWatcher;
52
58class QgsTerrainEntity : public QgsChunkedEntity
59{
60 Q_OBJECT
61 public:
63 explicit QgsTerrainEntity( Qgs3DMapSettings *map, Qt3DCore::QNode *parent = nullptr );
64
65 ~QgsTerrainEntity() override;
66
68 QgsTerrainTextureGenerator *textureGenerator() { return mTextureGenerator; }
69
71 Qt3DCore::QTransform *transform() const { return mTerrainTransform; }
73 float terrainElevationOffset() const;
74
75 QList<QgsRayCastHit> rayIntersection( const QgsRay3D &ray, const QgsRayCastContext &context ) const override;
76
77 private slots:
78 void onShowBoundingBoxesChanged();
79 void invalidateMapImages();
80 void onTerrainElevationOffsetChanged();
81
82 private:
83 QgsTerrainTextureGenerator *mTextureGenerator = nullptr;
84 Qt3DCore::QTransform *mTerrainTransform = nullptr;
85
86 std::unique_ptr<TerrainMapUpdateJobFactory> mUpdateJobFactory;
87 QObjectUniquePtr<QgsLayerStyleWatcher> mLayerWatcher;
88};
89
90
92class TerrainMapUpdateJob : public QgsChunkQueueJob
93{
94 Q_OBJECT
95 public:
96 TerrainMapUpdateJob( QgsTerrainTextureGenerator *textureGenerator, QgsChunkNode *mNode );
97
98 void start() override;
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 = -1;
108};
109
111
112#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.