QGIS API Documentation  3.17.0-Master (7a14973234)
Public Member Functions | List of all members
QgsNumericScaleBarRenderer Class Reference

A scale bar style that draws text in the form of '1:XXXXX'. More...

#include <qgsnumericscalebarrenderer.h>

Inheritance diagram for QgsNumericScaleBarRenderer:
Inheritance graph
[legend]

Public Member Functions

 QgsNumericScaleBarRenderer ()=default
 Constructor for QgsNumericScaleBarRenderer. More...
 
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 scaleContext. More...
 
Q_DECL_DEPRECATED QSizeF calculateBoxSize (const QgsScaleBarSettings &settings, const QgsScaleBarRenderer::ScaleBarContext &scaleContext) const override
 Calculates the required box size (in millimeters) for a scalebar using the specified settings and scaleContext. More...
 
QgsNumericScaleBarRendererclone () const override
 Returns a clone of the renderer. More...
 
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. More...
 
Flags flags () const override
 Returns the scalebar rendering flags, which dictates the renderer's behavior. More...
 
QString id () const override
 Returns the unique ID for this renderer. More...
 
int sortKey () const override
 Returns a sorting key value, where renderers with a lower sort key will be shown earlier in lists. More...
 
QString visibleName () const override
 Returns the user friendly, translated name for the renderer. More...
 
- Public Member Functions inherited from QgsScaleBarRenderer
 QgsScaleBarRenderer ()=default
 Constructor for QgsScaleBarRenderer. More...
 
virtual ~QgsScaleBarRenderer ()=default
 
virtual bool applyDefaultSettings (QgsScaleBarSettings &settings) const
 Applies any default settings relating to the scalebar to the passed settings object. More...
 
Q_DECL_DEPRECATED QString name () const
 Returns the unique name for this style. More...
 

Additional Inherited Members

- Public Types inherited from QgsScaleBarRenderer
enum  Flag {
  Flag::FlagUsesLineSymbol = 1 << 0, Flag::FlagUsesFillSymbol = 1 << 1, Flag::FlagUsesAlternateFillSymbol = 1 << 2, Flag::FlagRespectsUnits = 1 << 3,
  Flag::FlagRespectsMapUnitsPerScaleBarUnit = 1 << 4, Flag::FlagUsesUnitLabel = 1 << 5, Flag::FlagUsesSegments = 1 << 6, Flag::FlagUsesLabelBarSpace = 1 << 7,
  Flag::FlagUsesLabelVerticalPlacement = 1 << 8, Flag::FlagUsesLabelHorizontalPlacement = 1 << 8, Flag::FlagUsesAlignment = 1 << 9, Flag::FlagUsesSubdivisions = 1 << 10,
  Flag::FlagUsesDivisionSymbol = 1 << 11, Flag::FlagUsesSubdivisionSymbol = 1 << 12, Flag::FlagUsesSubdivisionsHeight = 1 << 13
}
 Flags which control scalebar renderer behavior. More...
 
- Protected Member Functions inherited from QgsScaleBarRenderer
void drawDefaultLabels (QgsRenderContext &context, const QgsScaleBarSettings &settings, const QgsScaleBarRenderer::ScaleBarContext &scaleContext) const
 Draws default scalebar labels using the specified settings and scaleContext to a destination render context. More...
 
QString firstLabelString (const QgsScaleBarSettings &settings) const
 Returns the text used for the first label in the scalebar. More...
 
Q_DECL_DEPRECATED double firstLabelXOffset (const QgsScaleBarSettings &settings) const
 Returns the x-offset (in millimeters) used for the first label in the scalebar. More...
 
double firstLabelXOffset (const QgsScaleBarSettings &settings, const QgsRenderContext &context, const ScaleBarContext &scaleContext) const
 Returns the x-offset (in render context painter units) used for the first label in the scalebar. More...
 
Q_DECL_DEPRECATED QList< double > segmentPositions (const QgsScaleBarRenderer::ScaleBarContext &scaleContext, const QgsScaleBarSettings &settings) const
 Returns a list of positions for each segment within the scalebar. More...
 
