12 priority = elem.attribute(
"priority" ).toInt();
13 obstacle = elem.attribute(
"obstacle" ).toInt();
14 dist = elem.attribute(
"dist" ).toDouble();
15 xPosColumn = elem.attribute(
"xPosColumn" ).toInt();
16 yPosColumn = elem.attribute(
"yPosColumn" ).toInt();
21 QDomElement diagramLayerElem = doc.createElement(
"DiagramLayerSettings" );
22 diagramLayerElem.setAttribute(
"placement",
placement );
23 diagramLayerElem.setAttribute(
"linePlacementFlags",
placementFlags );
24 diagramLayerElem.setAttribute(
"priority",
priority );
25 diagramLayerElem.setAttribute(
"obstacle",
obstacle );
26 diagramLayerElem.setAttribute(
"dist",
dist );
27 diagramLayerElem.setAttribute(
"xPosColumn",
xPosColumn );
28 diagramLayerElem.setAttribute(
"yPosColumn",
yPosColumn );
29 layerElem.appendChild( diagramLayerElem );
34 font.fromString( elem.attribute(
"font" ) );
36 backgroundColor.setAlpha( elem.attribute(
"backgroundAlpha" ).toInt() );
37 size.setWidth( elem.attribute(
"width" ).toDouble() );
38 size.setHeight( elem.attribute(
"height" ).toDouble() );
39 penColor.setNamedColor( elem.attribute(
"penColor" ) );
40 penWidth = elem.attribute(
"penWidth" ).toDouble();
45 if ( elem.attribute(
"sizeType" ) ==
"MM" )
56 QStringList colorList = elem.attribute(
"colors" ).split(
"/" );
57 QStringList::const_iterator colorIt = colorList.constBegin();
58 for ( ; colorIt != colorList.constEnd(); ++colorIt )
65 QStringList catList = elem.attribute(
"categories" ).split(
"/" );
66 QStringList::const_iterator catIt = catList.constBegin();
67 for ( ; catIt != catList.constEnd(); ++catIt )
75 QDomElement categoryElem = doc.createElement(
"DiagramCategory" );
76 categoryElem.setAttribute(
"font",
font.toString() );
78 categoryElem.setAttribute(
"backgroundAlpha",
backgroundColor.alpha() );
79 categoryElem.setAttribute(
"width",
size.width() );
80 categoryElem.setAttribute(
"height",
size.height() );
81 categoryElem.setAttribute(
"penColor",
penColor.name() );
82 categoryElem.setAttribute(
"penWidth",
penWidth );
87 categoryElem.setAttribute(
"sizeType",
"MM" );
91 categoryElem.setAttribute(
"sizeType",
"MapUnits" );
103 categoryElem.setAttribute(
"colors", colors );
110 categories.append(
"/" );
114 categoryElem.setAttribute(
"categories", categories );
116 rendererElem.appendChild( categoryElem );
168 if ( !size.isValid() )
180 size.rwidth() *= pixelToMap;
181 size.rheight() *= pixelToMap;
188 QPaintDevice* device = painter->device();
191 return device->logicalDpiX();
200 QString diagramType = elem.attribute(
"diagramType" );
201 if ( diagramType ==
"Pie" )
205 else if ( diagramType ==
"Text" )
239 QList<QgsDiagramSettings> settingsList;
246 QDomElement categoryElem = elem.firstChildElement(
"DiagramCategory" );
247 if ( categoryElem.isNull() )
258 QDomElement rendererElem = doc.createElement(
"SingleCategoryDiagramRenderer" );
261 layerElem.appendChild( rendererElem );
275 QList<QgsDiagramSettings> settingsList;
300 if ( attIt == attributes.constEnd() )
304 double value = attIt.value().toDouble();
314 mLowerValue = elem.attribute(
"lowerValue" ).toDouble();
315 mUpperValue = elem.attribute(
"upperValue" ).toDouble();
316 mLowerSize.setWidth( elem.attribute(
"lowerWidth" ).toDouble() );
317 mLowerSize.setHeight( elem.attribute(
"lowerHeight" ).toDouble() );
318 mUpperSize.setWidth( elem.attribute(
"upperWidth" ).toDouble() );
319 mUpperSize.setHeight( elem.attribute(
"upperHeight" ).toDouble() );
321 QDomElement settingsElem = elem.firstChildElement(
"DiagramCategory" );
322 if ( !settingsElem.isNull() )
331 QDomElement rendererElem = doc.createElement(
"LinearlyInterpolatedDiagramRenderer" );
332 rendererElem.setAttribute(
"lowerValue",
mLowerValue );
333 rendererElem.setAttribute(
"upperValue",
mUpperValue );
334 rendererElem.setAttribute(
"lowerWidth",
mLowerSize.width() );
335 rendererElem.setAttribute(
"lowerHeight",
mLowerSize.height() );
336 rendererElem.setAttribute(
"upperWidth",
mUpperSize.width() );
337 rendererElem.setAttribute(
"upperHeight",
mUpperSize.height() );
341 layerElem.appendChild( rendererElem );