@@ -467,7 +467,7 @@ void QgsRasterLayerProperties::setMinimumMaximumEstimateWarning()
467
467
*/
468
468
void QgsRasterLayerProperties::sync ()
469
469
{
470
- QgsDebugMsg ( " called. " ) ;
470
+ QSettings myQSettings ;
471
471
QgsDebugMsg ( " sync populate symbology tab" );
472
472
/*
473
473
* Symbology Tab
@@ -656,19 +656,28 @@ void QgsRasterLayerProperties::sync()
656
656
cboGray->setCurrentIndex ( cboGray->findText ( mRasterLayer ->grayBandName () ) );
657
657
658
658
// set the stdDevs and min max values
659
+ mDefaultStandardDeviation = myQSettings.value ( " /Raster/defaultStandardDeviation" , 2.0 ).toDouble ();
659
660
if ( mRasterLayerIsGdal && rbtnThreeBand->isChecked () )
660
661
{
661
662
mRGBMinimumMaximumEstimated = mRasterLayer ->isRGBMinimumMaximumEstimated ();
662
663
if ( mRasterLayer ->hasUserDefinedRGBMinimumMaximum () )
663
664
{
664
- sboxThreeBandStdDev->setValue ( 0.0 );
665
+ sboxThreeBandStdDev->setValue ( mDefaultStandardDeviation );
665
666
rbtnThreeBandStdDev->setChecked ( false );
666
667
rbtnThreeBandMinMax->setChecked ( true );
667
668
}
668
669
else
669
670
{
670
671
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
+ }
672
681
rbtnThreeBandMinMax->setChecked ( false );
673
682
}
674
683
@@ -700,14 +709,22 @@ void QgsRasterLayerProperties::sync()
700
709
mGrayMinimumMaximumEstimated = mRasterLayer ->isGrayMinimumMaximumEstimated ();
701
710
if ( mRasterLayer ->hasUserDefinedGrayMinimumMaximum () )
702
711
{
703
- sboxSingleBandStdDev->setValue ( 0.0 );
712
+ sboxSingleBandStdDev->setValue ( mDefaultStandardDeviation );
704
713
rbtnSingleBandStdDev->setChecked ( false );
705
714
rbtnSingleBandMinMax->setChecked ( true );
706
715
}
707
716
else
708
717
{
709
718
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
+ }
711
728
rbtnSingleBandMinMax->setChecked ( false );
712
729
}
713
730
@@ -748,7 +765,6 @@ void QgsRasterLayerProperties::sync()
748
765
}
749
766
750
767
// Display the current default contrast enhancement algorithm
751
- QSettings myQSettings;
752
768
mDefaultRedBand = myQSettings.value ( " /Raster/defaultRedBand" , 1 ).toInt ();
753
769
mDefaultGreenBand = myQSettings.value ( " /Raster/defaultGreenBand" , 2 ).toInt ();
754
770
mDefaultBlueBand = myQSettings.value ( " /Raster/defaultBlueBand" , 3 ).toInt ();
@@ -776,10 +792,6 @@ void QgsRasterLayerProperties::sync()
776
792
labelDefaultContrastEnhancementAlgorithm->setText ( tr ( " No Stretch" ) );
777
793
}
778
794
779
- mDefaultStandardDeviation = myQSettings.value ( " /Raster/defaultStandardDeviation" , 1.0 ).toDouble ();
780
- sboxThreeBandStdDev->setValue ( mDefaultStandardDeviation );
781
-
782
-
783
795
QgsDebugMsg ( " populate transparency tab" );
784
796
/*
785
797
* Transparent Pixel Tab
@@ -2404,15 +2416,23 @@ void QgsRasterLayerProperties::on_rbtnSingleBand_toggled( bool theState )
2404
2416
2405
2417
if ( mRasterLayer ->hasUserDefinedGrayMinimumMaximum () )
2406
2418
{
2407
- sboxSingleBandStdDev->setValue ( 0.0 );
2419
+ sboxSingleBandStdDev->setValue ( mDefaultStandardDeviation );
2408
2420
rbtnSingleBandMinMax->setChecked ( true );
2409
2421
leGrayMin->setText ( QString::number ( mRasterLayer ->minimumValue ( cboGray->currentText () ) ) );
2410
2422
leGrayMax->setText ( QString::number ( mRasterLayer ->maximumValue ( cboGray->currentText () ) ) );
2411
2423
}
2412
2424
else
2413
2425
{
2414
2426
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
+ }
2416
2436
}
2417
2437
2418
2438
// Populate transparency table with single value transparency pixels
@@ -2493,7 +2513,16 @@ void QgsRasterLayerProperties::on_rbtnThreeBand_toggled( bool theState )
2493
2513
else
2494
2514
{
2495
2515
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
+
2497
2526
}
2498
2527
2499
2528
// Populate transparency table with single value transparency pixels
0 commit comments