QGIS API Documentation 4.3.0-Master (16eddb2670e)
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"
21#include "qgsrasterlayer.h"
22#include "qgsterraingenerator.h"
23
24#define SIP_NO_FILE
25
26class QgsDemHeightMapGenerator;
27
28
37{
38 Q_OBJECT
39
40 public:
45
47 ~QgsDemTerrainGenerator() override;
48
52 QgsRasterLayer *layer() const;
53
54 void setCrs( const QgsCoordinateReferenceSystem &crs, const QgsCoordinateTransformContext &context ) override;
55 QgsCoordinateReferenceSystem crs() const override { return mCrs; }
56
63
64 int resolution() const { return mResolution; }
65
69 float skirtHeight() const { return mSkirtHeight; }
70
72 QgsDemHeightMapGenerator *heightMapGenerator() { return mHeightMapGenerator.get(); }
73
74 QgsTerrainGenerator *clone() const override SIP_FACTORY;
75 Type type() const override;
76 QgsRectangle rootChunkExtent() const override;
77 void setExtent( const QgsRectangle &extent ) override;
78 float heightAt( double x, double y, const Qgs3DRenderContext &context ) const override;
79
80 QFuture<QgsChunkLoaderResult> loadChunk( QgsChunkNode *node ) override;
81
82 QgsTerrainGenerator::Capabilities capabilities() const override;
83
84 protected:
86 virtual void updateGenerator();
87
88 std::unique_ptr<QgsDemHeightMapGenerator> mHeightMapGenerator;
89
91
93
97 int mResolution = 16;
99 float mSkirtHeight = 10.f;
100
101 private:
102 Qt3DCore::QEntity *createEntity( QByteArray heightMap, TerrainTextureResources textureResources, QgsChunkNode *node, Qt3DCore::QEntity *parent );
103};
104
105
106#endif // QGSDEMTERRAINGENERATOR_H
Rendering context for preparation of 3D entities.
Represents a coordinate reference system (CRS).
Contains information about the context in which a coordinate transform is executed.
std::unique_ptr< QgsDemHeightMapGenerator > mHeightMapGenerator
static QgsTerrainGenerator * create()
Creates a new instance of a QgsDemTerrainGenerator object.
int resolution() const
Returns resolution of the generator (how many elevation samples on one side of a terrain tile).
float mSkirtHeight
height of the "skirts" at the edges of tiles to hide cracks between adjacent cracks
QgsCoordinateTransformContext mTransformContext
QgsRasterLayer * layer() const
Returns raster layer with elevation model to be used for terrain generation.
QPointer< QgsRasterLayer > mLayer
source layer for heights
virtual void updateGenerator()
(Re-)creates mHeightMapGenerator based on current params
QgsCoordinateReferenceSystem crs() const override
Returns CRS of the terrain.
QgsCoordinateReferenceSystem mCrs
QgsDemHeightMapGenerator * heightMapGenerator()
Returns height map generator object - takes care of extraction of elevations from the layer).
int mResolution
how many vertices to place on one side of the tile
void setLayer(QgsRasterLayer *layer)
Sets raster layer with elevation model to be used for terrain generation.
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).
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.
Base class for generators of terrain.
QgsTerrainGenerator()
Create new terrain generator.
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:83