QGIS API Documentation 3.40.0-Bratislava (b56115d8743)
|
Renders diagrams using mixed diagram render types. More...
#include <qgsdiagramrenderer.h>
Public Member Functions | |
QgsStackedDiagramRenderer ()=default | |
QgsStackedDiagramRenderer (const QgsStackedDiagramRenderer &other) | |
~QgsStackedDiagramRenderer () override | |
void | _readXmlSubRenderers (const QDomElement &elem, const QgsReadWriteContext &context) |
Reads stacked renderers state from a DOM element. | |
void | _writeXmlSubRenderers (QDomElement &rendererElem, QDomDocument &doc, const QgsReadWriteContext &context) const |
Writes stacked renderers state to a DOM element. | |
void | addRenderer (QgsDiagramRenderer *renderer) |
Adds a renderer to the stacked renderer object. | |
QgsStackedDiagramRenderer * | clone () const override |
Returns new instance that is equivalent to this one. | |
QList< QString > | diagramAttributes () const override |
Returns attribute indices needed for diagram rendering. | |
QList< QgsDiagramSettings > | diagramSettings () const override |
Returns list with all diagram settings in the renderer. | |
QList< QgsLayerTreeModelLegendNode * > | legendItems (QgsLayerTreeLayer *nodeLayer) const override |
Returns list of legend nodes for the diagram. | |
QgsStackedDiagramRenderer & | operator= (const QgsStackedDiagramRenderer &other) |
void | readXml (const QDomElement &elem, const QgsReadWriteContext &context) override |
Reads diagram state from a DOM element. | |
virtual void | renderDiagram (const QgsFeature &feature, QgsRenderContext &c, QPointF pos, const QgsPropertyCollection &properties=QgsPropertyCollection()) const override |
Renders the diagram for a specified feature at a specific position in the passed render context, taking all renderers and their own diagrams into account. | |
const QgsDiagramRenderer * | renderer (const int index) const |
Returns the renderer at the given index. | |
int | rendererCount () const |
Returns the number of sub renderers in the stacked diagram renderer. | |
QString | rendererName () const override |
QList< QgsDiagramRenderer * > | renderers (bool sortByDiagramMode=false) const |
Returns an ordered list with the renderers of the stacked renderer object. | |
void | setDiagramSettings (const QgsDiagramSettings &s) |
virtual QSizeF | sizeMapUnits (const QgsFeature &feature, const QgsRenderContext &c) const override |
Returns size of the diagram for a feature in map units. Returns an invalid QSizeF in case of error. | |
void | writeXml (QDomElement &layerElem, QDomDocument &doc, const QgsReadWriteContext &context) const override |
Writes diagram state to a DOM element. | |
Public Member Functions inherited from QgsDiagramRenderer | |
QgsDiagramRenderer ()=default | |
virtual | ~QgsDiagramRenderer ()=default |
bool | attributeLegend () const |
Returns true if renderer will show legend items for diagram attributes. | |
QgsDiagram * | diagram () const |
virtual QSet< QString > | referencedFields (const QgsExpressionContext &context=QgsExpressionContext()) const |
Returns the set of any fields required for diagram rendering. | |
void | setAttributeLegend (bool enabled) |
Sets whether the renderer will show legend items for diagram attributes. | |
void | setDiagram (QgsDiagram *d) |
Static Public Attributes | |
static const QString | DIAGRAM_RENDERER_NAME_STACKED = QStringLiteral( "Stacked" ) |
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). | |
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. | |
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. | |
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. | |
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. | |
Protected Attributes inherited from QgsDiagramRenderer | |
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. | |
Renders diagrams using mixed diagram render types.
The size of the rendered diagram is given by a combination of subrenderers.
Definition at line 1000 of file qgsdiagramrenderer.h.
|
default |
|
override |
Definition at line 893 of file qgsdiagramrenderer.cpp.
QgsStackedDiagramRenderer::QgsStackedDiagramRenderer | ( | const QgsStackedDiagramRenderer & | other | ) |
Definition at line 867 of file qgsdiagramrenderer.cpp.
void QgsStackedDiagramRenderer::_readXmlSubRenderers | ( | const QDomElement & | elem, |
const QgsReadWriteContext & | context | ||
) |
Reads stacked renderers state from a DOM element.
Definition at line 1110 of file qgsdiagramrenderer.cpp.
void QgsStackedDiagramRenderer::_writeXmlSubRenderers | ( | QDomElement & | rendererElem, |
QDomDocument & | doc, | ||
const QgsReadWriteContext & | context | ||
) | const |
Writes stacked renderers state to a DOM element.
Definition at line 1156 of file qgsdiagramrenderer.cpp.
void QgsStackedDiagramRenderer::addRenderer | ( | QgsDiagramRenderer * | renderer | ) |
Adds a renderer to the stacked renderer object.
Takes ownership.
Renderers added first will render their diagrams first, i.e., more to the left (horizontal mode) or more to the top (vertical mode).
renderer | diagram renderer to be added to the stacked renderer |
Definition at line 1079 of file qgsdiagramrenderer.cpp.
|
overridevirtual |
Returns new instance that is equivalent to this one.
Implements QgsDiagramRenderer.
Definition at line 898 of file qgsdiagramrenderer.cpp.
|
overridevirtual |
Returns attribute indices needed for diagram rendering.
Implements QgsDiagramRenderer.
Definition at line 1050 of file qgsdiagramrenderer.cpp.
|
overridevirtual |
Returns list with all diagram settings in the renderer.
Implements QgsDiagramRenderer.
Definition at line 1043 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 1028 of file qgsdiagramrenderer.cpp.
|
overrideprotectedvirtual |
Returns size of the diagram (in painter units) or an invalid size in case of error.
feature | the feature |
c | render context |
Implements QgsDiagramRenderer.
Definition at line 1036 of file qgsdiagramrenderer.cpp.
|
overridevirtual |
Returns list of legend nodes for the diagram.
Reimplemented from QgsDiagramRenderer.
Definition at line 1055 of file qgsdiagramrenderer.cpp.
QgsStackedDiagramRenderer & QgsStackedDiagramRenderer::operator= | ( | const QgsStackedDiagramRenderer & | other | ) |
Definition at line 879 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 1097 of file qgsdiagramrenderer.cpp.
|
overridevirtual |
Renders the diagram for a specified feature at a specific position in the passed render context, taking all renderers and their own diagrams into account.
Diagram rendering is delegated to renderer's diagram.
Reimplemented from QgsDiagramRenderer.
Definition at line 951 of file qgsdiagramrenderer.cpp.
const QgsDiagramRenderer * QgsStackedDiagramRenderer::renderer | ( | const int | index | ) | const |
Returns the renderer at the given index.
Does not transfer ownership.
index | index of the desired renderer in the stacked renderer |
Definition at line 1087 of file qgsdiagramrenderer.cpp.
int QgsStackedDiagramRenderer::rendererCount | ( | ) | const |
Returns the number of sub renderers in the stacked diagram renderer.
Definition at line 1092 of file qgsdiagramrenderer.cpp.
|
inlineoverridevirtual |
Implements QgsDiagramRenderer.
Definition at line 1031 of file qgsdiagramrenderer.h.
QList< QgsDiagramRenderer * > QgsStackedDiagramRenderer::renderers | ( | bool | sortByDiagramMode = false | ) | const |
Returns an ordered list with the renderers of the stacked renderer object.
Does not transfer ownership.
sortByDiagramMode | If true, the list is returned backwards for vertical orientation. |
Definition at line 1066 of file qgsdiagramrenderer.cpp.
|
inline |
Definition at line 1027 of file qgsdiagramrenderer.h.
|
overridevirtual |
Returns size of the diagram for a feature in map units. Returns an invalid QSizeF in case of error.
Reimplemented from QgsDiagramRenderer.
Definition at line 903 of file qgsdiagramrenderer.cpp.
|
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 1147 of file qgsdiagramrenderer.cpp.
|
static |
Definition at line 1003 of file qgsdiagramrenderer.h.