diff --git a/WebContent/OSRM.GUI.js b/WebContent/OSRM.GUI.js index 6d6389679..f3ff3c1d1 100644 --- a/WebContent/OSRM.GUI.js +++ b/WebContent/OSRM.GUI.js @@ -31,7 +31,7 @@ init: function() { OSRM.GUI.width = document.getElementById("main-wrapper").clientWidth; // init favicon - document.getElementById('favicon').href=OSRM.G.images["favicon"].src; + document.getElementById('favicon').href=OSRM.G.images["favicon"].getAttribute("src"); // init starting source/target document.getElementById('gui-input-source').value = OSRM.DEFAULTS.ONLOAD_SOURCE; diff --git a/WebContent/OSRM.Map.js b/WebContent/OSRM.Map.js index 0e5dc6e38..f4c38c777 100644 --- a/WebContent/OSRM.Map.js +++ b/WebContent/OSRM.Map.js @@ -27,27 +27,27 @@ OSRM.GLOBALS.map = null; OSRM.MapView = L.Map.extend({ setViewUI: function(position, zoom) { if( OSRM.GUI.visible == true ) { - var point = OSRM.G.map.project( position, zoom); + var point = this.project( position, zoom); point.x-=OSRM.GUI.width/2; - position = OSRM.G.map.unproject(point,zoom); + position = this.unproject(point,zoom); } this.setView( position, zoom); }, fitBoundsUI: function(bounds) { var southwest = bounds.getSouthWest(); var northeast = bounds.getNorthEast(); - var zoom = OSRM.G.map.getBoundsZoom(bounds); - var sw_point = OSRM.G.map.project( southwest, zoom); + var zoom = this.getBoundsZoom(bounds); + var sw_point = this.project( southwest, zoom); if( OSRM.GUI.visible == true ) sw_point.x-=OSRM.GUI.width/2; else sw_point.x-=10; sw_point.y+=10; - var ne_point = OSRM.G.map.project( northeast, zoom); + var ne_point = this.project( northeast, zoom); ne_point.y-=10; sw_point.x+=10; - bounds.extend( OSRM.G.map.unproject(sw_point,zoom) ); - bounds.extend( OSRM.G.map.unproject(ne_point,zoom) ); + bounds.extend( this.unproject(sw_point,zoom) ); + bounds.extend( this.unproject(ne_point,zoom) ); this.fitBounds( bounds ); }, getCenterUI: function(unbounded) { @@ -132,4 +132,4 @@ geolocationResponse: function(response) { var latlng = new L.LatLng(response.coords.latitude, response.coords.longitude); OSRM.G.map.setViewUI(latlng, OSRM.DEFAULTS.ZOOM_LEVEL ); } -}; \ No newline at end of file +}; diff --git a/WebContent/localization/OSRM.Locale.de.js b/WebContent/localization/OSRM.Locale.de.js index cef17bd45..f17b01e92 100644 --- a/WebContent/localization/OSRM.Locale.de.js +++ b/WebContent/localization/OSRM.Locale.de.js @@ -50,6 +50,8 @@ OSRM.Localization["de"] = { "DURATION": "Dauer", "YOUR_ROUTE_IS_BEING_COMPUTED": "Ihre Route wird berechnet", "NO_ROUTE_FOUND": "Keine Route hierher möglich", +// printing +"OVERVIEW_MAP": "Übersichtskarte", // directions "N": "Norden", "E": "Ost", @@ -87,4 +89,4 @@ OSRM.Localization["de"] = { // set GUI language on load if( OSRM.DEFAULTS.LANUGAGE_ONDEMAND_RELOADING==true ) - OSRM.Localization.setLanguage("de"); \ No newline at end of file + OSRM.Localization.setLanguage("de"); diff --git a/WebContent/localization/OSRM.Locale.en.js b/WebContent/localization/OSRM.Locale.en.js index a65870423..d8b3beedc 100644 --- a/WebContent/localization/OSRM.Locale.en.js +++ b/WebContent/localization/OSRM.Locale.en.js @@ -50,6 +50,8 @@ OSRM.Localization["en"] = { "DURATION": "Duration", "YOUR_ROUTE_IS_BEING_COMPUTED": "Your route is being computed", "NO_ROUTE_FOUND": "No route possible", +//printing +"OVERVIEW_MAP": "Overview Map", // directions "N": "north", "E": "east", @@ -87,4 +89,4 @@ OSRM.Localization["en"] = { //set GUI language on load if( OSRM.DEFAULTS.LANUGAGE_ONDEMAND_RELOADING == true ) - OSRM.Localization.setLanguage("en"); \ No newline at end of file + OSRM.Localization.setLanguage("en"); diff --git a/WebContent/main.js b/WebContent/main.js index b588baa59..b8bf2baec 100644 --- a/WebContent/main.js +++ b/WebContent/main.js @@ -95,15 +95,15 @@ OSRM.prefetchIcons = function() { for(var i=0; i'; route_desc += ''; - route_desc += ''; + route_desc += ''; route_desc += ""; route_desc += ''; @@ -99,7 +102,7 @@ show: function(response) { OSRM.printwindow.document.getElementById('description').innerHTML = route_desc; // init map - var map = OSRM.printwindow.initialize(); + var map = OSRM.printwindow.initialize( OSRM.DEFAULTS.TILE_SERVERS[0] ); var markers = OSRM.G.markers.route; map.addLayer( new L.MouseMarker( markers[0].getPosition(), {draggable:false,clickable:false,icon:OSRM.G.icons['marker-source']} ) ); for(var i=1, size=markers.length-1; i - - - + + @@ -86,8 +57,8 @@ function printsite() {
-
Übersichtskarte
-
+
Übersichtskarte
+
diff --git a/WebContent/printing/printing.js b/WebContent/printing/printing.js new file mode 100644 index 000000000..8303bba42 --- /dev/null +++ b/WebContent/printing/printing.js @@ -0,0 +1,49 @@ +/* +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU AFFERO General Public License as published by +the Free Software Foundation; either version 3 of the License, or +any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU Affero General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +or see http://www.gnu.org/licenses/agpl.txt. +*/ + +// OSRM initialization +// [for printing window] + +OSRM = {}; +OSRM.GLOBALS = {}; +OSRM.GUI = { visible:false }; +OSRM.G = OSRM.GLOBALS; + +// function to initialize a map in the new window +function initialize(tile_server) { + // setup map + var tile_layer = new L.TileLayer(tile_server.url, tile_server.options); + OSRM.G.map = new OSRM.MapView("overview-map", { + center: new L.LatLng(51.505, -0.09), + zoom: 13, + zoomAnimation: false, + fadeAnimation: false, + layers: [tile_layer], + attributionControl: false, + zoomControl: false, + dragging:false, + scrollWheelZoom:false, + touchZoom:false, + doubleClickZoom:false + }); + return OSRM.G.map; +} + +//print the window +function printWindow() { + window.print(); +} \ No newline at end of file diff --git a/WebContent/printing/printing_screen.css b/WebContent/printing/printing_screen.css deleted file mode 100644 index a1ae513f0..000000000 --- a/WebContent/printing/printing_screen.css +++ /dev/null @@ -1,105 +0,0 @@ -/* -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU AFFERO General Public License as published by -the Free Software Foundation; either version 3 of the License, or -any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU Affero General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -or see http://www.gnu.org/licenses/agpl.txt. -*/ - -/* OSRM CSS styles for printing*/ - - -/* printer button */ -.printer-inactive -{ - cursor:pointer; - width:16px; - height:16px; - background-image:url("../images/printer_inactive.png"); -} -.printer -{ - cursor:pointer; - width:16px; - height:16px; - background-image:url("../images/printer.png"); -} -.printer:hover -{ - background-image:url("../images/printer_hover.png"); -} -.printer:active -{ - background-image:url("../images/printer_active.png"); -} - -/* route summary */ -.route-summary -{ - font-size: 12px; -} - -/* route description box */ -#description -{ - position:absolute; - bottom:15px; - top:60px; - width:380px; - font-size:12px; - margin:5px; -} -.results-table -{ - border-spacing:0px; -} -.results-odd -{ - background-color: #FAF3E9; //#ffffff; -} -.results-even -{ - background-color: #F2DE9C; //#ffffe0; -} -.result-items -{ - text-align:left; - vertical-align: middle; - width:100%; - padding-left:1px; - padding-right:1px; - padding-top:1px; - padding-bottom:1px; -} -.result-direction -{ - width:30px; - padding-left:1px; - padding-right:1px; - padding-top:1px; - padding-bottom:1px; -} -.result-distance -{ - text-align:right; - vertical-align: middle; - width:30px; - padding-left:1px; - padding-right:1px; - padding-top:1px; - padding-bottom:1px; -} -.result-item -{ - cursor:pointer; - color:#000000 -} diff --git a/WebContent/routing/OSRM.RoutingDescription.js b/WebContent/routing/OSRM.RoutingDescription.js index d7c9a5e78..17513c256 100644 --- a/WebContent/routing/OSRM.RoutingDescription.js +++ b/WebContent/routing/OSRM.RoutingDescription.js @@ -154,9 +154,9 @@ getDrivingInstructionIcon: function(server_instruction_id) { local_icon_id += server_instruction_id; if( OSRM.G.images[local_icon_id] ) - return OSRM.G.images[local_icon_id].src; + return OSRM.G.images[local_icon_id].getAttribute("src"); else - return OSRM.G.images["direction_0"].src; + return OSRM.G.images["direction_0"].getAttribute("src"); }, // retrieve driving instructions from instruction ids