File tree Expand file tree Collapse file tree 2 files changed +20
-3
lines changed Expand file tree Collapse file tree 2 files changed +20
-3
lines changed Original file line number Diff line number Diff line change @@ -382,12 +382,12 @@ void QgsContrastEnhancement::readXML( const QDomElement& elem )
382382 QDomElement minValueElem = elem.firstChildElement ( " minValue" );
383383 if ( !minValueElem.isNull () )
384384 {
385- mMinimumValue = minValueElem.text ().toInt ();
385+ mMinimumValue = minValueElem.text ().toDouble ();
386386 }
387387 QDomElement maxValueElem = elem.firstChildElement ( " maxValue" );
388388 if ( !maxValueElem.isNull () )
389389 {
390- mMaximumValue = maxValueElem.text ().toInt ();
390+ mMaximumValue = maxValueElem.text ().toDouble ();
391391 }
392392 QDomElement algorithmElem = elem.firstChildElement ( " algorithm" );
393393 if ( !algorithmElem.isNull () )
Original file line number Diff line number Diff line change @@ -34,7 +34,24 @@ QgsSingleBandGrayRenderer::~QgsSingleBandGrayRenderer()
3434
3535QgsRasterRenderer* QgsSingleBandGrayRenderer::create ( const QDomElement& elem, QgsRasterDataProvider* provider )
3636{
37- return 0 ;
37+ if ( elem.isNull () )
38+ {
39+ return 0 ;
40+ }
41+
42+ int grayBand = elem.attribute ( " grayBand" , " -1" ).toInt ();
43+ QgsSingleBandGrayRenderer* r = new QgsSingleBandGrayRenderer ( provider, grayBand );
44+ r->readXML ( elem );
45+
46+ QDomElement contrastEnhancementElem = elem.firstChildElement ( " contrastEnhancement" );
47+ if ( !contrastEnhancementElem.isNull () )
48+ {
49+ QgsContrastEnhancement* ce = new QgsContrastEnhancement (( QgsContrastEnhancement::QgsRasterDataType )(
50+ provider->dataType ( grayBand ) ) ) ;
51+ ce->readXML ( contrastEnhancementElem );
52+ r->setContrastEnhancement ( ce );
53+ }
54+ return r;
3855}
3956
4057void QgsSingleBandGrayRenderer::setContrastEnhancement ( QgsContrastEnhancement* ce )
You can’t perform that action at this time.
0 commit comments