Bug 341275 - Elevation profile float scale display and data display don't match
Summary: Elevation profile float scale display and data display don't match
Status: REPORTED
Alias: None
Product: marble
Classification: Applications
Component: general (show other bugs)
Version: 1.9 (KDE 4.14)
Platform: Microsoft Windows Microsoft Windows
: NOR normal
Target Milestone: ---
Assignee: marble-bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-11-26 06:43 UTC by Ryan
Modified: 2021-03-09 22:51 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ryan 2014-11-26 06:43:16 UTC
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 );
    }
Comment 1 Justin Zobel 2021-03-09 22:51:30 UTC
Thank you for the bug report.

As this report hasn't seen any changes in 5 years or more, we ask if you can please confirm that the issue still persists.

If this bug is no longer persisting or relevant please change the status to resolved.