QGIS API Documentation  2.13.0-Master
qgsdiagramrendererv2.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  qgsdiagramrendererv2.cpp
3  ---------------------
4  begin : March 2011
5  copyright : (C) 2011 by Marco Hugentobler
6  email : marco dot hugentobler at sourcepole dot ch
7  ***************************************************************************
8  * *
9  * This program is free software; you can redistribute it and/or modify *
10  * it under the terms of the GNU General Public License as published by *
11  * the Free Software Foundation; either version 2 of the License, or *
12  * (at your option) any later version. *
13  * *
14  ***************************************************************************/
15 #include "qgsdiagramrendererv2.h"
16 #include "qgsvectorlayer.h"
17 #include "diagram/qgstextdiagram.h"
18 #include "diagram/qgspiediagram.h"
20 #include "qgsrendercontext.h"
22 #include "qgsfontutils.h"
23 
24 #include <QDomElement>
25 #include <QPainter>
26 
28  : placement( AroundPoint )
29  , placementFlags( OnLine )
30  , priority( 5 )
31  , zIndex( 0.0 )
32  , obstacle( false )
33  , dist( 0.0 )
34  , renderer( nullptr )
35  , ct( nullptr )
36  , xform( nullptr )
37  , xPosColumn( -1 )
38  , yPosColumn( -1 )
39  , showAll( true )
40 {
41 }
42 
44  : placement( rh.placement )
46  , priority( rh.priority )
47  , zIndex( rh.zIndex )
48  , obstacle( rh.obstacle )
49  , dist( rh.dist )
50  , renderer( rh.renderer ? rh.renderer->clone() : nullptr )
51  , ct( rh.ct )
52  , xform( rh.xform )
53  , fields( rh.fields )
54  , xPosColumn( rh.xPosColumn )
55  , yPosColumn( rh.yPosColumn )
56  , showAll( rh.showAll )
57 {
58 }
59 
61 {
62  placement = rh.placement;
64  priority = rh.priority;
65  zIndex = rh.zIndex;
66  obstacle = rh.obstacle;
67  dist = rh.dist;
68  renderer = rh.renderer ? rh.renderer->clone() : nullptr;
69  ct = rh.ct;
70  xform = rh.xform;
71  fields = rh.fields;
74  showAll = rh.showAll;
75  return *this;
76 }
77 
79 {
80  delete renderer;
81 }
82 
84 {
85  Q_UNUSED( layer )
86 
87  placement = static_cast< Placement >( elem.attribute( "placement" ).toInt() );
88  placementFlags = static_cast< LinePlacementFlags >( elem.attribute( "linePlacementFlags" ).toInt() );
89  priority = elem.attribute( "priority" ).toInt();
90  zIndex = elem.attribute( "zIndex" ).toDouble();
91  obstacle = elem.attribute( "obstacle" ).toInt();
92  dist = elem.attribute( "dist" ).toDouble();
93  xPosColumn = elem.attribute( "xPosColumn" ).toInt();
94  yPosColumn = elem.attribute( "yPosColumn" ).toInt();
95  showAll = ( elem.attribute( "showAll", "0" ) != "0" );
96 }
97 
98 void QgsDiagramLayerSettings::writeXML( QDomElement& layerElem, QDomDocument& doc, const QgsVectorLayer* layer ) const
99 {
100  Q_UNUSED( layer )
101 
102  QDomElement diagramLayerElem = doc.createElement( "DiagramLayerSettings" );
103  diagramLayerElem.setAttribute( "placement", placement );
104  diagramLayerElem.setAttribute( "linePlacementFlags", placementFlags );
105  diagramLayerElem.setAttribute( "priority", priority );
106  diagramLayerElem.setAttribute( "zIndex", zIndex );
107  diagramLayerElem.setAttribute( "obstacle", obstacle );
108  diagramLayerElem.setAttribute( "dist", QString::number( dist ) );
109  diagramLayerElem.setAttribute( "xPosColumn", xPosColumn );
110  diagramLayerElem.setAttribute( "yPosColumn", yPosColumn );
111  diagramLayerElem.setAttribute( "showAll", showAll );
112  layerElem.appendChild( diagramLayerElem );
113 }
114 
115 void QgsDiagramSettings::readXML( const QDomElement& elem, const QgsVectorLayer* layer )
116 {
117  Q_UNUSED( layer );
118 
119  enabled = ( elem.attribute( "enabled", "1" ) != "0" );
120  if ( !QgsFontUtils::setFromXmlChildNode( font, elem, "fontProperties" ) )
121  {
122  font.fromString( elem.attribute( "font" ) );
123  }
124  backgroundColor.setNamedColor( elem.attribute( "backgroundColor" ) );
125  backgroundColor.setAlpha( elem.attribute( "backgroundAlpha" ).toInt() );
126  size.setWidth( elem.attribute( "width" ).toDouble() );
127  size.setHeight( elem.attribute( "height" ).toDouble() );
128  transparency = elem.attribute( "transparency", "0" ).toInt();
129  penColor.setNamedColor( elem.attribute( "penColor" ) );
130  int penAlpha = elem.attribute( "penAlpha", "255" ).toInt();
131  penColor.setAlpha( penAlpha );
132  penWidth = elem.attribute( "penWidth" ).toDouble();
133 
134  minScaleDenominator = elem.attribute( "minScaleDenominator", "-1" ).toDouble();
135  maxScaleDenominator = elem.attribute( "maxScaleDenominator", "-1" ).toDouble();
136  if ( elem.hasAttribute( "scaleBasedVisibility" ) )
137  {
138  scaleBasedVisibility = ( elem.attribute( "scaleBasedVisibility", "1" ) != "0" );
139  }
140  else
141  {
142  scaleBasedVisibility = minScaleDenominator >= 0 && maxScaleDenominator >= 0;
143  }
144 
145  //mm vs map units
146  if ( elem.attribute( "sizeType" ) == "MM" )
147  {
148  sizeType = MM;
149  }
150  else
151  {
152  sizeType = MapUnits;
153  }
154 
155  //label placement method
156  if ( elem.attribute( "labelPlacementMethod" ) == "Height" )
157  {
158  labelPlacementMethod = Height;
159  }
160  else
161  {
162  labelPlacementMethod = XHeight;
163  }
164 
165  // orientation
166  if ( elem.attribute( "diagramOrientation" ) == "Left" )
167  {
168  diagramOrientation = Left;
169  }
170  else if ( elem.attribute( "diagramOrientation" ) == "Right" )
171  {
172  diagramOrientation = Right;
173  }
174  else if ( elem.attribute( "diagramOrientation" ) == "Down" )
175  {
176  diagramOrientation = Down;
177  }
178  else
179  {
180  diagramOrientation = Up;
181  }
182 
183  // scale dependency
184  if ( elem.attribute( "scaleDependency" ) == "Diameter" )
185  {
186  scaleByArea = false;
187  }
188  else
189  {
190  scaleByArea = true;
191  }
192 
193  barWidth = elem.attribute( "barWidth" ).toDouble();
194 
195  angleOffset = elem.attribute( "angleOffset" ).toInt();
196 
197  minimumSize = elem.attribute( "minimumSize" ).toDouble();
198 
199  //colors
200  categoryColors.clear();
201  QDomNodeList attributes = elem.elementsByTagName( "attribute" );
202 
203  if ( attributes.length() > 0 )
204  {
205  for ( int i = 0; i < attributes.size(); i++ )
206  {
207  QDomElement attrElem = attributes.at( i ).toElement();
208  QColor newColor( attrElem.attribute( "color" ) );
209  newColor.setAlpha( 255 - transparency );
210  categoryColors.append( newColor );
211  categoryAttributes.append( attrElem.attribute( "field" ) );
212  categoryLabels.append( attrElem.attribute( "label" ) );
213  if ( categoryLabels.back().isEmpty() )
214  {
215  categoryLabels.back() = categoryAttributes.back();
216  }
217  }
218  }
219  else
220  {
221  // Restore old format attributes and colors
222 
223  QStringList colorList = elem.attribute( "colors" ).split( '/' );
224  QStringList::const_iterator colorIt = colorList.constBegin();
225  for ( ; colorIt != colorList.constEnd(); ++colorIt )
226  {
227  QColor newColor( *colorIt );
228  newColor.setAlpha( 255 - transparency );
229  categoryColors.append( QColor( newColor ) );
230  }
231 
232  //attribute indices
233  categoryAttributes.clear();
234  QStringList catList = elem.attribute( "categories" ).split( '/' );
235  QStringList::const_iterator catIt = catList.constBegin();
236  for ( ; catIt != catList.constEnd(); ++catIt )
237  {
238  categoryAttributes.append( *catIt );
239  categoryLabels.append( *catIt );
240  }
241  }
242 }
243 
244 void QgsDiagramSettings::writeXML( QDomElement& rendererElem, QDomDocument& doc, const QgsVectorLayer* layer ) const
245 {
246  Q_UNUSED( layer );
247 
248  QDomElement categoryElem = doc.createElement( "DiagramCategory" );
249  categoryElem.setAttribute( "enabled", enabled );
250  categoryElem.appendChild( QgsFontUtils::toXmlElement( font, doc, "fontProperties" ) );
251  categoryElem.setAttribute( "backgroundColor", backgroundColor.name() );
252  categoryElem.setAttribute( "backgroundAlpha", backgroundColor.alpha() );
253  categoryElem.setAttribute( "width", QString::number( size.width() ) );
254  categoryElem.setAttribute( "height", QString::number( size.height() ) );
255  categoryElem.setAttribute( "penColor", penColor.name() );
256  categoryElem.setAttribute( "penAlpha", penColor.alpha() );
257  categoryElem.setAttribute( "penWidth", QString::number( penWidth ) );
258  categoryElem.setAttribute( "scaleBasedVisibility", scaleBasedVisibility );
259  categoryElem.setAttribute( "minScaleDenominator", QString::number( minScaleDenominator ) );
260  categoryElem.setAttribute( "maxScaleDenominator", QString::number( maxScaleDenominator ) );
261  categoryElem.setAttribute( "transparency", QString::number( transparency ) );
262 
263  // site type (mm vs. map units)
264  if ( sizeType == MM )
265  {
266  categoryElem.setAttribute( "sizeType", "MM" );
267  }
268  else
269  {
270  categoryElem.setAttribute( "sizeType", "MapUnits" );
271  }
272 
273  // label placement method (text diagram)
274  if ( labelPlacementMethod == Height )
275  {
276  categoryElem.setAttribute( "labelPlacementMethod", "Height" );
277  }
278  else
279  {
280  categoryElem.setAttribute( "labelPlacementMethod", "XHeight" );
281  }
282 
283  if ( scaleByArea )
284  {
285  categoryElem.setAttribute( "scaleDependency", "Area" );
286  }
287  else
288  {
289  categoryElem.setAttribute( "scaleDependency", "Diameter" );
290  }
291 
292  // orientation (histogram)
293  switch ( diagramOrientation )
294  {
295  case Left:
296  categoryElem.setAttribute( "diagramOrientation", "Left" );
297  break;
298 
299  case Right:
300  categoryElem.setAttribute( "diagramOrientation", "Right" );
301  break;
302 
303  case Down:
304  categoryElem.setAttribute( "diagramOrientation", "Down" );
305  break;
306 
307  case Up:
308  categoryElem.setAttribute( "diagramOrientation", "Up" );
309  break;
310 
311  default:
312  categoryElem.setAttribute( "diagramOrientation", "Up" );
313  break;
314  }
315 
316  categoryElem.setAttribute( "barWidth", QString::number( barWidth ) );
317  categoryElem.setAttribute( "minimumSize", QString::number( minimumSize ) );
318  categoryElem.setAttribute( "angleOffset", QString::number( angleOffset ) );
319 
320  QString colors;
321  int nCats = qMin( categoryColors.size(), categoryAttributes.size() );
322  for ( int i = 0; i < nCats; ++i )
323  {
324  QDomElement attributeElem = doc.createElement( "attribute" );
325 
326  attributeElem.setAttribute( "field", categoryAttributes.at( i ) );
327  attributeElem.setAttribute( "color", categoryColors.at( i ).name() );
328  attributeElem.setAttribute( "label", categoryLabels.at( i ) );
329  categoryElem.appendChild( attributeElem );
330  }
331 
332  rendererElem.appendChild( categoryElem );
333 }
334 
336  : mDiagram( nullptr )
337 {
338 }
339 
341 {
342  delete mDiagram;
343 }
344 
346 {
347  delete mDiagram;
348  mDiagram = d;
349 }
350 
352  : mDiagram( other.mDiagram ? other.mDiagram->clone() : nullptr )
353 {
354 }
355 
357 {
358  if ( !mDiagram )
359  {
360  return;
361  }
362 
364  if ( !diagramSettings( feature, c, s ) )
365  {
366  return;
367  }
368 
369  mDiagram->renderDiagram( feature, c, s, pos );
370 }
371 
373 {
375  if ( !diagramSettings( feature, c, s ) )
376  {
377  return QSizeF();
378  }
379 
380  QSizeF size = diagramSize( feature, c );
381  if ( s.sizeType == QgsDiagramSettings::MM )
382  {
383  convertSizeToMapUnits( size, c );
384  }
385  return size;
386 }
387 
389 {
390  if ( !size.isValid() )
391  {
392  return;
393  }
394 
395  double pixelToMap = context.scaleFactor() * context.mapToPixel().mapUnitsPerPixel();
396  size.rwidth() *= pixelToMap;
397  size.rheight() *= pixelToMap;
398 }
399 
401 {
402  if ( painter )
403  {
404  QPaintDevice* device = painter->device();
405  if ( device )
406  {
407  return device->logicalDpiX();
408  }
409  }
410  return -1;
411 }
412 
414 {
415  Q_UNUSED( layer )
416 
417  delete mDiagram;
418  QString diagramType = elem.attribute( "diagramType" );
419  if ( diagramType == "Pie" )
420  {
421  mDiagram = new QgsPieDiagram();
422  }
423  else if ( diagramType == "Text" )
424  {
425  mDiagram = new QgsTextDiagram();
426  }
427  else if ( diagramType == "Histogram" )
428  {
430  }
431  else
432  {
433  mDiagram = nullptr;
434  }
435 }
436 
437 void QgsDiagramRendererV2::_writeXML( QDomElement& rendererElem, QDomDocument& doc, const QgsVectorLayer* layer ) const
438 {
439  Q_UNUSED( doc );
440  Q_UNUSED( layer )
441 
442  if ( mDiagram )
443  {
444  rendererElem.setAttribute( "diagramType", mDiagram->diagramName() );
445  }
446 }
447 
449 {
450 }
451 
453 {
454 }
455 
457 {
458  return new QgsSingleCategoryDiagramRenderer( *this );
459 }
460 
462 {
463  Q_UNUSED( c );
464  s = mSettings;
465  return true;
466 }
467 
469 {
470  return mDiagram->diagramSize( feature.attributes(), c, mSettings );
471 }
472 
474 {
475  QList<QgsDiagramSettings> settingsList;
476  settingsList.push_back( mSettings );
477  return settingsList;
478 }
479 
481 {
482  QDomElement categoryElem = elem.firstChildElement( "DiagramCategory" );
483  if ( categoryElem.isNull() )
484  {
485  return;
486  }
487 
488  mSettings.readXML( categoryElem, layer );
489  _readXML( elem, layer );
490 }
491 
493 {
494  QDomElement rendererElem = doc.createElement( "SingleCategoryDiagramRenderer" );
495  mSettings.writeXML( rendererElem, doc, layer );
496  _writeXML( rendererElem, doc, layer );
497  layerElem.appendChild( rendererElem );
498 }
499 
500 
502 {
503  mInterpolationSettings.classificationAttributeIsExpression = false;
504 }
505 
507 {
508 }
509 
511 {
512  return new QgsLinearlyInterpolatedDiagramRenderer( *this );
513 }
514 
516 {
517  QList<QgsDiagramSettings> settingsList;
518  settingsList.push_back( mSettings );
519  return settingsList;
520 }
521 
523 {
524  s = mSettings;
525  s.size = diagramSize( feature, c );
526  return true;
527 }
528 
530 {
531  return mSettings.categoryAttributes;
532 }
533 
535 {
536  return mDiagram->diagramSize( feature, c, mSettings, mInterpolationSettings );
537 }
538 
540 {
541  mInterpolationSettings.lowerValue = elem.attribute( "lowerValue" ).toDouble();
542  mInterpolationSettings.upperValue = elem.attribute( "upperValue" ).toDouble();
543  mInterpolationSettings.lowerSize.setWidth( elem.attribute( "lowerWidth" ).toDouble() );
544  mInterpolationSettings.lowerSize.setHeight( elem.attribute( "lowerHeight" ).toDouble() );
545  mInterpolationSettings.upperSize.setWidth( elem.attribute( "upperWidth" ).toDouble() );
546  mInterpolationSettings.upperSize.setHeight( elem.attribute( "upperHeight" ).toDouble() );
547  mInterpolationSettings.classificationAttributeIsExpression = elem.hasAttribute( "classificationAttributeExpression" );
548  if ( mInterpolationSettings.classificationAttributeIsExpression )
549  {
550  mInterpolationSettings.classificationAttributeExpression = elem.attribute( "classificationAttributeExpression" );
551  }
552  else
553  {
554  mInterpolationSettings.classificationAttribute = elem.attribute( "classificationAttribute" ).toInt();
555  }
556  QDomElement settingsElem = elem.firstChildElement( "DiagramCategory" );
557  if ( !settingsElem.isNull() )
558  {
559  mSettings.readXML( settingsElem, layer );
560  }
561  _readXML( elem, layer );
562 }
563 
565 {
566  QDomElement rendererElem = doc.createElement( "LinearlyInterpolatedDiagramRenderer" );
567  rendererElem.setAttribute( "lowerValue", QString::number( mInterpolationSettings.lowerValue ) );
568  rendererElem.setAttribute( "upperValue", QString::number( mInterpolationSettings.upperValue ) );
569  rendererElem.setAttribute( "lowerWidth", QString::number( mInterpolationSettings.lowerSize.width() ) );
570  rendererElem.setAttribute( "lowerHeight", QString::number( mInterpolationSettings.lowerSize.height() ) );
571  rendererElem.setAttribute( "upperWidth", QString::number( mInterpolationSettings.upperSize.width() ) );
572  rendererElem.setAttribute( "upperHeight", QString::number( mInterpolationSettings.upperSize.height() ) );
573  if ( mInterpolationSettings.classificationAttributeIsExpression )
574  {
575  rendererElem.setAttribute( "classificationAttributeExpression", mInterpolationSettings.classificationAttributeExpression );
576  }
577  else
578  {
579  rendererElem.setAttribute( "classificationAttribute", mInterpolationSettings.classificationAttribute );
580  }
581  mSettings.writeXML( rendererElem, doc, layer );
582  _writeXML( rendererElem, doc, layer );
583  layerElem.appendChild( rendererElem );
584 }
585 
587 {
589  list.reserve( categoryLabels.size() );
590  for ( int i = 0 ; i < categoryLabels.size(); ++i )
591  {
592  QPixmap pix( 16, 16 );
593  pix.fill( categoryColors[i] );
594  list << new QgsSimpleLegendNode( nodeLayer, categoryLabels[i], QIcon( pix ), nullptr, QString( "diagram_%1" ).arg( QString::number( i ) ) );
595  }
596  return list;
597 }
598 
600 {
602 }
603 
605 {
606  return mSettings.legendItems( nodeLayer );
607 }
608 
610 {
611  return mSettings.legendItems( nodeLayer );
612 }
double zIndex
Z-index of diagrams, where diagrams with a higher z-index are drawn on top of diagrams with a lower z...
QDomNodeList elementsByTagName(const QString &tagname) const
void writeXML(QDomElement &layerElem, QDomDocument &doc, const QgsVectorLayer *layer) const override
QgsSingleCategoryDiagramRenderer * clone() const override
Returns new instance that is equivalent to this one.
QDomNode appendChild(const QDomNode &newChild)
void fill(const QColor &color)
void push_back(const T &value)
void _readXML(const QDomElement &elem, const QgsVectorLayer *layer)
virtual QList< QgsLayerTreeModelLegendNode * > legendItems(QgsLayerTreeLayer *nodeLayer) const
Returns list of legend nodes for the diagram.
Renders the diagrams for all features with the same settings.
QString attribute(const QString &name, const QString &defValue) const
QList< QString > categoryAttributes
QStringList split(const QString &sep, SplitBehavior behavior, Qt::CaseSensitivity cs) const
void reserve(int alloc)
qreal & rwidth()
bool isValid() const
virtual QList< QgsDiagramSettings > diagramSettings() const =0
Returns list with all diagram settings in the renderer.
void setAlpha(int alpha)
static int dpiPaintDevice(const QPainter *)
Returns the paint device dpi (or -1 in case of error.
void renderDiagram(const QgsFeature &feature, QgsRenderContext &c, QPointF pos)
double scaleFactor() const
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
Definition: qgsfeature.h:187
double toDouble(bool *ok) const
void readXML(const QDomElement &elem, const QgsVectorLayer *layer)
QList< QgsDiagramSettings > diagramSettings() const override
Returns list with all diagram settings in the renderer.
Returns diagram settings for a feature.
virtual QSizeF diagramSize(const QgsFeature &features, const QgsRenderContext &c)=0
Returns size of the diagram (in painter units) or an invalid size in case of error.
QList< QgsLayerTreeModelLegendNode * > legendItems(QgsLayerTreeLayer *nodeLayer) const override
Returns list of legend nodes for the diagram.
QList< QgsLayerTreeModelLegendNode * > legendItems(QgsLayerTreeLayer *nodeLayer) const override
Returns list of legend nodes for the diagram.
void convertSizeToMapUnits(QSizeF &size, const QgsRenderContext &context) const
Converts size from mm to map units.
QDomElement toElement() const
QString number(int n, int base)
const QgsMapToPixel * xform
void readXML(const QDomElement &elem, const QgsVectorLayer *layer) override
bool hasAttribute(const QString &name) const
virtual QSizeF sizeMapUnits(const QgsFeature &feature, const QgsRenderContext &c)
Returns size of the diagram for a feature in map units.
QgsAttributes attributes() const
Returns the feature&#39;s attributes.
Definition: qgsfeature.cpp:110
void readXML(const QDomElement &elem, const QgsVectorLayer *layer)
void setAttribute(const QString &name, const QString &value)
void setWidth(qreal width)
int toInt(bool *ok, int base) const
QPaintDevice * device() const
QList< QgsLayerTreeModelLegendNode * > legendItems(QgsLayerTreeLayer *nodeLayer) const
Returns list of legend nodes for the diagram.
static bool setFromXmlChildNode(QFont &font, const QDomElement &element, const QString &childNode)
Sets the properties of a font to match the properties stored in an XML child node.
double mapUnitsPerPixel() const
Return current map units per pixel.
QgsDiagramRendererV2 * renderer
Implementation of legend node interface for displaying arbitrary label with icon. ...
virtual QSizeF diagramSize(const QgsAttributes &attributes, const QgsRenderContext &c, const QgsDiagramSettings &s)=0
Returns the size in map units the diagram will use to render.
int logicalDpiX() const
Base class for all diagram types.
Definition: qgsdiagram.h:35
QgsLinearlyInterpolatedDiagramRenderer * clone() const override
Returns new instance that is equivalent to this one.
bool isNull() const
virtual QString diagramName() const =0
void writeXML(QDomElement &layerElem, QDomDocument &doc, const QgsVectorLayer *layer) const override
void readXML(const QDomElement &elem, const QgsVectorLayer *layer) override
Contains information about the context of a rendering operation.
virtual Q_DECL_DEPRECATED void renderDiagram(const QgsAttributes &att, QgsRenderContext &c, const QgsDiagramSettings &s, QPointF position)
Definition: qgsdiagram.cpp:123
QList< QString > diagramAttributes() const override
Returns attribute indices needed for diagram rendering.
QDomElement firstChildElement(const QString &tagName) const
void writeXML(QDomElement &layerElem, QDomDocument &doc, const QgsVectorLayer *layer) const
virtual QgsDiagramRendererV2 * clone() const =0
Returns new instance that is equivalent to this one.
const QgsMapToPixel & mapToPixel() const
int classificationAttribute
Index of the classification attribute.
static QDomElement toXmlElement(const QFont &font, QDomDocument &document, const QString &elementName)
Returns a DOM element containing the properties of the font.
int size() const
uint length() const
const_iterator constEnd() const
qreal & rheight()
QDomElement createElement(const QString &tagName)
const_iterator constBegin() const
qreal height() const
void setDiagram(QgsDiagram *d)
QSizeF diagramSize(const QgsFeature &, const QgsRenderContext &c) override
Returns size of the diagram (in painter units) or an invalid size in case of error.
Represents a vector layer which manages a vector based data sets.
void setHeight(qreal height)
void writeXML(QDomElement &rendererElem, QDomDocument &doc, const QgsVectorLayer *layer) const
QgsDiagram * mDiagram
Reference to the object that does the real diagram rendering.
const QgsCoordinateTransform * ct
QList< QgsDiagramSettings > diagramSettings() const override
Returns list with all diagram settings in the renderer.
QgsDiagramLayerSettings & operator=(const QgsDiagramLayerSettings &rh)
qreal width() const
void _writeXML(QDomElement &rendererElem, QDomDocument &doc, const QgsVectorLayer *layer) const
QSizeF diagramSize(const QgsFeature &, const QgsRenderContext &c) override
Returns size of the diagram (in painter units) or an invalid size in case of error.
Layer tree node points to a map layer.
QDomNode at(int index) const