26using namespace Qt::StringLiterals;
60 return mLineWidthUnit;
70 QDomElement elem = doc.createElement( u
"mesh-settings"_s );
71 elem.setAttribute( u
"enabled"_s, mEnabled ? u
"1"_s : u
"0"_s );
72 elem.setAttribute( u
"line-width"_s, mLineWidth );
80 mEnabled = elem.attribute( u
"enabled"_s ).toInt();
81 mLineWidth = elem.attribute( u
"line-width"_s ).toDouble();
89 return mColorRampShader;
94 mColorRampShader = shader;
99 return mClassificationMinimum;
104 return mClassificationMaximum;
109 mClassificationMinimum = minimum;
110 mClassificationMaximum = maximum;
126 return mDataResamplingMethod;
131 mDataResamplingMethod = dataInterpolationMethod;
136 QDomElement elem = doc.createElement( u
"scalar-settings"_s );
137 elem.setAttribute( u
"min-val"_s, mClassificationMinimum );
138 elem.setAttribute( u
"max-val"_s, mClassificationMaximum );
139 elem.setAttribute( u
"opacity"_s, mOpacity );
142 switch ( mDataResamplingMethod )
145 methodTxt = u
"no-resampling"_s;
148 methodTxt = u
"neighbour-average"_s;
151 elem.setAttribute( u
"interpolation-method"_s, methodTxt );
158 const QDomElement elemShader = mColorRampShader.writeXml( doc, context );
159 elem.appendChild( elemShader );
161 QDomElement elemEdge = doc.createElement( u
"edge-settings"_s );
162 elemEdge.appendChild( mEdgeStrokeWidth.writeXml( doc, context ) );
163 elemEdge.setAttribute( u
"stroke-width-unit"_s,
static_cast< int >( mEdgeStrokeWidthUnit ) );
164 elem.appendChild( elemEdge );
171 mClassificationMinimum = elem.attribute( u
"min-val"_s ).toDouble();
172 mClassificationMaximum = elem.attribute( u
"max-val"_s ).toDouble();
173 mOpacity = elem.attribute( u
"opacity"_s ).toDouble();
175 const QString methodTxt = elem.attribute( u
"interpolation-method"_s );
176 if ( u
"neighbour-average"_s == methodTxt )
188 const QDomElement elemShader = elem.firstChildElement( u
"colorrampshader"_s );
189 mColorRampShader.readXml( elemShader, context );
191 const QDomElement elemEdge = elem.firstChildElement( u
"edge-settings"_s );
192 const QDomElement elemEdgeStrokeWidth = elemEdge.firstChildElement( u
"mesh-stroke-width"_s );
193 mEdgeStrokeWidth.readXml( elemEdgeStrokeWidth, context );
194 mEdgeStrokeWidthUnit =
static_cast<Qgis::RenderUnit>( elemEdge.attribute( u
"stroke-width-unit"_s ).toInt() );
199 return mEdgeStrokeWidth;
204 mEdgeStrokeWidth = strokeWidth;
209 return mEdgeStrokeWidthUnit;
217void QgsMeshRendererScalarSettings::updateShader()
222 if ( !mColorRampShader.
isEmpty() )
246 mColor = vectorColor;
256 mFilterMin = vectorFilterMin;
266 mFilterMax = vectorFilterMax;
271 return mOnUserDefinedGrid;
276 mOnUserDefinedGrid = enabled;
281 return mUserGridCellWidth;
286 mUserGridCellWidth = width;
291 return mUserGridCellHeight;
296 mUserGridCellHeight = height;
301 return mShaftLengthMethod;
311 return mMinShaftLength;
321 return mMaxShaftLength;
341 return mFixedShaftLength;
351 return mArrowHeadWidthRatio;
356 mArrowHeadWidthRatio = vectorHeadWidthRatio;
361 return mArrowHeadLengthRatio;
366 mArrowHeadLengthRatio = vectorHeadLengthRatio;
371 QDomElement elem = doc.createElement( u
"vector-arrow-settings"_s );
372 elem.setAttribute( u
"arrow-head-width-ratio"_s, mArrowHeadWidthRatio );
373 elem.setAttribute( u
"arrow-head-length-ratio"_s, mArrowHeadLengthRatio );
375 QDomElement elemShaft = doc.createElement( u
"shaft-length"_s );
377 switch ( mShaftLengthMethod )
380 methodTxt = u
"minmax"_s;
381 elemShaft.setAttribute( u
"min"_s, mMinShaftLength );
382 elemShaft.setAttribute( u
"max"_s, mMaxShaftLength );
385 methodTxt = u
"scaled"_s;
386 elemShaft.setAttribute( u
"scale-factor"_s, mScaleFactor );
389 methodTxt = u
"fixed"_s;
390 elemShaft.setAttribute( u
"fixed-length"_s, mFixedShaftLength );
393 elemShaft.setAttribute( u
"method"_s, methodTxt );
394 elem.appendChild( elemShaft );
400 mArrowHeadWidthRatio = elem.attribute( u
"arrow-head-width-ratio"_s ).toDouble();
401 mArrowHeadLengthRatio = elem.attribute( u
"arrow-head-length-ratio"_s ).toDouble();
403 const QDomElement elemShaft = elem.firstChildElement( u
"shaft-length"_s );
404 const QString methodTxt = elemShaft.attribute( u
"method"_s );
405 if ( u
"minmax"_s == methodTxt )
407 mShaftLengthMethod =
MinMax;
408 mMinShaftLength = elemShaft.attribute( u
"min"_s ).toDouble();
409 mMaxShaftLength = elemShaft.attribute( u
"max"_s ).toDouble();
411 else if ( u
"scaled"_s == methodTxt )
413 mShaftLengthMethod =
Scaled;
414 mScaleFactor = elemShaft.attribute( u
"scale-factor"_s ).toDouble();
418 mShaftLengthMethod =
Fixed;
419 mFixedShaftLength = elemShaft.attribute( u
"fixed-length"_s ).toDouble();
431 : mRendererNativeMeshSettings( other.mRendererNativeMeshSettings )
432 , mRendererTriangularMeshSettings( other.mRendererTriangularMeshSettings )
433 , mRendererEdgeMeshSettings( other.mRendererEdgeMeshSettings )
434 , mRendererScalarSettings( other.mRendererScalarSettings )
435 , mRendererVectorSettings( other.mRendererVectorSettings )
436 , mActiveScalarDatasetGroup( other.mActiveScalarDatasetGroup )
437 , mActiveVectorDatasetGroup( other.mActiveVectorDatasetGroup )
438 , mAveragingMethod( other.mAveragingMethod )
443 : mRendererNativeMeshSettings( std::move( other.mRendererNativeMeshSettings ) )
444 , mRendererTriangularMeshSettings( std::move( other.mRendererTriangularMeshSettings ) )
445 , mRendererEdgeMeshSettings( std::move( other.mRendererEdgeMeshSettings ) )
446 , mRendererScalarSettings( std::move( other.mRendererScalarSettings ) )
447 , mRendererVectorSettings( std::move( other.mRendererVectorSettings ) )
448 , mActiveScalarDatasetGroup( other.mActiveScalarDatasetGroup )
449 , mActiveVectorDatasetGroup( other.mActiveVectorDatasetGroup )
450 , mAveragingMethod( std::move( other.mAveragingMethod ) )
455 if ( &other ==
this )
459 mRendererNativeMeshSettings = other.mRendererNativeMeshSettings;
460 mRendererTriangularMeshSettings = other.mRendererTriangularMeshSettings;
461 mRendererEdgeMeshSettings = other.mRendererEdgeMeshSettings;
462 mRendererScalarSettings = other.mRendererScalarSettings;
463 mRendererVectorSettings = other.mRendererVectorSettings;
464 mActiveScalarDatasetGroup = other.mActiveScalarDatasetGroup;
465 mActiveVectorDatasetGroup = other.mActiveVectorDatasetGroup;
466 mAveragingMethod = other.mAveragingMethod;
473 if ( &other ==
this )
476 mRendererNativeMeshSettings = std::move( other.mRendererNativeMeshSettings );
477 mRendererTriangularMeshSettings = std::move( other.mRendererTriangularMeshSettings );
478 mRendererEdgeMeshSettings = std::move( other.mRendererEdgeMeshSettings );
479 mRendererScalarSettings = std::move( other.mRendererScalarSettings );
480 mRendererVectorSettings = std::move( other.mRendererVectorSettings );
481 mActiveScalarDatasetGroup = other.mActiveScalarDatasetGroup;
482 mActiveVectorDatasetGroup = other.mActiveVectorDatasetGroup;
483 mAveragingMethod = std::move( other.mAveragingMethod );
491 return mAveragingMethod.get();
497 mAveragingMethod.reset( method->
clone() );
499 mAveragingMethod.reset();
504 QDomElement elem = doc.createElement( u
"mesh-renderer-settings"_s );
506 QDomElement elemActiveDatasetGroup = doc.createElement( u
"active-dataset-group"_s );
507 elemActiveDatasetGroup.setAttribute( u
"scalar"_s, mActiveScalarDatasetGroup );
508 elemActiveDatasetGroup.setAttribute( u
"vector"_s, mActiveVectorDatasetGroup );
509 elem.appendChild( elemActiveDatasetGroup );
511 for (
auto groupIndex = mRendererScalarSettings.keyBegin(); groupIndex != mRendererScalarSettings.keyEnd(); groupIndex++ )
515 elemScalar.setAttribute( u
"group"_s, *groupIndex );
516 elem.appendChild( elemScalar );
519 for (
auto groupIndex = mRendererVectorSettings.keyBegin(); groupIndex != mRendererVectorSettings.keyEnd(); groupIndex++ )
523 elemVector.setAttribute( u
"group"_s, *groupIndex );
524 elem.appendChild( elemVector );
527 QDomElement elemNativeMesh = mRendererNativeMeshSettings.
writeXml( doc );
528 elemNativeMesh.setTagName( u
"mesh-settings-native"_s );
529 elem.appendChild( elemNativeMesh );
531 QDomElement elemEdgeMesh = mRendererEdgeMeshSettings.writeXml( doc );
532 elemEdgeMesh.setTagName( u
"mesh-settings-edge"_s );
533 elem.appendChild( elemEdgeMesh );
535 QDomElement elemTriangularMesh = mRendererTriangularMeshSettings.writeXml( doc );
536 elemTriangularMesh.setTagName( u
"mesh-settings-triangular"_s );
537 elem.appendChild( elemTriangularMesh );
539 if ( mAveragingMethod )
541 QDomElement elemAveraging = doc.createElement( u
"averaging-3d"_s );
542 elemAveraging.setAttribute( u
"method"_s, QString::number( mAveragingMethod->method() ) );
543 const QDomElement elemAveragingParams = mAveragingMethod->writeXml( doc );
544 elemAveraging.appendChild( elemAveragingParams );
545 elem.appendChild( elemAveraging );
553 mRendererScalarSettings.clear();
554 mRendererVectorSettings.clear();
555 mAveragingMethod.reset();
557 const QDomElement elemActiveDataset = elem.firstChildElement( u
"active-dataset-group"_s );
558 if ( elemActiveDataset.hasAttribute( u
"scalar"_s ) )
559 mActiveScalarDatasetGroup = elemActiveDataset.attribute( u
"scalar"_s ).toInt();
561 if ( elemActiveDataset.hasAttribute( u
"vector"_s ) )
562 mActiveVectorDatasetGroup = elemActiveDataset.attribute( u
"vector"_s ).toInt();
564 QDomElement elemScalar = elem.firstChildElement( u
"scalar-settings"_s );
565 while ( !elemScalar.isNull() )
567 const int groupIndex = elemScalar.attribute( u
"group"_s ).toInt();
572 elemScalar = elemScalar.nextSiblingElement( u
"scalar-settings"_s );
575 QDomElement elemVector = elem.firstChildElement( u
"vector-settings"_s );
576 while ( !elemVector.isNull() )
578 const int groupIndex = elemVector.attribute( u
"group"_s ).toInt();
583 elemVector = elemVector.nextSiblingElement( u
"vector-settings"_s );
586 const QDomElement elemNativeMesh = elem.firstChildElement( u
"mesh-settings-native"_s );
587 mRendererNativeMeshSettings.readXml( elemNativeMesh );
589 const QDomElement elemEdgeMesh = elem.firstChildElement( u
"mesh-settings-edge"_s );
590 mRendererEdgeMeshSettings.readXml( elemEdgeMesh );
592 const QDomElement elemTriangularMesh = elem.firstChildElement( u
"mesh-settings-triangular"_s );
593 mRendererTriangularMeshSettings.readXml( elemTriangularMesh );
595 const QDomElement elemAveraging = elem.firstChildElement( u
"averaging-3d"_s );
596 if ( !elemAveraging.isNull() )
604 return mActiveScalarDatasetGroup;
614 return mActiveVectorDatasetGroup;
624 return mSeedingMethod;
634 return mSeedingDensity;
644 QDomElement elem = doc.createElement( u
"vector-streamline-settings"_s );
646 elem.setAttribute( u
"seeding-method"_s, mSeedingMethod );
647 elem.setAttribute( u
"seeding-density"_s, mSeedingDensity );
655 mSeedingDensity = elem.attribute( u
"seeding-density"_s ).toDouble();
660 return mDisplayingMethod;
665 mDisplayingMethod = displayingMethod;
670 return mArrowsSettings;
680 return mStreamLinesSettings;
690 QDomElement elem = doc.createElement( u
"vector-settings"_s );
691 elem.setAttribute( u
"symbology"_s, mDisplayingMethod );
693 elem.setAttribute( u
"line-width"_s, mLineWidth );
696 const QDomElement elemShader = mColorRampShader.writeXml( doc, context );
697 elem.appendChild( elemShader );
698 elem.setAttribute( u
"filter-min"_s, mFilterMin );
699 elem.setAttribute( u
"filter-max"_s, mFilterMax );
701 elem.setAttribute( u
"user-grid-enabled"_s, mOnUserDefinedGrid ? u
"1"_s : u
"0"_s );
702 elem.setAttribute( u
"user-grid-width"_s, mUserGridCellWidth );
703 elem.setAttribute( u
"user-grid-height"_s, mUserGridCellHeight );
705 elem.appendChild( mArrowsSettings.writeXml( doc ) );
706 elem.appendChild( mStreamLinesSettings.writeXml( doc ) );
707 elem.appendChild( mTracesSettings.writeXml( doc ) );
708 elem.appendChild( mWindBarbSettings.writeXml( doc ) );
717 mLineWidth = elem.attribute( u
"line-width"_s ).toDouble();
720 mColorRampShader.readXml( elem.firstChildElement(
"colorrampshader" ), context );
721 mFilterMin = elem.attribute( u
"filter-min"_s ).toDouble();
722 mFilterMax = elem.attribute( u
"filter-max"_s ).toDouble();
724 mOnUserDefinedGrid = elem.attribute( u
"user-grid-enabled"_s ).toInt();
725 mUserGridCellWidth = elem.attribute( u
"user-grid-width"_s ).toInt();
726 mUserGridCellHeight = elem.attribute( u
"user-grid-height"_s ).toInt();
728 const QDomElement elemVector = elem.firstChildElement( u
"vector-arrow-settings"_s );
729 if ( !elemVector.isNull() )
730 mArrowsSettings.readXml( elemVector );
732 const QDomElement elemStreamLine = elem.firstChildElement( u
"vector-streamline-settings"_s );
733 if ( !elemStreamLine.isNull() )
734 mStreamLinesSettings.readXml( elemStreamLine );
736 const QDomElement elemTraces = elem.firstChildElement( u
"vector-traces-settings"_s );
737 if ( !elemTraces.isNull() )
738 mTracesSettings.readXml( elemTraces );
740 const QDomElement elemWindBarb = elem.firstChildElement( u
"vector-windbarb-settings"_s );
741 if ( !elemWindBarb.isNull() )
742 mWindBarbSettings.readXml( elemWindBarb );
747 return mColoringMethod;
757 return mColorRampShader;
768 switch ( mColoringMethod )
778 return strokeColoring;
783 return mTracesSettings;
793 mMaximumTailLength = elem.attribute( u
"maximum-tail-length"_s ).toInt();
794 mMaximumTailLengthUnit =
static_cast<Qgis::RenderUnit>( elem.attribute( u
"maximum-tail-length-unit"_s ).toInt() );
795 mParticlesCount = elem.attribute( u
"particles-count"_s ).toInt();
800 QDomElement elem = doc.createElement( u
"vector-traces-settings"_s );
801 elem.setAttribute( u
"maximum-tail-length"_s, mMaximumTailLength );
802 elem.setAttribute( u
"maximum-tail-length-unit"_s,
static_cast< int >( mMaximumTailLengthUnit ) );
803 elem.setAttribute( u
"particles-count"_s, mParticlesCount );
810 return mMaximumTailLengthUnit;
820 return mMaximumTailLength;
830 return mParticlesCount;
835 mParticlesCount = value;
840 return mRendererScalarSettings.contains( datasetGroupIndex ) || mRendererVectorSettings.contains( datasetGroupIndex );
845 return mWindBarbSettings;
855 mShaftLength = elem.attribute( u
"shaft-length"_s, u
"10"_s ).toDouble();
856 mShaftLengthUnits =
static_cast<Qgis::RenderUnit>( elem.attribute( u
"shaft-length-units"_s ).toInt() );
857 mMagnitudeMultiplier = elem.attribute( u
"magnitude-multiplier"_s, u
"1"_s ).toDouble();
858 mMagnitudeUnits =
static_cast<WindSpeedUnit>( elem.attribute( u
"magnitude-units"_s, u
"0"_s ).toInt() );
863 QDomElement elem = doc.createElement( u
"vector-windbarb-settings"_s );
864 elem.setAttribute( u
"shaft-length"_s, mShaftLength );
865 elem.setAttribute( u
"shaft-length-units"_s,
static_cast< int >( mShaftLengthUnits ) );
866 elem.setAttribute( u
"magnitude-multiplier"_s, mMagnitudeMultiplier );
867 elem.setAttribute( u
"magnitude-units"_s,
static_cast< int >( mMagnitudeUnits ) );
873 switch ( mMagnitudeUnits )
878 return 3600.0 / 1852.0;
882 return 1.609344 / 1.852;
884 return 3600.0 / 1.852 / 5280.0 * 1.609344;
886 return mMagnitudeMultiplier;
908 return mShaftLengthUnits;
913 mShaftLengthUnits = shaftLengthUnit;
918 return mMagnitudeUnits;
923 mMagnitudeUnits = units;
@ WholeMesh
Whole mesh is used to compute statistics.
RenderUnit
Rendering size units.
A ramp shader will color a raster pixel based on a list of values ranges in a ramp.
bool isEmpty() const
Whether the color ramp contains any items.
QgsColorRamp * sourceColorRamp() const
Returns the source color ramp.
void classifyColorRamp(int classes=0, int band=-1, const QgsRectangle &extent=QgsRectangle(), QgsRasterInterface *input=nullptr)
Classify color ramp shader.
virtual int count() const =0
Returns number of defined colors, or -1 if undefined.
static QColor colorFromString(const QString &string)
Decodes a string into a color value.
static QString colorToString(const QColor &color)
Encodes a color into a string value.
Defines color interpolation for rendering mesh datasets.
ColoringMethod
Defines how the color is defined.
@ ColorRamp
Render with a color ramp.
@ SingleColor
Render with a single color.
Represents a width that can vary depending on values.
Abstract class for interpolating 3d stacked mesh data to 2d data.
static QgsMesh3DAveragingMethod * createFromXml(const QDomElement &elem)
Creates the instance from XML by calling readXml of derived classes.
virtual QDomElement writeXml(QDomDocument &doc) const =0
Writes configuration to a new DOM element.
virtual QgsMesh3DAveragingMethod * clone() const =0
Clone the instance.
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.
void setClassificationMinimumMaximum(double minimum, double maximum)
Sets min/max values used for creation of the color ramp shader.
double opacity() const
Returns opacity.
void readXml(const QDomElement &elem, const QgsReadWriteContext &context=QgsReadWriteContext())
Reads configuration from the given DOM element.
void setEdgeStrokeWidthUnit(Qgis::RenderUnit edgeStrokeWidthUnit)
Sets the stroke width unit used to render edges scalar dataset.
void setColorRampShader(const QgsColorRampShader &shader)
Sets color ramp shader function.
QgsColorRampShader colorRampShader() const
Returns color ramp shader function.
double classificationMinimum() const
Returns min value used for creation of the color ramp shader.
void setOpacity(double opacity)
Sets opacity.
DataResamplingMethod
Resampling of value from dataset.
@ NoResampling
Does not use resampling.
@ NeighbourAverage
Does a simple average of values defined for all surrounding faces/vertices.
Qgis::RenderUnit edgeStrokeWidthUnit() const
Returns the stroke width unit used to render edges scalar dataset.
DataResamplingMethod dataResamplingMethod() const
Returns the type of interpolation to use to convert face defined datasets to values on vertices.
QDomElement writeXml(QDomDocument &doc, const QgsReadWriteContext &context=QgsReadWriteContext()) const
Writes configuration to a new DOM element.
void setEdgeStrokeWidth(const QgsInterpolatedLineWidth &strokeWidth)
Sets the stroke width used to render edges scalar dataset.
double classificationMaximum() const
Returns max value used for creation of the color ramp shader.
QgsInterpolatedLineWidth edgeStrokeWidth() const
Returns the stroke width used to render edges scalar dataset.
void setDataResamplingMethod(const DataResamplingMethod &dataResamplingMethod)
Sets data interpolation method.
void setAveragingMethod(QgsMesh3DAveragingMethod *method)
Sets averaging method for conversion of 3d stacked mesh data to 2d data.
void setActiveVectorDatasetGroup(int activeVectorDatasetGroup)
Sets the active vector dataset group.
QgsMeshRendererScalarSettings scalarSettings(int groupIndex) const
Returns renderer settings.
int activeVectorDatasetGroup() const
Returns the active vector dataset group.
QgsMesh3DAveragingMethod * averagingMethod() const
Returns averaging method for conversion of 3d stacked mesh data to 2d data.
bool hasSettings(int datasetGroupIndex) const
Returns whether the group with index has render settings (scalar or vector).
int activeScalarDatasetGroup() const
Returns the active scalar dataset group.
QgsMeshRendererVectorSettings vectorSettings(int groupIndex) const
Returns renderer settings.
void setActiveScalarDatasetGroup(int activeScalarDatasetGroup)
Sets the active scalar dataset group.
void readXml(const QDomElement &elem, const QgsReadWriteContext &context=QgsReadWriteContext())
Reads configuration from the given DOM element.
QgsMeshRendererSettings()
Constructs renderer with default single layer averaging method.
QDomElement writeXml(QDomDocument &doc, const QgsReadWriteContext &context=QgsReadWriteContext()) const
Writes configuration to a new DOM element.
~QgsMeshRendererSettings()
QgsMeshRendererSettings & operator=(const QgsMeshRendererSettings &other)
Represents a mesh renderer settings for vector datasets displayed with arrows.
void setFixedShaftLength(double fixedShaftLength)
Sets fixed length (in millimeters).
void setMaxShaftLength(double maxShaftLength)
Sets maximum shaft length (in millimeters).
QgsMeshRendererVectorArrowSettings::ArrowScalingMethod shaftLengthMethod() const
Returns method used for drawing arrows.
void setMinShaftLength(double minShaftLength)
Sets mininimum shaft length (in millimeters).
double fixedShaftLength() const
Returns fixed arrow length (in millimeters).
void setArrowHeadWidthRatio(double arrowHeadWidthRatio)
Sets ratio of the head width of the arrow (range 0-1).
double scaleFactor() const
Returns scale factor.
double maxShaftLength() const
Returns maximum shaft length (in millimeters).
double arrowHeadWidthRatio() const
Returns ratio of the head width of the arrow (range 0-1).
void setArrowHeadLengthRatio(double arrowHeadLengthRatio)
Sets ratio of the head length of the arrow (range 0-1).
void readXml(const QDomElement &elem)
Reads configuration from the given DOM element.
void setScaleFactor(double scaleFactor)
Sets scale factor.
void setShaftLengthMethod(ArrowScalingMethod shaftLengthMethod)
Sets method used for drawing arrows.
ArrowScalingMethod
Algorithm how to transform vector magnitude to length of arrow on the device in pixels.
@ Scaled
Scale vector magnitude by factor scaleFactor().
@ MinMax
Scale vector magnitude linearly to fit in range of vectorFilterMin() and vectorFilterMax().
@ Fixed
Use fixed length fixedShaftLength() regardless of vector's magnitude.
double minShaftLength() const
Returns mininimum shaft length (in millimeters).
QDomElement writeXml(QDomDocument &doc) const
Writes configuration to a new DOM element.
double arrowHeadLengthRatio() const
Returns ratio of the head length of the arrow (range 0-1).
Represents a renderer settings for vector datasets.
void setColorRampShader(const QgsColorRampShader &colorRampShader)
Returns the color ramp shader used to render vector datasets.
void setStreamLinesSettings(const QgsMeshRendererVectorStreamlineSettings &streamLinesSettings)
Sets settings for vector rendered with streamlines.
int userGridCellWidth() const
Returns width in pixels of user grid cell.
void setArrowsSettings(const QgsMeshRendererVectorArrowSettings &arrowSettings)
Sets settings for vector rendered with arrows.
void setUserGridCellWidth(int width)
Sets width of user grid cell (in pixels).
void setColor(const QColor &color)
Sets color used for drawing arrows.
QgsMeshRendererVectorTracesSettings tracesSettings() const
Returns settings for vector rendered with traces.
QColor color() const
Returns color used for drawing arrows.
int userGridCellHeight() const
Returns height in pixels of user grid cell.
void setOnUserDefinedGrid(bool enabled)
Toggles drawing of vectors on user defined grid.
double lineWidth() const
Returns line width of the arrow (in millimeters).
Symbology
Defines the symbology of vector rendering.
void setUserGridCellHeight(int height)
Sets height of user grid cell (in pixels).
Symbology symbology() const
Returns the displaying method used to render vector datasets.
double filterMax() const
Returns filter value for vector magnitudes.
QgsColorRampShader colorRampShader() const
Sets the color ramp shader used to render vector datasets.
void setSymbology(const Symbology &symbology)
Sets the displaying method used to render vector datasets.
void setFilterMin(double filterMin)
Sets filter value for vector magnitudes.
QgsMeshRendererVectorArrowSettings arrowSettings() const
Returns settings for vector rendered with arrows.
void setFilterMax(double filterMax)
Sets filter value for vector magnitudes.
QgsInterpolatedLineColor vectorStrokeColoring() const
Returns the stroke coloring used to render vector datasets.
void setTracesSettings(const QgsMeshRendererVectorTracesSettings &tracesSettings)
Sets settings for vector rendered with traces.
QDomElement writeXml(QDomDocument &doc, const QgsReadWriteContext &context=QgsReadWriteContext()) const
Writes configuration to a new DOM element.
void setColoringMethod(const QgsInterpolatedLineColor::ColoringMethod &coloringMethod)
Sets the coloring method used to render vector datasets.
QgsInterpolatedLineColor::ColoringMethod coloringMethod() const
Returns the coloring method used to render vector datasets.
void readXml(const QDomElement &elem, const QgsReadWriteContext &context=QgsReadWriteContext())
Reads configuration from the given DOM element.
QgsMeshRendererVectorWindBarbSettings windBarbSettings() const
Returns settings for vector rendered with wind barbs.
void setLineWidth(double lineWidth)
Sets line width of the arrow in pixels (in millimeters).
bool isOnUserDefinedGrid() const
Returns whether vectors are drawn on user-defined grid.
double filterMin() const
Returns filter value for vector magnitudes.
void setWindBarbSettings(const QgsMeshRendererVectorWindBarbSettings &windBarbSettings)
Sets settings for vector rendered with wind barbs.
QgsMeshRendererVectorStreamlineSettings streamLinesSettings() const
Returns settings for vector rendered with streamlines.
Represents a streamline renderer settings for vector datasets displayed by streamlines.
void setSeedingDensity(double seedingDensity)
Sets the density used for seeding start points.
SeedingStartPointsMethod seedingMethod() const
Returns the method used for seeding start points of strealines.
void setSeedingMethod(const SeedingStartPointsMethod &seedingMethod)
Sets the method used for seeding start points of strealines.
QDomElement writeXml(QDomDocument &doc) const
Writes configuration to a new DOM element.
SeedingStartPointsMethod
Method used to define start points that are used to draw streamlines.
void readXml(const QDomElement &elem)
Reads configuration from the given DOM element.
double seedingDensity() const
Returns the density used for seeding start points.
Represents a trace renderer settings for vector datasets displayed by particle traces.
Qgis::RenderUnit maximumTailLengthUnit() const
Returns the maximum tail length unit.
void setMaximumTailLength(double maximumTailLength)
Sets the maximums tail length.
QDomElement writeXml(QDomDocument &doc) const
Writes configuration to a new DOM element.
void readXml(const QDomElement &elem)
Reads configuration from the given DOM element.
void setMaximumTailLengthUnit(Qgis::RenderUnit maximumTailLengthUnit)
Sets the maximum tail length unit.
double maximumTailLength() const
Returns the maximum tail length.
int particlesCount() const
Returns particles count.
void setParticlesCount(int value)
Sets particles count.
Represents a mesh renderer settings for vector datasets displayed with wind barbs.
void readXml(const QDomElement &elem)
Reads configuration from the given DOM element.
void setShaftLengthUnits(Qgis::RenderUnit shaftLengthUnit)
Sets the units for the shaft length.
WindSpeedUnit magnitudeUnits() const
Returns the units that the data are in.
void setMagnitudeUnits(WindSpeedUnit units)
Sets the units that the data are in.
void setMagnitudeMultiplier(double magnitudeMultiplier)
Sets a multiplier for the magnitude to convert it to knots.
double shaftLength() const
Returns the shaft length (in millimeters).
void setShaftLength(double shaftLength)
Sets the shaft length (in millimeters).
Qgis::RenderUnit shaftLengthUnits() const
Returns the units for the shaft length.
QDomElement writeXml(QDomDocument &doc) const
Writes configuration to a new DOM element.
WindSpeedUnit
Wind speed units. Wind barbs use knots so we use this enum for preset conversion values.
@ FeetPerSecond
Feet per second.
@ KilometersPerHour
Kilometers per hour.
@ Knots
Knots (Nautical miles per hour).
@ MilesPerHour
Miles per hour.
@ MetersPerSecond
Meters per second.
double magnitudeMultiplier() const
Returns the multiplier for the magnitude to convert it to knots, according to the units set with setM...
Sigma averages over the values between 0 (bed level) and 1 (surface).
virtual void setMaximumValue(double value)
Sets the maximum value for the raster shader.
virtual void setMinimumValue(double value)
Sets the minimum value for the raster shader.
A container for the context for various read/write operations on objects.
A rectangle specified with double values.
static Q_INVOKABLE Qgis::RenderUnit decodeRenderUnit(const QString &string, bool *ok=nullptr)
Decodes a render unit from a string.
static Q_INVOKABLE QString encodeUnit(Qgis::DistanceUnit unit)
Encodes a distance unit to a string.
T qgsEnumKeyToValue(const QString &key, const T &defaultValue, bool tryValueAsKey=true, bool *returnOk=nullptr)
Returns the value corresponding to the given key of an enum.
QString qgsEnumValueToKey(const T &value, bool *returnOk=nullptr)
Returns the value for the given key of an enum.