From f8779e479e73a1a4df87c927668b58a08f0fe913 Mon Sep 17 00:00:00 2001 From: DennisSchiefer Date: Fri, 24 Aug 2012 07:58:29 +0100 Subject: [PATCH] temporary commit --- WebContent/OSRM.config.js | 17 ++++++++++++++++ WebContent/base/OSRM.Map.js | 6 +++--- WebContent/gui/OSRM.MainGUI.js | 12 ++++++++---- WebContent/gui/OSRM.RoutingGUI.js | 32 ++++++++++++++++++++++++++----- WebContent/main.css | 3 ++- WebContent/main.html | 6 +++--- 6 files changed, 60 insertions(+), 16 deletions(-) diff --git a/WebContent/OSRM.config.js b/WebContent/OSRM.config.js index b4324060b..2b61dd830 100644 --- a/WebContent/OSRM.config.js +++ b/WebContent/OSRM.config.js @@ -19,6 +19,23 @@ or see http://www.gnu.org/licenses/agpl.txt. // [has to be loaded directly after OSRM.base] OSRM.DEFAULTS = { + ROUTING_ENGINES: [ + { url:'http://router.project-osrm.org/viaroute', + timestamp:'http://router.project-osrm.org/timestamp', + title:'car (fastest route)', + metric:0}, + { url:'http://mapa.ump.waw.pl/ump-www/viaroute', + timestamp:'http://mapa.ump.waw.pl/ump-www/timestamp', + title:'car (poland)', + metric:0 + }, + { url:'http://mapa.ump.waw.pl/ump-www/rower/viaroute', + timestamp:'http://mapa.ump.waw.pl/ump-www/rower/timestamp', + title:'bike (poland)', + metric:0 + } + ], + ONLOAD_ENGINE: 0, 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', diff --git a/WebContent/base/OSRM.Map.js b/WebContent/base/OSRM.Map.js index 7b2e1b803..1ae79092b 100644 --- a/WebContent/base/OSRM.Map.js +++ b/WebContent/base/OSRM.Map.js @@ -55,9 +55,9 @@ init: function() { fadeAnimation: false }); - // add locations control - var locationsControl = new L.Control.Locations(); - OSRM.G.map.addControl(locationsControl); +// // add locations control +// var locationsControl = new L.Control.Locations(); +// OSRM.G.map.addControl(locationsControl); // add layer control var layerControl = new L.Control.QueryableLayers(base_maps, {}); diff --git a/WebContent/gui/OSRM.MainGUI.js b/WebContent/gui/OSRM.MainGUI.js index 8a740fe65..48d14847f 100644 --- a/WebContent/gui/OSRM.MainGUI.js +++ b/WebContent/gui/OSRM.MainGUI.js @@ -46,7 +46,7 @@ init: function() { // query last update of data OSRM.G.data_timestamp = "n/a"; - OSRM.JSONP.call(OSRM.DEFAULTS.HOST_TIMESTAMP_URL+"?jsonp=%jsonp", OSRM.GUI.setDataTimestamp, OSRM.JSONP.empty, OSRM.DEFAULTS.JSONP_TIMEOUT, 'data_timestamp'); + OSRM.JSONP.call(OSRM.DEFAULTS.HOST_TIMESTAMP_URL+"?jsonp=%jsonp", OSRM.GUI.setDataTimestamp, OSRM.GUI.setDataTimestampTimeout, OSRM.DEFAULTS.JSONP_TIMEOUT, 'data_timestamp'); }, // set language dependent labels @@ -54,7 +54,7 @@ setLabels: function() { document.getElementById("open-josm").innerHTML = OSRM.loc("OPEN_JOSM"); document.getElementById("open-osmbugs").innerHTML = OSRM.loc("OPEN_OSMBUGS"); document.getElementById("gui-reset").innerHTML = OSRM.loc("GUI_RESET"); - document.getElementById("gui-zoom").innerHTML = OSRM.loc("GUI_ZOOM_ON_ROUTE"); +// document.getElementById("gui-zoom").innerHTML = OSRM.loc("GUI_ZOOM_ON_ROUTE"); document.getElementById("gui-reverse").innerHTML = OSRM.loc("GUI_REVERSE"); document.getElementById("gui-option-highlight-nonames-label").innerHTML = OSRM.loc("GUI_HIGHLIGHT_UNNAMED_ROADS"); document.getElementById("gui-option-show-previous-routes-label").innerHTML = OSRM.loc("GUI_SHOW_PREVIOUS_ROUTES"); @@ -133,10 +133,14 @@ changeDistanceFormat: function(type) { // set timestamp of data setDataTimestamp: function(response) { if(!response) - return; - + OSRM.GUI.setDataTimestampTimeout(); + OSRM.G.data_timestamp = response.timestamp.slice(0,25).replace(/<\/?[^>]+(>|$)/g ,""); // discard tags document.getElementById('gui-data-timestamp').innerHTML = OSRM.G.data_timestamp; +}, +setDataTimestampTimeout: function() { + OSRM.G.data_timestamp = "n/a"; + document.getElementById('gui-data-timestamp').innerHTML = OSRM.G.data_timestamp; } }); \ No newline at end of file diff --git a/WebContent/gui/OSRM.RoutingGUI.js b/WebContent/gui/OSRM.RoutingGUI.js index 5915affaa..effcd124a 100644 --- a/WebContent/gui/OSRM.RoutingGUI.js +++ b/WebContent/gui/OSRM.RoutingGUI.js @@ -36,24 +36,46 @@ init: function() { document.getElementById("gui-search-target").onclick = function() {OSRM.GUI.showMarker(OSRM.C.TARGET_LABEL);}; document.getElementById("gui-reset").onclick = OSRM.GUI.resetRouting; - document.getElementById("gui-zoom").onclick = OSRM.GUI.zoomOnRoute; +// document.getElementById("gui-zoom").onclick = OSRM.GUI.zoomOnRoute; document.getElementById("gui-reverse").onclick = OSRM.GUI.reverseRouting; document.getElementById("open-josm").onclick = OSRM.GUI.openJOSM; document.getElementById("open-osmbugs").onclick = OSRM.GUI.openOSMBugs; document.getElementById("option-highlight-nonames").onclick = OSRM.GUI.hightlightNonames; document.getElementById("option-show-previous-routes").onclick = OSRM.GUI.showPreviousRoutes; + + // engine toggle + var engines = OSRM.DEFAULTS.ROUTING_ENGINES; + var options = []; + for(var i=0, size=engines.length; i 1 ) + OSRM.Routing.getRoute(); + + // query timestamp of data + OSRM.JSONP.call( OSRM.DEFAULTS.ROUTING_ENGINES[ OSRM.G.active_routing_engine ].timestamp+"?jsonp=%jsonp", OSRM.GUI.setDataTimestamp, OSRM.GUI.setDataTimestampTimeout, OSRM.DEFAULTS.JSONP_TIMEOUT, 'data_timestamp'); }, // toggle GUI features that need a route to work activateRouteFeatures: function() { OSRM.Printing.activate(); - document.getElementById("gui-zoom").className = "button"; - document.getElementById('leaflet-control-locations-route').className = "leaflet-control-locations-route"; +// document.getElementById("gui-zoom").className = "button"; +// document.getElementById('leaflet-control-locations-route').className = "leaflet-control-locations-route"; }, deactivateRouteFeatures: function() { OSRM.Printing.deactivate(); - document.getElementById("gui-zoom").className = "button-inactive"; - document.getElementById('leaflet-control-locations-route').className = "leaflet-control-locations-route-inactive"; +// document.getElementById("gui-zoom").className = "button-inactive"; +// document.getElementById('leaflet-control-locations-route').className = "leaflet-control-locations-route-inactive"; }, // click: button "reset" diff --git a/WebContent/main.css b/WebContent/main.css index c83eaf31e..24f28e183 100644 --- a/WebContent/main.css +++ b/WebContent/main.css @@ -50,7 +50,7 @@ html, body { display:none; } - +/* .leaflet-control-zoom { border-radius:8px; -moz-border-radius:8px; @@ -173,6 +173,7 @@ html, body { .leaflet-control-layers a:hover { background-color: #CCCCCC; } +*/ /* ------------------------------------------------------------------------ */ diff --git a/WebContent/main.html b/WebContent/main.html index cd16f3487..5d1f7cea6 100644 --- a/WebContent/main.html +++ b/WebContent/main.html @@ -37,7 +37,7 @@ or see http://www.gnu.org/licenses/agpl.txt. - + @@ -207,8 +207,8 @@ or see http://www.gnu.org/licenses/agpl.txt.
- - +
+