QGIS API Documentation
3.14.0-Pi (9f7028fd23)
|
Go to the documentation of this file.
27 return QStringLiteral(
"Numeric" );
32 return QObject::tr(
"Numeric" );
57 QPainter *painter = context.
painter();
61 painter->setRenderHint( QPainter::Antialiasing,
true );
110 QString QgsNumericScaleBarRenderer::scaleText(
double scale,
const QgsScaleBarSettings &settings )
const
void draw(QgsRenderContext &context, const QgsScaleBarSettings &settings, const QgsScaleBarRenderer::ScaleBarContext &scaleContext) const override
Draws the scalebar using the specified settings and scaleContext to a destination render context.
QgsNumericScaleBarRenderer * clone() const override
Returns a clone of the renderer.
double convertToPainterUnits(double size, QgsUnitTypes::RenderUnit unit, const QgsMapUnitScale &scale=QgsMapUnitScale()) const
Converts a size from the specified units to painter units (pixels).
Contains parameters regarding scalebar calculations.
@ AlignCenter
Center align.
QString id() const override
Returns the unique ID for this renderer.
@ RenderMillimeters
Millimeters.
QSizeF calculateBoxSize(QgsRenderContext &context, const QgsScaleBarSettings &settings, const QgsScaleBarRenderer::ScaleBarContext &scaleContext) const override
Calculates the required box size (in millimeters) for a scalebar using the specified settings and sca...
int sortKey() const override
Returns a sorting key value, where renderers with a lower sort key will be shown earlier in lists.
@ AlignMiddle
Center aligned.
static double textWidth(const QgsRenderContext &context, const QgsTextFormat &format, const QStringList &textLines, QFontMetricsF *fontMetrics=nullptr)
Returns the width of a text based on a given format.
QSizeF size
Destination size for scalebar.
static void drawText(const QRectF &rect, double rotation, HAlignment alignment, const QStringList &textLines, QgsRenderContext &context, const QgsTextFormat &format, bool drawAsOutlines=true)
Draws text within a rectangle using the specified settings.
Alignment alignment() const
Returns the scalebar alignment.
double boxContentSpace() const
Returns the spacing (margin) between the scalebar box and content in millimeters.
QgsTextFormat & textFormat()
Returns the text format used for drawing text in the scalebar.
QString visibleName() const override
Returns the user friendly, translated name for the renderer.
QgsNumericScaleBarRenderer()=default
Constructor for QgsNumericScaleBarRenderer.
@ FlagUsesAlignment
Renderer uses the QgsScaleBarSettings::alignment() setting.
double scale
Scale denominator.
Flags flags() const override
Returns the scalebar rendering flags, which dictates the renderer's behavior.
@ AlignRight
Right aligned.
static double textHeight(const QgsRenderContext &context, const QgsTextFormat &format, const QStringList &textLines, DrawMode mode=Point, QFontMetricsF *fontMetrics=nullptr)
Returns the height of a text based on a given format.
QFont toQFont() const
Returns a QFont matching the relevant settings from this text format.
static double fontAscentMM(const QFont &font)
Calculates a font ascent in millimeters, including workarounds for QT font rendering issues.
@ Antialiasing
Use antialiasing while drawing.
QPainter * painter()
Returns the destination QPainter for the render operation.
const QgsNumericFormat * numericFormat() const
Returns the numeric format used for numbers in the scalebar.
HAlignment
Horizontal alignment.
Flags flags() const
Returns combination of flags used for rendering.
static double textWidthMM(const QFont &font, const QString &text)
Calculate a font width in millimeters for a text string, including workarounds for QT font rendering ...