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

svn_qgis at osgeo.org svn_qgis at osgeo.org
Wed Sep 24 15:27:26 EDT 2008


Author: ersts
Date: 2008-09-24 15:27:26 -0400 (Wed, 24 Sep 2008)
New Revision: 9407

Modified:
   trunk/qgis/src/core/raster/qgsrasterlayer.cpp
Log:
-Fix a bug setting the color amp interpolation method, when loading from a project file

Modified: trunk/qgis/src/core/raster/qgsrasterlayer.cpp
===================================================================
--- trunk/qgis/src/core/raster/qgsrasterlayer.cpp	2008-09-24 19:08:02 UTC (rev 9406)
+++ trunk/qgis/src/core/raster/qgsrasterlayer.cpp	2008-09-24 19:27:26 UTC (rev 9407)
@@ -4023,8 +4023,19 @@
   {
     QgsColorRampShader* myColorRampShader = ( QgsColorRampShader* ) mRasterShader->getRasterShaderFunction();
 
-    QDomNode customColorRampTypeNode = customColorRampNode.namedItem( "colorRampType" );
-    myColorRampShader->setColorRampType( customColorRampTypeNode.toElement().text() );
+    //TODO: Remove the customColorRampType check and following if() in v2.0, added for compatability with older ( bugged ) project files
+    QDomNode customColorRampTypeNode = customColorRampNode.namedItem( "customColorRampType" );
+    QDomNode colorRampTypeNode = customColorRampNode.namedItem( "colorRampType" );
+    QString myRampType = "";
+    if( "" == customColorRampTypeNode.toElement().text() )
+    {
+      myRampType = colorRampTypeNode.toElement().text();
+    }
+    else
+    {
+      myRampType = customColorRampTypeNode.toElement().text();
+    }
+    myColorRampShader->setColorRampType( myRampType );
 
 
     //entries
@@ -4378,7 +4389,7 @@
   {
     QDomElement customColorRampElement = document.createElement( "customColorRamp" );
 
-    QDomElement customColorRampType = document.createElement( "customColorRampType" );
+    QDomElement customColorRampType = document.createElement( "colorRampType" );
     QDomText customColorRampTypeText = document.createTextNode((( QgsColorRampShader* )mRasterShader->getRasterShaderFunction() )->getColorRampTypeAsQString() );
     customColorRampType.appendChild( customColorRampTypeText );
     customColorRampElement.appendChild( customColorRampType );



More information about the QGIS-commit mailing list