finalized alternative integration

This commit is contained in:
DennisSchiefer 2012-07-05 09:24:27 +01:00
parent 74154ab0a6
commit ba46d77d1d
11 changed files with 63 additions and 105 deletions

View File

@ -81,7 +81,7 @@ zoomed: function(e) {
if(OSRM.G.dragging) if(OSRM.G.dragging)
OSRM.Routing.getRoute_Dragging(); OSRM.Routing.getRoute_Dragging();
else else
OSRM.Routing.getRoute_Redraw(); OSRM.Routing.getRoute_Redraw({keepAlternative:true});
}, },
contextmenu: function(e) {;}, contextmenu: function(e) {;},
mousemove: function(e) { OSRM.Via.drawDragMarker(e); }, mousemove: function(e) { OSRM.Via.drawDragMarker(e); },

View File

@ -31,7 +31,7 @@ OSRM.Route = function() {
this._old_noroute_style = {dashed:true, color:'#000000', weight:2}; this._old_noroute_style = {dashed:true, color:'#000000', weight:2};
this._unnamed_route_style = {dashed:false, color:'#FF00FF', weight:10}; this._unnamed_route_style = {dashed:false, color:'#FF00FF', weight:10};
this._old_unnamed_route_style = {dashed:false, color:'#990099', weight:10}; this._old_unnamed_route_style = {dashed:false, color:'#990099', weight:10};
this._alternative_route_style = {dashed:false,color:'#FF3300', weight:5}; this._alternative_route_style = {dashed:false,color:'#770033', weight:5, opacity:0.6};
this._noroute = OSRM.Route.ROUTE; this._noroute = OSRM.Route.ROUTE;
this._history = new OSRM.HistoryRoute(); this._history = new OSRM.HistoryRoute();

View File

@ -81,8 +81,6 @@ OSRM.RouteMarker = function ( label, style, position ) {
OSRM.inheritFrom( OSRM.RouteMarker, OSRM.Marker ); OSRM.inheritFrom( OSRM.RouteMarker, OSRM.Marker );
OSRM.extend( OSRM.RouteMarker, { OSRM.extend( OSRM.RouteMarker, {
onClick: function(e) { onClick: function(e) {
OSRM.RoutingAlternatives.reset();
for( var i=0; i<OSRM.G.markers.route.length; i++) { for( var i=0; i<OSRM.G.markers.route.length; i++) {
if( OSRM.G.markers.route[i].marker === this ) { if( OSRM.G.markers.route[i].marker === this ) {
OSRM.G.markers.removeMarker( i ); OSRM.G.markers.removeMarker( i );
@ -104,8 +102,6 @@ onDragStart: function(e) {
OSRM.G.dragging = true; OSRM.G.dragging = true;
this.switchIcon(this.options.dragicon); this.switchIcon(this.options.dragicon);
OSRM.RoutingAlternatives.reset();
// store id of dragged marker // store id of dragged marker
for( var i=0; i<OSRM.G.markers.route.length; i++) for( var i=0; i<OSRM.G.markers.route.length; i++)
if( OSRM.G.markers.route[i].marker === this ) { if( OSRM.G.markers.route[i].marker === this ) {

View File

@ -101,7 +101,7 @@ afterMainTransition: function() {
// toggle distance units // toggle distance units
onUnitsChanged: function(value) { onUnitsChanged: function(value) {
OSRM.Utils.setToHumanDistanceFunction(value); OSRM.Utils.setToHumanDistanceFunction(value);
OSRM.Routing.getRoute(); OSRM.Routing.getRoute({keepAlternative:true});
}, },
// set timestamp of data // set timestamp of data

View File

@ -40,7 +40,7 @@ init: function() {
document.getElementById("gui-reverse").onclick = OSRM.GUI.reverseRouting; document.getElementById("gui-reverse").onclick = OSRM.GUI.reverseRouting;
document.getElementById("open-josm").onclick = OSRM.GUI.openJOSM; document.getElementById("open-josm").onclick = OSRM.GUI.openJOSM;
document.getElementById("open-osmbugs").onclick = OSRM.GUI.openOSMBugs; document.getElementById("open-osmbugs").onclick = OSRM.GUI.openOSMBugs;
document.getElementById("option-highlight-nonames").onclick = OSRM.Routing.getRoute_Redraw; document.getElementById("option-highlight-nonames").onclick = OSRM.GUI.hightlightNonames;
document.getElementById("option-show-previous-routes").onclick = OSRM.GUI.showPreviousRoutes; document.getElementById("option-show-previous-routes").onclick = OSRM.GUI.showPreviousRoutes;
}, },
@ -59,8 +59,6 @@ resetRouting: function() {
document.getElementById('gui-input-source').value = ""; document.getElementById('gui-input-source').value = "";
document.getElementById('gui-input-target').value = ""; document.getElementById('gui-input-target').value = "";
OSRM.RoutingAlternatives.reset();
OSRM.G.route.reset(); OSRM.G.route.reset();
OSRM.G.markers.reset(); OSRM.G.markers.reset();
@ -77,8 +75,6 @@ reverseRouting: function() {
document.getElementById("gui-input-source").value = document.getElementById("gui-input-target").value; document.getElementById("gui-input-source").value = document.getElementById("gui-input-target").value;
document.getElementById("gui-input-target").value = tmp; document.getElementById("gui-input-target").value = tmp;
OSRM.RoutingAlternatives.reset();
// recompute route if needed // recompute route if needed
if( OSRM.G.route.isShown() ) { if( OSRM.G.route.isShown() ) {
OSRM.G.markers.route.reverse(); OSRM.G.markers.route.reverse();
@ -106,8 +102,6 @@ showMarker: function(marker_id) {
// changed: any inputbox (is called when enter is pressed [after] or focus is lost [before]) // changed: any inputbox (is called when enter is pressed [after] or focus is lost [before])
inputChanged: function(marker_id) { inputChanged: function(marker_id) {
OSRM.RoutingAlternatives.reset();
if( marker_id == OSRM.C.SOURCE_LABEL) if( marker_id == OSRM.C.SOURCE_LABEL)
OSRM.Geocoder.call(OSRM.C.SOURCE_LABEL, document.getElementById('gui-input-source').value); OSRM.Geocoder.call(OSRM.C.SOURCE_LABEL, document.getElementById('gui-input-source').value);
else if( marker_id == OSRM.C.TARGET_LABEL) else if( marker_id == OSRM.C.TARGET_LABEL)
@ -150,8 +144,6 @@ deleteMarker: function(marker_id) {
if( id == null) if( id == null)
return; return;
OSRM.RoutingAlternatives.reset();
OSRM.G.markers.removeMarker( id ); OSRM.G.markers.removeMarker( id );
OSRM.Routing.getRoute(); OSRM.Routing.getRoute();
OSRM.G.markers.highlight.hide(); OSRM.G.markers.highlight.hide();
@ -172,6 +164,11 @@ zoomOnRoute: function() {
var bounds = new L.LatLngBounds( OSRM.G.route._current_route.getPositions() ); var bounds = new L.LatLngBounds( OSRM.G.route._current_route.getPositions() );
OSRM.G.map.fitBoundsUI(bounds); OSRM.G.map.fitBoundsUI(bounds);
},
//click: toggle highlighting unnamed streets
hightlightNonames: function() {
OSRM.Routing.getRoute_Redraw({keepAlternative:true});
} }
}); });

View File

@ -64,7 +64,7 @@ setLanguage: function(language) {
if( OSRM.G.markers == null ) if( OSRM.G.markers == null )
return; return;
if( OSRM.G.markers.route.length > 1) if( OSRM.G.markers.route.length > 1)
OSRM.Routing.getRoute(); OSRM.Routing.getRoute({keepAlternative:true});
else if(OSRM.G.markers.route.length > 0 && document.getElementById('information-box').innerHTML != "" ) { else if(OSRM.G.markers.route.length > 0 && document.getElementById('information-box').innerHTML != "" ) {
OSRM.Geocoder.call( OSRM.C.SOURCE_LABEL, document.getElementById("gui-input-source").value ); OSRM.Geocoder.call( OSRM.C.SOURCE_LABEL, document.getElementById("gui-input-source").value );
OSRM.Geocoder.call( OSRM.C.TARGET_LABEL, document.getElementById("gui-input-target").value ); OSRM.Geocoder.call( OSRM.C.TARGET_LABEL, document.getElementById("gui-input-target").value );

View File

@ -29,6 +29,7 @@ OSRM.init = function() {
OSRM.Map.init(); OSRM.Map.init();
OSRM.Printing.init(); OSRM.Printing.init();
OSRM.Routing.init(); OSRM.Routing.init();
OSRM.RoutingAlternatives.init();
OSRM.Localization.init(); OSRM.Localization.init();
// stop if in maintenance mode // stop if in maintenance mode
@ -266,7 +267,7 @@ OSRM.parseParameters = function(){
OSRM.G.active_alternative = params.active_alternative; OSRM.G.active_alternative = params.active_alternative;
// compute route // compute route
OSRM.Routing.getRoute(); OSRM.Routing.getRoute({keepAlternative:true});
OSRM.G.initial_position_override = true; OSRM.G.initial_position_override = true;
return; return;
} }

View File

@ -195,6 +195,8 @@ drawRoute: function(response) {
return; return;
response.alternative_geometries.unshift( response.route_geometry ); response.alternative_geometries.unshift( response.route_geometry );
if( OSRM.G.active_alternative >= response.alternative_geometries.length ) // no redraw if the selected alternative cannot be found
return;
positions = OSRM.RoutingGeometry._decode( response.alternative_geometries[ OSRM.G.active_alternative ], 5 ); positions = OSRM.RoutingGeometry._decode( response.alternative_geometries[ OSRM.G.active_alternative ], 5 );
OSRM.G.printwindow.OSRM.drawRoute( positions ); OSRM.G.printwindow.OSRM.drawRoute( positions );
}, },

View File

@ -54,9 +54,11 @@ timeoutRoute_Reversed: function() {
OSRM.G.markers.reverseMarkers(); OSRM.G.markers.reverseMarkers();
OSRM.Routing.timeoutRoute(); OSRM.Routing.timeoutRoute();
}, },
showRoute: function(response) { showRoute: function(response, parameters) {
if(!response) if(!response)
return; return;
if(!parameters || parameters.keepAlternative == false)
OSRM.G.active_alternative = 0;
OSRM.G.response = response; // needed for printing & history routes! OSRM.G.response = response; // needed for printing & history routes!
if(response.status == 207) { if(response.status == 207) {
@ -65,11 +67,10 @@ showRoute: function(response) {
OSRM.RoutingDescription.showNA( OSRM.loc("NO_ROUTE_FOUND") ); OSRM.RoutingDescription.showNA( OSRM.loc("NO_ROUTE_FOUND") );
OSRM.Routing._snapRoute(); OSRM.Routing._snapRoute();
} else { } else {
OSRM.RoutingAlternatives.init(OSRM.G.response); OSRM.RoutingAlternatives.prepare(OSRM.G.response);
OSRM.RoutingGeometry.show(OSRM.G.response); OSRM.RoutingGeometry.show(OSRM.G.response);
OSRM.RoutingNoNames.show(OSRM.G.response); OSRM.RoutingNoNames.show(OSRM.G.response);
OSRM.RoutingDescription.show(OSRM.G.response); OSRM.RoutingDescription.show(OSRM.G.response);
OSRM.RoutingAlternatives._drawGUI();
OSRM.Routing._snapRoute(); OSRM.Routing._snapRoute();
} }
OSRM.Routing._updateHints(response); OSRM.Routing._updateHints(response);
@ -93,13 +94,15 @@ showRoute_Dragging: function(response) {
if(OSRM.G.pending) if(OSRM.G.pending)
setTimeout(OSRM.Routing.draggingTimeout,1); setTimeout(OSRM.Routing.draggingTimeout,1);
}, },
showRoute_Redraw: function(response) { showRoute_Redraw: function(response, parameters) {
if(!response) if(!response)
return; return;
if(!parameters || parameters.keepAlternative == false)
OSRM.G.active_alternative = 0;
OSRM.G.response = response; // not needed, even harmful as important information is not stored! ???? OSRM.G.response = response; // not needed, even harmful as important information is not stored! ==> really ????
if(response.status != 207) { if(response.status != 207) {
OSRM.RoutingAlternatives.init(OSRM.G.response); OSRM.RoutingAlternatives.prepare(OSRM.G.response);
OSRM.RoutingGeometry.show(OSRM.G.response); OSRM.RoutingGeometry.show(OSRM.G.response);
OSRM.RoutingNoNames.show(OSRM.G.response); OSRM.RoutingNoNames.show(OSRM.G.response);
} }
@ -110,7 +113,7 @@ showRoute_Redraw: function(response) {
//-- main function -- //-- main function --
//generate server calls to query routes //generate server calls to query routes
getRoute: function() { getRoute: function(parameters) {
// if source or target are not set -> hide route // if source or target are not set -> hide route
if( OSRM.G.markers.route.length < 2 ) { if( OSRM.G.markers.route.length < 2 ) {
@ -120,7 +123,7 @@ getRoute: function() {
OSRM.JSONP.clear('dragging'); OSRM.JSONP.clear('dragging');
OSRM.JSONP.clear('redraw'); OSRM.JSONP.clear('redraw');
OSRM.JSONP.clear('route'); OSRM.JSONP.clear('route');
OSRM.JSONP.call(OSRM.Routing._buildCall()+'&instructions=true', OSRM.Routing.showRoute, OSRM.Routing.timeoutRoute, OSRM.DEFAULTS.JSONP_TIMEOUT, 'route'); OSRM.JSONP.call(OSRM.Routing._buildCall()+'&instructions=true', OSRM.Routing.showRoute, OSRM.Routing.timeoutRoute, OSRM.DEFAULTS.JSONP_TIMEOUT, 'route',parameters);
}, },
getRoute_Reversed: function() { getRoute_Reversed: function() {
if( OSRM.G.markers.route.length < 2 ) if( OSRM.G.markers.route.length < 2 )
@ -131,13 +134,13 @@ getRoute_Reversed: function() {
OSRM.JSONP.clear('route'); OSRM.JSONP.clear('route');
OSRM.JSONP.call(OSRM.Routing._buildCall()+'&instructions=true', OSRM.Routing.showRoute, OSRM.Routing.timeoutRoute_Reversed, OSRM.DEFAULTS.JSONP_TIMEOUT, 'route'); OSRM.JSONP.call(OSRM.Routing._buildCall()+'&instructions=true', OSRM.Routing.showRoute, OSRM.Routing.timeoutRoute_Reversed, OSRM.DEFAULTS.JSONP_TIMEOUT, 'route');
}, },
getRoute_Redraw: function() { getRoute_Redraw: function(parameters) {
if( OSRM.G.markers.route.length < 2 ) if( OSRM.G.markers.route.length < 2 )
return; return;
OSRM.JSONP.clear('dragging'); OSRM.JSONP.clear('dragging');
OSRM.JSONP.clear('redraw'); OSRM.JSONP.clear('redraw');
OSRM.JSONP.call(OSRM.Routing._buildCall()+'&instructions=true', OSRM.Routing.showRoute_Redraw, OSRM.Routing.timeoutRoute, OSRM.DEFAULTS.JSONP_TIMEOUT, 'redraw'); OSRM.JSONP.call(OSRM.Routing._buildCall()+'&instructions=true', OSRM.Routing.showRoute_Redraw, OSRM.Routing.timeoutRoute, OSRM.DEFAULTS.JSONP_TIMEOUT, 'redraw',parameters);
}, },
getRoute_Dragging: function() { getRoute_Dragging: function() {
OSRM.G.pending = !OSRM.JSONP.call(OSRM.Routing._buildCall()+'&instructions=false', OSRM.Routing.showRoute_Dragging, OSRM.Routing.timeoutRoute_Dragging, OSRM.DEFAULTS.JSONP_TIMEOUT, 'dragging');; OSRM.G.pending = !OSRM.JSONP.call(OSRM.Routing._buildCall()+'&instructions=false', OSRM.Routing.showRoute_Dragging, OSRM.Routing.timeoutRoute_Dragging, OSRM.DEFAULTS.JSONP_TIMEOUT, 'dragging');;

View File

@ -21,23 +21,20 @@ or see http://www.gnu.org/licenses/agpl.txt.
OSRM.RoutingAlternatives = { OSRM.RoutingAlternatives = {
// remaining problems: how to handle PRINTING (do it internally), LINKS (add parameter to JSONP call)
// data of gui buttons for alternativess // data of gui buttons for alternativess
_buttons: [ _buttons: [
{id:"gui-a", label:"A"}, {id:"gui-a", label:"A"},
{id:"gui-b", label:"B"} {id:"gui-b", label:"B"}
], ],
// initialize required values
// reset stored values init: function() {
reset: function() {
OSRM.G.active_alternative = 0; OSRM.G.active_alternative = 0;
OSRM.G.alternative_count = 0; OSRM.G.alternative_count = 0;
}, },
// restructure response data // restructure response data
init: function(response) { prepare: function(response) {
// move best route to alternative array // move best route to alternative array
var the_response = OSRM.G.response; var the_response = OSRM.G.response;
the_response.alternative_geometries.unshift( response.route_geometry ); the_response.alternative_geometries.unshift( response.route_geometry );
@ -46,9 +43,7 @@ init: function(response) {
// update basic information // update basic information
OSRM.G.alternative_count = response.alternative_geometries.length; OSRM.G.alternative_count = response.alternative_geometries.length;
if( OSRM.G.active_alternative == undefined ) if( OSRM.G.active_alternative >= OSRM.G.alternative_count ) // reset if the selected alternative cannot be found
OSRM.G.active_alternative = 0;
if( OSRM.G.active_alternative > OSRM.G.alternative_count - 1 )
OSRM.G.active_alternative = 0; OSRM.G.active_alternative = 0;
// switch data // switch data
@ -57,46 +52,6 @@ init: function(response) {
the_response.route_summary = the_response.alternative_summaries[OSRM.G.active_alternative]; the_response.route_summary = the_response.alternative_summaries[OSRM.G.active_alternative];
}, },
// prepare using alternatives
prepare: function(response) {
// store basic information
OSRM.G.alternative_count = response.alternative_geometries.length + 1;
OSRM.G.active_alternative = 0;
// do nothing if there is no alternative
// if( OSRM.G.alternative_count == 1 )
// return;
// move best route to alternative array
var the_response = OSRM.G.response;
the_response.alternative_geometries.unshift( response.route_geometry );
the_response.alternative_instructions.unshift( response.route_instructions );
the_response.alternative_summaries.unshift( response.route_summary );
// add alternative GUI
OSRM.RoutingAlternatives._drawGUI();
},
prepare_Redraw: function(response) {
// do nothing if there is no alternative
if( OSRM.G.alternative_count == 1 )
return;
// move results
var the_response = OSRM.G.response;
the_response.alternative_geometries = response.alternative_geometries;
the_response.alternative_instructions = response.alternative_instructions;
the_response.alternative_summaries = response.alternative_summaries;
the_response.alternative_geometries.unshift( response.route_geometry );
the_response.alternative_instructions.unshift( response.route_instructions );
the_response.alternative_summaries.unshift( response.route_summary );
// switch data
the_response.route_geometry = the_response.alternative_geometries[OSRM.G.active_alternative];
the_response.route_instructions = the_response.alternative_instructions[OSRM.G.active_alternative];
the_response.route_summary = the_response.alternative_summaries[OSRM.G.active_alternative];
},
// switch active alternative and redraw buttons accordingly // switch active alternative and redraw buttons accordingly
setActive: function(button_id) { setActive: function(button_id) {
// switch active alternative // switch active alternative
@ -110,6 +65,33 @@ setActive: function(button_id) {
// do nothing for non-clickable buttons // do nothing for non-clickable buttons
}, },
//draw GUI and register click events
show: function() {
var buttons = OSRM.RoutingAlternatives._buttons;
var data = "";
// draw clickable buttons
for(var i=0, size=OSRM.G.alternative_count; i<size; i++) {
var distance = OSRM.Utils.toHumanDistance(OSRM.G.response.alternative_summaries[i].total_distance);
var time = OSRM.Utils.toHumanTime(OSRM.G.response.alternative_summaries[i].total_time);
var tooltip = OSRM.loc("DISTANCE")+":"+distance+" "+OSRM.loc("DURATION")+":"+time;
var buttonClass = (i == OSRM.G.active_alternative) ? "button-pressed" : "button";
data = '<a class="'+buttonClass+' top-right-button" id="'+buttons[i].id+'" title="'+tooltip+'">'+buttons[i].label+'</a>' + data;
}
// draw non-clickable buttons
for(var i=OSRM.G.alternative_count, size=buttons.length; i<size; ++i) {
data = '<a class="button-inactive top-right-button" id="'+buttons[i].id+'">'+buttons[i].label+'</a>' + data;
}
// add buttons to DOM
document.getElementById('information-box-header').innerHTML = data + document.getElementById('information-box-header').innerHTML;
// add events
for(var i=0, size=OSRM.G.alternative_count; i<size; i++) {
document.getElementById(buttons[i].id).onclick = function (button_id) { return function() {OSRM.RoutingAlternatives._click(button_id); }; }(i) ;
document.getElementById(buttons[i].id).onmouseover = function (button_id) { return function() {OSRM.RoutingAlternatives._mouseover(button_id); }; } (i);
document.getElementById(buttons[i].id).onmouseout = function (button_id) { return function() {OSRM.RoutingAlternatives._mouseout(button_id); }; } (i);
}
},
// mouse events on buttons // mouse events on buttons
_click: function(button_id) { _click: function(button_id) {
if( OSRM.G.active_alternative == button_id ) if( OSRM.G.active_alternative == button_id )
@ -123,11 +105,10 @@ _click: function(button_id) {
the_response.route_instructions = the_response.alternative_instructions[button_id]; the_response.route_instructions = the_response.alternative_instructions[button_id];
the_response.route_summary = the_response.alternative_summaries[button_id]; the_response.route_summary = the_response.alternative_summaries[button_id];
// show alternative // redraw route & data
OSRM.RoutingGeometry.show(the_response); OSRM.RoutingGeometry.show(the_response);
OSRM.RoutingNoNames.show(the_response); OSRM.RoutingNoNames.show(the_response);
OSRM.RoutingDescription.show(the_response); OSRM.RoutingDescription.show(the_response);
OSRM.RoutingAlternatives._drawGUI();
}, },
_mouseover: function(button_id) { _mouseover: function(button_id) {
if( OSRM.G.active_alternative == button_id ) if( OSRM.G.active_alternative == button_id )
@ -141,31 +122,6 @@ _mouseout: function(button_id) {
return; return;
OSRM.G.route.hideAlternativeRoute(); OSRM.G.route.hideAlternativeRoute();
},
// draw alternative GUI
_drawGUI: function() {
var buttons = OSRM.RoutingAlternatives._buttons;
// draw clickable buttons
for(var i=0, size=OSRM.G.alternative_count; i<size; i++) {
var distance = OSRM.Utils.toHumanDistance(OSRM.G.response.alternative_summaries[i].total_distance);
var time = OSRM.Utils.toHumanTime(OSRM.G.response.alternative_summaries[i].total_time);
var tooltip = OSRM.loc("DISTANCE")+":"+distance+" "+OSRM.loc("DURATION")+":"+time;
var buttonClass = (i == OSRM.G.active_alternative) ? "button-pressed" : "button";
var data = '<a class="'+buttonClass+' top-right-button" id="'+buttons[i].id+'" title="'+tooltip+'">'+buttons[i].label+'</a>';
document.getElementById('information-box-header').innerHTML = data + document.getElementById('information-box-header').innerHTML;
}
// draw non-clickable buttons
for(var i=OSRM.G.alternative_count, size=buttons.length; i<size; ++i) {
var data = '<a class="button-inactive top-right-button" id="'+buttons[i].id+'">'+buttons[i].label+'</a>';
document.getElementById('information-box-header').innerHTML = data + document.getElementById('information-box-header').innerHTML;
}
// add events
for(var i=0, size=OSRM.G.alternative_count; i<size; i++) {
document.getElementById(buttons[i].id).onclick = function (button_id) { return function() {OSRM.RoutingAlternatives._click(button_id); }; }(i) ;
document.getElementById(buttons[i].id).onmouseover = function (button_id) { return function() {OSRM.RoutingAlternatives._mouseover(button_id); }; } (i);
document.getElementById(buttons[i].id).onmouseout = function (button_id) { return function() {OSRM.RoutingAlternatives._mouseout(button_id); }; } (i);
}
} }
}; };

View File

@ -101,11 +101,14 @@ show: function(response) {
body += '</table>'; body += '</table>';
// build header // build header
header = OSRM.RoutingDescription._buildHeader(OSRM.Utils.toHumanDistance(response.route_summary.total_distance), OSRM.Utils.toHumanTime(response.route_summary.total_time), route_link, gpx_link); header = OSRM.RoutingDescription._buildHeader(OSRM.Utils.toHumanDistance(response.route_summary.total_distance), OSRM.Utils.toHumanTime(response.route_summary.total_time), route_link, gpx_link);
// update DOM // update DOM
document.getElementById('information-box-header').innerHTML = header; document.getElementById('information-box-header').innerHTML = header;
document.getElementById('information-box').innerHTML = body; document.getElementById('information-box').innerHTML = body;
// add alternative GUI (has to be done last since DOM has to be updated before events are registered)
OSRM.RoutingAlternatives.show();
}, },
// simple description // simple description