mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-27 00:33:48 -05:00
fix UI inconsistencies in raster min/max widget
This commit is contained in:
parent
3e4a915dd2
commit
b754ee70b8
@ -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>
|
||||
|
Loading…
x
Reference in New Issue
Block a user