1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-10-06 14:53:21 +02:00

Fixed broken gear ratio statistics

This commit is contained in:
Martin Tůma 2019-08-22 19:56:55 +02:00
parent 3ad0c89511
commit a70c6f0f24

View File

@ -7,16 +7,11 @@
GearRatioGraphItem::GearRatioGraphItem(const Graph &graph, GraphType type,
QGraphicsItem *parent) : GraphItem(graph, type, parent), _top(NAN)
{
qreal val = NAN;
for (QMap<qreal, qreal>::const_iterator it = _map.constBegin();
it != _map.constEnd(); ++it) {
if (it == _map.constBegin()) {
val = it.value();
_top = it.key();
} else if (it.value() > val) {
val = it.value();
_top = it.key();
for (int i = 0; i < graph.size(); i++) {
const GraphSegment &segment = graph.at(i);
for (int j = 1; j < segment.size(); j++) {
qreal dx = segment.at(j).s() - segment.at(j-1).s();
_map.insert(segment.at(j).y(), _map.value(segment.at(j).y()) + dx);
}
}