QGIS API Documentation 3.99.0-Master (2fe06baccd8)
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#include "qgs3dtypes.h"
21#include "qgsabstract3dsymbol.h"
22#include "qgscolorrampshader.h"
23
24#include <Qt3DRender/QCullFace>
25
27
37class _3D_EXPORT QgsMesh3DSymbol : public QgsAbstract3DSymbol
38{
39 public:
45 enum class RenderingStyle : int
46 {
47 SingleColor = 0,
48 ColorRamp,
49 ColorRamp2DRendering,
50 };
51
57 enum class ZValueType : int
58 {
59 VerticesZValue = 0,
60 ScalarDatasetZvalue,
61 };
62
65 ~QgsMesh3DSymbol() override;
66
67 QString type() const override { return "mesh"; }
68 QgsMesh3DSymbol *clone() const override SIP_FACTORY;
69
70 void writeXml( QDomElement &elem, const QgsReadWriteContext &context ) const override;
71 void readXml( const QDomElement &elem, const QgsReadWriteContext &context ) override;
72
78 bool isEnabled() const;
79
85 void setEnabled( bool enabled );
86
92 Qgs3DTypes::CullingMode cullingMode() const;
93
99 void setCullingMode( const Qgs3DTypes::CullingMode &mode );
100
102 Qgis::AltitudeClamping altitudeClamping() const { return mAltClamping; }
104 void setAltitudeClamping( Qgis::AltitudeClamping altClamping ) { mAltClamping = altClamping; }
105
107 float height() const { return mHeight; }
109 void setHeight( float height ) { mHeight = height; }
110
112 QgsAbstractMaterialSettings *materialSettings() const;
113
119 void setMaterialSettings( QgsAbstractMaterialSettings *materialSettings SIP_TRANSFER );
120
124 bool addBackFaces() const { return mAddBackFaces; }
125
129 void setAddBackFaces( bool add ) { mAddBackFaces = add; }
130
136 bool smoothedTriangles() const;
137
143 void setSmoothedTriangles( bool smoothTriangles );
144
150 bool wireframeEnabled() const;
151
157 void setWireframeEnabled( bool wireframeEnabled );
158
164 double wireframeLineWidth() const;
165
171 void setWireframeLineWidth( double wireframeLineWidth );
172
178 QColor wireframeLineColor() const;
179
185 void setWireframeLineColor( const QColor &wireframeLineColor );
186
192 double verticalScale() const;
193
199 void setVerticalScale( double verticalScale );
200
206 QgsColorRampShader colorRampShader() const;
207
213 void setColorRampShader( const QgsColorRampShader &colorRampShader );
214
220 QColor singleMeshColor() const;
221
227 void setSingleMeshColor( const QColor &singleMeshColor );
228
234 QgsMesh3DSymbol::RenderingStyle renderingStyle() const;
235
241 void setRenderingStyle( const QgsMesh3DSymbol::RenderingStyle &textureType );
242
248 int verticalDatasetGroupIndex() const;
249
255 void setVerticalDatasetGroupIndex( int verticalDatasetGroupIndex );
256
262 bool isVerticalMagnitudeRelative() const;
263
269 void setIsVerticalMagnitudeRelative( bool isVerticalMagnitudeRelative );
270
276 bool arrowsEnabled() const;
277
283 void setArrowsEnabled( bool arrowsEnabled );
284
290 double arrowsSpacing() const;
291
297 void setArrowsSpacing( double arrowsSpacing );
298
306 int maximumTextureSize() const;
307
315 void setMaximumTextureSize( int maximumTextureSize );
316
322 bool arrowsFixedSize() const;
323
329 void setArrowsFixedSize( bool arrowsFixedSize );
330
337 int levelOfDetailIndex() const;
338
345 void setLevelOfDetailIndex( int lod );
346
347 bool operator==( const QgsMesh3DSymbol &other ) const;
348 bool operator!=( const QgsMesh3DSymbol &other ) const;
349
350 private:
351#ifdef SIP_RUN
353#endif
354
357 float mHeight = 0.0f;
358 std::unique_ptr<QgsAbstractMaterialSettings> mMaterialSettings;
359 bool mAddBackFaces = false;
360
361 bool mEnabled = true;
362
364
366 bool mSmoothedTriangles = false;
367 bool mWireframeEnabled = false;
368 double mWireframeLineWidth = 1.0;
369 QColor mWireframeLineColor = Qt::darkGray;
370 int mLevelOfDetailIndex = 0;
371
373 double mVerticalScale = 1.0;
374 int mVerticalDatasetGroupIndex = -1;
375 bool mIsVerticalMagnitudeRelative = false;
376
379 QgsColorRampShader mColorRampShader;
380 QColor mSingleColor = Qt::darkGreen;
381
383 bool mArrowsEnabled = false;
384 double mArrowsSpacing = 25;
385 bool mArrowsFixedSize = false;
386 QColor mArrowsColor = Qt::yellow;
387 int mMaximumTextureSize = 1024;
388};
389
390#endif // QGSMESH3DSYMBOL_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
Defines enumerations and other auxiliary types for QGIS 3D.
Definition qgs3dtypes.h:31
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 QgsAbstract3DSymbol * clone() const =0
Returns a new instance of the symbol with the same settings.
Abstract base class for material settings.
A ramp shader will color a raster pixel based on a list of values ranges in a ramp.
3D symbol that draws mesh geometry as planar triangles.
void setAddBackFaces(bool add)
Sets whether also triangles facing the other side will be created.
QgsMesh3DSymbol()
Constructor for QgsMesh3DSymbol.
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).
Qgis::AltitudeClamping altitudeClamping() const
Returns method that determines altitude (whether to clamp to feature to terrain).
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
A container for the context for various read/write operations on objects.
#define SIP_TRANSFER
Definition qgis_sip.h:36
#define SIP_FACTORY
Definition qgis_sip.h:84
bool operator==(const QgsFeatureIterator &fi1, const QgsFeatureIterator &fi2)
bool operator!=(const QgsFeatureIterator &fi1, const QgsFeatureIterator &fi2)