mirror of
https://github.com/tumic0/GPXSee.git
synced 2025-02-26 04:00:49 +01:00
Fixed broken gear ratio statistics
This commit is contained in:
parent
3ad0c89511
commit
a70c6f0f24
@ -7,16 +7,11 @@
|
|||||||
GearRatioGraphItem::GearRatioGraphItem(const Graph &graph, GraphType type,
|
GearRatioGraphItem::GearRatioGraphItem(const Graph &graph, GraphType type,
|
||||||
QGraphicsItem *parent) : GraphItem(graph, type, parent), _top(NAN)
|
QGraphicsItem *parent) : GraphItem(graph, type, parent), _top(NAN)
|
||||||
{
|
{
|
||||||
qreal val = NAN;
|
for (int i = 0; i < graph.size(); i++) {
|
||||||
|
const GraphSegment &segment = graph.at(i);
|
||||||
for (QMap<qreal, qreal>::const_iterator it = _map.constBegin();
|
for (int j = 1; j < segment.size(); j++) {
|
||||||
it != _map.constEnd(); ++it) {
|
qreal dx = segment.at(j).s() - segment.at(j-1).s();
|
||||||
if (it == _map.constBegin()) {
|
_map.insert(segment.at(j).y(), _map.value(segment.at(j).y()) + dx);
|
||||||
val = it.value();
|
|
||||||
_top = it.key();
|
|
||||||
} else if (it.value() > val) {
|
|
||||||
val = it.value();
|
|
||||||
_top = it.key();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user