QGIS API Documentation 3.41.0-Master (cea29feecf2)
Loading...
Searching...
No Matches
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
23class QgsRasterLayer;
24class QgsDemHeightMapGenerator;
25
26#include "qgsmaplayerref.h"
27
28#define SIP_NO_FILE
29
38{
39 Q_OBJECT
40
41 public:
45 static QgsTerrainGenerator *create() SIP_FACTORY;
46
48 ~QgsDemTerrainGenerator() override;
49
51 void setLayer( QgsRasterLayer *layer );
53 QgsRasterLayer *layer() const;
54
55 void setCrs( const QgsCoordinateReferenceSystem &crs, const QgsCoordinateTransformContext &context ) override;
56 QgsCoordinateReferenceSystem crs() const override { return mCrs; }
57
59 void setResolution( int resolution )
60 {
61 mResolution = resolution;
62 updateGenerator();
63 }
65 int resolution() const { return mResolution; }
66
68 void setSkirtHeight( float skirtHeight ) { mSkirtHeight = skirtHeight; }
70 float skirtHeight() const { return mSkirtHeight; }
71
73 QgsDemHeightMapGenerator *heightMapGenerator() { return mHeightMapGenerator; }
74
75 QgsTerrainGenerator *clone() const override SIP_FACTORY;
76 Type type() const override;
77 QgsRectangle rootChunkExtent() const override;
78 void setExtent( const QgsRectangle &extent ) override;
79 float heightAt( double x, double y, const Qgs3DRenderContext &context ) const override;
80
81 QgsChunkLoader *createChunkLoader( QgsChunkNode *node ) const override SIP_FACTORY;
82
83 private:
84 void updateGenerator();
85
86 QgsDemHeightMapGenerator *mHeightMapGenerator = nullptr;
87
89
90 QgsCoordinateTransformContext mTransformContext;
91
93 QPointer<QgsRasterLayer> mLayer;
95 int mResolution = 16;
97 float mSkirtHeight = 10.f;
98};
99
100
101#endif // QGSDEMTERRAINGENERATOR_H
This class represents a coordinate reference system (CRS).
Contains information about the context in which a coordinate transform is executed.
int resolution() const
Returns resolution of the generator (how many elevation samples on one side of a terrain tile)
QgsCoordinateReferenceSystem crs() const override
Returns CRS of the terrain.
QgsDemHeightMapGenerator * heightMapGenerator()
Returns height map generator object - takes care of extraction of elevations from the layer)
void setSkirtHeight(float skirtHeight)
Sets skirt height (in world units). Skirts at the edges of terrain tiles help hide cracks between adj...
void setResolution(int resolution)
Sets resolution of the generator (how many elevation samples on one side of a terrain tile)
QgsDemTerrainGenerator()=default
float skirtHeight() const
Returns skirt height (in world units). Skirts at the edges of terrain tiles help hide cracks between ...
Represents a raster layer.
A rectangle specified with double values.
virtual QgsTerrainGenerator * clone() const =0SIP_FACTORY
Makes a copy of the current instance.
virtual void setCrs(const QgsCoordinateReferenceSystem &crs, const QgsCoordinateTransformContext &context)
Sets the CRS associated with the terrain.
#define SIP_FACTORY
Definition qgis_sip.h:76
const QgsCoordinateReferenceSystem & crs