added routing_engine and routing_metric to describe the currently chosen

routing
This commit is contained in:
DennisSchiefer 2012-08-14 06:59:42 +01:00
parent de2e070dde
commit 9a6c6cd485
3 changed files with 18 additions and 9 deletions

View File

@ -238,11 +238,17 @@ OSRM.parseParameters = function(){
return; return;
params.active_alternative = active_alternative; params.active_alternative = active_alternative;
} }
else if(name_val[0] == 'rs') { else if(name_val[0] == 're') {
var active_routing_server_id = Number(name_val[1]); var active_routing_engine = Number(name_val[1]);
if( active_routing_server_id<0 || active_routing_server_id>=OSRM.DEFAULTS.HOST_ROUTING_URL.length) if( active_routing_engine<0 || active_routing_engine>=OSRM.DEFAULTS.HOST_ROUTING_URL.length)
return; return;
params.active_routing_server_id = active_routing_server_id; 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;
} }
} }
@ -287,8 +293,9 @@ OSRM.parseParameters = function(){
OSRM.G.active_alternative = params.active_alternative || 0; OSRM.G.active_alternative = params.active_alternative || 0;
// set routing server // set routing server
OSRM.G.active_routing_server_id = params.active_routing_server_id || 0; OSRM.G.active_routing_engine = params.active_routing_engine || 0;
OSRM.G.active_routing_server_url = OSRM.DEFAULTS.HOST_ROUTING_URL[ OSRM.G.active_routing_server_id ]; 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 // compute route
OSRM.Routing.getRoute({keepAlternative:true}); OSRM.Routing.getRoute({keepAlternative:true});

View File

@ -31,8 +31,9 @@ OSRM.Routing = {
// init routing data structures // init routing data structures
init: function() { init: function() {
OSRM.G.active_routing_server_id = 0; OSRM.G.active_routing_engine = 0;
OSRM.G.active_routing_server_url = OSRM.DEFAULTS.HOST_ROUTING_URL[ OSRM.G.active_routing_server_id ]; 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.markers = new OSRM.Markers();
OSRM.G.route = new OSRM.Route(); OSRM.G.route = new OSRM.Route();
OSRM.G.response = { via_points:[] }; OSRM.G.response = { via_points:[] };

View File

@ -31,7 +31,8 @@ onClickCreateShortcut: function(src){
src += '&z='+ OSRM.G.map.getZoom() + '&center=' + OSRM.G.map.getCenter().lat.toFixed(6) + ',' + OSRM.G.map.getCenter().lng.toFixed(6); src += '&z='+ OSRM.G.map.getZoom() + '&center=' + OSRM.G.map.getCenter().lat.toFixed(6) + ',' + OSRM.G.map.getCenter().lng.toFixed(6);
src += '&alt='+OSRM.G.active_alternative; src += '&alt='+OSRM.G.active_alternative;
src += '&df=' + OSRM.G.DISTANCE_FORMAT; src += '&df=' + OSRM.G.DISTANCE_FORMAT;
src += '&rs=' + OSRM.G.active_routing_server_id; 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); var source = OSRM.DEFAULTS.SHORTENER_PARAMETERS.replace(/%url/, OSRM.DEFAULTS.HOST_SHORTENER_URL+src);