]> git.openstreetmap.org Git - rails.git/blobdiff - app/assets/javascripts/routing_engines/graphhopper.js
Don't show http-only routers to users on https
[rails.git] / app / assets / javascripts / routing_engines / graphhopper.js
index 9762c0fe4f0eb62c1cc25422d6479bb977979be0..6d83e26e2839b721454cd9722caf2352556105af 100644 (file)
@@ -42,9 +42,9 @@ GraphHopperEngine.prototype.createConfig = function() {
                 instrText += instr.descriptions[i];
                 var latlng = instr.latLngs[i];
                 var distInMeter = instr.distances[i];
-                steps.push([{lat: latlng[0], lng: latlng[1]}, instrCode, instrText, distInMeter]);
+                steps.push([{lat: latlng[0], lng: latlng[1]}, instrCode, instrText, distInMeter, []]); // TODO does graphhopper map instructions onto line indices?
             }
-            router.setItinerary({steps: steps});
+            router.setItinerary({ steps: steps, distance: data.route.distance, time: data.route['time']/1000 });
             return true;
         },
         GH_INSTR_MAP: {
@@ -59,5 +59,5 @@ GraphHopperEngine.prototype.createConfig = function() {
     };
 };
 
-OSM.RoutingEngines.list.push(new GraphHopperEngine("Bicycle", "vehicle=bike").createConfig());
-OSM.RoutingEngines.list.push(new GraphHopperEngine("Foot", "vehicle=foot").createConfig());
+OSM.RoutingEngines.add(false, new GraphHopperEngine("Bicycle", "vehicle=bike").createConfig());
+OSM.RoutingEngines.add(false, new GraphHopperEngine("Foot", "vehicle=foot").createConfig());