25 #include <QTextStream>
26 #include <QDomDocument>
60 Q_UNUSED( newVersion );
61 bool returnValue =
false;
63 if ( !
mDom.isNull() )
81 QgsDebugMsg( QString(
"Current project file version is %1.%2.%3" )
87 std::cout <<
mDom.toString( 2 ).toLatin1().constData();
98 if ( !
mDom.isNull() )
102 QDomElement mapCanvas;
105 QDomNode qgis =
mDom.firstChildElement(
"qgis" );
106 if ( ! qgis.isNull() )
111 mapCanvas =
mDom.createElement(
"mapcanvas" );
113 qgis.appendChild( mapCanvas );
115 mapCanvas.appendChild( qgis.namedItem(
"units" ) );
117 mapCanvas.appendChild( qgis.namedItem(
"extent" ) );
121 QDomElement properties = qgis.firstChildElement(
"properties" );
122 QDomElement spatial = properties.firstChildElement(
"SpatialRefSys" );
123 QDomElement hasCrsTransformEnabled = spatial.firstChildElement(
"ProjectionsEnabled" );
126 QDomElement projection =
mDom.createElement(
"projections" );
127 QgsDebugMsg( QString(
"Projection flag: " ) + hasCrsTransformEnabled.text() );
129 projection.appendChild(
mDom.createTextNode( hasCrsTransformEnabled.text() ) );
131 mapCanvas.appendChild( projection );
138 QDomNodeList mapLayers =
mDom.elementsByTagName(
"maplayer" );
139 bool doneDestination =
false;
140 for (
int i = 0; i < mapLayers.count(); i++ )
142 QDomNode mapLayer = mapLayers.item( i );
144 QDomNode coordinateTransform = mapLayer.namedItem(
"coordinatetransform" );
146 QDomNode sourceCrs = coordinateTransform.namedItem(
"sourcesrs" );
148 sourceCrs.toElement().setTagName(
"srs" );
150 mapLayer.appendChild( sourceCrs );
153 if ( ! doneDestination )
156 QDomNode destinationCRS = coordinateTransform.namedItem(
"destinationsrs" );
159 mapCanvas.appendChild( destinationCRS );
161 doneDestination =
true;
163 mapLayer.removeChild( coordinateTransform );
170 QDomNodeList legendLayerFiles =
mDom.elementsByTagName(
"legendlayerfile" );
171 QgsDebugMsg( QString(
"Legend layer file entries: " ) + QString::number( legendLayerFiles.count() ) );
172 for (
int i = 0; i < mapLayers.count(); i++ )
175 QDomElement mapLayer = mapLayers.item( i ).toElement();
177 QString
id = mapLayer.firstChildElement(
"id" ).text();
180 for (
int j = 0; j < legendLayerFiles.count(); j++ )
182 QDomElement legendLayerFile = legendLayerFiles.item( j ).toElement();
183 if (
id == legendLayerFile.attribute(
"layerid" ) )
189 legendLayerFile.setAttribute(
"visible", mapLayer.attribute(
"visible" ) );
192 legendLayerFile.setAttribute(
"isInOverview", mapLayer.attribute(
"showInOverviewFlag" ) );
204 if ( !
mDom.isNull() )
207 QDomNodeList rasterPropertyList =
mDom.elementsByTagName(
"rasterproperties" );
208 QgsDebugMsg( QString(
"Raster properties file entries: " ) + QString::number( rasterPropertyList.count() ) );
209 for (
int i = 0; i < rasterPropertyList.count(); i++ )
212 QDomNode rasterProperty = rasterPropertyList.item( i );
215 rasterProperty.namedItem(
"stdDevsToPlotDouble" ).toElement().setTagName(
"mStandardDeviations" );
217 rasterProperty.namedItem(
"invertHistogramFlag" ).toElement().setTagName(
"mInvertPixelsFlag" );
218 rasterProperty.namedItem(
"showDebugOverLayFlag" ).toElement().setTagName(
"mDebugOverLayFlag" );
220 rasterProperty.namedItem(
"redBandNameQString" ).toElement().setTagName(
"mRedBandName" );
221 rasterProperty.namedItem(
"blueBandNameQString" ).toElement().setTagName(
"mBlueBandName" );
222 rasterProperty.namedItem(
"greenBandNameQString" ).toElement().setTagName(
"mGreenBandName" );
223 rasterProperty.namedItem(
"grayBandNameQString" ).toElement().setTagName(
"mGrayBandName" );
227 QDomNodeList symbolPropertyList =
mDom.elementsByTagName(
"symbol" );
228 for (
int i = 0; i < symbolPropertyList.count(); i++ )
231 QDomNode symbolProperty = symbolPropertyList.item( i );
233 QDomElement pointSymbol = symbolProperty.firstChildElement(
"pointsymbol" );
234 if ( pointSymbol.text().startsWith(
"hard:" ) )
237 int lineWidth = symbolProperty.firstChildElement(
"outlinewidth" ).text().toInt();
238 int pointSize = symbolProperty.firstChildElement(
"pointsize" ).text().toInt();
240 if ( pointSize != 0 )
245 pointSize = pointSize + 2 + 2 * lineWidth;
246 QgsDebugMsg( QString(
"Setting point size to %1" ).arg( pointSize ) );
247 QDomElement newPointSizeProperty =
mDom.createElement(
"pointsize" );
248 QDomText newPointSizeTxt =
mDom.createTextNode( QString::number( pointSize ) );
249 newPointSizeProperty.appendChild( newPointSizeTxt );
250 symbolProperty.replaceChild( newPointSizeProperty, pointSymbol );
262 if ( !
mDom.isNull() )
265 QPrinter myPrinter( QPrinter::ScreenResolution );
266 int screenDpi = myPrinter.resolution();
269 QDomNodeList outlineWidthList =
mDom.elementsByTagName(
"outlinewidth" );
270 for (
int i = 0; i < outlineWidthList.size(); ++i )
273 QDomElement currentOutlineElem = outlineWidthList.at( i ).toElement();
274 double outlineWidth = currentOutlineElem.text().toDouble();
278 QDomNode outlineTextNode = currentOutlineElem.firstChild();
279 QDomText newOutlineText =
mDom.createTextNode( QString::number( outlineWidth ) );
280 currentOutlineElem.replaceChild( newOutlineText, outlineTextNode );
285 QDomNodeList pointSizeList =
mDom.elementsByTagName(
"pointsize" );
286 for (
int i = 0; i < pointSizeList.size(); ++i )
289 QDomElement currentPointSizeElem = pointSizeList.at( i ).toElement();
290 double pointSize = currentPointSizeElem.text().toDouble();
294 QDomNode pointSizeTextNode = currentPointSizeElem.firstChild();
295 QDomText newPointSizeText =
mDom.createTextNode( QString::number((
int )pointSize ) );
296 currentPointSizeElem.replaceChild( newPointSizeText, pointSizeTextNode );
303 if ( !
mDom.isNull() )
305 QDomNodeList layerList =
mDom.elementsByTagName(
"maplayer" );
306 for (
int i = 0; i < layerList.size(); ++i )
308 QDomElement layerElem = layerList.at( i ).toElement();
309 QString typeString = layerElem.attribute(
"type" );
310 if ( typeString !=
"vector" )
316 QDomNode dataSourceNode = layerElem.namedItem(
"datasource" );
317 if ( dataSourceNode.isNull() )
321 QString dataSource = dataSourceNode.toElement().text();
324 QDomNode providerNode = layerElem.namedItem(
"provider" );
325 if ( providerNode.isNull() )
329 QString providerKey = providerNode.toElement().text();
347 QDomNodeList classificationFieldList = layerElem.elementsByTagName(
"classificationfield" );
348 for (
int j = 0; j < classificationFieldList.size(); ++j )
350 QDomElement classificationFieldElem = classificationFieldList.
at( j ).toElement();
351 int fieldNumber = classificationFieldElem.text().toInt();
352 if ( fieldNumber >= 0 && fieldNumber < theFields.
count() )
354 QDomText fieldName =
mDom.createTextNode( theFields[fieldNumber].name() );
355 QDomNode nameNode = classificationFieldElem.firstChild();
356 classificationFieldElem.replaceChild( fieldName, nameNode );
370 QDomNode qgis =
mDom.firstChildElement(
"qgis" );
374 QDomElement properties = qgis.firstChildElement(
"properties" );
375 if ( properties.isNull() )
378 QDomElement digitizing = properties.firstChildElement(
"Digitizing" );
379 if ( digitizing.isNull() )
382 QDomElement tolList = digitizing.firstChildElement(
"LayerSnappingToleranceList" );
383 if ( tolList.isNull() )
386 QDomElement tolUnitList = digitizing.firstChildElement(
"LayerSnappingToleranceUnitList" );
387 if ( !tolUnitList.isNull() )
391 for (
int i = 0; i < tolList.childNodes().count(); i++ )
395 value.
writeXML(
"LayerSnappingToleranceUnitList", digitizing,
mDom );
406 QDomNodeList layerItemList =
mDom.elementsByTagName(
"LayerItem" );
407 QDomElement currentLayerItemElem;
408 QString currentLayerId;
410 for (
int i = 0; i < layerItemList.size(); ++i )
412 currentLayerItemElem = layerItemList.at( i ).toElement();
413 if ( currentLayerItemElem.isNull() )
417 currentLayerId = currentLayerItemElem.attribute(
"layerId" );
419 QDomNodeList vectorClassificationList = currentLayerItemElem.elementsByTagName(
"VectorClassificationItem" );
420 QDomElement currentClassificationElem;
421 for (
int j = 0; j < vectorClassificationList.size(); ++j )
423 currentClassificationElem = vectorClassificationList.at( j ).toElement();
424 if ( !currentClassificationElem.isNull() )
426 currentClassificationElem.setAttribute(
"layerId", currentLayerId );
431 QDomNodeList textItemList = currentLayerItemElem.elementsByTagName(
"TextItem" );
432 QDomElement currentTextItem;
434 for (
int j = 0; j < textItemList.size(); ++j )
436 currentTextItem = textItemList.at( j ).toElement();
437 if ( currentTextItem.isNull() )
442 QDomElement classificationElement;
443 if ( vectorClassificationList.size() > 0 )
445 classificationElement =
mDom.createElement(
"VectorClassificationItem" );
449 classificationElement =
mDom.createElement(
"RasterClassificationItem" );
452 classificationElement.setAttribute(
"layerId", currentLayerId );
453 classificationElement.setAttribute(
"text", currentTextItem.attribute(
"text" ) );
454 currentLayerItemElem.replaceChild( classificationElement, currentTextItem );
466 QDomNodeList layerItemList =
mDom.elementsByTagName(
"rasterproperties" );
467 for (
int i = 0; i < layerItemList.size(); ++i )
469 QDomElement rasterPropertiesElem = layerItemList.at( i ).toElement();
470 QDomNode layerNode = rasterPropertiesElem.parentNode();
471 QDomElement dataSourceElem = layerNode.firstChildElement(
"datasource" );
472 QDomElement layerNameElem = layerNode.firstChildElement(
"layername" );
482 QDomNodeList composerMapList =
mDom.elementsByTagName(
"ComposerMap" );
483 for (
int i = 0; i < composerMapList.size(); ++i )
485 QDomNodeList gridList = composerMapList.at( i ).toElement().elementsByTagName(
"Grid" );
486 for (
int j = 0; j < gridList.size(); ++j )
488 QDomNodeList annotationList = gridList.at( j ).toElement().elementsByTagName(
"Annotation" );
489 for (
int k = 0; k < annotationList.size(); ++k )
491 QDomElement annotationElem = annotationList.at( k ).toElement();
494 if ( annotationElem.hasAttribute(
"position" ) )
496 int pos = annotationElem.attribute(
"position" ).toInt();
497 annotationElem.setAttribute(
"leftPosition", pos );
498 annotationElem.setAttribute(
"rightPosition", pos );
499 annotationElem.setAttribute(
"topPosition", pos );
500 annotationElem.setAttribute(
"bottomPosition", pos );
501 annotationElem.removeAttribute(
"position" );
505 if ( annotationElem.hasAttribute(
"direction" ) )
507 int dir = annotationElem.attribute(
"direction" ).toInt();
510 annotationElem.setAttribute(
"leftDirection", 0 );
511 annotationElem.setAttribute(
"rightDirection", 0 );
512 annotationElem.setAttribute(
"topDirection", 1 );
513 annotationElem.setAttribute(
"bottomDirection", 1 );
517 annotationElem.setAttribute(
"leftDirection", 1 );
518 annotationElem.setAttribute(
"rightDirection", 1 );
519 annotationElem.setAttribute(
"topDirection", 0 );
520 annotationElem.setAttribute(
"bottomDirection", 0 );
524 annotationElem.setAttribute(
"leftDirection", dir );
525 annotationElem.setAttribute(
"rightDirection", dir );
526 annotationElem.setAttribute(
"topDirection", dir );
527 annotationElem.setAttribute(
"bottomDirection", dir );
529 annotationElem.removeAttribute(
"direction" );
536 QDomNodeList composerList =
mDom.elementsByTagName(
"Composer" );
537 for (
int i = 0; i < composerList.size(); ++i )
539 QDomElement composerElem = composerList.at( i ).toElement();
542 QDomElement compositionElem = composerElem.firstChildElement(
"Composition" );
543 if ( compositionElem.isNull() )
548 QDomNodeList composerChildren = composerElem.childNodes();
550 if ( composerChildren.size() < 1 )
555 for (
int j = composerChildren.size() - 1; j >= 0; --j )
557 QDomElement childElem = composerChildren.at( j ).toElement();
558 if ( childElem.tagName() ==
"Composition" )
563 composerElem.removeChild( childElem );
564 compositionElem.appendChild( childElem );
572 QDomNodeList rendererList =
mDom.elementsByTagName(
"renderer-v2" );
573 for (
int i = 0; i < rendererList.size(); ++i )
575 QDomNodeList layerList = rendererList.at( i ).toElement().elementsByTagName(
"layer" );
576 for (
int j = 0; j < layerList.size(); ++j )
578 QDomElement layerElem = layerList.at( j ).toElement();
579 if ( layerElem.attribute(
"class" ) ==
"SimpleFill" )
581 QDomNodeList propList = layerElem.elementsByTagName(
"prop" );
582 for (
int k = 0; k < propList.size(); ++k )
584 QDomElement propElem = propList.at( k ).toElement();
585 if ( propElem.attribute(
"k" ) ==
"color" || propElem.attribute(
"k" ) ==
"color_border" )
587 propElem.setAttribute(
"v", propElem.attribute(
"v" ).section(
",", 0, 2 ) +
",255" );
602 QDomNode noDataNode = rasterPropertiesElem.namedItem(
"mNoDataValue" );
603 QDomElement noDataElement = noDataNode.toElement();
604 if ( !noDataElement.text().isEmpty() )
606 QgsDebugMsg(
"mNoDataValue = " + noDataElement.text() );
607 QDomElement noDataElem = doc.createElement(
"noData" );
609 QDomElement noDataRangeList = doc.createElement(
"noDataRangeList" );
610 noDataRangeList.setAttribute(
"bandNo", 1 );
612 QDomElement noDataRange = doc.createElement(
"noDataRange" );
613 noDataRange.setAttribute(
"min", noDataElement.text() );
614 noDataRange.setAttribute(
"max", noDataElement.text() );
615 noDataRangeList.appendChild( noDataRange );
617 noDataElem.appendChild( noDataRangeList );
619 parentNode.appendChild( noDataElem );
622 QDomElement rasterRendererElem = doc.createElement(
"rasterrenderer" );
626 rasterRendererElem.setAttribute(
"invertColor",
"0" );
627 QDomElement invertColorElem = rasterPropertiesElem.firstChildElement(
"mInvertColor" );
628 if ( !invertColorElem.isNull() )
630 if ( invertColorElem.text() ==
"true" )
632 rasterRendererElem.setAttribute(
"invertColor",
"1" );
637 rasterRendererElem.setAttribute(
"opacity",
"1" );
638 QDomElement transparencyElem = parentNode.firstChildElement(
"transparencyLevelInt" );
639 if ( !transparencyElem.isNull() )
641 double transparency = transparencyElem.text().toInt();
642 rasterRendererElem.setAttribute(
"opacity", QString::number( transparency / 255.0 ) );
646 rasterRendererElem.setAttribute(
"alphaBand", -1 );
649 int grayBand =
rasterBandNumber( rasterPropertiesElem,
"mGrayBandName", rlayer );
652 QString drawingStyle = rasterPropertiesElem.firstChildElement(
"mDrawingStyle" ).text();
659 if ( drawingStyle ==
"PalettedColor" )
661 QDomElement customColorRampElem = rasterPropertiesElem.firstChildElement(
"customColorRamp" );
662 QDomNodeList colorRampEntryList = customColorRampElem.elementsByTagName(
"colorRampEntry" );
664 for (
int i = 0; i < colorRampEntryList.size(); ++i )
666 QDomElement colorRampEntryElem = colorRampEntryList.at( i ).toElement();
667 QString strValue = colorRampEntryElem.attribute(
"value" );
668 double value = strValue.toDouble();
669 if ( value < 0 || value > 10000 || value != (
int )value )
671 QgsDebugMsg( QString(
"forcing SingleBandPseudoColor value = %1" ).arg( value ) );
672 drawingStyle =
"SingleBandPseudoColor";
678 if ( drawingStyle ==
"SingleBandGray" )
680 rasterRendererElem.setAttribute(
"type",
"singlebandgray" );
681 rasterRendererElem.setAttribute(
"grayBand", grayBand );
684 else if ( drawingStyle ==
"SingleBandPseudoColor" )
686 rasterRendererElem.setAttribute(
"type",
"singlebandpseudocolor" );
687 rasterRendererElem.setAttribute(
"band", grayBand );
688 QDomElement newRasterShaderElem = doc.createElement(
"rastershader" );
689 QDomElement newColorRampShaderElem = doc.createElement(
"colorrampshader" );
690 newRasterShaderElem.appendChild( newColorRampShaderElem );
691 rasterRendererElem.appendChild( newRasterShaderElem );
694 QString colorShadingAlgorithm = rasterPropertiesElem.firstChildElement(
"mColorShadingAlgorithm" ).text();
695 if ( colorShadingAlgorithm ==
"PseudoColorShader" || colorShadingAlgorithm ==
"FreakOutShader" )
697 newColorRampShaderElem.setAttribute(
"colorRampType",
"INTERPOLATED" );
703 double breakSize = ( maxValue - minValue ) / 3;
705 QStringList colorList;
706 if ( colorShadingAlgorithm ==
"FreakOutShader" )
708 colorList <<
"#ff00ff" <<
"#00ffff" <<
"#ff0000" <<
"#00ff00";
712 colorList <<
"#0000ff" <<
"#00ffff" <<
"#ffff00" <<
"#ff0000";
714 QStringList::const_iterator colorIt = colorList.constBegin();
715 double boundValue = minValue;
716 for ( ; colorIt != colorList.constEnd(); ++colorIt )
718 QDomElement newItemElem = doc.createElement(
"item" );
719 newItemElem.setAttribute(
"value", QString::number( boundValue ) );
720 newItemElem.setAttribute(
"label", QString::number( boundValue ) );
721 newItemElem.setAttribute(
"color", *colorIt );
722 newColorRampShaderElem.appendChild( newItemElem );
723 boundValue += breakSize;
726 else if ( colorShadingAlgorithm ==
"ColorRampShader" )
728 QDomElement customColorRampElem = rasterPropertiesElem.firstChildElement(
"customColorRamp" );
729 QString type = customColorRampElem.firstChildElement(
"colorRampType" ).text();
730 newColorRampShaderElem.setAttribute(
"colorRampType", type );
731 QDomNodeList colorNodeList = customColorRampElem.elementsByTagName(
"colorRampEntry" );
733 QString value, label;
735 int red, green, blue;
736 QDomElement currentItemElem;
737 for (
int i = 0; i < colorNodeList.size(); ++i )
739 currentItemElem = colorNodeList.at( i ).toElement();
740 value = currentItemElem.attribute(
"value" );
741 label = currentItemElem.attribute(
"label" );
742 red = currentItemElem.attribute(
"red" ).toInt();
743 green = currentItemElem.attribute(
"green" ).toInt();
744 blue = currentItemElem.attribute(
"blue" ).toInt();
745 newColor = QColor( red, green, blue );
746 QDomElement newItemElem = doc.createElement(
"item" );
747 newItemElem.setAttribute(
"value", value );
748 newItemElem.setAttribute(
"label", label );
749 newItemElem.setAttribute(
"color", newColor.name() );
750 newColorRampShaderElem.appendChild( newItemElem );
754 else if ( drawingStyle ==
"PalettedColor" )
756 rasterRendererElem.setAttribute(
"type",
"paletted" );
757 rasterRendererElem.setAttribute(
"band", grayBand );
758 QDomElement customColorRampElem = rasterPropertiesElem.firstChildElement(
"customColorRamp" );
759 QDomNodeList colorRampEntryList = customColorRampElem.elementsByTagName(
"colorRampEntry" );
760 QDomElement newColorPaletteElem = doc.createElement(
"colorPalette" );
766 QDomElement colorRampEntryElem;
767 for (
int i = 0; i < colorRampEntryList.size(); ++i )
769 colorRampEntryElem = colorRampEntryList.at( i ).toElement();
770 QDomElement newPaletteElem = doc.createElement(
"paletteEntry" );
771 value = ( int )( colorRampEntryElem.attribute(
"value" ).toDouble() );
772 newPaletteElem.setAttribute(
"value", value );
773 red = colorRampEntryElem.attribute(
"red" ).toInt();
774 green = colorRampEntryElem.attribute(
"green" ).toInt();
775 blue = colorRampEntryElem.attribute(
"blue" ).toInt();
776 newPaletteElem.setAttribute(
"color", QColor( red, green, blue ).name() );
777 newColorPaletteElem.appendChild( newPaletteElem );
779 rasterRendererElem.appendChild( newColorPaletteElem );
781 else if ( drawingStyle ==
"MultiBandColor" )
783 rasterRendererElem.setAttribute(
"type",
"multibandcolor" );
786 int redBand =
rasterBandNumber( rasterPropertiesElem,
"mRedBandName", rlayer );
787 int greenBand =
rasterBandNumber( rasterPropertiesElem,
"mGreenBandName", rlayer );
788 int blueBand =
rasterBandNumber( rasterPropertiesElem,
"mBlueBandName", rlayer );
789 rasterRendererElem.setAttribute(
"redBand", redBand );
790 rasterRendererElem.setAttribute(
"greenBand", greenBand );
791 rasterRendererElem.setAttribute(
"blueBand", blueBand );
801 if ( !parentNode.isNull() )
803 parentNode.replaceChild( rasterRendererElem, rasterPropertiesElem );
816 QDomElement rasterBandElem = rasterPropertiesElem.firstChildElement( bandName );
817 if ( !rasterBandElem.isNull() )
819 QRegExp re(
"(\\d+)" );
821 if ( re.indexIn( rasterBandElem.text() ) >= 0 )
823 return re.cap( 1 ).toInt();
831 if ( rasterproperties.isNull() || rendererElem.isNull() )
836 double minimumValue = 0;
837 double maximumValue = 0;
838 QDomElement contrastMinMaxElem = rasterproperties.firstChildElement(
"contrastEnhancementMinMaxValues" );
839 if ( contrastMinMaxElem.isNull() )
844 QDomElement contrastEnhancementAlgorithmElem = rasterproperties.firstChildElement(
"mContrastEnhancementAlgorithm" );
845 if ( contrastEnhancementAlgorithmElem.isNull() )
851 int algorithmEnum = 0;
852 QString algorithmString = contrastEnhancementAlgorithmElem.text();
853 if ( algorithmString ==
"StretchToMinimumMaximum" )
857 else if ( algorithmString ==
"StretchAndClipToMinimumMaximum" )
861 else if ( algorithmString ==
"ClipToMinimumMaximum" )
865 else if ( algorithmString ==
"UserDefinedEnhancement" )
870 QDomNodeList minMaxEntryList = contrastMinMaxElem.elementsByTagName(
"minMaxEntry" );
871 QStringList enhancementNameList;
872 if ( minMaxEntryList.size() == 1 )
874 enhancementNameList <<
"contrastEnhancement";
876 if ( minMaxEntryList.size() == 3 )
878 enhancementNameList <<
"redContrastEnhancement" <<
"greenContrastEnhancement" <<
"blueContrastEnhancement";
880 if ( minMaxEntryList.size() > enhancementNameList.size() )
885 QDomElement minMaxEntryElem;
886 for (
int i = 0; i < minMaxEntryList.size(); ++i )
888 minMaxEntryElem = minMaxEntryList.at( i ).toElement();
889 QDomElement minElem = minMaxEntryElem.firstChildElement(
"min" );
890 if ( minElem.isNull() )
894 minimumValue = minElem.text().toDouble();
896 QDomElement maxElem = minMaxEntryElem.firstChildElement(
"max" );
897 if ( maxElem.isNull() )
901 maximumValue = maxElem.text().toDouble();
903 QDomElement newContrastEnhancementElem = doc.createElement( enhancementNameList.at( i ) );
904 QDomElement newMinValElem = doc.createElement(
"minValue" );
905 QDomText minText = doc.createTextNode( QString::number( minimumValue ) );
906 newMinValElem.appendChild( minText );
907 newContrastEnhancementElem.appendChild( newMinValElem );
908 QDomElement newMaxValElem = doc.createElement(
"maxValue" );
909 QDomText maxText = doc.createTextNode( QString::number( maximumValue ) );
910 newMaxValElem.appendChild( maxText );
911 newContrastEnhancementElem.appendChild( newMaxValElem );
913 QDomElement newAlgorithmElem = doc.createElement(
"algorithm" );
914 QDomText newAlgorithmText = doc.createTextNode( QString::number( algorithmEnum ) );
915 newAlgorithmElem.appendChild( newAlgorithmText );
916 newContrastEnhancementElem.appendChild( newAlgorithmElem );
918 rendererElem.appendChild( newContrastEnhancementElem );
927 Q_UNUSED( rendererElem );