QGIS API Documentation  2.18.21-Las Palmas (9fba24a)
Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
QgsDiagramRendererV2 Class Referenceabstract

Evaluates and returns the diagram settings relating to a diagram for a specific feature. More...

#include <qgsdiagramrendererv2.h>

Inheritance diagram for QgsDiagramRendererV2:
Inheritance graph
[legend]

Public Member Functions

 QgsDiagramRendererV2 ()
 
virtual ~QgsDiagramRendererV2 ()
 
bool attributeLegend () const
 Returns true if renderer will show legend items for diagram attributes. More...
 
virtual QgsDiagramRendererV2clone () const =0
 Returns new instance that is equivalent to this one. More...
 
QgsDiagramdiagram () const
 
virtual QList< QStringdiagramAttributes () const =0
 Returns attribute indices needed for diagram rendering. More...
 
virtual QList< QgsDiagramSettingsdiagramSettings () const =0
 Returns list with all diagram settings in the renderer. More...
 
virtual QList< QgsLayerTreeModelLegendNode *> legendItems (QgsLayerTreeLayer *nodeLayer) const
 Returns list of legend nodes for the diagram. More...
 
virtual void readXML (const QDomElement &elem, const QgsVectorLayer *layer)=0
 
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
 
virtual QString rendererName () const =0
 
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...
 
virtual void writeXML (QDomElement &layerElem, QDomDocument &doc, const QgsVectorLayer *layer) const =0
 

Protected Member Functions

 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...
 
virtual bool diagramSettings (const QgsFeature &feature, const QgsRenderContext &c, QgsDiagramSettings &s) const =0
 Returns diagram settings for a feature (or false if the diagram for the feature is not to be rendered). More...
 
virtual QSizeF diagramSize (const QgsFeature &features, const QgsRenderContext &c) const =0
 Returns size of the diagram (in painter units) or an invalid size in case of error. More...
 
QgsDiagramRendererV2operator= (const QgsDiagramRendererV2 &other)
 

Static Protected Member Functions

