]> git.openstreetmap.org Git - rails.git/blobdiff - app/assets/javascripts/routing_engines/graphhopper.js
Merge pull request #19 from apmon/jsroute2
[rails.git] / app / assets / javascripts / routing_engines / graphhopper.js
index 5e14ea0dfc8f2e3040d2b1fed672844d305f14a6..0f29c162b8ffe57da6ed290aef3577da15159560 100644 (file)
@@ -1,6 +1,7 @@
 GraphHopperEngine = function(vehicleName, vehicleParam, locale) {
     this.vehicleName = vehicleName;
     this.vehicleParam = vehicleParam;
+    //At this point the local system isn't correctly initialised yet, so we don't have accurate information about current locale
     this.locale = locale;
     if (!locale)
         this.locale = "en";
@@ -10,12 +11,13 @@ GraphHopperEngine.prototype.createConfig = function() {
     var that = this;
     return {
         name: "javascripts.directions.engines.graphhopper_"+this.vehicleName.toLowerCase(),
+            creditline: '<a href="http://graphhopper.com/" target="_blank">Graphhopper</a>',
         draggable: false,
         _hints: {},
         getRoute: function(isFinal, points) {
             var url = "http://graphhopper.com/routing/api/route?" 
                     + that.vehicleParam 
-                    + "&locale=" + that.locale;
+                    + "&locale=" + I18n.currentLocale();
             for (var i = 0; i < points.length; i++) {
                 var pair = points[i].join(',');
                 url += "&point=" + pair;
@@ -59,5 +61,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());