File tree Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -4023,8 +4023,19 @@ bool QgsRasterLayer::readXml( QDomNode & layer_node )
4023
4023
{
4024
4024
QgsColorRampShader* myColorRampShader = ( QgsColorRampShader* ) mRasterShader ->getRasterShaderFunction ();
4025
4025
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 );
4028
4039
4029
4040
4030
4041
// entries
@@ -4378,7 +4389,7 @@ bool QgsRasterLayer::writeXml( QDomNode & layer_node,
4378
4389
{
4379
4390
QDomElement customColorRampElement = document.createElement ( " customColorRamp" );
4380
4391
4381
- QDomElement customColorRampType = document.createElement ( " customColorRampType " );
4392
+ QDomElement customColorRampType = document.createElement ( " colorRampType " );
4382
4393
QDomText customColorRampTypeText = document.createTextNode ((( QgsColorRampShader* )mRasterShader ->getRasterShaderFunction () )->getColorRampTypeAsQString () );
4383
4394
customColorRampType.appendChild ( customColorRampTypeText );
4384
4395
customColorRampElement.appendChild ( customColorRampType );
You can’t perform that action at this time.
0 commit comments