QgsDiagram class
Base class for all diagram types.
Contents
Constructors, destructors, conversion operators
- QgsDiagram() protected defaulted
- Constructor for QgsDiagram.
Public functions
- auto clone() const -> QgsDiagram* pure virtual
- Returns an instance that is equivalent to this one.
- auto diagramName() const -> QString pure virtual
- Gets a descriptive name for this diagram type.
- auto diagramSize(const QgsAttributes& attributes, const QgsRenderContext& c, const QgsDiagramSettings& s) -> QSizeF pure virtual
- Returns the size in map units the diagram will use to render.
- auto diagramSize(const QgsFeature& feature, const QgsRenderContext& c, const QgsDiagramSettings& s, const QgsDiagramInterpolationSettings& is) -> QSizeF pure virtual
- Returns the size in map units the diagram will use to render. Interpolate size.
- auto getExpression(const QString& expression, const QgsExpressionContext& context) -> QgsExpression*
- Returns a prepared expression for the specified context.
- auto legendSize(double value, const QgsDiagramSettings& s, const QgsDiagramInterpolationSettings& is) const -> double pure virtual
- Returns the size of the legend item for the diagram corresponding to a specified value.
- void renderDiagram(const QgsFeature& feature, QgsRenderContext& c, const QgsDiagramSettings& s, QPointF position) pure virtual
- Draws the diagram at the given position (in pixel coordinates)
Protected functions
- auto scaledFont(const QgsDiagramSettings& s, const QgsRenderContext& c) -> QFont
- Calculates a size to match the current settings and rendering context.
- void setPenWidth(QPen& pen, const QgsDiagramSettings& s, const QgsRenderContext& c)
- Changes the pen width to match the current settings and rendering context.
- auto sizeForValue(double value, const QgsDiagramSettings& s, const QgsDiagramInterpolationSettings& is) const -> QSizeF
- Returns the scaled size of a diagram for a value, respecting the specified diagram interpolation settings.
- auto sizePainterUnits(QSizeF size, const QgsDiagramSettings& s, const QgsRenderContext& c) -> QSizeF
- Calculates a size to match the current settings and rendering context.
- auto sizePainterUnits(double l, const QgsDiagramSettings& s, const QgsRenderContext& c) -> double
- Calculates a length to match the current settings and rendering context.
Function documentation
QgsDiagram* QgsDiagram:: clone() const pure virtual
Returns an instance that is equivalent to this one.
QgsExpression* QgsDiagram:: getExpression(const QString& expression,
const QgsExpressionContext& context)
Returns a prepared expression for the specified context.
| Parameters | |
|---|---|
| expression | expression string |
| context | expression context |
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 | |
|---|---|
| value | value to return legend item size for |
| s | diagram settings |
| is | interpolation settings |
QFont QgsDiagram:: scaledFont(const QgsDiagramSettings& s,
const QgsRenderContext& c) protected
Calculates a size to match the current settings and rendering context.
| Parameters | |
|---|---|
| s | The settings that contain the font size and size type |
| c | The rendering specifying the proper scale units for pixel conversion |
| Returns | The properly scaled font for rendering |
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 | |
|---|---|
| pen | The pen to modify |
| s | The settings that specify the pen width |
| c | The rendering specifying the proper scale units for pixel conversion |
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 | |
|---|---|
| value | value to calculate corresponding circular size for |
| s | diagram settings |
| is | interpolation settings |
QSizeF QgsDiagram:: sizePainterUnits(QSizeF size,
const QgsDiagramSettings& s,
const QgsRenderContext& c) protected
Calculates a size to match the current settings and rendering context.
| Parameters | |
|---|---|
| size | The size to convert |
| s | The settings that specify the size type |
| c | The rendering specifying the proper scale units for pixel conversion |
| Returns | The converted size for rendering |
double QgsDiagram:: sizePainterUnits(double l,
const QgsDiagramSettings& s,
const QgsRenderContext& c) protected
Calculates a length to match the current settings and rendering context.
| Parameters | |
|---|---|
| l | The length to convert |
| s | Unused |
| c | The rendering specifying the proper scale units for pixel conversion |
| Returns | The converted length for rendering |