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