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 )
382
382
QDomElement minValueElem = elem.firstChildElement ( " minValue" );
383
383
if ( !minValueElem.isNull () )
384
384
{
385
- mMinimumValue = minValueElem.text ().toInt ();
385
+ mMinimumValue = minValueElem.text ().toDouble ();
386
386
}
387
387
QDomElement maxValueElem = elem.firstChildElement ( " maxValue" );
388
388
if ( !maxValueElem.isNull () )
389
389
{
390
- mMaximumValue = maxValueElem.text ().toInt ();
390
+ mMaximumValue = maxValueElem.text ().toDouble ();
391
391
}
392
392
QDomElement algorithmElem = elem.firstChildElement ( " algorithm" );
393
393
if ( !algorithmElem.isNull () )
Original file line number Diff line number Diff line change @@ -34,7 +34,24 @@ QgsSingleBandGrayRenderer::~QgsSingleBandGrayRenderer()
34
34
35
35
QgsRasterRenderer* QgsSingleBandGrayRenderer::create ( const QDomElement& elem, QgsRasterDataProvider* provider )
36
36
{
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;
38
55
}
39
56
40
57
void QgsSingleBandGrayRenderer::setContrastEnhancement ( QgsContrastEnhancement* ce )
You can’t perform that action at this time.
0 commit comments