QGIS API Documentation 3.39.0-Master (699c004a5df)
Loading...
Searching...
No Matches
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:
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 QList< Qgis::GeometryType > compatibleGeometryTypes() const override;
48 void setDefaultPropertiesFromLayer( const QgsVectorLayer *layer ) override;
49
55 static QgsAbstract3DSymbol *create() SIP_FACTORY;
56
58 Qgis::AltitudeClamping altitudeClamping() const { return mAltClamping; }
60 void setAltitudeClamping( Qgis::AltitudeClamping altClamping ) { mAltClamping = altClamping; }
61
63 Qgis::AltitudeBinding altitudeBinding() const { return mAltBinding; }
65 void setAltitudeBinding( Qgis::AltitudeBinding altBinding ) { mAltBinding = altBinding; }
66
72 Q_DECL_DEPRECATED float height() const SIP_DEPRECATED { return mOffset; }
73
79 Q_DECL_DEPRECATED void setHeight( float height ) SIP_DEPRECATED { mOffset = height; }
80
86 float offset() const { return mOffset; }
87
93 void setOffset( float offset ) { mOffset = offset; }
94
96 float extrusionHeight() const { return mExtrusionHeight; }
98 void setExtrusionHeight( float extrusionHeight ) { mExtrusionHeight = extrusionHeight; }
99
101 QgsAbstractMaterialSettings *materialSettings() const;
102
108 void setMaterialSettings( QgsAbstractMaterialSettings *materialSettings SIP_TRANSFER );
109
111 Qgs3DTypes::CullingMode cullingMode() const { return mCullingMode; }
113 void setCullingMode( Qgs3DTypes::CullingMode mode ) { mCullingMode = mode; }
114
116 bool invertNormals() const { return mInvertNormals; }
118 void setInvertNormals( bool invert ) { mInvertNormals = invert; }
119
124 bool addBackFaces() const { return mAddBackFaces; }
125
130 void setAddBackFaces( bool add ) { mAddBackFaces = add; }
131
136 bool edgesEnabled() const { return mEdgesEnabled; }
137
142 void setEdgesEnabled( bool enabled ) { mEdgesEnabled = enabled; }
143
148 float edgeWidth() const { return mEdgeWidth; }
149
154 void setEdgeWidth( float width ) { mEdgeWidth = width; }
155
160 QColor edgeColor() const { return mEdgeColor; }
161
166 void setEdgeColor( const QColor &color ) { mEdgeColor = color; }
167
172 void setRenderedFacade( int side ) { mRenderedFacade = side; }
173
178 int renderedFacade() const { return mRenderedFacade; }
179
185 bool exportGeometries( Qgs3DSceneExporter *exporter, Qt3DCore::QEntity *entity, const QString &objectNamePrefix ) const override SIP_SKIP;
186
187 private:
192
193 float mOffset = 0.0f;
194 float mExtrusionHeight = 0.0f;
195 std::unique_ptr< QgsAbstractMaterialSettings > mMaterialSettings;
197 bool mInvertNormals = false;
198 bool mAddBackFaces = false;
199 int mRenderedFacade = 3;
200
201 bool mEdgesEnabled = false;
202 float mEdgeWidth = 1.f;
203 QColor mEdgeColor = Qt::black;
204};
205
206
207#endif // QGSPOLYGON3DSYMBOL_H
The Qgis class provides global constants for use throughout the application.
Definition qgis.h:54
AltitudeClamping
Altitude clamping.
Definition qgis.h:3671
@ Relative
Elevation is relative to terrain height (final elevation = terrain elevation + feature elevation)
AltitudeBinding
Altitude binding.
Definition qgis.h:3684
@ 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