mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-28 00:17:30 -05:00
save default bands combination and stadard deviation. Also use this values when loading new raster layer (fix #3519)
git-svn-id: http://svn.osgeo.org/qgis/trunk@15256 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
parent
2a53db219b
commit
0065f6c8cf
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user