Really place annotations in RouteLeg and not Route

This commit is contained in:
Patrick Niklaus
2016-05-27 00:39:46 +02:00
parent 451a0d9090
commit d6de2ca71c
5 changed files with 42 additions and 20 deletions
+11 -7
View File
@@ -1,3 +1,5 @@
'use strict';
var Timeout = require('node-timeout');
var request = require('request');
@@ -141,14 +143,16 @@ module.exports = function () {
return this.extractInstructionList(instructions, s => s.maneuver.bearing_before + '->' + s.maneuver.bearing_after);
};
this.annotationList = (instructions) => {
// Pull out all the distinct segment distances, skipping the arrive
// instructions, and the leading 0 on all timestamps arrays.
var pairs = [];
for (var i in instructions.annotation.duration) {
pairs.push(instructions.annotation.duration[i]+':'+instructions.annotation.distance[i]);
this.annotationList = (matching) => {
function zip(list_1, list_2)
{
let pairs = [];
for (let i = 0; i < list_1.length; ++i) {
pairs.push([list_1[i], list_2[i]]);
}
return pairs;
}
return pairs.join(',');
return matching.legs.map(l => {return zip(l.annotation.duration, l.annotation.distance).map(p => { return p.join(':'); }).join(','); }).join(',');
};
this.turnList = (instructions) => {