diff --git a/WebContent/base/OSRM.Routes.js b/WebContent/base/OSRM.Routes.js index 7e8779c44..e03d8fe75 100644 --- a/WebContent/base/OSRM.Routes.js +++ b/WebContent/base/OSRM.Routes.js @@ -59,8 +59,8 @@ OSRM.extend( OSRM.Route,{ this._history.fetchHistoryRoute(); this._history.showHistoryRoutes(); - // deactivate printing - OSRM.Printing.deactivate(); + // deactivate GUI features that need a route + OSRM.GUI.deactivateRouteFeatures(); }, // show/hide highlighting for unnamed routes diff --git a/WebContent/gui/OSRM.MainGUI.js b/WebContent/gui/OSRM.MainGUI.js index b77e6e838..ae4db5f7f 100644 --- a/WebContent/gui/OSRM.MainGUI.js +++ b/WebContent/gui/OSRM.MainGUI.js @@ -54,6 +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"); 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"); diff --git a/WebContent/gui/OSRM.RoutingGUI.js b/WebContent/gui/OSRM.RoutingGUI.js index c2c4fb60d..6b7dfe45f 100644 --- a/WebContent/gui/OSRM.RoutingGUI.js +++ b/WebContent/gui/OSRM.RoutingGUI.js @@ -36,6 +36,7 @@ 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-reverse").onclick = OSRM.GUI.reverseRouting; document.getElementById("open-josm").onclick = OSRM.GUI.openJOSM; document.getElementById("open-osmbugs").onclick = OSRM.GUI.openOSMBugs; @@ -43,6 +44,16 @@ init: function() { document.getElementById("option-show-previous-routes").onclick = OSRM.GUI.showPreviousRoutes; }, +// toggle GUI features that need a route to work +activateRouteFeatures: function() { + OSRM.Printing.activate(); + document.getElementById("gui-zoom").className = "button"; +}, +deactivateRouteFeatures: function() { + OSRM.Printing.deactivate(); + document.getElementById("gui-zoom").className = "button-inactive"; +}, + // click: button "reset" resetRouting: function() { document.getElementById('gui-input-source').value = ""; @@ -144,6 +155,15 @@ showPreviousRoutes: function(value) { OSRM.G.route.deactivateHistoryRoutes(); else OSRM.G.route.activateHistoryRoutes(); +}, + +//click: button "zoom on route" +zoomOnRoute: function() { + if( OSRM.G.route.isShown() == false ) + return; + + var bounds = new L.LatLngBounds( OSRM.G.route._current_route.getPositions() ); + OSRM.G.map.fitBoundsUI(bounds); } }); diff --git a/WebContent/localization/OSRM.Locale.de.js b/WebContent/localization/OSRM.Locale.de.js index 29fcf1a4f..4db067146 100644 --- a/WebContent/localization/OSRM.Locale.de.js +++ b/WebContent/localization/OSRM.Locale.de.js @@ -26,6 +26,7 @@ OSRM.Localization["de"] = { "GUI_START": "Start", "GUI_END": "Ziel", "GUI_RESET": "Reset", +"GUI_ZOOM": "Zoom auf Route", "GUI_SEARCH": "Zeigen", "GUI_REVERSE": "Umdrehen", "GUI_START_TOOLTIP": "Startposition eingeben", diff --git a/WebContent/localization/OSRM.Locale.dk.js b/WebContent/localization/OSRM.Locale.dk.js index 91850e5b0..02100e623 100644 --- a/WebContent/localization/OSRM.Locale.dk.js +++ b/WebContent/localization/OSRM.Locale.dk.js @@ -26,6 +26,7 @@ OSRM.Localization["dk"] = { "GUI_START": "Start", "GUI_END": "Destination", "GUI_RESET": "Nulstil", +"GUI_ZOOM": "Zoom på Rute", "GUI_SEARCH": "Vis", "GUI_REVERSE": "Omvendt", "GUI_START_TOOLTIP": "Indtast start", diff --git a/WebContent/localization/OSRM.Locale.en.js b/WebContent/localization/OSRM.Locale.en.js index f4ab40d28..6375f28d2 100644 --- a/WebContent/localization/OSRM.Locale.en.js +++ b/WebContent/localization/OSRM.Locale.en.js @@ -26,6 +26,7 @@ OSRM.Localization["en"] = { "GUI_START": "Start", "GUI_END": "End", "GUI_RESET": "  Reset  ", +"GUI_ZOOM": "Zoom on Route", "GUI_SEARCH": "  Show  ", "GUI_REVERSE": "Reverse", "GUI_START_TOOLTIP": "Enter start", diff --git a/WebContent/localization/OSRM.Locale.fi.js b/WebContent/localization/OSRM.Locale.fi.js index bebfe5325..7cccad248 100644 --- a/WebContent/localization/OSRM.Locale.fi.js +++ b/WebContent/localization/OSRM.Locale.fi.js @@ -26,6 +26,7 @@ OSRM.Localization["fi"] = { "GUI_START": "Lähtöpaikka", "GUI_END": "Määränpää", "GUI_RESET": "Tyhjennä", +"GUI_ZOOM": "Zoom reitillä", "GUI_SEARCH": "Etsi", "GUI_REVERSE": "Käänteinen reitti", "GUI_START_TOOLTIP": "Syötä lähtöpaikka", diff --git a/WebContent/localization/OSRM.Locale.fr.js b/WebContent/localization/OSRM.Locale.fr.js index ecc256f88..87482dfcc 100644 --- a/WebContent/localization/OSRM.Locale.fr.js +++ b/WebContent/localization/OSRM.Locale.fr.js @@ -26,6 +26,7 @@ OSRM.Localization["fr"] = { "GUI_START": "Départ", "GUI_END": "Arrivée", "GUI_RESET": "Réinitialiser", +"GUI_ZOOM": "Zoom sur la Route", "GUI_SEARCH": "Montrer", "GUI_REVERSE": "Inverser", "GUI_START_TOOLTIP": "Entrez le lieu de départ", diff --git a/WebContent/localization/OSRM.Locale.it.js b/WebContent/localization/OSRM.Locale.it.js index c8b6ad717..6c9200382 100644 --- a/WebContent/localization/OSRM.Locale.it.js +++ b/WebContent/localization/OSRM.Locale.it.js @@ -26,6 +26,7 @@ OSRM.Localization["it"] = { "GUI_START": "Partenza", "GUI_END": "Destinazione", "GUI_RESET": "Reset", +"GUI_ZOOM": "Zoom su Percorso", "GUI_SEARCH": "Mostra", "GUI_REVERSE": "Inverti", "GUI_START_TOOLTIP": "Inserire la Partenza", @@ -41,7 +42,7 @@ OSRM.Localization["it"] = { // mapping "GUI_MAPPING_TOOLS": "Strumenti per la Mappatura", "GUI_HIGHLIGHT_UNNAMED_ROADS": "Evidenzia strade senza nome", -"GUI_SHOW_PREVIOUS_ROUTES": "Show previous routes", +"GUI_SHOW_PREVIOUS_ROUTES": "Mostra le percorsi precedenti", "OPEN_JOSM": "JOSM", "OPEN_OSMBUGS": "OSM Bugs", // geocoder diff --git a/WebContent/localization/OSRM.Locale.pl.js b/WebContent/localization/OSRM.Locale.pl.js index 3e6463778..a41d5cf17 100644 --- a/WebContent/localization/OSRM.Locale.pl.js +++ b/WebContent/localization/OSRM.Locale.pl.js @@ -26,6 +26,7 @@ OSRM.Localization["pl"] = { "GUI_START": "Początek", "GUI_END": "Koniec", "GUI_RESET": "Reset", +"GUI_ZOOM": "Zoom na Trasy", "GUI_SEARCH": "Pokaż", "GUI_REVERSE": "Odwróć", "GUI_START_TOOLTIP": "Wprowadź początek", diff --git a/WebContent/main.css b/WebContent/main.css index f75f6a6c9..2b61e5071 100644 --- a/WebContent/main.css +++ b/WebContent/main.css @@ -517,6 +517,21 @@ html, body { background-color:#F4F4F4; color:#FF0000; } +.button-inactive +{ + cursor:default; + padding:2px 10px 2px 10px; + border-radius:5px; + -moz-border-radius:5px; + -webkit-border-radius:5px; + background-color:#F9F9F9; + border:1px solid #CCCCCC; + color:#999999; + text-decoration:none; + font-size:9px; + outline-style:none; + vertical-align:1px; +} /* iconic buttons */ diff --git a/WebContent/main.html b/WebContent/main.html index e913562f7..0261f2b38 100644 --- a/WebContent/main.html +++ b/WebContent/main.html @@ -185,6 +185,7 @@ or see http://www.gnu.org/licenses/agpl.txt.
Reset
+
Reset
Reverse
diff --git a/WebContent/routing/OSRM.RoutingDescription.js b/WebContent/routing/OSRM.RoutingDescription.js index 5711c040f..21b65d0e2 100644 --- a/WebContent/routing/OSRM.RoutingDescription.js +++ b/WebContent/routing/OSRM.RoutingDescription.js @@ -48,8 +48,8 @@ showRouteLink_TimeOut: function(){ // handling of routing description show: function(response) { - // activate printing - OSRM.Printing.activate(); + // activate GUI features that need a route + OSRM.GUI.activateRouteFeatures(); // compute query string var query_string = '?hl=' + OSRM.Localization.current_language;