Skip to content

Commit 051a37d

Browse files
author
ersts
committedSep 24, 2008
-Fix a bug setting the color amp interpolation method, when loading from a project file
git-svn-id: http://svn.osgeo.org/qgis/trunk@9407 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 8ee3e85 commit 051a37d

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed
 

‎src/core/raster/qgsrasterlayer.cpp

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4023,8 +4023,19 @@ bool QgsRasterLayer::readXml( QDomNode & layer_node )
40234023
{
40244024
QgsColorRampShader* myColorRampShader = ( QgsColorRampShader* ) mRasterShader->getRasterShaderFunction();
40254025

4026-
QDomNode customColorRampTypeNode = customColorRampNode.namedItem( "colorRampType" );
4027-
myColorRampShader->setColorRampType( customColorRampTypeNode.toElement().text() );
4026+
//TODO: Remove the customColorRampType check and following if() in v2.0, added for compatability with older ( bugged ) project files
4027+
QDomNode customColorRampTypeNode = customColorRampNode.namedItem( "customColorRampType" );
4028+
QDomNode colorRampTypeNode = customColorRampNode.namedItem( "colorRampType" );
4029+
QString myRampType = "";
4030+
if( "" == customColorRampTypeNode.toElement().text() )
4031+
{
4032+
myRampType = colorRampTypeNode.toElement().text();
4033+
}
4034+
else
4035+
{
4036+
myRampType = customColorRampTypeNode.toElement().text();
4037+
}
4038+
myColorRampShader->setColorRampType( myRampType );
40284039

40294040

40304041
//entries
@@ -4378,7 +4389,7 @@ bool QgsRasterLayer::writeXml( QDomNode & layer_node,
43784389
{
43794390
QDomElement customColorRampElement = document.createElement( "customColorRamp" );
43804391

4381-
QDomElement customColorRampType = document.createElement( "customColorRampType" );
4392+
QDomElement customColorRampType = document.createElement( "colorRampType" );
43824393
QDomText customColorRampTypeText = document.createTextNode((( QgsColorRampShader* )mRasterShader->getRasterShaderFunction() )->getColorRampTypeAsQString() );
43834394
customColorRampType.appendChild( customColorRampTypeText );
43844395
customColorRampElement.appendChild( customColorRampType );

0 commit comments

Comments
 (0)
Please sign in to comment.