18#include "QDialogButtonBox"
32 mScalarMinSpinBox->setSpecialValueText( QString( ) );
34 mScalarMaxSpinBox->setSpecialValueText( QString( ) );
39 mScalarInterpolationTypeComboBox->setCurrentIndex( 0 );
41 mScalarEdgeStrokeWidthUnitSelectionWidget->setUnits(
50 connect( mScalarRecalculateMinMaxButton, &QPushButton::clicked,
this, &QgsMeshRendererScalarSettingsWidget::recalculateMinMaxButtonClicked );
51 connect( mScalarMinSpinBox, qOverload<double>( &QgsDoubleSpinBox::valueChanged ),
this, [ = ](
double ) { minMaxChanged(); } );
52 connect( mScalarMaxSpinBox, qOverload<double>( &QgsDoubleSpinBox::valueChanged ),
this, [ = ](
double ) { minMaxChanged(); } );
53 connect( mScalarEdgeStrokeWidthVariableRadioButton, &QRadioButton::toggled,
this, &QgsMeshRendererScalarSettingsWidget::onEdgeStrokeWidthMethodChanged );
61 connect( mScalarEdgeStrokeWidthSpinBox, qOverload<double>( &QgsDoubleSpinBox::valueChanged ),
72 mScalarInterpolationTypeComboBox->setEnabled( !dataIsDefinedOnEdges() );
77 mActiveDatasetGroup = groupIndex;
78 mScalarInterpolationTypeComboBox->setEnabled( !dataIsDefinedOnEdges() );
94 edgeStrokeWidth.
setIsVariableWidth( mScalarEdgeStrokeWidthVariableRadioButton->isChecked() );
108 if ( mActiveDatasetGroup < 0 )
119 whileBlocking( mScalarColorRampShaderWidget )->setFromShader( shader );
120 whileBlocking( mScalarColorRampShaderWidget )->setMinimumMaximum( min, max );
123 whileBlocking( mScalarInterpolationTypeComboBox )->setCurrentIndex( index );
128 mScalarResamplingWidget->setVisible( hasFaces );
130 mEdgeWidthGroupBox->setVisible( hasEdges );
135 whileBlocking( mScalarEdgeStrokeWidthVariablePushButton )->setVariableStrokeWidth( edgeStrokeWidth );
140 mOpacityContainerWidget->setVisible(
false );
143 const double min = metadata.
minimum();
144 const double max = metadata.
maximum();
145 mScalarEdgeStrokeWidthVariablePushButton->setDefaultMinMaxValue( min, max );
148 onEdgeStrokeWidthMethodChanged();
151double QgsMeshRendererScalarSettingsWidget::spinBoxValue(
const QgsDoubleSpinBox *spinBox )
const
153 if ( spinBox->value() == spinBox->
clearValue() )
155 return std::numeric_limits<double>::quiet_NaN();
158 return spinBox->value();
161void QgsMeshRendererScalarSettingsWidget::minMaxChanged()
163 const double min = spinBoxValue( mScalarMinSpinBox );
164 const double max = spinBoxValue( mScalarMaxSpinBox );
165 mScalarColorRampShaderWidget->setMinimumMaximumAndClassify( min, max );
168void QgsMeshRendererScalarSettingsWidget::recalculateMinMaxButtonClicked()
171 const double min = metadata.
minimum();
172 const double max = metadata.
maximum();
175 mScalarColorRampShaderWidget->setMinimumMaximumAndClassify( min, max );
178void QgsMeshRendererScalarSettingsWidget::onEdgeStrokeWidthMethodChanged()
180 const bool variableWidth = mScalarEdgeStrokeWidthVariableRadioButton->isChecked();
181 mScalarEdgeStrokeWidthVariablePushButton->setVisible( variableWidth );
182 mScalarEdgeStrokeWidthSpinBox->setVisible( !variableWidth );
187 const int data = mScalarInterpolationTypeComboBox->currentData().toInt();
192bool QgsMeshRendererScalarSettingsWidget::dataIsDefinedOnFaces()
const
197 if ( mActiveDatasetGroup < 0 )
205bool QgsMeshRendererScalarSettingsWidget::dataIsDefinedOnEdges()
const
210 if ( mActiveDatasetGroup < 0 )
@ Millimeters
Millimeters.
@ Points
Points (e.g., for font sizes)
@ MetersInMapUnits
Meters value as Map units.
A ramp shader will color a raster pixel based on a list of values ranges in a ramp.
The QgsSpinBox is a spin box with a clear button that will set the value to the defined clear value.
@ MinimumValue
Reset value to minimum()
Represents a width than can vary depending on values.
void setFixedStrokeWidth(double fixedWidth)
Sets the fixed width.
void setIsVariableWidth(bool isVariableWidth)
Returns whether the width is variable.
double fixedStrokeWidth() const
Returns the fixed width.
bool isVariableWidth() const
Returns whether the width is variable.
Represents a mesh layer supporting display of data on structured or unstructured meshes.
bool contains(const QgsMesh::ElementType &type) const
Returns whether the mesh contains at mesh elements of given type.
QgsMeshRendererSettings rendererSettings() const
Returns renderer settings.
QgsMeshDatasetGroupMetadata datasetGroupMetadata(const QgsMeshDatasetIndex &index) const
Returns the dataset groups metadata.
Represents a mesh renderer settings for scalar datasets.
void setClassificationMinimumMaximum(double minimum, double maximum)
Sets min/max values used for creation of the color ramp shader.
double opacity() const
Returns opacity.
void setEdgeStrokeWidthUnit(Qgis::RenderUnit edgeStrokeWidthUnit)
Sets the stroke width unit used to render edges scalar dataset.
void setColorRampShader(const QgsColorRampShader &shader)
Sets color ramp shader function.
QgsColorRampShader colorRampShader() const
Returns color ramp shader function.
double classificationMinimum() const
Returns min value used for creation of the color ramp shader.
void setOpacity(double opacity)
Sets opacity.
DataResamplingMethod
Resampling of value from dataset.
@ NoResampling
Does not use resampling.
@ NeighbourAverage
Does a simple average of values defined for all surrounding faces/vertices.
Qgis::RenderUnit edgeStrokeWidthUnit() const
Returns the stroke width unit used to render edges scalar dataset.
DataResamplingMethod dataResamplingMethod() const
Returns the type of interpolation to use to convert face defined datasets to values on vertices.
void setEdgeStrokeWidth(const QgsInterpolatedLineWidth &strokeWidth)
Sets the stroke width used to render edges scalar dataset.
double classificationMaximum() const
Returns max value used for creation of the color ramp shader.
QgsInterpolatedLineWidth edgeStrokeWidth() const
Returns the stroke width used to render edges scalar dataset.
void setDataResamplingMethod(const DataResamplingMethod &dataResamplingMethod)
Sets data interpolation method.
Represents all mesh renderer settings.
QgsMeshRendererScalarSettings scalarSettings(int groupIndex) const
Returns renderer settings.
QgsSignalBlocker< Object > whileBlocking(Object *object)
Temporarily blocks signals from a QObject while calling a single method from the object.