static int dpiPaintDevice (const QPainter *)
 Returns the paint device dpi (or -1 in case of error. More...
 

Protected Attributes

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

Evaluates and returns the diagram settings relating to a diagram for a specific feature.

Definition at line 425 of file qgsdiagramrendererv2.h.

Constructor & Destructor Documentation

◆ QgsDiagramRendererV2() [1/2]

QgsDiagramRendererV2::QgsDiagramRendererV2 ( )

Definition at line 388 of file qgsdiagramrendererv2.cpp.

◆ ~QgsDiagramRendererV2()

QgsDiagramRendererV2::~QgsDiagramRendererV2 ( )
virtual

Definition at line 396 of file qgsdiagramrendererv2.cpp.

◆ QgsDiagramRendererV2() [2/2]

QgsDiagramRendererV2::QgsDiagramRendererV2 ( const QgsDiagramRendererV2 other)
protected

Definition at line 407 of file qgsdiagramrendererv2.cpp.

Member Function Documentation

◆ _readXML()

void QgsDiagramRendererV2::_readXML ( const QDomElement elem,
const QgsVectorLayer layer 
)
protected

Definition at line 503 of file qgsdiagramrendererv2.cpp.

◆ _writeXML()

void QgsDiagramRendererV2::_writeXML ( QDomElement rendererElem,
QDomDocument doc,
const QgsVectorLayer layer 
) const
protected

Definition at line 534 of file qgsdiagramrendererv2.cpp.

◆ attributeLegend()

bool QgsDiagramRendererV2::attributeLegend ( ) const
inline

Returns true if renderer will show legend items for diagram attributes.

Note
added in QGIS 2.16
See also
setAttributeLegend()
sizeLegend()

Definition at line 474 of file qgsdiagramrendererv2.h.

◆ clone()

virtual QgsDiagramRendererV2* QgsDiagramRendererV2::clone ( ) const
pure virtual

Returns new instance that is equivalent to this one.

Note
added in 2.4

Implemented in QgsLinearlyInterpolatedDiagramRenderer, and QgsSingleCategoryDiagramRenderer.

◆ convertSizeToMapUnits()

void QgsDiagramRendererV2::convertSizeToMapUnits ( QSizeF size,
const QgsRenderContext context 
) const
protected

Converts size from mm to map units.

Definition at line 478 of file qgsdiagramrendererv2.cpp.

◆ diagram()

QgsDiagram* QgsDiagramRendererV2::diagram ( ) const
inline

Definition at line 455 of file qgsdiagramrendererv2.h.

◆ diagramAttributes()

virtual QList<QString> QgsDiagramRendererV2::diagramAttributes ( ) const
pure virtual

Returns attribute indices needed for diagram rendering.

Implemented in QgsLinearlyInterpolatedDiagramRenderer, and QgsSingleCategoryDiagramRenderer.

◆ diagramSettings() [1/2]

virtual QList<QgsDiagramSettings> QgsDiagramRendererV2::diagramSettings ( ) const
pure virtual

Returns list with all diagram settings in the renderer.

Implemented in QgsLinearlyInterpolatedDiagramRenderer, and QgsSingleCategoryDiagramRenderer.

◆ diagramSettings() [2/2]

virtual bool QgsDiagramRendererV2::diagramSettings ( const QgsFeature feature,
const QgsRenderContext c,
QgsDiagramSettings s 
) const
protectedpure virtual

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

Implemented in QgsLinearlyInterpolatedDiagramRenderer, and QgsSingleCategoryDiagramRenderer.

◆ diagramSize()

virtual QSizeF QgsDiagramRendererV2::diagramSize ( const QgsFeature features,
const QgsRenderContext c 
) const
protectedpure virtual

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

Implemented in QgsLinearlyInterpolatedDiagramRenderer, and QgsSingleCategoryDiagramRenderer.

◆ dpiPaintDevice()

int QgsDiagramRendererV2::dpiPaintDevice ( const QPainter painter)
staticprotected

Returns the paint device dpi (or -1 in case of error.

Definition at line 490 of file qgsdiagramrendererv2.cpp.

◆ legendItems()

QList< QgsLayerTreeModelLegendNode *> QgsDiagramRendererV2::legendItems ( QgsLayerTreeLayer nodeLayer) const
virtual

Returns list of legend nodes for the diagram.

Note
caller is responsible for deletion of QgsLayerTreeModelLegendNodes
added in 2.10

Reimplemented in QgsLinearlyInterpolatedDiagramRenderer, and QgsSingleCategoryDiagramRenderer.

Definition at line 718 of file qgsdiagramrendererv2.cpp.

◆ operator=()

QgsDiagramRendererV2 & QgsDiagramRendererV2::operator= ( const QgsDiagramRendererV2 other)
protected

Definition at line 415 of file qgsdiagramrendererv2.cpp.

◆ readXML()

virtual void QgsDiagramRendererV2::readXML ( const QDomElement elem,
const QgsVectorLayer layer 
)
pure virtual

◆ referencedFields()

QSet< QString > QgsDiagramRendererV2::referencedFields ( const QgsExpressionContext context = QgsExpressionContext(),
const QgsFields fields = QgsFields() 
) const
virtual

Returns the set of any fields required for diagram rendering.

Parameters
contextexpression context the diagrams will be drawn using
fieldslayer fields
Note
added in QGIS 2.16

Reimplemented in QgsLinearlyInterpolatedDiagramRenderer.

Definition at line 458 of file qgsdiagramrendererv2.cpp.

◆ renderDiagram()

void QgsDiagramRendererV2::renderDiagram ( const QgsFeature feature,
QgsRenderContext c,
QPointF  pos 
) const

Definition at line 424 of file qgsdiagramrendererv2.cpp.

◆ rendererName()

virtual QString QgsDiagramRendererV2::rendererName ( ) const
pure virtual

◆ setAttributeLegend()

void QgsDiagramRendererV2::setAttributeLegend ( bool  enabled)
inline

Sets whether the renderer will show legend items for diagram attributes.

Parameters
enabledset to true to show diagram attribute legend
Note
added in QGIS 2.16
See also
attributeLegend()
setSizeLegend()

Definition at line 482 of file qgsdiagramrendererv2.h.

◆ setDiagram()

void QgsDiagramRendererV2::setDiagram ( QgsDiagram d)

Definition at line 401 of file qgsdiagramrendererv2.cpp.

◆ setSizeLegend()

void QgsDiagramRendererV2::setSizeLegend ( bool  enabled)
inline

Sets whether the renderer will show legend items for diagram sizes.

Parameters
enabledset to true to show diagram size legend
Note
added in QGIS 2.16
See also
sizeLegend()
setAttributeLegend()
setSizeLegendSymbol()

Definition at line 499 of file qgsdiagramrendererv2.h.

◆ setSizeLegendSymbol()

void QgsDiagramRendererV2::setSizeLegendSymbol ( QgsMarkerSymbolV2 symbol)
inline

Sets the marker symbol used for rendering the diagram size legend.

Parameters
symbolmarker symbol, ownership is transferred to the renderer.
Note
added in QGIS 2.16
See also
sizeLegendSymbol()
setSizeLegend()

Definition at line 514 of file qgsdiagramrendererv2.h.

◆ sizeLegend()

bool QgsDiagramRendererV2::sizeLegend ( ) const
inline

Returns true if renderer will show legend items for diagram sizes.

Note
added in QGIS 2.16
See also
setSizeLegend()
attributeLegend()
sizeLegendSymbol()

Definition at line 490 of file qgsdiagramrendererv2.h.

◆ sizeLegendSymbol()

QgsMarkerSymbolV2* QgsDiagramRendererV2::sizeLegendSymbol ( ) const
inline

Returns the marker symbol used for rendering the diagram size legend.

Note
added in QGIS 2.16
See also
setSizeLegendSymbol()
sizeLegend()

Definition at line 506 of file qgsdiagramrendererv2.h.

◆ sizeMapUnits()

QSizeF QgsDiagramRendererV2::sizeMapUnits ( const QgsFeature feature,
const QgsRenderContext c 
) const
virtual

Returns size of the diagram for a feature in map units.

Returns an invalid QSizeF in case of error

Definition at line 440 of file qgsdiagramrendererv2.cpp.

◆ writeXML()

virtual void QgsDiagramRendererV2::writeXML ( QDomElement layerElem,
QDomDocument doc,
const QgsVectorLayer layer 
) const
pure virtual

Member Data Documentation

◆ mDiagram

QgsDiagram* QgsDiagramRendererV2::mDiagram
protected

Reference to the object that does the real diagram rendering.

Definition at line 541 of file qgsdiagramrendererv2.h.

◆ mShowAttributeLegend

bool QgsDiagramRendererV2::mShowAttributeLegend
protected

Whether to show an attribute legend for the diagrams.

Definition at line 544 of file qgsdiagramrendererv2.h.

◆ mShowSizeLegend

bool QgsDiagramRendererV2::mShowSizeLegend
protected

Whether to show a size legend for the diagrams.

Definition at line 547 of file qgsdiagramrendererv2.h.

◆ mSizeLegendSymbol

QScopedPointer< QgsMarkerSymbolV2 > QgsDiagramRendererV2::mSizeLegendSymbol
protected

Marker symbol to use in size legends.

Definition at line 550 of file qgsdiagramrendererv2.h.


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