QGIS API Documentation  3.2.0-Bonn (bc43194)
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 #include "qgschunkedentity_p.h"
31 #include "qgschunkqueuejob_p.h"
32 
33 #include <memory>
34 
35 namespace Qt3DRender
36 {
37  class QObjectPicker;
38 }
39 
40 class Qgs3DMapSettings;
41 class QgsTerrainTextureGenerator;
43 class QgsMapLayer;
45 class TerrainMapUpdateJobFactory;
46 
53 class QgsTerrainEntity : public QgsChunkedEntity
54 {
55  Q_OBJECT
56  public:
58  explicit QgsTerrainEntity( int maxLevel, const Qgs3DMapSettings &map, Qt3DCore::QNode *parent = nullptr );
59 
60  ~QgsTerrainEntity() override;
61 
63  const Qgs3DMapSettings &map3D() const { return mMap; }
65  QgsTerrainTextureGenerator *textureGenerator() { return mTextureGenerator; }
67  const QgsCoordinateTransform &terrainToMapTransform() const { return *mTerrainToMapTransform; }
68 
70  Qt3DRender::QObjectPicker *terrainPicker() const { return mTerrainPicker; }
71 
72  private slots:
73  void onShowBoundingBoxesChanged();
74  void invalidateMapImages();
75  void onLayersChanged();
76 
77  private:
78 
79  void connectToLayersRepaintRequest();
80 
81  const Qgs3DMapSettings &mMap;
83  Qt3DRender::QObjectPicker *mTerrainPicker = nullptr;
84  QgsTerrainTextureGenerator *mTextureGenerator = nullptr;
85  QgsCoordinateTransform *mTerrainToMapTransform = nullptr;
86 
87  std::unique_ptr<TerrainMapUpdateJobFactory> mUpdateJobFactory;
88 
90  QList<QgsMapLayer *> mLayers;
91 };
92 
93 
94 
96 class 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_P_H
Base class for all map layer types.
Definition: qgsmaplayer.h:61
3 Definition of the world
3 Base class for generators of terrain.
Class for doing transforms between two map coordinate systems.