60 && cur.speed < 0.5) || cur.speed === null) {
d[0].data[i] = null;
d[1].data[i] = null;
}
d[0].data[i] = [cur.timestamp*1000, d[0].data[i]];
d[1].data[i] = [cur.timestamp*1000, d[1].data[i]];
}
let opts = plot.getXAxes()[0].options;
opts.panRange = [
gps.data[0].timestamp*1000,
gps.data[gps.data.length-1].timestamp*1000
];
plot.setData(d);
plot.setupGrid(); //only necessary if your new data will change the axes or grid
plot.draw();
overview.setData(d);
overview.setupGrid(); //only necessary if your new data will change the axes or grid
overview.draw();
for(let t of gps.trips) {
$("#tracks").append(``);
}
}
$("#shadow").css("visibility", "visible");
$("#frame").css("visibility", "visible");
console.log(id);
let start = gps.trips[id].startTime*1000;
let end = gps.trips[id].endTime*1000;
setZoom(start,end);
$("#track").click(function () {
setZoom(start,end);
});
};
function hide() {
$(".popup").css("visibility", "hidden");
};
function setZoom(Xmin, Xmax) {
var opts = plot.getXAxes()[0].options;
if(Xmax==false) {
Xmax = +new Date() - 60 * new Date().getTimezoneOffset() * 1000;
}
if(Xmin==false) {
Xmin = d[0].data[0][0];
overview.clearSelection();
} else {
overview.setSelection({ xaxis: { from: Xmin, to: Xmax}});
}
opts.min=Xmin;
opts.max=Xmax;
plot.setupGrid();
plot.draw();
plot.clearSelection();
return false;
}
function addInfo(bingMapsProvider, viewer, id, data) {
$('.sidebar').append(`` +
timeFormat(data.timestamp, "short") + "
" +
data.name + "
" +
(data.distance/1000).toFixed(1) + " km
");
$('#info_'+id).click(function() {
viewer.camera.flyTo({
destination: Cesium.Cartesian3.fromDegrees(data.lng, data.lat, data.distance),
offset: new Cesium.HeadingPitchRange(0, -90, 0)
});
});
}