[QGIS Commit] r14032 - trunk/qgis/src/core/raster

svn_qgis at osgeo.org svn_qgis at osgeo.org
Sun Aug 8 22:27:24 EDT 2010


Author: ersts
Date: 2010-08-09 02:27:24 +0000 (Mon, 09 Aug 2010)
New Revision: 14032

Modified:
   trunk/qgis/src/core/raster/qgsrasterlayer.cpp
Log:
-Added check to make sure preferred bands combinations are valid
-Closes ticket #1852

Modified: trunk/qgis/src/core/raster/qgsrasterlayer.cpp
===================================================================
--- trunk/qgis/src/core/raster/qgsrasterlayer.cpp	2010-08-09 01:20:59 UTC (rev 14031)
+++ trunk/qgis/src/core/raster/qgsrasterlayer.cpp	2010-08-09 02:27:24 UTC (rev 14032)
@@ -5412,16 +5412,37 @@
     //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



More information about the QGIS-commit mailing list