QGIS API Documentation  3.2.0-Bonn (bc43194)
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 
42 class _3D_EXPORT QgsTerrainGenerator : public QgsChunkLoaderFactory
43 {
44  public:
45 
47  enum Type
48  {
49  Flat,
50  Dem,
52  };
53 
55  void setTerrain( QgsTerrainEntity *t ) { mTerrain = t; }
56 
58  virtual QgsTerrainGenerator *clone() const = 0 SIP_FACTORY;
59 
61  virtual Type type() const = 0;
62 
64  virtual QgsRectangle extent() const = 0;
65 
67  virtual QgsAABB rootChunkBbox( const Qgs3DMapSettings &map ) const;
68 
70  virtual float rootChunkError( const Qgs3DMapSettings &map ) const;
71 
73  virtual void rootChunkHeightRange( float &hMin, float &hMax ) const;
74 
76  virtual float heightAt( double x, double y, const Qgs3DMapSettings &map ) const;
77 
79  virtual void writeXml( QDomElement &elem ) const = 0;
80 
82  virtual void readXml( const QDomElement &elem ) = 0;
83 
85  virtual void resolveReferences( const QgsProject &project ) { Q_UNUSED( project ); }
86 
88  static QString typeToString( Type type );
89 
91  const QgsTilingScheme &tilingScheme() const { return mTerrainTilingScheme; }
92 
94  QgsCoordinateReferenceSystem crs() const { return mTerrainTilingScheme.crs(); }
95 
96  protected:
98  QgsTerrainEntity *mTerrain = nullptr;
99 };
100 
101 
102 #endif // QGSTERRAINGENERATOR_H
virtual void resolveReferences(const QgsProject &project)
After read of XML, resolve references to any layers that have been read as layer IDs.
3 Axis-aligned bounding box - in world coords.
Definition: qgsaabb.h:30
A rectangle specified with double values.
Definition: qgsrectangle.h:40
QgsCoordinateReferenceSystem crs() const
Returns CRS of the terrain.
3 Definition of the world
Terrain is built from raster layer with digital elevation model.
Reads and writes project states.
Definition: qgsproject.h:85
const QgsTilingScheme & tilingScheme() const
Returns tiling scheme of the terrain.
#define SIP_FACTORY
Definition: qgis_sip.h:69
Type
Enumeration of the available terrain generators.
QgsTilingScheme mTerrainTilingScheme
Tiling scheme of the terrain.
3 Base class for generators of terrain.
This class represents a coordinate reference system (CRS).
Terrain is built from downloaded tiles in quantized mesh format.
void setTerrain(QgsTerrainEntity *t)
Sets terrain entity for the generator (does not transfer ownership)
3 The class encapsulates tiling scheme (just like with WMTS / TMS / XYZ layers).
The whole terrain is flat area.