22using namespace Qt::StringLiterals;
51 mFilterMin = vectorFilterMin;
61 mFilterMax = vectorFilterMax;
66 return mOnUserDefinedGrid;
71 mOnUserDefinedGrid = enabled;
76 return mUserGridCellWidth;
81 mUserGridCellWidth = width;
86 return mUserGridCellHeight;
91 mUserGridCellHeight = height;
96 return mDisplayingMethod;
101 mDisplayingMethod = displayingMethod;
106 return mArrowsSettings;
116 return mStreamLinesSettings;
126 QDomElement elem = doc.createElement( u
"vector-settings"_s );
127 elem.setAttribute( u
"symbology"_s,
static_cast< int >( mDisplayingMethod ) );
129 elem.setAttribute( u
"line-width"_s, mLineWidth );
132 const QDomElement elemShader = mColorRampShader.writeXml( doc, context );
133 elem.appendChild( elemShader );
134 elem.setAttribute( u
"filter-min"_s, mFilterMin );
135 elem.setAttribute( u
"filter-max"_s, mFilterMax );
137 elem.setAttribute( u
"user-grid-enabled"_s, mOnUserDefinedGrid ? u
"1"_s : u
"0"_s );
138 elem.setAttribute( u
"user-grid-width"_s, mUserGridCellWidth );
139 elem.setAttribute( u
"user-grid-height"_s, mUserGridCellHeight );
141 elem.appendChild( mArrowsSettings.writeXml( doc ) );
142 elem.appendChild( mStreamLinesSettings.writeXml( doc ) );
143 elem.appendChild( mTracesSettings.writeXml( doc ) );
144 elem.appendChild( mWindBarbSettings.writeXml( doc ) );
153 mLineWidth = elem.attribute( u
"line-width"_s ).toDouble();
156 mColorRampShader.readXml( elem.firstChildElement(
"colorrampshader" ), context );
157 mFilterMin = elem.attribute( u
"filter-min"_s ).toDouble();
158 mFilterMax = elem.attribute( u
"filter-max"_s ).toDouble();
160 mOnUserDefinedGrid = elem.attribute( u
"user-grid-enabled"_s ).toInt();
161 mUserGridCellWidth = elem.attribute( u
"user-grid-width"_s ).toInt();
162 mUserGridCellHeight = elem.attribute( u
"user-grid-height"_s ).toInt();
164 const QDomElement elemVector = elem.firstChildElement( u
"vector-arrow-settings"_s );
165 if ( !elemVector.isNull() )
166 mArrowsSettings.readXml( elemVector );
168 const QDomElement elemStreamLine = elem.firstChildElement( u
"vector-streamline-settings"_s );
169 if ( !elemStreamLine.isNull() )
170 mStreamLinesSettings.readXml( elemStreamLine );
172 const QDomElement elemTraces = elem.firstChildElement( u
"vector-traces-settings"_s );
173 if ( !elemTraces.isNull() )
174 mTracesSettings.readXml( elemTraces );
176 const QDomElement elemWindBarb = elem.firstChildElement( u
"vector-windbarb-settings"_s );
177 if ( !elemWindBarb.isNull() )
178 mWindBarbSettings.readXml( elemWindBarb );
183 return mColoringMethod;
193 return mColorRampShader;
204 switch ( mColoringMethod )
214 return strokeColoring;
219 return mTracesSettings;
229 return mWindBarbSettings;
VectorFieldSymbology
Defines the symbology of vector field rendering.
A ramp shader will color a raster pixel based on a list of values ranges in a ramp.
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.
A container for the context for various read/write operations on objects.
Represents a mesh renderer settings for vector datasets displayed with arrows.
void setArrowsSettings(const QgsVectorFieldArrowSettings &arrowSettings)
Sets settings for vector rendered with arrows.
double filterMin() const
Returns filter value for vector magnitudes.
QgsVectorFieldArrowSettings arrowSettings() const
Returns settings for vector rendered with arrows.
QDomElement writeXml(QDomDocument &doc, const QgsReadWriteContext &context=QgsReadWriteContext()) const
Writes configuration to a new DOM element.
int userGridCellWidth() const
Returns width in pixels of user grid cell.
void setColor(const QColor &color)
Sets color used for drawing arrows.
void setStreamLinesSettings(const QgsVectorFieldStreamlineSettings &streamLinesSettings)
Sets settings for vector rendered with streamlines.
double lineWidth() const
Returns line width of the arrow (in millimeters).
QgsVectorFieldWindBarbSettings windBarbSettings() const
Returns settings for vector rendered with wind barbs.
QgsColorRampShader colorRampShader() const
Sets the color ramp shader used to render vector datasets.
void setFilterMin(double filterMin)
Sets filter value for vector magnitudes.
Qgis::VectorFieldSymbology symbology() const
Returns the displaying method used to render vector datasets.
void setTracesSettings(const QgsVectorFieldTracesSettings &tracesSettings)
Sets settings for vector rendered with traces.
QgsVectorFieldTracesSettings tracesSettings() const
Returns settings for vector rendered with traces.
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.
void setColoringMethod(const QgsInterpolatedLineColor::ColoringMethod &coloringMethod)
Sets the coloring method used to render vector datasets.
QgsVectorFieldStreamlineSettings streamLinesSettings() const
Returns settings for vector rendered with streamlines.
void setOnUserDefinedGrid(bool enabled)
Toggles drawing of vectors on user defined grid.
int userGridCellHeight() const
Returns height in pixels of user grid cell.
double filterMax() const
Returns filter value for vector magnitudes.
void readXml(const QDomElement &elem, const QgsReadWriteContext &context=QgsReadWriteContext())
Reads configuration from the given DOM element.
void setFilterMax(double filterMax)
Sets filter value for vector magnitudes.
QgsInterpolatedLineColor::ColoringMethod coloringMethod() const
Returns the coloring method used to render vector datasets.
QgsInterpolatedLineColor vectorStrokeColoring() const
Returns the stroke coloring used to render vector datasets.
void setUserGridCellWidth(int width)
Sets width of user grid cell (in pixels).
void setUserGridCellHeight(int height)
Sets height of user grid cell (in pixels).
void setSymbology(const Qgis::VectorFieldSymbology &symbology)
Sets the displaying method used to render vector datasets.
void setColorRampShader(const QgsColorRampShader &colorRampShader)
Returns the color ramp shader used to render vector datasets.
void setWindBarbSettings(const QgsVectorFieldWindBarbSettings &windBarbSettings)
Sets settings for vector rendered with wind barbs.
QColor color() const
Returns color used for drawing arrows.
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.