Skip to content

Commit 801f93c

Browse files
author
ersts
committed
-Fix for bugs introduced by patch attached to ticket #1683
-Closes ticket #2885 git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@14033 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 82c2435 commit 801f93c

File tree

1 file changed

+42
-13
lines changed

1 file changed

+42
-13
lines changed

src/app/qgsrasterlayerproperties.cpp

Lines changed: 42 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,7 @@ void QgsRasterLayerProperties::setMinimumMaximumEstimateWarning()
467467
*/
468468
void QgsRasterLayerProperties::sync()
469469
{
470-
QgsDebugMsg( "called." );
470+
QSettings myQSettings;
471471
QgsDebugMsg( "sync populate symbology tab" );
472472
/*
473473
* Symbology Tab
@@ -656,19 +656,28 @@ void QgsRasterLayerProperties::sync()
656656
cboGray->setCurrentIndex( cboGray->findText( mRasterLayer->grayBandName() ) );
657657

658658
//set the stdDevs and min max values
659+
mDefaultStandardDeviation = myQSettings.value( "/Raster/defaultStandardDeviation", 2.0 ).toDouble();
659660
if ( mRasterLayerIsGdal && rbtnThreeBand->isChecked() )
660661
{
661662
mRGBMinimumMaximumEstimated = mRasterLayer->isRGBMinimumMaximumEstimated();
662663
if ( mRasterLayer->hasUserDefinedRGBMinimumMaximum() )
663664
{
664-
sboxThreeBandStdDev->setValue( 0.0 );
665+
sboxThreeBandStdDev->setValue( mDefaultStandardDeviation );
665666
rbtnThreeBandStdDev->setChecked( false );
666667
rbtnThreeBandMinMax->setChecked( true );
667668
}
668669
else
669670
{
670671
sboxThreeBandStdDev->setValue( mRasterLayer->standardDeviations() );
671-
rbtnThreeBandStdDev->setChecked( true );
672+
if ( mRasterLayer->standardDeviations() == 0.0 )
673+
{
674+
sboxThreeBandStdDev->setValue( mDefaultStandardDeviation );
675+
rbtnThreeBandStdDev->setChecked( false );
676+
}
677+
else
678+
{
679+
rbtnThreeBandStdDev->setChecked( true );
680+
}
672681
rbtnThreeBandMinMax->setChecked( false );
673682
}
674683

@@ -700,14 +709,22 @@ void QgsRasterLayerProperties::sync()
700709
mGrayMinimumMaximumEstimated = mRasterLayer->isGrayMinimumMaximumEstimated();
701710
if ( mRasterLayer->hasUserDefinedGrayMinimumMaximum() )
702711
{
703-
sboxSingleBandStdDev->setValue( 0.0 );
712+
sboxSingleBandStdDev->setValue( mDefaultStandardDeviation );
704713
rbtnSingleBandStdDev->setChecked( false );
705714
rbtnSingleBandMinMax->setChecked( true );
706715
}
707716
else
708717
{
709718
sboxSingleBandStdDev->setValue( mRasterLayer->standardDeviations() );
710-
rbtnSingleBandStdDev->setChecked( true );
719+
if ( mRasterLayer->standardDeviations() == 0.0 )
720+
{
721+
sboxSingleBandStdDev->setValue( mDefaultStandardDeviation );
722+
rbtnSingleBandStdDev->setChecked( false );
723+
}
724+
else
725+
{
726+
rbtnSingleBandStdDev->setChecked( true );
727+
}
711728
rbtnSingleBandMinMax->setChecked( false );
712729
}
713730

@@ -748,7 +765,6 @@ void QgsRasterLayerProperties::sync()
748765
}
749766

750767
//Display the current default contrast enhancement algorithm
751-
QSettings myQSettings;
752768
mDefaultRedBand = myQSettings.value( "/Raster/defaultRedBand", 1 ).toInt();
753769
mDefaultGreenBand = myQSettings.value( "/Raster/defaultGreenBand", 2 ).toInt();
754770
mDefaultBlueBand = myQSettings.value( "/Raster/defaultBlueBand", 3 ).toInt();
@@ -776,10 +792,6 @@ void QgsRasterLayerProperties::sync()
776792
labelDefaultContrastEnhancementAlgorithm->setText( tr( "No Stretch" ) );
777793
}
778794

779-
mDefaultStandardDeviation = myQSettings.value( "/Raster/defaultStandardDeviation", 1.0 ).toDouble();
780-
sboxThreeBandStdDev->setValue( mDefaultStandardDeviation );
781-
782-
783795
QgsDebugMsg( "populate transparency tab" );
784796
/*
785797
* Transparent Pixel Tab
@@ -2404,15 +2416,23 @@ void QgsRasterLayerProperties::on_rbtnSingleBand_toggled( bool theState )
24042416

24052417
if ( mRasterLayer->hasUserDefinedGrayMinimumMaximum() )
24062418
{
2407-
sboxSingleBandStdDev->setValue( 0.0 );
2419+
sboxSingleBandStdDev->setValue( mDefaultStandardDeviation );
24082420
rbtnSingleBandMinMax->setChecked( true );
24092421
leGrayMin->setText( QString::number( mRasterLayer->minimumValue( cboGray->currentText() ) ) );
24102422
leGrayMax->setText( QString::number( mRasterLayer->maximumValue( cboGray->currentText() ) ) );
24112423
}
24122424
else
24132425
{
24142426
sboxSingleBandStdDev->setValue( mRasterLayer->standardDeviations() );
2415-
rbtnSingleBandStdDev->setChecked( true );
2427+
if ( mRasterLayer->standardDeviations() == 0.0 )
2428+
{
2429+
sboxSingleBandStdDev->setValue( mDefaultStandardDeviation );
2430+
rbtnSingleBandStdDev->setChecked( false );
2431+
}
2432+
else
2433+
{
2434+
rbtnSingleBandStdDev->setChecked( true );
2435+
}
24162436
}
24172437

24182438
// Populate transparency table with single value transparency pixels
@@ -2493,7 +2513,16 @@ void QgsRasterLayerProperties::on_rbtnThreeBand_toggled( bool theState )
24932513
else
24942514
{
24952515
sboxThreeBandStdDev->setValue( mRasterLayer->standardDeviations() );
2496-
rbtnThreeBandStdDev->setChecked( true );
2516+
if ( mRasterLayer->standardDeviations() == 0.0 )
2517+
{
2518+
sboxThreeBandStdDev->setValue( mDefaultStandardDeviation );
2519+
rbtnThreeBandStdDev->setChecked( false );
2520+
}
2521+
else
2522+
{
2523+
rbtnThreeBandStdDev->setChecked( true );
2524+
}
2525+
24972526
}
24982527

24992528
// Populate transparency table with single value transparency pixels

0 commit comments

Comments
 (0)