1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-12-01 07:01:16 +01:00

Only ignore invalid segments, do not invalidate the whole track

This commit is contained in:
Martin Tůma 2019-02-13 00:33:00 +01:00
parent cd74b0d43e
commit 143f53fbd9

View File

@ -169,6 +169,8 @@ Graph Track::elevation() const
for (int i = 0; i < _data.size(); i++) { for (int i = 0; i < _data.size(); i++) {
const SegmentData &sd = _data.at(i); const SegmentData &sd = _data.at(i);
if (sd.size() < 2)
continue;
const Segment &seg = _segments.at(i); const Segment &seg = _segments.at(i);
GraphSegment gs; GraphSegment gs;
@ -202,6 +204,8 @@ Graph Track::speed() const
for (int i = 0; i < _data.size(); i++) { for (int i = 0; i < _data.size(); i++) {
const SegmentData &sd = _data.at(i); const SegmentData &sd = _data.at(i);
if (sd.size() < 2)
continue;
const Segment &seg = _segments.at(i); const Segment &seg = _segments.at(i);
GraphSegment gs; GraphSegment gs;
QList<int> stop; QList<int> stop;
@ -239,6 +243,8 @@ Graph Track::heartRate() const
for (int i = 0; i < _data.size(); i++) { for (int i = 0; i < _data.size(); i++) {
const SegmentData &sd = _data.at(i); const SegmentData &sd = _data.at(i);
if (sd.size() < 2)
continue;
const Segment &seg = _segments.at(i); const Segment &seg = _segments.at(i);
GraphSegment gs; GraphSegment gs;
@ -259,6 +265,8 @@ Graph Track::temperature() const
for (int i = 0; i < _data.size(); i++) { for (int i = 0; i < _data.size(); i++) {
const SegmentData &sd = _data.at(i); const SegmentData &sd = _data.at(i);
if (sd.size() < 2)
continue;
const Segment &seg = _segments.at(i); const Segment &seg = _segments.at(i);
GraphSegment gs; GraphSegment gs;
@ -280,6 +288,8 @@ Graph Track::ratio() const
for (int i = 0; i < _data.size(); i++) { for (int i = 0; i < _data.size(); i++) {
const SegmentData &sd = _data.at(i); const SegmentData &sd = _data.at(i);
if (sd.size() < 2)
continue;
const Segment &seg = _segments.at(i); const Segment &seg = _segments.at(i);
GraphSegment gs; GraphSegment gs;
@ -300,6 +310,8 @@ Graph Track::cadence() const
for (int i = 0; i < _data.size(); i++) { for (int i = 0; i < _data.size(); i++) {
const SegmentData &sd = _data.at(i); const SegmentData &sd = _data.at(i);
if (sd.size() < 2)
continue;
const Segment &seg = _segments.at(i); const Segment &seg = _segments.at(i);
GraphSegment gs; GraphSegment gs;
QList<int> stop; QList<int> stop;
@ -335,16 +347,18 @@ Graph Track::power() const
for (int i = 0; i < _data.size(); i++) { for (int i = 0; i < _data.size(); i++) {
const SegmentData &segment = _data.at(i); const SegmentData &sd = _data.at(i);
if (sd.size() < 2)
continue;
const Segment &seg = _segments.at(i); const Segment &seg = _segments.at(i);
GraphSegment gs; GraphSegment gs;
for (int j = 0; j < segment.size(); j++) { for (int j = 0; j < sd.size(); j++) {
if (segment.at(j).hasPower() && seg.stop.contains(j)) { if (sd.at(j).hasPower() && seg.stop.contains(j)) {
p = 0; p = 0;
stop.append(gs.size()); stop.append(gs.size());
} else if (segment.at(j).hasPower() && !seg.outliers.contains(j)) } else if (sd.at(j).hasPower() && !seg.outliers.contains(j))
p = segment.at(j).power(); p = sd.at(j).power();
else else
continue; continue;
@ -404,6 +418,8 @@ Path Track::path() const
for (int i = 0; i < _data.size(); i++) { for (int i = 0; i < _data.size(); i++) {
const SegmentData &sd = _data.at(i); const SegmentData &sd = _data.at(i);
if (sd.size() < 2)
continue;
const Segment &seg = _segments.at(i); const Segment &seg = _segments.at(i);
ret.append(PathSegment()); ret.append(PathSegment());
PathSegment &ps = ret.last(); PathSegment &ps = ret.last();
@ -425,10 +441,8 @@ bool Track::discardStopPoint(const Segment &seg, int i) const
bool Track::isValid() const bool Track::isValid() const
{ {
if (_data.isEmpty())
return false;
for (int i = 0; i < _data.size(); i++) for (int i = 0; i < _data.size(); i++)
if (_data.at(i).size() < 2) if (_data.at(i).size() >= 2)
return false;
return true; return true;
return false;
} }