time management improvements for routing tool
This commit is contained in:
parent
61c6a29d64
commit
d7c756e471
2 changed files with 5 additions and 1 deletions
|
@ -682,7 +682,7 @@ export class TrackSegment extends GPXTreeLeaf {
|
||||||
const time = (points[i].time.getTime() - points[i - 1].time.getTime()) / 1000;
|
const time = (points[i].time.getTime() - points[i - 1].time.getTime()) / 1000;
|
||||||
speed = dist / (time / 3600);
|
speed = dist / (time / 3600);
|
||||||
|
|
||||||
if (speed >= 0.5) {
|
if (speed >= 0.5 && speed <= 1500) {
|
||||||
statistics.global.distance.moving += dist;
|
statistics.global.distance.moving += dist;
|
||||||
statistics.global.time.moving += time;
|
statistics.global.time.moving += time;
|
||||||
}
|
}
|
||||||
|
|
|
@ -569,6 +569,10 @@ export class RoutingControls {
|
||||||
let remainingTime = stats.global.time.moving - (stats.local.time.moving[anchors[anchors.length - 1].point._data.index] - stats.local.time.moving[anchors[0].point._data.index]);
|
let remainingTime = stats.global.time.moving - (stats.local.time.moving[anchors[anchors.length - 1].point._data.index] - stats.local.time.moving[anchors[0].point._data.index]);
|
||||||
let replacingTime = newTime - remainingTime;
|
let replacingTime = newTime - remainingTime;
|
||||||
|
|
||||||
|
if (replacingTime <= 0) { // Fallback to simple time difference
|
||||||
|
replacingTime = stats.local.time.total[anchors[anchors.length - 1].point._data.index] - stats.local.time.total[anchors[0].point._data.index];
|
||||||
|
}
|
||||||
|
|
||||||
speed = replacingDistance / replacingTime * 3600;
|
speed = replacingDistance / replacingTime * 3600;
|
||||||
|
|
||||||
if (startTime === undefined) { // Replacing the first point
|
if (startTime === undefined) { // Replacing the first point
|
||||||
|
|
Loading…
Reference in a new issue