QGIS API Documentation 3.38.0-Grenoble (exported)
Loading...
Searching...
No Matches
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
24class QgsAABB;
26class QgsRectangle;
27class QgsTerrainEntity;
28
29class QDomElement;
30class QDomDocument;
31class QgsProject;
32
33#define SIP_NO_FILE
34
35
48class _3D_EXPORT QgsTerrainGenerator : public QgsQuadtreeChunkLoaderFactory
49{
50 Q_OBJECT
51 public:
52
54 enum Type
55 {
59 Mesh
60 };
61
63 void setTerrain( QgsTerrainEntity *t ) { mTerrain = t; }
64
67
69 virtual Type type() const = 0;
70
72 virtual QgsRectangle extent() const { return mExtent; }
73
75 virtual void setExtent( const QgsRectangle &extent ) { Q_UNUSED( extent ) }
76
78 virtual QgsRectangle rootChunkExtent() const = 0;
79
81 virtual QgsAABB rootChunkBbox( const Qgs3DMapSettings &map ) const;
82
84 virtual float rootChunkError( const Qgs3DMapSettings &map ) const;
85
87 virtual void rootChunkHeightRange( float &hMin, float &hMax ) const;
88
90 virtual float heightAt( double x, double y, const Qgs3DMapSettings &map ) const;
91
93 virtual void writeXml( QDomElement &elem ) const = 0;
94
96 virtual void readXml( const QDomElement &elem ) = 0;
97
99 virtual void resolveReferences( const QgsProject &project ) { Q_UNUSED( project ) }
100
102 static QString typeToString( Type type );
103
105 const QgsTilingScheme &tilingScheme() const { return mTerrainTilingScheme; }
106
108 QgsCoordinateReferenceSystem crs() const { return mTerrainTilingScheme.crs(); }
109
111 bool isValid() const;
112
113 signals:
114
117
118 protected:
119
121 QgsTerrainEntity *mTerrain = nullptr;
123
124 bool mIsValid = true;
125
126};
127
128
129#endif // QGSTERRAINGENERATOR_H
This class represents a coordinate reference system (CRS).
Encapsulates a QGIS project, including sets of map layers and their styles, layouts,...
Definition qgsproject.h:107
A rectangle specified with double values.
virtual void writeXml(QDomElement &elem) const =0
Write terrain generator's configuration to XML.
Type
Enumeration of the available terrain generators.
@ Dem
Terrain is built from raster layer with digital elevation model.
@ Online
Terrain is built from downloaded tiles with digital elevation model.
@ Flat
The whole terrain is flat area.
QgsTilingScheme mTerrainTilingScheme
Tiling scheme of the terrain.
void terrainChanged()
Emitted when the terrain changed (for example, raster DEM or mesh have data changed)
virtual Type type() const =0
What texture generator implementation is this.
QgsCoordinateReferenceSystem crs() const
Returns CRS of the terrain.
virtual void setExtent(const QgsRectangle &extent)
sets the extent of the terrain in terrain's CRS
virtual QgsRectangle extent() const
extent of the terrain in terrain's CRS, might be non-square and smaller than rootChunkExtent()
virtual QgsRectangle rootChunkExtent() const =0
extent of the terrain's root chunk in terrain's CRS
virtual void readXml(const QDomElement &elem)=0
Read terrain generator's configuration from XML.
virtual void resolveReferences(const QgsProject &project)
After read of XML, resolve references to any layers that have been read as layer IDs.
const QgsTilingScheme & tilingScheme() const
Returns tiling scheme of the terrain.
void setTerrain(QgsTerrainEntity *t)
Sets terrain entity for the generator (does not transfer ownership)
virtual QgsTerrainGenerator * clone() const =0SIP_FACTORY
Makes a copy of the current instance.
#define SIP_FACTORY
Definition qgis_sip.h:76