QGIS API Documentation 4.3.0-Master (6313fb5bce0)
Loading...
Searching...
No Matches
qgsmeshrenderersettings.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsmeshrenderersettings.h
3 -------------------------
4 begin : May 2018
5 copyright : (C) 2018 by Peter Petrik
6 email : zilolv at gmail dot com
7 ***************************************************************************/
8
9/***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
17
18#ifndef QGSMESHRENDERERSETTINGS_H
19#define QGSMESHRENDERERSETTINGS_H
20
21#include "qgis.h"
22#include "qgis_core.h"
23#include "qgscolorrampshader.h"
25#include "qgsmesh3daveraging.h"
27
28#include <QColor>
29#include <QDomElement>
30
41{
42 public:
44 bool isEnabled() const;
46 void setEnabled( bool enabled );
47
49 double lineWidth() const;
51 void setLineWidth( double lineWidth );
52
54 QColor color() const;
56 void setColor( const QColor &color );
57
64
71
73 QDomElement writeXml( QDomDocument &doc ) const;
75 void readXml( const QDomElement &elem );
76
77 private:
78 bool mEnabled = false;
79 double mLineWidth = Qgis::DEFAULT_LINE_WIDTH;
81 QColor mColor = Qt::black;
82};
83
94{
95 public:
116
118 QgsColorRampShader colorRampShader() const;
120 void setColorRampShader( const QgsColorRampShader &shader );
121
123 double classificationMinimum() const;
125 double classificationMaximum() const;
127 void setClassificationMinimumMaximum( double minimum, double maximum );
128
130 double opacity() const;
132 void setOpacity( double opacity );
133
141 DataResamplingMethod dataResamplingMethod() const;
142
148 void setDataResamplingMethod( const DataResamplingMethod &dataResamplingMethod );
149
155 QgsInterpolatedLineWidth edgeStrokeWidth() const;
156
162 void setEdgeStrokeWidth( const QgsInterpolatedLineWidth &strokeWidth );
163
169 Qgis::RenderUnit edgeStrokeWidthUnit() const;
170
176 void setEdgeStrokeWidthUnit( Qgis::RenderUnit edgeStrokeWidthUnit );
177
183 void setLimits( Qgis::MeshRangeLimit limits ) { mRangeLimit = limits; }
184
190 Qgis::MeshRangeLimit limits() const { return mRangeLimit; }
191
197 void setExtent( Qgis::MeshRangeExtent extent ) { mRangeExtent = extent; }
198
204 Qgis::MeshRangeExtent extent() const { return mRangeExtent; }
205
207 QDomElement writeXml( QDomDocument &doc, const QgsReadWriteContext &context = QgsReadWriteContext() ) const;
209 void readXml( const QDomElement &elem, const QgsReadWriteContext &context = QgsReadWriteContext() );
210
211 private:
212 void updateShader();
213
214 QgsColorRampShader mColorRampShader;
215 DataResamplingMethod mDataResamplingMethod = DataResamplingMethod::NoResampling;
216 double mClassificationMinimum = 0;
217 double mClassificationMaximum = 0;
218 double mOpacity = 1;
219
220 QgsInterpolatedLineWidth mEdgeStrokeWidth;
221 Qgis::RenderUnit mEdgeStrokeWidthUnit = Qgis::RenderUnit::Millimeters;
222
225};
226
238{
239 // exists for backwards compatibility only
240};
241
253{
254 // exists for backwards compatibility only
255};
256
268{
269 // exists for backwards compatibility only
270};
271
283{
284 // exists for backwards compatibility only
285};
286
298{
299 // exists for backwards compatibility only
300};
301
311class CORE_EXPORT QgsMeshRendererSettings
312{
313 public:
320
323
325
327 QgsMeshRendererMeshSettings nativeMeshSettings() const { return mRendererNativeMeshSettings; }
329 void setNativeMeshSettings( const QgsMeshRendererMeshSettings &settings ) { mRendererNativeMeshSettings = settings; }
330
332 QgsMeshRendererMeshSettings triangularMeshSettings() const { return mRendererTriangularMeshSettings; }
334 void setTriangularMeshSettings( const QgsMeshRendererMeshSettings &settings ) { mRendererTriangularMeshSettings = settings; }
335
340 QgsMeshRendererMeshSettings edgeMeshSettings() const { return mRendererEdgeMeshSettings; }
341
346 void setEdgeMeshSettings( const QgsMeshRendererMeshSettings &settings ) { mRendererEdgeMeshSettings = settings; }
347
349 QgsMeshRendererScalarSettings scalarSettings( int groupIndex ) const { return mRendererScalarSettings.value( groupIndex ); }
350
352 void setScalarSettings( int groupIndex, const QgsMeshRendererScalarSettings &settings ) { mRendererScalarSettings[groupIndex] = settings; }
353
358 bool hasScalarSettings( int groupIndex ) const { return mRendererScalarSettings.contains( groupIndex ); }
359
364 bool removeScalarSettings( int groupIndex ) { return mRendererScalarSettings.remove( groupIndex ); }
365
367 QgsVectorFieldSettings vectorSettings( int groupIndex ) const { return mRendererVectorSettings.value( groupIndex ); }
369 void setVectorSettings( int groupIndex, const QgsVectorFieldSettings &settings ) { mRendererVectorSettings[groupIndex] = settings; }
370
375 bool hasVectorSettings( int groupIndex ) const { return mRendererVectorSettings.contains( groupIndex ); }
376
381 bool removeVectorSettings( int groupIndex ) { return mRendererVectorSettings.remove( groupIndex ); }
382
388 QgsMesh3DAveragingMethod *averagingMethod() const;
389
395 void setAveragingMethod( QgsMesh3DAveragingMethod *method );
396
398 QDomElement writeXml( QDomDocument &doc, const QgsReadWriteContext &context = QgsReadWriteContext() ) const;
400 void readXml( const QDomElement &elem, const QgsReadWriteContext &context = QgsReadWriteContext() );
401
406 int activeScalarDatasetGroup() const;
407
412 void setActiveScalarDatasetGroup( int activeScalarDatasetGroup );
413
418 int activeVectorDatasetGroup() const;
419
424 void setActiveVectorDatasetGroup( int activeVectorDatasetGroup );
425
431 bool hasSettings( int datasetGroupIndex ) const;
432
433 private:
434 QgsMeshRendererMeshSettings mRendererNativeMeshSettings;
435 QgsMeshRendererMeshSettings mRendererTriangularMeshSettings;
436 QgsMeshRendererMeshSettings mRendererEdgeMeshSettings;
437
438 QHash<int, QgsMeshRendererScalarSettings> mRendererScalarSettings;
439 QHash<int, QgsVectorFieldSettings> mRendererVectorSettings;
440
442 int mActiveScalarDatasetGroup = -1;
443
445 int mActiveVectorDatasetGroup = -1;
446
448 std::shared_ptr<QgsMesh3DAveragingMethod> mAveragingMethod;
449};
450
451#endif //QGSMESHRENDERERSETTINGS_H
static const double DEFAULT_LINE_WIDTH
The default width (in millimeters) for line symbols.
Definition qgis.h:7241
MeshRangeLimit
Describes the limits used to compute mesh ranges (min/max values).
Definition qgis.h:6845
@ NotSet
User defined.
Definition qgis.h:6846
MeshRangeExtent
Describes the extent used to compute mesh ranges (min/max values).
Definition qgis.h:6857
@ WholeMesh
Whole mesh is used to compute statistics.
Definition qgis.h:6858
RenderUnit
Rendering size units.
Definition qgis.h:5704
@ Millimeters
Millimeters.
Definition qgis.h:5705
A ramp shader will color a raster pixel based on a list of values ranges in a ramp.
Represents a width that can vary depending on values.
Abstract class for interpolating 3d stacked mesh data to 2d data.
Represents a mesh renderer settings for mesh objects.
void setLineWidthUnit(Qgis::RenderUnit lineWidthUnit)
Sets units of the width of the mesh frame.
void setEnabled(bool enabled)
Sets whether mesh structure rendering is enabled.
QColor color() const
Returns color used for rendering.
QDomElement writeXml(QDomDocument &doc) const
Writes configuration to a new DOM element.
double lineWidth() const
Returns line width used for rendering (in millimeters).
void setLineWidth(double lineWidth)
Sets line width used for rendering (in millimeters).
void readXml(const QDomElement &elem)
Reads configuration from the given DOM element.
Qgis::RenderUnit lineWidthUnit() const
Returns units of the width of the mesh frame.
bool isEnabled() const
Returns whether mesh structure rendering is enabled.
void setColor(const QColor &color)
Sets color used for rendering of the mesh.
Represents a mesh renderer settings for scalar datasets.
Qgis::MeshRangeExtent extent() const
Returns the mesh extent for minimum maximum calculation.
Qgis::MeshRangeLimit limits() const
Returns the range limits type for minimum maximum calculation.
void setExtent(Qgis::MeshRangeExtent extent)
Sets the mesh extent for minimum maximum calculation.
DataResamplingMethod
Resampling of value from dataset.
@ NoResampling
Does not use resampling.
@ NeighbourAverage
Does a simple average of values defined for all surrounding faces/vertices.
void setLimits(Qgis::MeshRangeLimit limits)
Sets the range limits type for minimum maximum calculation.
QgsMeshRendererScalarSettings scalarSettings(int groupIndex) const
Returns renderer settings.
bool hasVectorSettings(int groupIndex) const
Returns whether groupIndex has existing vector settings.
void setEdgeMeshSettings(const QgsMeshRendererMeshSettings &settings)
Sets new edge mesh renderer settings.
bool removeVectorSettings(int groupIndex)
Removes vector settings for groupIndex.
QgsMeshRendererSettings()
Constructs renderer with default single layer averaging method.
void setTriangularMeshSettings(const QgsMeshRendererMeshSettings &settings)
Sets new triangular mesh renderer settings.
QgsMeshRendererMeshSettings edgeMeshSettings() const
Returns edge mesh renderer settings.
QgsMeshRendererMeshSettings nativeMeshSettings() const
Returns native mesh renderer settings.
bool hasScalarSettings(int groupIndex) const
Returns whether groupIndex has existing scalar settings.
bool removeScalarSettings(int groupIndex)
Removes scalar settings with groupIndex.
void setScalarSettings(int groupIndex, const QgsMeshRendererScalarSettings &settings)
Sets new renderer settings.
QgsMeshRendererMeshSettings triangularMeshSettings() const
Returns triangular mesh renderer settings.
void setVectorSettings(int groupIndex, const QgsVectorFieldSettings &settings)
Sets new renderer settings.
QgsVectorFieldSettings vectorSettings(int groupIndex) const
Returns renderer settings.
QgsMeshRendererSettings & operator=(const QgsMeshRendererSettings &other)
void setNativeMeshSettings(const QgsMeshRendererMeshSettings &settings)
Sets new native mesh renderer settings, triggers repaint.
Represents a mesh renderer settings for vector datasets displayed with arrows.
Represents a renderer settings for vector datasets.
Represents a streamline renderer settings for vector datasets displayed by streamlines.
Represents a trace renderer settings for vector datasets displayed by particle traces.
Represents a mesh renderer settings for vector datasets displayed with wind barbs.
A container for the context for various read/write operations on objects.
Represents a mesh renderer settings for vector datasets displayed with arrows.
Represents a renderer settings for vector datasets.
Represents a streamline renderer settings for vector datasets displayed by streamlines.
Represents a trace renderer settings for vector datasets displayed by particle traces.
Represents a mesh renderer settings for vector datasets displayed with wind barbs.
#define SIP_SKIP
Definition qgis_sip.h:138