17#include "moc_qgsmeshrendererscalarsettingswidget.cpp"
19#include "QDialogButtonBox"
33 mScalarMinSpinBox->setSpecialValueText( QString() );
35 mScalarMaxSpinBox->setSpecialValueText( QString() );
40 mScalarInterpolationTypeComboBox->setCurrentIndex( 0 );
42 mScalarEdgeStrokeWidthUnitSelectionWidget->setUnits(
52 connect( mScalarRecalculateMinMaxButton, &QPushButton::clicked,
this, &QgsMeshRendererScalarSettingsWidget::recalculateMinMaxButtonClicked );
53 connect( mScalarMinSpinBox, qOverload<double>( &QgsDoubleSpinBox::valueChanged ),
this, [=](
double ) { minMaxChanged(); } );
54 connect( mScalarMaxSpinBox, qOverload<double>( &QgsDoubleSpinBox::valueChanged ),
this, [=](
double ) { minMaxChanged(); } );
55 connect( mScalarEdgeStrokeWidthVariableRadioButton, &QRadioButton::toggled,
this, &QgsMeshRendererScalarSettingsWidget::onEdgeStrokeWidthMethodChanged );
71 mScalarInterpolationTypeComboBox->setEnabled( !dataIsDefinedOnEdges() );
76 mActiveDatasetGroup = groupIndex;
77 mScalarInterpolationTypeComboBox->setEnabled( !dataIsDefinedOnEdges() );
92 edgeStrokeWidth.
setIsVariableWidth( mScalarEdgeStrokeWidthVariableRadioButton->isChecked() );
106 if ( mActiveDatasetGroup < 0 )
117 whileBlocking( mScalarColorRampShaderWidget )->setFromShader( shader );
118 whileBlocking( mScalarColorRampShaderWidget )->setMinimumMaximum( min, max );
121 whileBlocking( mScalarInterpolationTypeComboBox )->setCurrentIndex( index );
126 mScalarResamplingWidget->setVisible( hasFaces );
128 mEdgeWidthGroupBox->setVisible( hasEdges );
133 whileBlocking( mScalarEdgeStrokeWidthVariablePushButton )->setVariableStrokeWidth( edgeStrokeWidth );
138 mOpacityContainerWidget->setVisible(
false );
141 const double min = metadata.
minimum();
142 const double max = metadata.
maximum();
143 mScalarEdgeStrokeWidthVariablePushButton->setDefaultMinMaxValue( min, max );
146 onEdgeStrokeWidthMethodChanged();
149double QgsMeshRendererScalarSettingsWidget::spinBoxValue(
const QgsDoubleSpinBox *spinBox )
const
151 if ( spinBox->value() == spinBox->
clearValue() )
153 return std::numeric_limits<double>::quiet_NaN();
156 return spinBox->value();
159void QgsMeshRendererScalarSettingsWidget::minMaxChanged()
161 const double min = spinBoxValue( mScalarMinSpinBox );
162 const double max = spinBoxValue( mScalarMaxSpinBox );
163 mScalarColorRampShaderWidget->setMinimumMaximumAndClassify( min, max );
166void QgsMeshRendererScalarSettingsWidget::recalculateMinMaxButtonClicked()
169 const double min = metadata.
minimum();
170 const double max = metadata.
maximum();
173 mScalarColorRampShaderWidget->setMinimumMaximumAndClassify( min, max );
176void QgsMeshRendererScalarSettingsWidget::onEdgeStrokeWidthMethodChanged()
178 const bool variableWidth = mScalarEdgeStrokeWidthVariableRadioButton->isChecked();
179 mScalarEdgeStrokeWidthVariablePushButton->setVisible( variableWidth );
180 mScalarEdgeStrokeWidthSpinBox->setVisible( !variableWidth );
185 const int data = mScalarInterpolationTypeComboBox->currentData().toInt();
190bool QgsMeshRendererScalarSettingsWidget::dataIsDefinedOnFaces()
const
195 if ( mActiveDatasetGroup < 0 )
203bool QgsMeshRendererScalarSettingsWidget::dataIsDefinedOnEdges()
const
208 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.