Skip to content
Permalink
Browse files

fix UI inconsistencies in raster min/max widget

  • Loading branch information
etiennesky committed Apr 17, 2014
1 parent 3e4a915 commit b754ee70b8234b589626672382a7684254ff5ec4
Showing with 29 additions and 0 deletions.
  1. +17 −0 src/gui/raster/qgsrasterminmaxwidget.cpp
  2. +12 −0 src/ui/qgsrasterminmaxwidgetbase.ui
@@ -16,6 +16,7 @@
***************************************************************************/

#include <QSettings>
#include <QMessageBox>

#include "qgsrasterlayer.h"
#include "qgsrasterminmaxwidget.h"
@@ -28,10 +29,21 @@ QgsRasterMinMaxWidget::QgsRasterMinMaxWidget( QgsRasterLayer* theLayer, QWidget
setupUi( this );

QSettings mySettings;

// set contrast enhancement setting to default
// ideally we should set it actual method last used to get min/max, but there is no way to know currently
QString contrastEnchacementLimits = mySettings.value( "/Raster/defaultContrastEnhancementLimits", "CumulativeCut" ).toString();
if ( contrastEnchacementLimits == "MinMax" )
mMinMaxRadioButton->setChecked( true );
else if ( contrastEnchacementLimits == "StdDev" )
mStdDevRadioButton->setChecked( true );

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 );

mStdDevSpinBox->setValue( mySettings.value( "/Raster/defaultStandardDeviation", 2.0 ).toDouble() );
}

QgsRasterMinMaxWidget::~QgsRasterMinMaxWidget()
@@ -99,6 +111,11 @@ void QgsRasterMinMaxWidget::on_mLoadPushButton_clicked()
myMax = myRasterBandStats.mean + ( myStdDev * myRasterBandStats.stdDev );
origin |= QgsRasterRenderer::MinMaxStdDev;
}
else
{
QMessageBox::warning( this, tr( "No option selected" ), tr( "Please select an option to load min/max values." ) );
return;
}

emit load( myBand, myMin, myMax, origin );
}
@@ -37,6 +37,9 @@ count cut</string>
<property name="checked">
<bool>true</bool>
</property>
<attribute name="buttonGroup">
<string notr="true">buttonGroup</string>
</attribute>
</widget>
</item>
<item>
@@ -89,6 +92,9 @@ count cut</string>
<property name="text">
<string>Min / max</string>
</property>
<attribute name="buttonGroup">
<string notr="true">buttonGroup</string>
</attribute>
</widget>
</item>
<item>
@@ -114,6 +120,9 @@ count cut</string>
<string>Mean +/-
standard deviation ×</string>
</property>
<attribute name="buttonGroup">
<string notr="true">buttonGroup</string>
</attribute>
</widget>
</item>
<item>
@@ -247,4 +256,7 @@ standard deviation ×</string>
</widget>
<resources/>
<connections/>
<buttongroups>
<buttongroup name="buttonGroup"/>
</buttongroups>
</ui>

0 comments on commit b754ee7

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