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,20 +88,35 @@ 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()) {
|
||||||
|
if (sd.at(j).timestamp() > sd.at(j-1).timestamp())
|
||||||
dt = sd.at(j-1).timestamp().msecsTo(
|
dt = sd.at(j-1).timestamp().msecsTo(
|
||||||
sd.at(j).timestamp()) / 1000.0;
|
sd.at(j).timestamp()) / 1000.0;
|
||||||
else {
|
else {
|
||||||
qWarning("%s: %s: time skew detected", qPrintable(_data.name()),
|
qWarning("%s: %s: time skew detected", qPrintable(
|
||||||
qPrintable(sd.at(j).timestamp().toString(Qt::ISODate)));
|
_data.name()), qPrintable(sd.at(j).timestamp().toString(
|
||||||
|
Qt::ISODate)));
|
||||||
dt = 0;
|
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);
|
||||||
|
|
||||||
if (dt < 1e-3) {
|
if (dt < 1e-3) {
|
||||||
@ -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