41 return "Line Ticks Up";
43 return "Line Ticks Down";
45 return "Line Ticks Middle";
63 QList<QPair<double, double> > segmentInfo;
66 QList<QPair<double, double> >::const_iterator segmentIt = segmentInfo.constBegin();
67 for ( ; segmentIt != segmentInfo.constEnd(); ++segmentIt )
69 p->drawLine( segmentIt->first + xOffset, barTopPosition, segmentIt->first + xOffset, barTopPosition +
mScaleBar->
height() );
73 p->drawLine( xOffset + segmentIt->first, barTopPosition, xOffset + segmentIt->first +
mScaleBar->
segmentMillimeters(), barTopPosition );
76 p->drawLine( xOffset + segmentIt->first, middlePosition, xOffset + segmentIt->first +
mScaleBar->
segmentMillimeters(), middlePosition );
79 p->drawLine( xOffset + segmentIt->first, bottomPosition, xOffset + segmentIt->first +
mScaleBar->
segmentMillimeters(), bottomPosition );
85 if ( !segmentInfo.isEmpty() )
88 p->drawLine( lastTickPositionX + xOffset, barTopPosition, lastTickPositionX + xOffset, 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 segmentPositions(QList< QPair< double, double > > &posWidthList) const
Returns the x - positions of the segment borders (in item coordinates) and the width of the segment...
void draw(QPainter *p, double xOffset=0) const
double labelBarSpace() const
double segmentMillimeters() const
Abstraction of composer scale bar style.
const QgsComposerScaleBar * mScaleBar
TickPosition mTickPosition
double fontAscentMillimeters(const QFont &font) const
Returns the font ascent in Millimeters (considers upscaling and downscaling with FONT_WORKAROUND_SCAL...