diff --git a/WebContent/OSRM.config.js b/WebContent/OSRM.config.js index eb15d60f6..7ee95c4a2 100644 --- a/WebContent/OSRM.config.js +++ b/WebContent/OSRM.config.js @@ -19,7 +19,7 @@ or see http://www.gnu.org/licenses/agpl.txt. // [has to be loaded directly after OSRM.base] OSRM.DEFAULTS = { - HOST_ROUTING_URL: 'http://router.project-osrm.org/viaroute', + HOST_ROUTING_URL: ['http://router.project-osrm.org/viaroute'], HOST_SHORTENER_URL: 'http://map.project-osrm.org/shorten/', HOST_TIMESTAMP_URL: 'http://router.project-osrm.org/timestamp', HOST_GEOCODER_URL: 'http://nominatim.openstreetmap.org/search', diff --git a/WebContent/base/OSRM.HistoryRoutes.js b/WebContent/base/OSRM.HistoryRoutes.js index b50f6ad4c..32ed45cdb 100644 --- a/WebContent/base/OSRM.HistoryRoutes.js +++ b/WebContent/base/OSRM.HistoryRoutes.js @@ -169,7 +169,7 @@ OSRM.extend( OSRM.HistoryRoute,{ } }, _buildCall: function(history_id) { - var source = OSRM.DEFAULTS.HOST_ROUTING_URL; + var source = OSRM.G.active_routing_server_url; source += '?z=' + OSRM.G.map.getZoom() + '&output=json&jsonp=%jsonp'; if(this._history[history_id].checksum) @@ -190,4 +190,4 @@ OSRM.extend( OSRM.HistoryRoute,{ for(var i=0; i=OSRM.DEFAULTS.HOST_ROUTING_URL.length) + return; + params.active_routing_engine = active_routing_engine; + } + else if(name_val[0] == 'rm') { + var active_routing_metric = Number(name_val[1]); + if( active_routing_metric<0 ) + return; + params.active_routing_metric = active_routing_metric; + } } // case 1: destination given @@ -283,6 +295,11 @@ OSRM.parseParameters = function(){ // set active alternative (if via points are set or alternative does not exists: automatic fallback to shortest route) OSRM.G.active_alternative = params.active_alternative || 0; + + // set routing server + OSRM.G.active_routing_engine = params.active_routing_engine || 0; + OSRM.G.active_routing_metric = params.active_routing_metric || 0; + OSRM.G.active_routing_server_url = OSRM.DEFAULTS.HOST_ROUTING_URL[ OSRM.G.active_routing_engine ]; // compute route OSRM.Routing.getRoute({keepAlternative:true}); diff --git a/WebContent/routing/OSRM.Routing.js b/WebContent/routing/OSRM.Routing.js index 88b363bf4..aabffb9f0 100644 --- a/WebContent/routing/OSRM.Routing.js +++ b/WebContent/routing/OSRM.Routing.js @@ -31,6 +31,9 @@ OSRM.Routing = { // init routing data structures init: function() { + OSRM.G.active_routing_engine = 0; + OSRM.G.active_routing_metric = 0; + OSRM.G.active_routing_server_url = OSRM.DEFAULTS.HOST_ROUTING_URL[ OSRM.G.active_routing_engine ]; OSRM.G.markers = new OSRM.Markers(); OSRM.G.route = new OSRM.Route(); OSRM.G.response = { via_points:[] }; @@ -159,7 +162,7 @@ draggingTimeout: function() { }, _buildCall: function() { - var source = OSRM.DEFAULTS.HOST_ROUTING_URL; + var source = OSRM.G.active_routing_server_url; source += '?z=' + OSRM.G.map.getZoom() + '&output=json&jsonp=%jsonp'; if(OSRM.G.markers.checksum) source += '&checksum=' + OSRM.G.markers.checksum; diff --git a/WebContent/routing/OSRM.RoutingDescription.js b/WebContent/routing/OSRM.RoutingDescription.js index 84f6ce1ce..a8c5ed37c 100644 --- a/WebContent/routing/OSRM.RoutingDescription.js +++ b/WebContent/routing/OSRM.RoutingDescription.js @@ -31,6 +31,8 @@ onClickCreateShortcut: function(src){ src += '&z='+ OSRM.G.map.getZoom() + '¢er=' + OSRM.G.map.getCenter().lat.toFixed(6) + ',' + OSRM.G.map.getCenter().lng.toFixed(6); src += '&alt='+OSRM.G.active_alternative; src += '&df=' + OSRM.G.DISTANCE_FORMAT; + src += '&re=' + OSRM.G.active_routing_engine; + src += '&rm=' + OSRM.G.active_routing_metric; var source = OSRM.DEFAULTS.SHORTENER_PARAMETERS.replace(/%url/, OSRM.DEFAULTS.HOST_SHORTENER_URL+src); @@ -61,7 +63,7 @@ show: function(response) { var route_link ='['+OSRM.loc("GET_LINK_TO_ROUTE")+']'; // create GPX link - var gpx_link = '['+OSRM.loc("GPX_FILE")+']'; + var gpx_link = '['+OSRM.loc("GPX_FILE")+']'; // create route description var positions = OSRM.G.route.getPositions();