Skip to content
Permalink
Browse files
Implement readXML for singleband gray renderer
  • Loading branch information
mhugent committed Apr 3, 2012
1 parent 1802630 commit a6eaf71c7caccb4e7854abf88b0072bae0994b3c
Showing with 20 additions and 3 deletions.
  1. +2 −2 src/core/raster/qgscontrastenhancement.cpp
  2. +18 −1 src/core/raster/qgssinglebandgrayrenderer.cpp
@@ -382,12 +382,12 @@ void QgsContrastEnhancement::readXML( const QDomElement& elem )
QDomElement minValueElem = elem.firstChildElement( "minValue" );
if ( !minValueElem.isNull() )
{
mMinimumValue = minValueElem.text().toInt();
mMinimumValue = minValueElem.text().toDouble();
}
QDomElement maxValueElem = elem.firstChildElement( "maxValue" );
if ( !maxValueElem.isNull() )
{
mMaximumValue = maxValueElem.text().toInt();
mMaximumValue = maxValueElem.text().toDouble();
}
QDomElement algorithmElem = elem.firstChildElement( "algorithm" );
if ( !algorithmElem.isNull() )
@@ -34,7 +34,24 @@ QgsSingleBandGrayRenderer::~QgsSingleBandGrayRenderer()

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

int grayBand = elem.attribute( "grayBand", "-1" ).toInt();
QgsSingleBandGrayRenderer* r = new QgsSingleBandGrayRenderer( provider, grayBand );
r->readXML( elem );

QDomElement contrastEnhancementElem = elem.firstChildElement( "contrastEnhancement" );
if ( !contrastEnhancementElem.isNull() )
{
QgsContrastEnhancement* ce = new QgsContrastEnhancement(( QgsContrastEnhancement::QgsRasterDataType )(
provider->dataType( grayBand ) ) ) ;
ce->readXML( contrastEnhancementElem );
r->setContrastEnhancement( ce );
}
return r;
}

void QgsSingleBandGrayRenderer::setContrastEnhancement( QgsContrastEnhancement* ce )

0 comments on commit a6eaf71

Please sign in to comment.