QGIS API Documentation 3.41.0-Master (57ec4277f5e)
Loading...
Searching...
No Matches
qgsinterpolatedlinesymbollayerwidget.cpp
Go to the documentation of this file.
1/***************************************************************************
2 qgsinterpolatedlinesymbollayerwidget.cpp - QgsInterpolatedLineSymbolLayerWidget
3
4 ---------------------
5 begin : 23.3.2021
6 copyright : (C) 2021 by Vincent Cloarec
7 email : vcloarec at gmail dot com
8 ***************************************************************************
9 * *
10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. *
14 * *
15 ***************************************************************************/
17#include "moc_qgsinterpolatedlinesymbollayerwidget.cpp"
18
19#include "qgsvectorlayer.h"
20#include "qgsdoublevalidator.h"
21
22
24 : QgsSymbolLayerWidget( parent, layer )
25{
26 setupUi( this );
27
28 mWidthMethodComboBox->addItem( tr( "Fixed Width" ), false );
29 mWidthMethodComboBox->addItem( tr( "Varying Width" ), true );
30 mColorMethodComboBox->addItem( tr( "Single Color" ), QgsInterpolatedLineColor::SingleColor );
31 mColorMethodComboBox->addItem( tr( "Varying Color" ), QgsInterpolatedLineColor::ColorRamp );
32
33 mWidthStartFieldExpression->setFilters( QgsFieldProxyModel::Numeric );
34 mWidthEndFieldExpression->setFilters( QgsFieldProxyModel::Numeric );
35 mColorStartFieldExpression->setFilters( QgsFieldProxyModel::Numeric );
36 mColorEndFieldExpression->setFilters( QgsFieldProxyModel::Numeric );
37
38 mWidthStartFieldExpression->setLayer( layer );
39 mWidthEndFieldExpression->setLayer( layer );
40 mColorStartFieldExpression->setLayer( layer );
41 mColorEndFieldExpression->setLayer( layer );
42
43 mWidthUnitSelectionFixed->setUnits(
44 {
51 }
52 );
53
54 mWidthUnitSelectionVarying->setUnits(
55 {
62 }
63 );
64
65 connect( mWidthMethodComboBox, qOverload<int>( &QComboBox::currentIndexChanged ), this, &QgsInterpolatedLineSymbolLayerWidget::updateVisibleWidget );
66 connect( mColorMethodComboBox, qOverload<int>( &QComboBox::currentIndexChanged ), this, &QgsInterpolatedLineSymbolLayerWidget::updateVisibleWidget );
67
68 // Width parameter
69 connect( mWidthMethodComboBox, qOverload<int>( &QComboBox::currentIndexChanged ), this, &QgsInterpolatedLineSymbolLayerWidget::apply );
70 connect( mDoubleSpinBoxWidth, qOverload<double>( &QDoubleSpinBox::valueChanged ), this, &QgsInterpolatedLineSymbolLayerWidget::apply );
71 connect( mWidthStartFieldExpression, static_cast<void ( QgsFieldExpressionWidget::* )( const QString & )>( &QgsFieldExpressionWidget::fieldChanged ), this, &QgsInterpolatedLineSymbolLayerWidget::reloadMinMaxWidthFromLayer );
72 connect( mWidthEndFieldExpression, static_cast<void ( QgsFieldExpressionWidget::* )( const QString & )>( &QgsFieldExpressionWidget::fieldChanged ), this, &QgsInterpolatedLineSymbolLayerWidget::reloadMinMaxWidthFromLayer );
73 connect( mButtonLoadMinMaxValueWidth, &QPushButton::clicked, this, &QgsInterpolatedLineSymbolLayerWidget::onReloadMinMaxValueWidth );
74 connect( mLineEditWidthMinValue, &QLineEdit::textChanged, this, &QgsInterpolatedLineSymbolLayerWidget::apply );
75 connect( mLineEditWidthMaxValue, &QLineEdit::textChanged, this, &QgsInterpolatedLineSymbolLayerWidget::apply );
76 connect( mDoubleSpinBoxMinWidth, qOverload<double>( &QDoubleSpinBox::valueChanged ), this, &QgsInterpolatedLineSymbolLayerWidget::apply );
77 connect( mDoubleSpinBoxMaxWidth, qOverload<double>( &QDoubleSpinBox::valueChanged ), this, &QgsInterpolatedLineSymbolLayerWidget::apply );
78 connect( mWidthUnitSelectionFixed, &QgsUnitSelectionWidget::changed, this, &QgsInterpolatedLineSymbolLayerWidget::apply );
79 connect( mWidthUnitSelectionVarying, &QgsUnitSelectionWidget::changed, this, &QgsInterpolatedLineSymbolLayerWidget::apply );
80
81 connect( mWidthUnitSelectionVarying, &QgsUnitSelectionWidget::changed, this, [this] {
82 whileBlocking( mWidthUnitSelectionFixed )->setUnit( mWidthUnitSelectionVarying->unit() );
83 } );
84
85 connect( mWidthUnitSelectionFixed, &QgsUnitSelectionWidget::changed, this, [this] {
86 whileBlocking( mWidthUnitSelectionVarying )->setUnit( mWidthUnitSelectionFixed->unit() );
87 } );
88
89 connect( mCheckBoxAbsoluteValue, &QCheckBox::clicked, this, &QgsInterpolatedLineSymbolLayerWidget::apply );
90 connect( mCheckBoxOutOfrange, &QCheckBox::clicked, this, &QgsInterpolatedLineSymbolLayerWidget::apply );
91
92 // Color parameter
93 connect( mColorMethodComboBox, qOverload<int>( &QComboBox::currentIndexChanged ), this, &QgsInterpolatedLineSymbolLayerWidget::apply );
94 connect( mColorRampShaderWidget, &QgsColorRampShaderWidget::widgetChanged, this, &QgsInterpolatedLineSymbolLayerWidget::apply );
95 connect( mColorButton, &QgsColorButton::colorChanged, this, &QgsInterpolatedLineSymbolLayerWidget::apply );
96
97 connect( mColorStartFieldExpression, static_cast<void ( QgsFieldExpressionWidget::* )( const QString & )>( &QgsFieldExpressionWidget::fieldChanged ), this, &QgsInterpolatedLineSymbolLayerWidget::reloadMinMaxColorFromLayer );
98 connect( mColorEndFieldExpression, static_cast<void ( QgsFieldExpressionWidget::* )( const QString & )>( &QgsFieldExpressionWidget::fieldChanged ), this, &QgsInterpolatedLineSymbolLayerWidget::reloadMinMaxColorFromLayer );
99
100 connect( mLineEditColorMinValue, &QLineEdit::textChanged, this, &QgsInterpolatedLineSymbolLayerWidget::onColorMinMaxLineTextChanged );
101 connect( mLineEditColorMinValue, &QLineEdit::textEdited, this, &QgsInterpolatedLineSymbolLayerWidget::onColorMinMaxLineTextEdited );
102 connect( mLineEditColorMaxValue, &QLineEdit::textChanged, this, &QgsInterpolatedLineSymbolLayerWidget::onColorMinMaxLineTextChanged );
103 connect( mLineEditColorMaxValue, &QLineEdit::textEdited, this, &QgsInterpolatedLineSymbolLayerWidget::onColorMinMaxLineTextEdited );
104 connect( mButtonLoadMinMaxValueColor, &QPushButton::clicked, this, &QgsInterpolatedLineSymbolLayerWidget::onReloadMinMaxValueColor );
105 connect( mColorRampShaderWidget, &QgsColorRampShaderWidget::widgetChanged, this, &QgsInterpolatedLineSymbolLayerWidget::apply );
106}
107
109{
110 if ( !layer || layer->layerType() != QLatin1String( "InterpolatedLine" ) )
111 return;
112
113 mLayer = static_cast<QgsInterpolatedLineSymbolLayer *>( layer );
114
115 const QgsInterpolatedLineWidth interpolatedWidth = mLayer->interpolatedWidth();
116 whileBlocking( mWidthMethodComboBox )->setCurrentIndex( mWidthMethodComboBox->findData( interpolatedWidth.isVariableWidth() ) );
117
118 whileBlocking( mDoubleSpinBoxWidth )->setValue( interpolatedWidth.fixedStrokeWidth() );
119 whileBlocking( mWidthStartFieldExpression )->setExpression( mLayer->dataDefinedProperties().property( QgsSymbolLayer::Property::LineStartWidthValue ).asExpression() );
120 whileBlocking( mWidthEndFieldExpression )->setExpression( mLayer->dataDefinedProperties().property( QgsSymbolLayer::Property::LineEndWidthValue ).asExpression() );
121 setLineEditValue( mLineEditWidthMinValue, interpolatedWidth.minimumValue() );
122 setLineEditValue( mLineEditWidthMaxValue, interpolatedWidth.maximumValue() );
123 whileBlocking( mDoubleSpinBoxMinWidth )->setValue( interpolatedWidth.minimumWidth() );
124 whileBlocking( mDoubleSpinBoxMaxWidth )->setValue( interpolatedWidth.maximumWidth() );
125 whileBlocking( mWidthUnitSelectionFixed )->setUnit( mLayer->widthUnit() );
126 whileBlocking( mWidthUnitSelectionVarying )->setUnit( mLayer->widthUnit() );
127 whileBlocking( mCheckBoxAbsoluteValue )->setChecked( interpolatedWidth.useAbsoluteValue() );
128 whileBlocking( mCheckBoxOutOfrange )->setChecked( interpolatedWidth.ignoreOutOfRange() );
129
130 const QgsInterpolatedLineColor interpolatedColor = mLayer->interpolatedColor();
131 whileBlocking( mColorMethodComboBox )->setCurrentIndex( mColorMethodComboBox->findData( interpolatedColor.coloringMethod() ) );
132
133 whileBlocking( mColorStartFieldExpression )->setExpression( mLayer->dataDefinedProperties().property( QgsSymbolLayer::Property::LineStartColorValue ).asExpression() );
134 whileBlocking( mColorEndFieldExpression )->setExpression( mLayer->dataDefinedProperties().property( QgsSymbolLayer::Property::LineEndColorValue ).asExpression() );
135 whileBlocking( mColorRampShaderWidget )->setFromShader( interpolatedColor.colorRampShader() );
136 setLineEditValue( mLineEditColorMinValue, interpolatedColor.colorRampShader().minimumValue() );
137 setLineEditValue( mLineEditColorMaxValue, interpolatedColor.colorRampShader().maximumValue() );
138 whileBlocking( mColorButton )->setColor( interpolatedColor.singleColor() );
139
140
141 updateVisibleWidget();
142}
143
145{
146 if ( !mLayer )
147 return nullptr;
148
149 return mLayer;
150}
151
152void QgsInterpolatedLineSymbolLayerWidget::apply()
153{
154 if ( !mLayer )
155 return;
156
157 bool isExpression = false;
158 QString fieldOrExpression = mWidthStartFieldExpression->currentField( &isExpression );
159 mLayer->setDataDefinedProperty( QgsSymbolLayer::Property::LineStartWidthValue, isExpression ? QgsProperty::fromExpression( fieldOrExpression ) : QgsProperty::fromField( fieldOrExpression ) );
160 fieldOrExpression = mWidthEndFieldExpression->currentField( &isExpression );
161 mLayer->setDataDefinedProperty( QgsSymbolLayer::Property::LineEndWidthValue, isExpression ? QgsProperty::fromExpression( fieldOrExpression ) : QgsProperty::fromField( fieldOrExpression ) );
162
163 mLayer->setInterpolatedWidth( interpolatedLineWidth() );
164 if ( mWidthMethodComboBox->currentData().toBool() )
165 mLayer->setWidthUnit( mWidthUnitSelectionVarying->unit() );
166 else
167 mLayer->setWidthUnit( mWidthUnitSelectionFixed->unit() );
168
169 fieldOrExpression = mColorStartFieldExpression->currentField( &isExpression );
170 mLayer->setDataDefinedProperty( QgsSymbolLayer::Property::LineStartColorValue, isExpression ? QgsProperty::fromExpression( fieldOrExpression ) : QgsProperty::fromField( fieldOrExpression ) );
171 fieldOrExpression = mColorEndFieldExpression->currentField( &isExpression );
172 mLayer->setDataDefinedProperty( QgsSymbolLayer::Property::LineEndColorValue, isExpression ? QgsProperty::fromExpression( fieldOrExpression ) : QgsProperty::fromField( fieldOrExpression ) );
173
174 mLayer->setInterpolatedColor( interpolatedLineColor() );
175
176 emit changed();
177}
178
179void QgsInterpolatedLineSymbolLayerWidget::updateVisibleWidget()
180{
181 mFixedWidthWidget->setVisible( !mWidthMethodComboBox->currentData().toBool() );
182 mVaryingWidthWidget->setVisible( mWidthMethodComboBox->currentData().toBool() );
183
184 mFixedColorWidget->setVisible(
185 static_cast<QgsInterpolatedLineColor::ColoringMethod>( mColorMethodComboBox->currentData().toInt() ) == QgsInterpolatedLineColor::SingleColor
186 );
187 mVaryingColorWidget->setVisible(
188 static_cast<QgsInterpolatedLineColor::ColoringMethod>( mColorMethodComboBox->currentData().toInt() ) == QgsInterpolatedLineColor::ColorRamp
189 );
190}
191
192void QgsInterpolatedLineSymbolLayerWidget::onReloadMinMaxValueWidth()
193{
194 reloadMinMaxWidthFromLayer();
195 setLineEditValue( mLineEditWidthMinValue, mMinimumForWidthFromLayer );
196 setLineEditValue( mLineEditWidthMaxValue, mMaximumForWidthFromLayer );
197 apply();
198}
199
200void QgsInterpolatedLineSymbolLayerWidget::onReloadMinMaxValueColor()
201{
202 reloadMinMaxColorFromLayer();
203 setLineEditValue( mLineEditColorMinValue, mMinimumForColorFromLayer );
204 setLineEditValue( mLineEditColorMaxValue, mMaximumForColorFromLayer );
205 onColorMinMaxLineTextEdited();
206}
207
208void QgsInterpolatedLineSymbolLayerWidget::reloadMinMaxWidthFromLayer()
209{
210 QgsExpressionContext expressionContext = createExpressionContext();
211
212 QgsExpression expressionStart( mWidthStartFieldExpression->expression() );
213 if ( !expressionStart.prepare( &expressionContext ) )
214 {
215 apply();
216 return;
217 }
218
219 QgsExpression expressionEnd( mWidthEndFieldExpression->expression() );
220 if ( !expressionEnd.prepare( &expressionContext ) )
221 {
222 apply();
223 return;
224 }
225
226 if ( !mLayer || !vectorLayer() )
227 {
228 apply();
229 return;
230 }
231
233 QgsFeature feat;
234 mMinimumForWidthFromLayer = std::numeric_limits<double>::max();
235 mMaximumForWidthFromLayer = -std::numeric_limits<double>::max();
236 while ( it.nextFeature( feat ) )
237 {
238 expressionContext.setFeature( feat );
239 double startValue = expressionStart.evaluate( &expressionContext ).toDouble();
240 double endValue = expressionEnd.evaluate( &expressionContext ).toDouble();
241
242 if ( mCheckBoxAbsoluteValue->isChecked() )
243 {
244 startValue = fabs( startValue );
245 endValue = fabs( endValue );
246 }
247
248 if ( startValue < mMinimumForWidthFromLayer )
249 mMinimumForWidthFromLayer = startValue;
250 if ( startValue > mMaximumForWidthFromLayer )
251 mMaximumForWidthFromLayer = startValue;
252
253 if ( endValue < mMinimumForWidthFromLayer )
254 mMinimumForWidthFromLayer = endValue;
255 if ( endValue > mMaximumForWidthFromLayer )
256 mMaximumForWidthFromLayer = endValue;
257 }
258
259 if ( mLineEditWidthMinValue->text().isEmpty() && !std::isnan( mMinimumForWidthFromLayer ) )
260 {
261 setLineEditValue( mLineEditWidthMinValue, mMinimumForWidthFromLayer );
262 }
263
264 if ( mLineEditWidthMaxValue->text().isEmpty() && !std::isnan( mMaximumForWidthFromLayer ) )
265 {
266 setLineEditValue( mLineEditWidthMaxValue, mMaximumForWidthFromLayer );
267 }
268
269 apply();
270}
271
272void QgsInterpolatedLineSymbolLayerWidget::reloadMinMaxColorFromLayer()
273{
274 QgsExpressionContext expressionContext = createExpressionContext();
275
276 QgsExpression expressionStart( mColorStartFieldExpression->expression() );
277 if ( !expressionStart.prepare( &expressionContext ) )
278 {
279 apply();
280 return;
281 }
282
283 QgsExpression expressionEnd( mColorEndFieldExpression->expression() );
284 if ( !expressionEnd.prepare( &expressionContext ) )
285 {
286 apply();
287 return;
288 }
289
290 if ( !mLayer || !vectorLayer() )
291 {
292 apply();
293 return;
294 }
295
297 QgsFeature feat;
298 mMinimumForColorFromLayer = std::numeric_limits<double>::max();
299 mMaximumForColorFromLayer = -std::numeric_limits<double>::max();
300 while ( it.nextFeature( feat ) )
301 {
302 expressionContext.setFeature( feat );
303 const double startValue = expressionStart.evaluate( &expressionContext ).toDouble();
304 const double endValue = expressionEnd.evaluate( &expressionContext ).toDouble();
305
306 if ( startValue < mMinimumForColorFromLayer )
307 mMinimumForColorFromLayer = startValue;
308 if ( startValue > mMaximumForColorFromLayer )
309 mMaximumForColorFromLayer = startValue;
310
311 if ( endValue < mMinimumForColorFromLayer )
312 mMinimumForColorFromLayer = endValue;
313 if ( endValue > mMaximumForColorFromLayer )
314 mMaximumForColorFromLayer = endValue;
315 }
316
317 bool minMaxColorChanged = false;
318 if ( mLineEditColorMinValue->text().isEmpty() && !std::isnan( mMinimumForColorFromLayer ) )
319 {
320 setLineEditValue( mLineEditColorMinValue, mMinimumForColorFromLayer );
321 minMaxColorChanged = true;
322 }
323
324 if ( mLineEditColorMaxValue->text().isEmpty() && !std::isnan( mMaximumForColorFromLayer ) )
325 {
326 setLineEditValue( mLineEditColorMaxValue, mMaximumForColorFromLayer );
327 minMaxColorChanged = true;
328 }
329
330 if ( minMaxColorChanged )
331 onColorMinMaxLineTextEdited();
332
333 apply();
334}
335
336void QgsInterpolatedLineSymbolLayerWidget::onColorMinMaxLineTextChanged()
337{
338 const double min = lineEditValue( mLineEditColorMinValue );
339 const double max = lineEditValue( mLineEditColorMaxValue );
340 whileBlocking( mColorRampShaderWidget )->setMinimumMaximum( min, max );
341 apply();
342}
343
344void QgsInterpolatedLineSymbolLayerWidget::onColorMinMaxLineTextEdited()
345{
346 const double min = lineEditValue( mLineEditColorMinValue );
347 const double max = lineEditValue( mLineEditColorMaxValue );
348 whileBlocking( mColorRampShaderWidget )->setMinimumMaximumAndClassify( min, max );
349 apply();
350}
351
352QgsInterpolatedLineWidth QgsInterpolatedLineSymbolLayerWidget::interpolatedLineWidth()
353{
354 QgsInterpolatedLineWidth interWidth;
355 interWidth.setIsVariableWidth( mWidthMethodComboBox->currentData().toBool() );
356 interWidth.setMinimumValue( lineEditValue( mLineEditWidthMinValue ) );
357 interWidth.setMaximumValue( lineEditValue( mLineEditWidthMaxValue ) );
358 interWidth.setMinimumWidth( mDoubleSpinBoxMinWidth->value() );
359 interWidth.setMaximumWidth( mDoubleSpinBoxMaxWidth->value() );
360 interWidth.setFixedStrokeWidth( mDoubleSpinBoxWidth->value() );
361 interWidth.setIgnoreOutOfRange( mCheckBoxOutOfrange->isChecked() );
362 interWidth.setUseAbsoluteValue( mCheckBoxAbsoluteValue->isChecked() );
363
364 return interWidth;
365}
366
367QgsInterpolatedLineColor QgsInterpolatedLineSymbolLayerWidget::interpolatedLineColor()
368{
369 QgsInterpolatedLineColor interColor;
370 interColor.setColor( mColorButton->color() );
371 const QgsColorRampShader colorRampShader = mColorRampShaderWidget->shader();
372 interColor.setColor( colorRampShader );
373 interColor.setColoringMethod( static_cast<QgsInterpolatedLineColor::ColoringMethod>( mColorMethodComboBox->currentData().toInt() ) );
374
375 return interColor;
376}
377
378double QgsInterpolatedLineSymbolLayerWidget::lineEditValue( QLineEdit *lineEdit )
379{
380 if ( lineEdit->text().isEmpty() )
381 {
382 return std::numeric_limits<double>::quiet_NaN();
383 }
384
385 return QgsDoubleValidator::toDouble( lineEdit->text() );
386}
387
388void QgsInterpolatedLineSymbolLayerWidget::setLineEditValue( QLineEdit *lineEdit, double value )
389{
390 QString strValue;
391 if ( !std::isnan( value ) )
392 strValue = QLocale().toString( value );
393 whileBlocking( lineEdit )->setText( strValue );
394}
@ Millimeters
Millimeters.
@ Points
Points (e.g., for font sizes)
@ MapUnits
Map units.
@ MetersInMapUnits
Meters value as Map units.
void colorChanged(const QColor &color)
Emitted whenever a new color is set for the button.
void widgetChanged()
Widget changed.
A ramp shader will color a raster pixel based on a list of values ranges in a ramp.
static double toDouble(const QString &input, bool *ok)
Converts input string to double value.
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
void setFeature(const QgsFeature &feature)
Convenience function for setting a feature for the context.
Class for parsing and evaluation of expressions (formerly called "search strings").
Wrapper for iterator of features from vector data provider or vector layer.
bool nextFeature(QgsFeature &f)
Fetch next feature and stores in f, returns true on success.
The feature class encapsulates a single feature including its unique ID, geometry and a list of field...
Definition qgsfeature.h:58
The QgsFieldExpressionWidget class creates a widget to choose fields and edit expressions It contains...
void fieldChanged(const QString &fieldName)
Emitted when the currently selected field changes.
@ Numeric
All numeric fields.
Class defining color to render mesh datasets.
QgsInterpolatedLineColor::ColoringMethod coloringMethod() const
Returns the coloring method used.
QgsColorRampShader colorRampShader() const
Returns the color ramp shader.
void setColor(const QgsColorRampShader &colorRampShader)
Sets the color ramp to define the coloring.
QColor singleColor() const
Returns the single color that is used if SingleColor coloring mode is set.
void setColoringMethod(ColoringMethod coloringMethod)
Sets the coloring method used.
ColoringMethod
Defines how the color is defined.
@ ColorRamp
Render with a color ramp.
@ SingleColor
Render with a single color.
QgsInterpolatedLineSymbolLayerWidget(QgsVectorLayer *layer, QWidget *parent=nullptr)
Constructor.
A symbol layer that represents vector layer line feature as interpolated line The interpolation is do...
Qgis::RenderUnit widthUnit() const
Returns the width unit.
QgsInterpolatedLineColor interpolatedColor() const
Returns the interpolated color used to render the colors of lines, see QgsInterpolatedLineColor.
void setInterpolatedWidth(const QgsInterpolatedLineWidth &interpolatedLineWidth)
Sets the interpolated width used to render the width of lines, see QgsInterpolatedLineWidth.
void setInterpolatedColor(const QgsInterpolatedLineColor &interpolatedLineColor)
Sets the interpolated color used to render the colors of lines, see QgsInterpolatedLineColor.
QgsInterpolatedLineWidth interpolatedWidth() const
Returns the interpolated width used to render the width of lines, see QgsInterpolatedLineWidth.
void setWidthUnit(Qgis::RenderUnit strokeWidthUnit)
Sets the width unit.
Represents a width than can vary depending on values.
void setFixedStrokeWidth(double fixedWidth)
Sets the fixed width.
void setUseAbsoluteValue(bool useAbsoluteValue)
Sets whether absolute value are used as input.
double minimumValue() const
Returns the minimum value used to defined the variable width.
void setIgnoreOutOfRange(bool ignoreOutOfRange)
Sets whether the variable width ignores out of range value.
void setMaximumValue(double maximumValue)
Sets the maximum value used to defined the variable width.
bool useAbsoluteValue() const
Returns whether absolute value are used as input.
void setIsVariableWidth(bool isVariableWidth)
Returns whether the width is variable.
void setMinimumValue(double minimumValue)
Sets the minimum value used to defined the variable width.
double maximumWidth() const
Returns the maximum width used to defined the variable width.
void setMaximumWidth(double maximumWidth)
Sets the maximum width used to defined the variable width.
double maximumValue() const
Returns the maximum value used to defined the variable width.
void setMinimumWidth(double minimumWidth)
Sets the minimum width used to defined the variable width.
bool ignoreOutOfRange() const
Returns whether the variable width ignores out of range value.
double minimumWidth() const
Returns the minimum width used to defined the variable width.
double fixedStrokeWidth() const
Returns the fixed width.
bool isVariableWidth() const
Returns whether the width is variable.
QgsProperty property(int key) const final
Returns a matching property from the collection, if one exists.
A store for object properties.
QString asExpression() const
Returns an expression string representing the state of the property, or an empty string if the proper...
static QgsProperty fromExpression(const QString &expression, bool isActive=true)
Returns a new ExpressionBasedProperty created from the specified expression.
double maximumValue() const
Returns the minimum value for the raster shader.
double minimumValue() const
Returns the maximum value for the raster shader.
void changed()
Should be emitted whenever configuration changes happened on this symbol layer configuration.
QgsExpressionContext createExpressionContext() const override
This method needs to be reimplemented in all classes which implement this interface and return an exp...
const QgsVectorLayer * vectorLayer() const
Returns the vector layer associated with the widget.
@ LineEndColorValue
End line color for interpolated line renderer.
@ LineStartColorValue
Start line color for interpolated line renderer.
@ LineEndWidthValue
End line width for interpolated line renderer.
@ LineStartWidthValue
Start line width for interpolated line renderer.
virtual QString layerType() const =0
Returns a string that represents this layer type.
virtual void setDataDefinedProperty(Property key, const QgsProperty &property)
Sets a data defined property for the layer.
QgsPropertyCollection & dataDefinedProperties()
Returns a reference to the symbol layer's property collection, used for data defined overrides.
void changed()
Emitted when the selected unit is changed, or the definition of the map unit scale is changed.
Represents a vector layer which manages a vector based data sets.
QgsFeatureIterator getFeatures(const QgsFeatureRequest &request=QgsFeatureRequest()) const FINAL
Queries the layer for features specified in request.
QgsSignalBlocker< Object > whileBlocking(Object *object)
Temporarily blocks signals from a QObject while calling a single method from the object.
Definition qgis.h:5970