QList< double > segmentPositions (QgsRenderContext &context, const QgsScaleBarRenderer::ScaleBarContext &scaleContext, const QgsScaleBarSettings &settings) const
 Returns a list of positions for each segment within the scalebar. More...
 
QList< double > segmentWidths (const QgsScaleBarRenderer::ScaleBarContext &scaleContext, const QgsScaleBarSettings &settings) const
 Returns a list of widths of each segment of the scalebar. More...
 

Detailed Description

A scale bar style that draws text in the form of '1:XXXXX'.

Since
QGIS 3.0

Definition at line 30 of file qgsnumericscalebarrenderer.h.

Constructor & Destructor Documentation

◆ QgsNumericScaleBarRenderer()

QgsNumericScaleBarRenderer::QgsNumericScaleBarRenderer ( )
default

Constructor for QgsNumericScaleBarRenderer.

Member Function Documentation

◆ calculateBoxSize() [1/2]

QSizeF QgsNumericScaleBarRenderer::calculateBoxSize ( QgsRenderContext context,
const QgsScaleBarSettings settings,
const QgsScaleBarRenderer::ScaleBarContext scaleContext 
) const
overridevirtual

Calculates the required box size (in millimeters) for a scalebar using the specified settings and scaleContext.

Since
QGIS 3.14

Reimplemented from QgsScaleBarRenderer.

Definition at line 84 of file qgsnumericscalebarrenderer.cpp.

◆ calculateBoxSize() [2/2]

QSizeF QgsNumericScaleBarRenderer::calculateBoxSize ( const QgsScaleBarSettings settings,
const QgsScaleBarRenderer::ScaleBarContext scaleContext 
) const
overridevirtual

Calculates the required box size (in millimeters) for a scalebar using the specified settings and scaleContext.

Deprecated:
Use the version with a QgsRenderContext instead.

Reimplemented from QgsScaleBarRenderer.

Definition at line 96 of file qgsnumericscalebarrenderer.cpp.

◆ clone()

QgsNumericScaleBarRenderer * QgsNumericScaleBarRenderer::clone ( ) const
overridevirtual

Returns a clone of the renderer.

The caller takes ownership of the returned value.

Implements QgsScaleBarRenderer.

Definition at line 45 of file qgsnumericscalebarrenderer.cpp.

◆ draw()

void QgsNumericScaleBarRenderer::draw ( QgsRenderContext context,
const QgsScaleBarSettings settings,
const QgsScaleBarRenderer::ScaleBarContext scaleContext 
) const
overridevirtual

Draws the scalebar using the specified settings and scaleContext to a destination render context.

Implements QgsScaleBarRenderer.

Definition at line 50 of file qgsnumericscalebarrenderer.cpp.

◆ flags()

QgsScaleBarRenderer::Flags QgsNumericScaleBarRenderer::flags ( ) const
overridevirtual

Returns the scalebar rendering flags, which dictates the renderer's behavior.

Since
QGIS 3.14

Reimplemented from QgsScaleBarRenderer.

Definition at line 40 of file qgsnumericscalebarrenderer.cpp.

◆ id()

QString QgsNumericScaleBarRenderer::id ( ) const
overridevirtual

Returns the unique ID for this renderer.

Since
QGIS 3.14

Implements QgsScaleBarRenderer.

Definition at line 25 of file qgsnumericscalebarrenderer.cpp.

◆ sortKey()

int QgsNumericScaleBarRenderer::sortKey ( ) const
overridevirtual

Returns a sorting key value, where renderers with a lower sort key will be shown earlier in lists.

Generally, subclasses should return QgsScaleBarRenderer::sortKey() as their sorting key.

Reimplemented from QgsScaleBarRenderer.

Definition at line 35 of file qgsnumericscalebarrenderer.cpp.

◆ visibleName()

QString QgsNumericScaleBarRenderer::visibleName ( ) const
overridevirtual

Returns the user friendly, translated name for the renderer.

Since
QGIS 3.14

Implements QgsScaleBarRenderer.

Definition at line 30 of file qgsnumericscalebarrenderer.cpp.


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