[Marble-bugs] [marble] [Bug 341275] New: Elevation profile float scale display and data display don't match

Ryan somebodyelse007007 at gmail.com
Wed Nov 26 06:43:16 UTC 2014


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

            Bug ID: 341275
           Summary: Elevation profile float scale display and data display
                    don't match
           Product: marble
           Version: 1.9 (KDE 4.14)
          Platform: MS Windows
                OS: MS Windows
            Status: UNCONFIRMED
          Severity: normal
          Priority: NOR
         Component: general
          Assignee: marble-bugs at kde.org
          Reporter: somebodyelse007007 at gmail.com

I created (in code) a track that had elevation data that ranges from 0 to 35
metres. The Y-axis of the graph auto-scaled to 10 metre increments, yet the
peak of the graph data (at 35 metres) matched with the 30-metre y-axis
increment. It should have been half-way between the 30-metre and 40-metre
increments.

Part of the problem is the position of the axis ticks are generated with
integer operations which lead to errors that are cumulative, so the
larger-value ticks are more wrong than the smaller-value ones.

Using Marble Library version 0.19.20 (0.20 alpha)


Reproducible: Always




The following code changes fix the problem:

ElevationProfileFloatItem.cpp (line 238):
    const int posY = m_eleGraphHeight - tick.position;
becomes
    const int posY = m_eleGraphHeight - tick.position / m_shrinkFactorY;

ElevationProfilePlotAxis.cpp (lines 122-132):
    qreal val = m_minValue + offset;
    int pos = m_pixelLength / range() * offset;
    m_ticks << AxisTick( pos, val );
    while( val < m_maxValue ) {
        val += stepWidth;
        pos += m_pixelLength / range() * stepWidth;
        if ( pos > m_pixelLength ) {
            break;
        }
        m_ticks << AxisTick( pos, val );
    }
becomes
    qreal val = m_minValue + offset;
    qreal pos = m_pixelLength / range() * offset;
    m_ticks << AxisTick( qRound(pos), val );
    while( val < m_maxValue ) {
        val += stepWidth;
        pos += m_pixelLength / range() * stepWidth;
        if ( pos > m_pixelLength ) {
            break;
        }
        m_ticks << AxisTick( qRound(pos), val );
    }

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


More information about the Marble-bugs mailing list