QGIS API Documentation 3.30.0-'s-Hertogenbosch (f186b8efe0)
Public Member Functions | Protected Member Functions | List of all members
QgsDiagram Class Referenceabstract

Base class for all diagram types. More...

#include <qgsdiagram.h>

Inheritance diagram for QgsDiagram:
Inheritance graph
[legend]

Public Member Functions

virtual ~QgsDiagram ()
 
void clearCache ()
 
virtual QgsDiagramclone () const =0
 Returns an instance that is equivalent to this one. More...
 
virtual QString diagramName () const =0
 Gets a descriptive name for this diagram type. More...
 
virtual QSizeF diagramSize (const QgsAttributes &attributes, const QgsRenderContext &c, const QgsDiagramSettings &s)=0
 Returns the size in map units the diagram will use to render. More...
 
virtual QSizeF diagramSize (const QgsFeature &feature, const QgsRenderContext &c, const QgsDiagramSettings &s, const QgsDiagramInterpolationSettings &is)=0
 Returns the size in map units the diagram will use to render. Interpolate size. More...
 
QgsExpressiongetExpression (const QString &expression, const QgsExpressionContext &context)
 Returns a prepared expression for the specified context. More...
 
virtual double legendSize (double value, const QgsDiagramSettings &s, const QgsDiagramInterpolationSettings &is) const =0
 Returns the size of the legend item for the diagram corresponding to a specified value. More...
 
virtual void renderDiagram (const QgsFeature &feature, QgsRenderContext &c, const QgsDiagramSettings &s, QPointF position)=0
 Draws the diagram at the given position (in pixel coordinates) More...
 

Protected Member Functions

 QgsDiagram ()=default
 Constructor for QgsDiagram. More...
 
 QgsDiagram (const QgsDiagram &other)
 
QFont scaledFont (const QgsDiagramSettings &s, const QgsRenderContext &c)
 Calculates a size to match the current settings and rendering context. More...
 
void setPenWidth (QPen &pen, const QgsDiagramSettings &s, const QgsRenderContext &c)
 Changes the pen width to match the current settings and rendering context. More...
 
QSizeF sizeForValue (double value, const QgsDiagramSettings &s, const QgsDiagramInterpolationSettings &is) const
 Returns the scaled size of a diagram for a value, respecting the specified diagram interpolation settings. More...
 
double sizePainterUnits (double l, const QgsDiagramSettings &s, const QgsRenderContext &c)
 Calculates a length to match the current settings and rendering context. More...
 
QSizeF sizePainterUnits (QSizeF size, const QgsDiagramSettings &s, const QgsRenderContext &c)
 Calculates a size to match the current settings and rendering context. More...
 

Detailed Description

Base class for all diagram types.

Definition at line 39 of file qgsdiagram.h.

Constructor & Destructor Documentation

◆ ~QgsDiagram()

virtual QgsDiagram::~QgsDiagram ( )
inlinevirtual

Definition at line 58 of file qgsdiagram.h.

◆ QgsDiagram() [1/2]

QgsDiagram::QgsDiagram ( )
protecteddefault

Constructor for QgsDiagram.

◆ QgsDiagram() [2/2]

QgsDiagram::QgsDiagram ( const QgsDiagram other)
protected

Definition at line 21 of file qgsdiagram.cpp.

Member Function Documentation

◆ clearCache()

void QgsDiagram::clearCache ( )

Definition at line 27 of file qgsdiagram.cpp.

◆ clone()

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

Returns an instance that is equivalent to this one.

Since
QGIS 2.4

Implemented in QgsHistogramDiagram, QgsPieDiagram, QgsStackedBarDiagram, and QgsTextDiagram.

◆ diagramName()

virtual QString QgsDiagram::diagramName ( ) const
pure virtual

Gets a descriptive name for this diagram type.

Implemented in QgsHistogramDiagram, QgsPieDiagram, QgsStackedBarDiagram, and QgsTextDiagram.

◆ diagramSize() [1/2]

virtual QSizeF QgsDiagram::diagramSize ( const QgsAttributes attributes,
const QgsRenderContext c,
const QgsDiagramSettings s 
)
pure virtual

