QGIS API Documentation 3.99.0-Master (e9821da5c6b)
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
18#include "qgsdoublevalidator.h"
19#include "qgsvectorlayer.h"
20
21#include <QString>
22
23#include "moc_qgsinterpolatedlinesymbollayerwidget.cpp"
24
25using namespace Qt::StringLiterals;
26
28 : QgsSymbolLayerWidget( parent, layer )
29{
30 setupUi( this );
31
32 mWidthMethodComboBox->addItem( tr( "Fixed Width" ), false );
33 mWidthMethodComboBox->addItem( tr( "Varying Width" ), true );
34 mColorMethodComboBox->addItem( tr( "Single Color" ), QgsInterpolatedLineColor::SingleColor );
35 mColorMethodComboBox->addItem( tr( "Varying Color" ), QgsInterpolatedLineColor::ColorRamp );
36
37 mWidthStartFieldExpression->setFilters( QgsFieldProxyModel::Numeric );
38 mWidthEndFieldExpression->setFilters( QgsFieldProxyModel::Numeric );
39 mColorStartFieldExpression->setFilters( QgsFieldProxyModel::Numeric );
40 mColorEndFieldExpression->setFilters( QgsFieldProxyModel::Numeric );
41
42 mWidthStartFieldExpression->setLayer( layer );
43 mWidthEndFieldExpression->setLayer( layer );
44 mColorStartFieldExpression->setLayer( layer );
45 mColorEndFieldExpression->setLayer( layer );
46
47 mWidthUnitSelectionFixed->setUnits(
48 {
55 }
56 );
57
58 mWidthUnitSelectionVarying->setUnits(
59 {
66 }
67 );
68
69 connect( mWidthMethodComboBox, qOverload<int>( &QComboBox::currentIndexChanged ), this, &QgsInterpolatedLineSymbolLayerWidget::updateVisibleWidget );
70 connect( mColorMethodComboBox, qOverload<int>( &QComboBox::currentIndexChanged ), this, &QgsInterpolatedLineSymbolLayerWidget::updateVisibleWidget );
71
72 // Width parameter
73 connect( mWidthMethodComboBox, qOverload<int>( &QComboBox::currentIndexChanged ), this, &QgsInterpolatedLineSymbolLayerWidget::apply );
74 connect( mDoubleSpinBoxWidth, qOverload<double>( &QDoubleSpinBox::valueChanged ), this, &QgsInterpolatedLineSymbolLayerWidget::apply );
75 connect( mWidthStartFieldExpression, static_cast<void ( QgsFieldExpressionWidget::* )( const QString & )>( &QgsFieldExpressionWidget::fieldChanged ), this, &QgsInterpolatedLineSymbolLayerWidget::reloadMinMaxWidthFromLayer );
76 connect( mWidthEndFieldExpression, static_cast<void ( QgsFieldExpressionWidget::* )( const QString & )>( &QgsFieldExpressionWidget::fieldChanged ), 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 ), this, &QgsInterpolatedLineSymbolLayerWidget::apply );
81 connect( mDoubleSpinBoxMaxWidth, qOverload<double>( &QDoubleSpinBox::valueChanged ), this, &QgsInterpolatedLineSymbolLayerWidget::apply );
82 connect( mWidthUnitSelectionFixed, &QgsUnitSelectionWidget::changed, this, &QgsInterpolatedLineSymbolLayerWidget::apply );
83 connect( mWidthUnitSelectionVarying, &QgsUnitSelectionWidget::changed, this, &QgsInterpolatedLineSymbolLayerWidget::apply );
84
85 connect( mWidthUnitSelectionVarying, &QgsUnitSelectionWidget::changed, this, [this] {
86 whileBlocking( mWidthUnitSelectionFixed )->setUnit( mWidthUnitSelectionVarying->unit() );
87 } );
88
89 connect( mWidthUnitSelectionFixed, &QgsUnitSelectionWidget::changed, this, [this] {
90 whileBlocking( mWidthUnitSelectionVarying )->setUnit( mWidthUnitSelectionFixed->unit() );
91 } );
92
93 connect( mCheckBoxAbsoluteValue, &QCheckBox::clicked, this, &QgsInterpolatedLineSymbolLayerWidget::apply );
94 connect( mCheckBoxOutOfrange, &QCheckBox::clicked, this, &QgsInterpolatedLineSymbolLayerWidget::apply );
95
96 // Color parameter
97 connect( mColorMethodComboBox, qOverload<int>( &QComboBox::currentIndexChanged ), this, &QgsInterpolatedLineSymbolLayerWidget::apply );
98 connect( mColorRampShaderWidget, &QgsColorRampShaderWidget::widgetChanged, this, &QgsInterpolatedLineSymbolLayerWidget::apply );
99 connect( mColorButton, &QgsColorButton::colorChanged, this, &QgsInterpolatedLineSymbolLayerWidget::apply );
100
101 connect( mColorStartFieldExpression, static_cast<void ( QgsFieldExpressionWidget::* )( const QString & )>( &QgsFieldExpressionWidget::fieldChanged ), this, &QgsInterpolatedLineSymbolLayerWidget::reloadMinMaxColorFromLayer );
102 connect( mColorEndFieldExpression, static_cast<void ( QgsFieldExpressionWidget::* )( const QString & )>( &QgsFieldExpressionWidget::fieldChanged ), this, &QgsInterpolatedLineSymbolLayerWidget::reloadMinMaxColorFromLayer );
103
104 connect( mLineEditColorMinValue, &QLineEdit::textChanged, this, &QgsInterpolatedLineSymbolLayerWidget::onColorMinMaxLineTextChanged );
105 connect( mLineEditColorMinValue, &QLineEdit::textEdited, this, &QgsInterpolatedLineSymbolLayerWidget::onColorMinMaxLineTextEdited );
106 connect( mLineEditColorMaxValue, &QLineEdit::textChanged, this, &QgsInterpolatedLineSymbolLayerWidget::onColorMinMaxLineTextChanged );
107 connect( mLineEditColorMaxValue, &QLineEdit::textEdited, this, &QgsInterpolatedLineSymbolLayerWidget::onColorMinMaxLineTextEdited );
108 connect( mButtonLoadMinMaxValueColor, &QPushButton::clicked, this, &QgsInterpolatedLineSymbolLayerWidget::onReloadMinMaxValueColor );
109 connect( mColorRampShaderWidget, &QgsColorRampShaderWidget::widgetChanged, this, &QgsInterpolatedLineSymbolLayerWidget::apply );
110}
111
113{
114 if ( !layer || layer->layerType() != "InterpolatedLine"_L1 )
115 return;
116
117 mLayer = static_cast<QgsInterpolatedLineSymbolLayer *>( layer );
118
119 const QgsInterpolatedLineWidth interpolatedWidth = mLayer->interpolatedWidth();
120 whileBlocking( mWidthMethodComboBox )->setCurrentIndex( mWidthMethodComboBox->findData( interpolatedWidth.isVariableWidth() ) );
121
122 whileBlocking( mDoubleSpinBoxWidth )->setValue( interpolatedWidth.fixedStrokeWidth() );
123 whileBlocking( mWidthStartFieldExpression )->setExpression( mLayer->dataDefinedProperties().property( QgsSymbolLayer::Property::LineStartWidthValue ).asExpression() );
124 whileBlocking( mWidthEndFieldExpression )->setExpression( mLayer->dataDefinedProperties().property( QgsSymbolLayer::Property::LineEndWidthValue ).asExpression() );
125 setLineEditValue( mLineEditWidthMinValue, interpolatedWidth.minimumValue() );
126 setLineEditValue( mLineEditWidthMaxValue, interpolatedWidth.maximumValue() );
127 whileBlocking( mDoubleSpinBoxMinWidth )->setValue( interpolatedWidth.minimumWidth() );
128 whileBlocking( mDoubleSpinBoxMaxWidth )->setValue( interpolatedWidth.maximumWidth() );
129 whileBlocking( mWidthUnitSelectionFixed )->setUnit( mLayer->widthUnit() );
130 whileBlocking( mWidthUnitSelectionVarying )->setUnit( mLayer->widthUnit() );
131 whileBlocking( mCheckBoxAbsoluteValue )->setChecked( interpolatedWidth.useAbsoluteValue() );
132 whileBlocking( mCheckBoxOutOfrange )->setChecked( interpolatedWidth.ignoreOutOfRange() );
133
134 const QgsInterpolatedLineColor interpolatedColor = mLayer->interpolatedColor();
135 whileBlocking( mColorMethodComboBox )->setCurrentIndex( mColorMethodComboBox->findData( interpolatedColor.coloringMethod() ) );
136
137 whileBlocking( mColorStartFieldExpression )->setExpression( mLayer->dataDefinedProperties().property( QgsSymbolLayer::Property::LineStartColorValue ).asExpression() );
138 whileBlocking( mColorEndFieldExpression )->setExpression( mLayer->dataDefinedProperties().property( QgsSymbolLayer::Property::LineEndColorValue ).asExpression() );
139 whileBlocking( mColorRampShaderWidget )->setFromShader( interpolatedColor.colorRampShader() );
140 setLineEditValue( mLineEditColorMinValue, interpolatedColor.colorRampShader().minimumValue() );
141 setLineEditValue( mLineEditColorMaxValue, interpolatedColor.colorRampShader().maximumValue() );
142 whileBlocking( mColorButton )->setColor( interpolatedColor.singleColor() );
143
144
145 updateVisibleWidget();
146}
147
149{
150 if ( !mLayer )
151 return nullptr;
152
153 return mLayer;
154}
155
156void QgsInterpolatedLineSymbolLayerWidget::apply()
157{
158 if ( !mLayer )
159 return;
160
161 bool isExpression = false;
162 QString fieldOrExpression = mWidthStartFieldExpression->currentField( &isExpression );
163 mLayer->setDataDefinedProperty( QgsSymbolLayer::Property::LineStartWidthValue, isExpression ? QgsProperty::fromExpression( fieldOrExpression ) : QgsProperty::fromField( fieldOrExpression ) );
164 fieldOrExpression = mWidthEndFieldExpression->currentField( &isExpression );
165 mLayer->setDataDefinedProperty( QgsSymbolLayer::Property::LineEndWidthValue, isExpression ? QgsProperty::fromExpression( fieldOrExpression ) : QgsProperty::fromField( fieldOrExpression ) );
166
167 mLayer->setInterpolatedWidth( interpolatedLineWidth() );
168 if ( mWidthMethodComboBox->currentData().toBool() )
169 mLayer->setWidthUnit( mWidthUnitSelectionVarying->unit() );
170 else
171 mLayer->setWidthUnit( mWidthUnitSelectionFixed->unit() );
172
173 fieldOrExpression = mColorStartFieldExpression->currentField( &isExpression );
174 mLayer->setDataDefinedProperty( QgsSymbolLayer::Property::LineStartColorValue, isExpression ? QgsProperty::fromExpression( fieldOrExpression ) : QgsProperty::fromField( fieldOrExpression ) );
175 fieldOrExpression = mColorEndFieldExpression->currentField( &isExpression );
176 mLayer->setDataDefinedProperty( QgsSymbolLayer::Property::LineEndColorValue, isExpression ? QgsProperty::fromExpression( fieldOrExpression ) : QgsProperty::fromField( fieldOrExpression ) );
177
178 mLayer->setInterpolatedColor( interpolatedLineColor() );
179
180 emit changed();
181}
182
183void QgsInterpolatedLineSymbolLayerWidget::updateVisibleWidget()
184{
185 mFixedWidthWidget->setVisible( !mWidthMethodComboBox->currentData().toBool() );
186 mVaryingWidthWidget->setVisible( mWidthMethodComboBox->currentData().toBool() );
187
188 mFixedColorWidget->setVisible(
189 static_cast<QgsInterpolatedLineColor::ColoringMethod>( mColorMethodComboBox->currentData().toInt() ) == QgsInterpolatedLineColor::SingleColor
190 );
191 mVaryingColorWidget->setVisible(
192 static_cast<QgsInterpolatedLineColor::ColoringMethod>( mColorMethodComboBox->currentData().toInt() ) == QgsInterpolatedLineColor::ColorRamp
193 );
194}
195
196void QgsInterpolatedLineSymbolLayerWidget::onReloadMinMaxValueWidth()
197{
198 reloadMinMaxWidthFromLayer();
199 setLineEditValue( mLineEditWidthMinValue, mMinimumForWidthFromLayer );
200 setLineEditValue( mLineEditWidthMaxValue, mMaximumForWidthFromLayer );
201 apply();
202}
203
204void QgsInterpolatedLineSymbolLayerWidget::onReloadMinMaxValueColor()
205{
206 reloadMinMaxColorFromLayer();
207 setLineEditValue( mLineEditColorMinValue, mMinimumForColorFromLayer );
208 setLineEditValue( mLineEditColorMaxValue, mMaximumForColorFromLayer );
209 onColorMinMaxLineTextEdited();
210}
211
212void QgsInterpolatedLineSymbolLayerWidget::reloadMinMaxWidthFromLayer()
213{
214 QgsExpressionContext expressionContext = createExpressionContext();
215
216 QgsExpression expressionStart( mWidthStartFieldExpression->expression() );
217 if ( !expressionStart.prepare( &expressionContext ) )
218 {
219 apply();
220 return;
221 }
222
223 QgsExpression expressionEnd( mWidthEndFieldExpression->expression() );
224 if ( !expressionEnd.prepare( &expressionContext ) )
225 {
226 apply();
227 return;
228 }
229
230 if ( !mLayer || !vectorLayer() )
231 {
232 apply();
233 return;
234 }
235
236 QgsFeatureIterator it = vectorLayer()->getFeatures();
237 QgsFeature feat;
238 mMinimumForWidthFromLayer = std::numeric_limits<double>::max();
239 mMaximumForWidthFromLayer = -std::numeric_limits<double>::max();
240 while ( it.nextFeature( feat ) )
241 {
242 expressionContext.setFeature( feat );
243 double startValue = expressionStart.evaluate( &expressionContext ).toDouble();
244 double endValue = expressionEnd.evaluate( &expressionContext ).toDouble();
245
246 if ( mCheckBoxAbsoluteValue->isChecked() )
247 {
248 startValue = fabs( startValue );
249 endValue = fabs( endValue );
250 }
251
252 if ( startValue < mMinimumForWidthFromLayer )
253 mMinimumForWidthFromLayer = startValue;
254 if ( startValue > mMaximumForWidthFromLayer )
255 mMaximumForWidthFromLayer = startValue;
256
257 if ( endValue < mMinimumForWidthFromLayer )
258 mMinimumForWidthFromLayer = endValue;
259 if ( endValue > mMaximumForWidthFromLayer )
260 mMaximumForWidthFromLayer = endValue;
261 }
262
263 if ( mLineEditWidthMinValue->text().isEmpty() && !std::isnan( mMinimumForWidthFromLayer ) )
264 {
265 setLineEditValue( mLineEditWidthMinValue, mMinimumForWidthFromLayer );
266 }
267
268 if ( mLineEditWidthMaxValue->text().isEmpty() && !std::isnan( mMaximumForWidthFromLayer ) )
269 {
270 setLineEditValue( mLineEditWidthMaxValue, mMaximumForWidthFromLayer );
271 }
272
273 apply();
274}
275
276void QgsInterpolatedLineSymbolLayerWidget::reloadMinMaxColorFromLayer()
277{
278 QgsExpressionContext expressionContext = createExpressionContext();
279
280 QgsExpression expressionStart( mColorStartFieldExpression->expression() );
281 if ( !expressionStart.prepare( &expressionContext ) )
282 {
283 apply();
284 return;
285 }
286
287 QgsExpression expressionEnd( mColorEndFieldExpression->expression() );
288 if ( !expressionEnd.prepare( &expressionContext ) )
289 {
290 apply();
291 return;
292 }
293
294 if ( !mLayer || !vectorLayer() )
295 {
296 apply();
297 return;
298 }
299
300 QgsFeatureIterator it = vectorLayer()->getFeatures();
301 QgsFeature feat;
302 mMinimumForColorFromLayer = std::numeric_limits<double>::max();
303 mMaximumForColorFromLayer = -std::numeric_limits<double>::max();
304 while ( it.nextFeature( feat ) )
305 {
306 expressionContext.setFeature( feat );
307 const double startValue = expressionStart.evaluate( &expressionContext ).toDouble();
308 const double endValue = expressionEnd.evaluate( &expressionContext ).toDouble();
309
310 if ( startValue < mMinimumForColorFromLayer )
311 mMinimumForColorFromLayer = startValue;
312 if ( startValue > mMaximumForColorFromLayer )
313 mMaximumForColorFromLayer = startValue;
314
315 if ( endValue < mMinimumForColorFromLayer )
316 mMinimumForColorFromLayer = endValue;
317 if ( endValue > mMaximumForColorFromLayer )
318 mMaximumForColorFromLayer = endValue;
319 }
320
321 bool minMaxColorChanged = false;
322 if ( mLineEditColorMinValue->text().isEmpty() && !std::isnan( mMinimumForColorFromLayer ) )
323 {
324 setLineEditValue( mLineEditColorMinValue, mMinimumForColorFromLayer );
325 minMaxColorChanged = true;
326 }
327
328 if ( mLineEditColorMaxValue->text().isEmpty() && !std::isnan( mMaximumForColorFromLayer ) )
329 {
330 setLineEditValue( mLineEditColorMaxValue, mMaximumForColorFromLayer );
331 minMaxColorChanged = true;
332 }
333
334 if ( minMaxColorChanged )
335 onColorMinMaxLineTextEdited();
336
337 apply();
338}
339
340void QgsInterpolatedLineSymbolLayerWidget::onColorMinMaxLineTextChanged()
341{
342 const double min = lineEditValue( mLineEditColorMinValue );
343 const double max = lineEditValue( mLineEditColorMaxValue );
344 whileBlocking( mColorRampShaderWidget )->setMinimumMaximum( min, max );
345 apply();
346}
347
348void QgsInterpolatedLineSymbolLayerWidget::onColorMinMaxLineTextEdited()
349{
350 const double min = lineEditValue( mLineEditColorMinValue );
351 const double max = lineEditValue( mLineEditColorMaxValue );
352 whileBlocking( mColorRampShaderWidget )->setMinimumMaximumAndClassify( min, max );
353 apply();
354}
355
356QgsInterpolatedLineWidth QgsInterpolatedLineSymbolLayerWidget::interpolatedLineWidth()
357{
358 QgsInterpolatedLineWidth interWidth;
359 interWidth.setIsVariableWidth( mWidthMethodComboBox->currentData().toBool() );
360 interWidth.setMinimumValue( lineEditValue( mLineEditWidthMinValue ) );
361 interWidth.setMaximumValue( lineEditValue( mLineEditWidthMaxValue ) );
362 interWidth.setMinimumWidth( mDoubleSpinBoxMinWidth->value() );
363 interWidth.setMaximumWidth( mDoubleSpinBoxMaxWidth->value() );
364 interWidth.setFixedStrokeWidth( mDoubleSpinBoxWidth->value() );
365 interWidth.setIgnoreOutOfRange( mCheckBoxOutOfrange->isChecked() );
366 interWidth.setUseAbsoluteValue( mCheckBoxAbsoluteValue->isChecked() );
367
368 return interWidth;
369}
370
371QgsInterpolatedLineColor QgsInterpolatedLineSymbolLayerWidget::interpolatedLineColor()
372{
373 QgsInterpolatedLineColor interColor;
374 interColor.setColor( mColorButton->color() );
375 const QgsColorRampShader colorRampShader = mColorRampShaderWidget->shader();
376 interColor.setColor( colorRampShader );
377 interColor.setColoringMethod( static_cast<QgsInterpolatedLineColor::ColoringMethod>( mColorMethodComboBox->currentData().toInt() ) );
378
379 return interColor;
380}
381
382double QgsInterpolatedLineSymbolLayerWidget::lineEditValue( QLineEdit *lineEdit )
383{
384 if ( lineEdit->text().isEmpty() )
385 {
386 return std::numeric_limits<double>::quiet_NaN();
387 }
388
389 return QgsDoubleValidator::toDouble( lineEdit->text() );
390}
391
392void QgsInterpolatedLineSymbolLayerWidget::setLineEditValue( QLineEdit *lineEdit, double value )
393{
394 QString strValue;
395 if ( !std::isnan( value ) )
396 strValue = QLocale().toString( value );
397 whileBlocking( lineEdit )->setText( strValue );
398}
@ Millimeters
Millimeters.
Definition qgis.h:5280
@ Points
Points (e.g., for font sizes).
Definition qgis.h:5284
@ MapUnits
Map units.
Definition qgis.h:5281
@ Pixels
Pixels.
Definition qgis.h:5282
@ Inches
Inches.
Definition qgis.h:5285
@ MetersInMapUnits
Meters value as Map units.
Definition qgis.h:5287
void colorChanged(const QColor &color)
Emitted whenever a new color is set for the button.
void widgetChanged()
Widget changed.
static double toDouble(const QString &input, bool *ok)
Converts input string to double value.
void setFeature(const QgsFeature &feature)
Convenience function for setting a feature for the context.
bool nextFeature(QgsFeature &f)
Fetch next feature and stores in f, returns true on success.
A widget for selection of layer fields or expression creation.
void fieldChanged(const QString &fieldName)
Emitted when the currently selected field changes.
@ Numeric
All numeric fields.
Defines color interpolation for rendering 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 features as interpolated lines.
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.
void setWidthUnit(Qgis::RenderUnit strokeWidthUnit)
Sets the width unit.
Represents a width that 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.
static QgsProperty fromExpression(const QString &expression, bool isActive=true)
Returns a new ExpressionBasedProperty created from the specified expression.
static QgsProperty fromField(const QString &fieldName, bool isActive=true)
Returns a new FieldBasedProperty created from the specified field name.
double maximumValue() const
Returns the minimum value for the raster shader.
double minimumValue() const
Returns the maximum value for the raster shader.
QgsVectorLayer * vectorLayer() const
Returns the vector layer associated with the widget.
QgsSymbolLayerWidget(QWidget *parent, QgsVectorLayer *vl=nullptr)
Constructor for QgsSymbolLayerWidget.
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...
Abstract base class for symbol layers.
@ 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.
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 dataset.
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:6828