QgsRasterRenderer* QgsSingleBandPseudoColorRenderer::create( const QDomElement& elem, QgsRasterInterface* input )
{
  if ( elem.isNull() )
  {
    return 0;
  }

  int band = elem.attribute( "band", "-1" ).toInt();
  QgsRasterShader* shader = 0;
  QDomElement rasterShaderElem = elem.firstChildElement( "rastershader" );
  if ( !rasterShaderElem.isNull() )
  {
    shader = new QgsRasterShader();
    shader->readXML( rasterShaderElem );
  }

  //QgsRasterRenderer* r = new QgsSingleBandPseudoColorRenderer( input, band, shader );
  QgsSingleBandPseudoColorRenderer* r = new QgsSingleBandPseudoColorRenderer( input, band, shader );
  r->readXML( elem );

  // TODO: add _readXML in superclass?
  r->setClassificationMin( elem.attribute( "classificationMin", "NaN" ).toDouble() );
  r->setClassificationMax( elem.attribute( "classificationMax", "NaN" ).toDouble() );
  r->setClassificationMinMaxOrigin( QgsRasterRenderer::minMaxOriginFromName( elem.attribute( "classificationMinMaxOrigin", "Unknown" ) ) );

  return r;
}
QgsRasterRenderer* QgsSingleBandPseudoColorRenderer::create( const QDomElement& elem, QgsRasterDataProvider* provider )
{
  if ( elem.isNull() )
  {
    return 0;
  }

  int band = elem.attribute( "band", "-1" ).toInt();
  QgsRasterShader* shader = 0;
  QDomElement rasterShaderElem = elem.firstChildElement( "rastershader" );
  if ( !rasterShaderElem.isNull() )
  {
    shader = new QgsRasterShader();
    shader->readXML( rasterShaderElem );
  }
  QgsRasterRenderer* r = new QgsSingleBandPseudoColorRenderer( provider, band, shader );
  r->readXML( elem );
  return r;
}