mirror of
https://github.com/tumic0/GPXSee.git
synced 2024-11-24 11:45:53 +01:00
Be more strict when handling tracks with missing timestamps
This commit is contained in:
parent
725bb8a381
commit
41ebe8aec7
@ -88,19 +88,34 @@ Track::Track(const TrackData &data) : _data(data), _pause(0)
|
|||||||
sd.first().hasTimestamp() ? 0 : NAN);
|
sd.first().hasTimestamp() ? 0 : NAN);
|
||||||
seg.speed.append(sd.first().hasTimestamp() ? 0 : NAN);
|
seg.speed.append(sd.first().hasTimestamp() ? 0 : NAN);
|
||||||
acceleration.append(sd.first().hasTimestamp() ? 0 : NAN);
|
acceleration.append(sd.first().hasTimestamp() ? 0 : NAN);
|
||||||
|
bool hasTime = !std::isnan(seg.time.first());
|
||||||
|
|
||||||
for (int j = 1; j < sd.size(); j++) {
|
for (int j = 1; j < sd.size(); j++) {
|
||||||
ds = sd.at(j).coordinates().distanceTo(
|
ds = sd.at(j).coordinates().distanceTo(
|
||||||
sd.at(j-1).coordinates());
|
sd.at(j-1).coordinates());
|
||||||
seg.distance.append(seg.distance.last() + ds);
|
seg.distance.append(seg.distance.last() + ds);
|
||||||
|
|
||||||
if (sd.at(j).timestamp() >= sd.at(j-1).timestamp())
|
if (hasTime && sd.at(j).timestamp().isValid()) {
|
||||||
dt = sd.at(j-1).timestamp().msecsTo(
|
if (sd.at(j).timestamp() > sd.at(j-1).timestamp())
|
||||||
sd.at(j).timestamp()) / 1000.0;
|
dt = sd.at(j-1).timestamp().msecsTo(
|
||||||
else {
|
sd.at(j).timestamp()) / 1000.0;
|
||||||
qWarning("%s: %s: time skew detected", qPrintable(_data.name()),
|
else {
|
||||||
qPrintable(sd.at(j).timestamp().toString(Qt::ISODate)));
|
qWarning("%s: %s: time skew detected", qPrintable(
|
||||||
dt = 0;
|
_data.name()), qPrintable(sd.at(j).timestamp().toString(
|
||||||
|
Qt::ISODate)));
|
||||||
|
dt = 0;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
dt = NAN;
|
||||||
|
if (hasTime) {
|
||||||
|
qWarning("%s: missing timestamp(s), time graphs disabled",
|
||||||
|
qPrintable(_data.name()));
|
||||||
|
hasTime = false;
|
||||||
|
for (int i = 0; i < seg.time.size(); i++)
|
||||||
|
seg.time[i] = NAN;
|
||||||
|
for (int i = 0; i < seg.speed.size(); i++)
|
||||||
|
seg.speed[i] = NAN;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
seg.time.append(seg.time.last() + dt);
|
seg.time.append(seg.time.last() + dt);
|
||||||
|
|
||||||
@ -125,7 +140,7 @@ Track::Track(const TrackData &data) : _data(data), _pause(0)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_outlierEliminate)
|
if (!_outlierEliminate || !hasTime)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user