QGIS API Documentation  3.16.0-Hannover (43b64b13f3)
qgsdemterraingenerator.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsdemterraingenerator.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 QGSDEMTERRAINGENERATOR_H
17 #define QGSDEMTERRAINGENERATOR_H
18 
19 #include "qgis_3d.h"
20 
21 #include "qgsterraingenerator.h"
22 
23 
24 #include <memory>
25 
26 class QgsRasterLayer;
27 class QgsDemHeightMapGenerator;
28 
29 #include "qgsmaplayerref.h"
30 
31 #define SIP_NO_FILE
32 
42 {
43  public:
46  ~QgsDemTerrainGenerator() override;
47 
49  void setLayer( QgsRasterLayer *layer );
51  QgsRasterLayer *layer() const;
52 
54  void setCrs( const QgsCoordinateReferenceSystem &crs, const QgsCoordinateTransformContext &context );
55 
57  void setResolution( int resolution ) { mResolution = resolution; updateGenerator(); }
59  int resolution() const { return mResolution; }
60 
62  void setSkirtHeight( float skirtHeight ) { mSkirtHeight = skirtHeight; }
64  float skirtHeight() const { return mSkirtHeight; }
65 
67  QgsDemHeightMapGenerator *heightMapGenerator() { return mHeightMapGenerator; }
68 
69  QgsTerrainGenerator *clone() const override SIP_FACTORY;
70  Type type() const override;
71  QgsRectangle extent() const override;
72  float heightAt( double x, double y, const Qgs3DMapSettings &map ) const override;
73  void writeXml( QDomElement &elem ) const override;
74  void readXml( const QDomElement &elem ) override;
75  void resolveReferences( const QgsProject &project ) override;
76 
77  QgsChunkLoader *createChunkLoader( QgsChunkNode *node ) const override SIP_FACTORY;
78 
79  private:
80  void updateGenerator();
81 
82  QgsDemHeightMapGenerator *mHeightMapGenerator = nullptr;
83 
85 
86  QgsCoordinateTransformContext mTransformContext;
87 
89  QgsMapLayerRef mLayer;
91  int mResolution = 16;
93  float mSkirtHeight = 10.f;
94 };
95 
96 
97 #endif // QGSDEMTERRAINGENERATOR_H
QgsCoordinateTransformContext
Contains information about the context in which a coordinate transform is executed.
Definition: qgscoordinatetransformcontext.h:58
QgsDemTerrainGenerator::setResolution
void setResolution(int resolution)
Sets resolution of the generator (how many elevation samples on one side of a terrain tile)
Definition: qgsdemterraingenerator.h:57
QgsDemTerrainGenerator::skirtHeight
float skirtHeight() const
Returns skirt height (in world units). Skirts at the edges of terrain tiles help hide cracks between ...
Definition: qgsdemterraingenerator.h:64
crs
const QgsCoordinateReferenceSystem & crs
Definition: qgswfsgetfeature.cpp:51
QgsRectangle
A rectangle specified with double values.
Definition: qgsrectangle.h:42
QgsProject
Encapsulates a QGIS project, including sets of map layers and their styles, layouts,...
Definition: qgsproject.h:95
SIP_FACTORY
#define SIP_FACTORY
Definition: qgis_sip.h:76
QgsDemTerrainGenerator::heightMapGenerator
QgsDemHeightMapGenerator * heightMapGenerator()
Returns height map generator object - takes care of extraction of elevations from the layer)
Definition: qgsdemterraingenerator.h:67
QgsTerrainGenerator
3 Base class for generators of terrain.
Definition: qgsterraingenerator.h:48
QgsTerrainGenerator::clone
virtual QgsTerrainGenerator * clone() const =0SIP_FACTORY
Makes a copy of the current instance.
qgsterraingenerator.h
Qgs3DMapSettings
3 Definition of the world
Definition: qgs3dmapsettings.h:54
QgsRasterLayer
Represents a raster layer.
Definition: qgsrasterlayer.h:71
QgsCoordinateReferenceSystem
This class represents a coordinate reference system (CRS).
Definition: qgscoordinatereferencesystem.h:206
QgsDemTerrainGenerator
3 Implementation of terrain generator that uses a raster layer with DEM to build terrain.
Definition: qgsdemterraingenerator.h:42
QgsDemTerrainGenerator::QgsDemTerrainGenerator
QgsDemTerrainGenerator()=default
Constructor for QgsDemTerrainGenerator.
qgsmaplayerref.h
QgsDemTerrainGenerator::setSkirtHeight
void setSkirtHeight(float skirtHeight)
Sets skirt height (in world units). Skirts at the edges of terrain tiles help hide cracks between adj...
Definition: qgsdemterraingenerator.h:62
_LayerRef< QgsMapLayer >
QgsDemTerrainGenerator::resolution
int resolution() const
Returns resolution of the generator (how many elevation samples on one side of a terrain tile)
Definition: qgsdemterraingenerator.h:59