Skip to content
Permalink
Browse files
-Added check to make sure preferred bands combinations are valid
-Closes ticket #1852

git-svn-id: http://svn.osgeo.org/qgis/trunk@14032 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
ersts committed Aug 9, 2010
1 parent d5e0f6b commit a2a9a28bb7f8a39e45abe1c623485e3a551155e4
Showing with 21 additions and 0 deletions.
  1. +21 −0 src/core/raster/qgsrasterlayer.cpp
@@ -5412,16 +5412,37 @@ bool QgsRasterLayer::readFile( QString const &theFilename )
//we know we have at least 2 layers...
mRedBandName = bandName( myQSettings.value( "/Raster/defaultRedBand", 1 ).toInt() ); // sensible default
mGreenBandName = bandName( myQSettings.value( "/Raster/defaultGreenBand", 2 ).toInt() ); // sensible default

//Check to make sure preferred bands combinations are valid
if ( mRedBandName.isEmpty() )
{
mRedBandName = bandName( 1 );
}

if ( mGreenBandName.isEmpty() )
{
mGreenBandName = bandName( 2 );
}

//for the third layer we cant be sure so..
if ( GDALGetRasterCount( mGdalDataset ) > 2 )
{
mBlueBandName = bandName( myQSettings.value( "/Raster/defaultBlueBand", 3 ).toInt() ); // sensible default
if ( mBlueBandName.isEmpty() )
{
mBlueBandName = bandName( 3 );
}
}
else
{
mBlueBandName = bandName( myQSettings.value( "/Raster/defaultBlueBand", 2 ).toInt() ); // sensible default
if ( mBlueBandName.isEmpty() )
{
mBlueBandName = bandName( 2 );
}
}


mTransparencyBandName = TRSTRING_NOT_SET;
mGrayBandName = TRSTRING_NOT_SET; //sensible default
mDrawingStyle = MultiBandColor; //sensible default

0 comments on commit a2a9a28

Please sign in to comment.