Skip to content

Commit

Permalink
fix UI inconsistencies in raster min/max widget
Browse files Browse the repository at this point in the history
  • Loading branch information
etiennesky committed Apr 17, 2014
1 parent 3e4a915 commit b754ee7
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/gui/raster/qgsrasterminmaxwidget.cpp
Expand Up @@ -16,6 +16,7 @@
***************************************************************************/

#include <QSettings>
#include <QMessageBox>

#include "qgsrasterlayer.h"
#include "qgsrasterminmaxwidget.h"
Expand All @@ -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()
Expand Down Expand Up @@ -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 );
}
Expand Down
12 changes: 12 additions & 0 deletions src/ui/qgsrasterminmaxwidgetbase.ui
Expand Up @@ -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>
Expand Down Expand Up @@ -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>
Expand All @@ -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>
Expand Down Expand Up @@ -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.