update other libs

This commit is contained in:
Norbert Renner 2014-05-14 16:01:20 +02:00
parent e4ae9b5533
commit aa1e051cfd
31 changed files with 679 additions and 719 deletions

View file

@ -1,4 +1,4 @@
//#include "GPX.js"
//#include 'GPX.js'
(function() {
@ -6,7 +6,7 @@ function d2h(d) {
var hex = '0123456789ABCDEF';
var r = '';
d = Math.floor(d);
while (d != 0) {
while (d !== 0) {
r = hex[d % 16] + r;
d = Math.floor(d / 16);
}
@ -18,23 +18,23 @@ function gradient(color) {
// First arc (0, PI) in HSV colorspace
function f2h(d) { return d2h(256 * d); }
if (color < 0)
return "#FF0000";
return '#FF0000';
else if (color < 1.0/3)
return "#FF" + f2h(3 * color) + "00";
return '#FF' + f2h(3 * color) + '00';
else if (color < 2.0/3)
return "#" + f2h(2 - 3 * color) + "FF00";
return '#' + f2h(2 - 3 * color) + 'FF00';
else if (color < 1)
return "#00FF" + f2h(3 * color - 2);
return '#00FF' + f2h(3 * color - 2);
else
return "#00FFFF";
};
return '#00FFFF';
}
function gpx2time(s) {
// 2011-09-24T12:07:53Z
if (s.length != 10 + 1 + 8 + 1)
if (s.length !== 10 + 1 + 8 + 1)
return new Date();
return new Date(s);
};
}
L.GPX.include({
options: {
@ -68,11 +68,11 @@ L.GPX.include({
p = ll[i + chunk - 1];
t = (gpx2time(p.meta.time) - t) / (3600 * 1000);
var speed = 0.001 * d / t;
//console.info('Dist: ' + d + "; Speed: " + speed);
//console.info('Dist: ' + d + '; Speed: ' + speed);
var color = gradient(speed / this.options.maxSpeed);
var l = new L.Polyline(ll.slice(i, i+chunk+1), {color: color, weight: 2, opacity: 1});
l.bindPopup('Dist: ' + d.toFixed() + "m; Speed: " + speed.toFixed(2) + " km/h");
e.line.push(l);
var poly = new L.Polyline(ll.slice(i, i+chunk+1), {color: color, weight: 2, opacity: 1});
poly.bindPopup('Dist: ' + d.toFixed() + 'm; Speed: ' + speed.toFixed(2) + ' km/h');
e.line.push(poly);
}
}