QGIS API Documentation 3.41.0-Master (3440c17df1d)
Loading...
Searching...
No Matches
qgsmesh3dsymbol.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsmesh3dsymbol.h
3 -----------------
4 Date : January 2019
5 Copyright : (C) 2019 by Peter Petrik
6 Email : zilolv 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 QGSMESH3DSYMBOL_H
17#define QGSMESH3DSYMBOL_H
18
19#include "qgis_3d.h"
20
21#include "qgsabstract3dsymbol.h"
22#include "qgs3dtypes.h"
23#include "qgscolorrampshader.h"
24#include "qgsmeshdataprovider.h"
25
26#include <Qt3DRender/QCullFace>
27
29
30#define SIP_NO_FILE
31
43class _3D_EXPORT QgsMesh3DSymbol : public QgsAbstract3DSymbol
44{
45 public:
46
53 {
55 SingleColor = 0,
59 ColorRamp2DRendering
60 };
61
68 {
70 VerticesZValue = 0,
72 ScalarDatasetZvalue
73 };
74
77 ~QgsMesh3DSymbol() override;
78
79 QString type() const override { return "mesh"; }
80 QgsMesh3DSymbol *clone() const override SIP_FACTORY;
81
82 void writeXml( QDomElement &elem, const QgsReadWriteContext &context ) const override;
83 void readXml( const QDomElement &elem, const QgsReadWriteContext &context ) override;
84
90 bool isEnabled() const;
91
97 void setEnabled( bool enabled );
98
104 Qgs3DTypes::CullingMode cullingMode() const;
105
111 void setCullingMode( const Qgs3DTypes::CullingMode &mode );
112
114 Qgis::AltitudeClamping altitudeClamping() const { return mAltClamping; }
116 void setAltitudeClamping( Qgis::AltitudeClamping altClamping ) { mAltClamping = altClamping; }
117
119 float height() const { return mHeight; }
121 void setHeight( float height ) { mHeight = height; }
122
124 QgsAbstractMaterialSettings *materialSettings() const;
125
131 void setMaterialSettings( QgsAbstractMaterialSettings *materialSettings SIP_TRANSFER );
132
136 bool addBackFaces() const { return mAddBackFaces; }
137
141 void setAddBackFaces( bool add ) { mAddBackFaces = add; }
142
148 bool smoothedTriangles() const;
149
155 void setSmoothedTriangles( bool smoothTriangles );
156
162 bool wireframeEnabled() const;
163
169 void setWireframeEnabled( bool wireframeEnabled );
170
176 double wireframeLineWidth() const;
177
183 void setWireframeLineWidth( double wireframeLineWidth );
184
190 QColor wireframeLineColor() const;
191
197 void setWireframeLineColor( const QColor &wireframeLineColor );
198
204 double verticalScale() const;
205
211 void setVerticalScale( double verticalScale );
212
218 QgsColorRampShader colorRampShader() const;
219
225 void setColorRampShader( const QgsColorRampShader &colorRampShader );
226
232 QColor singleMeshColor() const;
233
239 void setSingleMeshColor( const QColor &singleMeshColor );
240
246 QgsMesh3DSymbol::RenderingStyle renderingStyle() const;
247
253 void setRenderingStyle( const QgsMesh3DSymbol::RenderingStyle &textureType );
254
260 int verticalDatasetGroupIndex() const;
261
267 void setVerticalDatasetGroupIndex( int verticalDatasetGroupIndex );
268
274 bool isVerticalMagnitudeRelative() const;
275
281 void setIsVerticalMagnitudeRelative( bool isVerticalMagnitudeRelative );
282
288 bool arrowsEnabled() const;
289
295 void setArrowsEnabled( bool arrowsEnabled );
296
302 double arrowsSpacing() const;
303
309 void setArrowsSpacing( double arrowsSpacing );
310
318 int maximumTextureSize() const;
319
327 void setMaximumTextureSize( int maximumTextureSize );
328
334 bool arrowsFixedSize() const;
335
341 void setArrowsFixedSize( bool arrowsFixedSize );
342
349 int levelOfDetailIndex() const;
350
357 void setLevelOfDetailIndex( int lod );
358
359 private:
360
363 float mHeight = 0.0f;
364 std::unique_ptr< QgsAbstractMaterialSettings > mMaterialSettings;
365 bool mAddBackFaces = false;
366
367 bool mEnabled = true;
368
370
372 bool mSmoothedTriangles = false;
373 bool mWireframeEnabled = false;
374 double mWireframeLineWidth = 1.0;
375 QColor mWireframeLineColor = Qt::darkGray;
376 int mLevelOfDetailIndex = 0;
377
379 double mVerticalScale = 1.0;
380 int mVerticalDatasetGroupIndex = -1;
381 bool mIsVerticalMagnitudeRelative = false;
382
385 QgsColorRampShader mColorRampShader;
386 QColor mSingleColor = Qt::darkGreen;
387
389 bool mArrowsEnabled = false;
390 double mArrowsSpacing = 25;
391 bool mArrowsFixedSize = false;
392 QColor mArrowsColor = Qt::yellow;
393 int mMaximumTextureSize = 1024;
394};
395
396#endif // QGSMESH3DSYMBOL_H
The Qgis class provides global constants for use throughout the application.
Definition qgis.h:54
AltitudeClamping
Altitude clamping.
Definition qgis.h:3699
@ Relative
Elevation is relative to terrain height (final elevation = terrain elevation + feature elevation)
CullingMode
Triangle culling mode.
Definition qgs3dtypes.h:36
@ NoCulling
Will render both front and back faces of triangles.
Definition qgs3dtypes.h:37
virtual QgsAbstract3DSymbol * clone() const =0
Returns a new instance of the symbol with the same settings.
A ramp shader will color a raster pixel based on a list of values ranges in a ramp.
ZValueType
How to render the Z value of the mesh.
void setAddBackFaces(bool add)
Sets whether also triangles facing the other side will be created.
QString type() const override
Returns identifier of symbol type. Each 3D symbol implementation should return a different type.
void setHeight(float height)
Sets height (altitude) of the symbol (in map units)
bool addBackFaces() const
Returns whether also triangles facing the other side will be created.
void setAltitudeClamping(Qgis::AltitudeClamping altClamping)
Sets method that determines altitude (whether to clamp to feature to terrain)
float height() const
Returns height (altitude) of the symbol (in map units)
~QgsMesh3DSymbol() override
RenderingStyle
How to render the color of the mesh.
@ ColorRamp
Render the mesh with a color ramp.
@ SingleColor
Render the mesh with a single color.
The class is used as a container of context for various read/write operations on other objects.
#define SIP_TRANSFER
Definition qgis_sip.h:36
#define SIP_FACTORY
Definition qgis_sip.h:76