QGIS API Documentation  3.14.0-Pi (9f7028fd23)
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 "qgs3dtypes.h"
24 
25 #include <Qt3DRender/QCullFace>
26 
36 class _3D_EXPORT QgsPolygon3DSymbol : public QgsAbstract3DSymbol
37 {
38  public:
40  QgsPolygon3DSymbol() = default;
41 
42  QString type() const override { return "polygon"; }
43  QgsAbstract3DSymbol *clone() const override SIP_FACTORY;
44 
45  void writeXml( QDomElement &elem, const QgsReadWriteContext &context ) const override;
46  void readXml( const QDomElement &elem, const QgsReadWriteContext &context ) override;
47 
49  Qgs3DTypes::AltitudeClamping altitudeClamping() const { return mAltClamping; }
51  void setAltitudeClamping( Qgs3DTypes::AltitudeClamping altClamping ) { mAltClamping = altClamping; }
52 
54  Qgs3DTypes::AltitudeBinding altitudeBinding() const { return mAltBinding; }
56  void setAltitudeBinding( Qgs3DTypes::AltitudeBinding altBinding ) { mAltBinding = altBinding; }
57 
59  float height() const { return mHeight; }
61  void setHeight( float height ) { mHeight = height; }
62 
64  float extrusionHeight() const { return mExtrusionHeight; }
66  void setExtrusionHeight( float extrusionHeight ) { mExtrusionHeight = extrusionHeight; }
67 
69  QgsPhongMaterialSettings material() const { return mMaterial; }
71  void setMaterial( const QgsPhongMaterialSettings &material ) { mMaterial = material; }
72 
74  Qgs3DTypes::CullingMode cullingMode() const { return mCullingMode; }
76  void setCullingMode( Qgs3DTypes::CullingMode mode ) { mCullingMode = mode; }
77 
79  bool invertNormals() const { return mInvertNormals; }
81  void setInvertNormals( bool invert ) { mInvertNormals = invert; }
82 
87  bool addBackFaces() const { return mAddBackFaces; }
88 
93  void setAddBackFaces( bool add ) { mAddBackFaces = add; }
94 
99  bool edgesEnabled() const { return mEdgesEnabled; }
100 
105  void setEdgesEnabled( bool enabled ) { mEdgesEnabled = enabled; }
106 
111  float edgeWidth() const { return mEdgeWidth; }
112 
117  void setEdgeWidth( float width ) { mEdgeWidth = width; }
118 
123  QColor edgeColor() const { return mEdgeColor; }
124 
129  void setEdgeColor( const QColor &color ) { mEdgeColor = color; }
130 
131  private:
136 
137  float mHeight = 0.0f;
138  float mExtrusionHeight = 0.0f;
139  QgsPhongMaterialSettings mMaterial;
141  bool mInvertNormals = false;
142  bool mAddBackFaces = false;
143 
144  bool mEdgesEnabled = false;
145  float mEdgeWidth = 1.f;
146  QColor mEdgeColor = Qt::black;
147 };
148 
149 
150 #endif // QGSPOLYGON3DSYMBOL_H
Qgs3DTypes::AltitudeBinding
AltitudeBinding
how to handle clamping of vertices of individual features
Definition: qgs3dtypes.h:55
QgsReadWriteContext
Definition: qgsreadwritecontext.h:34
QgsAbstract3DSymbol::readXml
virtual void readXml(const QDomElement &elem, const QgsReadWriteContext &context)=0
Reads symbol configuration from the given DOM element.
Qgs3DTypes::AltClampRelative
@ AltClampRelative
Z_final = z_terrain + z_geometry.
Definition: qgs3dtypes.h:63
Qgs3DTypes::AltBindCentroid
@ AltBindCentroid
Clamp just centroid of feature.
Definition: qgs3dtypes.h:58
QgsPolygon3DSymbol
Definition: qgspolygon3dsymbol.h:36
qgsabstract3dsymbol.h
SIP_FACTORY
#define SIP_FACTORY
Definition: qgis_sip.h:76
QgsPhongMaterialSettings
Definition: qgsphongmaterialsettings.h:35
QgsAbstract3DSymbol
Definition: qgsabstract3dsymbol.h:41
Qgs3DTypes::CullingMode
CullingMode
Triangle culling mode.
Definition: qgs3dtypes.h:62
QgsAbstract3DSymbol::type
virtual QString type() const =0
Returns identifier of symbol type. Each 3D symbol implementation should return a different type.
qgs3dtypes.h
QgsAbstract3DSymbol::clone
virtual QgsAbstract3DSymbol * clone() const =0
Returns a new instance of the symbol with the same settings.
Qgs3DTypes::AltitudeClamping
AltitudeClamping
how to handle altitude of vector features
Definition: qgs3dtypes.h:47
QgsAbstract3DSymbol::writeXml
virtual void writeXml(QDomElement &elem, const QgsReadWriteContext &context) const =0
Writes symbol configuration to the given DOM element.
qgsphongmaterialsettings.h
Qgs3DTypes::NoCulling
@ NoCulling
Will render both front and back faces of triangles.
Definition: qgs3dtypes.h:64