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() );
57 foreach (
int myBand,
mBands )
60 QgsDebugMsg( QString(
"myBand = %1" ).arg( myBand ) );
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 );
116 QMessageBox::warning(
this,
tr(
"No option selected" ),
tr(
"Please select an option to load min/max values." ) );
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.
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.
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.
static const double CUMULATIVE_CUT_LOWER
Default cumulative cut lower limit.
double minimumValue
The minimum cell value in the raster band.
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.