QGIS API Documentation  3.26.3-Buenos Aires (65e4edfdad)
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
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:151
QgsPolygon3DSymbol::setExtrusionHeight
void setExtrusionHeight(float extrusionHeight)
Sets extrusion height (in map units)
Definition: qgspolygon3dsymbol.h:77
QgsReadWriteContext
The class is used as a container of context for various read/write operations on other objects.
Definition: qgsreadwritecontext.h:34
Qgis::AltitudeBinding::Centroid
@ Centroid
Clamp just centroid of feature.
QgsPolygon3DSymbol::extrusionHeight
float extrusionHeight() const
Returns extrusion height (in map units)
Definition: qgspolygon3dsymbol.h:75
QgsPolygon3DSymbol::setEdgesEnabled
void setEdgesEnabled(bool enabled)
Sets whether edge highlighting is enabled.
Definition: qgspolygon3dsymbol.h:121
QgsPolygon3DSymbol
3D symbol that draws polygon geometries as planar polygons, optionally extruded (with added walls).
Definition: qgspolygon3dsymbol.h:37
Qgis::AltitudeClamping::Relative
@ Relative
Elevation is relative to terrain height (final elevation = terrain elevation + feature elevation)
QgsPolygon3DSymbol::setCullingMode
void setCullingMode(Qgs3DTypes::CullingMode mode)
Sets front/back culling mode.
Definition: qgspolygon3dsymbol.h:92
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:145
QgsAbstract3DSymbol
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:48
Qgis::AltitudeBinding
AltitudeBinding
Altitude binding.
Definition: qgis.h:1770
Qgs3DSceneExporter
Entity that handles the exporting of 3D scene.
Definition: qgs3dsceneexporter.h:55
SIP_SKIP
#define SIP_SKIP
Definition: qgis_sip.h:126
QgsAbstractMaterialSettings
Abstract base class for material settings.
Definition: qgsabstractmaterialsettings.h:114
QgsPolygon3DSymbol::setHeight
void setHeight(float height)
Sets height (altitude) of the symbol (in map units)
Definition: qgspolygon3dsymbol.h:72
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:157
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:109
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:127
QgsPolygon3DSymbol::setEdgeWidth
void setEdgeWidth(float width)
Sets width of edge lines (in pixels)
Definition: qgspolygon3dsymbol.h:133
QgsPolygon3DSymbol::edgeColor
QColor edgeColor() const
Returns edge lines color.
Definition: qgspolygon3dsymbol.h:139
QgsPolygon3DSymbol::type
QString type() const override
Definition: qgspolygon3dsymbol.h:44
QgsPolygon3DSymbol::setAltitudeClamping
void setAltitudeClamping(Qgis::AltitudeClamping altClamping)
Sets method that determines altitude (whether to clamp to feature to terrain)
Definition: qgspolygon3dsymbol.h:62
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
QgsPolygon3DSymbol::setAltitudeBinding
void setAltitudeBinding(Qgis::AltitudeBinding altBinding)
Sets method that determines how altitude is bound to individual vertices.
Definition: qgspolygon3dsymbol.h:67
QgsVectorLayer
Represents a vector layer which manages a vector based data sets.
Definition: qgsvectorlayer.h:391
QgsPolygon3DSymbol::cullingMode
Qgs3DTypes::CullingMode cullingMode() const
Returns front/back culling mode.
Definition: qgspolygon3dsymbol.h:90
QgsPolygon3DSymbol::invertNormals
bool invertNormals() const
Returns whether the normals of triangles will be inverted (useful for fixing clockwise / counter-cloc...
Definition: qgspolygon3dsymbol.h:95
QgsPolygon3DSymbol::edgesEnabled
bool edgesEnabled() const
Returns whether edge highlighting is enabled.
Definition: qgspolygon3dsymbol.h:115
QgsPolygon3DSymbol::height
float height() const
Returns height (altitude) of the symbol (in map units)
Definition: qgspolygon3dsymbol.h:70
Qgis
The Qgis class provides global constants for use throughout the application.
Definition: qgis.h:71
QgsWkbTypes
Handles storage of information regarding WKB types and their properties.
Definition: qgswkbtypes.h:41
QgsPolygon3DSymbol::addBackFaces
bool addBackFaces() const
Returns whether also triangles facing the other side will be created.
Definition: qgspolygon3dsymbol.h:103
Qgis::AltitudeClamping
AltitudeClamping
Altitude clamping.
Definition: qgis.h:1757
Qgs3DTypes::NoCulling
@ NoCulling
Will render both front and back faces of triangles.
Definition: qgs3dtypes.h:63
QgsPolygon3DSymbol::setInvertNormals
void setInvertNormals(bool invert)
Sets whether the normals of triangles will be inverted (useful for fixing clockwise / counter-clockwi...
Definition: qgspolygon3dsymbol.h:97
QgsPolygon3DSymbol::altitudeBinding
Qgis::AltitudeBinding altitudeBinding() const
Returns method that determines how altitude is bound to individual vertices.
Definition: qgspolygon3dsymbol.h:65