QGIS API Documentation
3.26.3-Buenos Aires (65e4edfdad)
|
Go to the documentation of this file.
28 , mDisableMinMaxWidgetRefresh( false )
31 connect( mMinLineEdit, &QLineEdit::textChanged,
this, &QgsSingleBandGrayRendererWidget::mMinLineEdit_textChanged );
32 connect( mMaxLineEdit, &QLineEdit::textChanged,
this, &QgsSingleBandGrayRendererWidget::mMaxLineEdit_textChanged );
34 connect( mLegendSettingsButton, &QPushButton::clicked,
this, &QgsSingleBandGrayRendererWidget::showLegendSettings );
54 QHBoxLayout *layout =
new QHBoxLayout();
55 layout->setContentsMargins( 0, 0, 0, 0 );
56 mMinMaxContainerWidget->setLayout( layout );
57 layout->addWidget( mMinMaxWidget );
92 const int band = mGrayBandComboBox->currentBand();
101 renderer->setContrastEnhancement( e );
122 void QgsSingleBandGrayRendererWidget::mMinLineEdit_textChanged(
const QString & )
127 void QgsSingleBandGrayRendererWidget::mMaxLineEdit_textChanged(
const QString & )
132 void QgsSingleBandGrayRendererWidget::minMaxModified()
134 if ( !mDisableMinMaxWidgetRefresh )
138 mContrastEnhancementComboBox->setCurrentIndex(
151 QgsDebugMsg( QStringLiteral(
"theBandNo = %1 min = %2 max = %3" ).arg( bandNo ).arg(
min ).arg(
max ) );
153 mDisableMinMaxWidgetRefresh =
true;
154 if ( std::isnan(
min ) )
156 mMinLineEdit->clear();
160 mMinLineEdit->setText( QLocale().toString(
min ) );
163 if ( std::isnan(
max ) )
165 mMaxLineEdit->clear();
169 mMaxLineEdit->setText( QLocale().toString(
max ) );
171 mDisableMinMaxWidgetRefresh =
false;
174 void QgsSingleBandGrayRendererWidget::bandChanged()
177 myBands.append( mGrayBandComboBox->currentBand() );
188 mGrayBandComboBox->setBand( gr->
grayBand() );
190 mGradientComboBox->setCurrentIndex( mGradientComboBox->findData( gr->
gradient() ) );
196 mDisableMinMaxWidgetRefresh =
true;
197 mMinLineEdit->setText( QLocale().toString( ce->
minimumValue() ) );
198 mMaxLineEdit->setText( QLocale().toString( ce->
maximumValue() ) );
199 mDisableMinMaxWidgetRefresh =
false;
201 mContrastEnhancementComboBox->setCurrentIndex(
214 mDisableMinMaxWidgetRefresh =
true;
215 mMinLineEdit->setText( value );
216 mDisableMinMaxWidgetRefresh =
false;
221 mDisableMinMaxWidgetRefresh =
true;
222 mMaxLineEdit->setText( value );
223 mDisableMinMaxWidgetRefresh =
false;
226 void QgsSingleBandGrayRendererWidget::showLegendSettings()
237 mLegendSettings = legendPanel->
settings();
245 dialog.setUseContinuousRampCheckBoxVisibility(
false );
246 dialog.setWindowTitle( tr(
"Legend Settings" ) );
249 mLegendSettings = dialog.settings();
262 mDisableMinMaxWidgetRefresh =
true;
263 mContrastEnhancementComboBox->setCurrentIndex( mContrastEnhancementComboBox->findData(
static_cast<int>(
algorithm ) ) );
264 mDisableMinMaxWidgetRefresh =
false;
double maximumValue() const
Returns the maximum value for the contrast enhancement range.
void bandChanged(int band)
Emitted when the currently selected band changes.
void setContrastEnhancementAlgorithm(ContrastEnhancementAlgorithm algorithm, bool generateTable=true)
Sets the contrast enhancement algorithm.
Qgis::DataType dataType(int bandNo) const override=0
Returns data type for the band specified by number.
double minimumValue() const
Returns the minimum value for the contrast enhancement range.
const QgsColorRampLegendNodeSettings * legendSettings() const
Returns the color ramp shader legend settings.
const QgsRasterMinMaxOrigin & minMaxOrigin() const
Returns const reference to origin of min/max values.
As part of the API refactoring and improvements which landed in the Processing API was substantially reworked from the x version This was done in order to allow much of the underlying Processing framework to be ported into allowing algorithms to be written in pure substantial changes are required in order to port existing x Processing algorithms for QGIS x The most significant changes are outlined not GeoAlgorithm For algorithms which operate on features one by consider subclassing the QgsProcessingFeatureBasedAlgorithm class This class allows much of the boilerplate code for looping over features from a vector layer to be bypassed and instead requires implementation of a processFeature method Ensure that your algorithm(or algorithm 's parent class) implements the new pure virtual createInstance(self) call
void setMinimumValue(double value, bool generateTable=true)
Sets the minimum value for the contrast enhancement range.
Map canvas is a class for displaying all GIS data types on a canvas.
DataType
Raster data types.
@ StretchAndClipToMinimumMaximum
Raster renderer pipe for single band gray.
Gradient gradient() const
A rectangle specified with double values.
const QgsContrastEnhancement * contrastEnhancement() const
QgsRasterRenderer * renderer() const
Returns the raster's renderer.
A dialog for configuring a QgsColorRampLegendNode (QgsColorRampLegendNodeSettings).
ContrastEnhancementAlgorithm
This enumerator describes the types of contrast enhancement algorithms that can be used.
Raster renderer pipe that applies colors to a raster.
@ StretchToMinimumMaximum
Linear histogram.
@ NoEnhancement
Default color scaling algorithm, no scaling is applied.
QgsDoubleValidator is a QLineEdit Validator that combines QDoubleValidator and QRegularExpressionVali...
ContrastEnhancementAlgorithm contrastEnhancementAlgorithm() const
Represents a raster layer.
Manipulates raster or point cloud pixel values so that they enhanceContrast or clip into a specified ...
void setMinMaxOrigin(const QgsRasterMinMaxOrigin &origin)
Sets origin of min/max values.
static double toDouble(const QString &input, bool *ok)
Converts input string to double value.
void setMaximumValue(double value, bool generateTable=true)
Sets the maximum value for the contrast enhancement range.
Base class for raster data providers.
Settings for a color ramp legend node.
QgsRasterDataProvider * dataProvider() override
Returns the source data provider.