Returns the size in map units the diagram will use to render.

Implemented in QgsHistogramDiagram, QgsPieDiagram, QgsStackedBarDiagram, and QgsTextDiagram.

◆ diagramSize() [2/2]

virtual QSizeF QgsDiagram::diagramSize ( const QgsFeature feature,
const QgsRenderContext c,
const QgsDiagramSettings s,
const QgsDiagramInterpolationSettings is 
)
pure virtual

Returns the size in map units the diagram will use to render. Interpolate size.

Implemented in QgsHistogramDiagram, QgsPieDiagram, QgsStackedBarDiagram, and QgsTextDiagram.

◆ getExpression()

QgsExpression * QgsDiagram::getExpression ( const QString &  expression,
const QgsExpressionContext context 
)

Returns a prepared expression for the specified context.

Parameters
expressionexpression string
contextexpression context
Since
QGIS 2.12

Definition at line 38 of file qgsdiagram.cpp.

◆ legendSize()

virtual double QgsDiagram::legendSize ( double  value,
const QgsDiagramSettings s,
const QgsDiagramInterpolationSettings is 
) const
pure virtual

Returns the size of the legend item for the diagram corresponding to a specified value.

Parameters
valuevalue to return legend item size for
sdiagram settings
isinterpolation settings
Since
QGIS 2.16

Implemented in QgsHistogramDiagram, QgsPieDiagram, QgsStackedBarDiagram, and QgsTextDiagram.

◆ renderDiagram()

virtual void QgsDiagram::renderDiagram ( const QgsFeature feature,
QgsRenderContext c,
const QgsDiagramSettings s,
QPointF  position 
)
pure virtual

Draws the diagram at the given position (in pixel coordinates)

Implemented in QgsHistogramDiagram, QgsPieDiagram, QgsStackedBarDiagram, and QgsTextDiagram.

◆ scaledFont()

QFont QgsDiagram::scaledFont ( const QgsDiagramSettings s,
const QgsRenderContext c 
)
protected

Calculates a size to match the current settings and rendering context.

Parameters
sThe settings that contain the font size and size type
cThe rendering specifying the proper scale units for pixel conversion
Returns
The properly scaled font for rendering

Definition at line 65 of file qgsdiagram.cpp.

◆ setPenWidth()

void QgsDiagram::setPenWidth ( QPen &  pen,
const QgsDiagramSettings s,
const QgsRenderContext c 
)
protected

Changes the pen width to match the current settings and rendering context.

Parameters
penThe pen to modify
sThe settings that specify the pen width
cThe rendering specifying the proper scale units for pixel conversion

Definition at line 49 of file qgsdiagram.cpp.

◆ sizeForValue()

QSizeF QgsDiagram::sizeForValue ( double  value,
const QgsDiagramSettings s,
const QgsDiagramInterpolationSettings is 
) const
protected

Returns the scaled size of a diagram for a value, respecting the specified diagram interpolation settings.

Parameters
valuevalue to calculate corresponding circular size for
sdiagram settings
isinterpolation settings
Since
QGIS 2.16

Definition at line 81 of file qgsdiagram.cpp.

◆ sizePainterUnits() [1/2]

double QgsDiagram::sizePainterUnits ( double  l,
const QgsDiagramSettings s,
const QgsRenderContext c 
)
protected

Calculates a length to match the current settings and rendering context.

Parameters
lThe length to convert
sUnused
cThe rendering specifying the proper scale units for pixel conversion
Returns
The converted length for rendering

Definition at line 60 of file qgsdiagram.cpp.

◆ sizePainterUnits() [2/2]

QSizeF QgsDiagram::sizePainterUnits ( QSizeF  size,
const QgsDiagramSettings s,
const QgsRenderContext c 
)
protected

Calculates a size to match the current settings and rendering context.

Parameters
sizeThe size to convert
sThe settings that specify the size type
cThe rendering specifying the proper scale units for pixel conversion
Returns
The converted size for rendering

Definition at line 55 of file qgsdiagram.cpp.


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