QGIS API Documentation  3.14.0-Pi (9f7028fd23)
qgsterraingenerator.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsterraingenerator.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 QGSTERRAINGENERATOR_H
17 #define QGSTERRAINGENERATOR_H
18 
19 #include "qgis_3d.h"
20 
21 #include "qgstilingscheme.h"
22 #include "qgschunkloader_p.h"
23 
24 class QgsAABB;
25 class Qgs3DMapSettings;
26 class QgsRectangle;
27 class QgsTerrainEntity;
28 
29 class QDomElement;
30 class QDomDocument;
31 class QgsProject;
32 
33 #define SIP_NO_FILE
34 
35 
47 class _3D_EXPORT QgsTerrainGenerator : public QgsChunkLoaderFactory
48 {
49  public:
50 
52  enum Type
53  {
54  Flat,
55  Dem,
57  Mesh
58  };
59 
61  void setTerrain( QgsTerrainEntity *t ) { mTerrain = t; }
62 
64  virtual QgsTerrainGenerator *clone() const = 0 SIP_FACTORY;
65 
67  virtual Type type() const = 0;
68 
70  virtual QgsRectangle extent() const = 0;
71 
73  virtual QgsAABB rootChunkBbox( const Qgs3DMapSettings &map ) const;
74 
76  virtual float rootChunkError( const Qgs3DMapSettings &map ) const;
77 
79  virtual void rootChunkHeightRange( float &hMin, float &hMax ) const;
80 
82  virtual float heightAt( double x, double y, const Qgs3DMapSettings &map ) const;
83 
85  virtual void writeXml( QDomElement &elem ) const = 0;
86 
88  virtual void readXml( const QDomElement &elem ) = 0;
89 
91  virtual void resolveReferences( const QgsProject &project ) { Q_UNUSED( project ) }
92 
94  static QString typeToString( Type type );
95 
97  const QgsTilingScheme &tilingScheme() const { return mTerrainTilingScheme; }
98 
100  QgsCoordinateReferenceSystem crs() const { return mTerrainTilingScheme.crs(); }
101 
103  bool isValid() const;
104 
105  protected:
107  QgsTerrainEntity *mTerrain = nullptr;
108 
109  bool mIsValid = true;
110 };
111 
112 
113 #endif // QGSTERRAINGENERATOR_H
QgsTerrainGenerator::Dem
@ Dem
Terrain is built from raster layer with digital elevation model.
Definition: qgsterraingenerator.h:55
QgsTerrainGenerator::resolveReferences
virtual void resolveReferences(const QgsProject &project)
After read of XML, resolve references to any layers that have been read as layer IDs.
Definition: qgsterraingenerator.h:91
QgsTerrainGenerator::crs
QgsCoordinateReferenceSystem crs() const
Returns CRS of the terrain.
Definition: qgsterraingenerator.h:100
QgsRectangle
Definition: qgsrectangle.h:41
QgsProject
Definition: qgsproject.h:92
SIP_FACTORY
#define SIP_FACTORY
Definition: qgis_sip.h:76
qgschunkloader_p.h
QgsTerrainGenerator::mTerrainTilingScheme
QgsTilingScheme mTerrainTilingScheme
Tiling scheme of the terrain.
Definition: qgsterraingenerator.h:106
QgsTerrainGenerator
Definition: qgsterraingenerator.h:47
QgsTerrainGenerator::Flat
@ Flat
The whole terrain is flat area.
Definition: qgsterraingenerator.h:54
QgsAABB
Definition: qgsaabb.h:33
QgsTerrainGenerator::Type
Type
Enumeration of the available terrain generators.
Definition: qgsterraingenerator.h:52
Qgs3DMapSettings
Definition: qgs3dmapsettings.h:51
QgsCoordinateReferenceSystem
Definition: qgscoordinatereferencesystem.h:206
QgsTerrainGenerator::Online
@ Online
Terrain is built from downloaded tiles with digital elevation model.
Definition: qgsterraingenerator.h:56
QgsTilingScheme
Definition: qgstilingscheme.h:35
qgstilingscheme.h
QgsTerrainGenerator::tilingScheme
const QgsTilingScheme & tilingScheme() const
Returns tiling scheme of the terrain.
Definition: qgsterraingenerator.h:97
QgsTerrainGenerator::setTerrain
void setTerrain(QgsTerrainEntity *t)
Sets terrain entity for the generator (does not transfer ownership)
Definition: qgsterraingenerator.h:61