27 QVector<QgsDoubleSpinBox *> widgets;
28 widgets << mMinMagSpinBox << mMaxMagSpinBox
29 << mHeadWidthSpinBox << mHeadLengthSpinBox
30 << mMinimumShaftSpinBox << mMaximumShaftSpinBox
31 << mScaleShaftByFactorOfSpinBox << mShaftLengthSpinBox;
34 for (
const auto &widget : std::as_const( widgets ) )
36 widget->setClearValueMode( QgsDoubleSpinBox::ClearValueMode::MinimumValue );
37 widget->setSpecialValueText( QString( ) );
38 widget->setValue( widget->minimum() );
41 mShaftLengthComboBox->setCurrentIndex( -1 );
46 mXSpacingSpinBox->setClearValue( 10.0 );
47 mYSpacingSpinBox->setClearValue( 10.0 );
48 mStreamlinesDensitySpinBox->setClearValue( 15.0 );
49 mTracesParticlesCountSpinBox->setClearValue( 1000 );
50 mTracesMaxLengthSpinBox->setClearValue( 100.0 );
53 connect( mColoringMethodComboBox, qOverload<int>( &QComboBox::currentIndexChanged ),
54 this, &QgsMeshRendererVectorSettingsWidget::onColoringMethodChanged );
57 connect( mColorRampShaderMinimumSpinBox, qOverload<double>( &QgsDoubleSpinBox::valueChanged ),
58 this, &QgsMeshRendererVectorSettingsWidget::onColorRampMinMaxChanged );
59 connect( mColorRampShaderMaximumSpinBox, qOverload<double>( &QgsDoubleSpinBox::valueChanged ),
60 this, &QgsMeshRendererVectorSettingsWidget::onColorRampMinMaxChanged );
62 connect( mLineWidthSpinBox, qOverload<double>( &QgsDoubleSpinBox::valueChanged ),
65 connect( mShaftLengthComboBox, qOverload<int>( &QComboBox::currentIndexChanged ),
68 connect( mShaftLengthComboBox, qOverload<int>( &QComboBox::currentIndexChanged ),
69 mShaftOptionsStackedWidget, &QStackedWidget::setCurrentIndex );
73 connect( mColorRampShaderLoadButton, &QPushButton::clicked,
this, &QgsMeshRendererVectorSettingsWidget::loadColorRampShader );
75 onColoringMethodChanged();
77 for (
const auto &widget : std::as_const( widgets ) )
85 connect( mSymbologyVectorComboBox, qOverload<int>( &QComboBox::currentIndexChanged ),
86 this, &QgsMeshRendererVectorSettingsWidget::onSymbologyChanged );
87 onSymbologyChanged( 0 );
89 connect( mSymbologyVectorComboBox, qOverload<int>( &QComboBox::currentIndexChanged ),
92 connect( mStreamlinesSeedingMethodComboBox, qOverload<int>( &QComboBox::currentIndexChanged ),
93 this, &QgsMeshRendererVectorSettingsWidget::onStreamLineSeedingMethodChanged );
94 onStreamLineSeedingMethodChanged( 0 );
96 connect( mStreamlinesSeedingMethodComboBox, qOverload<int>( &QComboBox::currentIndexChanged ),
99 connect( mStreamlinesDensitySpinBox, qOverload<double>( &QgsDoubleSpinBox::valueChanged ),
102 connect( mTracesMaxLengthSpinBox, qOverload<double>( &QgsDoubleSpinBox::valueChanged ),
105 connect( mTracesParticlesCountSpinBox, qOverload<int>( &QgsSpinBox::valueChanged ),
136 ( mColoringMethodComboBox->currentData().toInt() ) );
140 double val = filterValue( mMinMagSpinBox, -1 );
143 val = filterValue( mMaxMagSpinBox, -1 );
154 bool enabled = mDisplayVectorsOnGridGroupBox->isChecked();
163 val = filterValue( mMinimumShaftSpinBox, arrowSettings.
minShaftLength() );
166 val = filterValue( mMaximumShaftSpinBox, arrowSettings.
maxShaftLength() );
169 val = filterValue( mScaleShaftByFactorOfSpinBox, arrowSettings.
scaleFactor() );
182 streamlineSettings.
setSeedingDensity( mStreamlinesDensitySpinBox->value() / 100 );
201 if ( mActiveDatasetGroup < 0 )
210 symbologyLabel->setVisible( hasFaces );
211 mSymbologyVectorComboBox->setVisible( hasFaces );
212 mSymbologyVectorComboBox->setCurrentIndex( hasFaces ?
settings.
symbology() : 0 );
220 mColoringMethodComboBox->setCurrentIndex( mColoringMethodComboBox->findData(
settings.
coloringMethod() ) );
240 mDisplayVectorsOnGridGroupBox->setVisible( hasFaces );
250 mScaleShaftByFactorOfSpinBox->setValue( arrowSettings.
scaleFactor() );
256 mStreamlinesSeedingMethodComboBox->setCurrentIndex( streamlinesSettings.
seedingMethod() );
257 mStreamlinesDensitySpinBox->setValue( streamlinesSettings.
seedingDensity() * 100 );
264 mTracesParticlesCountSpinBox->setValue( tracesSettings.
particlesCount() );
268 void QgsMeshRendererVectorSettingsWidget::onSymbologyChanged(
int currentIndex )
282 mDisplayVectorsOnGridGroupBox->setEnabled(
288 void QgsMeshRendererVectorSettingsWidget::onStreamLineSeedingMethodChanged(
int currentIndex )
291 mStreamlinesDensityLabel->setEnabled( enabled );
292 mStreamlinesDensitySpinBox->setEnabled( enabled );
294 mDisplayVectorsOnGridGroupBox->setEnabled( !enabled );
297 void QgsMeshRendererVectorSettingsWidget::onColoringMethodChanged()
303 if ( mColorRampShaderWidget->shader().colorRampItemList().isEmpty() )
304 loadColorRampShader();
309 void QgsMeshRendererVectorSettingsWidget::onColorRampMinMaxChanged()
311 mColorRampShaderWidget->setMinimumMaximumAndClassify(
312 filterValue( mColorRampShaderMinimumSpinBox, 0 ),
313 filterValue( mColorRampShaderMaximumSpinBox, 0 ) );
316 void QgsMeshRendererVectorSettingsWidget::loadColorRampShader()
322 if ( currentVectorDataSetGroupIndex < 0 ||
330 mColorRampShaderWidget->setMinimumMaximumAndClassify( min, max );
331 whileBlocking( mColorRampShaderMinimumSpinBox )->setValue( min );
332 whileBlocking( mColorRampShaderMaximumSpinBox )->setValue( max );
335 double QgsMeshRendererVectorSettingsWidget::filterValue(
const QgsDoubleSpinBox *spinBox,
double errVal )
const
337 if ( spinBox->value() == spinBox->
clearValue() )
340 return spinBox->value();