QGIS API Documentation  2.18.21-Las Palmas (9fba24a)
Public Member Functions | Protected Member Functions | List of all members
QgsSingleCategoryDiagramRenderer Class Reference

Renders the diagrams for all features with the same settings. More...

#include <qgsdiagramrendererv2.h>

Inheritance diagram for QgsSingleCategoryDiagramRenderer:
Inheritance graph
[legend]

Public Member Functions

 QgsSingleCategoryDiagramRenderer ()
 
 ~QgsSingleCategoryDiagramRenderer ()
 
QgsSingleCategoryDiagramRendererclone () const override
 Returns new instance that is equivalent to this one. More...
 
QList< QStringdiagramAttributes () const override
 Returns attribute indices needed for diagram rendering. More...
 
QList< QgsDiagramSettingsdiagramSettings () const override
 Returns list with all diagram settings in the renderer. More...
 
QList< QgsLayerTreeModelLegendNode *> legendItems (QgsLayerTreeLayer *nodeLayer) const override
 Returns list of legend nodes for the diagram. More...
 
void readXML (const QDomElement &elem, const QgsVectorLayer *layer) override
 
QString rendererName () const override
 
void setDiagramSettings (const QgsDiagramSettings &s)
 
void writeXML (QDomElement &layerElem, QDomDocument &doc, const QgsVectorLayer *layer) const override
 
- Public Member Functions inherited from QgsDiagramRendererV2
 QgsDiagramRendererV2 ()
 
virtual ~QgsDiagramRendererV2 ()
 
bool attributeLegend () const
 Returns true if renderer will show legend items for diagram attributes. More...
 
QgsDiagramdiagram () const
 
virtual QSet< QStringreferencedFields (const QgsExpressionContext &context=QgsExpressionContext(), const QgsFields &fields=QgsFields()) const
 Returns the set of any fields required for diagram rendering. More...
 
void renderDiagram (const QgsFeature &feature, QgsRenderContext &c, QPointF pos) const
 
void setAttributeLegend (bool enabled)
 Sets whether the renderer will show legend items for diagram attributes. More...
 
void setDiagram (QgsDiagram *d)
 
void setSizeLegend (bool enabled)
 Sets whether the renderer will show legend items for diagram sizes. More...
 
void setSizeLegendSymbol (QgsMarkerSymbolV2 *symbol)
 Sets the marker symbol used for rendering the diagram size legend. More...
 
bool sizeLegend () const
 Returns true if renderer will show legend items for diagram sizes. More...
 
QgsMarkerSymbolV2sizeLegendSymbol () const
 Returns the marker symbol used for rendering the diagram size legend. More...
 
virtual QSizeF sizeMapUnits (const QgsFeature &feature, const QgsRenderContext &c) const
 Returns size of the diagram for a feature in map units. More...
 

Protected Member Functions

bool diagramSettings (const QgsFeature &feature, const QgsRenderContext &c, QgsDiagramSettings &s) const override
 Returns diagram settings for a feature (or false if the diagram for the feature is not to be rendered). More...
 
QSizeF diagramSize (const QgsFeature &, const QgsRenderContext &c) const override
 Returns size of the diagram (in painter units) or an invalid size in case of error. More...
 
- Protected Member Functions inherited from QgsDiagramRendererV2
 QgsDiagramRendererV2 (const QgsDiagramRendererV2 &other)
 
void _readXML (const QDomElement &elem, const QgsVectorLayer *layer)
 
void _writeXML (QDomElement &rendererElem, QDomDocument &doc, const QgsVectorLayer *layer) const
 
void convertSizeToMapUnits (QSizeF &size, const QgsRenderContext &context) const
 Converts size from mm to map units. More...
 
QgsDiagramRendererV2operator= (const QgsDiagramRendererV2 &other)
 

Additional Inherited Members

