QGIS API Documentation 3.28.0-Firenze (ed3ad0430f)
|
Renders the diagrams for all features with the same settings. More...
#include <qgsdiagramrenderer.h>
Public Member Functions | |
QgsSingleCategoryDiagramRenderer ()=default | |
Constructor for QgsSingleCategoryDiagramRenderer. More... | |
QgsSingleCategoryDiagramRenderer * | clone () const override |
Returns new instance that is equivalent to this one. More... | |
QList< QString > | diagramAttributes () const override |
Returns attribute indices needed for diagram rendering. More... | |
QList< QgsDiagramSettings > | diagramSettings () 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 QgsReadWriteContext &context) override |
Reads diagram state from a DOM element. More... | |
QString | rendererName () const override |
void | setDiagramSettings (const QgsDiagramSettings &s) |
void | writeXml (QDomElement &layerElem, QDomDocument &doc, const QgsReadWriteContext &context) const override |
Writes diagram state to a DOM element. More... | |
Public Member Functions inherited from QgsDiagramRenderer | |
QgsDiagramRenderer ()=default | |
Constructor for QgsDiagramRenderer. More... | |
virtual | ~QgsDiagramRenderer ()=default |
bool | attributeLegend () const |
Returns true if renderer will show legend items for diagram attributes. More... | |
virtual QgsDiagramRenderer * | clone () const =0 |
Returns new instance that is equivalent to this one. More... | |
QgsDiagram * | diagram () const |
virtual QList< QString > | diagramAttributes () const =0 |
Returns attribute indices needed for diagram rendering. More... | |
virtual QList< QgsDiagramSettings > | diagramSettings () 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 QgsReadWriteContext &context)=0 |
Reads diagram state from a DOM element. More... | |
virtual QSet< QString > | referencedFields (const QgsExpressionContext &context=QgsExpressionContext()) const |
Returns the set of any fields required for diagram rendering. More... | |
void | renderDiagram (const QgsFeature &feature, QgsRenderContext &c, QPointF pos, const QgsPropertyCollection &properties=QgsPropertyCollection()) const |
Renders the diagram for a specified feature at a specific position in the passed render context. More... | |
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) |
virtual QSizeF | sizeMapUnits (const QgsFeature &feature, const QgsRenderContext &c) const |
Returns size of the diagram for a feature in map units. Returns an invalid QSizeF in case of error. More... | |
virtual void | writeXml (QDomElement &layerElem, QDomDocument &doc, const QgsReadWriteContext &context) const =0 |
Writes diagram state to a DOM element. 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 QgsDiagramRenderer | |
QgsDiagramRenderer (const QgsDiagramRenderer &other) | |
void | _readXml (const QDomElement &elem, const QgsReadWriteContext &context) |
Reads internal QgsDiagramRenderer state from a DOM element. More... | |
void | _writeXml (QDomElement &rendererElem, QDomDocument &doc, const QgsReadWriteContext &context) const |
Writes internal QgsDiagramRenderer diagram state to a DOM element. More... | |
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... | |
QgsDiagramRenderer & | operator= (const QgsDiagramRenderer &other) |
Additional Inherited Members | |
Static Protected Member Functions inherited from QgsDiagramRenderer | |
static int | dpiPaintDevice (const QPainter *) |
Returns the paint device dpi (or -1 in case of error. More... | |
Protected Attributes inherited from QgsDiagramRenderer | |
std::unique_ptr< QgsDiagram > | mDiagram |
Reference to the object that does the real diagram rendering. More... | |
bool | mShowAttributeLegend = true |
Whether to show an attribute legend for the diagrams. More... | |
Renders the diagrams for all features with the same settings.
Definition at line 820 of file qgsdiagramrenderer.h.
|
default |
Constructor for QgsSingleCategoryDiagramRenderer.
|
overridevirtual |
Returns new instance that is equivalent to this one.
Implements QgsDiagramRenderer.
Definition at line 601 of file qgsdiagramrenderer.cpp.
|
inlineoverridevirtual |
Returns attribute indices needed for diagram rendering.
Implements QgsDiagramRenderer.
Definition at line 831 of file qgsdiagramrenderer.h.
|
overridevirtual |
Returns list with all diagram settings in the renderer.
Implements QgsDiagramRenderer.
Definition at line 618 of file qgsdiagramrenderer.cpp.
|
overrideprotectedvirtual |
Returns diagram settings for a feature (or false
if the diagram for the feature is not to be rendered).
Used internally within renderDiagram()
feature | the feature |
c | render context |
s | out: diagram settings for the feature |
Implements QgsDiagramRenderer.
Definition at line 606 of file qgsdiagramrenderer.cpp.
|
overrideprotectedvirtual |
Returns size of the diagram (in painter units) or an invalid size in case of error.
Implements QgsDiagramRenderer.
Definition at line 613 of file qgsdiagramrenderer.cpp.
|
overridevirtual |
Returns list of legend nodes for the diagram.
Reimplemented from QgsDiagramRenderer.
Definition at line 943 of file qgsdiagramrenderer.cpp.
|
overridevirtual |
Reads diagram state from a DOM element.
Subclasses should ensure that _readXml() is called by their readXml implementation to restore the general QgsDiagramRenderer settings.
Implements QgsDiagramRenderer.
Definition at line 625 of file qgsdiagramrenderer.cpp.
|
inlineoverridevirtual |
Implements QgsDiagramRenderer.
Definition at line 829 of file qgsdiagramrenderer.h.
|
inline |
Definition at line 833 of file qgsdiagramrenderer.h.
|
overridevirtual |
Writes diagram state to a DOM element.
Subclasses should ensure that _writeXml() is called by their writeXml implementation to save the general QgsDiagramRenderer settings.
Implements QgsDiagramRenderer.
Definition at line 637 of file qgsdiagramrenderer.cpp.