QGIS API Documentation 3.41.0-Master (3440c17df1d)
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 mWidthUnitSelectionVarying->setUnits(
54 {
61 } );
62
63 connect( mWidthMethodComboBox, qOverload<int>( &QComboBox::currentIndexChanged ),
64 this, &QgsInterpolatedLineSymbolLayerWidget::updateVisibleWidget );
65 connect( mColorMethodComboBox, qOverload<int>( &QComboBox::currentIndexChanged ),
66 this, &QgsInterpolatedLineSymbolLayerWidget::updateVisibleWidget );
67
68 // Width parameter
69 connect( mWidthMethodComboBox, qOverload<int>( &QComboBox::currentIndexChanged ),
70 this, &QgsInterpolatedLineSymbolLayerWidget::apply );
71 connect( mDoubleSpinBoxWidth, qOverload<double>( &QDoubleSpinBox::valueChanged ),
72 this, &QgsInterpolatedLineSymbolLayerWidget::apply );
73 connect( mWidthStartFieldExpression, static_cast < void ( QgsFieldExpressionWidget::* )( const QString & ) >( &QgsFieldExpressionWidget::fieldChanged )
74 , this, &QgsInterpolatedLineSymbolLayerWidget::reloadMinMaxWidthFromLayer );
75 connect( mWidthEndFieldExpression, static_cast < void ( QgsFieldExpressionWidget::* )( const QString & ) >( &QgsFieldExpressionWidget::fieldChanged )
76 , this, &QgsInterpolatedLineSymbolLayerWidget::reloadMinMaxWidthFromLayer );
77 connect( mButtonLoadMinMaxValueWidth, &QPushButton::clicked, this, &QgsInterpolatedLineSymbolLayerWidget::onReloadMinMaxValueWidth );
78 connect( mLineEditWidthMinValue, &QLineEdit::textChanged, this, &QgsInterpolatedLineSymbolLayerWidget::apply );
79 connect( mLineEditWidthMaxValue, &QLineEdit::textChanged, this, &QgsInterpolatedLineSymbolLayerWidget::apply );
80 connect( mDoubleSpinBoxMinWidth, qOverload<double>( &QDoubleSpinBox::valueChanged ),
81 this, &QgsInterpolatedLineSymbolLayerWidget::apply );
82 connect( mDoubleSpinBoxMaxWidth, qOverload<double>( &QDoubleSpinBox::valueChanged ),
83 this, &QgsInterpolatedLineSymbolLayerWidget::apply );
84 connect( mWidthUnitSelectionFixed, &QgsUnitSelectionWidget::changed, this, &QgsInterpolatedLineSymbolLayerWidget::apply );
85 connect( mWidthUnitSelectionVarying, &QgsUnitSelectionWidget::changed, this, &QgsInterpolatedLineSymbolLayerWidget::apply );
86
87 connect( mWidthUnitSelectionVarying, &QgsUnitSelectionWidget::changed, this, [this]
88 {
89 whileBlocking( mWidthUnitSelectionFixed )->setUnit( mWidthUnitSelectionVarying->unit() );
90 } );
91
92 connect( mWidthUnitSelectionFixed, &QgsUnitSelectionWidget::changed, this, [this]
93 {
94 whileBlocking( mWidthUnitSelectionVarying )->setUnit( mWidthUnitSelectionFixed->unit() );
95 } );
96
97 connect( mCheckBoxAbsoluteValue, &QCheckBox::clicked, this, &QgsInterpolatedLineSymbolLayerWidget::apply );
98 connect( mCheckBoxOutOfrange, &QCheckBox::clicked, this, &QgsInterpolatedLineSymbolLayerWidget::apply );
99
100 // Color parameter
101 connect( mColorMethodComboBox, qOverload<int>( &QComboBox::currentIndexChanged ),
102 this, &QgsInterpolatedLineSymbolLayerWidget::apply );
103 connect( mColorRampShaderWidget, &QgsColorRampShaderWidget::widgetChanged, this, &QgsInterpolatedLineSymbolLayerWidget::apply );
104 connect( mColorButton, &QgsColorButton::colorChanged, this, &QgsInterpolatedLineSymbolLayerWidget::apply );
105
106 connect( mColorStartFieldExpression, static_cast < void ( QgsFieldExpressionWidget::* )( const QString & ) >( &QgsFieldExpressionWidget::fieldChanged )
107 , this, &QgsInterpolatedLineSymbolLayerWidget::reloadMinMaxColorFromLayer );
108 connect( mColorEndFieldExpression, static_cast < void ( QgsFieldExpressionWidget::* )( const QString & ) >( &QgsFieldExpressionWidget::fieldChanged )
109 , this, &QgsInterpolatedLineSymbolLayerWidget::reloadMinMaxColorFromLayer );
110
111 connect( mLineEditColorMinValue, &QLineEdit::textChanged, this, &QgsInterpolatedLineSymbolLayerWidget::onColorMinMaxLineTextChanged );
112 connect( mLineEditColorMinValue, &QLineEdit::textEdited, this, &QgsInterpolatedLineSymbolLayerWidget::onColorMinMaxLineTextEdited );
113 connect( mLineEditColorMaxValue, &QLineEdit::textChanged, this, &QgsInterpolatedLineSymbolLayerWidget::onColorMinMaxLineTextChanged );
114 connect( mLineEditColorMaxValue, &QLineEdit::textEdited, this, &QgsInterpolatedLineSymbolLayerWidget::onColorMinMaxLineTextEdited );
115 connect( mButtonLoadMinMaxValueColor, &QPushButton::clicked, this, &QgsInterpolatedLineSymbolLayerWidget::onReloadMinMaxValueColor );
116 connect( mColorRampShaderWidget, &QgsColorRampShaderWidget::widgetChanged, this, &QgsInterpolatedLineSymbolLayerWidget::apply );
117
118}
119
121{
122 if ( !layer || layer->layerType() != QLatin1String( "InterpolatedLine" ) )
123 return;
124
125 mLayer = static_cast<QgsInterpolatedLineSymbolLayer *>( layer );
126
127 const QgsInterpolatedLineWidth interpolatedWidth = mLayer->interpolatedWidth();
128 whileBlocking( mWidthMethodComboBox )->setCurrentIndex( mWidthMethodComboBox->findData( interpolatedWidth.isVariableWidth() ) );
129
130 whileBlocking( mDoubleSpinBoxWidth )->setValue( interpolatedWidth.fixedStrokeWidth() );
131 whileBlocking( mWidthStartFieldExpression )->setExpression( mLayer->dataDefinedProperties().property( QgsSymbolLayer::Property::LineStartWidthValue ).asExpression() );
132 whileBlocking( mWidthEndFieldExpression )->setExpression( mLayer->dataDefinedProperties().property( QgsSymbolLayer::Property::LineEndWidthValue ).asExpression() );
133 setLineEditValue( mLineEditWidthMinValue, interpolatedWidth.minimumValue() );
134 setLineEditValue( mLineEditWidthMaxValue, interpolatedWidth.maximumValue() );
135 whileBlocking( mDoubleSpinBoxMinWidth )->setValue( interpolatedWidth.minimumWidth() );
136 whileBlocking( mDoubleSpinBoxMaxWidth )->setValue( interpolatedWidth.maximumWidth() );
137 whileBlocking( mWidthUnitSelectionFixed )->setUnit( mLayer->widthUnit() );
138 whileBlocking( mWidthUnitSelectionVarying )->setUnit( mLayer->widthUnit() );
139 whileBlocking( mCheckBoxAbsoluteValue )->setChecked( interpolatedWidth.useAbsoluteValue() );
140 whileBlocking( mCheckBoxOutOfrange )->setChecked( interpolatedWidth.ignoreOutOfRange() );
141
142 const QgsInterpolatedLineColor interpolatedColor = mLayer->interpolatedColor();
143 whileBlocking( mColorMethodComboBox )->setCurrentIndex( mColorMethodComboBox->findData( interpolatedColor.coloringMethod() ) );
144
145 whileBlocking( mColorStartFieldExpression )->setExpression( mLayer->dataDefinedProperties().property( QgsSymbolLayer::Property::LineStartColorValue ).asExpression() );
146 whileBlocking( mColorEndFieldExpression )->setExpression( mLayer->dataDefinedProperties().property( QgsSymbolLayer::Property::LineEndColorValue ).asExpression() );
147 whileBlocking( mColorRampShaderWidget )->setFromShader( interpolatedColor.colorRampShader() );
148 setLineEditValue( mLineEditColorMinValue, interpolatedColor.colorRampShader().minimumValue() );
149 setLineEditValue( mLineEditColorMaxValue, interpolatedColor.colorRampShader().maximumValue() );
150 whileBlocking( mColorButton )->setColor( interpolatedColor.singleColor() );
151
152
153 updateVisibleWidget();
154}
155
157{
158 if ( !mLayer )
159 return nullptr;
160
161 return mLayer;
162}
163
164void QgsInterpolatedLineSymbolLayerWidget::apply()
165{
166 if ( !mLayer )
167 return;
168
169 bool isExpression = false;
170 QString fieldOrExpression = mWidthStartFieldExpression->currentField( &isExpression );
171 mLayer->setDataDefinedProperty( QgsSymbolLayer::Property::LineStartWidthValue, isExpression ? QgsProperty::fromExpression( fieldOrExpression ) : QgsProperty::fromField( fieldOrExpression ) );
172 fieldOrExpression = mWidthEndFieldExpression->currentField( &isExpression );
173 mLayer->setDataDefinedProperty( QgsSymbolLayer::Property::LineEndWidthValue, isExpression ? QgsProperty::fromExpression( fieldOrExpression ) : QgsProperty::fromField( fieldOrExpression ) );
174
175 mLayer->setInterpolatedWidth( interpolatedLineWidth() );
176 if ( mWidthMethodComboBox->currentData().toBool() )
177 mLayer->setWidthUnit( mWidthUnitSelectionVarying->unit() );
178 else
179 mLayer->setWidthUnit( mWidthUnitSelectionFixed->unit() );
180
181 fieldOrExpression = mColorStartFieldExpression->currentField( &isExpression );
182 mLayer->setDataDefinedProperty( QgsSymbolLayer::Property::LineStartColorValue, isExpression ? QgsProperty::fromExpression( fieldOrExpression ) : QgsProperty::fromField( fieldOrExpression ) );
183 fieldOrExpression = mColorEndFieldExpression->currentField( &isExpression );
184 mLayer->setDataDefinedProperty( QgsSymbolLayer::Property::LineEndColorValue, isExpression ? QgsProperty::fromExpression( fieldOrExpression ) : QgsProperty::fromField( fieldOrExpression ) );
185
186 mLayer->setInterpolatedColor( interpolatedLineColor() );
187
188 emit changed();
189}
190
191void QgsInterpolatedLineSymbolLayerWidget::updateVisibleWidget()
192{
193 mFixedWidthWidget->setVisible( !mWidthMethodComboBox->currentData().toBool() );
194 mVaryingWidthWidget->setVisible( mWidthMethodComboBox->currentData().toBool() );
195
196 mFixedColorWidget->setVisible(
197 static_cast<QgsInterpolatedLineColor::ColoringMethod>( mColorMethodComboBox->currentData().toInt() ) == QgsInterpolatedLineColor::SingleColor );
198 mVaryingColorWidget->setVisible(
199 static_cast<QgsInterpolatedLineColor::ColoringMethod>( mColorMethodComboBox->currentData().toInt() ) == QgsInterpolatedLineColor::ColorRamp );
200}
201
202void QgsInterpolatedLineSymbolLayerWidget::onReloadMinMaxValueWidth()
203{
204 reloadMinMaxWidthFromLayer();
205 setLineEditValue( mLineEditWidthMinValue, mMinimumForWidthFromLayer );
206 setLineEditValue( mLineEditWidthMaxValue, mMaximumForWidthFromLayer );
207 apply();
208}
209
210void QgsInterpolatedLineSymbolLayerWidget::onReloadMinMaxValueColor()
211{
212 reloadMinMaxColorFromLayer();
213 setLineEditValue( mLineEditColorMinValue, mMinimumForColorFromLayer );
214 setLineEditValue( mLineEditColorMaxValue, mMaximumForColorFromLayer );
215 onColorMinMaxLineTextEdited();
216}
217
218void QgsInterpolatedLineSymbolLayerWidget::reloadMinMaxWidthFromLayer()
219{
220 QgsExpressionContext expressionContext = createExpressionContext();
221
222 QgsExpression expressionStart( mWidthStartFieldExpression->expression() );
223 if ( !expressionStart.prepare( &expressionContext ) )
224 {
225 apply();
226 return;
227 }
228
229 QgsExpression expressionEnd( mWidthEndFieldExpression->expression() );
230 if ( !expressionEnd.prepare( &expressionContext ) )
231 {
232 apply();
233 return;
234 }
235
236 if ( !mLayer || !vectorLayer() )
237 {
238 apply();
239 return;
240 }
241
243 QgsFeature feat;
244 mMinimumForWidthFromLayer = std::numeric_limits<double>::max();
245 mMaximumForWidthFromLayer = -std::numeric_limits<double>::max();
246 while ( it.nextFeature( feat ) )
247 {
248 expressionContext.setFeature( feat );
249 double startValue = expressionStart.evaluate( &expressionContext ).toDouble();
250 double endValue = expressionEnd.evaluate( &expressionContext ).toDouble();
251
252 if ( mCheckBoxAbsoluteValue->isChecked() )
253 {
254 startValue = fabs( startValue );
255 endValue = fabs( endValue );
256 }
257
258 if ( startValue < mMinimumForWidthFromLayer )
259 mMinimumForWidthFromLayer = startValue;
260 if ( startValue > mMaximumForWidthFromLayer )
261 mMaximumForWidthFromLayer = startValue;
262
263 if ( endValue < mMinimumForWidthFromLayer )
264 mMinimumForWidthFromLayer = endValue;
265 if ( endValue > mMaximumForWidthFromLayer )
266 mMaximumForWidthFromLayer = endValue;
267 }
268
269 if ( mLineEditWidthMinValue->text().isEmpty() && !std::isnan( mMinimumForWidthFromLayer ) )
270 {
271 setLineEditValue( mLineEditWidthMinValue, mMinimumForWidthFromLayer );
272 }
273
274 if ( mLineEditWidthMaxValue->text().isEmpty() && !std::isnan( mMaximumForWidthFromLayer ) )
275 {
276 setLineEditValue( mLineEditWidthMaxValue, mMaximumForWidthFromLayer );
277 }
278
279 apply();
280}
281
282void QgsInterpolatedLineSymbolLayerWidget::reloadMinMaxColorFromLayer()
283{
284 QgsExpressionContext expressionContext = createExpressionContext();
285
286 QgsExpression expressionStart( mColorStartFieldExpression->expression() );
287 if ( !expressionStart.prepare( &expressionContext ) )
288 {
289 apply();
290 return;
291 }
292
293 QgsExpression expressionEnd( mColorEndFieldExpression->expression() );
294 if ( !expressionEnd.prepare( &expressionContext ) )
295 {
296 apply();
297 return;
298 }
299
300 if ( !mLayer || !vectorLayer() )
301 {
302 apply();
303 return;
304 }
305
307 QgsFeature feat;
308 mMinimumForColorFromLayer = std::numeric_limits<double>::max();
309 mMaximumForColorFromLayer = -std::numeric_limits<double>::max();
310 while ( it.nextFeature( feat ) )
311 {
312 expressionContext.setFeature( feat );
313 const double startValue = expressionStart.evaluate( &expressionContext ).toDouble();
314 const double endValue = expressionEnd.evaluate( &expressionContext ).toDouble();
315
316 if ( startValue < mMinimumForColorFromLayer )
317 mMinimumForColorFromLayer = startValue;
318 if ( startValue > mMaximumForColorFromLayer )
319 mMaximumForColorFromLayer = startValue;
320
321 if ( endValue < mMinimumForColorFromLayer )
322 mMinimumForColorFromLayer = endValue;
323 if ( endValue > mMaximumForColorFromLayer )
324 mMaximumForColorFromLayer = endValue;
325 }
326
327 bool minMaxColorChanged = false;
328 if ( mLineEditColorMinValue->text().isEmpty() && !std::isnan( mMinimumForColorFromLayer ) )
329 {
330 setLineEditValue( mLineEditColorMinValue, mMinimumForColorFromLayer );
331 minMaxColorChanged = true;
332 }
333
334 if ( mLineEditColorMaxValue->text().isEmpty() && !std::isnan( mMaximumForColorFromLayer ) )
335 {
336 setLineEditValue( mLineEditColorMaxValue, mMaximumForColorFromLayer );
337 minMaxColorChanged = true;
338 }
339
340 if ( minMaxColorChanged )
341 onColorMinMaxLineTextEdited();
342
343 apply();
344}
345
346void QgsInterpolatedLineSymbolLayerWidget::onColorMinMaxLineTextChanged()
347{
348 const double min = lineEditValue( mLineEditColorMinValue );
349 const double max = lineEditValue( mLineEditColorMaxValue );
350 whileBlocking( mColorRampShaderWidget )->setMinimumMaximum( min, max );
351 apply();
352}
353
354void QgsInterpolatedLineSymbolLayerWidget::onColorMinMaxLineTextEdited()
355{
356 const double min = lineEditValue( mLineEditColorMinValue );
357 const double max = lineEditValue( mLineEditColorMaxValue );
358 whileBlocking( mColorRampShaderWidget )->setMinimumMaximumAndClassify( min, max );
359 apply();
360}
361
362QgsInterpolatedLineWidth QgsInterpolatedLineSymbolLayerWidget::interpolatedLineWidth()
363{
364 QgsInterpolatedLineWidth interWidth;
365 interWidth.setIsVariableWidth( mWidthMethodComboBox->currentData().toBool() );
366 interWidth.setMinimumValue( lineEditValue( mLineEditWidthMinValue ) );
367 interWidth.setMaximumValue( lineEditValue( mLineEditWidthMaxValue ) );
368 interWidth.setMinimumWidth( mDoubleSpinBoxMinWidth->value() );
369 interWidth.setMaximumWidth( mDoubleSpinBoxMaxWidth->value() );
370 interWidth.setFixedStrokeWidth( mDoubleSpinBoxWidth->value() );
371 interWidth.setIgnoreOutOfRange( mCheckBoxOutOfrange->isChecked() );
372 interWidth.setUseAbsoluteValue( mCheckBoxAbsoluteValue->isChecked() );
373
374 return interWidth;
375}
376
377QgsInterpolatedLineColor QgsInterpolatedLineSymbolLayerWidget::interpolatedLineColor()
378{
379 QgsInterpolatedLineColor interColor;
380 interColor.setColor( mColorButton->color() );
381 const QgsColorRampShader colorRampShader = mColorRampShaderWidget->shader();
382 interColor.setColor( colorRampShader );
383 interColor.setColoringMethod( static_cast<QgsInterpolatedLineColor::ColoringMethod>( mColorMethodComboBox->currentData().toInt() ) );
384
385 return interColor;
386}
387
388double QgsInterpolatedLineSymbolLayerWidget::lineEditValue( QLineEdit *lineEdit )
389{
390 if ( lineEdit->text().isEmpty() )
391 {
392 return std::numeric_limits<double>::quiet_NaN();
393 }
394
395 return QgsDoubleValidator::toDouble( lineEdit->text() );
396}
397
398void QgsInterpolatedLineSymbolLayerWidget::setLineEditValue( QLineEdit *lineEdit, double value )
399{
400 QString strValue;
401 if ( !std::isnan( value ) )
402 strValue = QLocale().toString( value );
403 whileBlocking( lineEdit )->setText( strValue );
404}
@ 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:5862