[Marble-bugs] [marble] [Bug 324858] Scale bar displays nonlinear integer values.

Tom Hardy rhardy702 at gmail.com
Thu Nov 14 18:29:22 UTC 2013


https://bugs.kde.org/show_bug.cgi?id=324858

--- Comment #1 from Tom Hardy <rhardy702 at gmail.com> ---
OK, this applies when using miles for distance units, and appears to be a
problem with truncation to single digit miles where single digits aren't
enough.

If so, a patch something like this might work:

diff --git a/src/plugins/render/mapscale/MapScaleFloatItem.cpp
b/src/plugins/render/mapscale/MapScaleFloatItem.cpp
index bac707c..bcd90e5 100644
--- a/src/plugins/render/mapscale/MapScaleFloatItem.cpp
+++ b/src/plugins/render/mapscale/MapScaleFloatItem.cpp
@@ -262,7 +262,7 @@ void MapScaleFloatItem::paintContent( QPainter *painter )
             unit = tr("mi");
             intervalStr.setNum( j * m_valueInterval / 1000 );

-            if ( m_bestDivisor * m_valueInterval > 3800 ) {
+            if ( m_bestDivisor * m_valueInterval >= 10000 ) {
                 intervalStr.setNum( j * m_valueInterval / 1000 );
             }
             else {
The trouble is, I don't really understand the code.  For instance,
m_bestDivisor * m_valueInterval as shown above clearly represents a distance in
units of meters throughout the code, but the map scale behaves as if units are
miles/1000 in the above.  That is, the scale uses an int if the scale is longer
than 3.8 miles, and a qreal if it is less.

(And I don't know what a qreal is, anyway; I don't know QT.  (But I am finally
looking at c++.))

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the Marble-bugs mailing list