QGIS API Documentation  3.10.0-A Coruña (6c816b4204)
qgsonlineterraingenerator.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsonlineterraingenerator.h
3  --------------------------------------
4  Date : March 2019
5  Copyright : (C) 2019 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 QGSONLINETERRAINGENERATOR_H
17 #define QGSONLINETERRAINGENERATOR_H
18 
19 #include "qgis_3d.h"
20 
21 #include "qgsterraingenerator.h"
22 
24 
25 class QgsDemHeightMapGenerator;
26 
33 {
34  public:
37  ~QgsOnlineTerrainGenerator() override;
38 
40  void setExtent( const QgsRectangle &extent );
41 
43  void setCrs( const QgsCoordinateReferenceSystem &crs, const QgsCoordinateTransformContext &context );
45  QgsCoordinateReferenceSystem crs() const { return mCrs; }
46 
48  void setResolution( int resolution ) { mResolution = resolution; updateGenerator(); }
50  int resolution() const { return mResolution; }
51 
53  void setSkirtHeight( float skirtHeight ) { mSkirtHeight = skirtHeight; }
55  float skirtHeight() const { return mSkirtHeight; }
56 
58  QgsDemHeightMapGenerator *heightMapGenerator() { return mHeightMapGenerator.get(); }
59 
60  QgsTerrainGenerator *clone() const override SIP_FACTORY;
61  Type type() const override;
62  QgsRectangle extent() const override;
63  float heightAt( double x, double y, const Qgs3DMapSettings &map ) const override;
64  void writeXml( QDomElement &elem ) const override;
65  void readXml( const QDomElement &elem ) override;
66  //void resolveReferences( const QgsProject &project ) override;
67 
68  QgsChunkLoader *createChunkLoader( QgsChunkNode *node ) const override SIP_FACTORY;
69 
70  private:
71 
72  void updateGenerator();
73 
74  QgsRectangle mExtent;
76  QgsCoordinateTransformContext mTransformContext;
77 
79  int mResolution = 16;
81  float mSkirtHeight = 10.f;
82 
83  std::unique_ptr<QgsDemHeightMapGenerator> mHeightMapGenerator;
84 };
85 
86 #endif // QGSONLINETERRAINGENERATOR_H
A rectangle specified with double values.
Definition: qgsrectangle.h:41
virtual float heightAt(double x, double y, const Qgs3DMapSettings &map) const
Returns height at (x,y) in terrain&#39;s CRS.
QgsDemHeightMapGenerator * heightMapGenerator()
Returns height map generator object - takes care of extraction of elevations from the layer) ...
3 Implementation of terrain generator that uses online resources to download heightmaps.
virtual Type type() const =0
What texture generator implementation is this.
QgsCoordinateReferenceSystem crs() const
Returns CRS of the terrain.
const QgsCoordinateReferenceSystem & crs
float skirtHeight() const
Returns skirt height (in world units). Skirts at the edges of terrain tiles help hide cracks between ...
3 Definition of the world
virtual void readXml(const QDomElement &elem)=0
Read terrain generator&#39;s configuration from XML.
virtual QgsTerrainGenerator * clone() const =0SIP_FACTORY
Makes a copy of the current instance.
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) ...
#define SIP_FACTORY
Definition: qgis_sip.h:76
Contains information about the context in which a coordinate transform is executed.
Type
Enumeration of the available terrain generators.
int resolution() const
Returns resolution of the generator (how many elevation samples on one side of a terrain tile) ...
3 Base class for generators of terrain.
virtual void writeXml(QDomElement &elem) const =0
Write terrain generator&#39;s configuration to XML.
This class represents a coordinate reference system (CRS).
virtual QgsRectangle extent() const =0
extent of the terrain in terrain&#39;s CRS