diff --git a/WebContent/OSRM.config.js b/WebContent/OSRM.config.js
index fe30e41e1..5952c401b 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://i10pc68.ira.uka.de:5000/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/main.css b/WebContent/main.css
index 219dcd911..aea366930 100644
--- a/WebContent/main.css
+++ b/WebContent/main.css
@@ -539,7 +539,7 @@ html, body {
border-radius:5px;
-moz-border-radius:5px;
-webkit-border-radius:5px;
- background-color:#DDDDDD;
+ background-color:#AAAAAA;
border:1px solid #999999;
color:#000000;
text-decoration:none;
diff --git a/WebContent/main.html b/WebContent/main.html
index 4dadffd95..ca9fa97e1 100644
--- a/WebContent/main.html
+++ b/WebContent/main.html
@@ -65,6 +65,7 @@ or see http://www.gnu.org/licenses/agpl.txt.
+
diff --git a/WebContent/routing/OSRM.RoutingAlternatives.js b/WebContent/routing/OSRM.RoutingAlternatives.js
index 6e46bca95..64ab47fd8 100644
--- a/WebContent/routing/OSRM.RoutingAlternatives.js
+++ b/WebContent/routing/OSRM.RoutingAlternatives.js
@@ -23,19 +23,32 @@ OSRM.RoutingAlternatives = {
// remaining problems: how to handle PRINTING (do it internally), LINKS (add parameter to JSONP call)
-// name of gui buttons to choose alternatives
-_buttons: ["gui_a", "gui_b"],
-
-// prepare response
+// data of gui buttons for alternativess
+_buttons: [
+ {id:"gui-a", label:"A"},
+ {id:"gui-b", label:"B"},
+ {id:"gui-c", label:"C"},
+ {id:"gui-d", label:"D"}
+],
+
+
+// prepare using alternatives
prepare: function(response) {
- var original = {};
- original.route_geometry = response.route_geometry;
- original.route_instructions = response.route_instructions;
- original.route_summary = response.route_summary;
- OSRM.G.response.alternatives.push( original );
+ // store basic information
+ OSRM.G.alternative_count = response.alternative_geometries.length;
+ OSRM.G.alternative_active = 0;
- OSRM.G.response.active_alternative = 0;
+ // do nothing if there is no alternative
+ if( OSRM.G.alternative_count == 0 )
+ 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._addGUI();
},
prepare_Redraw: function(response) {
@@ -51,57 +64,65 @@ prepare_Redraw: function(response) {
// press one of the buttons
press: function(button_id) {
+ // switch active alternative
+ OSRM.G.alternative_active = button_id;
+
+ // redraw buttons
var buttons = OSRM.RoutingAlternatives._buttons;
- for(var i=0, size=buttons; iB' +
- 'A';
- document.getElementById('information-box-header').innerHTML = data + document.getElementById('information-box-header').innerHTML;
-
- OSRM.RoutingAlternatives.press( OSRM.G.response.active_alternative );
-
var buttons = OSRM.RoutingAlternatives._buttons;
- for(var i=0, size=buttons; i'+buttons[i].label+'';
+ document.getElementById('information-box-header').innerHTML = data + document.getElementById('information-box-header').innerHTML;
+ 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);
}
+ OSRM.RoutingAlternatives.press( OSRM.G.alternative_active );
}
};
\ No newline at end of file