39 switch ( mTickPosition )
42 return "Line Ticks Up";
44 return "Line Ticks Down";
46 return "Line Ticks Middle";
63 p->setRenderHint( QPainter::Antialiasing,
true );
66 QList<QPair<double, double> > segmentInfo;
69 QList<QPair<double, double> >::const_iterator segmentIt = segmentInfo.constBegin();
70 for ( ; segmentIt != segmentInfo.constEnd(); ++segmentIt )
72 p->drawLine( QLineF( segmentIt->first + xOffset, barTopPosition, segmentIt->first + xOffset, barTopPosition +
mScaleBar->
height() ) );
76 if ( !segmentInfo.isEmpty() )
80 switch ( mTickPosition )
83 verticalPos = barTopPosition;
86 verticalPos = middlePosition;
89 verticalPos = bottomPosition;
93 p->drawLine( QLineF( xOffset + segmentInfo.at( 0 ).first, verticalPos, lastTickPositionX, verticalPos ) );
95 p->drawLine( QLineF( lastTickPositionX, barTopPosition, lastTickPositionX, barTopPosition +
mScaleBar->
height() ) );
A scale bar item that can be added to a map composition.
virtual void drawLabels(QPainter *p) const
double boxContentSpace() const
void draw(QPainter *p, double xOffset=0) const override
void segmentPositions(QList< QPair< double, double > > &posWidthList) const
Returns the x - positions of the segment borders (in item coordinates) and the width of the segment...
static double fontAscentMM(const QFont &font)
Calculate font ascent in millimeters, including workarounds for QT font rendering issues...
double labelBarSpace() const
QString name() const override
double segmentMillimeters() const
Abstraction of composer scale bar style.
QgsTicksScaleBarStyle(const QgsComposerScaleBar *bar)
QPen pen() const
Returns the pen used for drawing the scalebar.
const QgsComposerScaleBar * mScaleBar