Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Implement readXML for singleband gray renderer
  • Loading branch information
mhugent committed Apr 3, 2012
1 parent 1802630 commit a6eaf71
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/core/raster/qgscontrastenhancement.cpp
Expand Up @@ -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() )
Expand Down
19 changes: 18 additions & 1 deletion src/core/raster/qgssinglebandgrayrenderer.cpp
Expand Up @@ -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 )
Expand Down

0 comments on commit a6eaf71

Please sign in to comment.