QGIS API Documentation 3.99.0-Master (21b3aa880ba)
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#include "qgs3dtypes.h"
21#include "qgsabstract3dsymbol.h"
22
23#include <Qt3DRender/QCullFace>
24
26
36{
37 public:
40
41 QString type() const override { return "polygon"; }
42 QgsAbstract3DSymbol *clone() const override SIP_FACTORY;
43
44 void writeXml( QDomElement &elem, const QgsReadWriteContext &context ) const override;
45 void readXml( const QDomElement &elem, const QgsReadWriteContext &context ) override;
46 QList<Qgis::GeometryType> compatibleGeometryTypes() const override;
47 void setDefaultPropertiesFromLayer( const QgsVectorLayer *layer ) override;
48
54 static QgsAbstract3DSymbol *create() SIP_FACTORY;
55
57 Qgis::AltitudeClamping altitudeClamping() const { return mAltClamping; }
59 void setAltitudeClamping( Qgis::AltitudeClamping altClamping ) { mAltClamping = altClamping; }
60
62 Qgis::AltitudeBinding altitudeBinding() const { return mAltBinding; }
64 void setAltitudeBinding( Qgis::AltitudeBinding altBinding ) { mAltBinding = altBinding; }
65
71 Q_DECL_DEPRECATED float height() const SIP_DEPRECATED { return mOffset; }
72
78 Q_DECL_DEPRECATED void setHeight( float height ) SIP_DEPRECATED { mOffset = height; }
79
85 float offset() const { return mOffset; }
86
92 void setOffset( float offset ) { mOffset = offset; }
93
95 float extrusionHeight() const { return mExtrusionHeight; }
97 void setExtrusionHeight( float extrusionHeight ) { mExtrusionHeight = extrusionHeight; }
98
100 QgsAbstractMaterialSettings *materialSettings() const;
101
107 void setMaterialSettings( QgsAbstractMaterialSettings *materialSettings SIP_TRANSFER );
108
110 Qgs3DTypes::CullingMode cullingMode() const { return mCullingMode; }
112 void setCullingMode( Qgs3DTypes::CullingMode mode ) { mCullingMode = mode; }
113
115 bool invertNormals() const { return mInvertNormals; }
117 void setInvertNormals( bool invert ) { mInvertNormals = invert; }
118
123 bool addBackFaces() const { return mAddBackFaces; }
124
129 void setAddBackFaces( bool add ) { mAddBackFaces = add; }
130
135 bool edgesEnabled() const { return mEdgesEnabled; }
136
141 void setEdgesEnabled( bool enabled ) { mEdgesEnabled = enabled; }
142
147 float edgeWidth() const { return mEdgeWidth; }
148
153 void setEdgeWidth( float width ) { mEdgeWidth = width; }
154
159 QColor edgeColor() const { return mEdgeColor; }
160
165 void setEdgeColor( const QColor &color ) { mEdgeColor = color; }
166
172 Q_DECL_DEPRECATED void setRenderedFacade( int side ) SIP_DEPRECATED;
173
178 void setExtrusionFaces( Qgis::ExtrusionFaces side ) { mExtrusionFaces = side; }
179
185 Q_DECL_DEPRECATED int renderedFacade() SIP_DEPRECATED;
186
191 Qgis::ExtrusionFaces extrusionFaces() const { return mExtrusionFaces; }
192
198 bool exportGeometries( Qgs3DSceneExporter *exporter, Qt3DCore::QEntity *entity, const QString &objectNamePrefix ) const override SIP_SKIP;
199
200 private:
205
206 float mOffset = 0.0f;
207 float mExtrusionHeight = 0.0f;
208 std::unique_ptr<QgsAbstractMaterialSettings> mMaterialSettings;
210 bool mInvertNormals = false;
211 bool mAddBackFaces = false;
213
214 bool mEdgesEnabled = false;
215 float mEdgeWidth = 1.f;
216 QColor mEdgeColor = Qt::black;
217};
218
219
220#endif // QGSPOLYGON3DSYMBOL_H
Provides global constants and enumerations for use throughout the application.
Definition qgis.h:56
AltitudeClamping
Altitude clamping.
Definition qgis.h:3982
@ Absolute
Elevation is taken directly from feature and is independent of terrain height (final elevation = feat...
Definition qgis.h:3983
QFlags< ExtrusionFace > ExtrusionFaces
Tessellator extrusion face types.
Definition qgis.h:6168
AltitudeBinding
Altitude binding.
Definition qgis.h:3995
@ Centroid
Clamp just centroid of feature.
Definition qgis.h:3997
Entity that handles the exporting of 3D scenes.
CullingMode
Triangle culling mode.
Definition qgs3dtypes.h:35
@ NoCulling
Will render both front and back faces of triangles.
Definition qgs3dtypes.h:36
Abstract base class for 3D symbols that are used by VectorLayer3DRenderer objects.
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.
Abstract base class for material 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...
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.
Qgis::ExtrusionFaces extrusionFaces() const
Returns the building extrusion sides to be rendered.
float offset() const
Returns vertical offset of the symbol (in map units).
Qgis::AltitudeClamping altitudeClamping() const
Returns method that determines altitude (whether to clamp to feature to terrain).
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.
void setExtrusionFaces(Qgis::ExtrusionFaces side)
Sets the building extrusion sides to be rendered.
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).
A container for the context for various read/write operations on objects.
Represents a vector layer which manages a vector based dataset.
#define SIP_DEPRECATED
Definition qgis_sip.h:114
#define SIP_SKIP
Definition qgis_sip.h:134
#define SIP_TRANSFER
Definition qgis_sip.h:36
#define SIP_FACTORY
Definition qgis_sip.h:84
#define SIP_NODEFAULTCTORS
Definition qgis_sip.h:109