| Summary: | Elevation profile float scale display and data display don't match | ||
|---|---|---|---|
| Product: | [Applications] marble | Reporter: | Ryan <somebodyelse007007> |
| Component: | general | Assignee: | marble-bugs |
| Status: | REPORTED --- | ||
| Severity: | normal | ||
| Priority: | NOR | ||
| Version First Reported In: | 1.9 (KDE 4.14) | ||
| Target Milestone: | --- | ||
| Platform: | Microsoft Windows | ||
| OS: | Microsoft Windows | ||
| Latest Commit: | Version Fixed/Implemented In: | ||
| Sentry Crash Report: | |||
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. |
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 ); }