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;
103 mClassificationMinimum = minimum;
104 mClassificationMaximum = maximum;
114 return mDataResamplingMethod;
119 mDataResamplingMethod = dataInterpolationMethod;
124 QDomElement elem = doc.createElement( u
"scalar-settings"_s );
125 elem.setAttribute( u
"min-val"_s, mClassificationMinimum );
126 elem.setAttribute( u
"max-val"_s, mClassificationMaximum );
127 elem.setAttribute( u
"opacity"_s, mOpacity );
130 switch ( mDataResamplingMethod )
133 methodTxt = u
"no-resampling"_s;
136 methodTxt = u
"neighbour-average"_s;
139 elem.setAttribute( u
"interpolation-method"_s, methodTxt );
146 const QDomElement elemShader = mColorRampShader.writeXml( doc, context );
147 elem.appendChild( elemShader );
149 QDomElement elemEdge = doc.createElement( u
"edge-settings"_s );
150 elemEdge.appendChild( mEdgeStrokeWidth.writeXml( doc, context ) );
151 elemEdge.setAttribute( u
"stroke-width-unit"_s,
static_cast< int >( mEdgeStrokeWidthUnit ) );
152 elem.appendChild( elemEdge );
159 mClassificationMinimum = elem.attribute( u
"min-val"_s ).toDouble();
160 mClassificationMaximum = elem.attribute( u
"max-val"_s ).toDouble();
161 mOpacity = elem.attribute( u
"opacity"_s ).toDouble();
163 const QString methodTxt = elem.attribute( u
"interpolation-method"_s );
164 if ( u
"neighbour-average"_s == methodTxt )
176 const QDomElement elemShader = elem.firstChildElement( u
"colorrampshader"_s );
177 mColorRampShader.readXml( elemShader, context );
179 const QDomElement elemEdge = elem.firstChildElement( u
"edge-settings"_s );
180 const QDomElement elemEdgeStrokeWidth = elemEdge.firstChildElement( u
"mesh-stroke-width"_s );
181 mEdgeStrokeWidth.readXml( elemEdgeStrokeWidth, context );
183 elemEdge.attribute( u
"stroke-width-unit"_s ).toInt() );
188 return mEdgeStrokeWidth;
193 mEdgeStrokeWidth = strokeWidth;
198 return mEdgeStrokeWidthUnit;
206void QgsMeshRendererScalarSettings::updateShader()
212 if ( !mColorRampShader.
isEmpty() )
236 mColor = vectorColor;
246 mFilterMin = vectorFilterMin;
256 mFilterMax = vectorFilterMax;
261 return mOnUserDefinedGrid;
266 mOnUserDefinedGrid = enabled;
271 return mUserGridCellWidth;
276 mUserGridCellWidth = width;
281 return mUserGridCellHeight;
286 mUserGridCellHeight = height;
291 return mShaftLengthMethod;
301 return mMinShaftLength;
311 return mMaxShaftLength;
331 return mFixedShaftLength;
341 return mArrowHeadWidthRatio;
346 mArrowHeadWidthRatio = vectorHeadWidthRatio;
351 return mArrowHeadLengthRatio;
356 mArrowHeadLengthRatio = vectorHeadLengthRatio;
361 QDomElement elem = doc.createElement( u
"vector-arrow-settings"_s );
362 elem.setAttribute( u
"arrow-head-width-ratio"_s, mArrowHeadWidthRatio );
363 elem.setAttribute( u
"arrow-head-length-ratio"_s, mArrowHeadLengthRatio );
365 QDomElement elemShaft = doc.createElement( u
"shaft-length"_s );
367 switch ( mShaftLengthMethod )
370 methodTxt = u
"minmax"_s;
371 elemShaft.setAttribute( u
"min"_s, mMinShaftLength );
372 elemShaft.setAttribute( u
"max"_s, mMaxShaftLength );
375 methodTxt = u
"scaled"_s;
376 elemShaft.setAttribute( u
"scale-factor"_s, mScaleFactor );
379 methodTxt = u
"fixed"_s ;
380 elemShaft.setAttribute( u
"fixed-length"_s, mFixedShaftLength );
383 elemShaft.setAttribute( u
"method"_s, methodTxt );
384 elem.appendChild( elemShaft );
390 mArrowHeadWidthRatio = elem.attribute( u
"arrow-head-width-ratio"_s ).toDouble();
391 mArrowHeadLengthRatio = elem.attribute( u
"arrow-head-length-ratio"_s ).toDouble();
393 const QDomElement elemShaft = elem.firstChildElement( u
"shaft-length"_s );
394 const QString methodTxt = elemShaft.attribute( u
"method"_s );
395 if ( u
"minmax"_s == methodTxt )
397 mShaftLengthMethod =
MinMax;
398 mMinShaftLength = elemShaft.attribute( u
"min"_s ).toDouble();
399 mMaxShaftLength = elemShaft.attribute( u
"max"_s ).toDouble();
401 else if ( u
"scaled"_s == methodTxt )
403 mShaftLengthMethod =
Scaled;
404 mScaleFactor = elemShaft.attribute( u
"scale-factor"_s ).toDouble();
408 mShaftLengthMethod =
Fixed;
409 mFixedShaftLength = elemShaft.attribute( u
"fixed-length"_s ).toDouble();
422 : mRendererNativeMeshSettings( other.mRendererNativeMeshSettings )
423 , mRendererTriangularMeshSettings( other.mRendererTriangularMeshSettings )
424 , mRendererEdgeMeshSettings( other.mRendererEdgeMeshSettings )
425 , mRendererScalarSettings( other.mRendererScalarSettings )
426 , mRendererVectorSettings( other.mRendererVectorSettings )
427 , mActiveScalarDatasetGroup( other.mActiveScalarDatasetGroup )
428 , mActiveVectorDatasetGroup( other.mActiveVectorDatasetGroup )
429 , mAveragingMethod( other.mAveragingMethod )
435 : mRendererNativeMeshSettings( std::move( other.mRendererNativeMeshSettings ) )
436 , mRendererTriangularMeshSettings( std::move( other.mRendererTriangularMeshSettings ) )
437 , mRendererEdgeMeshSettings( std::move( other.mRendererEdgeMeshSettings ) )
438 , mRendererScalarSettings( std::move( other.mRendererScalarSettings ) )
439 , mRendererVectorSettings( std::move( other.mRendererVectorSettings ) )
440 , mActiveScalarDatasetGroup( other.mActiveScalarDatasetGroup )
441 , mActiveVectorDatasetGroup( other.mActiveVectorDatasetGroup )
442 , mAveragingMethod( std::move( other.mAveragingMethod ) )
448 if ( &other ==
this )
452 mRendererNativeMeshSettings = other.mRendererNativeMeshSettings;
453 mRendererTriangularMeshSettings = other.mRendererTriangularMeshSettings;
454 mRendererEdgeMeshSettings = other.mRendererEdgeMeshSettings;
455 mRendererScalarSettings = other.mRendererScalarSettings;
456 mRendererVectorSettings = other.mRendererVectorSettings;
457 mActiveScalarDatasetGroup = other.mActiveScalarDatasetGroup;
458 mActiveVectorDatasetGroup = other.mActiveVectorDatasetGroup;
459 mAveragingMethod = other.mAveragingMethod;
466 if ( &other ==
this )
469 mRendererNativeMeshSettings = std::move( other.mRendererNativeMeshSettings );
470 mRendererTriangularMeshSettings = std::move( other.mRendererTriangularMeshSettings );
471 mRendererEdgeMeshSettings = std::move( other.mRendererEdgeMeshSettings );
472 mRendererScalarSettings = std::move( other.mRendererScalarSettings );
473 mRendererVectorSettings = std::move( other.mRendererVectorSettings );
474 mActiveScalarDatasetGroup = other.mActiveScalarDatasetGroup;
475 mActiveVectorDatasetGroup = other.mActiveVectorDatasetGroup;
476 mAveragingMethod = std::move( other.mAveragingMethod );
484 return mAveragingMethod.get();
490 mAveragingMethod.reset( method->
clone() );
492 mAveragingMethod.reset();
497 QDomElement elem = doc.createElement( u
"mesh-renderer-settings"_s );
499 QDomElement elemActiveDatasetGroup = doc.createElement( u
"active-dataset-group"_s );
500 elemActiveDatasetGroup.setAttribute( u
"scalar"_s, mActiveScalarDatasetGroup );
501 elemActiveDatasetGroup.setAttribute( u
"vector"_s, mActiveVectorDatasetGroup );
502 elem.appendChild( elemActiveDatasetGroup );
504 for (
auto groupIndex = mRendererScalarSettings.keyBegin(); groupIndex != mRendererScalarSettings.keyEnd(); groupIndex++ )
508 elemScalar.setAttribute( u
"group"_s, *groupIndex );
509 elem.appendChild( elemScalar );
512 for (
auto groupIndex = mRendererVectorSettings.keyBegin(); groupIndex != mRendererVectorSettings.keyEnd(); groupIndex++ )
516 elemVector.setAttribute( u
"group"_s, *groupIndex );
517 elem.appendChild( elemVector );
520 QDomElement elemNativeMesh = mRendererNativeMeshSettings.
writeXml( doc );
521 elemNativeMesh.setTagName( u
"mesh-settings-native"_s );
522 elem.appendChild( elemNativeMesh );
524 QDomElement elemEdgeMesh = mRendererEdgeMeshSettings.writeXml( doc );
525 elemEdgeMesh.setTagName( u
"mesh-settings-edge"_s );
526 elem.appendChild( elemEdgeMesh );
528 QDomElement elemTriangularMesh = mRendererTriangularMeshSettings.writeXml( doc );
529 elemTriangularMesh.setTagName( u
"mesh-settings-triangular"_s );
530 elem.appendChild( elemTriangularMesh );
532 if ( mAveragingMethod )
534 QDomElement elemAveraging = doc.createElement( u
"averaging-3d"_s );
535 elemAveraging.setAttribute( u
"method"_s, QString::number( mAveragingMethod->method() ) ) ;
536 const QDomElement elemAveragingParams = mAveragingMethod->writeXml( doc );
537 elemAveraging.appendChild( elemAveragingParams );
538 elem.appendChild( elemAveraging );
546 mRendererScalarSettings.clear();
547 mRendererVectorSettings.clear();
548 mAveragingMethod.reset();
550 const QDomElement elemActiveDataset = elem.firstChildElement( u
"active-dataset-group"_s );
551 if ( elemActiveDataset.hasAttribute( u
"scalar"_s ) )
552 mActiveScalarDatasetGroup = elemActiveDataset.attribute( u
"scalar"_s ).toInt();
554 if ( elemActiveDataset.hasAttribute( u
"vector"_s ) )
555 mActiveVectorDatasetGroup = elemActiveDataset.attribute( u
"vector"_s ).toInt();
557 QDomElement elemScalar = elem.firstChildElement( u
"scalar-settings"_s );
558 while ( !elemScalar.isNull() )
560 const int groupIndex = elemScalar.attribute( u
"group"_s ).toInt();
565 elemScalar = elemScalar.nextSiblingElement( u
"scalar-settings"_s );
568 QDomElement elemVector = elem.firstChildElement( u
"vector-settings"_s );
569 while ( !elemVector.isNull() )
571 const int groupIndex = elemVector.attribute( u
"group"_s ).toInt();
576 elemVector = elemVector.nextSiblingElement( u
"vector-settings"_s );
579 const QDomElement elemNativeMesh = elem.firstChildElement( u
"mesh-settings-native"_s );
580 mRendererNativeMeshSettings.readXml( elemNativeMesh );
582 const QDomElement elemEdgeMesh = elem.firstChildElement( u
"mesh-settings-edge"_s );
583 mRendererEdgeMeshSettings.readXml( elemEdgeMesh );
585 const QDomElement elemTriangularMesh = elem.firstChildElement( u
"mesh-settings-triangular"_s );
586 mRendererTriangularMeshSettings.readXml( elemTriangularMesh );
588 const QDomElement elemAveraging = elem.firstChildElement( u
"averaging-3d"_s );
589 if ( !elemAveraging.isNull() )
597 return mActiveScalarDatasetGroup;
607 return mActiveVectorDatasetGroup;
617 return mSeedingMethod;
627 return mSeedingDensity;
637 QDomElement elem = doc.createElement( u
"vector-streamline-settings"_s );
639 elem.setAttribute( u
"seeding-method"_s, mSeedingMethod );
640 elem.setAttribute( u
"seeding-density"_s, mSeedingDensity );
649 elem.attribute( u
"seeding-method"_s ).toInt() );
650 mSeedingDensity = elem.attribute( u
"seeding-density"_s ).toDouble();
655 return mDisplayingMethod;
660 mDisplayingMethod = displayingMethod;
665 return mArrowsSettings;
675 return mStreamLinesSettings;
685 QDomElement elem = doc.createElement( u
"vector-settings"_s );
686 elem.setAttribute( u
"symbology"_s, mDisplayingMethod );
688 elem.setAttribute( u
"line-width"_s, mLineWidth );
691 const QDomElement elemShader = mColorRampShader.writeXml( doc, context );
692 elem.appendChild( elemShader );
693 elem.setAttribute( u
"filter-min"_s, mFilterMin );
694 elem.setAttribute( u
"filter-max"_s, mFilterMax );
696 elem.setAttribute( u
"user-grid-enabled"_s, mOnUserDefinedGrid ? u
"1"_s : u
"0"_s );
697 elem.setAttribute( u
"user-grid-width"_s, mUserGridCellWidth );
698 elem.setAttribute( u
"user-grid-height"_s, mUserGridCellHeight );
700 elem.appendChild( mArrowsSettings.writeXml( doc ) );
701 elem.appendChild( mStreamLinesSettings.writeXml( doc ) );
702 elem.appendChild( mTracesSettings.writeXml( doc ) );
703 elem.appendChild( mWindBarbSettings.writeXml( doc ) );
711 elem.attribute( u
"symbology"_s ).toInt() );
713 mLineWidth = elem.attribute( u
"line-width"_s ).toDouble();
715 elem.attribute( u
"coloring-method"_s ).toInt() );
717 mColorRampShader.readXml( elem.firstChildElement(
"colorrampshader" ), context );
718 mFilterMin = elem.attribute( u
"filter-min"_s ).toDouble();
719 mFilterMax = elem.attribute( u
"filter-max"_s ).toDouble();
721 mOnUserDefinedGrid = elem.attribute( u
"user-grid-enabled"_s ).toInt();
722 mUserGridCellWidth = elem.attribute( u
"user-grid-width"_s ).toInt();
723 mUserGridCellHeight = elem.attribute( u
"user-grid-height"_s ).toInt();
725 const QDomElement elemVector = elem.firstChildElement( u
"vector-arrow-settings"_s );
726 if ( ! elemVector.isNull() )
727 mArrowsSettings.readXml( elemVector );
729 const QDomElement elemStreamLine = elem.firstChildElement( u
"vector-streamline-settings"_s );
730 if ( ! elemStreamLine.isNull() )
731 mStreamLinesSettings.readXml( elemStreamLine );
733 const QDomElement elemTraces = elem.firstChildElement( u
"vector-traces-settings"_s );
734 if ( ! elemTraces.isNull() )
735 mTracesSettings.readXml( elemTraces );
737 const QDomElement elemWindBarb = elem.firstChildElement( u
"vector-windbarb-settings"_s );
738 if ( ! elemWindBarb.isNull() )
739 mWindBarbSettings.readXml( elemWindBarb );
744 return mColoringMethod;
754 return mColorRampShader;
765 switch ( mColoringMethod )
775 return strokeColoring;
780 return mTracesSettings;
790 mMaximumTailLength = elem.attribute( u
"maximum-tail-length"_s ).toInt();
792 elem.attribute( u
"maximum-tail-length-unit"_s ).toInt() );
793 mParticlesCount = elem.attribute( u
"particles-count"_s ).toInt();
798 QDomElement elem = doc.createElement( u
"vector-traces-settings"_s );
799 elem.setAttribute( u
"maximum-tail-length"_s, mMaximumTailLength );
800 elem.setAttribute( u
"maximum-tail-length-unit"_s,
static_cast< int >( mMaximumTailLengthUnit ) );
801 elem.setAttribute( u
"particles-count"_s, mParticlesCount );
808 return mMaximumTailLengthUnit;
818 return mMaximumTailLength;
828 return mParticlesCount;
833 mParticlesCount = value;
838 return mRendererScalarSettings.contains( datasetGroupIndex ) || mRendererVectorSettings.contains( datasetGroupIndex );
843 return mWindBarbSettings;
853 mShaftLength = elem.attribute( u
"shaft-length"_s, u
"10"_s ).toDouble();
855 elem.attribute( u
"shaft-length-units"_s ).toInt() );
856 mMagnitudeMultiplier = elem.attribute( u
"magnitude-multiplier"_s, u
"1"_s ).toDouble();
858 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.