19 #include <QMessageBox> 37 QString contrastEnchacementLimits = mySettings.
value(
"/Raster/defaultContrastEnhancementLimits",
"CumulativeCut" ).
toString();
38 if ( contrastEnchacementLimits ==
"MinMax" )
39 mMinMaxRadioButton->setChecked(
true );
40 else if ( contrastEnchacementLimits ==
"StdDev" )
41 mStdDevRadioButton->setChecked(
true );
45 mCumulativeCutLowerDoubleSpinBox->setValue( myLower );
46 mCumulativeCutUpperDoubleSpinBox->setValue( myUpper );
48 mStdDevSpinBox->setValue( mySettings.
value(
"/Raster/defaultStandardDeviation", 2.0 ).
toDouble() );
67 if ( !cbxClipExtent->isChecked() )
70 if ( mLayer && mCanvas )
78 void QgsRasterMinMaxWidget::on_mLoadPushButton_clicked()
82 Q_FOREACH (
int myBand, mBands )
90 double myMin = std::numeric_limits<double>::quiet_NaN();
91 double myMax = std::numeric_limits<double>::quiet_NaN();
94 if ( cbxClipExtent->isChecked() )
105 if ( cboAccuracy->currentIndex() == 0 )
114 if ( mCumulativeCutRadioButton->isChecked() )
116 double myLower = mCumulativeCutLowerDoubleSpinBox->value() / 100.0;
117 double myUpper = mCumulativeCutUpperDoubleSpinBox->value() / 100.0;
121 else if ( mMinMaxRadioButton->isChecked() )
129 else if ( mStdDevRadioButton->isChecked() )
132 double myStdDev = mStdDevSpinBox->value();
133 myMin = myRasterBandStats.
mean - ( myStdDev * myRasterBandStats.
stdDev );
134 myMax = myRasterBandStats.
mean + ( myStdDev * myRasterBandStats.
stdDev );
143 emit
load( myBand, myMin, myMax, origin );
virtual int bandCount() const =0
Get number of bands.
A rectangle specified with double values.
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)
Map canvas is a class for displaying all GIS data types on a canvas.
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.
bool isEmpty() const
test if rectangle is empty.
static const double CUMULATIVE_CUT_UPPER
Default cumulative cut upper limit.
QgsRectangle extent() const
Returns the current zoom exent of the map canvas.
const QgsMapSettings & mapSettings() const
Get access to properties used for map rendering.
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.
QgsRectangle outputExtentToLayerExtent(QgsMapLayer *theLayer, QgsRectangle extent) const
transform bounding box from output CRS to layer's CRS