- Static Protected Member Functions inherited from QgsDiagramRendererV2
static int dpiPaintDevice (const QPainter *)
 Returns the paint device dpi (or -1 in case of error. More...
 
- Protected Attributes inherited from QgsDiagramRendererV2
QgsDiagrammDiagram
 Reference to the object that does the real diagram rendering. More...
 
bool mShowAttributeLegend
 Whether to show an attribute legend for the diagrams. More...
 
bool mShowSizeLegend
 Whether to show a size legend for the diagrams. More...
 
QScopedPointer< QgsMarkerSymbolV2mSizeLegendSymbol
 Marker symbol to use in size legends. More...
 

Detailed Description

Renders the diagrams for all features with the same settings.

Definition at line 556 of file qgsdiagramrendererv2.h.

Constructor & Destructor Documentation

◆ QgsSingleCategoryDiagramRenderer()

QgsSingleCategoryDiagramRenderer::QgsSingleCategoryDiagramRenderer ( )

Definition at line 549 of file qgsdiagramrendererv2.cpp.

◆ ~QgsSingleCategoryDiagramRenderer()

QgsSingleCategoryDiagramRenderer::~QgsSingleCategoryDiagramRenderer ( )

Definition at line 553 of file qgsdiagramrendererv2.cpp.

Member Function Documentation

◆ clone()

QgsSingleCategoryDiagramRenderer * QgsSingleCategoryDiagramRenderer::clone ( ) const
overridevirtual

Returns new instance that is equivalent to this one.

Note
added in 2.4

Implements QgsDiagramRendererV2.

Definition at line 557 of file qgsdiagramrendererv2.cpp.

◆ diagramAttributes()

QList<QString> QgsSingleCategoryDiagramRenderer::diagramAttributes ( ) const
inlineoverridevirtual

Returns attribute indices needed for diagram rendering.

Implements QgsDiagramRendererV2.

Definition at line 566 of file qgsdiagramrendererv2.h.

◆ diagramSettings() [1/2]

QList< QgsDiagramSettings > QgsSingleCategoryDiagramRenderer::diagramSettings ( ) const
overridevirtual

Returns list with all diagram settings in the renderer.

Implements QgsDiagramRendererV2.

Definition at line 574 of file qgsdiagramrendererv2.cpp.

◆ diagramSettings() [2/2]

bool QgsSingleCategoryDiagramRenderer::diagramSettings ( const QgsFeature feature,
const QgsRenderContext c,
QgsDiagramSettings s 
) const
overrideprotectedvirtual

Returns diagram settings for a feature (or false if the diagram for the feature is not to be rendered).

Used internally within renderDiagram()

Parameters
featurethe feature
crender context
sout: diagram settings for the feature

Implements QgsDiagramRendererV2.

Definition at line 562 of file qgsdiagramrendererv2.cpp.

◆ diagramSize()

QSizeF QgsSingleCategoryDiagramRenderer::diagramSize ( const QgsFeature features,
const QgsRenderContext c 
) const
overrideprotectedvirtual

Returns size of the diagram (in painter units) or an invalid size in case of error.

Implements QgsDiagramRendererV2.

Definition at line 569 of file qgsdiagramrendererv2.cpp.

◆ legendItems()

QList< QgsLayerTreeModelLegendNode *> QgsSingleCategoryDiagramRenderer::legendItems ( QgsLayerTreeLayer nodeLayer) const
overridevirtual

Returns list of legend nodes for the diagram.

Note
caller is responsible for deletion of QgsLayerTreeModelLegendNodes
added in 2.10

Reimplemented from QgsDiagramRendererV2.

Definition at line 723 of file qgsdiagramrendererv2.cpp.

◆ readXML()

void QgsSingleCategoryDiagramRenderer::readXML ( const QDomElement elem,
const QgsVectorLayer layer 
)
overridevirtual

Implements QgsDiagramRendererV2.

Definition at line 581 of file qgsdiagramrendererv2.cpp.

◆ rendererName()

QString QgsSingleCategoryDiagramRenderer::rendererName ( ) const
inlineoverridevirtual

Implements QgsDiagramRendererV2.

Definition at line 564 of file qgsdiagramrendererv2.h.

◆ setDiagramSettings()

void QgsSingleCategoryDiagramRenderer::setDiagramSettings ( const QgsDiagramSettings s)
inline

Definition at line 568 of file qgsdiagramrendererv2.h.

◆ writeXML()

void QgsSingleCategoryDiagramRenderer::writeXML ( QDomElement layerElem,
QDomDocument doc,
const QgsVectorLayer layer 
) const
overridevirtual

Implements QgsDiagramRendererV2.

Definition at line 593 of file qgsdiagramrendererv2.cpp.


The documentation for this class was generated from the following files: