18 #include "QDialogButtonBox"
34 mScalarMinSpinBox->setClearValueMode( QgsDoubleSpinBox::ClearValueMode::MinimumValue );
35 mScalarMinSpinBox->setSpecialValueText( QString( ) );
36 mScalarMaxSpinBox->setClearValueMode( QgsDoubleSpinBox::ClearValueMode::MinimumValue );
37 mScalarMaxSpinBox->setSpecialValueText( QString( ) );
42 mScalarInterpolationTypeComboBox->setCurrentIndex( 0 );
51 connect( mScalarRecalculateMinMaxButton, &QPushButton::clicked,
this, &QgsMeshRendererScalarSettingsWidget::recalculateMinMaxButtonClicked );
52 connect( mScalarMinSpinBox, qOverload<double>( &QgsDoubleSpinBox::valueChanged ),
this, [ = ](
double ) { minMaxChanged(); } );
53 connect( mScalarMaxSpinBox, qOverload<double>( &QgsDoubleSpinBox::valueChanged ),
this, [ = ](
double ) { minMaxChanged(); } );
54 connect( mScalarEdgeStrokeWidthVariableRadioButton, &QRadioButton::toggled,
this, &QgsMeshRendererScalarSettingsWidget::onEdgeStrokeWidthMethodChanged );
62 connect( mScalarEdgeStrokeWidthSpinBox, qOverload<double>( &QgsDoubleSpinBox::valueChanged ),
73 mScalarInterpolationTypeComboBox->setEnabled( !dataIsDefinedOnEdges() );
78 mActiveDatasetGroup = groupIndex;
79 mScalarInterpolationTypeComboBox->setEnabled( !dataIsDefinedOnEdges() );
90 const bool hasEdges = ( mMeshLayer->
contains( QgsMesh::ElementType::Edge ) );
95 edgeStrokeWidth.
setIsVariableWidth( mScalarEdgeStrokeWidthVariableRadioButton->isChecked() );
109 if ( mActiveDatasetGroup < 0 )
120 whileBlocking( mScalarColorRampShaderWidget )->setFromShader( shader );
121 whileBlocking( mScalarColorRampShaderWidget )->setMinimumMaximum( min, max );
124 whileBlocking( mScalarInterpolationTypeComboBox )->setCurrentIndex( index );
126 const bool hasEdges = ( mMeshLayer->
contains( QgsMesh::ElementType::Edge ) );
127 const bool hasFaces = ( mMeshLayer->
contains( QgsMesh::ElementType::Face ) );
129 mScalarResamplingWidget->setVisible( hasFaces );
131 mEdgeWidthGroupBox->setVisible( hasEdges );
136 whileBlocking( mScalarEdgeStrokeWidthVariablePushButton )->setVariableStrokeWidth( edgeStrokeWidth );
141 mOpacityContainerWidget->setVisible(
false );
144 const double min = metadata.
minimum();
145 const double max = metadata.
maximum();
146 mScalarEdgeStrokeWidthVariablePushButton->setDefaultMinMaxValue( min, max );
149 onEdgeStrokeWidthMethodChanged();
152 double QgsMeshRendererScalarSettingsWidget::spinBoxValue(
const QgsDoubleSpinBox *spinBox )
const
154 if ( spinBox->value() == spinBox->
clearValue() )
156 return std::numeric_limits<double>::quiet_NaN();
159 return spinBox->value();
162 void QgsMeshRendererScalarSettingsWidget::minMaxChanged()
164 const double min = spinBoxValue( mScalarMinSpinBox );
165 const double max = spinBoxValue( mScalarMaxSpinBox );
166 mScalarColorRampShaderWidget->setMinimumMaximumAndClassify( min, max );
169 void QgsMeshRendererScalarSettingsWidget::recalculateMinMaxButtonClicked()
172 const double min = metadata.
minimum();
173 const double max = metadata.
maximum();
176 mScalarColorRampShaderWidget->setMinimumMaximumAndClassify( min, max );
179 void QgsMeshRendererScalarSettingsWidget::onEdgeStrokeWidthMethodChanged()
181 const bool variableWidth = mScalarEdgeStrokeWidthVariableRadioButton->isChecked();
182 mScalarEdgeStrokeWidthVariablePushButton->setVisible( variableWidth );
183 mScalarEdgeStrokeWidthSpinBox->setVisible( !variableWidth );
188 const int data = mScalarInterpolationTypeComboBox->currentData().toInt();
193 bool QgsMeshRendererScalarSettingsWidget::dataIsDefinedOnFaces()
const
198 if ( mActiveDatasetGroup < 0 )
206 bool QgsMeshRendererScalarSettingsWidget::dataIsDefinedOnEdges()
const
211 if ( mActiveDatasetGroup < 0 )