QGIS API Documentation 3.41.0-Master (cea29feecf2)
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
25#include <Qt3DRender/QCullFace>
26
28
38class _3D_EXPORT QgsMesh3DSymbol : public QgsAbstract3DSymbol
39{
40 public:
46 enum class RenderingStyle : int
47 {
48 SingleColor = 0,
49 ColorRamp,
50 ColorRamp2DRendering,
51 };
52
58 enum class ZValueType : int
59 {
60 VerticesZValue = 0,
61 ScalarDatasetZvalue,
62 };
63
66 ~QgsMesh3DSymbol() override;
67
68 QString type() const override { return "mesh"; }
69 QgsMesh3DSymbol *clone() const override SIP_FACTORY;
70
71 void writeXml( QDomElement &elem, const QgsReadWriteContext &context ) const override;
72 void readXml( const QDomElement &elem, const QgsReadWriteContext &context ) override;
73
79 bool isEnabled() const;
80
86 void setEnabled( bool enabled );
87
93 Qgs3DTypes::CullingMode cullingMode() const;
94
100 void setCullingMode( const Qgs3DTypes::CullingMode &mode );
101
103 Qgis::AltitudeClamping altitudeClamping() const { return mAltClamping; }
105 void setAltitudeClamping( Qgis::AltitudeClamping altClamping ) { mAltClamping = altClamping; }
106
108 float height() const { return mHeight; }
110 void setHeight( float height ) { mHeight = height; }
111
113 QgsAbstractMaterialSettings *materialSettings() const;
114
120 void setMaterialSettings( QgsAbstractMaterialSettings *materialSettings SIP_TRANSFER );
121
125 bool addBackFaces() const { return mAddBackFaces; }
126
130 void setAddBackFaces( bool add ) { mAddBackFaces = add; }
131
137 bool smoothedTriangles() const;
138
144 void setSmoothedTriangles( bool smoothTriangles );
145
151 bool wireframeEnabled() const;
152
158 void setWireframeEnabled( bool wireframeEnabled );
159
165 double wireframeLineWidth() const;
166
172 void setWireframeLineWidth( double wireframeLineWidth );
173
179 QColor wireframeLineColor() const;
180
186 void setWireframeLineColor( const QColor &wireframeLineColor );
187
193 double verticalScale() const;
194
200 void setVerticalScale( double verticalScale );
201
207 QgsColorRampShader colorRampShader() const;
208
214 void setColorRampShader( const QgsColorRampShader &colorRampShader );
215
221 QColor singleMeshColor() const;
222
228 void setSingleMeshColor( const QColor &singleMeshColor );
229
235 QgsMesh3DSymbol::RenderingStyle renderingStyle() const;
236
242 void setRenderingStyle( const QgsMesh3DSymbol::RenderingStyle &textureType );
243
249 int verticalDatasetGroupIndex() const;
250
256 void setVerticalDatasetGroupIndex( int verticalDatasetGroupIndex );
257
263 bool isVerticalMagnitudeRelative() const;
264
270 void setIsVerticalMagnitudeRelative( bool isVerticalMagnitudeRelative );
271
277 bool arrowsEnabled() const;
278
284 void setArrowsEnabled( bool arrowsEnabled );
285
291 double arrowsSpacing() const;
292
298 void setArrowsSpacing( double arrowsSpacing );
299
307 int maximumTextureSize() const;
308
316 void setMaximumTextureSize( int maximumTextureSize );
317
323 bool arrowsFixedSize() const;
324
330 void setArrowsFixedSize( bool arrowsFixedSize );
331
338 int levelOfDetailIndex() const;
339
346 void setLevelOfDetailIndex( int lod );
347
348 bool operator==( const QgsMesh3DSymbol &other ) const;
349 bool operator!=( const QgsMesh3DSymbol &other ) const;
350
351 private:
352#ifdef SIP_RUN
354#endif
355
358 float mHeight = 0.0f;
359 std::unique_ptr<QgsAbstractMaterialSettings> mMaterialSettings;
360 bool mAddBackFaces = false;
361
362 bool mEnabled = true;
363
365
367 bool mSmoothedTriangles = false;
368 bool mWireframeEnabled = false;
369 double mWireframeLineWidth = 1.0;
370 QColor mWireframeLineColor = Qt::darkGray;
371 int mLevelOfDetailIndex = 0;
372
374 double mVerticalScale = 1.0;
375 int mVerticalDatasetGroupIndex = -1;
376 bool mIsVerticalMagnitudeRelative = false;
377
380 QgsColorRampShader mColorRampShader;
381 QColor mSingleColor = Qt::darkGreen;
382
384 bool mArrowsEnabled = false;
385 double mArrowsSpacing = 25;
386 bool mArrowsFixedSize = false;
387 QColor mArrowsColor = Qt::yellow;
388 int mMaximumTextureSize = 1024;
389};
390
391#endif // QGSMESH3DSYMBOL_H
The Qgis class provides global constants for use throughout the application.
Definition qgis.h:54
AltitudeClamping
Altitude clamping.
Definition qgis.h:3744
@ Relative
Elevation is relative to terrain height (final elevation = terrain elevation + feature elevation)
CullingMode
Triangle culling mode.
Definition qgs3dtypes.h:35
@ NoCulling
Will render both front and back faces of triangles.
Definition qgs3dtypes.h:36
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.
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)
ZValueType
How to render the Z value of the mesh.
RenderingStyle
How to render the color of the mesh.
@ SingleColor
Render the mesh with a single color.
~QgsMesh3DSymbol() override
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
bool operator==(const QgsFeatureIterator &fi1, const QgsFeatureIterator &fi2)
bool operator!=(const QgsFeatureIterator &fi1, const QgsFeatureIterator &fi2)