32 QMapIterator<QString, QgsExpression *> i( mExpressions );
43 if ( !mExpressions.contains( expression ) )
47 mExpressions[expression] = expr;
49 return mExpressions[expression];
74 f.setPixelSize( pixelsize > 0 ? pixelsize : 1 );
86 double scaledValue = value;
93 scaledValue = std::sqrt( scaledValue );
94 scaledLowerValue = std::sqrt( scaledLowerValue );
95 scaledUpperValue = std::sqrt( scaledUpperValue );
99 double scaledRatio = ( scaledValue - scaledLowerValue ) / ( scaledUpperValue - scaledLowerValue );
101 QSizeF size = QSizeF( is.
upperSize.width() * scaledRatio + is.
lowerSize.width() * ( 1 - scaledRatio ),
115 size.setWidth( size.height() );
QSizeF sizePainterUnits(QSizeF size, const QgsDiagramSettings &s, const QgsRenderContext &c)
Calculates a size to match the current settings and rendering context.
Class for parsing and evaluation of expressions (formerly called "search strings").
QgsUnitTypes::RenderUnit lineSizeUnit
Line unit index.
double minimumSize
Scale diagrams smaller than mMinimumSize to mMinimumSize.
double convertToPainterUnits(double size, QgsUnitTypes::RenderUnit unit, const QgsMapUnitScale &scale=QgsMapUnitScale()) const
Converts a size from the specified units to painter units (pixels).
bool qgsDoubleNear(double a, double b, double epsilon=4 *std::numeric_limits< double >::epsilon())
Compare two doubles (but allow some difference)
double scaleFactor() const
Returns the scaling factor for the render to convert painter units to physical sizes.
As part of the API refactoring and improvements which landed in the Processing API was substantially reworked from the x version This was done in order to allow much of the underlying Processing framework to be ported into c
QgsDiagram()=default
Constructor for QgsDiagram.
QgsExpression * getExpression(const QString &expression, const QgsExpressionContext &context)
Returns a prepared expression for the specified context.
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
QgsMapUnitScale sizeScale
Diagram size unit scale.
double mapUnitsPerPixel() const
Returns current map units per pixel.
Base class for all diagram types.
QgsUnitTypes::RenderUnit sizeType
Diagram size unit.
Additional diagram settings for interpolated size rendering.
Contains information about the context of a rendering operation.
QFont scaledFont(const QgsDiagramSettings &s, const QgsRenderContext &c)
Calculates a size to match the current settings and rendering context.
bool prepare(const QgsExpressionContext *context)
Gets the expression ready for evaluation - find out column indexes.
const QgsMapToPixel & mapToPixel() const
Returns the context's map to pixel transform, which transforms between map coordinates and device coo...
QgsMapUnitScale lineSizeScale
Line unit scale.
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 sett...
void setPenWidth(QPen &pen, const QgsDiagramSettings &s, const QgsRenderContext &c)
Changes the pen width to match the current settings and rendering context.
Stores the settings for rendering a single diagram.