bool QgsComposerLabel::writeXml( QDomElement &elem, QDomDocument &doc ) const { if ( elem.isNull() ) { return false; } QDomElement composerLabelElem = doc.createElement( QStringLiteral( "ComposerLabel" ) ); composerLabelElem.setAttribute( QStringLiteral( "htmlState" ), mHtmlState ); composerLabelElem.setAttribute( QStringLiteral( "labelText" ), mText ); composerLabelElem.setAttribute( QStringLiteral( "marginX" ), QString::number( mMarginX ) ); composerLabelElem.setAttribute( QStringLiteral( "marginY" ), QString::number( mMarginY ) ); composerLabelElem.setAttribute( QStringLiteral( "halign" ), mHAlignment ); composerLabelElem.setAttribute( QStringLiteral( "valign" ), mVAlignment ); //font QDomElement labelFontElem = QgsFontUtils::toXmlElement( mFont, doc, QStringLiteral( "LabelFont" ) ); composerLabelElem.appendChild( labelFontElem ); //font color QDomElement fontColorElem = doc.createElement( QStringLiteral( "FontColor" ) ); fontColorElem.setAttribute( QStringLiteral( "red" ), mFontColor.red() ); fontColorElem.setAttribute( QStringLiteral( "green" ), mFontColor.green() ); fontColorElem.setAttribute( QStringLiteral( "blue" ), mFontColor.blue() ); composerLabelElem.appendChild( fontColorElem ); elem.appendChild( composerLabelElem ); return _writeXml( composerLabelElem, doc ); }
bool QgsComposerArrow::writeXml( QDomElement& elem, QDomDocument & doc ) const { QDomElement composerArrowElem = doc.createElement( QStringLiteral( "ComposerArrow" ) ); composerArrowElem.setAttribute( QStringLiteral( "arrowHeadWidth" ), QString::number( mArrowHeadWidth ) ); composerArrowElem.setAttribute( QStringLiteral( "arrowHeadFillColor" ), QgsSymbolLayerUtils::encodeColor( mArrowHeadFillColor ) ); composerArrowElem.setAttribute( QStringLiteral( "arrowHeadOutlineColor" ), QgsSymbolLayerUtils::encodeColor( mArrowHeadOutlineColor ) ); composerArrowElem.setAttribute( QStringLiteral( "outlineWidth" ), QString::number( mArrowHeadOutlineWidth ) ); composerArrowElem.setAttribute( QStringLiteral( "markerMode" ), mMarkerMode ); composerArrowElem.setAttribute( QStringLiteral( "startMarkerFile" ), mStartMarkerFile ); composerArrowElem.setAttribute( QStringLiteral( "endMarkerFile" ), mEndMarkerFile ); composerArrowElem.setAttribute( QStringLiteral( "boundsBehaviourVersion" ), QString::number( mBoundsBehaviour ) ); QDomElement styleElem = doc.createElement( QStringLiteral( "lineStyle" ) ); QDomElement lineStyleElem = QgsSymbolLayerUtils::saveSymbol( QString(), mLineSymbol, doc ); styleElem.appendChild( lineStyleElem ); composerArrowElem.appendChild( styleElem ); //start point QDomElement startPointElem = doc.createElement( QStringLiteral( "StartPoint" ) ); startPointElem.setAttribute( QStringLiteral( "x" ), QString::number( mStartPoint.x() ) ); startPointElem.setAttribute( QStringLiteral( "y" ), QString::number( mStartPoint.y() ) ); composerArrowElem.appendChild( startPointElem ); //stop point QDomElement stopPointElem = doc.createElement( QStringLiteral( "StopPoint" ) ); stopPointElem.setAttribute( QStringLiteral( "x" ), QString::number( mStopPoint.x() ) ); stopPointElem.setAttribute( QStringLiteral( "y" ), QString::number( mStopPoint.y() ) ); composerArrowElem.appendChild( stopPointElem ); elem.appendChild( composerArrowElem ); return _writeXml( composerArrowElem, doc ); }
void QgsMultiBandColorRenderer::writeXml( QDomDocument &doc, QDomElement &parentElem ) const { if ( parentElem.isNull() ) { return; } QDomElement rasterRendererElem = doc.createElement( QStringLiteral( "rasterrenderer" ) ); _writeXml( doc, rasterRendererElem ); rasterRendererElem.setAttribute( QStringLiteral( "redBand" ), mRedBand ); rasterRendererElem.setAttribute( QStringLiteral( "greenBand" ), mGreenBand ); rasterRendererElem.setAttribute( QStringLiteral( "blueBand" ), mBlueBand ); //contrast enhancement if ( mRedContrastEnhancement ) { QDomElement redContrastElem = doc.createElement( QStringLiteral( "redContrastEnhancement" ) ); mRedContrastEnhancement->writeXml( doc, redContrastElem ); rasterRendererElem.appendChild( redContrastElem ); } if ( mGreenContrastEnhancement ) { QDomElement greenContrastElem = doc.createElement( QStringLiteral( "greenContrastEnhancement" ) ); mGreenContrastEnhancement->writeXml( doc, greenContrastElem ); rasterRendererElem.appendChild( greenContrastElem ); } if ( mBlueContrastEnhancement ) { QDomElement blueContrastElem = doc.createElement( QStringLiteral( "blueContrastEnhancement" ) ); mBlueContrastEnhancement->writeXml( doc, blueContrastElem ); rasterRendererElem.appendChild( blueContrastElem ); } parentElem.appendChild( rasterRendererElem ); }
void QgsSingleBandGrayRenderer::writeXml( QDomDocument &doc, QDomElement &parentElem ) const { if ( parentElem.isNull() ) { return; } QDomElement rasterRendererElem = doc.createElement( QStringLiteral( "rasterrenderer" ) ); _writeXml( doc, rasterRendererElem ); rasterRendererElem.setAttribute( QStringLiteral( "grayBand" ), mGrayBand ); QString gradient; if ( mGradient == BlackToWhite ) { gradient = QStringLiteral( "BlackToWhite" ); } else { gradient = QStringLiteral( "WhiteToBlack" ); } rasterRendererElem.setAttribute( QStringLiteral( "gradient" ), gradient ); if ( mContrastEnhancement ) { QDomElement contrastElem = doc.createElement( QStringLiteral( "contrastEnhancement" ) ); mContrastEnhancement->writeXml( doc, contrastElem ); rasterRendererElem.appendChild( contrastElem ); } parentElem.appendChild( rasterRendererElem ); }
void QgsFormAnnotation::writeXml( QDomElement &elem, QDomDocument &doc, const QgsReadWriteContext &context ) const { QDomElement formAnnotationElem = doc.createElement( QStringLiteral( "FormAnnotationItem" ) ); formAnnotationElem.setAttribute( QStringLiteral( "designerForm" ), mDesignerForm ); _writeXml( formAnnotationElem, doc, context ); elem.appendChild( formAnnotationElem ); }
void QgsPalettedRasterRenderer::writeXml( QDomDocument& doc, QDomElement& parentElem ) const { if ( parentElem.isNull() ) { return; } QDomElement rasterRendererElem = doc.createElement( QStringLiteral( "rasterrenderer" ) ); _writeXml( doc, rasterRendererElem ); rasterRendererElem.setAttribute( QStringLiteral( "band" ), mBand ); QDomElement colorPaletteElem = doc.createElement( QStringLiteral( "colorPalette" ) ); for ( int i = 0; i < mNColors; ++i ) { QDomElement colorElem = doc.createElement( QStringLiteral( "paletteEntry" ) ); colorElem.setAttribute( QStringLiteral( "value" ), i ); colorElem.setAttribute( QStringLiteral( "color" ), QColor( mColors[i] ).name() ); if ( !label( i ).isEmpty() ) { colorElem.setAttribute( QStringLiteral( "label" ), label( i ) ); } colorPaletteElem.appendChild( colorElem ); } rasterRendererElem.appendChild( colorPaletteElem ); parentElem.appendChild( rasterRendererElem ); }
void QgsHtmlAnnotation::writeXml( QDomElement &elem, QDomDocument &doc, const QgsReadWriteContext &context ) const { QDomElement formAnnotationElem = doc.createElement( QStringLiteral( "HtmlAnnotationItem" ) ); formAnnotationElem.setAttribute( QStringLiteral( "htmlfile" ), sourceFile() ); _writeXml( formAnnotationElem, doc, context ); elem.appendChild( formAnnotationElem ); }
void QgsSingleBandColorDataRenderer::writeXml( QDomDocument& doc, QDomElement& parentElem ) const { if ( parentElem.isNull() ) return; QDomElement rasterRendererElem = doc.createElement( QStringLiteral( "rasterrenderer" ) ); _writeXml( doc, rasterRendererElem ); rasterRendererElem.setAttribute( QStringLiteral( "band" ), mBand ); parentElem.appendChild( rasterRendererElem ); }
bool QgsComposerShape::writeXml( QDomElement& elem, QDomDocument & doc ) const { QDomElement composerShapeElem = doc.createElement( "ComposerShape" ); composerShapeElem.setAttribute( "shapeType", mShape ); composerShapeElem.setAttribute( "cornerRadius", mCornerRadius ); QDomElement shapeStyleElem = QgsSymbolLayerUtils::saveSymbol( QString(), mShapeStyleSymbol, doc ); composerShapeElem.appendChild( shapeStyleElem ); elem.appendChild( composerShapeElem ); return _writeXml( composerShapeElem, doc ); }
void QgsSvgAnnotationItem::writeXml( QDomDocument& doc ) const { QDomElement documentElem = doc.documentElement(); if ( documentElem.isNull() ) { return; } QDomElement svgAnnotationElem = doc.createElement( "SVGAnnotationItem" ); svgAnnotationElem.setAttribute( "file", QgsProject::instance()->writePath( mFilePath ) ); _writeXml( doc, svgAnnotationElem ); documentElem.appendChild( svgAnnotationElem ); }
bool QgsComposerFrame::writeXml( QDomElement& elem, QDomDocument & doc ) const { QDomElement frameElem = doc.createElement( "ComposerFrame" ); frameElem.setAttribute( "sectionX", QString::number( mSection.x() ) ); frameElem.setAttribute( "sectionY", QString::number( mSection.y() ) ); frameElem.setAttribute( "sectionWidth", QString::number( mSection.width() ) ); frameElem.setAttribute( "sectionHeight", QString::number( mSection.height() ) ); frameElem.setAttribute( "hidePageIfEmpty", mHidePageIfEmpty ); frameElem.setAttribute( "hideBackgroundIfEmpty", mHideBackgroundIfEmpty ); elem.appendChild( frameElem ); return _writeXml( frameElem, doc ); }
bool QgsComposerTableV2::writeXml( QDomElement &elem, QDomDocument &doc, bool ignoreFrames ) const { elem.setAttribute( QStringLiteral( "cellMargin" ), QString::number( mCellMargin ) ); elem.setAttribute( QStringLiteral( "emptyTableMode" ), QString::number( static_cast< int >( mEmptyTableMode ) ) ); elem.setAttribute( QStringLiteral( "emptyTableMessage" ), mEmptyTableMessage ); elem.setAttribute( QStringLiteral( "showEmptyRows" ), mShowEmptyRows ); elem.appendChild( QgsFontUtils::toXmlElement( mHeaderFont, doc, QStringLiteral( "headerFontProperties" ) ) ); elem.setAttribute( QStringLiteral( "headerFontColor" ), QgsSymbolLayerUtils::encodeColor( mHeaderFontColor ) ); elem.setAttribute( QStringLiteral( "headerHAlignment" ), QString::number( static_cast< int >( mHeaderHAlignment ) ) ); elem.setAttribute( QStringLiteral( "headerMode" ), QString::number( static_cast< int >( mHeaderMode ) ) ); elem.appendChild( QgsFontUtils::toXmlElement( mContentFont, doc, QStringLiteral( "contentFontProperties" ) ) ); elem.setAttribute( QStringLiteral( "contentFontColor" ), QgsSymbolLayerUtils::encodeColor( mContentFontColor ) ); elem.setAttribute( QStringLiteral( "gridStrokeWidth" ), QString::number( mGridStrokeWidth ) ); elem.setAttribute( QStringLiteral( "gridColor" ), QgsSymbolLayerUtils::encodeColor( mGridColor ) ); elem.setAttribute( QStringLiteral( "horizontalGrid" ), mHorizontalGrid ); elem.setAttribute( QStringLiteral( "verticalGrid" ), mVerticalGrid ); elem.setAttribute( QStringLiteral( "showGrid" ), mShowGrid ); elem.setAttribute( QStringLiteral( "backgroundColor" ), QgsSymbolLayerUtils::encodeColor( mBackgroundColor ) ); elem.setAttribute( QStringLiteral( "wrapBehavior" ), QString::number( static_cast< int >( mWrapBehavior ) ) ); //columns QDomElement displayColumnsElem = doc.createElement( QStringLiteral( "displayColumns" ) ); QList<QgsComposerTableColumn *>::const_iterator columnIt = mColumns.constBegin(); for ( ; columnIt != mColumns.constEnd(); ++columnIt ) { QDomElement columnElem = doc.createElement( QStringLiteral( "column" ) ); ( *columnIt )->writeXml( columnElem, doc ); displayColumnsElem.appendChild( columnElem ); } elem.appendChild( displayColumnsElem ); //cell styles QDomElement stylesElem = doc.createElement( QStringLiteral( "cellStyles" ) ); QMap< CellStyleGroup, QString >::const_iterator it = mCellStyleNames.constBegin(); for ( ; it != mCellStyleNames.constEnd(); ++it ) { QString styleName = it.value(); QDomElement styleElem = doc.createElement( styleName ); QgsComposerTableStyle *style = mCellStyles.value( it.key() ); if ( style ) { style->writeXml( styleElem, doc ); stylesElem.appendChild( styleElem ); } } elem.appendChild( stylesElem ); bool state = _writeXml( elem, doc, ignoreFrames ); return state; }
void QgsTextAnnotationItem::writeXml( QDomDocument& doc ) const { QDomElement documentElem = doc.documentElement(); if ( documentElem.isNull() ) { return; } QDomElement annotationElem = doc.createElement( "TextAnnotationItem" ); if ( mDocument ) { annotationElem.setAttribute( "document", mDocument->toHtml() ); } _writeXml( doc, annotationElem ); documentElem.appendChild( annotationElem ); }
bool QgsComposerHtml::writeXml( QDomElement& elem, QDomDocument & doc, bool ignoreFrames ) const { QDomElement htmlElem = doc.createElement( "ComposerHtml" ); htmlElem.setAttribute( "contentMode", QString::number( static_cast< int >( mContentMode ) ) ); htmlElem.setAttribute( "url", mUrl.toString() ); htmlElem.setAttribute( "html", mHtml ); htmlElem.setAttribute( "evaluateExpressions", mEvaluateExpressions ? "true" : "false" ); htmlElem.setAttribute( "useSmartBreaks", mUseSmartBreaks ? "true" : "false" ); htmlElem.setAttribute( "maxBreakDistance", QString::number( mMaxBreakDistance ) ); htmlElem.setAttribute( "stylesheet", mUserStylesheet ); htmlElem.setAttribute( "stylesheetEnabled", mEnableUserStylesheet ? "true" : "false" ); bool state = _writeXml( htmlElem, doc, ignoreFrames ); elem.appendChild( htmlElem ); return state; }
void QgsHillshadeRenderer::writeXml( QDomDocument &doc, QDomElement &parentElem ) const { if ( parentElem.isNull() ) { return; } QDomElement rasterRendererElem = doc.createElement( "rasterrenderer" ); _writeXml( doc, rasterRendererElem ); rasterRendererElem.setAttribute( "band", mBand ); rasterRendererElem.setAttribute( "azimuth", QString::number( mLightAzimuth ) ); rasterRendererElem.setAttribute( "angle", QString::number( mLightAngle ) ); rasterRendererElem.setAttribute( "zfactor", QString::number( mZFactor ) ); rasterRendererElem.setAttribute( "multidirection", QString::number( mMultiDirectional ) ); parentElem.appendChild( rasterRendererElem ); }
void QgsSingleBandPseudoColorRenderer::writeXml( QDomDocument& doc, QDomElement& parentElem ) const { if ( parentElem.isNull() ) { return; } QDomElement rasterRendererElem = doc.createElement( QStringLiteral( "rasterrenderer" ) ); _writeXml( doc, rasterRendererElem ); rasterRendererElem.setAttribute( QStringLiteral( "band" ), mBand ); if ( mShader ) { mShader->writeXml( doc, rasterRendererElem ); //todo: include color ramp items directly in this renderer } rasterRendererElem.setAttribute( QStringLiteral( "classificationMin" ), QgsRasterBlock::printValue( mClassificationMin ) ); rasterRendererElem.setAttribute( QStringLiteral( "classificationMax" ), QgsRasterBlock::printValue( mClassificationMax ) ); rasterRendererElem.setAttribute( QStringLiteral( "classificationMinMaxOrigin" ), QgsRasterRenderer::minMaxOriginName( mClassificationMinMaxOrigin ) ); parentElem.appendChild( rasterRendererElem ); }
void QgsPalettedRasterRenderer::writeXml( QDomDocument &doc, QDomElement &parentElem ) const { if ( parentElem.isNull() ) { return; } QDomElement rasterRendererElem = doc.createElement( QStringLiteral( "rasterrenderer" ) ); _writeXml( doc, rasterRendererElem ); rasterRendererElem.setAttribute( QStringLiteral( "band" ), mBand ); QDomElement colorPaletteElem = doc.createElement( QStringLiteral( "colorPalette" ) ); ClassData::const_iterator it = mClassData.constBegin(); for ( ; it != mClassData.constEnd(); ++it ) { QColor color = it->color; QDomElement colorElem = doc.createElement( QStringLiteral( "paletteEntry" ) ); colorElem.setAttribute( QStringLiteral( "value" ), it->value ); colorElem.setAttribute( QStringLiteral( "color" ), color.name() ); colorElem.setAttribute( QStringLiteral( "alpha" ), color.alpha() ); if ( !it->label.isEmpty() ) { colorElem.setAttribute( QStringLiteral( "label" ), it->label ); } colorPaletteElem.appendChild( colorElem ); } rasterRendererElem.appendChild( colorPaletteElem ); // save source color ramp if ( mSourceColorRamp ) { QDomElement colorRampElem = QgsSymbolLayerUtils::saveColorRamp( QStringLiteral( "[source]" ), mSourceColorRamp.get(), doc ); rasterRendererElem.appendChild( colorRampElem ); } parentElem.appendChild( rasterRendererElem ); }
bool QgsComposerScaleBar::writeXml( QDomElement& elem, QDomDocument & doc ) const { if ( elem.isNull() ) { return false; } QDomElement composerScaleBarElem = doc.createElement( QStringLiteral( "ComposerScaleBar" ) ); composerScaleBarElem.setAttribute( QStringLiteral( "height" ), QString::number( mHeight ) ); composerScaleBarElem.setAttribute( QStringLiteral( "labelBarSpace" ), QString::number( mLabelBarSpace ) ); composerScaleBarElem.setAttribute( QStringLiteral( "boxContentSpace" ), QString::number( mBoxContentSpace ) ); composerScaleBarElem.setAttribute( QStringLiteral( "numSegments" ), mNumSegments ); composerScaleBarElem.setAttribute( QStringLiteral( "numSegmentsLeft" ), mNumSegmentsLeft ); composerScaleBarElem.setAttribute( QStringLiteral( "numUnitsPerSegment" ), QString::number( mNumUnitsPerSegment ) ); composerScaleBarElem.setAttribute( QStringLiteral( "segmentSizeMode" ), mSegmentSizeMode ); composerScaleBarElem.setAttribute( QStringLiteral( "minBarWidth" ), mMinBarWidth ); composerScaleBarElem.setAttribute( QStringLiteral( "maxBarWidth" ), mMaxBarWidth ); composerScaleBarElem.setAttribute( QStringLiteral( "segmentMillimeters" ), QString::number( mSegmentMillimeters ) ); composerScaleBarElem.setAttribute( QStringLiteral( "numMapUnitsPerScaleBarUnit" ), QString::number( mNumMapUnitsPerScaleBarUnit ) ); composerScaleBarElem.appendChild( QgsFontUtils::toXmlElement( mFont, doc, QStringLiteral( "scaleBarFont" ) ) ); composerScaleBarElem.setAttribute( QStringLiteral( "outlineWidth" ), QString::number( mPen.widthF() ) ); composerScaleBarElem.setAttribute( QStringLiteral( "unitLabel" ), mUnitLabeling ); composerScaleBarElem.setAttribute( QStringLiteral( "units" ), mUnits ); composerScaleBarElem.setAttribute( QStringLiteral( "lineJoinStyle" ), QgsSymbolLayerUtils::encodePenJoinStyle( mLineJoinStyle ) ); composerScaleBarElem.setAttribute( QStringLiteral( "lineCapStyle" ), QgsSymbolLayerUtils::encodePenCapStyle( mLineCapStyle ) ); //style if ( mStyle ) { composerScaleBarElem.setAttribute( QStringLiteral( "style" ), mStyle->name() ); } //map id if ( mComposerMap ) { composerScaleBarElem.setAttribute( QStringLiteral( "mapId" ), mComposerMap->id() ); } //colors //fill color QDomElement fillColorElem = doc.createElement( QStringLiteral( "fillColor" ) ); QColor fillColor = mBrush.color(); fillColorElem.setAttribute( QStringLiteral( "red" ), QString::number( fillColor.red() ) ); fillColorElem.setAttribute( QStringLiteral( "green" ), QString::number( fillColor.green() ) ); fillColorElem.setAttribute( QStringLiteral( "blue" ), QString::number( fillColor.blue() ) ); fillColorElem.setAttribute( QStringLiteral( "alpha" ), QString::number( fillColor.alpha() ) ); composerScaleBarElem.appendChild( fillColorElem ); //fill color 2 QDomElement fillColor2Elem = doc.createElement( QStringLiteral( "fillColor2" ) ); QColor fillColor2 = mBrush2.color(); fillColor2Elem.setAttribute( QStringLiteral( "red" ), QString::number( fillColor2.red() ) ); fillColor2Elem.setAttribute( QStringLiteral( "green" ), QString::number( fillColor2.green() ) ); fillColor2Elem.setAttribute( QStringLiteral( "blue" ), QString::number( fillColor2.blue() ) ); fillColor2Elem.setAttribute( QStringLiteral( "alpha" ), QString::number( fillColor2.alpha() ) ); composerScaleBarElem.appendChild( fillColor2Elem ); //pen color QDomElement strokeColorElem = doc.createElement( QStringLiteral( "strokeColor" ) ); QColor strokeColor = mPen.color(); strokeColorElem.setAttribute( QStringLiteral( "red" ), QString::number( strokeColor.red() ) ); strokeColorElem.setAttribute( QStringLiteral( "green" ), QString::number( strokeColor.green() ) ); strokeColorElem.setAttribute( QStringLiteral( "blue" ), QString::number( strokeColor.blue() ) ); strokeColorElem.setAttribute( QStringLiteral( "alpha" ), QString::number( strokeColor.alpha() ) ); composerScaleBarElem.appendChild( strokeColorElem ); //font color QDomElement fontColorElem = doc.createElement( QStringLiteral( "textColor" ) ); fontColorElem.setAttribute( QStringLiteral( "red" ), QString::number( mFontColor.red() ) ); fontColorElem.setAttribute( QStringLiteral( "green" ), QString::number( mFontColor.green() ) ); fontColorElem.setAttribute( QStringLiteral( "blue" ), QString::number( mFontColor.blue() ) ); fontColorElem.setAttribute( QStringLiteral( "alpha" ), QString::number( mFontColor.alpha() ) ); composerScaleBarElem.appendChild( fontColorElem ); //alignment composerScaleBarElem.setAttribute( QStringLiteral( "alignment" ), QString::number( static_cast< int >( mAlignment ) ) ); elem.appendChild( composerScaleBarElem ); return _writeXml( composerScaleBarElem, doc ); }
bool QgsComposerLegend::writeXml( QDomElement &elem, QDomDocument &doc ) const { if ( elem.isNull() ) { return false; } QDomElement composerLegendElem = doc.createElement( QStringLiteral( "ComposerLegend" ) ); elem.appendChild( composerLegendElem ); //write general properties composerLegendElem.setAttribute( QStringLiteral( "title" ), mTitle ); composerLegendElem.setAttribute( QStringLiteral( "titleAlignment" ), QString::number( static_cast< int >( mSettings.titleAlignment() ) ) ); composerLegendElem.setAttribute( QStringLiteral( "columnCount" ), QString::number( mColumnCount ) ); composerLegendElem.setAttribute( QStringLiteral( "splitLayer" ), QString::number( mSettings.splitLayer() ) ); composerLegendElem.setAttribute( QStringLiteral( "equalColumnWidth" ), QString::number( mSettings.equalColumnWidth() ) ); composerLegendElem.setAttribute( QStringLiteral( "boxSpace" ), QString::number( mSettings.boxSpace() ) ); composerLegendElem.setAttribute( QStringLiteral( "columnSpace" ), QString::number( mSettings.columnSpace() ) ); composerLegendElem.setAttribute( QStringLiteral( "symbolWidth" ), QString::number( mSettings.symbolSize().width() ) ); composerLegendElem.setAttribute( QStringLiteral( "symbolHeight" ), QString::number( mSettings.symbolSize().height() ) ); composerLegendElem.setAttribute( QStringLiteral( "lineSpacing" ), QString::number( mSettings.lineSpacing() ) ); composerLegendElem.setAttribute( QStringLiteral( "rasterBorder" ), mSettings.drawRasterStroke() ); composerLegendElem.setAttribute( QStringLiteral( "rasterBorderColor" ), QgsSymbolLayerUtils::encodeColor( mSettings.rasterStrokeColor() ) ); composerLegendElem.setAttribute( QStringLiteral( "rasterBorderWidth" ), QString::number( mSettings.rasterStrokeWidth() ) ); composerLegendElem.setAttribute( QStringLiteral( "wmsLegendWidth" ), QString::number( mSettings.wmsLegendSize().width() ) ); composerLegendElem.setAttribute( QStringLiteral( "wmsLegendHeight" ), QString::number( mSettings.wmsLegendSize().height() ) ); composerLegendElem.setAttribute( QStringLiteral( "wrapChar" ), mSettings.wrapChar() ); composerLegendElem.setAttribute( QStringLiteral( "fontColor" ), mSettings.fontColor().name() ); composerLegendElem.setAttribute( QStringLiteral( "resizeToContents" ), mSizeToContents ); if ( mComposerMap ) { composerLegendElem.setAttribute( QStringLiteral( "map" ), mComposerMap->id() ); } QDomElement composerLegendStyles = doc.createElement( QStringLiteral( "styles" ) ); composerLegendElem.appendChild( composerLegendStyles ); style( QgsLegendStyle::Title ).writeXml( QStringLiteral( "title" ), composerLegendStyles, doc ); style( QgsLegendStyle::Group ).writeXml( QStringLiteral( "group" ), composerLegendStyles, doc ); style( QgsLegendStyle::Subgroup ).writeXml( QStringLiteral( "subgroup" ), composerLegendStyles, doc ); style( QgsLegendStyle::Symbol ).writeXml( QStringLiteral( "symbol" ), composerLegendStyles, doc ); style( QgsLegendStyle::SymbolLabel ).writeXml( QStringLiteral( "symbolLabel" ), composerLegendStyles, doc ); if ( mCustomLayerTree ) { // if not using auto-update - store the custom layer tree mCustomLayerTree->writeXml( composerLegendElem ); } if ( mLegendFilterByMap ) { composerLegendElem.setAttribute( QStringLiteral( "legendFilterByMap" ), QStringLiteral( "1" ) ); } composerLegendElem.setAttribute( QStringLiteral( "legendFilterByAtlas" ), mFilterOutAtlas ? QStringLiteral( "1" ) : QStringLiteral( "0" ) ); return _writeXml( composerLegendElem, doc ); }