Skip to content
Permalink
Browse files

save default bands combination and stadard deviation. Also use this v…

…alues when loading new raster layer (fix #3519)

git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@15256 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
alexbruy
alexbruy committed Feb 24, 2011
1 parent 63d3f86 commit 68ff7e8046886a71d0d29c3579d70a129fe6bdb3
Showing with 22 additions and 1 deletion.
  1. +10 −1 src/app/qgsrasterlayerproperties.cpp
  2. +12 −0 src/core/raster/qgsrasterlayer.cpp
@@ -695,12 +695,18 @@ void QgsRasterLayerProperties::sync()
cboxContrastEnhancementAlgorithm->setCurrentIndex( cboxContrastEnhancementAlgorithm->findText( tr( "No Stretch" ) ) );
}

//Display the current default contrast enhancement algorithm
// Display the current default band combination
mDefaultRedBand = myQSettings.value( "/Raster/defaultRedBand", 1 ).toInt();
mDefaultGreenBand = myQSettings.value( "/Raster/defaultGreenBand", 2 ).toInt();
mDefaultBlueBand = myQSettings.value( "/Raster/defaultBlueBand", 3 ).toInt();
labelDefaultBandCombination->setText( tr( "Default R:%1 G:%2 B:%3" ).arg( mDefaultRedBand ) .arg( mDefaultGreenBand ) .arg( mDefaultBlueBand ) );

// and used band combination
cboRed->setCurrentIndex( cboRed->findText( mRasterLayer->redBandName() ) );
cboGreen->setCurrentIndex( cboGreen->findText( mRasterLayer->greenBandName() ) );
cboBlue->setCurrentIndex( cboBlue->findText( mRasterLayer->blueBandName() ) );

//Display the current default contrast enhancement algorithm
mDefaultContrastEnhancementAlgorithm = myQSettings.value( "/Raster/defaultContrastEnhancementAlgorithm", "NoEnhancement" ).toString();
if ( mDefaultContrastEnhancementAlgorithm == "NoEnhancement" )
{
@@ -722,6 +728,8 @@ void QgsRasterLayerProperties::sync()
{
labelDefaultContrastEnhancementAlgorithm->setText( tr( "No Stretch" ) );
}
mDefaultStandardDeviation = myQSettings.value("/Raster/defaultStandardDeviation", 1.0).toDouble();
sboxThreeBandStdDev->setValue(mDefaultStandardDeviation);
}

QgsDebugMsg( "populate transparency tab" );
@@ -2193,6 +2201,7 @@ void QgsRasterLayerProperties::on_rbtnThreeBandMinMax_toggled( bool theState )
void QgsRasterLayerProperties::on_rbtnThreeBandStdDev_toggled( bool theState )
{
sboxThreeBandStdDev->setEnabled( theState );
sboxThreeBandStdDev->setValue( mDefaultStandardDeviation );
}

void QgsRasterLayerProperties::pixelSelected( int x, int y )
@@ -5531,6 +5531,12 @@ bool QgsRasterLayer::readFile( QString const &theFilename )
mTransparencyBandName = TRSTRING_NOT_SET;
mGrayBandName = TRSTRING_NOT_SET; //sensible default
mDrawingStyle = MultiBandColor; //sensible default

// read standard deviations
if ( mContrastEnhancementAlgorithm == QgsContrastEnhancement::StretchToMinimumMaximum )
{
setStandardDeviations( myQSettings.value( "/Raster/defaultStandardDeviation", 2 ).toInt() );
}
}
else //GrayOrUndefined
{
@@ -5540,6 +5546,12 @@ bool QgsRasterLayer::readFile( QString const &theFilename )
mTransparencyBandName = TRSTRING_NOT_SET; //sensible default
mDrawingStyle = SingleBandGray; //sensible default
mGrayBandName = bandName( 1 );

// read standard deviations
if ( mContrastEnhancementAlgorithm == QgsContrastEnhancement::StretchToMinimumMaximum )
{
setStandardDeviations( myQSettings.value( "/Raster/defaultStandardDeviation", 2 ).toInt() );
}
}

//mark the layer as valid

0 comments on commit 68ff7e8

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