Skip to content
Permalink
Browse files

raster cumulative cut optional limits

  • Loading branch information
blazek committed Jul 29, 2012
1 parent e8bbc2d commit 93cbb54a9dbadf01c1c924618a7cb17947b178e8
@@ -394,6 +394,9 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WFlags fl ) :
spnThreeBandStdDev->setValue( settings.value( "/Raster/defaultStandardDeviation", 2.0 ).toDouble() );
toggleStandardDeviation( chkUseStandardDeviation->checkState() );

mRasterCumulativeCutLowerDoubleSpinBox->setValue( 100.0 * settings.value( "/Raster/cumulativeCutLower", QString::number( QgsRasterLayer::CUMULATIVE_CUT_LOWER ) ).toDouble() );
mRasterCumulativeCutUpperDoubleSpinBox->setValue( 100.0 * settings.value( "/Raster/cumulativeCutUpper", QString::number( QgsRasterLayer::CUMULATIVE_CUT_UPPER ) ).toDouble() );

//set the color for selections
int myRed = settings.value( "/qgis/default_selection_color_red", 255 ).toInt();
int myGreen = settings.value( "/qgis/default_selection_color_green", 255 ).toInt();
@@ -885,6 +888,9 @@ void QgsOptions::saveOptions()
settings.setValue( "/Raster/useStandardDeviation", chkUseStandardDeviation->isChecked() );
settings.setValue( "/Raster/defaultStandardDeviation", spnThreeBandStdDev->value() );

settings.setValue( "/Raster/cumulativeCutLower", mRasterCumulativeCutLowerDoubleSpinBox->value() / 100.0 );
settings.setValue( "/Raster/cumulativeCutUpper", mRasterCumulativeCutUpperDoubleSpinBox->value() / 100.0 );

settings.setValue( "/Map/updateThreshold", spinBoxUpdateThreshold->value() );
//check behaviour so default projection when new layer is added with no
//projection defined...
@@ -912,6 +912,7 @@ void QgsRasterDataProvider::cumulativeCut( int theBandNo,
int myMaxCount = ( int ) qRound( theUpperCount * myHistogram.nonNullCount );
bool myLowerFound = false;
QgsDebugMsg( QString( "binCount = %1 minimum = %2 maximum = %3 myBinXStep = %4" ).arg( myHistogram.binCount ).arg( myHistogram.minimum ).arg( myHistogram.maximum ).arg( myBinXStep ) );
QgsDebugMsg( QString( "myMinCount = %1 myMaxCount = %2" ).arg( myMinCount ).arg( myMaxCount ) );

for ( int myBin = 0; myBin < myHistogram.histogramVector.size(); myBin++ )
{
@@ -15,6 +15,8 @@
* *
***************************************************************************/

#include <QSettings>

#include "qgsrasterlayer.h"
#include "qgsrasterminmaxwidget.h"

@@ -24,6 +26,12 @@ QgsRasterMinMaxWidget::QgsRasterMinMaxWidget( QgsRasterLayer* theLayer, QWidget
{
QgsDebugMsg( "Entered." );
setupUi( this );

QSettings mySettings;
double myLower = 100.0 * mySettings.value( "/Raster/cumulativeCutLower", QString::number( QgsRasterLayer::CUMULATIVE_CUT_LOWER ) ).toDouble();
double myUpper = 100.0 * mySettings.value( "/Raster/cumulativeCutUpper", QString::number( QgsRasterLayer::CUMULATIVE_CUT_UPPER ) ).toDouble();
mCumulativeCutLowerDoubleSpinBox->setValue( myLower );
mCumulativeCutUpperDoubleSpinBox->setValue( myUpper );
}

QgsRasterMinMaxWidget::~QgsRasterMinMaxWidget()
@@ -59,7 +67,9 @@ void QgsRasterMinMaxWidget::on_mLoadPushButton_clicked()

if ( mCumulativeCutRadioButton->isChecked() )
{
mLayer->dataProvider()->cumulativeCut( myBand, 0.02, 0.98, myMin, myMax, myExtent, mySampleSize );
double myLower = mCumulativeCutLowerDoubleSpinBox->value() / 100.0;
double myUpper = mCumulativeCutUpperDoubleSpinBox->value() / 100.0;
mLayer->dataProvider()->cumulativeCut( myBand, myLower, myUpper, myMin, myMax, myExtent, mySampleSize );
}
else if ( mMinMaxRadioButton->isChecked() )
{

0 comments on commit 93cbb54

Please sign in to comment.
You can’t perform that action at this time.