QGIS API Documentation 3.37.0-Master (fdefdf9c27f)
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
37{
38 public:
42
43 QString type() const override { return "polygon"; }
44 QgsAbstract3DSymbol *clone() const override SIP_FACTORY;
45
46 void writeXml( QDomElement &elem, const QgsReadWriteContext &context ) const override;
47 void readXml( const QDomElement &elem, const QgsReadWriteContext &context ) override;
48 QList< Qgis::GeometryType > compatibleGeometryTypes() const override;
49 void setDefaultPropertiesFromLayer( const QgsVectorLayer *layer ) override;
50
56 static QgsAbstract3DSymbol *create() SIP_FACTORY;
57
59 Qgis::AltitudeClamping altitudeClamping() const { return mAltClamping; }
61 void setAltitudeClamping( Qgis::AltitudeClamping altClamping ) { mAltClamping = altClamping; }
62
64 Qgis::AltitudeBinding altitudeBinding() const { return mAltBinding; }
66 void setAltitudeBinding( Qgis::AltitudeBinding altBinding ) { mAltBinding = altBinding; }
67
73 Q_DECL_DEPRECATED float height() const SIP_DEPRECATED { return mOffset; }
74
80 Q_DECL_DEPRECATED void setHeight( float height ) SIP_DEPRECATED { mOffset = height; }
81
87 float offset() const { return mOffset; }
88
94 void setOffset( float offset ) { mOffset = offset; }
95
97 float extrusionHeight() const { return mExtrusionHeight; }
99 void setExtrusionHeight( float extrusionHeight ) { mExtrusionHeight = extrusionHeight; }
100
102 QgsAbstractMaterialSettings *materialSettings() const;
103
109 void setMaterialSettings( QgsAbstractMaterialSettings *materialSettings SIP_TRANSFER );
110
112 Qgs3DTypes::CullingMode cullingMode() const { return mCullingMode; }
114 void setCullingMode( Qgs3DTypes::CullingMode mode ) { mCullingMode = mode; }
115
117 bool invertNormals() const { return mInvertNormals; }
119 void setInvertNormals( bool invert ) { mInvertNormals = invert; }
120
125 bool addBackFaces() const { return mAddBackFaces; }
126
131 void setAddBackFaces( bool add ) { mAddBackFaces = add; }
132
137 bool edgesEnabled() const { return mEdgesEnabled; }
138
143 void setEdgesEnabled( bool enabled ) { mEdgesEnabled = enabled; }
144
149 float edgeWidth() const { return mEdgeWidth; }
150
155 void setEdgeWidth( float width ) { mEdgeWidth = width; }
156
161 QColor edgeColor() const { return mEdgeColor; }
162
167 void setEdgeColor( const QColor &color ) { mEdgeColor = color; }
168
173 void setRenderedFacade( int side ) { mRenderedFacade = side; }
174
179 int renderedFacade() const { return mRenderedFacade; }
180
186 bool exportGeometries( Qgs3DSceneExporter *exporter, Qt3DCore::QEntity *entity, const QString &objectNamePrefix ) const override SIP_SKIP;
187
188 private:
193
194 float mOffset = 0.0f;
195 float mExtrusionHeight = 0.0f;
196 std::unique_ptr< QgsAbstractMaterialSettings > mMaterialSettings;
198 bool mInvertNormals = false;
199 bool mAddBackFaces = false;
200 int mRenderedFacade = 3;
201
202 bool mEdgesEnabled = false;
203 float mEdgeWidth = 1.f;
204 QColor mEdgeColor = Qt::black;
205};
206
207
208#endif // QGSPOLYGON3DSYMBOL_H
The Qgis class provides global constants for use throughout the application.
Definition: qgis.h:54
AltitudeClamping
Altitude clamping.
Definition: qgis.h:3238
@ Relative
Elevation is relative to terrain height (final elevation = terrain elevation + feature elevation)
AltitudeBinding
Altitude binding.
Definition: qgis.h:3251
@ 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.
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,...
Q_DECL_DEPRECATED float height() const SIP_DEPRECATED
Returns height (altitude) of the symbol (in map units)
float extrusionHeight() const
Returns extrusion height (in map units)
Q_DECL_DEPRECATED void setHeight(float height) SIP_DEPRECATED
Sets height (altitude) of the symbol (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.
float offset() const
Returns vertical offset of the symbol (in map units)
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.
void setOffset(float offset)
Sets vertical offset of the symbol (in map units)
bool edgesEnabled() const
Returns whether edge highlighting is enabled.
void setEdgesEnabled(bool enabled)
Sets whether edge highlighting is enabled.
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.
#define SIP_DEPRECATED
Definition: qgis_sip.h:106
#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