19 #include <QMessageBox>
35 QString contrastEnchacementLimits = mySettings.
value(
"/Raster/defaultContrastEnhancementLimits",
"CumulativeCut" ).
toString();
36 if ( contrastEnchacementLimits ==
"MinMax" )
37 mMinMaxRadioButton->setChecked(
true );
38 else if ( contrastEnchacementLimits ==
"StdDev" )
39 mStdDevRadioButton->setChecked(
true );
43 mCumulativeCutLowerDoubleSpinBox->setValue( myLower );
44 mCumulativeCutUpperDoubleSpinBox->setValue( myUpper );
46 mStdDevSpinBox->setValue( mySettings.
value(
"/Raster/defaultStandardDeviation", 2.0 ).
toDouble() );
53 void QgsRasterMinMaxWidget::on_mLoadPushButton_clicked()
57 foreach (
int myBand, mBands )
65 double myMin = std::numeric_limits<double>::quiet_NaN();
66 double myMax = std::numeric_limits<double>::quiet_NaN();
69 if ( mCurrentExtentRadioButton->isChecked() )
81 if ( mEstimateRadioButton->isChecked() )
83 mySampleSize = 250000;
91 if ( mCumulativeCutRadioButton->isChecked() )
93 double myLower = mCumulativeCutLowerDoubleSpinBox->value() / 100.0;
94 double myUpper = mCumulativeCutUpperDoubleSpinBox->value() / 100.0;
98 else if ( mMinMaxRadioButton->isChecked() )
106 else if ( mStdDevRadioButton->isChecked() )
109 double myStdDev = mStdDevSpinBox->value();
110 myMin = myRasterBandStats.
mean - ( myStdDev * myRasterBandStats.
stdDev );
111 myMax = myRasterBandStats.
mean + ( myStdDev * myRasterBandStats.
stdDev );
120 emit
load( myBand, myMin, myMax, origin );
virtual int bandCount() const =0
Get number of bands.
A rectangle specified with double values.
bool isEmpty() const
test if rectangle is empty.
This class provides qgis with the ability to render raster datasets onto the mapcanvas.
double maximumValue
The maximum cell value in the raster band.
QString tr(const char *sourceText, const char *disambiguation, int n)
virtual QgsRasterBandStats bandStatistics(int theBandNo, int theStats=QgsRasterBandStats::All, const QgsRectangle &theExtent=QgsRectangle(), int theSampleSize=0)
Get band statistics.
double stdDev
The standard deviation of the cell values.
QString number(int n, int base)
The RasterBandStats struct is a container for statistics about a single raster band.
double mean
The mean cell value for the band.
static const double CUMULATIVE_CUT_UPPER
Default cumulative cut upper limit.
QVariant value(const QString &key, const QVariant &defaultValue) const
static const double CUMULATIVE_CUT_LOWER
Default cumulative cut lower limit.
double minimumValue
The minimum cell value in the raster band.
StandardButton warning(QWidget *parent, const QString &title, const QString &text, QFlags< QMessageBox::StandardButton > buttons, StandardButton defaultButton)
double toDouble(bool *ok) const
QgsRasterDataProvider * dataProvider()
Returns the data provider.
virtual void cumulativeCut(int theBandNo, double theLowerCount, double theUpperCount, double &theLowerValue, double &theUpperValue, const QgsRectangle &theExtent=QgsRectangle(), int theSampleSize=0)
Find values for cumulative pixel count cut.