20 #include <QFontMetricsF>
28 QgsScaleBarStyle::QgsScaleBarStyle(): mScaleBar( 0 )
54 QList<QPair<double, double> > segmentInfo;
57 double currentLabelNumber = 0.0;
60 int segmentCounter = 0;
61 QString currentNumericLabel;
63 QList<QPair<double, double> >::const_iterator segmentIt = segmentInfo.constBegin();
64 for ( ; segmentIt != segmentInfo.constEnd(); ++segmentIt )
66 if ( segmentCounter == 0 && nSegmentsLeft > 0 )
69 currentNumericLabel = firstLabel;
71 else if ( segmentCounter != 0 && segmentCounter == nSegmentsLeft )
73 currentLabelNumber = 0;
76 if ( segmentCounter >= nSegmentsLeft )
81 if ( segmentCounter == 0 || segmentCounter >= nSegmentsLeft )
87 if ( segmentCounter >= nSegmentsLeft )
95 if ( !segmentInfo.isEmpty() )
118 QString largestNumberLabel = QString::number( largestLabelNumber );
122 double totalBarLength = 0.0;
124 QList< QPair<double, double> > segmentList;
127 QList< QPair<double, double> >::const_iterator segmentIt = segmentList.constBegin();
128 for ( ; segmentIt != segmentList.constEnd(); ++segmentIt )
130 totalBarLength += segmentIt->second;