19#include "moc_qgssinglebandgrayrendererwidget.cpp"
29 , mDisableMinMaxWidgetRefresh( false )
32 connect( mMinLineEdit, &QLineEdit::textChanged,
this, &QgsSingleBandGrayRendererWidget::mMinLineEdit_textChanged );
33 connect( mMaxLineEdit, &QLineEdit::textChanged,
this, &QgsSingleBandGrayRendererWidget::mMaxLineEdit_textChanged );
35 connect( mLegendSettingsButton, &QPushButton::clicked,
this, &QgsSingleBandGrayRendererWidget::showLegendSettings );
55 QHBoxLayout *layout =
new QHBoxLayout();
56 layout->setContentsMargins( 0, 0, 0, 0 );
57 mMinMaxContainerWidget->setLayout( layout );
58 layout->addWidget( mMinMaxWidget );
91 const int band = mGrayBandComboBox->currentBand();
101 renderer->setContrastEnhancement( e );
122void QgsSingleBandGrayRendererWidget::mMinLineEdit_textChanged(
const QString & )
127void QgsSingleBandGrayRendererWidget::mMaxLineEdit_textChanged(
const QString & )
132void QgsSingleBandGrayRendererWidget::minMaxModified()
134 if ( !mDisableMinMaxWidgetRefresh )
138 mContrastEnhancementComboBox->setCurrentIndex(
152 QgsDebugMsgLevel( QStringLiteral(
"theBandNo = %1 min = %2 max = %3" ).arg( bandNo ).arg(
min ).arg(
max ), 2 );
154 mDisableMinMaxWidgetRefresh =
true;
155 if ( std::isnan(
min ) )
157 mMinLineEdit->clear();
161 mMinLineEdit->setText( QLocale().toString(
min ) );
164 if ( std::isnan(
max ) )
166 mMaxLineEdit->clear();
170 mMaxLineEdit->setText( QLocale().toString(
max ) );
172 mDisableMinMaxWidgetRefresh =
false;
175void QgsSingleBandGrayRendererWidget::bandChanged()
178 myBands.append( mGrayBandComboBox->currentBand() );
189 mGrayBandComboBox->setBand( gr->
inputBand() );
191 mGradientComboBox->setCurrentIndex( mGradientComboBox->findData( gr->
gradient() ) );
197 mDisableMinMaxWidgetRefresh =
true;
198 mMinLineEdit->setText( QLocale().toString( ce->
minimumValue() ) );
199 mMaxLineEdit->setText( QLocale().toString( ce->
maximumValue() ) );
200 mDisableMinMaxWidgetRefresh =
false;
202 mContrastEnhancementComboBox->setCurrentIndex(
216 mDisableMinMaxWidgetRefresh =
true;
217 mMinLineEdit->setText( value );
218 mDisableMinMaxWidgetRefresh =
false;
223 mDisableMinMaxWidgetRefresh =
true;
224 mMaxLineEdit->setText( value );
225 mDisableMinMaxWidgetRefresh =
false;
228void QgsSingleBandGrayRendererWidget::showLegendSettings()
238 mLegendSettings = legendPanel->
settings();
246 dialog.setUseContinuousRampCheckBoxVisibility(
false );
247 dialog.setWindowTitle( tr(
"Legend Settings" ) );
250 mLegendSettings = dialog.settings();
263 mDisableMinMaxWidgetRefresh =
true;
264 mContrastEnhancementComboBox->setCurrentIndex( mContrastEnhancementComboBox->findData(
static_cast<int>(
algorithm ) ) );
265 mDisableMinMaxWidgetRefresh =
false;
DataType
Raster data types.
A dialog for configuring a QgsColorRampLegendNode (QgsColorRampLegendNodeSettings).
Settings for a color ramp legend node.
Manipulates raster or point cloud pixel values so that they enhanceContrast or clip into a specified ...
ContrastEnhancementAlgorithm
This enumerator describes the types of contrast enhancement algorithms that can be used.
@ StretchToMinimumMaximum
Linear histogram.
@ StretchAndClipToMinimumMaximum
@ NoEnhancement
Default color scaling algorithm, no scaling is applied.
void setMinimumValue(double value, bool generateTable=true)
Sets the minimum value for the contrast enhancement range.
void setContrastEnhancementAlgorithm(ContrastEnhancementAlgorithm algorithm, bool generateTable=true)
Sets the contrast enhancement algorithm.
double minimumValue() const
Returns the minimum value for the contrast enhancement range.
ContrastEnhancementAlgorithm contrastEnhancementAlgorithm() const
void setMaximumValue(double value, bool generateTable=true)
Sets the maximum value for the contrast enhancement range.
double maximumValue() const
Returns the maximum value for the contrast enhancement range.
QgsDoubleValidator is a QLineEdit Validator that combines QDoubleValidator and QRegularExpressionVali...
static double toDouble(const QString &input, bool *ok)
Converts input string to double value.
Map canvas is a class for displaying all GIS data types on a canvas.
void bandChanged(int band)
Emitted when the currently selected band changes.
Base class for raster data providers.
Qgis::DataType dataType(int bandNo) const override=0
Returns data type for the band specified by number.
Represents a raster layer.
QgsRasterRenderer * renderer() const
Returns the raster's renderer.
QgsRasterDataProvider * dataProvider() override
Returns the source data provider.
Raster renderer pipe that applies colors to a raster.
void setMinMaxOrigin(const QgsRasterMinMaxOrigin &origin)
Sets origin of min/max values.
const QgsRasterMinMaxOrigin & minMaxOrigin() const
Returns const reference to origin of min/max values.
A rectangle specified with double values.
Raster renderer pipe for single band gray.
const QgsContrastEnhancement * contrastEnhancement() const
Gradient gradient() const
const QgsColorRampLegendNodeSettings * legendSettings() const
Returns the color ramp shader legend settings.
int inputBand() const override
Returns the input band for the renderer, or -1 if no input band is available.
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
#define QgsDebugMsgLevel(str, level)