QGIS API Documentation  3.16.0-Hannover (43b64b13f3)
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"
22 #include "qgs3dtypes.h"
23 
24 #include <Qt3DRender/QCullFace>
25 
27 
38 {
39  public:
42  ~QgsPolygon3DSymbol() override;
43 
44  QString type() const override { return "polygon"; }
45  QgsAbstract3DSymbol *clone() const override SIP_FACTORY;
46 
47  void writeXml( QDomElement &elem, const QgsReadWriteContext &context ) const override;
48  void readXml( const QDomElement &elem, const QgsReadWriteContext &context ) override;
49  QList< QgsWkbTypes::GeometryType > compatibleGeometryTypes() const override;
50 
56  static QgsAbstract3DSymbol *create() SIP_FACTORY;
57 
59  Qgs3DTypes::AltitudeClamping altitudeClamping() const { return mAltClamping; }
61  void setAltitudeClamping( Qgs3DTypes::AltitudeClamping altClamping ) { mAltClamping = altClamping; }
62 
64  Qgs3DTypes::AltitudeBinding altitudeBinding() const { return mAltBinding; }
66  void setAltitudeBinding( Qgs3DTypes::AltitudeBinding altBinding ) { mAltBinding = altBinding; }
67 
69  float height() const { return mHeight; }
71  void setHeight( float height ) { mHeight = height; }
72 
74  float extrusionHeight() const { return mExtrusionHeight; }
76  void setExtrusionHeight( float extrusionHeight ) { mExtrusionHeight = extrusionHeight; }
77 
79  QgsAbstractMaterialSettings *material() const;
80 
86  void setMaterial( QgsAbstractMaterialSettings *material SIP_TRANSFER );
87 
89  Qgs3DTypes::CullingMode cullingMode() const { return mCullingMode; }
91  void setCullingMode( Qgs3DTypes::CullingMode mode ) { mCullingMode = mode; }
92 
94  bool invertNormals() const { return mInvertNormals; }
96  void setInvertNormals( bool invert ) { mInvertNormals = invert; }
97 
102  bool addBackFaces() const { return mAddBackFaces; }
103 
108  void setAddBackFaces( bool add ) { mAddBackFaces = add; }
109 
114  bool edgesEnabled() const { return mEdgesEnabled; }
115 
120  void setEdgesEnabled( bool enabled ) { mEdgesEnabled = enabled; }
121 
126  float edgeWidth() const { return mEdgeWidth; }
127 
132  void setEdgeWidth( float width ) { mEdgeWidth = width; }
133 
138  QColor edgeColor() const { return mEdgeColor; }
139 
144  void setEdgeColor( const QColor &color ) { mEdgeColor = color; }
145 
150  void setRenderedFacade( int side ) { mRenderedFacade = side; }
151 
156  int renderedFacade() const { return mRenderedFacade; }
157 
163  bool exportGeometries( Qgs3DSceneExporter *exporter, Qt3DCore::QEntity *entity, const QString &objectNamePrefix ) const override SIP_SKIP;
164 
165  private:
170 
171  float mHeight = 0.0f;
172  float mExtrusionHeight = 0.0f;
173  std::unique_ptr< QgsAbstractMaterialSettings > mMaterial;
175  bool mInvertNormals = false;
176  bool mAddBackFaces = false;
177  int mRenderedFacade = 3;
178 
179  bool mEdgesEnabled = false;
180  float mEdgeWidth = 1.f;
181  QColor mEdgeColor = Qt::black;
182 };
183 
184 
185 #endif // QGSPOLYGON3DSYMBOL_H
Qgs3DTypes::AltitudeBinding
AltitudeBinding
how to handle clamping of vertices of individual features
Definition: qgs3dtypes.h:43
QgsPolygon3DSymbol::setRenderedFacade
void setRenderedFacade(int side)
Sets which facade of the buildings is rendered (0 for None, 1 for Walls, 2 for Roofs,...
Definition: qgspolygon3dsymbol.h:150
QgsPolygon3DSymbol::setExtrusionHeight
void setExtrusionHeight(float extrusionHeight)
Sets extrusion height (in map units)
Definition: qgspolygon3dsymbol.h:76
QgsReadWriteContext
The class is used as a container of context for various read/write operations on other objects.
Definition: qgsreadwritecontext.h:35
QgsPolygon3DSymbol::extrusionHeight
float extrusionHeight() const
Returns extrusion height (in map units)
Definition: qgspolygon3dsymbol.h:74
Qgs3DTypes::AltClampRelative
@ AltClampRelative
Z_final = z_terrain + z_geometry.
Definition: qgs3dtypes.h:37
Qgs3DTypes::AltBindCentroid
@ AltBindCentroid
Clamp just centroid of feature.
Definition: qgs3dtypes.h:45
QgsPolygon3DSymbol::setAltitudeBinding
void setAltitudeBinding(Qgs3DTypes::AltitudeBinding altBinding)
Sets method that determines how altitude is bound to individual vertices.
Definition: qgspolygon3dsymbol.h:66
QgsPolygon3DSymbol::setEdgesEnabled
void setEdgesEnabled(bool enabled)
Sets whether edge highlighting is enabled.
Definition: qgspolygon3dsymbol.h:120
QgsPolygon3DSymbol
3 3D symbol that draws polygon geometries as planar polygons, optionally extruded (with added walls).
Definition: qgspolygon3dsymbol.h:38
QgsPolygon3DSymbol::setCullingMode
void setCullingMode(Qgs3DTypes::CullingMode mode)
Sets front/back culling mode.
Definition: qgspolygon3dsymbol.h:91
qgsabstract3dsymbol.h
SIP_FACTORY
#define SIP_FACTORY
Definition: qgis_sip.h:76
QgsPolygon3DSymbol::setEdgeColor
void setEdgeColor(const QColor &color)
Sets edge lines color.
Definition: qgspolygon3dsymbol.h:144
QgsAbstract3DSymbol
3 Abstract base class for 3D symbols that are used by VectorLayer3DRenderer objects.
Definition: qgsabstract3dsymbol.h:46
Qgs3DTypes::CullingMode
CullingMode
Triangle culling mode.
Definition: qgs3dtypes.h:50
Qgs3DSceneExporter
The Qgs3DSceneExporter class Entity that handles the exporting of 3D scene.
Definition: qgs3dsceneexporter.h:57
SIP_SKIP
#define SIP_SKIP
Definition: qgis_sip.h:126
QgsAbstractMaterialSettings
3 Abstract base class for material settings.
Definition: qgsabstractmaterialsettings.h:105
QgsPolygon3DSymbol::setHeight
void setHeight(float height)
Sets height (altitude) of the symbol (in map units)
Definition: qgspolygon3dsymbol.h:71
QgsPolygon3DSymbol::renderedFacade
int renderedFacade() const
Returns which facade of the buildings is rendered (0 for None, 1 for Walls, 2 for Roofs,...
Definition: qgspolygon3dsymbol.h:156
SIP_TRANSFER
#define SIP_TRANSFER
Definition: qgis_sip.h:36
QgsPolygon3DSymbol::setAddBackFaces
void setAddBackFaces(bool add)
Sets whether also triangles facing the other side will be created.
Definition: qgspolygon3dsymbol.h:108
qgs3dtypes.h
QgsAbstract3DSymbol::clone
virtual QgsAbstract3DSymbol * clone() const =0
Returns a new instance of the symbol with the same settings.
QgsPolygon3DSymbol::edgeWidth
float edgeWidth() const
Returns width of edge lines (in pixels)
Definition: qgspolygon3dsymbol.h:126
QgsPolygon3DSymbol::setEdgeWidth
void setEdgeWidth(float width)
Sets width of edge lines (in pixels)
Definition: qgspolygon3dsymbol.h:132
QgsPolygon3DSymbol::edgeColor
QColor edgeColor() const
Returns edge lines color.
Definition: qgspolygon3dsymbol.h:138
QgsPolygon3DSymbol::~QgsPolygon3DSymbol
~QgsPolygon3DSymbol() override
QgsPolygon3DSymbol::type
QString type() const override
Definition: qgspolygon3dsymbol.h:44
QgsPolygon3DSymbol::setAltitudeClamping
void setAltitudeClamping(Qgs3DTypes::AltitudeClamping altClamping)
Sets method that determines altitude (whether to clamp to feature to terrain)
Definition: qgspolygon3dsymbol.h:61
QgsAbstract3DSymbol::exportGeometries
virtual bool exportGeometries(Qgs3DSceneExporter *exporter, Qt3DCore::QEntity *entity, const QString &objectNamePrefix) const
Exports the geometries contained within the hierarchy of entity.
Definition: qgsabstract3dsymbol.cpp:53
SIP_NODEFAULTCTORS
#define SIP_NODEFAULTCTORS
Definition: qgis_sip.h:101
Qgs3DTypes::AltitudeClamping
AltitudeClamping
how to handle altitude of vector features
Definition: qgs3dtypes.h:35
QgsPolygon3DSymbol::cullingMode
Qgs3DTypes::CullingMode cullingMode() const
Returns front/back culling mode.
Definition: qgspolygon3dsymbol.h:89
QgsPolygon3DSymbol::invertNormals
bool invertNormals() const
Returns whether the normals of triangles will be inverted (useful for fixing clockwise / counter-cloc...
Definition: qgspolygon3dsymbol.h:94
QgsPolygon3DSymbol::edgesEnabled
bool edgesEnabled() const
Returns whether edge highlighting is enabled.
Definition: qgspolygon3dsymbol.h:114
QgsPolygon3DSymbol::height
float height() const
Returns height (altitude) of the symbol (in map units)
Definition: qgspolygon3dsymbol.h:69
QgsWkbTypes
Handles storage of information regarding WKB types and their properties.
Definition: qgswkbtypes.h:42
QgsPolygon3DSymbol::altitudeBinding
Qgs3DTypes::AltitudeBinding altitudeBinding() const
Returns method that determines how altitude is bound to individual vertices.
Definition: qgspolygon3dsymbol.h:64
QgsPolygon3DSymbol::addBackFaces
bool addBackFaces() const
Returns whether also triangles facing the other side will be created.
Definition: qgspolygon3dsymbol.h:102
Qgs3DTypes::NoCulling
@ NoCulling
Will render both front and back faces of triangles.
Definition: qgs3dtypes.h:51
Qgs3DTypes
3 Defines enumerations and other auxiliary types for QGIS 3D
Definition: qgs3dtypes.h:31
QgsPolygon3DSymbol::setInvertNormals
void setInvertNormals(bool invert)
Sets whether the normals of triangles will be inverted (useful for fixing clockwise / counter-clockwi...
Definition: qgspolygon3dsymbol.h:96