QGIS API Documentation 3.39.0-Master (04dac197d13)
|
Evaluates and returns the diagram settings relating to a diagram for a specific feature. More...
#include <qgsdiagramrenderer.h>
Public Member Functions | |
QgsDiagramRenderer ()=default | |
virtual | ~QgsDiagramRenderer ()=default |
bool | attributeLegend () const |
Returns true if renderer will show legend items for diagram attributes. | |
virtual QgsDiagramRenderer * | clone () const =0 |
Returns new instance that is equivalent to this one. | |
QgsDiagram * | diagram () const |
virtual QList< QString > | diagramAttributes () const =0 |
Returns attribute indices needed for diagram rendering. | |
virtual QList< QgsDiagramSettings > | diagramSettings () const =0 |
Returns list with all diagram settings in the renderer. | |
virtual QList< QgsLayerTreeModelLegendNode * > | legendItems (QgsLayerTreeLayer *nodeLayer) const |
Returns list of legend nodes for the diagram. | |
virtual void | readXml (const QDomElement &elem, const QgsReadWriteContext &context)=0 |
Reads diagram state from a DOM element. | |
virtual QSet< QString > | referencedFields (const QgsExpressionContext &context=QgsExpressionContext()) const |
Returns the set of any fields required for diagram rendering. | |
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. | |
virtual QString | rendererName () const =0 |
void | setAttributeLegend (bool enabled) |
Sets whether the renderer will show legend items for diagram attributes. | |
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. | |
virtual void | writeXml (QDomElement &layerElem, QDomDocument &doc, const QgsReadWriteContext &context) const =0 |
Writes diagram state to a DOM element. | |
Protected Member Functions | |
QgsDiagramRenderer (const QgsDiagramRenderer &other) | |
void | _readXml (const QDomElement &elem, const QgsReadWriteContext &context) |
Reads internal QgsDiagramRenderer state from a DOM element. | |
void | _writeXml (QDomElement &rendererElem, QDomDocument &doc, const QgsReadWriteContext &context) const |
Writes internal QgsDiagramRenderer diagram state to a DOM element. | |
void | convertSizeToMapUnits (QSizeF &size, const QgsRenderContext &context) const |
Converts size from mm to map units. | |
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). | |
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. | |
QgsDiagramRenderer & | operator= (const QgsDiagramRenderer &other) |
Static Protected Member Functions | |
static int | dpiPaintDevice (const QPainter *) |
Returns the paint device dpi (or -1 in case of error. | |
Protected Attributes | |
std::unique_ptr< QgsDiagram > | mDiagram |
Reference to the object that does the real diagram rendering. | |
bool | mShowAttributeLegend = true |
Whether to show an attribute legend for the diagrams. | |
Evaluates and returns the diagram settings relating to a diagram for a specific feature.
Definition at line 646 of file qgsdiagramrenderer.h.
|
default |
|
virtualdefault |
|
protected |
Definition at line 450 of file qgsdiagramrenderer.cpp.
|
protected |
Reads internal QgsDiagramRenderer state from a DOM element.
Definition at line 561 of file qgsdiagramrenderer.cpp.
|
protected |
Writes internal QgsDiagramRenderer diagram state to a DOM element.
Definition at line 590 of file qgsdiagramrenderer.cpp.
|
inline |
Returns true
if renderer will show legend items for diagram attributes.
Definition at line 719 of file qgsdiagramrenderer.h.
|
pure virtual |
Returns new instance that is equivalent to this one.
Implemented in QgsSingleCategoryDiagramRenderer, and QgsLinearlyInterpolatedDiagramRenderer.
|
protected |
Converts size from mm to map units.
Definition at line 536 of file qgsdiagramrenderer.cpp.
|
inline |
Definition at line 690 of file qgsdiagramrenderer.h.
|
pure virtual |
Returns attribute indices needed for diagram rendering.
Implemented in QgsSingleCategoryDiagramRenderer, and QgsLinearlyInterpolatedDiagramRenderer.
|
pure virtual |
Returns list with all diagram settings in the renderer.
Implemented in QgsSingleCategoryDiagramRenderer, and QgsLinearlyInterpolatedDiagramRenderer.
|
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()
feature | the feature |
c | render context |
s | out: diagram settings for the feature |
Implemented in QgsSingleCategoryDiagramRenderer, and QgsLinearlyInterpolatedDiagramRenderer.
|
protectedpure virtual |
Returns size of the diagram (in painter units) or an invalid size in case of error.
Implemented in QgsSingleCategoryDiagramRenderer, and QgsLinearlyInterpolatedDiagramRenderer.
|
staticprotected |
Returns the paint device dpi (or -1 in case of error.
Definition at line 548 of file qgsdiagramrenderer.cpp.
|
virtual |
Returns list of legend nodes for the diagram.
Reimplemented in QgsSingleCategoryDiagramRenderer, and QgsLinearlyInterpolatedDiagramRenderer.
Definition at line 939 of file qgsdiagramrenderer.cpp.
|
protected |
Definition at line 456 of file qgsdiagramrenderer.cpp.
|
pure virtual |
Reads diagram state from a DOM element.
Subclasses should ensure that _readXml() is called by their readXml implementation to restore the general QgsDiagramRenderer settings.
Implemented in QgsSingleCategoryDiagramRenderer, and QgsLinearlyInterpolatedDiagramRenderer.
|
virtual |
Returns the set of any fields required for diagram rendering.
context | expression context the diagrams will be drawn using |
Reimplemented in QgsLinearlyInterpolatedDiagramRenderer.
Definition at line 516 of file qgsdiagramrenderer.cpp.
void QgsDiagramRenderer::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.
Definition at line 463 of file qgsdiagramrenderer.cpp.
|
pure virtual |
Implemented in QgsSingleCategoryDiagramRenderer, and QgsLinearlyInterpolatedDiagramRenderer.
|
inline |
Sets whether the renderer will show legend items for diagram attributes.
enabled | set to true to show diagram attribute legend |
Definition at line 726 of file qgsdiagramrenderer.h.
void QgsDiagramRenderer::setDiagram | ( | QgsDiagram * | d | ) |
Definition at line 442 of file qgsdiagramrenderer.cpp.
|
virtual |
Returns size of the diagram for a feature in map units. Returns an invalid QSizeF in case of error.
Definition at line 498 of file qgsdiagramrenderer.cpp.
|
pure virtual |
Writes diagram state to a DOM element.
Subclasses should ensure that _writeXml() is called by their writeXml implementation to save the general QgsDiagramRenderer settings.
Implemented in QgsSingleCategoryDiagramRenderer, and QgsLinearlyInterpolatedDiagramRenderer.
|
protected |
Reference to the object that does the real diagram rendering.
Definition at line 764 of file qgsdiagramrenderer.h.
|
protected |
Whether to show an attribute legend for the diagrams.
Definition at line 767 of file qgsdiagramrenderer.h.