QGIS API Documentation 3.41.0-Master (3440c17df1d)
Loading...
Searching...
No Matches
Public Member Functions | Static Public Attributes | Protected Member Functions | List of all members
QgsSingleCategoryDiagramRenderer Class Reference

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

#include <qgsdiagramrenderer.h>

Inheritance diagram for QgsSingleCategoryDiagramRenderer:
Inheritance graph
[legend]

Public Member Functions

 QgsSingleCategoryDiagramRenderer ()=default
 
QgsSingleCategoryDiagramRendererclone () const override
 Returns new instance that is equivalent to this one.
 
QList< QString > diagramAttributes () const override
 Returns attribute indices needed for diagram rendering.
 
QList< QgsDiagramSettingsdiagramSettings () 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.
 
void readXml (const QDomElement &elem, const QgsReadWriteContext &context) override
 Reads diagram state from a DOM element.
 
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.
 
- 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.
 
QgsDiagramdiagram () const
 
virtual QSet< QString > referencedFields (const QgsExpressionContext &context=QgsExpressionContext()) const
 Returns the set of any fields required for diagram rendering.
 
virtual 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.
 
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.
 

Static Public Attributes

static const QString DIAGRAM_RENDERER_NAME_SINGLE_CATEGORY = QStringLiteral( "SingleCategory" )
 

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.
 
QgsDiagramRendereroperator= (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< QgsDiagrammDiagram
 Reference to the object that does the real diagram rendering.
 
bool mShowAttributeLegend = true
 Whether to show an attribute legend for the diagrams.
 

Detailed Description

Renders the diagrams for all features with the same settings.

Definition at line 874 of file qgsdiagramrenderer.h.

Constructor & Destructor Documentation

◆ QgsSingleCategoryDiagramRenderer()

QgsSingleCategoryDiagramRenderer::QgsSingleCategoryDiagramRenderer ( )
default

Member Function Documentation

◆ clone()

QgsSingleCategoryDiagramRenderer * QgsSingleCategoryDiagramRenderer::clone ( ) const
overridevirtual

Returns new instance that is equivalent to this one.

Implements QgsDiagramRenderer.

Definition at line 659 of file qgsdiagramrenderer.cpp.

◆ diagramAttributes()

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

Returns attribute indices needed for diagram rendering.

Implements QgsDiagramRenderer.

Definition at line 885 of file qgsdiagramrenderer.h.

◆ diagramSettings() [1/2]

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

Returns list with all diagram settings in the renderer.

Implements QgsDiagramRenderer.

Definition at line 676 of file qgsdiagramrenderer.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 QgsDiagramRenderer.

Definition at line 664 of file qgsdiagramrenderer.cpp.

◆ diagramSize()

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

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

Parameters
featurethe feature
crender context

Implements QgsDiagramRenderer.

Definition at line 671 of file qgsdiagramrenderer.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

Reimplemented from QgsDiagramRenderer.

Definition at line 1313 of file qgsdiagramrenderer.cpp.

◆ readXml()

void QgsSingleCategoryDiagramRenderer::readXml ( const QDomElement &  elem,
const QgsReadWriteContext context 
)
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.

See also
writeXml()

Implements QgsDiagramRenderer.

Definition at line 683 of file qgsdiagramrenderer.cpp.

◆ rendererName()

QString QgsSingleCategoryDiagramRenderer::rendererName ( ) const
inlineoverridevirtual

Implements QgsDiagramRenderer.

Definition at line 883 of file qgsdiagramrenderer.h.

◆ setDiagramSettings()

void QgsSingleCategoryDiagramRenderer::setDiagramSettings ( const QgsDiagramSettings s)
inline

Definition at line 887 of file qgsdiagramrenderer.h.

◆ writeXml()

void QgsSingleCategoryDiagramRenderer::writeXml ( QDomElement &  layerElem,
QDomDocument &  doc,
const QgsReadWriteContext context 
) const
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.

See also
readXml()

Implements QgsDiagramRenderer.

Definition at line 695 of file qgsdiagramrenderer.cpp.

Member Data Documentation

◆ DIAGRAM_RENDERER_NAME_SINGLE_CATEGORY

const QString QgsSingleCategoryDiagramRenderer::DIAGRAM_RENDERER_NAME_SINGLE_CATEGORY = QStringLiteral( "SingleCategory" )
static

Definition at line 877 of file qgsdiagramrenderer.h.


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