QGIS API Documentation  3.2.0-Bonn (bc43194)
qgspolygon3dsymbol.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgspolygon3dsymbol.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 QGSPOLYGON3DSYMBOL_H
17 #define QGSPOLYGON3DSYMBOL_H
18 
19 #include "qgis_3d.h"
20 
21 #include "qgsabstract3dsymbol.h"
23 #include "qgs3dutils.h"
24 
25 #include <Qt3DRender/QCullFace>
26 
32 class _3D_EXPORT QgsPolygon3DSymbol : public QgsAbstract3DSymbol
33 {
34  public:
36  QgsPolygon3DSymbol() = default;
37 
38  QString type() const override { return "polygon"; }
39  QgsAbstract3DSymbol *clone() const override SIP_FACTORY;
40 
41  void writeXml( QDomElement &elem, const QgsReadWriteContext &context ) const override;
42  void readXml( const QDomElement &elem, const QgsReadWriteContext &context ) override;
43 
45  AltitudeClamping altitudeClamping() const { return mAltClamping; }
47  void setAltitudeClamping( AltitudeClamping altClamping ) { mAltClamping = altClamping; }
48 
50  AltitudeBinding altitudeBinding() const { return mAltBinding; }
52  void setAltitudeBinding( AltitudeBinding altBinding ) { mAltBinding = altBinding; }
53 
55  float height() const { return mHeight; }
57  void setHeight( float height ) { mHeight = height; }
58 
60  float extrusionHeight() const { return mExtrusionHeight; }
62  void setExtrusionHeight( float extrusionHeight ) { mExtrusionHeight = extrusionHeight; }
63 
65  QgsPhongMaterialSettings material() const { return mMaterial; }
67  void setMaterial( const QgsPhongMaterialSettings &material ) { mMaterial = material; }
68 
70  Qt3DRender::QCullFace::CullingMode cullingMode() const { return mCullingMode; }
72  void setCullingMode( Qt3DRender::QCullFace::CullingMode mode ) { mCullingMode = mode; }
73 
75  bool invertNormals() const { return mInvertNormals; }
77  void setInvertNormals( bool invert ) { mInvertNormals = invert; }
78 
83  bool addBackFaces() const { return mAddBackFaces; }
84 
89  void setAddBackFaces( bool add ) { mAddBackFaces = add; }
90 
91  private:
93  AltitudeClamping mAltClamping = AltClampRelative;
95  AltitudeBinding mAltBinding = AltBindCentroid;
96 
97  float mHeight = 0.0f;
98  float mExtrusionHeight = 0.0f;
99  QgsPhongMaterialSettings mMaterial;
100  Qt3DRender::QCullFace::CullingMode mCullingMode = Qt3DRender::QCullFace::NoCulling;
101  bool mInvertNormals = false;
102  bool mAddBackFaces = false;
103 };
104 
105 
106 #endif // QGSPOLYGON3DSYMBOL_H
float height() const
Returns height (altitude) of the symbol (in map units)
The class is used as a container of context for various read/write operations on other objects...
Z_final = z_terrain + z_geometry.
Definition: qgs3dutils.h:31
bool addBackFaces() const
Returns whether also triangles facing the other side will be created.
virtual QgsAbstract3DSymbol * clone() const =0
Returns a new instance of the symbol with the same settings.
3 3D symbol that draws polygon geometries as planar polygons, optionally extruded (with added walls)...
void setHeight(float height)
Sets height (altitude) of the symbol (in map units)
Clamp just centroid of feature.
Definition: qgs3dutils.h:40
AltitudeClamping altitudeClamping() const
Returns method that determines altitude (whether to clamp to feature to terrain)
3 Basic shading material used for rendering based on the Phong shading model with three color compone...
QgsPhongMaterialSettings material() const
Returns material used for shading of the symbol.
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.
void setAddBackFaces(bool add)
Sets whether also triangles facing the other side will be created.
#define SIP_FACTORY
Definition: qgis_sip.h:69
Qt3DRender::QCullFace::CullingMode cullingMode() const
Returns front/back culling mode.
bool invertNormals() const
Returns whether the normals of triangles will be inverted (useful for fixing clockwise / counter-cloc...
AltitudeClamping
how to handle altitude of vector features
Definition: qgs3dutils.h:28
AltitudeBinding altitudeBinding() const
Returns method that determines how altitude is bound to individual vertices.
void setMaterial(const QgsPhongMaterialSettings &material)
Sets material used for shading of the symbol.
void setAltitudeClamping(AltitudeClamping altClamping)
Sets method that determines altitude (whether to clamp to feature to terrain)
QString type() const override
Returns identifier of symbol type. Each 3D symbol implementation should return a different type...
void setInvertNormals(bool invert)
Sets whether the normals of triangles will be inverted (useful for fixing clockwise / counter-clockwi...
virtual void readXml(const QDomElement &elem, const QgsReadWriteContext &context)=0
Reads symbol configuration from the given DOM element.
void setExtrusionHeight(float extrusionHeight)
Sets extrusion height (in map units)
void setCullingMode(Qt3DRender::QCullFace::CullingMode mode)
Sets front/back culling mode.
AltitudeBinding
how to handle clamping of vertices of individual features
Definition: qgs3dutils.h:37
float extrusionHeight() const
Returns extrusion height (in map units)
void setAltitudeBinding(AltitudeBinding altBinding)
Sets method that determines how altitude is bound to individual vertices.