QGIS API Documentation  3.27.0-Master (e113457133)
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  void setDefaultPropertiesFromLayer( const QgsVectorLayer *layer ) override;
51 
57  static QgsAbstract3DSymbol *create() SIP_FACTORY;
58 
60  Qgis::AltitudeClamping altitudeClamping() const { return mAltClamping; }
62  void setAltitudeClamping( Qgis::AltitudeClamping altClamping ) { mAltClamping = altClamping; }
63 
65  Qgis::AltitudeBinding altitudeBinding() const { return mAltBinding; }
67  void setAltitudeBinding( Qgis::AltitudeBinding altBinding ) { mAltBinding = altBinding; }
68 
70  float height() const { return mHeight; }
72  void setHeight( float height ) { mHeight = height; }
73 
75  float extrusionHeight() const { return mExtrusionHeight; }
77  void setExtrusionHeight( float extrusionHeight ) { mExtrusionHeight = extrusionHeight; }
78 
80  QgsAbstractMaterialSettings *material() const;
81 
87  void setMaterial( QgsAbstractMaterialSettings *material SIP_TRANSFER );
88 
90  Qgs3DTypes::CullingMode cullingMode() const { return mCullingMode; }
92  void setCullingMode( Qgs3DTypes::CullingMode mode ) { mCullingMode = mode; }
93 
95  bool invertNormals() const { return mInvertNormals; }
97  void setInvertNormals( bool invert ) { mInvertNormals = invert; }
98 
103  bool addBackFaces() const { return mAddBackFaces; }
104 
109  void setAddBackFaces( bool add ) { mAddBackFaces = add; }
110 
115  bool edgesEnabled() const { return mEdgesEnabled; }
116 
121  void setEdgesEnabled( bool enabled ) { mEdgesEnabled = enabled; }
122 
127  float edgeWidth() const { return mEdgeWidth; }
128 
133  void setEdgeWidth( float width ) { mEdgeWidth = width; }
134 
139  QColor edgeColor() const { return mEdgeColor; }
140 
145  void setEdgeColor( const QColor &color ) { mEdgeColor = color; }
146 
151  void setRenderedFacade( int side ) { mRenderedFacade = side; }
152 
157  int renderedFacade() const { return mRenderedFacade; }
158 
164  bool exportGeometries( Qgs3DSceneExporter *exporter, Qt3DCore::QEntity *entity, const QString &objectNamePrefix ) const override SIP_SKIP;
165 
166  private:
171 
172  float mHeight = 0.0f;
173  float mExtrusionHeight = 0.0f;
174  std::unique_ptr< QgsAbstractMaterialSettings > mMaterial;
176  bool mInvertNormals = false;
177  bool mAddBackFaces = false;
178  int mRenderedFacade = 3;
179 
180  bool mEdgesEnabled = false;
181  float mEdgeWidth = 1.f;
182  QColor mEdgeColor = Qt::black;
183 };
184 
185 
186 #endif // QGSPOLYGON3DSYMBOL_H
The Qgis class provides global constants for use throughout the application.
Definition: qgis.h:72
AltitudeClamping
Altitude clamping.
Definition: qgis.h:1776
@ Relative
Elevation is relative to terrain height (final elevation = terrain elevation + feature elevation)
AltitudeBinding
Altitude binding.
Definition: qgis.h:1789
@ Centroid
Clamp just centroid of feature.
Entity that handles the exporting of 3D scene.
CullingMode
Triangle culling mode.
Definition: qgs3dtypes.h:36
@ NoCulling
Will render both front and back faces of triangles.
Definition: qgs3dtypes.h:37
virtual bool exportGeometries(Qgs3DSceneExporter *exporter, Qt3DCore::QEntity *entity, const QString &objectNamePrefix) const
Exports the geometries contained within the hierarchy of entity.
virtual QgsAbstract3DSymbol * clone() const =0
Returns a new instance of the symbol with the same settings.
void setHeight(float height)
Sets height (altitude) of the symbol (in map units)
Qgis::AltitudeBinding altitudeBinding() const
Returns method that determines how altitude is bound to individual vertices.
void setCullingMode(Qgs3DTypes::CullingMode mode)
Sets front/back culling mode.
void setAddBackFaces(bool add)
Sets whether also triangles facing the other side will be created.
QString type() const override
void setExtrusionHeight(float extrusionHeight)
Sets extrusion height (in map units)
void setAltitudeBinding(Qgis::AltitudeBinding altBinding)
Sets method that determines how altitude is bound to individual vertices.
bool invertNormals() const
Returns whether the normals of triangles will be inverted (useful for fixing clockwise / counter-cloc...
void setRenderedFacade(int side)
Sets which facade of the buildings is rendered (0 for None, 1 for Walls, 2 for Roofs,...
float extrusionHeight() const
Returns extrusion height (in map units)
~QgsPolygon3DSymbol() override
Qgs3DTypes::CullingMode cullingMode() const
Returns front/back culling mode.
QColor edgeColor() const
Returns edge lines color.
void setEdgeWidth(float width)
Sets width of edge lines (in pixels)
void setEdgeColor(const QColor &color)
Sets edge lines color.
int renderedFacade() const
Returns which facade of the buildings is rendered (0 for None, 1 for Walls, 2 for Roofs,...
void setInvertNormals(bool invert)
Sets whether the normals of triangles will be inverted (useful for fixing clockwise / counter-clockwi...
bool addBackFaces() const
Returns whether also triangles facing the other side will be created.
bool edgesEnabled() const
Returns whether edge highlighting is enabled.
void setEdgesEnabled(bool enabled)
Sets whether edge highlighting is enabled.
float height() const
Returns height (altitude) of the symbol (in map units)
float edgeWidth() const
Returns width of edge lines (in pixels)
void setAltitudeClamping(Qgis::AltitudeClamping altClamping)
Sets method that determines altitude (whether to clamp to feature to terrain)
The class is used as a container of context for various read/write operations on other objects.
Represents a vector layer which manages a vector based data sets.
Handles storage of information regarding WKB types and their properties.
Definition: qgswkbtypes.h:42
#define SIP_SKIP
Definition: qgis_sip.h:126
#define SIP_TRANSFER
Definition: qgis_sip.h:36
#define SIP_FACTORY
Definition: qgis_sip.h:76
#define SIP_NODEFAULTCTORS
Definition: qgis_sip.h:101