QGIS API Documentation
2.2.0-Valmiera
|
A scale bar style that draws text in the form of '1:XXXXX'. More...
#include <qgsnumericscalebarstyle.h>
Public Member Functions | |
QgsNumericScaleBarStyle (QgsComposerScaleBar *bar) | |
~QgsNumericScaleBarStyle () | |
QString | name () const |
void | draw (QPainter *p, double xOffset=0) const |
Draws the style. | |
QRectF | calculateBoxSize () const |
Public Member Functions inherited from QgsScaleBarStyle | |
QgsScaleBarStyle (const QgsComposerScaleBar *bar) | |
virtual | ~QgsScaleBarStyle () |
virtual void | drawLabels (QPainter *p) const |
Private Member Functions | |
QgsNumericScaleBarStyle () | |
QString | scaleText () const |
Returns the text for the scale bar or an empty string in case of error. |
Private Attributes | |
double | mLastScaleBarWidth |
Store last width (in mm) to keep alignment to left/middle/right side. |
Additional Inherited Members | |
Protected Attributes inherited from QgsScaleBarStyle | |
const QgsComposerScaleBar * | mScaleBar |
A scale bar style that draws text in the form of '1:XXXXX'.
Definition at line 25 of file qgsnumericscalebarstyle.h.
QgsNumericScaleBarStyle::QgsNumericScaleBarStyle | ( | QgsComposerScaleBar * | bar | ) |
Definition at line 23 of file qgsnumericscalebarstyle.cpp.
QgsNumericScaleBarStyle::~QgsNumericScaleBarStyle | ( | ) |
Definition at line 33 of file qgsnumericscalebarstyle.cpp.
|
private |
Definition at line 28 of file qgsnumericscalebarstyle.cpp.
|
virtual |
Reimplemented from QgsScaleBarStyle.
Definition at line 86 of file qgsnumericscalebarstyle.cpp.
References QgsComposerScaleBar::boxContentSpace(), QgsComposerScaleBar::font(), QgsComposerItem::fontAscentMillimeters(), mLastScaleBarWidth, QgsScaleBarStyle::mScaleBar, QgsComposerScaleBar::pen(), scaleText(), and QgsComposerItem::textWidthMillimeters().
|
virtual |
Draws the style.
p | painter object |
xOffset | offset to account for centered labeling |
Implements QgsScaleBarStyle.
Definition at line 43 of file qgsnumericscalebarstyle.cpp.
References QgsComposerScaleBar::alignment(), QgsComposerScaleBar::boxContentSpace(), QgsComposerItem::drawText(), QgsComposerScaleBar::font(), QgsComposerScaleBar::fontColor(), QgsComposerScaleBar::height(), QgsComposerScaleBar::Left, QgsComposerScaleBar::Middle, QgsScaleBarStyle::mScaleBar, QgsComposerScaleBar::Right, and scaleText().
|
virtual |
Implements QgsScaleBarStyle.
Definition at line 38 of file qgsnumericscalebarstyle.cpp.
|
private |
Returns the text for the scale bar or an empty string in case of error.
Definition at line 110 of file qgsnumericscalebarstyle.cpp.
References QgsComposerScaleBar::composerMap(), QgsScaleBarStyle::mScaleBar, and QgsComposerMap::scale().
Referenced by calculateBoxSize(), and draw().
|
mutableprivate |
Store last width (in mm) to keep alignment to left/middle/right side.
Definition at line 44 of file qgsnumericscalebarstyle.h.
Referenced by calculateBoxSize().