QGIS API Documentation  3.12.1-BucureČ™ti (121cc00ff0)
qgsmesh3dsymbol.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsmesh3dsymbol.h
3  -----------------
4  Date : January 2019
5  Copyright : (C) 2019 by Peter Petrik
6  Email : zilolv 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 QGSMESH3DSYMBOL_H
17 #define QGSMESH3DSYMBOL_H
18 
19 #include "qgis_3d.h"
20 
21 #include "qgsabstract3dsymbol.h"
23 #include "qgs3dtypes.h"
24 #include "qgscolorrampshader.h"
25 
26 #include <Qt3DRender/QCullFace>
27 
37 class _3D_EXPORT QgsMesh3DSymbol : public QgsAbstract3DSymbol
38 {
39  public:
40 
47  {
49  SingleColor = 0,
51  ColorRamp
52  };
53 
55  QgsMesh3DSymbol() = default;
56 
57  QString type() const override { return "mesh"; }
58  QgsAbstract3DSymbol *clone() const override SIP_FACTORY;
59 
60  void writeXml( QDomElement &elem, const QgsReadWriteContext &context ) const override;
61  void readXml( const QDomElement &elem, const QgsReadWriteContext &context ) override;
62 
64  Qgs3DTypes::AltitudeClamping altitudeClamping() const { return mAltClamping; }
66  void setAltitudeClamping( Qgs3DTypes::AltitudeClamping altClamping ) { mAltClamping = altClamping; }
67 
69  float height() const { return mHeight; }
71  void setHeight( float height ) { mHeight = height; }
72 
74  QgsPhongMaterialSettings material() const { return mMaterial; }
76  void setMaterial( const QgsPhongMaterialSettings &material ) { mMaterial = material; }
77 
81  bool addBackFaces() const { return mAddBackFaces; }
82 
86  void setAddBackFaces( bool add ) { mAddBackFaces = add; }
87 
93  bool smoothedTriangles() const;
94 
100  void setSmoothedTriangles( bool smoothTriangles );
101 
107  bool wireframeEnabled() const;
108 
114  void setWireframeEnabled( bool wireframeEnabled );
115 
121  double wireframeLineWidth() const;
122 
128  void setWireframeLineWidth( double wireframeLineWidth );
129 
135  QColor wireframeLineColor() const;
136 
142  void setWireframeLineColor( const QColor &wireframeLineColor );
143 
149  double verticaleScale() const;
150 
156  void setVerticaleScale( double verticaleScale );
157 
163  QgsColorRampShader colorRampShader() const;
164 
170  void setColorRampShader( const QgsColorRampShader &colorRampShader );
171 
177  QColor singleMeshColor() const;
178 
184  void setSingleMeshColor( const QColor &singleMeshColor );
185 
191  QgsMesh3DSymbol::RenderingStyle renderingStyle() const;
192 
198  void setRenderingStyle( const QgsMesh3DSymbol::RenderingStyle &textureType );
199 
200  private:
201 
204  float mHeight = 0.0f;
205  QgsPhongMaterialSettings mMaterial;
206  bool mAddBackFaces = false;
207 
208  bool mSmoothedTriangles = false;
209  bool mWireframeEnabled = false;
210  double mWireframeLineWidth = 1.0;
211  QColor mWireframeLineColor = Qt::darkGray;
212  double mVerticaleScale = 1.0;
213 
215  QgsColorRampShader mColorRampShader;
216  QColor mSingleColor = Qt::darkGreen;
217 };
218 
219 #endif // QGSMESH3DSYMBOL_H
QString type() const override
Returns identifier of symbol type. Each 3D symbol implementation should return a different type...
AltitudeClamping
how to handle altitude of vector features
Definition: qgs3dtypes.h:34
The class is used as a container of context for various read/write operations on other objects...
void setAltitudeClamping(Qgs3DTypes::AltitudeClamping altClamping)
Sets method that determines altitude (whether to clamp to feature to terrain)
3 3D symbol that draws mesh geometry as planar triangles.
virtual QgsAbstract3DSymbol * clone() const =0
Returns a new instance of the symbol with the same settings.
A ramp shader will color a raster pixel based on a list of values ranges in a ramp.
float height() const
Returns height (altitude) of the symbol (in map units)
3 Basic shading material used for rendering based on the Phong shading model with three color compone...
virtual void writeXml(QDomElement &elem, const QgsReadWriteContext &context) const =0
Writes symbol configuration to the given DOM element.
3 Abstract base class for 3D symbols that are used by VectorLayer3DRenderer objects.
bool addBackFaces() const
Returns whether also triangles facing the other side will be created.
void setHeight(float height)
Sets height (altitude) of the symbol (in map units)
#define SIP_FACTORY
Definition: qgis_sip.h:76
QgsPhongMaterialSettings material() const
Returns material used for shading of the symbol.
void setAddBackFaces(bool add)
Sets whether also triangles facing the other side will be created.
RenderingStyle
How to render the color of the mesh with advanced symbology.
virtual void readXml(const QDomElement &elem, const QgsReadWriteContext &context)=0
Reads symbol configuration from the given DOM element.
Render the mesh with a single color.
Qgs3DTypes::AltitudeClamping altitudeClamping() const
Returns method that determines altitude (whether to clamp to feature to terrain)
Z_final = z_terrain + z_geometry.
Definition: qgs3dtypes.h:37
void setMaterial(const QgsPhongMaterialSettings &material)
Sets material used for shading of the symbol.