From c59a6f94448b9280423f88abd1437449b84d32bb Mon Sep 17 00:00:00 2001 From: shiin Date: Sun, 22 Apr 2012 23:48:43 +0200 Subject: [PATCH 01/16] reorganized folders --- WebContent/OSRM.base.js | 29 --- WebContent/base/OSRM.Geocoder.js | 217 ++++++++++++++++ WebContent/base/OSRM.Map.js | 103 ++++++++ WebContent/base/OSRM.Markers.js | 281 +++++++++++++++++++++ WebContent/base/OSRM.Route.js | 193 ++++++++++++++ WebContent/base/OSRM.Via.js | 121 +++++++++ WebContent/gui/OSRM.GUI.js | 137 ++++++++++ WebContent/gui/OSRM.RoutingGUI.js | 114 +++++++++ WebContent/gui/leaflet/L.Bugfixes.js | 80 ++++++ WebContent/gui/leaflet/L.DashedPolyline.js | 60 +++++ WebContent/gui/leaflet/L.MouseMarker.js | 65 +++++ WebContent/gui/leaflet/L.SwitchableIcon.js | 115 +++++++++ WebContent/gui/leaflet/OSRM.MapView.js | 54 ++++ WebContent/main.html | 30 ++- WebContent/printing/printing.js | 2 +- WebContent/utils/OSRM.EventHandler.js | 61 +++++ WebContent/utils/OSRM.JSONP.js | 104 ++++++++ WebContent/utils/OSRM.Utils.js | 67 +++++ WebContent/utils/OSRM.browsers.js | 66 +++++ WebContent/utils/OSRM.classes.js | 47 ++++ WebContent/utils/OSRM.debug.js | 66 +++++ 21 files changed, 1968 insertions(+), 44 deletions(-) create mode 100644 WebContent/base/OSRM.Geocoder.js create mode 100644 WebContent/base/OSRM.Map.js create mode 100644 WebContent/base/OSRM.Markers.js create mode 100644 WebContent/base/OSRM.Route.js create mode 100644 WebContent/base/OSRM.Via.js create mode 100644 WebContent/gui/OSRM.GUI.js create mode 100644 WebContent/gui/OSRM.RoutingGUI.js create mode 100644 WebContent/gui/leaflet/L.Bugfixes.js create mode 100644 WebContent/gui/leaflet/L.DashedPolyline.js create mode 100644 WebContent/gui/leaflet/L.MouseMarker.js create mode 100644 WebContent/gui/leaflet/L.SwitchableIcon.js create mode 100644 WebContent/gui/leaflet/OSRM.MapView.js create mode 100644 WebContent/utils/OSRM.EventHandler.js create mode 100644 WebContent/utils/OSRM.JSONP.js create mode 100644 WebContent/utils/OSRM.Utils.js create mode 100644 WebContent/utils/OSRM.browsers.js create mode 100644 WebContent/utils/OSRM.classes.js create mode 100644 WebContent/utils/OSRM.debug.js diff --git a/WebContent/OSRM.base.js b/WebContent/OSRM.base.js index 492f210c0..783282ae4 100644 --- a/WebContent/OSRM.base.js +++ b/WebContent/OSRM.base.js @@ -26,32 +26,3 @@ OSRM.DEFAULTS = {}; OSRM.GLOBALS = {}; OSRM.G = OSRM.GLOBALS; // abbreviations OSRM.C = OSRM.CONSTANTS; - - -// declare one class to be a subclass of another class -// (runs anonymous function to prevent local functions cluttering global namespace) -(function() { -var _inheritFromHelper = function() {}; -OSRM.inheritFrom = function( sub_class, base_class ) { - _inheritFromHelper.prototype = base_class.prototype; - sub_class.prototype = new _inheritFromHelper(); - sub_class.prototype.constructor = sub_class; - sub_class.prototype.base = base_class.prototype; -}; -}()); - - -// extend prototypes of a class -> used to add member values and functions -OSRM.extend = function( target_class, properties ) { - for( property in properties ) { - target_class.prototype[property] = properties[property]; - } -}; - - -// [usage of convenience functions] -// SubClass = function() { -// SubClass.prototype.base.constructor.apply(this, arguments); -// } -// OSRM.inheritFrom( SubClass, BaseClass ); -// OSRM.extend( SubClass, { property:value } ); diff --git a/WebContent/base/OSRM.Geocoder.js b/WebContent/base/OSRM.Geocoder.js new file mode 100644 index 000000000..4790f734d --- /dev/null +++ b/WebContent/base/OSRM.Geocoder.js @@ -0,0 +1,217 @@ +/* +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 geocoding routines +// [geocoder query, management and display of geocoder results] + +// some constants +OSRM.CONSTANTS.SOURCE_LABEL = "source"; +OSRM.CONSTANTS.TARGET_LABEL = "target"; +OSRM.CONSTANTS.VIA_LABEL = "via"; +OSRM.CONSTANTS.DO_FALLBACK_TO_LAT_LNG = true; + + +OSRM.Geocoder = { + +//[normal geocoding] + +// process input request and call geocoder if needed +call: function(marker_id, query) { + if(query=="") + return; + + //geo coordinates given -> directly draw results + if(query.match(/^\s*[-+]?[0-9]*\.?[0-9]+\s*[,;]\s*[-+]?[0-9]*\.?[0-9]+\s*$/)){ + var coord = query.split(/[,;]/); + OSRM.Geocoder._onclickResult(marker_id, coord[0], coord[1]); + OSRM.Geocoder.updateAddress( marker_id ); + return; + } + + //build request for geocoder + var call = OSRM.DEFAULTS.HOST_GEOCODER_URL + "?format=json&json_callback=%jsonp" + OSRM.DEFAULTS.GEOCODER_BOUNDS + "&accept-language="+OSRM.Localization.current_language+"&q=" + query; + OSRM.JSONP.call( call, OSRM.Geocoder._showResults, OSRM.Geocoder._showResults_Timeout, OSRM.DEFAULTS.JSONP_TIMEOUT, "geocoder_"+marker_id, {marker_id:marker_id,query:query} ); +}, + + +// helper function for clicks on geocoder search results +_onclickResult: function(marker_id, lat, lon) { + var index; + if( marker_id == OSRM.C.SOURCE_LABEL ) + index = OSRM.G.markers.setSource( new L.LatLng(lat, lon) ); + else if( marker_id == OSRM.C.TARGET_LABEL ) + index = OSRM.G.markers.setTarget( new L.LatLng(lat, lon) ); + else + return; + + OSRM.G.markers.route[index].show(); + OSRM.G.markers.route[index].centerView(); + if( OSRM.G.markers.route.length > 1 ) + OSRM.Routing.getRoute(); +}, + + +// process geocoder response +_showResults: function(response, parameters) { + if(!response){ + OSRM.Geocoder._showResults_Empty(parameters); + return; + } + + if(response.length == 0) { + OSRM.Geocoder._showResults_Empty(parameters); + return; + } + + // show first result + OSRM.Geocoder._onclickResult(parameters.marker_id, response[0].lat, response[0].lon); + if( OSRM.G.markers.route.length > 1 ) // if a route is displayed, we don't need to show other possible geocoding results + return; + + // show possible results for input + var html = ""; + html += ''; + for(var i=0; i < response.length; i++){ + var result = response[i]; + + //odd or even ? + var rowstyle='results-odd'; + if(i%2==0) { rowstyle='results-even'; } + + html += ''; + html += ''; + html += '"; + } + html += '
'+(i+1)+'.'; + + if(result.display_name){ + html += '
'+result.display_name+'
'; + } + html += "
'; + + document.getElementById('information-box-header').innerHTML = + "
"+OSRM.loc("SEARCH_RESULTS")+"
" + + "
("+OSRM.loc("FOUND_X_RESULTS").replace(/%i/,response.length)+")
"; + "
(found "+response.length+" results)"+"
"; + document.getElementById('information-box').innerHTML = html; +}, +_showResults_Empty: function(parameters) { + document.getElementById('information-box-header').innerHTML = + "
"+OSRM.loc("SEARCH_RESULTS")+"
" + + "
("+OSRM.loc("FOUND_X_RESULTS").replace(/%i/,0)+")
"; + if(parameters.marker_id == OSRM.C.SOURCE_LABEL) + document.getElementById('information-box').innerHTML = "
"+OSRM.loc("NO_RESULTS_FOUND_SOURCE")+": "+parameters.query +"
"; + else if(parameters.marker_id == OSRM.C.TARGET_LABEL) + document.getElementById('information-box').innerHTML = "
"+OSRM.loc("NO_RESULTS_FOUND_TARGET")+": "+parameters.query +"
"; + else + document.getElementById('information-box').innerHTML = "
"+OSRM.loc("NO_RESULTS_FOUND")+": "+parameters.query +"
"; +}, +_showResults_Timeout: function() { + document.getElementById('information-box-header').innerHTML = + "
"+OSRM.loc("SEARCH_RESULTS")+"
" + + "
("+OSRM.loc("FOUND_X_RESULTS").replace(/%i/,0)+")
"; + document.getElementById('information-box').innerHTML = "
"+OSRM.loc("TIMED_OUT")+"
"; +}, + + +// [reverse geocoding] + +//update geo coordinates in input boxes +updateLocation: function(marker_id) { + if (marker_id == OSRM.C.SOURCE_LABEL && OSRM.G.markers.hasSource()) { + document.getElementById("gui-input-source").value = OSRM.G.markers.route[0].getLat().toFixed(6) + ", " + OSRM.G.markers.route[0].getLng().toFixed(6); + } else if (marker_id == OSRM.C.TARGET_LABEL && OSRM.G.markers.hasTarget()) { + document.getElementById("gui-input-target").value = OSRM.G.markers.route[OSRM.G.markers.route.length-1].getLat().toFixed(6) + ", " + OSRM.G.markers.route[OSRM.G.markers.route.length-1].getLng().toFixed(6); + } +}, + + +// update address in input boxes +updateAddress: function(marker_id, do_fallback_to_lat_lng) { + // build request for reverse geocoder + var lat = null; + var lng = null; + + if(marker_id == OSRM.C.SOURCE_LABEL && OSRM.G.markers.hasSource()) { + lat = OSRM.G.markers.route[0].getLat(); + lng = OSRM.G.markers.route[0].getLng(); + } else if(marker_id == OSRM.C.TARGET_LABEL && OSRM.G.markers.hasTarget() ) { + lat = OSRM.G.markers.route[OSRM.G.markers.route.length-1].getLat(); + lng = OSRM.G.markers.route[OSRM.G.markers.route.length-1].getLng(); + } else + return; + + var call = OSRM.DEFAULTS.HOST_REVERSE_GEOCODER_URL + "?format=json&json_callback=%jsonp" + "&accept-language="+OSRM.Localization.current_language + "&lat=" + lat + "&lon=" + lng; + OSRM.JSONP.call( call, OSRM.Geocoder._showReverseResults, OSRM.Geocoder._showReverseResults_Timeout, OSRM.DEFAULTS.JSONP_TIMEOUT, "reverse_geocoder_"+marker_id, {marker_id:marker_id, do_fallback: do_fallback_to_lat_lng} ); +}, + + +// processing JSONP response of reverse geocoder +_showReverseResults: function(response, parameters) { + if(!response) { + OSRM.Geocoder._showReverseResults_Timeout(response, parameters); + return; + } + + if(response.address == undefined) { + OSRM.Geocoder._showReverseResults_Timeout(response, parameters); + return; + } + + // build reverse geocoding address + var used_address_data = 0; + var address = ""; + if( response.address.road) { + address += response.address.road; + used_address_data++; + } + if( response.address.city ) { + if( used_address_data > 0 ) + address += ", "; + address += response.address.city; + used_address_data++; + } else if( response.address.village ) { + if( used_address_data > 0 ) + address += ", "; + address += response.address.village; + used_address_data++; + } + if( used_address_data < 2 && response.address.country ) { + if( used_address_data > 0 ) + address += ", "; + address += response.address.country; + used_address_data++; + } + if( used_address_data == 0 ) { + OSRM.Geocoder._showReverseResults_Timeout(response, parameters); + return; + } + + // add result to DOM + if(parameters.marker_id == OSRM.C.SOURCE_LABEL && OSRM.G.markers.hasSource() ) + document.getElementById("gui-input-source").value = address; + else if(parameters.marker_id == OSRM.C.TARGET_LABEL && OSRM.G.markers.hasTarget() ) + document.getElementById("gui-input-target").value = address; +}, +_showReverseResults_Timeout: function(response, parameters) { + if(!parameters.do_fallback) + return; + + OSRM.Geocoder.updateLocation(parameters.marker_id); +} + +}; diff --git a/WebContent/base/OSRM.Map.js b/WebContent/base/OSRM.Map.js new file mode 100644 index 000000000..31685234a --- /dev/null +++ b/WebContent/base/OSRM.Map.js @@ -0,0 +1,103 @@ +/* +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 map handling +// [initialization, event handling, centering relative to UI] + +// will hold the map object +OSRM.GLOBALS.map = null; + + +// map controller +// [map initialization, event handling] +OSRM.Map = { + +// map initialization +init: function() { + // check if GUI is initialized! + if(OSRM.GUI.visible == null) + OSRM.GUI.init(); + + // setup tile servers + var tile_servers = OSRM.DEFAULTS.TILE_SERVERS; + var base_maps = {}; + for(var i=0, size=tile_servers.length; i routes are not hidden during zoom + fadeAnimation: false + }); + + // add layer control + var layersControl = new L.Control.Layers(base_maps, {}); + OSRM.G.map.addControl(layersControl); + + // move zoom markers + OSRM.Browser.getElementsByClassName(document,'leaflet-control-zoom')[0].style.left=(OSRM.GUI.width+10)+"px"; + OSRM.Browser.getElementsByClassName(document,'leaflet-control-zoom')[0].style.top="5px"; + + // map events + OSRM.G.map.on('zoomend', OSRM.Map.zoomed ); + OSRM.G.map.on('click', OSRM.Map.click ); + OSRM.G.map.on('contextmenu', OSRM.Map.contextmenu ); + OSRM.G.map.on('mousemove', OSRM.Map.mousemove ); +}, + +// init map position and zoom (respect UI visibility / use browser geolocation) +initPosition: function() { + var position = new L.LatLng( OSRM.DEFAULTS.ONLOAD_LATITUDE, OSRM.DEFAULTS.ONLOAD_LONGITUDE); + OSRM.G.map.setViewUI( position, OSRM.DEFAULTS.ONLOAD_ZOOM_LEVEL, true); + if (navigator.geolocation && document.URL.indexOf("file://") == -1) // convenience: FF does not save access rights for local files + navigator.geolocation.getCurrentPosition(OSRM.Map.geolocationResponse); +}, + +// map event handlers +zoomed: function(e) { + if(OSRM.G.dragging) + OSRM.Routing.getDragRoute(); + else + OSRM.Routing.getZoomRoute(); +}, +contextmenu: function(e) {;}, +mousemove: function(e) { OSRM.Via.drawDragMarker(e); }, +click: function(e) { + if( !OSRM.G.markers.hasSource() ) { + var index = OSRM.G.markers.setSource( e.latlng ); + OSRM.Geocoder.updateAddress( OSRM.C.SOURCE_LABEL, OSRM.C.DO_FALLBACK_TO_LAT_LNG ); + OSRM.G.markers.route[index].show(); + OSRM.G.markers.route[index].centerView( OSRM.G.map.getZoom() ); + OSRM.Routing.getRoute(); + } else if( !OSRM.G.markers.hasTarget() ) { + var index = OSRM.G.markers.setTarget( e.latlng ); + OSRM.Geocoder.updateAddress( OSRM.C.TARGET_LABEL, OSRM.C.DO_FALLBACK_TO_LAT_LNG ); + OSRM.G.markers.route[index].show(); + OSRM.G.markers.route[index].centerView( OSRM.G.map.getZoom() ); + OSRM.Routing.getRoute(); + } +}, +geolocationResponse: function(response) { + var latlng = new L.LatLng(response.coords.latitude, response.coords.longitude); + OSRM.G.map.setViewUI(latlng, OSRM.DEFAULTS.ZOOM_LEVEL ); +} +}; diff --git a/WebContent/base/OSRM.Markers.js b/WebContent/base/OSRM.Markers.js new file mode 100644 index 000000000..ccd2f975b --- /dev/null +++ b/WebContent/base/OSRM.Markers.js @@ -0,0 +1,281 @@ +/* +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 markers +// [base marker class, derived highlight marker and route marker classes, marker management] + + +// base marker class (wraps Leaflet markers) +OSRM.Marker = function( label, style, position ) { + this.label = label ? label : "marker"; + this.position = position ? position : new L.LatLng(0,0); + + this.marker = new L.MouseMarker( this.position, style ); + this.marker.parent = this; + + this.shown = false; + this.hint = null; +}; +OSRM.extend( OSRM.Marker,{ +show: function() { + OSRM.G.map.addLayer(this.marker); + this.shown = true; +}, +hide: function() { + OSRM.G.map.removeLayer(this.marker); + this.shown = false; +}, +setPosition: function( position ) { + this.position = position; + this.marker.setLatLng( position ); + this.hint = null; +}, +getPosition: function() { + return this.position; +}, +getLat: function() { + return this.position.lat; +}, +getLng: function() { + return this.position.lng; +}, +isShown: function() { + return this.shown; +}, +centerView: function(zoom) { + if( zoom == undefined ) + zoom = OSRM.DEFAULTS.ZOOM_LEVEL; + OSRM.G.map.setViewUI( this.position, zoom ); +}, +toString: function() { + return "OSRM.Marker: \""+this.label+"\", "+this.position+")"; +} +}); + + +// route marker class (draggable, invokes route drawing routines) +OSRM.RouteMarker = function ( label, style, position ) { + style.baseicon = style.icon; + OSRM.RouteMarker.prototype.base.constructor.apply( this, arguments ); + this.label = label ? label : "route_marker"; + + this.marker.on( 'click', this.onClick ); + this.marker.on( 'drag', this.onDrag ); + this.marker.on( 'dragstart', this.onDragStart ); + this.marker.on( 'dragend', this.onDragEnd ); +}; +OSRM.inheritFrom( OSRM.RouteMarker, OSRM.Marker ); +OSRM.extend( OSRM.RouteMarker, { +onClick: function(e) { + for( var i=0; i1) + OSRM.Routing.getDragRoute(); + OSRM.Geocoder.updateLocation( this.parent.label ); +}, +onDragStart: function(e) { + OSRM.G.dragging = true; + this.switchIcon(this.options.dragicon); + + // store id of dragged marker + for( var i=0; i this.route.length-2 ) + return -1; + + this.route.splice(id+1,0, new OSRM.RouteMarker(OSRM.C.VIA_LABEL, {draggable:true,icon:OSRM.G.icons['marker-via'],dragicon:OSRM.G.icons['marker-via-drag']}, position)); + return id+1; +}, +removeMarker: function(id) { + if( id >= this.route.length ) + return; + + // also remove vias if source or target are removed + if( id==0 && this.route[0].label == OSRM.C.SOURCE_LABEL ) { + this.removeVias(); + document.getElementById('gui-input-source').value = ""; + document.getElementById('information-box').innerHTML = ""; + document.getElementById('information-box-header').innerHTML = ""; + document.getElementById('gui-delete-source').style.visibility = "hidden"; + } else if( id == this.route.length-1 && this.route[ this.route.length-1 ].label == OSRM.C.TARGET_LABEL ) { + this.removeVias(); + id = this.route.length-1; + document.getElementById('gui-input-target').value = ""; + document.getElementById('information-box').innerHTML = ""; + document.getElementById('information-box-header').innerHTML = ""; + document.getElementById('gui-delete-target').style.visibility = "hidden"; + } + + this.route[id].hide(); + this.route.splice(id, 1); +}, +reverseMarkers: function() { + var size = this.route.length; + + // invert route, if a route is shown + if( size > 1 ) { + // switch positions in nodes + var temp_position = this.route[0].getPosition(); + this.route[0].setPosition( this.route[size-1].getPosition() ); + OSRM.G.markers.route[size-1].setPosition( temp_position ); + // switch nodes in array + var temp_node = OSRM.G.markers.route[0]; + OSRM.G.markers.route[0] = OSRM.G.markers.route[size-1]; + OSRM.G.markers.route[size-1] = temp_node; + // reverse route + OSRM.G.markers.route.reverse(); + // clear information (both delete markers stay visible) + document.getElementById('information-box').innerHTML = ""; + document.getElementById('information-box-header').innerHTML = ""; + + // invert marker, if only one marker is shown (implicit clear of information / delete markers) + } else if( size > 0 ) { + var position = this.route[0].getPosition(); + var label = this.route[0].label; + this.removeMarker(0); + if( label == OSRM.C.TARGET_LABEL ) + this.setSource( position ); + else if( label == OSRM.C.SOURCE_LABEL ) + this.setTarget( position ); + this.route[0].show(); + } + +}, +hasSource: function() { + if( OSRM.G.markers.route[0] && OSRM.G.markers.route[0].label == OSRM.C.SOURCE_LABEL ) + return true; + return false; +}, +hasTarget: function() { + if( OSRM.G.markers.route[OSRM.G.markers.route.length-1] && OSRM.G.markers.route[OSRM.G.markers.route.length-1].label == OSRM.C.TARGET_LABEL ) + return true; + return false; +} +}); diff --git a/WebContent/base/OSRM.Route.js b/WebContent/base/OSRM.Route.js new file mode 100644 index 000000000..54a1097e8 --- /dev/null +++ b/WebContent/base/OSRM.Route.js @@ -0,0 +1,193 @@ +/* +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 routes +// [drawing of all types of route geometry] + + +// simple route class (wraps Leaflet Polyline) +OSRM.SimpleRoute = function (label, style) { + this.label = (label ? label : "route"); + this.route = new L.DashedPolyline(); + this.route.setLatLngs( [] ); + if(style) this.route.setStyle( style ); + + this.shown = false; +}; +OSRM.extend( OSRM.SimpleRoute,{ +show: function() { + OSRM.G.map.addLayer(this.route); + this.shown = true; +}, +hide: function() { + OSRM.G.map.removeLayer(this.route); + this.shown = false; +}, +isShown: function() { + return this.shown; +}, +getPoints: function() { + return this.route._originalPoints; +}, +getPositions: function() { + return this.route.getLatLngs(); +}, +setPositions: function(positions) { + this.route.setLatLngs( positions ); +}, +setStyle: function(style) { + this.route.setStyle(style); +}, +centerView: function() { + var bounds = new L.LatLngBounds( this.getPositions() ); + OSRM.g.map.fitBoundsUI( bounds ); +}, +toString: function() { + return "OSRM.Route("+ this.label + ", " + this.route.getLatLngs().length + " points)"; +} +}); + + +// multiroute class (wraps Leaflet LayerGroup to hold several disjoint routes) +OSRM.MultiRoute = function (label) { + this.label = (label ? label : "multiroute"); + this.route = new L.LayerGroup(); + + this.shown = false; +}; +OSRM.extend( OSRM.MultiRoute,{ +show: function() { + OSRM.G.map.addLayer(this.route); + this.shown = true; +}, +hide: function() { + OSRM.G.map.removeLayer(this.route); + this.shown = false; +}, +isShown: function() { + return this.shown; +}, +addRoute: function(positions) { + var line = new L.DashedPolyline( positions ); + line.on('click', function(e) { OSRM.G.route.fire('click',e); }); + this.route.addLayer( line ); +}, +clearRoutes: function() { + this.route.clearLayers(); +}, +setStyle: function(style) { + this.route.invoke('setStyle', style); +}, +toString: function() { + return "OSRM.MultiRoute("+ this.label + ")"; +} +}); + + +// route management (handles drawing of route geometry - current route, old route, unnamed route, highlight unnamed streets) +// [this holds the route geometry] +OSRM.Route = function() { + this._current_route = new OSRM.SimpleRoute("current" , {dashed:false} ); + this._old_route = new OSRM.SimpleRoute("old", {dashed:false,color:"#123"} ); + this._unnamed_route = new OSRM.MultiRoute("unnamed"); + + this._current_route_style = {dashed:false,color:'#0033FF', weight:5}; + this._current_noroute_style = {dashed:true, color:'#222222', weight:2}; + this._old_route_style = {dashed:false,color:'#112233', weight:5}; + this._old_noroute_style = {dashed:true, color:'#000000', weight:2}; + this._unnamed_route_style = {dashed:false, color:'#FF00FF', weight:10}; + this._old_unnamed_route_style = {dashed:false, color:'#990099', weight:10}; + + this._noroute = OSRM.Route.ROUTE; +}; +OSRM.Route.NOROUTE = true; +OSRM.Route.ROUTE = false; +OSRM.extend( OSRM.Route,{ + + showRoute: function(positions, noroute) { + this._noroute = noroute; + this._current_route.setPositions( positions ); + if ( this._noroute == OSRM.Route.NOROUTE ) + this._current_route.setStyle( this._current_noroute_style ); + else + this._current_route.setStyle( this._current_route_style ); + this._current_route.show(); + //this._raiseUnnamedRoute(); + }, + hideRoute: function() { + this._current_route.hide(); + this._unnamed_route.hide(); + }, + hideAll: function() { + this._current_route.hide(); + this._unnamed_route.hide(); + this._old_route.hide(); + this._noroute = OSRM.Route.ROUTE; + }, + + showUnnamedRoute: function(positions) { + this._unnamed_route.clearRoutes(); + for(var i=0; i easier way in will be available Leaflet 0.4 + _raiseUnnamedRoute: function() { + if(this._unnamed_route.isShown()) { + this._unnamed_route.hide(); + this._unnamed_route.show(); + } + }, + showOldRoute: function() { + this._old_route.setPositions( this._current_route.getPositions() ); + if ( this._noroute == OSRM.Route.NOROUTE) + this._old_route.setStyle( this._old_noroute_style ); + else + this._old_route.setStyle( this._old_route_style ); + this._old_route.show(); + this._raiseUnnamedRoute(); + // change color of unnamed route highlighting - no separate object as dragged route does not have unnamed route highlighting + this._unnamed_route.setStyle( this._old_unnamed_route_style ); + }, + hideOldRoute: function() { + this._old_route.hide(); + }, + + isShown: function() { + return this._current_route.isShown(); + }, + isRoute: function() { + return !(this._noroute); + }, + getPositions: function() { + return this._current_route.getPositions(); + }, + getPoints: function() { + return this._current_route.getPoints(); + }, + fire: function(type,event) { + this._current_route.route.fire(type,event); + }, + centerView: function() { + this._current_route.centerView(); + } +}); diff --git a/WebContent/base/OSRM.Via.js b/WebContent/base/OSRM.Via.js new file mode 100644 index 000000000..9775d3b3d --- /dev/null +++ b/WebContent/base/OSRM.Via.js @@ -0,0 +1,121 @@ +/* +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 via marker routines +// [find correct position for a via marker] + +// store location of via points returned by server +OSRM.GLOBALS.via_points = []; + + +OSRM.Via = { + +// find route segment of current route geometry that is closest to the new via node (marked by index of its endpoint) +_findNearestRouteSegment: function( new_via ) { + var min_dist = Number.MAX_VALUE; + var min_index = undefined; + + var p = OSRM.G.map.latLngToLayerPoint( new_via ); + var positions = OSRM.G.route.getPoints(); + for(var i=1; i nearest_index) { + new_via_index = i; + break; + } + } + + // add via node + return new_via_index; +}, + + +//function that draws a drag marker +dragTimer: new Date(), + +drawDragMarker: function(event) { + if( OSRM.G.route.isShown() == false) + return; + if( OSRM.G.dragging == true ) + return; + + // throttle computation + if( (new Date() - OSRM.Via.dragTimer) < 25 ) + return; + OSRM.Via.dragTimer = new Date(); + + // get distance to route + var minpoint = OSRM.G.route._current_route.route.closestLayerPoint( event.layerPoint ); + var min_dist = minpoint ? minpoint._sqDist : 1000; + + // get distance to markers + var mouse = event.latlng; + for(var i=0, size=OSRM.G.markers.route.length; i 0) { + t = ((p.x - x) * dx + (p.y - y) * dy) / dot; + + if (t > 1) { + x = p2.x; + y = p2.y; + } else if (t > 0) { + x += dx * t; + y += dy * t; + } + } + + dx = p.x - x; + dy = p.y - y; + + // DS_CHANGE: modified return values + if(sqDist) + return dx*dx + dy*dy; + else { + var p = new L.Point(x,y); + p._sqDist = dx*dx + dy*dy; + return p; + } +}; + + +// makes requestAnimFrame respect the immediate paramter -> prevents drag events after dragend events +// (alternatively: add if(!this.dragging ) return to L.Draggable._updatePosition, but must be done in leaflet.js!) +// [TODO: In Leaflet 0.4 use L.Util.cancelAnimFrame(this._animRequest) in L.Draggable._onUp() instead, also has to be done in leaflet.js!] +L.Util.requestAnimFrame = (function () { + function timeoutDefer(callback) { + window.setTimeout(callback, 1000 / 60); + } + + var requestFn = window.requestAnimationFrame || + window.webkitRequestAnimationFrame || + window.mozRequestAnimationFrame || + window.oRequestAnimationFrame || + window.msRequestAnimationFrame || + timeoutDefer; + + return function (callback, context, immediate, contextEl) { + callback = context ? L.Util.bind(callback, context) : callback; + if (immediate ) { // DS_CHANGE: removed additional condition requestFn === timeoutDefer + callback(); + } else { + requestFn(callback, contextEl); + } + }; +}()); diff --git a/WebContent/gui/leaflet/L.DashedPolyline.js b/WebContent/gui/leaflet/L.DashedPolyline.js new file mode 100644 index 000000000..875d89ce6 --- /dev/null +++ b/WebContent/gui/leaflet/L.DashedPolyline.js @@ -0,0 +1,60 @@ +/* +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. +*/ + +// Leaflet extension: Dashed Polyline +// [adds dashed optionally dashed lines when using SVG or VML rendering] + + +// dashed polyline class +L.DashedPolyline = L.Polyline.extend({ + initialize: function(latlngs, options) { + L.Polyline.prototype.initialize.call(this, latlngs, options); + }, + + options: { + dashed: true + } +}); + + +// svg rendering +L.DashedPolyline = !L.Browser.svg ? L.DashedPolyline : L.DashedPolyline.extend({ + _updateStyle: function () { + L.Polyline.prototype._updateStyle.call(this); + if (this.options.stroke) { + if (this.options.dashed == true) + this._path.setAttribute('stroke-dasharray', '8,6'); + else + this._path.setAttribute('stroke-dasharray', ''); + } + } +}); + + +// vml rendering +L.DashedPolyline = L.Browser.svg || !L.Browser.vml ? L.DashedPolyline : L.DashedPolyline.extend({ + _updateStyle: function () { + L.Polyline.prototype._updateStyle.call(this); + if (this.options.stroke) { + if (this.options.dashed == true) + this._stroke.dashstyle = "dash"; + else + this._stroke.dashstyle = "solid"; + } + } + +}); diff --git a/WebContent/gui/leaflet/L.MouseMarker.js b/WebContent/gui/leaflet/L.MouseMarker.js new file mode 100644 index 000000000..f15c79b19 --- /dev/null +++ b/WebContent/gui/leaflet/L.MouseMarker.js @@ -0,0 +1,65 @@ +/* +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. +*/ + +// Leaflet extension: MouseMarker +// [marker class that propagates modifier and button presses in mouse click events and allows for changing icons] + + +// extended marker class +L.MouseMarker = L.Marker.extend({ + initialize: function (latlng, options) { + L.Marker.prototype.initialize.apply(this, arguments); + }, + + switchIcon: function( icon ) { + this.options.icon = icon; + + if (this._map) { + this._changeIcon(); + this._reset(); + } + }, + + _changeIcon: function () { + var options = this.options; + + if (this._icon) { + this._icon = options.icon.switchIcon( this._icon ); + if (this.options.clickable) // TODO: only needed until Leaflet 0.4 + this._icon.className += ' leaflet-clickable'; + } + + var panes = this._map._panes; + + if (this._shadow) + panes.shadowPane.removeChild(this._shadow); + this._shadow = options.icon.createShadow(); + if (this._shadow) + panes.shadowPane.appendChild(this._shadow); + }, + + _onMouseClick: function (e) { + L.DomEvent.stopPropagation(e); + if (this.dragging && this.dragging.moved()) { return; } + this.fire(e.type, { + altKey: e.altKey, + ctrlKey: e.ctrlKey, + shiftKey: e.shiftKey, + button: e.button + }); + } +}); \ No newline at end of file diff --git a/WebContent/gui/leaflet/L.SwitchableIcon.js b/WebContent/gui/leaflet/L.SwitchableIcon.js new file mode 100644 index 000000000..8a93d863e --- /dev/null +++ b/WebContent/gui/leaflet/L.SwitchableIcon.js @@ -0,0 +1,115 @@ +/* +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. +*/ + +// Leaflet extension: SwitchableIcon +// [will be an extension of L.Icon in Leaflet 0.4, for now it is a copy with added functionality] + + +// icon class with functions to simply switch the icon images +L.SwitchableIcon = L.Class.extend({ + options: { + /* + iconUrl: (String) (required) + iconSize: (Point) (can be set through CSS) + iconAnchor: (Point) (centered by default if size is specified, can be set in CSS with negative margins) + popupAnchor: (Point) (if not specified, popup opens in the anchor point) + shadowUrl: (Point) (no shadow by default) + shadowSize: (Point) + */ + className: '' + }, + + initialize: function (options) { + L.Util.setOptions(this, options); + }, + + createIcon: function () { + return this._createIcon('icon'); + }, + + createShadow: function () { + return this.options.shadowUrl ? this._createIcon('shadow') : null; + }, + + _createIcon: function (name) { + var img = this._createImg(this.options[name + 'Url']); + this._setIconStyles(img, name); + return img; + }, + + _setIconStyles: function (img, name) { + var options = this.options, + size = options[name + 'Size'], + anchor = options.iconAnchor; + + if (!anchor && size) { + anchor = size.divideBy(2, true); + } + + if (name === 'shadow' && anchor && options.shadowOffset) { + anchor._add(options.shadowOffset); + } + + img.className = 'leaflet-marker-' + name + ' ' + options.className; + + if (anchor) { + img.style.marginLeft = (-anchor.x) + 'px'; + img.style.marginTop = (-anchor.y) + 'px'; + } + + if (size) { + img.style.width = size.x + 'px'; + img.style.height = size.y + 'px'; + } + }, + + _createImg: function (src) { + var el; + if (!L.Browser.ie6) { + el = document.createElement('img'); + el.src = src; + } else { + el = document.createElement('div'); + el.style.filter = 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src="' + src + '")'; + } + return el; + }, + + // new functions start here + switchIcon: function (el) { + return this._switchIcon('icon', el); + }, + + switchShadow: function (el) { + return this.options.shadowUrl ? this._switchIcon('shadow', el) : null; + }, + + _switchIcon: function (name, el) { + var img = this._switchImg(this.options[name + 'Url'], el); + this._setIconStyles(img, name); + return img; + }, + + _switchImg: function (src, el) { + if (!L.Browser.ie6) { + el.src = src; + } else { + el.style.filter = 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src="' + src + '")'; + } + return el; + } +}); diff --git a/WebContent/gui/leaflet/OSRM.MapView.js b/WebContent/gui/leaflet/OSRM.MapView.js new file mode 100644 index 000000000..3492fe93a --- /dev/null +++ b/WebContent/gui/leaflet/OSRM.MapView.js @@ -0,0 +1,54 @@ +/* +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. +*/ + +// map view/model +// [extending Leaflet L.Map with setView/fitBounds methods that respect UI visibility] +L.MapView = L.Map.extend({ + setViewUI: function(position, zoom, no_animation) { + if( OSRM.GUI.visible == true ) { + var point = this.project( position, zoom); + point.x-=OSRM.GUI.width/2; + position = this.unproject(point,zoom); + } + this.setView( position, zoom, no_animation); + }, + fitBoundsUI: function(bounds) { + var southwest = bounds.getSouthWest(); + var northeast = bounds.getNorthEast(); + var zoom = this.getBoundsZoom(bounds); + var sw_point = this.project( southwest, zoom); + if( OSRM.GUI.visible == true ) + sw_point.x-=OSRM.GUI.width+20; + else + sw_point.x-=20; + sw_point.y+=20; + var ne_point = this.project( northeast, zoom); + ne_point.y-=20; + sw_point.x+=20; + bounds.extend( this.unproject(sw_point,zoom) ); + bounds.extend( this.unproject(ne_point,zoom) ); + this.fitBounds( bounds ); + }, + getCenterUI: function(unbounded) { + var viewHalf = this.getSize(); + if( OSRM.GUI.visible == true ) + viewHalf.x += OSRM.GUI.width; + var centerPoint = this._getTopLeftPoint().add(viewHalf.divideBy(2)); + + return this.unproject(centerPoint, this._zoom, unbounded); + } +}); diff --git a/WebContent/main.html b/WebContent/main.html index 4e5c73267..8f0c4428b 100644 --- a/WebContent/main.html +++ b/WebContent/main.html @@ -36,35 +36,37 @@ or see http://www.gnu.org/licenses/agpl.txt. - - - - + + + + + - + + - - + + - - + + - + - - + + - + - + diff --git a/WebContent/printing/printing.js b/WebContent/printing/printing.js index 8303bba42..37a3d845c 100644 --- a/WebContent/printing/printing.js +++ b/WebContent/printing/printing.js @@ -27,7 +27,7 @@ OSRM.G = OSRM.GLOBALS; 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", { + OSRM.G.map = new L.MapView("overview-map", { center: new L.LatLng(51.505, -0.09), zoom: 13, zoomAnimation: false, diff --git a/WebContent/utils/OSRM.EventHandler.js b/WebContent/utils/OSRM.EventHandler.js new file mode 100644 index 000000000..a43033505 --- /dev/null +++ b/WebContent/utils/OSRM.EventHandler.js @@ -0,0 +1,61 @@ +/* +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 EventHandler +// [adds simple event handling: other classes can derive from this class to acquire custom event handling] + + +OSRM.EventHandler = function() { + this._listeners = {}; +}; + +OSRM.extend( OSRM.EventHandler, { + + // add listener + addListener: function(type, listener) { + if( this._listeners[type] == undefined) + this._listeners[type] = []; + this._listeners[type].push(listener); + }, + + //remove event listener + removeListener: function(type, listener) { + if( this._listeners[type] != undefined) { + for(var i=0; i= 100000){ return (parseInt(distance/1000))+' ' + 'km'; } + else if(distance >= 10000){ return (parseInt(distance/1000).toFixed(1))+' ' + 'km'; } + else if(distance >= 1000){ return (parseFloat(distance/1000).toFixed(2))+' ' + 'km'; } + else{ return distance+' ' + 'm'; } +}, + + +// [verification routines] + +// verify angles +isLatitude: function(value) { + if( value >=-90 && value <=90) + return true; + else + return false; +}, +isLongitude: function(value) { + if( value >=-180 && value <=180) + return true; + else + return false; +} + +}; \ No newline at end of file diff --git a/WebContent/utils/OSRM.browsers.js b/WebContent/utils/OSRM.browsers.js new file mode 100644 index 000000000..9247a60dd --- /dev/null +++ b/WebContent/utils/OSRM.browsers.js @@ -0,0 +1,66 @@ +/* +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 old/cross browser support +// [browser detection and routines for old/cross browser support] + + +// browser detection (runs anonymous function to prevent local variables cluttering global namespace) +(function() { + var useragent = navigator.userAgent; + + OSRM.Browser = { + FF3: useragent.search(/Firefox\/3/), + IE6_9: useragent.search(/MSIE (6|7|8|9)/) + }; +}()); + + +// compatibility tools + +//add document.head reference for older browsers +document.head = document.head || document.getElementsByTagName('head')[0]; + +// supply getElementsByClassName method for older browser +OSRM.Browser.getElementsByClassName = function( node, classname ) { + var a = []; + var re = new RegExp('(^| )'+classname+'( |$)'); + var els = node.getElementsByTagName("*"); + for(var i=0,j=els.length; i used to add member values and functions +OSRM.extend = function( target_class, properties ) { + for( property in properties ) { + target_class.prototype[property] = properties[property]; + } +}; + + +// [usage of convenience functions] +// SubClass = function() { +// SubClass.prototype.base.constructor.apply(this, arguments); +// } +// OSRM.inheritFrom( SubClass, BaseClass ); +// OSRM.extend( SubClass, { property:value } ); diff --git a/WebContent/utils/OSRM.debug.js b/WebContent/utils/OSRM.debug.js new file mode 100644 index 000000000..bce76898a --- /dev/null +++ b/WebContent/utils/OSRM.debug.js @@ -0,0 +1,66 @@ +/* +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. +*/ + +// debug code for OSRM +// [works better than console.log in older browsers and for logging event handling] + +OSRM.debug = {}; + + +// access functions +OSRM.debug.log = function(text) { + OSRM.debug.content.innerHTML += text + "
"; + OSRM.debug.content.scrollTop = OSRM.debug.content.scrollHeight; +}; +OSRM.debug.clear = function() { + OSRM.debug.content.innerHTML = ""; +}; + + +// add elements to DOM +OSRM.debug.init = function() { + //create DOM objects for debug output + var wrapper = document.createElement('div'); + wrapper.id = "OSRM.debug-wrapper"; + wrapper.className = "gui-wrapper"; + wrapper.style.cssText = "width:410px;height:95%;top:5px;right:50px;"; + + var box = document.createElement('div'); + box.id = "OSRM.debug-box"; + box.className = "gui-box"; + box.style.cssText = "width:390px;top:0px;bottom:0px;"; + + var clear = document.createElement('a'); + clear.id = "OSRM.debug-clear"; + clear.className = "button not-selectable"; + clear.innerHTML = "clear"; + clear.onclick = OSRM.debug.clear; + + OSRM.debug.content= document.createElement('div'); + OSRM.debug.content.id = "OSRM.debug-content"; + OSRM.debug.content.style.cssText = "position:absolute;bottom:0px;top:20px;width:380px;font-size:11px;overflow:auto;margin:5px;"; + + // add elements + document.body.appendChild(wrapper); + wrapper.appendChild(box); + box.appendChild(clear); + box.appendChild(OSRM.debug.content); +}; + + +// onload event +OSRM.Browser.onLoadHandler( OSRM.debug.init ); \ No newline at end of file From 087bb128474951f45718e44a3b3edeb2de7425d4 Mon Sep 17 00:00:00 2001 From: shiin Date: Mon, 23 Apr 2012 00:08:02 +0200 Subject: [PATCH 02/16] more file & folder restructuring --- WebContent/OSRM.EventHandler.js | 61 ---- WebContent/OSRM.GUI.js | 137 --------- WebContent/OSRM.Geocoder.js | 217 -------------- WebContent/OSRM.JSONP.js | 104 ------- WebContent/OSRM.Map.js | 142 --------- WebContent/OSRM.Markers.js | 281 ------------------ WebContent/OSRM.Route.js | 193 ------------ WebContent/OSRM.Utils.js | 67 ----- WebContent/OSRM.Via.js | 121 -------- WebContent/OSRM.browsers.js | 66 ---- WebContent/OSRM.debug.js | 66 ---- WebContent/base/OSRM.Map.js | 2 +- WebContent/base/OSRM.Markers.js | 154 +--------- .../base/{OSRM.Route.js => OSRM.Routes.js} | 86 +----- .../{gui => base}/leaflet/L.Bugfixes.js | 0 .../{gui => base}/leaflet/L.DashedPolyline.js | 0 .../{gui => base}/leaflet/L.MouseMarker.js | 0 .../{gui => base}/leaflet/L.SwitchableIcon.js | 0 .../leaflet => base/osrm}/OSRM.MapView.js | 2 +- WebContent/base/osrm/OSRM.Marker.js | 166 +++++++++++ WebContent/base/osrm/OSRM.Route.js | 98 ++++++ WebContent/main.html | 16 +- WebContent/printing/printing.html | 6 +- WebContent/printing/printing.js | 2 +- 24 files changed, 282 insertions(+), 1705 deletions(-) delete mode 100644 WebContent/OSRM.EventHandler.js delete mode 100644 WebContent/OSRM.GUI.js delete mode 100644 WebContent/OSRM.Geocoder.js delete mode 100644 WebContent/OSRM.JSONP.js delete mode 100644 WebContent/OSRM.Map.js delete mode 100644 WebContent/OSRM.Markers.js delete mode 100644 WebContent/OSRM.Route.js delete mode 100644 WebContent/OSRM.Utils.js delete mode 100644 WebContent/OSRM.Via.js delete mode 100644 WebContent/OSRM.browsers.js delete mode 100644 WebContent/OSRM.debug.js rename WebContent/base/{OSRM.Route.js => OSRM.Routes.js} (62%) rename WebContent/{gui => base}/leaflet/L.Bugfixes.js (100%) rename WebContent/{gui => base}/leaflet/L.DashedPolyline.js (100%) rename WebContent/{gui => base}/leaflet/L.MouseMarker.js (100%) rename WebContent/{gui => base}/leaflet/L.SwitchableIcon.js (100%) rename WebContent/{gui/leaflet => base/osrm}/OSRM.MapView.js (95%) create mode 100644 WebContent/base/osrm/OSRM.Marker.js create mode 100644 WebContent/base/osrm/OSRM.Route.js diff --git a/WebContent/OSRM.EventHandler.js b/WebContent/OSRM.EventHandler.js deleted file mode 100644 index a43033505..000000000 --- a/WebContent/OSRM.EventHandler.js +++ /dev/null @@ -1,61 +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 EventHandler -// [adds simple event handling: other classes can derive from this class to acquire custom event handling] - - -OSRM.EventHandler = function() { - this._listeners = {}; -}; - -OSRM.extend( OSRM.EventHandler, { - - // add listener - addListener: function(type, listener) { - if( this._listeners[type] == undefined) - this._listeners[type] = []; - this._listeners[type].push(listener); - }, - - //remove event listener - removeListener: function(type, listener) { - if( this._listeners[type] != undefined) { - for(var i=0; i directly draw results - if(query.match(/^\s*[-+]?[0-9]*\.?[0-9]+\s*[,;]\s*[-+]?[0-9]*\.?[0-9]+\s*$/)){ - var coord = query.split(/[,;]/); - OSRM.Geocoder._onclickResult(marker_id, coord[0], coord[1]); - OSRM.Geocoder.updateAddress( marker_id ); - return; - } - - //build request for geocoder - var call = OSRM.DEFAULTS.HOST_GEOCODER_URL + "?format=json&json_callback=%jsonp" + OSRM.DEFAULTS.GEOCODER_BOUNDS + "&accept-language="+OSRM.Localization.current_language+"&q=" + query; - OSRM.JSONP.call( call, OSRM.Geocoder._showResults, OSRM.Geocoder._showResults_Timeout, OSRM.DEFAULTS.JSONP_TIMEOUT, "geocoder_"+marker_id, {marker_id:marker_id,query:query} ); -}, - - -// helper function for clicks on geocoder search results -_onclickResult: function(marker_id, lat, lon) { - var index; - if( marker_id == OSRM.C.SOURCE_LABEL ) - index = OSRM.G.markers.setSource( new L.LatLng(lat, lon) ); - else if( marker_id == OSRM.C.TARGET_LABEL ) - index = OSRM.G.markers.setTarget( new L.LatLng(lat, lon) ); - else - return; - - OSRM.G.markers.route[index].show(); - OSRM.G.markers.route[index].centerView(); - if( OSRM.G.markers.route.length > 1 ) - OSRM.Routing.getRoute(); -}, - - -// process geocoder response -_showResults: function(response, parameters) { - if(!response){ - OSRM.Geocoder._showResults_Empty(parameters); - return; - } - - if(response.length == 0) { - OSRM.Geocoder._showResults_Empty(parameters); - return; - } - - // show first result - OSRM.Geocoder._onclickResult(parameters.marker_id, response[0].lat, response[0].lon); - if( OSRM.G.markers.route.length > 1 ) // if a route is displayed, we don't need to show other possible geocoding results - return; - - // show possible results for input - var html = ""; - html += ''; - for(var i=0; i < response.length; i++){ - var result = response[i]; - - //odd or even ? - var rowstyle='results-odd'; - if(i%2==0) { rowstyle='results-even'; } - - html += ''; - html += ''; - html += '"; - } - html += '
'+(i+1)+'.'; - - if(result.display_name){ - html += '
'+result.display_name+'
'; - } - html += "
'; - - document.getElementById('information-box-header').innerHTML = - "
"+OSRM.loc("SEARCH_RESULTS")+"
" + - "
("+OSRM.loc("FOUND_X_RESULTS").replace(/%i/,response.length)+")
"; - "
(found "+response.length+" results)"+"
"; - document.getElementById('information-box').innerHTML = html; -}, -_showResults_Empty: function(parameters) { - document.getElementById('information-box-header').innerHTML = - "
"+OSRM.loc("SEARCH_RESULTS")+"
" + - "
("+OSRM.loc("FOUND_X_RESULTS").replace(/%i/,0)+")
"; - if(parameters.marker_id == OSRM.C.SOURCE_LABEL) - document.getElementById('information-box').innerHTML = "
"+OSRM.loc("NO_RESULTS_FOUND_SOURCE")+": "+parameters.query +"
"; - else if(parameters.marker_id == OSRM.C.TARGET_LABEL) - document.getElementById('information-box').innerHTML = "
"+OSRM.loc("NO_RESULTS_FOUND_TARGET")+": "+parameters.query +"
"; - else - document.getElementById('information-box').innerHTML = "
"+OSRM.loc("NO_RESULTS_FOUND")+": "+parameters.query +"
"; -}, -_showResults_Timeout: function() { - document.getElementById('information-box-header').innerHTML = - "
"+OSRM.loc("SEARCH_RESULTS")+"
" + - "
("+OSRM.loc("FOUND_X_RESULTS").replace(/%i/,0)+")
"; - document.getElementById('information-box').innerHTML = "
"+OSRM.loc("TIMED_OUT")+"
"; -}, - - -// [reverse geocoding] - -//update geo coordinates in input boxes -updateLocation: function(marker_id) { - if (marker_id == OSRM.C.SOURCE_LABEL && OSRM.G.markers.hasSource()) { - document.getElementById("gui-input-source").value = OSRM.G.markers.route[0].getLat().toFixed(6) + ", " + OSRM.G.markers.route[0].getLng().toFixed(6); - } else if (marker_id == OSRM.C.TARGET_LABEL && OSRM.G.markers.hasTarget()) { - document.getElementById("gui-input-target").value = OSRM.G.markers.route[OSRM.G.markers.route.length-1].getLat().toFixed(6) + ", " + OSRM.G.markers.route[OSRM.G.markers.route.length-1].getLng().toFixed(6); - } -}, - - -// update address in input boxes -updateAddress: function(marker_id, do_fallback_to_lat_lng) { - // build request for reverse geocoder - var lat = null; - var lng = null; - - if(marker_id == OSRM.C.SOURCE_LABEL && OSRM.G.markers.hasSource()) { - lat = OSRM.G.markers.route[0].getLat(); - lng = OSRM.G.markers.route[0].getLng(); - } else if(marker_id == OSRM.C.TARGET_LABEL && OSRM.G.markers.hasTarget() ) { - lat = OSRM.G.markers.route[OSRM.G.markers.route.length-1].getLat(); - lng = OSRM.G.markers.route[OSRM.G.markers.route.length-1].getLng(); - } else - return; - - var call = OSRM.DEFAULTS.HOST_REVERSE_GEOCODER_URL + "?format=json&json_callback=%jsonp" + "&accept-language="+OSRM.Localization.current_language + "&lat=" + lat + "&lon=" + lng; - OSRM.JSONP.call( call, OSRM.Geocoder._showReverseResults, OSRM.Geocoder._showReverseResults_Timeout, OSRM.DEFAULTS.JSONP_TIMEOUT, "reverse_geocoder_"+marker_id, {marker_id:marker_id, do_fallback: do_fallback_to_lat_lng} ); -}, - - -// processing JSONP response of reverse geocoder -_showReverseResults: function(response, parameters) { - if(!response) { - OSRM.Geocoder._showReverseResults_Timeout(response, parameters); - return; - } - - if(response.address == undefined) { - OSRM.Geocoder._showReverseResults_Timeout(response, parameters); - return; - } - - // build reverse geocoding address - var used_address_data = 0; - var address = ""; - if( response.address.road) { - address += response.address.road; - used_address_data++; - } - if( response.address.city ) { - if( used_address_data > 0 ) - address += ", "; - address += response.address.city; - used_address_data++; - } else if( response.address.village ) { - if( used_address_data > 0 ) - address += ", "; - address += response.address.village; - used_address_data++; - } - if( used_address_data < 2 && response.address.country ) { - if( used_address_data > 0 ) - address += ", "; - address += response.address.country; - used_address_data++; - } - if( used_address_data == 0 ) { - OSRM.Geocoder._showReverseResults_Timeout(response, parameters); - return; - } - - // add result to DOM - if(parameters.marker_id == OSRM.C.SOURCE_LABEL && OSRM.G.markers.hasSource() ) - document.getElementById("gui-input-source").value = address; - else if(parameters.marker_id == OSRM.C.TARGET_LABEL && OSRM.G.markers.hasTarget() ) - document.getElementById("gui-input-target").value = address; -}, -_showReverseResults_Timeout: function(response, parameters) { - if(!parameters.do_fallback) - return; - - OSRM.Geocoder.updateLocation(parameters.marker_id); -} - -}; diff --git a/WebContent/OSRM.JSONP.js b/WebContent/OSRM.JSONP.js deleted file mode 100644 index cd039987c..000000000 --- a/WebContent/OSRM.JSONP.js +++ /dev/null @@ -1,104 +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 JSONP call wrapper -// [wrapper for JSONP calls with DOM cleaning, fencing, timout handling] - -OSRM.JSONP = { - - // storage to keep track of unfinished JSONP calls - fences: {}, - callbacks: {}, - timeouts: {}, - timers: {}, - - - // default callback routines - late: function() {}, - empty: function() {}, - - - // init JSONP call - call: function(source, callback_function, timeout_function, timeout, id, parameters) { - // only one active JSONP call per id - if (OSRM.JSONP.fences[id] == true) - return false; - OSRM.JSONP.fences[id] = true; - - // wrap timeout function - OSRM.JSONP.timeouts[id] = function(response) { - console.log("timeout",id); - try { - timeout_function(response, parameters); - } finally { - OSRM.JSONP.callbacks[id] = OSRM.JSONP.late; // clean functions - OSRM.JSONP.timeouts[id] = OSRM.JSONP.empty; - OSRM.JSONP.fences[id] = undefined; // clean fence - } - }; - - // wrap callback function - OSRM.JSONP.callbacks[id] = function(response) { - clearTimeout(OSRM.JSONP.timers[id]); // clear timeout timer - OSRM.JSONP.timers[id] = undefined; - - try { - callback_function(response, parameters); // actual wrapped callback - } finally { - OSRM.JSONP.callbacks[id] = OSRM.JSONP.empty; // clean functions - OSRM.JSONP.timeouts[id] = OSRM.JSONP.late; - OSRM.JSONP.fences[id] = undefined; // clean fence - } - }; - - // clean DOM - var jsonp = document.getElementById('jsonp_'+id); - if(jsonp) - jsonp.parentNode.removeChild(jsonp); - - // add script to DOM - var script = document.createElement('script'); - script.type = 'text/javascript'; - script.id = 'jsonp_'+id; - script.src = source.replace(/%jsonp/,"OSRM.JSONP.callbacks."+id); - document.head.appendChild(script); - - // start timeout timer - OSRM.JSONP.timers[id] = setTimeout(OSRM.JSONP.timeouts[id], timeout); - return true; - }, - - clear: function(id) { - clearTimeout(OSRM.JSONP.timers[id]); // clear timeout timer - OSRM.JSONP.callbacks[id] = OSRM.JSONP.empty; // clean functions - OSRM.JSONP.timeouts[id] = OSRM.JSONP.empty; - OSRM.JSONP.fences[id] = undefined; // clean fence - - // clean DOM - var jsonp = document.getElementById('jsonp_'+id); - if(jsonp) - jsonp.parentNode.removeChild(jsonp); - }, - - // reset all data - reset: function() { - OSRM.JSONP.fences = {}; - OSRM.JSONP.callbacks = {}; - OSRM.JSONP.timeouts = {}; - OSRM.JSONP.timers = {}; - } -}; diff --git a/WebContent/OSRM.Map.js b/WebContent/OSRM.Map.js deleted file mode 100644 index a9d60c421..000000000 --- a/WebContent/OSRM.Map.js +++ /dev/null @@ -1,142 +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 map handling -// [initialization, event handling, centering relative to UI] - -// will hold the map object -OSRM.GLOBALS.map = null; - - -// map view/model -// [extending Leaflet L.Map with setView/fitBounds methods that respect UI visibility] -OSRM.MapView = L.Map.extend({ - setViewUI: function(position, zoom, no_animation) { - if( OSRM.GUI.visible == true ) { - var point = this.project( position, zoom); - point.x-=OSRM.GUI.width/2; - position = this.unproject(point,zoom); - } - this.setView( position, zoom, no_animation); - }, - fitBoundsUI: function(bounds) { - var southwest = bounds.getSouthWest(); - var northeast = bounds.getNorthEast(); - var zoom = this.getBoundsZoom(bounds); - var sw_point = this.project( southwest, zoom); - if( OSRM.GUI.visible == true ) - sw_point.x-=OSRM.GUI.width+20; - else - sw_point.x-=20; - sw_point.y+=20; - var ne_point = this.project( northeast, zoom); - ne_point.y-=20; - sw_point.x+=20; - bounds.extend( this.unproject(sw_point,zoom) ); - bounds.extend( this.unproject(ne_point,zoom) ); - this.fitBounds( bounds ); - }, - getCenterUI: function(unbounded) { - var viewHalf = this.getSize(); - if( OSRM.GUI.visible == true ) - viewHalf.x += OSRM.GUI.width; - var centerPoint = this._getTopLeftPoint().add(viewHalf.divideBy(2)); - - return this.unproject(centerPoint, this._zoom, unbounded); - } -}); - - -// map controller -// [map initialization, event handling] -OSRM.Map = { - -// map initialization -init: function() { - // check if GUI is initialized! - if(OSRM.GUI.visible == null) - OSRM.GUI.init(); - - // setup tile servers - var tile_servers = OSRM.DEFAULTS.TILE_SERVERS; - var base_maps = {}; - for(var i=0, size=tile_servers.length; i routes are not hidden during zoom - fadeAnimation: false - }); - - // add layer control - var layersControl = new L.Control.Layers(base_maps, {}); - OSRM.G.map.addControl(layersControl); - - // move zoom markers - OSRM.Browser.getElementsByClassName(document,'leaflet-control-zoom')[0].style.left=(OSRM.GUI.width+10)+"px"; - OSRM.Browser.getElementsByClassName(document,'leaflet-control-zoom')[0].style.top="5px"; - - // map events - OSRM.G.map.on('zoomend', OSRM.Map.zoomed ); - OSRM.G.map.on('click', OSRM.Map.click ); - OSRM.G.map.on('contextmenu', OSRM.Map.contextmenu ); - OSRM.G.map.on('mousemove', OSRM.Map.mousemove ); -}, - -// init map position and zoom (respect UI visibility / use browser geolocation) -initPosition: function() { - var position = new L.LatLng( OSRM.DEFAULTS.ONLOAD_LATITUDE, OSRM.DEFAULTS.ONLOAD_LONGITUDE); - OSRM.G.map.setViewUI( position, OSRM.DEFAULTS.ONLOAD_ZOOM_LEVEL, true); - if (navigator.geolocation && document.URL.indexOf("file://") == -1) // convenience: FF does not save access rights for local files - navigator.geolocation.getCurrentPosition(OSRM.Map.geolocationResponse); -}, - -// map event handlers -zoomed: function(e) { - if(OSRM.G.dragging) - OSRM.Routing.getDragRoute(); - else - OSRM.Routing.getZoomRoute(); -}, -contextmenu: function(e) {;}, -mousemove: function(e) { OSRM.Via.drawDragMarker(e); }, -click: function(e) { - if( !OSRM.G.markers.hasSource() ) { - var index = OSRM.G.markers.setSource( e.latlng ); - OSRM.Geocoder.updateAddress( OSRM.C.SOURCE_LABEL, OSRM.C.DO_FALLBACK_TO_LAT_LNG ); - OSRM.G.markers.route[index].show(); - OSRM.G.markers.route[index].centerView( OSRM.G.map.getZoom() ); - OSRM.Routing.getRoute(); - } else if( !OSRM.G.markers.hasTarget() ) { - var index = OSRM.G.markers.setTarget( e.latlng ); - OSRM.Geocoder.updateAddress( OSRM.C.TARGET_LABEL, OSRM.C.DO_FALLBACK_TO_LAT_LNG ); - OSRM.G.markers.route[index].show(); - OSRM.G.markers.route[index].centerView( OSRM.G.map.getZoom() ); - OSRM.Routing.getRoute(); - } -}, -geolocationResponse: function(response) { - var latlng = new L.LatLng(response.coords.latitude, response.coords.longitude); - OSRM.G.map.setViewUI(latlng, OSRM.DEFAULTS.ZOOM_LEVEL ); -} -}; diff --git a/WebContent/OSRM.Markers.js b/WebContent/OSRM.Markers.js deleted file mode 100644 index ccd2f975b..000000000 --- a/WebContent/OSRM.Markers.js +++ /dev/null @@ -1,281 +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 markers -// [base marker class, derived highlight marker and route marker classes, marker management] - - -// base marker class (wraps Leaflet markers) -OSRM.Marker = function( label, style, position ) { - this.label = label ? label : "marker"; - this.position = position ? position : new L.LatLng(0,0); - - this.marker = new L.MouseMarker( this.position, style ); - this.marker.parent = this; - - this.shown = false; - this.hint = null; -}; -OSRM.extend( OSRM.Marker,{ -show: function() { - OSRM.G.map.addLayer(this.marker); - this.shown = true; -}, -hide: function() { - OSRM.G.map.removeLayer(this.marker); - this.shown = false; -}, -setPosition: function( position ) { - this.position = position; - this.marker.setLatLng( position ); - this.hint = null; -}, -getPosition: function() { - return this.position; -}, -getLat: function() { - return this.position.lat; -}, -getLng: function() { - return this.position.lng; -}, -isShown: function() { - return this.shown; -}, -centerView: function(zoom) { - if( zoom == undefined ) - zoom = OSRM.DEFAULTS.ZOOM_LEVEL; - OSRM.G.map.setViewUI( this.position, zoom ); -}, -toString: function() { - return "OSRM.Marker: \""+this.label+"\", "+this.position+")"; -} -}); - - -// route marker class (draggable, invokes route drawing routines) -OSRM.RouteMarker = function ( label, style, position ) { - style.baseicon = style.icon; - OSRM.RouteMarker.prototype.base.constructor.apply( this, arguments ); - this.label = label ? label : "route_marker"; - - this.marker.on( 'click', this.onClick ); - this.marker.on( 'drag', this.onDrag ); - this.marker.on( 'dragstart', this.onDragStart ); - this.marker.on( 'dragend', this.onDragEnd ); -}; -OSRM.inheritFrom( OSRM.RouteMarker, OSRM.Marker ); -OSRM.extend( OSRM.RouteMarker, { -onClick: function(e) { - for( var i=0; i1) - OSRM.Routing.getDragRoute(); - OSRM.Geocoder.updateLocation( this.parent.label ); -}, -onDragStart: function(e) { - OSRM.G.dragging = true; - this.switchIcon(this.options.dragicon); - - // store id of dragged marker - for( var i=0; i this.route.length-2 ) - return -1; - - this.route.splice(id+1,0, new OSRM.RouteMarker(OSRM.C.VIA_LABEL, {draggable:true,icon:OSRM.G.icons['marker-via'],dragicon:OSRM.G.icons['marker-via-drag']}, position)); - return id+1; -}, -removeMarker: function(id) { - if( id >= this.route.length ) - return; - - // also remove vias if source or target are removed - if( id==0 && this.route[0].label == OSRM.C.SOURCE_LABEL ) { - this.removeVias(); - document.getElementById('gui-input-source').value = ""; - document.getElementById('information-box').innerHTML = ""; - document.getElementById('information-box-header').innerHTML = ""; - document.getElementById('gui-delete-source').style.visibility = "hidden"; - } else if( id == this.route.length-1 && this.route[ this.route.length-1 ].label == OSRM.C.TARGET_LABEL ) { - this.removeVias(); - id = this.route.length-1; - document.getElementById('gui-input-target').value = ""; - document.getElementById('information-box').innerHTML = ""; - document.getElementById('information-box-header').innerHTML = ""; - document.getElementById('gui-delete-target').style.visibility = "hidden"; - } - - this.route[id].hide(); - this.route.splice(id, 1); -}, -reverseMarkers: function() { - var size = this.route.length; - - // invert route, if a route is shown - if( size > 1 ) { - // switch positions in nodes - var temp_position = this.route[0].getPosition(); - this.route[0].setPosition( this.route[size-1].getPosition() ); - OSRM.G.markers.route[size-1].setPosition( temp_position ); - // switch nodes in array - var temp_node = OSRM.G.markers.route[0]; - OSRM.G.markers.route[0] = OSRM.G.markers.route[size-1]; - OSRM.G.markers.route[size-1] = temp_node; - // reverse route - OSRM.G.markers.route.reverse(); - // clear information (both delete markers stay visible) - document.getElementById('information-box').innerHTML = ""; - document.getElementById('information-box-header').innerHTML = ""; - - // invert marker, if only one marker is shown (implicit clear of information / delete markers) - } else if( size > 0 ) { - var position = this.route[0].getPosition(); - var label = this.route[0].label; - this.removeMarker(0); - if( label == OSRM.C.TARGET_LABEL ) - this.setSource( position ); - else if( label == OSRM.C.SOURCE_LABEL ) - this.setTarget( position ); - this.route[0].show(); - } - -}, -hasSource: function() { - if( OSRM.G.markers.route[0] && OSRM.G.markers.route[0].label == OSRM.C.SOURCE_LABEL ) - return true; - return false; -}, -hasTarget: function() { - if( OSRM.G.markers.route[OSRM.G.markers.route.length-1] && OSRM.G.markers.route[OSRM.G.markers.route.length-1].label == OSRM.C.TARGET_LABEL ) - return true; - return false; -} -}); diff --git a/WebContent/OSRM.Route.js b/WebContent/OSRM.Route.js deleted file mode 100644 index 54a1097e8..000000000 --- a/WebContent/OSRM.Route.js +++ /dev/null @@ -1,193 +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 routes -// [drawing of all types of route geometry] - - -// simple route class (wraps Leaflet Polyline) -OSRM.SimpleRoute = function (label, style) { - this.label = (label ? label : "route"); - this.route = new L.DashedPolyline(); - this.route.setLatLngs( [] ); - if(style) this.route.setStyle( style ); - - this.shown = false; -}; -OSRM.extend( OSRM.SimpleRoute,{ -show: function() { - OSRM.G.map.addLayer(this.route); - this.shown = true; -}, -hide: function() { - OSRM.G.map.removeLayer(this.route); - this.shown = false; -}, -isShown: function() { - return this.shown; -}, -getPoints: function() { - return this.route._originalPoints; -}, -getPositions: function() { - return this.route.getLatLngs(); -}, -setPositions: function(positions) { - this.route.setLatLngs( positions ); -}, -setStyle: function(style) { - this.route.setStyle(style); -}, -centerView: function() { - var bounds = new L.LatLngBounds( this.getPositions() ); - OSRM.g.map.fitBoundsUI( bounds ); -}, -toString: function() { - return "OSRM.Route("+ this.label + ", " + this.route.getLatLngs().length + " points)"; -} -}); - - -// multiroute class (wraps Leaflet LayerGroup to hold several disjoint routes) -OSRM.MultiRoute = function (label) { - this.label = (label ? label : "multiroute"); - this.route = new L.LayerGroup(); - - this.shown = false; -}; -OSRM.extend( OSRM.MultiRoute,{ -show: function() { - OSRM.G.map.addLayer(this.route); - this.shown = true; -}, -hide: function() { - OSRM.G.map.removeLayer(this.route); - this.shown = false; -}, -isShown: function() { - return this.shown; -}, -addRoute: function(positions) { - var line = new L.DashedPolyline( positions ); - line.on('click', function(e) { OSRM.G.route.fire('click',e); }); - this.route.addLayer( line ); -}, -clearRoutes: function() { - this.route.clearLayers(); -}, -setStyle: function(style) { - this.route.invoke('setStyle', style); -}, -toString: function() { - return "OSRM.MultiRoute("+ this.label + ")"; -} -}); - - -// route management (handles drawing of route geometry - current route, old route, unnamed route, highlight unnamed streets) -// [this holds the route geometry] -OSRM.Route = function() { - this._current_route = new OSRM.SimpleRoute("current" , {dashed:false} ); - this._old_route = new OSRM.SimpleRoute("old", {dashed:false,color:"#123"} ); - this._unnamed_route = new OSRM.MultiRoute("unnamed"); - - this._current_route_style = {dashed:false,color:'#0033FF', weight:5}; - this._current_noroute_style = {dashed:true, color:'#222222', weight:2}; - this._old_route_style = {dashed:false,color:'#112233', weight:5}; - this._old_noroute_style = {dashed:true, color:'#000000', weight:2}; - this._unnamed_route_style = {dashed:false, color:'#FF00FF', weight:10}; - this._old_unnamed_route_style = {dashed:false, color:'#990099', weight:10}; - - this._noroute = OSRM.Route.ROUTE; -}; -OSRM.Route.NOROUTE = true; -OSRM.Route.ROUTE = false; -OSRM.extend( OSRM.Route,{ - - showRoute: function(positions, noroute) { - this._noroute = noroute; - this._current_route.setPositions( positions ); - if ( this._noroute == OSRM.Route.NOROUTE ) - this._current_route.setStyle( this._current_noroute_style ); - else - this._current_route.setStyle( this._current_route_style ); - this._current_route.show(); - //this._raiseUnnamedRoute(); - }, - hideRoute: function() { - this._current_route.hide(); - this._unnamed_route.hide(); - }, - hideAll: function() { - this._current_route.hide(); - this._unnamed_route.hide(); - this._old_route.hide(); - this._noroute = OSRM.Route.ROUTE; - }, - - showUnnamedRoute: function(positions) { - this._unnamed_route.clearRoutes(); - for(var i=0; i easier way in will be available Leaflet 0.4 - _raiseUnnamedRoute: function() { - if(this._unnamed_route.isShown()) { - this._unnamed_route.hide(); - this._unnamed_route.show(); - } - }, - showOldRoute: function() { - this._old_route.setPositions( this._current_route.getPositions() ); - if ( this._noroute == OSRM.Route.NOROUTE) - this._old_route.setStyle( this._old_noroute_style ); - else - this._old_route.setStyle( this._old_route_style ); - this._old_route.show(); - this._raiseUnnamedRoute(); - // change color of unnamed route highlighting - no separate object as dragged route does not have unnamed route highlighting - this._unnamed_route.setStyle( this._old_unnamed_route_style ); - }, - hideOldRoute: function() { - this._old_route.hide(); - }, - - isShown: function() { - return this._current_route.isShown(); - }, - isRoute: function() { - return !(this._noroute); - }, - getPositions: function() { - return this._current_route.getPositions(); - }, - getPoints: function() { - return this._current_route.getPoints(); - }, - fire: function(type,event) { - this._current_route.route.fire(type,event); - }, - centerView: function() { - this._current_route.centerView(); - } -}); diff --git a/WebContent/OSRM.Utils.js b/WebContent/OSRM.Utils.js deleted file mode 100644 index 9c4decdc7..000000000 --- a/WebContent/OSRM.Utils.js +++ /dev/null @@ -1,67 +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 utility functions -// [mixed functions] - - -OSRM.Utils = { - -// [human readabilty functions] - -// human readable time -secondsToTime: function(seconds){ - seconds = parseInt(seconds); - minutes = parseInt(seconds/60); - seconds = seconds%60; - hours = parseInt(minutes/60); - minutes = minutes%60; - if(hours==0){ - return minutes + ' ' + 'min'; - } - else{ - return hours + ' ' + 'h' + ' ' + minutes + ' ' + 'min'; - } -}, -//human readable distance -metersToDistance: function(distance){ - distance = parseInt(distance); - - if(distance >= 100000){ return (parseInt(distance/1000))+' ' + 'km'; } - else if(distance >= 10000){ return (parseInt(distance/1000).toFixed(1))+' ' + 'km'; } - else if(distance >= 1000){ return (parseFloat(distance/1000).toFixed(2))+' ' + 'km'; } - else{ return distance+' ' + 'm'; } -}, - - -// [verification routines] - -// verify angles -isLatitude: function(value) { - if( value >=-90 && value <=90) - return true; - else - return false; -}, -isLongitude: function(value) { - if( value >=-180 && value <=180) - return true; - else - return false; -} - -}; \ No newline at end of file diff --git a/WebContent/OSRM.Via.js b/WebContent/OSRM.Via.js deleted file mode 100644 index 9775d3b3d..000000000 --- a/WebContent/OSRM.Via.js +++ /dev/null @@ -1,121 +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 via marker routines -// [find correct position for a via marker] - -// store location of via points returned by server -OSRM.GLOBALS.via_points = []; - - -OSRM.Via = { - -// find route segment of current route geometry that is closest to the new via node (marked by index of its endpoint) -_findNearestRouteSegment: function( new_via ) { - var min_dist = Number.MAX_VALUE; - var min_index = undefined; - - var p = OSRM.G.map.latLngToLayerPoint( new_via ); - var positions = OSRM.G.route.getPoints(); - for(var i=1; i nearest_index) { - new_via_index = i; - break; - } - } - - // add via node - return new_via_index; -}, - - -//function that draws a drag marker -dragTimer: new Date(), - -drawDragMarker: function(event) { - if( OSRM.G.route.isShown() == false) - return; - if( OSRM.G.dragging == true ) - return; - - // throttle computation - if( (new Date() - OSRM.Via.dragTimer) < 25 ) - return; - OSRM.Via.dragTimer = new Date(); - - // get distance to route - var minpoint = OSRM.G.route._current_route.route.closestLayerPoint( event.layerPoint ); - var min_dist = minpoint ? minpoint._sqDist : 1000; - - // get distance to markers - var mouse = event.latlng; - for(var i=0, size=OSRM.G.markers.route.length; i"; - OSRM.debug.content.scrollTop = OSRM.debug.content.scrollHeight; -}; -OSRM.debug.clear = function() { - OSRM.debug.content.innerHTML = ""; -}; - - -// add elements to DOM -OSRM.debug.init = function() { - //create DOM objects for debug output - var wrapper = document.createElement('div'); - wrapper.id = "OSRM.debug-wrapper"; - wrapper.className = "gui-wrapper"; - wrapper.style.cssText = "width:410px;height:95%;top:5px;right:50px;"; - - var box = document.createElement('div'); - box.id = "OSRM.debug-box"; - box.className = "gui-box"; - box.style.cssText = "width:390px;top:0px;bottom:0px;"; - - var clear = document.createElement('a'); - clear.id = "OSRM.debug-clear"; - clear.className = "button not-selectable"; - clear.innerHTML = "clear"; - clear.onclick = OSRM.debug.clear; - - OSRM.debug.content= document.createElement('div'); - OSRM.debug.content.id = "OSRM.debug-content"; - OSRM.debug.content.style.cssText = "position:absolute;bottom:0px;top:20px;width:380px;font-size:11px;overflow:auto;margin:5px;"; - - // add elements - document.body.appendChild(wrapper); - wrapper.appendChild(box); - box.appendChild(clear); - box.appendChild(OSRM.debug.content); -}; - - -// onload event -OSRM.Browser.onLoadHandler( OSRM.debug.init ); \ No newline at end of file diff --git a/WebContent/base/OSRM.Map.js b/WebContent/base/OSRM.Map.js index 31685234a..01e8ec9a1 100644 --- a/WebContent/base/OSRM.Map.js +++ b/WebContent/base/OSRM.Map.js @@ -41,7 +41,7 @@ init: function() { } // setup map - OSRM.G.map = new L.MapView('map', { + OSRM.G.map = new OSRM.MapView('map', { center: new L.LatLng(OSRM.DEFAULTS.ONLOAD_LATITUDE, OSRM.DEFAULTS.ONLOAD_LONGITUDE), zoom: OSRM.DEFAULTS.ONLOAD_ZOOM_LEVEL, layers: [base_maps[tile_servers[0].display_name]], diff --git a/WebContent/base/OSRM.Markers.js b/WebContent/base/OSRM.Markers.js index ccd2f975b..09179abbb 100644 --- a/WebContent/base/OSRM.Markers.js +++ b/WebContent/base/OSRM.Markers.js @@ -15,159 +15,9 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA or see http://www.gnu.org/licenses/agpl.txt. */ -// OSRM markers -// [base marker class, derived highlight marker and route marker classes, marker management] - - -// base marker class (wraps Leaflet markers) -OSRM.Marker = function( label, style, position ) { - this.label = label ? label : "marker"; - this.position = position ? position : new L.LatLng(0,0); - - this.marker = new L.MouseMarker( this.position, style ); - this.marker.parent = this; - - this.shown = false; - this.hint = null; -}; -OSRM.extend( OSRM.Marker,{ -show: function() { - OSRM.G.map.addLayer(this.marker); - this.shown = true; -}, -hide: function() { - OSRM.G.map.removeLayer(this.marker); - this.shown = false; -}, -setPosition: function( position ) { - this.position = position; - this.marker.setLatLng( position ); - this.hint = null; -}, -getPosition: function() { - return this.position; -}, -getLat: function() { - return this.position.lat; -}, -getLng: function() { - return this.position.lng; -}, -isShown: function() { - return this.shown; -}, -centerView: function(zoom) { - if( zoom == undefined ) - zoom = OSRM.DEFAULTS.ZOOM_LEVEL; - OSRM.G.map.setViewUI( this.position, zoom ); -}, -toString: function() { - return "OSRM.Marker: \""+this.label+"\", "+this.position+")"; -} -}); - - -// route marker class (draggable, invokes route drawing routines) -OSRM.RouteMarker = function ( label, style, position ) { - style.baseicon = style.icon; - OSRM.RouteMarker.prototype.base.constructor.apply( this, arguments ); - this.label = label ? label : "route_marker"; - - this.marker.on( 'click', this.onClick ); - this.marker.on( 'drag', this.onDrag ); - this.marker.on( 'dragstart', this.onDragStart ); - this.marker.on( 'dragend', this.onDragEnd ); -}; -OSRM.inheritFrom( OSRM.RouteMarker, OSRM.Marker ); -OSRM.extend( OSRM.RouteMarker, { -onClick: function(e) { - for( var i=0; i1) - OSRM.Routing.getDragRoute(); - OSRM.Geocoder.updateLocation( this.parent.label ); -}, -onDragStart: function(e) { - OSRM.G.dragging = true; - this.switchIcon(this.options.dragicon); - - // store id of dragged marker - for( var i=0; i1) + OSRM.Routing.getDragRoute(); + OSRM.Geocoder.updateLocation( this.parent.label ); +}, +onDragStart: function(e) { + OSRM.G.dragging = true; + this.switchIcon(this.options.dragicon); + + // store id of dragged marker + for( var i=0; i - - - - - + + + + @@ -50,10 +49,13 @@ or see http://www.gnu.org/licenses/agpl.txt. - - + + + + + diff --git a/WebContent/printing/printing.html b/WebContent/printing/printing.html index e38518d57..64a0d6809 100644 --- a/WebContent/printing/printing.html +++ b/WebContent/printing/printing.html @@ -29,9 +29,6 @@ or see http://www.gnu.org/licenses/agpl.txt. - - - @@ -39,8 +36,9 @@ or see http://www.gnu.org/licenses/agpl.txt. + + - diff --git a/WebContent/printing/printing.js b/WebContent/printing/printing.js index 37a3d845c..8303bba42 100644 --- a/WebContent/printing/printing.js +++ b/WebContent/printing/printing.js @@ -27,7 +27,7 @@ OSRM.G = OSRM.GLOBALS; function initialize(tile_server) { // setup map var tile_layer = new L.TileLayer(tile_server.url, tile_server.options); - OSRM.G.map = new L.MapView("overview-map", { + OSRM.G.map = new OSRM.MapView("overview-map", { center: new L.LatLng(51.505, -0.09), zoom: 13, zoomAnimation: false, From 38defe96294b7ad55cdb4f37a8d38bc2a5cc32cc Mon Sep 17 00:00:00 2001 From: shiin Date: Mon, 23 Apr 2012 00:09:22 +0200 Subject: [PATCH 03/16] some files weren't removed properly... --- WebContent/L.Bugfixes.js | 80 ------------------ WebContent/L.DashedPolyline.js | 60 -------------- WebContent/L.MouseMarker.js | 65 --------------- WebContent/L.SwitchableIcon.js | 115 -------------------------- WebContent/routing/OSRM.RoutingGUI.js | 114 ------------------------- 5 files changed, 434 deletions(-) delete mode 100644 WebContent/L.Bugfixes.js delete mode 100644 WebContent/L.DashedPolyline.js delete mode 100644 WebContent/L.MouseMarker.js delete mode 100644 WebContent/L.SwitchableIcon.js delete mode 100644 WebContent/routing/OSRM.RoutingGUI.js diff --git a/WebContent/L.Bugfixes.js b/WebContent/L.Bugfixes.js deleted file mode 100644 index e1979df15..000000000 --- a/WebContent/L.Bugfixes.js +++ /dev/null @@ -1,80 +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. -*/ - -// Leaflet bugfixes -// [assorted bugfixes to Leaflet functions we use] - - -// return closest point on segment or distance to that point -L.LineUtil._sqClosestPointOnSegment = function (p, p1, p2, sqDist) { - var x = p1.x, - y = p1.y, - dx = p2.x - x, - dy = p2.y - y, - dot = dx * dx + dy * dy, - t; - - if (dot > 0) { - t = ((p.x - x) * dx + (p.y - y) * dy) / dot; - - if (t > 1) { - x = p2.x; - y = p2.y; - } else if (t > 0) { - x += dx * t; - y += dy * t; - } - } - - dx = p.x - x; - dy = p.y - y; - - // DS_CHANGE: modified return values - if(sqDist) - return dx*dx + dy*dy; - else { - var p = new L.Point(x,y); - p._sqDist = dx*dx + dy*dy; - return p; - } -}; - - -// makes requestAnimFrame respect the immediate paramter -> prevents drag events after dragend events -// (alternatively: add if(!this.dragging ) return to L.Draggable._updatePosition, but must be done in leaflet.js!) -// [TODO: In Leaflet 0.4 use L.Util.cancelAnimFrame(this._animRequest) in L.Draggable._onUp() instead, also has to be done in leaflet.js!] -L.Util.requestAnimFrame = (function () { - function timeoutDefer(callback) { - window.setTimeout(callback, 1000 / 60); - } - - var requestFn = window.requestAnimationFrame || - window.webkitRequestAnimationFrame || - window.mozRequestAnimationFrame || - window.oRequestAnimationFrame || - window.msRequestAnimationFrame || - timeoutDefer; - - return function (callback, context, immediate, contextEl) { - callback = context ? L.Util.bind(callback, context) : callback; - if (immediate ) { // DS_CHANGE: removed additional condition requestFn === timeoutDefer - callback(); - } else { - requestFn(callback, contextEl); - } - }; -}()); diff --git a/WebContent/L.DashedPolyline.js b/WebContent/L.DashedPolyline.js deleted file mode 100644 index 875d89ce6..000000000 --- a/WebContent/L.DashedPolyline.js +++ /dev/null @@ -1,60 +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. -*/ - -// Leaflet extension: Dashed Polyline -// [adds dashed optionally dashed lines when using SVG or VML rendering] - - -// dashed polyline class -L.DashedPolyline = L.Polyline.extend({ - initialize: function(latlngs, options) { - L.Polyline.prototype.initialize.call(this, latlngs, options); - }, - - options: { - dashed: true - } -}); - - -// svg rendering -L.DashedPolyline = !L.Browser.svg ? L.DashedPolyline : L.DashedPolyline.extend({ - _updateStyle: function () { - L.Polyline.prototype._updateStyle.call(this); - if (this.options.stroke) { - if (this.options.dashed == true) - this._path.setAttribute('stroke-dasharray', '8,6'); - else - this._path.setAttribute('stroke-dasharray', ''); - } - } -}); - - -// vml rendering -L.DashedPolyline = L.Browser.svg || !L.Browser.vml ? L.DashedPolyline : L.DashedPolyline.extend({ - _updateStyle: function () { - L.Polyline.prototype._updateStyle.call(this); - if (this.options.stroke) { - if (this.options.dashed == true) - this._stroke.dashstyle = "dash"; - else - this._stroke.dashstyle = "solid"; - } - } - -}); diff --git a/WebContent/L.MouseMarker.js b/WebContent/L.MouseMarker.js deleted file mode 100644 index f15c79b19..000000000 --- a/WebContent/L.MouseMarker.js +++ /dev/null @@ -1,65 +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. -*/ - -// Leaflet extension: MouseMarker -// [marker class that propagates modifier and button presses in mouse click events and allows for changing icons] - - -// extended marker class -L.MouseMarker = L.Marker.extend({ - initialize: function (latlng, options) { - L.Marker.prototype.initialize.apply(this, arguments); - }, - - switchIcon: function( icon ) { - this.options.icon = icon; - - if (this._map) { - this._changeIcon(); - this._reset(); - } - }, - - _changeIcon: function () { - var options = this.options; - - if (this._icon) { - this._icon = options.icon.switchIcon( this._icon ); - if (this.options.clickable) // TODO: only needed until Leaflet 0.4 - this._icon.className += ' leaflet-clickable'; - } - - var panes = this._map._panes; - - if (this._shadow) - panes.shadowPane.removeChild(this._shadow); - this._shadow = options.icon.createShadow(); - if (this._shadow) - panes.shadowPane.appendChild(this._shadow); - }, - - _onMouseClick: function (e) { - L.DomEvent.stopPropagation(e); - if (this.dragging && this.dragging.moved()) { return; } - this.fire(e.type, { - altKey: e.altKey, - ctrlKey: e.ctrlKey, - shiftKey: e.shiftKey, - button: e.button - }); - } -}); \ No newline at end of file diff --git a/WebContent/L.SwitchableIcon.js b/WebContent/L.SwitchableIcon.js deleted file mode 100644 index 8a93d863e..000000000 --- a/WebContent/L.SwitchableIcon.js +++ /dev/null @@ -1,115 +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. -*/ - -// Leaflet extension: SwitchableIcon -// [will be an extension of L.Icon in Leaflet 0.4, for now it is a copy with added functionality] - - -// icon class with functions to simply switch the icon images -L.SwitchableIcon = L.Class.extend({ - options: { - /* - iconUrl: (String) (required) - iconSize: (Point) (can be set through CSS) - iconAnchor: (Point) (centered by default if size is specified, can be set in CSS with negative margins) - popupAnchor: (Point) (if not specified, popup opens in the anchor point) - shadowUrl: (Point) (no shadow by default) - shadowSize: (Point) - */ - className: '' - }, - - initialize: function (options) { - L.Util.setOptions(this, options); - }, - - createIcon: function () { - return this._createIcon('icon'); - }, - - createShadow: function () { - return this.options.shadowUrl ? this._createIcon('shadow') : null; - }, - - _createIcon: function (name) { - var img = this._createImg(this.options[name + 'Url']); - this._setIconStyles(img, name); - return img; - }, - - _setIconStyles: function (img, name) { - var options = this.options, - size = options[name + 'Size'], - anchor = options.iconAnchor; - - if (!anchor && size) { - anchor = size.divideBy(2, true); - } - - if (name === 'shadow' && anchor && options.shadowOffset) { - anchor._add(options.shadowOffset); - } - - img.className = 'leaflet-marker-' + name + ' ' + options.className; - - if (anchor) { - img.style.marginLeft = (-anchor.x) + 'px'; - img.style.marginTop = (-anchor.y) + 'px'; - } - - if (size) { - img.style.width = size.x + 'px'; - img.style.height = size.y + 'px'; - } - }, - - _createImg: function (src) { - var el; - if (!L.Browser.ie6) { - el = document.createElement('img'); - el.src = src; - } else { - el = document.createElement('div'); - el.style.filter = 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src="' + src + '")'; - } - return el; - }, - - // new functions start here - switchIcon: function (el) { - return this._switchIcon('icon', el); - }, - - switchShadow: function (el) { - return this.options.shadowUrl ? this._switchIcon('shadow', el) : null; - }, - - _switchIcon: function (name, el) { - var img = this._switchImg(this.options[name + 'Url'], el); - this._setIconStyles(img, name); - return img; - }, - - _switchImg: function (src, el) { - if (!L.Browser.ie6) { - el.src = src; - } else { - el.style.filter = 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src="' + src + '")'; - } - return el; - } -}); diff --git a/WebContent/routing/OSRM.RoutingGUI.js b/WebContent/routing/OSRM.RoutingGUI.js deleted file mode 100644 index cf49c3455..000000000 --- a/WebContent/routing/OSRM.RoutingGUI.js +++ /dev/null @@ -1,114 +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 routing -// [handles GUI events] - - -OSRM.RoutingGUI = { - -// click: button "reset" -resetRouting: function() { - document.getElementById('gui-input-source').value = ""; - document.getElementById('gui-input-target').value = ""; - - OSRM.G.route.hideAll(); - OSRM.G.markers.removeAll(); - OSRM.G.markers.highlight.hide(); - - document.getElementById('information-box').innerHTML = ""; - document.getElementById('information-box-header').innerHTML = ""; - - OSRM.JSONP.reset(); -}, - -// click: button "reverse" -reverseRouting: function() { - // invert input boxes - var tmp = document.getElementById("gui-input-source").value; - document.getElementById("gui-input-source").value = document.getElementById("gui-input-target").value; - document.getElementById("gui-input-target").value = tmp; - - // recompute route if needed - if( OSRM.G.route.isShown() ) { - OSRM.G.markers.route.reverse(); - OSRM.Routing.getRoute(); // temporary route reversal for query, actual reversal done after receiving response - OSRM.G.markers.route.reverse(); - OSRM.G.markers.highlight.hide(); - OSRM.RoutingDescription.showSimple( OSRM.G.response ); - - // simply reverse markers - } else { - OSRM.G.markers.reverseMarkers(); - } -}, - -// click: button "show" -showMarker: function(marker_id) { - if( OSRM.JSONP.fences["geocoder_source"] || OSRM.JSONP.fences["geocoder_target"] ) - return; - - if( marker_id == OSRM.C.SOURCE_LABEL && OSRM.G.markers.hasSource() ) - OSRM.G.markers.route[0].centerView(); - else if( marker_id == OSRM.C.TARGET_LABEL && OSRM.G.markers.hasTarget() ) - OSRM.G.markers.route[OSRM.G.markers.route.length-1].centerView(); -}, - -// changed: any inputbox (is called when enter is pressed [after] or focus is lost [before]) -inputChanged: function(marker_id) { - if( marker_id == OSRM.C.SOURCE_LABEL) - OSRM.Geocoder.call(OSRM.C.SOURCE_LABEL, document.getElementById('gui-input-source').value); - else if( marker_id == OSRM.C.TARGET_LABEL) - OSRM.Geocoder.call(OSRM.C.TARGET_LABEL, document.getElementById('gui-input-target').value); -}, - -// click: button "open JOSM" -openJOSM: function() { - var x = OSRM.G.map.getCenterUI(); - var ydelta = 0.01; - var xdelta = ydelta * 2; - var p = [ 'left=' + (x.lng - xdelta), 'bottom=' + (x.lat - ydelta), 'right=' + (x.lng + xdelta), 'top=' + (x.lat + ydelta)]; - var url = 'http://localhost:8111/load_and_zoom?' + p.join('&'); - - var frame = L.DomUtil.create('iframe', null, document.body); - frame.style.width = frame.style.height = "0px"; - frame.src = url; - frame.onload = function(e) { document.body.removeChild(frame); }; -}, - -//click: button "open OSM Bugs" -openOSMBugs: function() { - var position = OSRM.G.map.getCenterUI(); - window.open( "http://osmbugs.org/?lat="+position.lat.toFixed(6)+"&lon="+position.lng.toFixed(6)+"&zoom="+OSRM.G.map.getZoom() ); -}, - -//click: button "delete marker" -deleteMarker: function(marker_id) { - var id = null; - if(marker_id == 'source' && OSRM.G.markers.hasSource() ) - id = 0; - else if(marker_id == 'target' && OSRM.G.markers.hasTarget() ) - id = OSRM.G.markers.route.length-1; - if( id == null) - return; - - OSRM.G.markers.removeMarker( id ); - OSRM.Routing.getRoute(); - OSRM.G.markers.highlight.hide(); -} - -}; \ No newline at end of file From 2060088c6b643d8bb2a39cb9d4c18064ed378216 Mon Sep 17 00:00:00 2001 From: DennisSchiefer Date: Mon, 23 Apr 2012 09:58:34 +0100 Subject: [PATCH 04/16] finished making jsonp parameter names interchangeable --- WebContent/utils/OSRM.JSONP.js | 1 - 1 file changed, 1 deletion(-) diff --git a/WebContent/utils/OSRM.JSONP.js b/WebContent/utils/OSRM.JSONP.js index cd039987c..4d7d5fdc1 100644 --- a/WebContent/utils/OSRM.JSONP.js +++ b/WebContent/utils/OSRM.JSONP.js @@ -41,7 +41,6 @@ OSRM.JSONP = { // wrap timeout function OSRM.JSONP.timeouts[id] = function(response) { - console.log("timeout",id); try { timeout_function(response, parameters); } finally { From 44c38146c9f7159df8e8b58c6a4f451630734f38 Mon Sep 17 00:00:00 2001 From: DennisSchiefer Date: Mon, 23 Apr 2012 14:48:09 +0100 Subject: [PATCH 05/16] enabled printing --- WebContent/main.js | 2 +- WebContent/printing/OSRM.Printing.js | 10 +++------- WebContent/printing/printing.html | 2 +- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/WebContent/main.js b/WebContent/main.js index 8755fbf8b..233075b5b 100644 --- a/WebContent/main.js +++ b/WebContent/main.js @@ -27,7 +27,7 @@ OSRM.init = function() { OSRM.Localization.init(); OSRM.GUI.init(); OSRM.Map.init(); - //OSRM.Printing.init(); + OSRM.Printing.init(); OSRM.Routing.init(); // check if the URL contains some GET parameter, e.g. for showing a route diff --git a/WebContent/printing/OSRM.Printing.js b/WebContent/printing/OSRM.Printing.js index b8a53428b..7d9a42343 100644 --- a/WebContent/printing/OSRM.Printing.js +++ b/WebContent/printing/OSRM.Printing.js @@ -95,12 +95,10 @@ show: function(response) { route_desc += '
'; // build route description - if( i == 0 ) - route_desc += OSRM.loc(OSRM.RoutingDescription.getDrivingInstruction(response.route_instructions[i][0])).replace(/\[(.*)\]/,"$1").replace(/%s/, OSRM.loc(response.route_instructions[i][6]) ); - else if( response.route_instructions[i][1] != "" ) - route_desc += OSRM.loc(OSRM.RoutingDescription.getDrivingInstruction(response.route_instructions[i][0])).replace(/\[(.*)\]/,"$1").replace(/%s/, response.route_instructions[i][1]); + if( response.route_instructions[i][1] != "" ) + route_desc += OSRM.loc(OSRM.RoutingDescription.getDrivingInstruction(response.route_instructions[i][0])).replace(/\[(.*)\]/,"$1").replace(/%s/, response.route_instructions[i][1]).replace(/%d/, OSRM.loc(response.route_instructions[i][6])); else - route_desc += OSRM.loc(OSRM.RoutingDescription.getDrivingInstruction(response.route_instructions[i][0])).replace(/\[(.*)\]/,""); + route_desc += OSRM.loc(OSRM.RoutingDescription.getDrivingInstruction(response.route_instructions[i][0])).replace(/\[(.*)\]/,"").replace(/%d/, OSRM.loc(response.route_instructions[i][6])); route_desc += '
'; route_desc += ""; @@ -115,8 +113,6 @@ show: function(response) { route_desc += ''; route_desc += ''; - - // put everything in DOM OSRM.printwindow.document.getElementById('description').innerHTML = route_desc; OSRM.printwindow.document.getElementById('overview-description').innerHTML = diff --git a/WebContent/printing/printing.html b/WebContent/printing/printing.html index 64a0d6809..dec97170b 100644 --- a/WebContent/printing/printing.html +++ b/WebContent/printing/printing.html @@ -35,10 +35,10 @@ or see http://www.gnu.org/licenses/agpl.txt. + - From 7241438502d56b92b63536154711dbcf89d96a64 Mon Sep 17 00:00:00 2001 From: DennisSchiefer Date: Mon, 23 Apr 2012 17:29:18 +0100 Subject: [PATCH 06/16] corrected error ne instead of sw direction --- WebContent/base/osrm/OSRM.MapView.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WebContent/base/osrm/OSRM.MapView.js b/WebContent/base/osrm/OSRM.MapView.js index 2e066b667..a48a67075 100644 --- a/WebContent/base/osrm/OSRM.MapView.js +++ b/WebContent/base/osrm/OSRM.MapView.js @@ -38,7 +38,7 @@ OSRM.MapView = L.Map.extend({ sw_point.y+=20; var ne_point = this.project( northeast, zoom); ne_point.y-=20; - sw_point.x+=20; + ne_point.x+=20; bounds.extend( this.unproject(sw_point,zoom) ); bounds.extend( this.unproject(ne_point,zoom) ); this.fitBounds( bounds ); From 3444499cf417f46a43ffa71b651e603393fd58cf Mon Sep 17 00:00:00 2001 From: DennisSchiefer Date: Mon, 23 Apr 2012 17:29:53 +0100 Subject: [PATCH 07/16] onload event can use a different window --- WebContent/utils/OSRM.browsers.js | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/WebContent/utils/OSRM.browsers.js b/WebContent/utils/OSRM.browsers.js index 9247a60dd..923ac2b0a 100644 --- a/WebContent/utils/OSRM.browsers.js +++ b/WebContent/utils/OSRM.browsers.js @@ -45,22 +45,25 @@ OSRM.Browser.getElementsByClassName = function( node, classname ) { return a; }; -// call a function when DOM has finished loading and remove event handler -OSRM.Browser.onLoadHandler = function( function_pointer ) { - if(document.addEventListener) { // FF, CH, IE9+ +// call a function when DOM has finished loading and remove event handler (optionally pass a different window object) +OSRM.Browser.onLoadHandler = function( function_pointer, the_document ) { + the_document = the_document || document; // default document + + if(the_document.addEventListener) { // FF, CH, IE9+ var temp_function = function() { - document.removeEventListener("DOMContentLoaded", arguments.callee, false); + the_document.removeEventListener("DOMContentLoaded", arguments.callee, false); function_pointer.call(); }; - document.addEventListener("DOMContentLoaded", temp_function, false); + the_document.addEventListener("DOMContentLoaded", temp_function, false); } - else if(document.attachEvent) { // IE8- + + else if(the_document.attachEvent) { // IE8- var temp_function = function() { - if ( document.readyState === "interactive" || document.readyState === "complete" ) { - document.detachEvent("onreadystatechange", arguments.callee); + if ( the_document.readyState === "interactive" || the_document.readyState === "complete" ) { + the_document.detachEvent("onreadystatechange", arguments.callee); function_pointer.call(); } }; - document.attachEvent("onreadystatechange", temp_function); + the_document.attachEvent("onreadystatechange", temp_function); } }; \ No newline at end of file From dffd67ef7286bb5d4b669ff09e5c23165873ed2f Mon Sep 17 00:00:00 2001 From: DennisSchiefer Date: Mon, 23 Apr 2012 17:30:09 +0100 Subject: [PATCH 08/16] continued printing work --- WebContent/base/OSRM.Map.js | 19 ++++++++- WebContent/printing/OSRM.Printing.js | 61 ++++++++++++++++++---------- WebContent/printing/printing.css | 18 ++++---- WebContent/printing/printing.html | 9 ++-- WebContent/printing/printing.js | 2 +- 5 files changed, 74 insertions(+), 35 deletions(-) diff --git a/WebContent/base/OSRM.Map.js b/WebContent/base/OSRM.Map.js index 01e8ec9a1..b84309612 100644 --- a/WebContent/base/OSRM.Map.js +++ b/WebContent/base/OSRM.Map.js @@ -22,6 +22,22 @@ or see http://www.gnu.org/licenses/agpl.txt. OSRM.GLOBALS.map = null; +L.MyLayers = L.Control.Layers.extend({ +getActive: function () { + var i, input, obj, + inputs = this._form.getElementsByTagName('input'), + inputsLen = inputs.length; + + for (i = 0; i < inputsLen; i++) { + input = inputs[i]; + obj = this._layers[input.layerId]; + if (input.checked && !obj.overlay) { + return obj.name; + } + } +} +}); + // map controller // [map initialization, event handling] OSRM.Map = { @@ -50,7 +66,8 @@ init: function() { }); // add layer control - var layersControl = new L.Control.Layers(base_maps, {}); + var layersControl = new L.MyLayers(base_maps, {}); + OSRM.G.map.layerControl = layersControl; OSRM.G.map.addControl(layersControl); // move zoom markers diff --git a/WebContent/printing/OSRM.Printing.js b/WebContent/printing/OSRM.Printing.js index 7d9a42343..e746bdc12 100644 --- a/WebContent/printing/OSRM.Printing.js +++ b/WebContent/printing/OSRM.Printing.js @@ -15,11 +15,12 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA or see http://www.gnu.org/licenses/agpl.txt. */ -// OSRM printer +// OSRM printing // [printing support] -OSRM.Printing = { +OSRM.Printing = { + // create UI for printing in mainwindow init: function() { var icon = document.createElement('div'); @@ -36,15 +37,9 @@ init: function() { document.getElementById("gui-printer").onclick = OSRM.Printing.print; }, + // create UI in printwindow show: function(response) { - // add events - OSRM.printwindow.document.getElementById('gui-printer').onclick = OSRM.printwindow.printWindow; - - // localization - OSRM.printwindow.document.getElementById('description-label').innerHTML = OSRM.loc( "ROUTE_DESCRIPTION" ); - OSRM.printwindow.document.getElementById('overview-map-label').innerHTML = OSRM.loc( "OVERVIEW_MAP" ); - // create header header = '
' + @@ -114,14 +109,22 @@ show: function(response) { route_desc += ''; // put everything in DOM - OSRM.printwindow.document.getElementById('description').innerHTML = route_desc; - OSRM.printwindow.document.getElementById('overview-description').innerHTML = + OSRM.G.printwindow.document.getElementById('description').innerHTML = route_desc; + OSRM.G.printwindow.document.getElementById('overview-map-description').innerHTML = '' + ''+ '
'+header+'
'; // init map - OSRM.Printing.map = OSRM.printwindow.initialize( OSRM.DEFAULTS.TILE_SERVERS[0] ); + var tile_servers = OSRM.DEFAULTS.TILE_SERVERS; + var tile_server_name = OSRM.G.map.layerControl.getActive(); + var tile_server_id = 0; + for(var size=tile_servers.length;tile_server_id < size; tile_server_id++) { + if( tile_servers[tile_server_id].display_name == tile_server_name ) + break; + } + + OSRM.Printing.map = OSRM.G.printwindow.initialize( OSRM.DEFAULTS.TILE_SERVERS[tile_server_id] ); var map = OSRM.Printing.map; var markers = OSRM.G.markers.route; map.addLayer( new L.MouseMarker( markers[0].getPosition(), {draggable:false,clickable:false,icon:OSRM.G.icons['marker-source']} ) ); @@ -150,23 +153,39 @@ drawRoute: function(response) { }, - -// open printwindow +//open printWindow print: function() { // do not open window if there is no route to draw if( !OSRM.G.route.isRoute() || !OSRM.G.route.isShown() ) return; + // close old window (should we really do this?) - if( OSRM.printwindow ) - OSRM.printwindow.close(); - OSRM.printwindow = window.open("printing/printing.html","","width=540,height=500,left=100,top=100,dependent=yes,location=no,menubar=no,scrollbars=yes,status=no,toolbar=no,resizable=yes"); - OSRM.printwindow.addEventListener("DOMContentLoaded", OSRM.Printing.printwindowLoaded, false); + if( OSRM.G.printwindow ) + OSRM.G.printwindow.close(); + + // generate a new window and wait till it has finished loading + OSRM.G.printwindow = window.open("printing/printing.html","","width=540,height=500,left=100,top=100,dependent=yes,location=no,menubar=no,scrollbars=yes,status=no,toolbar=no,resizable=yes"); + OSRM.Browser.onLoadHandler( OSRM.Printing.printwindowLoaded, OSRM.G.printwindow ); }, -// add content to printwindow after it has finished loading + +//add content to printwindow after it has finished loading printwindowLoaded: function(){ + var print_window = OSRM.G.printwindow; + var print_document = print_window.document; + + // add events + print_document.getElementById('gui-printer').onclick = print_window.printWindow; + + // localization + print_document.getElementById('description-label').innerHTML = OSRM.loc( "ROUTE_DESCRIPTION" ); + print_document.getElementById('overview-map-label').innerHTML = OSRM.loc( "OVERVIEW_MAP" ); + + // add routing content OSRM.Printing.show( OSRM.G.response ); - OSRM.printwindow.focus(); + + // finally, focus on printwindow + print_window.focus(); } -}; +}; \ No newline at end of file diff --git a/WebContent/printing/printing.css b/WebContent/printing/printing.css index 8013bec30..8efe55890 100644 --- a/WebContent/printing/printing.css +++ b/WebContent/printing/printing.css @@ -32,7 +32,7 @@ body } /* route description box */ -#overview-description +#overview-map-description { width:500px; margin:5px; @@ -141,18 +141,20 @@ div.header-title /* utility styles */ -@media print { -.quad -{ - page-break-before:always; -} -} -@media screen { .quad { min-width:10px; min-height:10px; } +@media print { +.pagebreak +{ + page-break-before:always; +} +.noprint +{ + display:none; +} } diff --git a/WebContent/printing/printing.html b/WebContent/printing/printing.html index dec97170b..3db6a2ac7 100644 --- a/WebContent/printing/printing.html +++ b/WebContent/printing/printing.html @@ -38,7 +38,6 @@ or see http://www.gnu.org/licenses/agpl.txt. - @@ -46,7 +45,7 @@ or see http://www.gnu.org/licenses/agpl.txt. -
+
@@ -55,9 +54,11 @@ or see http://www.gnu.org/licenses/agpl.txt.
-
+
+
+
Übersichtskarte
-
+
diff --git a/WebContent/printing/printing.js b/WebContent/printing/printing.js index 8303bba42..32a5c7da7 100644 --- a/WebContent/printing/printing.js +++ b/WebContent/printing/printing.js @@ -28,7 +28,7 @@ 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), + center: new L.LatLng(48.84, 10.10), zoom: 13, zoomAnimation: false, fadeAnimation: false, From 74211172788f69d28ed64a2e13a6498cf0dae19e Mon Sep 17 00:00:00 2001 From: shiin Date: Tue, 24 Apr 2012 00:56:41 +0200 Subject: [PATCH 09/16] extended mapview to give information about the current visible tile layer, continued work on printing --- WebContent/base/OSRM.Map.js | 21 +--------- .../base/leaflet/L.Control.QueryableLayers.js | 34 +++++++++++++++ WebContent/base/osrm/OSRM.MapView.js | 22 +++++++++- WebContent/main.html | 1 + WebContent/printing/OSRM.Printing.js | 42 +++++++------------ WebContent/printing/printing.css | 8 ++++ 6 files changed, 81 insertions(+), 47 deletions(-) create mode 100644 WebContent/base/leaflet/L.Control.QueryableLayers.js diff --git a/WebContent/base/OSRM.Map.js b/WebContent/base/OSRM.Map.js index b84309612..e26edb31c 100644 --- a/WebContent/base/OSRM.Map.js +++ b/WebContent/base/OSRM.Map.js @@ -22,22 +22,6 @@ or see http://www.gnu.org/licenses/agpl.txt. OSRM.GLOBALS.map = null; -L.MyLayers = L.Control.Layers.extend({ -getActive: function () { - var i, input, obj, - inputs = this._form.getElementsByTagName('input'), - inputsLen = inputs.length; - - for (i = 0; i < inputsLen; i++) { - input = inputs[i]; - obj = this._layers[input.layerId]; - if (input.checked && !obj.overlay) { - return obj.name; - } - } -} -}); - // map controller // [map initialization, event handling] OSRM.Map = { @@ -66,9 +50,8 @@ init: function() { }); // add layer control - var layersControl = new L.MyLayers(base_maps, {}); - OSRM.G.map.layerControl = layersControl; - OSRM.G.map.addControl(layersControl); + var layerControl = new L.Control.QueryableLayers(base_maps, {}); + OSRM.G.map.addLayerControl(layerControl); // move zoom markers OSRM.Browser.getElementsByClassName(document,'leaflet-control-zoom')[0].style.left=(OSRM.GUI.width+10)+"px"; diff --git a/WebContent/base/leaflet/L.Control.QueryableLayers.js b/WebContent/base/leaflet/L.Control.QueryableLayers.js new file mode 100644 index 000000000..973884591 --- /dev/null +++ b/WebContent/base/leaflet/L.Control.QueryableLayers.js @@ -0,0 +1,34 @@ +/* +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. +*/ + +// queryable Layers control +// [simply Control.Layers extended by query functions] +L.Control.QueryableLayers = L.Control.Layers.extend({ +getActiveLayerName: function () { + var i, input, obj, + inputs = this._form.getElementsByTagName('input'), + inputsLen = inputs.length; + + for (i = 0; i < inputsLen; i++) { + input = inputs[i]; + obj = this._layers[input.layerId]; + if (input.checked && !obj.overlay) { + return obj.name; + } + } +} +}); diff --git a/WebContent/base/osrm/OSRM.MapView.js b/WebContent/base/osrm/OSRM.MapView.js index a48a67075..89a114a97 100644 --- a/WebContent/base/osrm/OSRM.MapView.js +++ b/WebContent/base/osrm/OSRM.MapView.js @@ -16,7 +16,7 @@ or see http://www.gnu.org/licenses/agpl.txt. */ // map view/model -// [extending Leaflet L.Map with setView/fitBounds methods that respect UI visibility] +// [extending Leaflet L.Map with setView/fitBounds methods that respect UI visibility, better layerControl] OSRM.MapView = L.Map.extend({ setViewUI: function(position, zoom, no_animation) { if( OSRM.GUI.visible == true ) { @@ -50,5 +50,25 @@ OSRM.MapView = L.Map.extend({ var centerPoint = this._getTopLeftPoint().add(viewHalf.divideBy(2)); return this.unproject(centerPoint, this._zoom, unbounded); + }, + addLayerControl: function( layerControl ) { + if( this.layerControl ) + return; + + this.layerControl = layerControl; + this.addControl(this.layerControl); + }, + getActiveLayerId: function() { + var tile_server_id = 0; + + var tile_servers = OSRM.DEFAULTS.TILE_SERVERS; + var tile_server_name = this.layerControl.getActiveLayerName(); + for(var i=0, size=tile_servers.length; i + diff --git a/WebContent/printing/OSRM.Printing.js b/WebContent/printing/OSRM.Printing.js index e746bdc12..1551a637e 100644 --- a/WebContent/printing/OSRM.Printing.js +++ b/WebContent/printing/OSRM.Printing.js @@ -41,7 +41,9 @@ init: function() { // create UI in printwindow show: function(response) { // create header - header = + var header = + '' + + '
' + '
' + @@ -67,14 +69,12 @@ show: function(response) { '
' + '
' + - '
'; + + '
' + + ''; // create route description - var route_desc = ''; - route_desc += ''; - route_desc += ''; - route_desc += ''; - + var route_desc = ''; for(var i=0; i < response.route_instructions.length; i++){ //odd or even ? var rowstyle='results-odd'; @@ -106,32 +106,21 @@ show: function(response) { route_desc += ""; } route_desc += ''; - route_desc += '
'+header+'
'; // put everything in DOM - OSRM.G.printwindow.document.getElementById('description').innerHTML = route_desc; - OSRM.G.printwindow.document.getElementById('overview-map-description').innerHTML = - '' + - ''+ - '
'+header+'
'; + OSRM.G.printwindow.document.getElementById('description').innerHTML = '' + header + route_desc + '
'; + OSRM.G.printwindow.document.getElementById('overview-map-description').innerHTML = '' + header + '
'; - // init map - var tile_servers = OSRM.DEFAULTS.TILE_SERVERS; - var tile_server_name = OSRM.G.map.layerControl.getActive(); - var tile_server_id = 0; - for(var size=tile_servers.length;tile_server_id < size; tile_server_id++) { - if( tile_servers[tile_server_id].display_name == tile_server_name ) - break; - } - - OSRM.Printing.map = OSRM.G.printwindow.initialize( OSRM.DEFAULTS.TILE_SERVERS[tile_server_id] ); - var map = OSRM.Printing.map; + // draw map + var tile_server_id = OSRM.MapView.getActiveLayerId(); + var map = OSRM.G.printwindow.initialize( OSRM.DEFAULTS.TILE_SERVERS[tile_server_id] ); + // draw markers 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 Date: Tue, 24 Apr 2012 09:35:13 +0100 Subject: [PATCH 10/16] corrected wrong name when querying layers --- WebContent/printing/OSRM.Printing.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WebContent/printing/OSRM.Printing.js b/WebContent/printing/OSRM.Printing.js index 1551a637e..e402bc7a2 100644 --- a/WebContent/printing/OSRM.Printing.js +++ b/WebContent/printing/OSRM.Printing.js @@ -112,7 +112,7 @@ show: function(response) { OSRM.G.printwindow.document.getElementById('overview-map-description').innerHTML = '' + header + '
'; // draw map - var tile_server_id = OSRM.MapView.getActiveLayerId(); + var tile_server_id = OSRM.G.map.getActiveLayerId(); var map = OSRM.G.printwindow.initialize( OSRM.DEFAULTS.TILE_SERVERS[tile_server_id] ); // draw markers var markers = OSRM.G.markers.route; From 253df58fdb4502e68068cb35794ff43d674e7273 Mon Sep 17 00:00:00 2001 From: DennisSchiefer Date: Tue, 24 Apr 2012 09:38:20 +0100 Subject: [PATCH 11/16] beginning to restructure routing header area --- WebContent/main.css | 4 ++ WebContent/routing/OSRM.RoutingDescription.js | 52 +++++++++++-------- 2 files changed, 35 insertions(+), 21 deletions(-) diff --git a/WebContent/main.css b/WebContent/main.css index 88d595d0f..bf85c17bb 100644 --- a/WebContent/main.css +++ b/WebContent/main.css @@ -475,6 +475,10 @@ html, body { display:table; width:100%; } +.row +{ + display:table-row; +} .left { display:table-cell; diff --git a/WebContent/routing/OSRM.RoutingDescription.js b/WebContent/routing/OSRM.RoutingDescription.js index efbc8e4df..915c51306 100644 --- a/WebContent/routing/OSRM.RoutingDescription.js +++ b/WebContent/routing/OSRM.RoutingDescription.js @@ -96,14 +96,16 @@ show: function(response) { // create header header = '
' + OSRM.loc("ROUTE_DESCRIPTION") + '
' + - '
' + - '
' + - '
' + OSRM.loc("DISTANCE")+": " + OSRM.Utils.metersToDistance(response.route_summary.total_distance) + '
' + - '
' + OSRM.loc("DURATION")+": " + OSRM.Utils.secondsToTime(response.route_summary.total_time) + '
' + - '
' + - '
' + - '' + - '
' + gpx_link + '
' + + '
' + + '
' + + '
' + OSRM.loc("DISTANCE")+":" + '
' + + '
' + OSRM.Utils.metersToDistance(response.route_summary.total_distance) + '
' + + '' + + '
' + + '
' + + '
' + OSRM.loc("DURATION")+":" + '
' + + '
' + OSRM.Utils.secondsToTime(response.route_summary.total_time) + '
' + + '
' + gpx_link + '
' + '
' + '
'; @@ -114,16 +116,20 @@ show: function(response) { // simple description showSimple: function(response) { - header = + header = '
' + OSRM.loc("ROUTE_DESCRIPTION") + '
' + '
' + - '
' + - '
' + OSRM.loc("DISTANCE")+": " + OSRM.Utils.metersToDistance(response.route_summary.total_distance) + '
' + - '
' + OSRM.loc("DURATION")+": " + OSRM.Utils.secondsToTime(response.route_summary.total_time) + '
' + + '
' + + '
' + OSRM.loc("DISTANCE")+":" + '
' + + '
' + OSRM.Utils.metersToDistance(response.route_summary.total_distance) + '
' + + '' + '
' + - '
' + - '
' + - '
'; + '
' + + '
' + OSRM.loc("DURATION")+":" + '
' + + '
' + OSRM.Utils.secondsToTime(response.route_summary.total_time) + '
' + + '
' + + '
' + + '
'; // update DOM document.getElementById('information-box-header').innerHTML = header; @@ -132,15 +138,19 @@ showSimple: function(response) { // no description showNA: function( display_text ) { - header = + header = '
' + OSRM.loc("ROUTE_DESCRIPTION") + '
' + '
' + - '
' + - '
' + OSRM.loc("DISTANCE")+": N/A" + '
' + - '
' + OSRM.loc("DURATION")+": N/A" + '
' + + '
' + + '
' + OSRM.loc("DISTANCE")+":" + '
' + + '
' + "N/A" + '
' + + '' + + '
' + + '
' + + '
' + OSRM.loc("DURATION")+":" + '
' + + '
' + "N/A" + '
' + + '
' + '
' + - '
' + - '
' + '
'; // update DOM From c0b71cb62a68cc0d7ad0af97e4878a72aae15d11 Mon Sep 17 00:00:00 2001 From: DennisSchiefer Date: Tue, 24 Apr 2012 15:24:42 +0100 Subject: [PATCH 12/16] restored large images --- WebContent/images/continue.png | Bin 345 -> 414 bytes WebContent/images/default.png | Bin 166 -> 240 bytes WebContent/images/round-about.png | Bin 669 -> 716 bytes WebContent/images/sharp-left.png | Bin 442 -> 530 bytes WebContent/images/sharp-right.png | Bin 402 -> 746 bytes WebContent/images/slight-left.png | Bin 348 -> 635 bytes WebContent/images/slight-right.png | Bin 344 -> 607 bytes WebContent/images/small/continue.png | Bin 0 -> 345 bytes WebContent/images/small/default.png | Bin 0 -> 166 bytes WebContent/images/small/round-about.png | Bin 0 -> 669 bytes WebContent/images/small/sharp-left.png | Bin 0 -> 442 bytes WebContent/images/small/sharp-right.png | Bin 0 -> 402 bytes WebContent/images/small/slight-left.png | Bin 0 -> 348 bytes WebContent/images/small/slight-right.png | Bin 0 -> 344 bytes WebContent/images/small/target.png | Bin 0 -> 373 bytes WebContent/images/small/turn-left.png | Bin 0 -> 430 bytes WebContent/images/small/turn-right.png | Bin 0 -> 403 bytes WebContent/images/small/u-turn.png | Bin 0 -> 457 bytes WebContent/images/target.png | Bin 373 -> 489 bytes WebContent/images/turn-left.png | Bin 430 -> 676 bytes WebContent/images/turn-right.png | Bin 403 -> 656 bytes WebContent/images/u-turn.png | Bin 457 -> 778 bytes 22 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 WebContent/images/small/continue.png create mode 100644 WebContent/images/small/default.png create mode 100644 WebContent/images/small/round-about.png create mode 100644 WebContent/images/small/sharp-left.png create mode 100644 WebContent/images/small/sharp-right.png create mode 100644 WebContent/images/small/slight-left.png create mode 100644 WebContent/images/small/slight-right.png create mode 100644 WebContent/images/small/target.png create mode 100644 WebContent/images/small/turn-left.png create mode 100644 WebContent/images/small/turn-right.png create mode 100644 WebContent/images/small/u-turn.png diff --git a/WebContent/images/continue.png b/WebContent/images/continue.png index 11784c269961dcaa3f0ed326b38e0b9fbcf73db4..50a54e0b941a21dfd284ce12108f62fef3ec5bd2 100644 GIT binary patch literal 414 zcmeAS@N?(olHy`uVBq!ia0vp^jv&mz1|<8wpL7LMEa{HEK*5du+#;u1_nl5PZ!6Kid%2*?B#7X5NJ!3QaiyS zD5|g#%byC&wsEY5DWO_`&xj{xO9LKQrGPQhN2Y6&cK6L>V?|6GMih8$Z( UhiSShpqOCrboFyt=akR{0I9Nv6aWAK delta 336 zcmV-W0k8g^1K9#eiBL{Q4GJ0x0000DNk~Le0000I0000I2nGNE09MY9R{#J22XskI zMF-pj69yhS2*k3Q00009a7bBm000W`000W`0Ya=an2{k9f9Od>K~#9!WBmXBzX<~a z!*vEq0ni{_eDbcYuH1fpeo_<}q^_>c%gM>PkA;Qhsf>(_4p{~%DJk)T3;{C#0P$a- zVNax`rS(WMNL*Z;8)(Q*AoCZ@ARzwD%F6mcLPA25XoG-ajAzcA;VLUD(`IC3{0TBh zS64S1B({J5ets5g=3o^BYW@$TzIAqXz6Y5LHT;{2iODxyK4Zcce$LL$AAr<91|k3x zF^WbF8mb0C(-wIK2@4DV113Z;``fo~@9?Q*!6&JxsQ4o=Fi@GDot^RT-@k9}-o1<4 i#XuYFfb@Gx!w3MQE>=ox9-*}W0000%#MhayL=a3%Wwn;TGj YXR^?al`|%M0y>4k)78&qol`;+08Jk~lmGw# delta 156 zcmeysxQx-WGr-TCmrII^fq{Y7)59eQNDF~52OE$KJJ%Nuq}WS5eO=k_un4osnY^!= zKNl#(S>O>_%)r3)0fZTy)|kwgs3`1Z>gnPbQgJK!&;S4XIhmOcm$Gp&atr)VNlE$R zwbIdNij+atg%ysA*?LQw9iC29*idkJ=@kVAcV5nz$P76Zps@^|u6{1-oD!MXU((NT<`u#WI>ZPNxs1 zCs@?}-|2MtM;w!|DjtuAw&?kM7Wa+gg9td2$;1(WHo}Q@EQb62ZYmlMhwco75yG_{ zL&KFAnjscLuh%mbU9VU7P7p>2*Khrs*h)MP_;%mpOaPoguuvOvjW*9mjCnGf&8E}o`~UrZzuj(8U9xd=Kc?2BV$%p*8f05z-*9VAeUivvZJG;vY43I8<<93 zUf%!u`uZ2`?Cj193JQLPiGvISxeQq^O2A4S-jEu})bc1SZYadEVO5Opnf%2|64f^=;;~NnD>(?)a$B!RlO;6vxeFKYs z{`~n3PJ`Ik*bai|PoF-4!k`4*kfNd@_YWUFfYZ+3zkd(n45OHs7;a#IKLv#WFf9K1 z`}_Cy_4P?^+_+IZG&D3yK|$dYNDh=V0s{jra2f0l?%i36?imUjDkCGK z1(=G17zhA2H#Zev7%c^5bV6z=1ONa3SH~kKj888B3CP-S!BGgW00000NkvXXu0mjf D^m-$8 diff --git a/WebContent/images/sharp-left.png b/WebContent/images/sharp-left.png index 3961e8d4632f181bc081b92d5ce93f71b3ec1962..18d2ff962e2a98a6bde722ebd7b07c5d7175112f 100644 GIT binary patch literal 530 zcmeAS@N?(olHy`uVBq!ia0vp^jv&mz1|<8wpL7LMEa{HEK*5du+@^bUMzmGN`TZREf_4mJr8}ll3OGKFB%O^5NZI^}j}~ z8~gnWz8k1p*WQ2cUm3h!>G6u*X62oXj2sROOacuIED8(|rdij8(!1+4x|XYW@*Q51 z`RkU+*}YdeSRPcyRp0t^t@U2IDwFJt_rK4oGI+&auYN7?j3J`aK>UCei!j4#fs85p z(*(ANH8R9pf9u1bks4{Y$!&*dgOe$9bc-rOgt89n0kK5S246*&z%LV1Z=SxzFx!cv z>4Asrsn35ZJsS*o_TNzSah$<$r0~zWEQUIc!+kTEF6>()SjXSOHFGD!^K_wVmdQN& zs)ZcM$())-l$~M>ezy=I1gQgFj0zu9k)+hhZb@<6BC;Q7YhyVZp literal 442 zcmV;r0Y(0aP)Y>d0fGjZnVBiN zySqz**fKIQ_RpU`U-$3dKYk`AravG@gB3C{aS$}<<;#~EhYlUu33PtKvuDpX01e?~ zW@i3uVq%gCOd7w43T;prLH++1hJl8B)YR1UI&7to+@ATb>sokUW@=sz%wimqS3 zzKtlCAR7dXoqtGTjIUq6E(3Z?i4=pt>Bz>$<{;1u)<6Rp;Sww?KS?%d;lhPKfYb>r z@?0c&jTrFt>(|$08zd$s28>j2GGYKGiN6HBh6~8a$$gKGj#mEr_b=mz4R07*qoM6N<$f_C4q%K!iX diff --git a/WebContent/images/sharp-right.png b/WebContent/images/sharp-right.png index 7ff55fa562a7e5b3e4918910b6f6205880ec1e6e..11cffa6f095af9a94cc75a7d58d2cd3b3c30a351 100644 GIT binary patch literal 746 zcmV2m2k7XGE000SaNLh0L01FZT01FZU(%pXi00004XF*Lt006O%3;baP0007cNkl@XCiwzRGGStrjcAn3?_e1G4labjz(V4JO!y&Skl=vm zPGUk>2pWm^E;JI;3YFgVF1&woX~@0aU4Q-edatFS*=&{qfGbvRVM7(3Z-<6qJO@3P zpkxF+02M?KfFN)Y1Rw}p1OW&F7eN4mz(o*%AaD@`AP8LH^_%df$z-zC>2&s6t=6Ga zeLkPRPp8vzGg^F}z{<6({_6Gm3EO=ARf@%8StbMNmqV}DvzEnFDwWG}xqKmQP_mt1 zS=JLQae`e6g~FYTF)2MU)@rqa3=m2~kOe|{2r@uu0YNkfZ6JsQp%nyCAhd%Z0)&kU%^FMzu(_+3{Y{!7>PtC%VJ=~l_dg5Bocj$>vp>-rx+!jFdB_aHt^R~ z`!_@&D(K@hl~+y13e$?-UqbOI_GjeauwT3#K2 zXC7_8=zwLC{!qm$2zEv-F9(EiEWYcdA7!1e2m&3E%jF(K^`Sfj8$`3&JZ9H?ZDS$W zV%Pk+2oPF95CuXz2sQ{m=Ljt!psLmCnO|)weT#I{d?ncSt3B2$jN-~I6=FI#y!)@cJFnM}Tk zYFnGjL8J%*5CkrQ00e=HAOJz&A_zbbxCjCe1TN_i+;VzbUfwwQrO^Bf*;B(XZe(G-^1nF5MzDQvkrM||cIROX)7eRoZIpKg!kU@_nFyY++|Jkv( cc1s%T8=$j8Qhsd4t^fc407*qoM6N<$f|b=Tq5uE@ literal 402 zcmV;D0d4+?P)w^amrsFb1On*Sx&E wE&-!l9vT*}4jw#+Q!OJfuh{|V_mp}K0N@K`#u-dc4gdfE07*qoM6N<$g2Y~;DF6Tf diff --git a/WebContent/images/slight-left.png b/WebContent/images/slight-left.png index 81596f5bca463b554d24b21ad781006206087b67..2a3b41c29614b5eb85a2cb88b3a75841f111d256 100644 GIT binary patch literal 635 zcmeAS@N?(olHy`uVBq!ia0vp^jv&mz1|<8wpL7LM>?NMQuIzW1x%ds0-v!^@3l!ok z@Q5sCVBi)4Va7{$>;3=*S<)SSftok=bN@+XWnf_9@^o<0zJ z)NaOzNaoDa(4H(k*@z>0@$UN!!iPKNABa5^Wd7)xdV%7M8&eiK3cD2+WiHzI@g1x3 z)(Fr>8IpH z3eyZ_pQNq0|Ni~?e|EJ$Rg<$^Tz_Pn&yeWQ;ONe27iL`8b>a2bKC!=Y0%C`@y`Ai$ z(Bdo65w`m4`@b`NbGlVGI#>xi|Ft~#Xp8fNiT8y{T7d4Je!8}+{G?&&#U&iO;9-== zlEA{F%%Geg!6?CanBxG41X?i8QabV3H@iPzZP@$ka*FRj0qpj3#r`ax%Q9Ad$>(;b zFBR12nj=1s52Ur>e)*w90hTMZir!u#`uv`6gUVZs?$3(Sy4F8!jt?-EFnGH9xvX)A0Tkja z@Q5sCVBq=y!i-L9OlANDS<)SS9T^xl_H+M9WCikHd%8G=RNPAb^Z);TPG;uArEFY` z+yehoQd0hSt#tI6BGqtJL0VecQBiTBc1%o+e_}*vsA+pj^SwQlhd=)OoW3;w{yxtJ z17qXQ4_B;MkttIB_WAkw*KTji4OYCZkeBx^*vH3bfBoNIs-+JPweAfH3Sv`{JaX{h zNB4+`9s8FoIT95YXUCl)A>gsM>TA~QY172&rZZlisHbPi$=Ru+@Kw6w|EpK8)F#Nf zMQ_WAWbjGezfjC*Qm%kz!WD&rg#Sys9OL)ZRQCGMW1YXGv-9Nk7cVlN?yvuERQKb< r!?%aq`3qO2vRK{Z^Vq-Kq=&)NCGvjM)rdDhZ!>th`njxgN@xNAhzg8S diff --git a/WebContent/images/slight-right.png b/WebContent/images/slight-right.png index 1060453abd41f765c1f22bd736374505acd37155..dba4064b1316418a1cacd5d8910f21f5fb8af00a 100644 GIT binary patch literal 607 zcmeAS@N?(olHy`uVBq!ia0vp^jv&mz1|<8wpL7LM>?NMQuIzW1x%drbB1}It0EIXU zJR*x37`TN%nDNrxx<5ccmUKs7pyrMJ+mzi`{bf{F=QEh-9Z z&5o8|ITodDu9O#Dc>8Uf>&|6m`fkSy^_)1=Pi>s{JaVQ(2lqrtmcYdqE2fm{=KfO> z7ta5gwe^?6>#AF}oW%{-Z{}>jK^;F9uzKMGRBCmVQ5@;KKOgYt{3` z7f<+=$SuserNiKJ`AcSVW+6wxwu-)|n%`>PPUK^`Ug~eQvvT9t-+veXKev@*;w;t> zk%p)038F4p0$E#c6;EQ=-zmD}{cr1)4l6>m^gWr6_=U4%GVD_FV7(yfsKtCsQ_U&)T0kD}GyUy7a;b9lyi#SH5|@ zj{7|e6B9ejuWEG}cE<%(I;T#xn(OcTY#CxJF!e8kd_lH6E5m~|z?8t?>FVdQ&MBb@ E0HUe&y#N3J literal 344 zcmeAS@N?(olHy`uVBq!ia0vp^LLkh+1|-AI^@Rf|_7YEDSN1zB!fbLp$LrLYfkK=G z9+AZi3|t>Tn9*sC$qb+%OS+@4BLl<6e(pbstU&&APZ!6Kid)Hl{{P?4$;^DXl#Pp# zTi}06O3ELvm5x4Bq#PzWrlqCbv$3)1-??MQye0#4^Y6~m($cCTt_KV*sU9q;QLwiDT{)xt$dMzv!q!F|)zR0FPsz_;@3_TLN=oXO!|nQJ9zjvjxe`)Rr+O~G zJR-$%q)en$aAU$11uovC)YMkP|C={#_;Y;uG(nNS2Q>Ee_zKN<5uu{0dek8&p{vd| m``ViOKX{my_J5yJ#mnG3!ArP0JKYZGWd=`IKbLh*2~7ZyHG};C diff --git a/WebContent/images/small/continue.png b/WebContent/images/small/continue.png new file mode 100644 index 0000000000000000000000000000000000000000..11784c269961dcaa3f0ed326b38e0b9fbcf73db4 GIT binary patch literal 345 zcmeAS@N?(olHy`uVBq!ia0vp^LLkh+1|-AI^@Rf|_7YEDSN1zB!fbL@97i_I0t#^! zctjR6FmQbUVMeDlCNqG7Ea{HEjtmSN`?>!lvI6-pJY5_^DsCnJ`Tu`ECo}WmQZ_Hf z3ktC{pVqBgcc-qdE=WXj$+~stPMB^p-9==F6O-;>@%{+`o{~12UFG%!X zvUKTJ4cysb3CGPEM0Enj4aO($CF#sHLraIV~mS52ukw zc(}Q=%C`Fdbz(Ws5=2?D{_!u_S6WuKk9{V$>7Uu1ohQv>?2-?O*PT0ePQKxaJ)07P zuwj=Quhc3w$ID`sY@FQO|C!ZX41V9gM{eO(pr08$UHx3vIVCg!04AY_t^fc4 literal 0 HcmV?d00001 diff --git a/WebContent/images/small/default.png b/WebContent/images/small/default.png new file mode 100644 index 0000000000000000000000000000000000000000..caa54d295ee683004100fb089469d417752b0415 GIT binary patch literal 166 zcmeAS@N?(olHy`uVBq!ia0vp^LLkh+1|-AI^@Rf|_7YEDSN1zB!fbLT?`!7I1qyK% zctjR6FmQbUVMeDlCNqG7Ea{HEjtmSN`?>!lvI6<0o-U3d6}OWA{Qtk7lbQK&DH|6f zx4{3Dl$1YSD;<5NNEu{ZSmC&st+%Av;ps$$4F#8%UQu9h=jDuv%#c$78o=P`>gTe~ HDWM4fMiVcn literal 0 HcmV?d00001 diff --git a/WebContent/images/small/round-about.png b/WebContent/images/small/round-about.png new file mode 100644 index 0000000000000000000000000000000000000000..9641c26e29b2b2e069a6c41be5a66fabbbd73258 GIT binary patch literal 669 zcmV;O0%HA%P)U9xd=Kc?2BV$%p*8f05z-*9VAeUivvZJG;vY43I8<<93 zUf%!u`uZ2`?Cj193JQLPiGvISxeQq^O2A4S-jEu})bc1SZYadEVO5Opnf%2|64f^=;;~NnD>(?)a$B!RlO;6vxeFKYs z{`~n3PJ`Ik*bai|PoF-4!k`4*kfNd@_YWUFfYZ+3zkd(n45OHs7;a#IKLv#WFf9K1 z`}_Cy_4P?^+_+IZG&D3yK|$dYNDh=V0s{jra2f0l?%i36?imUjDkCGK z1(=G17zhA2H#Zev7%c^5bV6z=1ONa3SH~kKj888B3CP-S!BGgW00000NkvXXu0mjf D^m-$8 literal 0 HcmV?d00001 diff --git a/WebContent/images/small/sharp-left.png b/WebContent/images/small/sharp-left.png new file mode 100644 index 0000000000000000000000000000000000000000..3961e8d4632f181bc081b92d5ce93f71b3ec1962 GIT binary patch literal 442 zcmV;r0Y(0aP)Y>d0fGjZnVBiN zySqz**fKIQ_RpU`U-$3dKYk`AravG@gB3C{aS$}<<;#~EhYlUu33PtKvuDpX01e?~ zW@i3uVq%gCOd7w43T;prLH++1hJl8B)YR1UI&7to+@ATb>sokUW@=sz%wimqS3 zzKtlCAR7dXoqtGTjIUq6E(3Z?i4=pt>Bz>$<{;1u)<6Rp;Sww?KS?%d;lhPKfYb>r z@?0c&jTrFt>(|$08zd$s28>j2GGYKGiN6HBh6~8a$$gKGj#mEr_b=mz4R07*qoM6N<$f_C4q%K!iX literal 0 HcmV?d00001 diff --git a/WebContent/images/small/sharp-right.png b/WebContent/images/small/sharp-right.png new file mode 100644 index 0000000000000000000000000000000000000000..7ff55fa562a7e5b3e4918910b6f6205880ec1e6e GIT binary patch literal 402 zcmV;D0d4+?P)w^amrsFb1On*Sx&E wE&-!l9vT*}4jw#+Q!OJfuh{|V_mp}K0N@K`#u-dc4gdfE07*qoM6N<$g2Y~;DF6Tf literal 0 HcmV?d00001 diff --git a/WebContent/images/small/slight-left.png b/WebContent/images/small/slight-left.png new file mode 100644 index 0000000000000000000000000000000000000000..81596f5bca463b554d24b21ad781006206087b67 GIT binary patch literal 348 zcmeAS@N?(olHy`uVBq!ia0vp^LLkh+1|-AI^@Rf|_7YEDSN1zB!fbMqs}>)A0Tkja z@Q5sCVBq=y!i-L9OlANDS<)SS9T^xl_H+M9WCikHd%8G=RNPAb^Z);TPG;uArEFY` z+yehoQd0hSt#tI6BGqtJL0VecQBiTBc1%o+e_}*vsA+pj^SwQlhd=)OoW3;w{yxtJ z17qXQ4_B;MkttIB_WAkw*KTji4OYCZkeBx^*vH3bfBoNIs-+JPweAfH3Sv`{JaX{h zNB4+`9s8FoIT95YXUCl)A>gsM>TA~QY172&rZZlisHbPi$=Ru+@Kw6w|EpK8)F#Nf zMQ_WAWbjGezfjC*Qm%kz!WD&rg#Sys9OL)ZRQCGMW1YXGv-9Nk7cVlN?yvuERQKb< r!?%aq`3qO2vRK{Z^Vq-Kq=&)NCGvjM)rdDhZ!>th`njxgN@xNAhzg8S literal 0 HcmV?d00001 diff --git a/WebContent/images/small/slight-right.png b/WebContent/images/small/slight-right.png new file mode 100644 index 0000000000000000000000000000000000000000..1060453abd41f765c1f22bd736374505acd37155 GIT binary patch literal 344 zcmeAS@N?(olHy`uVBq!ia0vp^LLkh+1|-AI^@Rf|_7YEDSN1zB!fbLp$LrLYfkK=G z9+AZi3|t>Tn9*sC$qb+%OS+@4BLl<6e(pbstU&&APZ!6Kid)Hl{{P?4$;^DXl#Pp# zTi}06O3ELvm5x4Bq#PzWrlqCbv$3)1-??MQye0#4^Y6~m($cCTt_KV*sU9q;QLwiDT{)xt$dMzv!q!F|)zR0FPsz_;@3_TLN=oXO!|nQJ9zjvjxe`)Rr+O~G zJR-$%q)en$aAU$11uovC)YMkP|C={#_;Y;uG(nNS2Q>Ee_zKN<5uu{0dek8&p{vd| m``ViOKX{my_J5yJ#mnG3!ArP0JKYZGWd=`IKbLh*2~7ZyHG};C literal 0 HcmV?d00001 diff --git a/WebContent/images/small/target.png b/WebContent/images/small/target.png new file mode 100644 index 0000000000000000000000000000000000000000..25607006dfb92f19b1c6f63d04da006fede02a54 GIT binary patch literal 373 zcmeAS@N?(olHy`uVBq!ia0vp^LLkh+1|-AI^@Rf|_7YEDSN1zB!kn54d4Jcu1PXB$ zctjR6FmQbUVMeDlCNqG7Ea{HEjtmSN`?>!lvNA9*vUs{UhE&{2{`3F;eokiQ!=-Fo zjNAhMQ&Lj??8>^T_3Usv|7H$O&cFFNIe%O?c{+%{Y|4m?yqRTZx3AsC#%6ot7ad7S z$?tF8@{Li>^%Iw*{J6EiDVOdxA zFZ#@xGw&Od6t4ec?Oa&RE1tj-b?D>Q*WsQ5YEO*SyqGIFBw2XQ?05Lnzramx+4&PS zJqN@@ME0nwsfm64^)-9@eEWKAcV(_g6_tDV#lAf>*xz!Ny~!PgireFdM%;ZJvK`LY|P$wG|JQ9J3_Y7@Q`>`Y=}f Rod^sc22WQ%mvv4FO#le^kAMIG literal 0 HcmV?d00001 diff --git a/WebContent/images/small/turn-left.png b/WebContent/images/small/turn-left.png new file mode 100644 index 0000000000000000000000000000000000000000..9e2d7b4688827cb872e3e1573a7c75a7d16fa856 GIT binary patch literal 430 zcmV;f0a5;mP)Tq&$iel6B_wV2DpFVwhbMD-^yFlOk2MYqj zNH;Vzl$oEOe-V)T2c(V|3^d@Uyu7>xiq}@JUJW$w|1VO!0#wh!!NCD{G0bcKR8>_o zf#Jgf^jeI%x_Z5gjLdRu1^~Te0*r`dKqe#5Abw<%b&+F?hlgi@wzhUME|+w7cZ&fj zkn8{I>+8p01U3kqJ$v>ykV4;cx?AS3*5U#JUXQId;YyjjnL24KV Y0B+iawxLFCivR!s07*qoM6N<$f~XI<1poj5 literal 0 HcmV?d00001 diff --git a/WebContent/images/small/turn-right.png b/WebContent/images/small/turn-right.png new file mode 100644 index 0000000000000000000000000000000000000000..f56af46eb73bb488fd60f4c2107c283041be82fe GIT binary patch literal 403 zcmV;E0c`$>P)D83KYRAZ48?25j~{3K^XCr_Dc)paV)_I0!9Nh21)BmH8JQ{S>gp4*$q5Ju z2(4Ya_82=m`*m?~agT!s557V1+OcEDID!8E405uzwss0GSDZO>h6`xOIayg*DT-nZ z7$HA^hPXd|{P-ENI18x;0bLCWlh+vGMXEu#zz{JAn1a8OY7jiIB_$>Q0|W9Ki2d!` xw+|#c2|4$J(h>**#Yp!usl^CBuL)AaFaXN}a?Pm*g%$t+002ovPDHLkV1n6+o8|xj literal 0 HcmV?d00001 diff --git a/WebContent/images/small/u-turn.png b/WebContent/images/small/u-turn.png new file mode 100644 index 0000000000000000000000000000000000000000..cf7c37b463886121a83d778081038f6db413b1c7 GIT binary patch literal 457 zcmV;)0XF`LP)p3RjXDpv$C>+y!n?1{98sw#ty5Cl$4a1fD|i~`yZ+S9e~t; zT*}1D%PWY}YcQaws5ou)>eUtK;$2-`hCr7e02#){#>Pv~ARu^WVq)?QU2x&Tg*Si( z{m14^l7P0h_IIeaDKiKcpp8L$_wMBYrX4PF3<3wXy}dol^XJcVXU&==_V@2!a7=vp z^2HVya}7K^JUcF5zI+0kW}sR`SiuscsHkW#6B83CAmND)n7R)E(-uFn<}+u`fL#0& zB(JQj?2cg&2nY!Y1py8F0ySj6ii!#!x-0JAzs~_o{WpR5j+~sF6;^|wE(-!0xL#gf zUI15k?BBni1*i`-4Wb)Fl~|($fSe~t4OamGV#0nGVL+Ai00000NkvXXu0mjffCab? literal 0 HcmV?d00001 diff --git a/WebContent/images/target.png b/WebContent/images/target.png index 25607006dfb92f19b1c6f63d04da006fede02a54..3bcb3b732d07b6e99803c7fb9722ffd8130c65ef 100644 GIT binary patch literal 489 zcmeAS@N?(olHy`uVBq!ia0vp^jv&mz1|<8wpL7LMEa{HEK*5du+g3=Lga}yiO=VEzW4Nx*tX;QyTd1s z+H$U5_xi7;-R#v96HVp$rk!MF5pZB&Y_S$xwd&TY)JTuM2hm$_tp?oyE=w_9z!lvNA9*vUs{UhE&{2{`3F;eokiQ!=-Fo zjNAhMQ&Lj??8>^T_3Usv|7H$O&cFFNIe%O?c{+%{Y|4m?yqRTZx3AsC#%6ot7ad7S z$?tF8@{Li>^%Iw*{J6EiDVOdxA zFZ#@xGw&Od6t4ec?Oa&RE1tj-b?D>Q*WsQ5YEO*SyqGIFBw2XQ?05Lnzramx+4&PS zJqN@@ME0nwsfm64^)-9@eEWKAcV(_g6_tDV#lAf>*xz!Ny~!PgireFdM%;ZJvK`LY|P$wG|JQ9J3_Y7@Q`>`Y=}f Rod^sc22WQ%mvv4FO#le^kAMIG diff --git a/WebContent/images/turn-left.png b/WebContent/images/turn-left.png index 9e2d7b4688827cb872e3e1573a7c75a7d16fa856..12f96787e669571c3397d84e41de4aada18d1d28 100644 GIT binary patch literal 676 zcmeAS@N?(olHy`uVBq!ia0vp^jv&mz1|<8wpL7LM>?NMQuIzW1IXES_+?4Z}fkK=G z9+AZi4BSE>%y{W;-5;PJOS+>kQ1ixq?mvmF3=B-ho-U3d6}R5rvh_dYAi@5Dy-A6C zat(tk8@F(=m_^rBEJmb{&zsU?clAiKyGnu*nak|yqx`TNO|M`Y&muRA#!*drW z4 zuWER&6uFa^`N3<3vR{jxALhROTBUwUpoE#jYhl2T38oPiYAEl z&nxf0`-)E0HMP#UwD#b%Q~ax5MOAg(QQKkmO>MmXl^@`!PqkF0u literal 430 zcmV;f0a5;mP)Tq&$iel6B_wV2DpFVwhbMD-^yFlOk2MYqj zNH;Vzl$oEOe-V)T2c(V|3^d@Uyu7>xiq}@JUJW$w|1VO!0#wh!!NCD{G0bcKR8>_o zf#Jgf^jeI%x_Z5gjLdRu1^~Te0*r`dKqe#5Abw<%b&+F?hlgi@wzhUME|+w7cZ&fj zkn8{I>+8p01U3kqJ$v>ykV4;cx?AS3*5U#JUXQId;YyjjnL24KV Y0B+iawxLFCivR!s07*qoM6N<$f~XI<1poj5 diff --git a/WebContent/images/turn-right.png b/WebContent/images/turn-right.png index f56af46eb73bb488fd60f4c2107c283041be82fe..fc759cf83f939002a1f638f48a4d6750d25ed840 100644 GIT binary patch literal 656 zcmeAS@N?(olHy`uVBq!ia0vp^jv&mz1|<8wpL7LM>?NMQuIzW1IXER)ugxi*1Qg;d z@Q5sCVBi)4Va7{$>;3=*S<)SSftok=bN@+XWnf^E_jGX#skrs__J03E4kGLy+?ySz z`FFv`fAe)LE$XQa$i`GS<>g3^*N@&|f-#U3A0sdrrL+-Wd#{eJwhLVYvGfBqdCu~OtH*7z?agnug=ShhNhw;f-wvbN^^ z7dPK^Id6M@)!utMwHi8d<{l{TSpH0W-N~z2UoB5Ix*JRI_&IF#nC1HVdgJu%{j;4q ztS^OGF->wXm|Mya)Ve{>Axj{H0p!aBQ>OU7{Ur0co-MECVUB1*B1D2Pw6tVQC~tf2P220ixlJe&#yB!_fFjRuHpGl+w;k% zZ_SVkSi~W5EJEwQp?fitKof@|gJOpOm~kL}Zh=_a!k7Cby!-g&@~do2?g~!+$?A8@ W^(JSI#Wi5kVeoYIb6Mw<&;$VGX9ywy literal 403 zcmV;E0c`$>P)D83KYRAZ48?25j~{3K^XCr_Dc)paV)_I0!9Nh21)BmH8JQ{S>gp4*$q5Ju z2(4Ya_82=m`*m?~agT!s557V1+OcEDID!8E405uzwss0GSDZO>h6`xOIayg*DT-nZ z7$HA^hPXd|{P-ENI18x;0bLCWlh+vGMXEu#zz{JAn1a8OY7jiIB_$>Q0|W9Ki2d!` xw+|#c2|4$J(h>**#Yp!usl^CBuL)AaFaXN}a?Pm*g%$t+002ovPDHLkV1n6+o8|xj diff --git a/WebContent/images/u-turn.png b/WebContent/images/u-turn.png index cf7c37b463886121a83d778081038f6db413b1c7..a2e0e7888f2891cef85a4babd26180e70fdb5ef4 100644 GIT binary patch literal 778 zcmV+l1NHogP)*oMqv8@9!<^1mP zHjzkt)7=%GoqvorSeUzD~|sq}R;8of|1!FAmW!!TUk z9p1LFD`GC%m%w9!<2bq1YV|1S@v33B=hbXBd#Y5zF~Gj0$FY|n3Q2$ymw;1s>?Mfi zDpHcAZLn$Tr)60mYqi>EnQ^<_?wd}hV@aExg60X6$pn|>cFxuHdc7^P^Y^J%tDp9r zzu9aG^-JmPkV>U~tBTE1<%z6VCp{*JLK5JJC6vqMFR_=v#+zmACCG#%07>AG1Rx0< zk^m%uLlS@_a7Y4>1WsTH%jGhqyYbp342Q#4x*M-u!YM%#fFy8sF1h0$nuEch@^BEu z1&w~cf3q+6cs#ytx7%+w9bc(b2Kjvchi(C!T}$pNYY*;X2S#McU&@j@JCVs6`(3tp zjES*j$9)J^v4ob8OeX)z7U2oN*s3MmFXIU;LAHoP3h;x_>>xu#R0Rl22rDAW0(?mb zDkACvd`s{vLZtx1F#hcO4AwM?#0pfOfSqz(*DMx`w&OU@4lMw|M2jVJxoyQ+C`q`e zGfXij)-rBNsPHv>PetdI5Jti#5l1HgB$VrTw??DU_<;MZR_k4q2f>Ymy%J6V`Y8=0 zfkP62BydOqkOU4%0FuD*GRBuIVba|eZJe>rW1gSW-4LDp2Mn{Ff(dEVV*mgE07*qo IM6N<$f~C+~761SM literal 457 zcmV;)0XF`LP)p3RjXDpv$C>+y!n?1{98sw#ty5Cl$4a1fD|i~`yZ+S9e~t; zT*}1D%PWY}YcQaws5ou)>eUtK;$2-`hCr7e02#){#>Pv~ARu^WVq)?QU2x&Tg*Si( z{m14^l7P0h_IIeaDKiKcpp8L$_wMBYrX4PF3<3wXy}dol^XJcVXU&==_V@2!a7=vp z^2HVya}7K^JUcF5zI+0kW}sR`SiuscsHkW#6B83CAmND)n7R)E(-uFn<}+u`fL#0& zB(JQj?2cg&2nY!Y1py8F0ySj6ii!#!x-0JAzs~_o{WpR5j+~sF6;^|wE(-!0xL#gf zUI15k?BBni1*i`-4Wb)Fl~|($fSe~t4OamGV#0nGVL+Ai00000NkvXXu0mjffCab? From 7cdeeb07238dfe1a4101c75855acfb23a1872a3f Mon Sep 17 00:00:00 2001 From: DennisSchiefer Date: Tue, 24 Apr 2012 15:28:09 +0100 Subject: [PATCH 13/16] continued work on printing header --- WebContent/printing/OSRM.Printing.js | 61 ++++++++++++++++++---------- WebContent/printing/printing.css | 30 +++++++------- 2 files changed, 54 insertions(+), 37 deletions(-) diff --git a/WebContent/printing/OSRM.Printing.js b/WebContent/printing/OSRM.Printing.js index e402bc7a2..9def95301 100644 --- a/WebContent/printing/OSRM.Printing.js +++ b/WebContent/printing/OSRM.Printing.js @@ -44,37 +44,58 @@ show: function(response) { var header = '' + - '
' + - '
' + +// '
' + +// '
' + +// '
' + OSRM.loc("GUI_START")+ ':
' + +// '
' + document.getElementById("gui-input-source").value + '
' + +// '
' + OSRM.loc("DISTANCE")+':
' + +// '
' + OSRM.Utils.metersToDistance(response.route_summary.total_distance) + '
' + +// '
' + +// '
' + +// '
' + OSRM.loc("GUI_END")+ ':
' + +// '
' + document.getElementById("gui-input-target").value + '
' + +// '
' + OSRM.loc("DURATION")+':
' + +// '
' + OSRM.Utils.secondsToTime(response.route_summary.total_time) + '
' + +// '
' + +// '
' + - '
' + - '
' + OSRM.loc("GUI_START")+ ':
' + - '
' + OSRM.loc("GUI_END")+ ':
' + - '
' + + '
' + + '
' + '
' + - '
' + document.getElementById("gui-input-source").value + '
' + - '
' + document.getElementById("gui-input-target").value + '
' + + '
' + + '
' + + '
' + OSRM.loc("GUI_START")+ ':
' + + '
' + document.getElementById("gui-input-source").value + '
' + '
' + - - '
' + - '
' + OSRM.loc("DISTANCE")+':
' + - '
' + OSRM.loc("DURATION")+':
' + + '
' + + '
' + OSRM.loc("GUI_END")+ ':
' + + '
' + document.getElementById("gui-input-target").value + '
' + '
' + + '
' + + '
' + '
' + - '
' + OSRM.Utils.metersToDistance(response.route_summary.total_distance) + '
' + - '
' + OSRM.Utils.secondsToTime(response.route_summary.total_time) + '
' + + '
' + + '
' + + '
' + OSRM.loc("DISTANCE")+':
' + + '
' + OSRM.Utils.metersToDistance(response.route_summary.total_distance) + '
' + + '
' + + '
' + + '
' + OSRM.loc("DURATION")+':
' + + '
' + OSRM.Utils.secondsToTime(response.route_summary.total_time) + '
' + + '
' + + '
' + '
' + '
' + '
' + - '
' + + '
' + ''; // create route description - var route_desc = ''; + var route_desc = ''; for(var i=0; i < response.route_instructions.length; i++){ //odd or even ? var rowstyle='results-odd'; @@ -83,19 +104,15 @@ show: function(response) { route_desc += ''; route_desc += ''; - route_desc += ''; + route_desc += ''; route_desc += ""; - - route_desc += ''; - route_desc += '
'; // build route description + route_desc += ''; if( response.route_instructions[i][1] != "" ) route_desc += OSRM.loc(OSRM.RoutingDescription.getDrivingInstruction(response.route_instructions[i][0])).replace(/\[(.*)\]/,"$1").replace(/%s/, response.route_instructions[i][1]).replace(/%d/, OSRM.loc(response.route_instructions[i][6])); else route_desc += OSRM.loc(OSRM.RoutingDescription.getDrivingInstruction(response.route_instructions[i][0])).replace(/\[(.*)\]/,"").replace(/%d/, OSRM.loc(response.route_instructions[i][6])); - - route_desc += '
'; route_desc += ""; route_desc += ''; diff --git a/WebContent/printing/printing.css b/WebContent/printing/printing.css index 699f8ae56..570dfdc68 100644 --- a/WebContent/printing/printing.css +++ b/WebContent/printing/printing.css @@ -84,36 +84,32 @@ div.header-title { background-color: #FFF9BB; } -.result-counter -{ - text-align:right; - vertical-align:top; - font-weight:bold; - padding:1px 5px 1px 5px; -} .result-items { text-align:left; vertical-align: middle; width:100%; padding:1px; + border-bottom: 1px solid black; } .result-directions { text-align:left; vertical-align: middle; padding:1px 5px 1px 5px; + border-bottom: 1px solid black; +} +.result-direction +{ + height:36px; + width:36px; } .result-distance { text-align:right; vertical-align: middle; padding:1px 1px 1px 5px; -} -.result-item -{ - cursor:pointer; - color:#000000 + border-bottom: 1px solid black; } .no-results { @@ -238,23 +234,27 @@ div.header-title display:table; width:100%; } +.row +{ + display:table-row; +} .left { display:table-cell; text-align:left; - vertical-align:middle; + vertical-align:top; } .right { display:table-cell; text-align:right; - vertical-align:middle; + vertical-align:top; } .center { display:table-cell; text-align:center; - vertical-align:middle; + vertical-align:top; } .header-group { From 7657f0de222da4a68d6bd3600f01ea66e156496b Mon Sep 17 00:00:00 2001 From: DennisSchiefer Date: Tue, 24 Apr 2012 22:12:24 +0200 Subject: [PATCH 14/16] finished printing support (?) --- WebContent/printing/OSRM.Printing.js | 73 +++---- WebContent/printing/printing.css | 287 +++++++++++++-------------- WebContent/printing/printing.html | 8 +- 3 files changed, 170 insertions(+), 198 deletions(-) diff --git a/WebContent/printing/OSRM.Printing.js b/WebContent/printing/OSRM.Printing.js index 9def95301..b63f6638c 100644 --- a/WebContent/printing/OSRM.Printing.js +++ b/WebContent/printing/OSRM.Printing.js @@ -42,35 +42,20 @@ init: function() { show: function(response) { // create header var header = - '' + - -// '
' + -// '
' + -// '
' + OSRM.loc("GUI_START")+ ':
' + -// '
' + document.getElementById("gui-input-source").value + '
' + -// '
' + OSRM.loc("DISTANCE")+':
' + -// '
' + OSRM.Utils.metersToDistance(response.route_summary.total_distance) + '
' + -// '
' + -// '
' + -// '
' + OSRM.loc("GUI_END")+ ':
' + -// '
' + document.getElementById("gui-input-target").value + '
' + -// '
' + OSRM.loc("DURATION")+':
' + -// '
' + OSRM.Utils.secondsToTime(response.route_summary.total_time) + '
' + -// '
' + -// '
' + + '' + '
' + '
' + - '
' + + '
' + '
' + '
' + - '
' + OSRM.loc("GUI_START")+ ':
' + - '
' + document.getElementById("gui-input-source").value + '
' + + '
' + OSRM.loc("GUI_START")+ ':
' + + '
' + document.getElementById("gui-input-source").value + '
' + '
' + '
' + - '
' + OSRM.loc("GUI_END")+ ':
' + - '
' + document.getElementById("gui-input-target").value + '
' + + '
' + OSRM.loc("GUI_END")+ ':
' + + '
' + document.getElementById("gui-input-target").value + '
' + '
' + '
' + '
' + @@ -78,12 +63,12 @@ show: function(response) { '
' + '
' + '
' + - '
' + OSRM.loc("DISTANCE")+':
' + - '
' + OSRM.Utils.metersToDistance(response.route_summary.total_distance) + '
' + + '
' + OSRM.loc("DISTANCE")+':
' + + '
' + OSRM.Utils.metersToDistance(response.route_summary.total_distance) + '
' + '
' + '
' + - '
' + OSRM.loc("DURATION")+':
' + - '
' + OSRM.Utils.secondsToTime(response.route_summary.total_time) + '
' + + '
' + OSRM.loc("DURATION")+':
' + + '
' + OSRM.Utils.secondsToTime(response.route_summary.total_time) + '
' + '
' + '
' + '
' + @@ -91,42 +76,42 @@ show: function(response) { '
' + '
' + - '
' + + '
' + ''; // create route description - var route_desc = ''; + var body = ''; for(var i=0; i < response.route_instructions.length; i++){ //odd or even ? - var rowstyle='results-odd'; - if(i%2==0) { rowstyle='results-even'; } + var rowstyle='description-body-odd'; + if(i%2==0) { rowstyle='description-body-even'; } - route_desc += ''; + body += ''; - route_desc += ''; - route_desc += ''; - route_desc += ""; + body += ''; + body += ''; + body += ""; // build route description - route_desc += ''; + body += ''; if( response.route_instructions[i][1] != "" ) - route_desc += OSRM.loc(OSRM.RoutingDescription.getDrivingInstruction(response.route_instructions[i][0])).replace(/\[(.*)\]/,"$1").replace(/%s/, response.route_instructions[i][1]).replace(/%d/, OSRM.loc(response.route_instructions[i][6])); + body += OSRM.loc(OSRM.RoutingDescription.getDrivingInstruction(response.route_instructions[i][0])).replace(/\[(.*)\]/,"$1").replace(/%s/, response.route_instructions[i][1]).replace(/%d/, OSRM.loc(response.route_instructions[i][6])); else - route_desc += OSRM.loc(OSRM.RoutingDescription.getDrivingInstruction(response.route_instructions[i][0])).replace(/\[(.*)\]/,"").replace(/%d/, OSRM.loc(response.route_instructions[i][6])); - route_desc += ""; + body += OSRM.loc(OSRM.RoutingDescription.getDrivingInstruction(response.route_instructions[i][0])).replace(/\[(.*)\]/,"").replace(/%d/, OSRM.loc(response.route_instructions[i][6])); + body += ""; - route_desc += ''; + body += ''; if( i != response.route_instructions.length-1 ) - route_desc += ''+OSRM.Utils.metersToDistance(response.route_instructions[i][2])+''; - route_desc += ""; + body += ''+OSRM.Utils.metersToDistance(response.route_instructions[i][2])+''; + body += ""; - route_desc += ""; + body += ""; } - route_desc += ''; + body += ''; // put everything in DOM - OSRM.G.printwindow.document.getElementById('description').innerHTML = '' + header + route_desc + '
'; - OSRM.G.printwindow.document.getElementById('overview-map-description').innerHTML = '' + header + '
'; + OSRM.G.printwindow.document.getElementById('description').innerHTML = '' + header + body + '
'; + OSRM.G.printwindow.document.getElementById('overview-map-description').innerHTML = '' + header + '
'; // draw map var tile_server_id = OSRM.G.map.getActiveLayerId(); diff --git a/WebContent/printing/printing.css b/WebContent/printing/printing.css index 570dfdc68..c09d75ea1 100644 --- a/WebContent/printing/printing.css +++ b/WebContent/printing/printing.css @@ -24,100 +24,6 @@ body } -/* route description box */ -#description -{ - width:500px; - margin:5px; -} - -/* route description box */ -#overview-map-description -{ - width:500px; - margin:5px; -} - - -/* route map box */ -#overview-map -{ - width:500px; - height:500px; - margin:5px; -} - - -/* styles for information-box-header */ -div.header-title -{ - font-weight:bold; - margin-bottom:10px; -} -.header-content -{ - font-weight:normal; -} -.result-link -{ - color:#0000ff; - text-decoration:none; - cursor:pointer; -} -.result-link:hover -{ - color:#ff0000; -} - - -/* style for information-box table (search results, driving directions) */ -.results-table -{ - border-spacing:0px; - width:100%; -} -.results-odd -{ - background-color: #FFFDE3; -} -.results-even -{ - background-color: #FFF9BB; -} -.result-items -{ - text-align:left; - vertical-align: middle; - width:100%; - padding:1px; - border-bottom: 1px solid black; -} -.result-directions -{ - text-align:left; - vertical-align: middle; - padding:1px 5px 1px 5px; - border-bottom: 1px solid black; -} -.result-direction -{ - height:36px; - width:36px; -} -.result-distance -{ - text-align:right; - vertical-align: middle; - padding:1px 1px 1px 5px; - border-bottom: 1px solid black; -} -.no-results -{ - text-align:center; - margin:28px; -} - - /* header area */ #printing-header { @@ -136,6 +42,93 @@ div.header-title } +/* content area */ +div.label +{ + font-weight:bold; + margin-bottom:10px; +} +.box +{ + width:500px; + margin:5px; +} +#overview-map +{ + width:500px; + height:500px; + margin:5px; +} + + +/* description content */ +.description +{ + border-spacing:0px; + width:100%; +} + +/* styles for description header */ +.description-header +{ + display:table-header-group; +} +.description-header-label +{ + padding:0px 5px 0px 0px; +} +.description-header-content +{ + font-weight:bold; +} + + +/* styles for description body */ +.description-body +{ + display:table-row-group; +} +.description-body-odd +{ + background-color: #FFFDE3; +} +.description-body-even +{ + background-color: #FFF9BB; +} +.description-body-items +{ + text-align:left; + vertical-align: middle; + width:100%; + padding:1px; +} +.description-body-directions +{ + text-align:left; + vertical-align: middle; + padding:1px 5px 1px 5px; +} +.description-body-direction +{ + height:36px; + width:36px; +} +.description-body-distance +{ + text-align:right; + vertical-align: middle; + padding:1px 1px 1px 5px; +} +@media print { +.description-body-even > td, +.description-body-odd > td +{ + border-bottom: 1px solid black; +} +} + + /* utility styles */ .quad { @@ -154,6 +147,54 @@ div.header-title } +/* fonts */ +@media print { +.base-font { + font-family: Times New Roman, Times, serif; + font-size: 16px; + font-weight: normal; +} +.big-font { + font-family: Times New Roman, Times, serif; + font-size: 18px; + font-weight: bold; +} +.medium-font { + font-family: Times New Roman, Times, serif; + font-size: 14px; + font-weight: normal; +} +.small-font { + font-family: Times New Roman, Times, serif; + font-size: 12px; + font-weight: normal; +} +} + +@media screen { +.base-font { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 12px; + font-weight: normal; +} +.big-font { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 14px; + font-weight: bold; +} +.medium-font { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 10.5px; + font-weight: normal; +} +.small-font { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 9px; + font-weight: normal; +} +} + + /* iconic buttons */ .iconic-button { @@ -178,56 +219,6 @@ div.header-title } -/* fonts */ -@media print { - -.base-font { - font-family: Times New Roman, Times, serif; - font-size: 16px; - font-weight: normal; -} -.big-font { - font-family: Times New Roman, Times, serif; - font-size: 18px; - font-weight: bold; -} -.medium-font { - font-family: Times New Roman, Times, serif; - font-size: 14px; - font-weight: normal; -} -.small-font { - font-family: Times New Roman, Times, serif; - font-size: 12px; - font-weight: normal; -} - -} - -@media screen { -.base-font { - font-family: Verdana, Arial, Helvetica, sans-serif; - font-size: 12px; - font-weight: normal; -} -.big-font { - font-family: Verdana, Arial, Helvetica, sans-serif; - font-size: 14px; - font-weight: bold; -} -.medium-font { - font-family: Verdana, Arial, Helvetica, sans-serif; - font-size: 10.5px; - font-weight: normal; -} -.small-font { - font-family: Verdana, Arial, Helvetica, sans-serif; - font-size: 9px; - font-weight: normal; -} -} - - /* table */ .full { @@ -256,11 +247,7 @@ div.header-title text-align:center; vertical-align:top; } -.header-group +.stretch { - display:table-header-group; -} -.row-group -{ - display:table-row-group; + width:100%; } \ No newline at end of file diff --git a/WebContent/printing/printing.html b/WebContent/printing/printing.html index 3db6a2ac7..9206de4fb 100644 --- a/WebContent/printing/printing.html +++ b/WebContent/printing/printing.html @@ -50,15 +50,15 @@ or see http://www.gnu.org/licenses/agpl.txt.
-
Routenbeschreibung
-
+
Routenbeschreibung
+
-
Übersichtskarte
-
+
Übersichtskarte
+
From 04298b73f3b9f98d084d7bcc36c0fe05adfe9a5e Mon Sep 17 00:00:00 2001 From: shiin Date: Tue, 24 Apr 2012 23:06:19 +0200 Subject: [PATCH 15/16] added image for "head on", removed unneeded images --- WebContent/images/head.png | Bin 0 -> 710 bytes WebContent/images/raw/continue.png | Bin 414 -> 0 bytes WebContent/images/raw/default.png | Bin 240 -> 0 bytes WebContent/images/raw/markers.pdf | Bin 11596 -> 12298 bytes WebContent/images/raw/round-about.png | Bin 716 -> 0 bytes WebContent/images/raw/sharp-left.png | Bin 530 -> 0 bytes WebContent/images/raw/sharp-right.png | Bin 746 -> 0 bytes WebContent/images/raw/slight-left.png | Bin 635 -> 0 bytes WebContent/images/raw/slight-right.png | Bin 607 -> 0 bytes WebContent/images/raw/target.png | Bin 489 -> 0 bytes WebContent/images/raw/turn-left.png | Bin 676 -> 0 bytes WebContent/images/raw/turn-right.png | Bin 656 -> 0 bytes WebContent/images/raw/u-turn.png | Bin 778 -> 0 bytes WebContent/images/small/continue.png | Bin 345 -> 0 bytes WebContent/images/small/default.png | Bin 166 -> 0 bytes WebContent/images/small/round-about.png | Bin 669 -> 0 bytes WebContent/images/small/sharp-left.png | Bin 442 -> 0 bytes WebContent/images/small/sharp-right.png | Bin 402 -> 0 bytes WebContent/images/small/slight-left.png | Bin 348 -> 0 bytes WebContent/images/small/slight-right.png | Bin 344 -> 0 bytes WebContent/images/small/target.png | Bin 373 -> 0 bytes WebContent/images/small/turn-left.png | Bin 430 -> 0 bytes WebContent/images/small/turn-right.png | Bin 403 -> 0 bytes WebContent/images/small/u-turn.png | Bin 457 -> 0 bytes WebContent/main.js | 1 + 25 files changed, 1 insertion(+) create mode 100644 WebContent/images/head.png delete mode 100644 WebContent/images/raw/continue.png delete mode 100644 WebContent/images/raw/default.png delete mode 100644 WebContent/images/raw/round-about.png delete mode 100644 WebContent/images/raw/sharp-left.png delete mode 100644 WebContent/images/raw/sharp-right.png delete mode 100644 WebContent/images/raw/slight-left.png delete mode 100644 WebContent/images/raw/slight-right.png delete mode 100644 WebContent/images/raw/target.png delete mode 100644 WebContent/images/raw/turn-left.png delete mode 100644 WebContent/images/raw/turn-right.png delete mode 100644 WebContent/images/raw/u-turn.png delete mode 100644 WebContent/images/small/continue.png delete mode 100644 WebContent/images/small/default.png delete mode 100644 WebContent/images/small/round-about.png delete mode 100644 WebContent/images/small/sharp-left.png delete mode 100644 WebContent/images/small/sharp-right.png delete mode 100644 WebContent/images/small/slight-left.png delete mode 100644 WebContent/images/small/slight-right.png delete mode 100644 WebContent/images/small/target.png delete mode 100644 WebContent/images/small/turn-left.png delete mode 100644 WebContent/images/small/turn-right.png delete mode 100644 WebContent/images/small/u-turn.png diff --git a/WebContent/images/head.png b/WebContent/images/head.png new file mode 100644 index 0000000000000000000000000000000000000000..5d1d791a907866c77f58df359387dd94f093f1ee GIT binary patch literal 710 zcmV;%0y+JOP)7xV5XX;{7O}A92`EEZDtLl!Ox?PbC+HKfR0wrpVeNug5HG;ULjXgOI#3>< z&>f))RG$l~8li;9K7WY&OBNCF9p)F?Ip>_rZnwJufG1I2;Y^j?e=dU{c(>gcTMBG9 zzy&b`U%5`8~lYJu681TL&3VHAQ&4C-EKEkSI4?& zb4+6RTxxBciJnlYR8H;z(So*7f2zS(R7QG2qtUQp>lB1)wQ9xIDF`aJJ+w^|M>q>X zRU$z0AA$&Vt=KvRVKSLmv2_YUyWO^8>lB3PbPBy*FSQ-ope?z444b_SmJTYFO3-Sx z66;|dtZPa}o-s!M;9xL-dc6*{S`7+?f{X)Js}+n!BYDom9pRr$FQs)9uZM%HVhF$x zq!#;u1_nl5PZ!6Kid%2*?B#7X5NJ!3QaiyS zD5|g#%byC&wsEY5DWO_`&xj{xO9LKQrGPQhN2Y6&cK6L>V?|6GMih8$Z( UhiSShpqOCrboFyt=akR{0I9Nv6aWAK diff --git a/WebContent/images/raw/default.png b/WebContent/images/raw/default.png deleted file mode 100644 index 7e162eb62f625bd4e5f246c8be66a28aa4ff630c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 240 zcmeAS@N?(olHy`uVBq!ia0vp^jv&mz1|<8wpL7LMEa{HEK*5du+%#MhayL=a3%Wwn;TGj YXR^?al`|%M0y>4k)78&qol`;+08Jk~lmGw# diff --git a/WebContent/images/raw/markers.pdf b/WebContent/images/raw/markers.pdf index 4cf60451a93852234158ec1a77f77060c5005cd4..6cfc6a90a5f16602c1c28fccfd5e11470fd4aa1c 100644 GIT binary patch delta 2498 zcmZWqXH=7k5~YYhSR^bc9X?zTkeY-*K!~&;C3HfQumXnOYmgF};3h(ZXkh74iUf&3 zs8VD#qAMsxiWCbauplT!KtR^VdiK4uXW#ubbLXCWX6DDtfCuqXL#G@!R9l1(l3Yy`Z?Q(VYl}WQ(=~sR*gsPRCmolw)V=nHoaOw&g?zXVLA;S-RekOEzfBQJEdPRL zc7J%e)HYnU$OqrMe(=j+yB{}$w+Fu+`KsF(-E)2w6VnUAgrjdbI`d_jCgNWZ*cg{+=F_T~)k z)~UTGH+|9TqA&Ut7^F>~{c|xeN3dq-UWg^r_q*ID|FL^3kdy z0p2zO!5+3gOpCf=v8AYy0c*qU&B_i}T;p_Zl)XAzgL}+UzMtG;Zx>qQGgGNf%XYzI zXU_LGGjJ~!u8a=)jhuvadti!Wh{5jO7Kb5cu#i^*PF0gM{OtpmpW`C;Ja?04&Jt{+ zYpAb-^+t6YyQYQ9ALP^^mb=vGE3CDo*8xQ}nv*=95FVO`C`PXKIO^2Gy=94?lkDni zWBur*?pLyd$iLDoPjqs{5qX8-&BpLw0iEcb*C-?<=nIhZu*O#+I_$0v&CKLrc~w zPT11Iig;O2MyJ=@u-7Mzj7vBZZKFZwDngsot;hjuDmOw0f~DC0JU zm*0O}`04t@^yW6MZV%eF29{b-TqM;^XgSCS4f(2MpklBpB^jQcuSB zd1@H)EC@zVLRFz3Ph&2h3b%V^bUrmSo~;8bOpw2oRyM?u@{_qVDQEY13G-6BOG9`V z{jwEK{Ev5>NOJftH58b>q+eOIs5?%?15RS(N1V-8b8oBhW)>~zsCAisdOW)To99xk z5>T<)$F?xeV$M{fsH1&^)Mu_8&bjGx91l~if9n+zRZ)uRA=}&!nk4_0C?%5hC*MGv zi`E4*nOynCV*IUz*pL8>s4OrWF_?<_Y2^iFtX39a#Z$Cy#^>69S3 zU*=z{gbd=-Hz6f!n6#)Bzjrc>`r{oZS}X4ik=i|qg;LygS2vXi2X&3VbGVJR@GCr% zyJ{k{z43zsU_#E3kn+#1ryN|-hW@-v=iZ&{OO}0d`1NV{LrDZC_Wk%dr&79}eYx6b zjquG<1S4iF?cym^saOlGF*FaD;8T6$S?iGvT|J*oQKIa`Hd)QmBdQi$-|P>HD(-Pf z&b9?dsicvH%}4$q1O^tV!?DwaWe`QzruA6Q2|8M=Z&PAw9MhJvn9j#sM&DKSFEHpA}p;|1ntKCF)*$uqjiVFoElVv zN*_NxYR)^Q04`&)QZIaAj~~e7B5iky z8r14yBFz!_ajLCx_wLejxEW2%ft@`tKLSgPO`j#Slk7eEwoqDkNxcG=VCf@Q-%P<3 zVT0(78D8mxLW(i=K!5G`#Y*oP#yop4y$Z+5d~aIy_t4RVtU9#E@|tarZh_PVb! z^~zRe+;Q1GFY$F_L!akj?O?yW=?pA&XXRyDoJbnRxAh#xlMAXC+GcsVwQO zL_)ii@+NXd>*2YCrG+(qg?+++5hAz0Q|LH2f#=q@M1@gZU2zQ-4d^VZY|zYfGrenl z?fOE*FyeCPB2`>Sk@jNV2z8~jD^khrTh+Sk4n02j&J@Sy+%RP&G2o}Qn{-~mq?x!N zT9QY_8C9}h>SJARon)h{y>l|9L~7aB<`lg>q1G8Md5W;K2&F?=juT3mRK}cyX#rY* zBY*`Vk-*WP4)+NH!5|a^6_y+X0vH%*+5^fEs0tE^1(3*pYM>P1vw;rUP;DqoOIuq{ zPTJ6;uKoh>-=Y>m z_bB@}hk*UR2~-REFC7G;4b`I@s7b?NAWg^c@E8CF`D4+A0TF-OiCKSH=uV8%29;^UD z0(CZ-=}bG_&g`kzrU%8AZB1m!E6GXRo%V0<10)$F6g$6mlkUY29v_d7$KwIEKa(FM z7=JW!4||}zoP134Wue=W#l`fOpC~32`%ScWm(*v$L0L2+TMSV&D*$MqpB{88)ydXOqZuXKi^s`G0sWO~VN1nt_|j@)2C_)@l9XG&XU0b3RYY zd6t}2Km*lfoL9@D+{863T6Hm1icHr!mILnq5idlNOe+)6utvig%}Hz)X?64BTuvH! zsfS*kH1?`2cH2=7N>lDKFr5^#{8$h5%yuTmUD^_QXolCt{j*%_n$}FtM}2H2U4Jpt zvsIy94p5%XmtV z&dZ{zPF&81ou+yEl3lgR2MymQwW z{1xLxHpq5*Xs3_&(c_3d{Sx*BwqUoRx=!NTG%2U(HqLfXhoDe5%>!Z?*Ig^|Xs>mb zL9#L-8lXq2(!blQY8IEPqyq(RPz8w~J7%d)^SwccD3tQ}=x}iNc7g2S0)HpQ8qHUb zd65-m(_AKt!zl8yGC-`#1QxM#FCq@iHMAKJ01Y7fB+H6BV=R}Q0?rL{+VWIn+(oL$ zEZ&}wiGBdv?#gXuF!Mqx6Fs2;d`65oCL8Y!IA_6duHfI?G|807Fwma^d>-HKE#JUt zgXxfJn%`J6;(v;y{sdLg)L~jH;IX7`(SIVd#&*>|h0VMAQ)&61$04NnXc> zRYl)Ljk7wR=paTPg2MfI`$r`C};wtt<%_M9guAH&&E z6{w(Y*4+`>s*`JDOF9a@h^w{v;Fop7FMqPX8lMb+MO~Xfg8We^)KMSL5CtOiSf8wi#&|L3st$t5|nJ$d!GqkO%ZvM;#5fXyV{)Ic_=0gV+E+`2bY-nMdWZeV% zv;h-pp?&H!jawRCU>nCSIBntF0#hfLum;?->~sfh{Q-Ta%?tWA;Xe=(f_ zHMoH%TNzsDE?v}XaO<#NnO0^uf3(+m`+cms-mj#{;(gNQ_c+_GV+DjO_8n49RjWqv zyiRW|lzJg3RDTEB#C4h8H+M^UG@u!scCU!*ES}%A4+vekoDeJ!=b@5tF*!)s4wl3W z2`V}X2fb7`f?zz5+A8j>4`dXgUGHm!ma2Y-T~0Wdhpo1e1s)1`pb$SaO0v;@v^0)= z9sfR?p0e3rC3?atQHHp{mK5|Lg%}9Y3a%Hh5mJenDSrrUgtujYTw4+ zqme7;5QSbuRU9&p%gF5235M-1Lg^XL7r~$|0xu*%aJ-Ivj}bPgNAS$$avgBwVNM2h z9qY6wo1KPnJCB#&3zn4;7eY93)@(~#9;jixtueEt#|+>pjCU?>v`%w}ARTXUo?Krx(b9PbT)(^P^*8 z;XA(IzK3T?|3NXM=(xXeH)G|AMmEuP5NfY$p?^ZzkTNmwuoVI;Wh+Ea7^_FyyN|CoVrY?pVR3?TCgD*t;V)OT*sU5G>!TK+SH@;RaJ^6+2<>WuZ^ZpH!5gZefIx8OmF_T&=RRLX-@gW$K z&nvkRT_8R_3O+s{Wo~3|VrmLAFq5Y&X&y5%HZe0YGBY_T3O+s{Wo~3|VrmL_a%E-; zFd#EAlP)bA7&tXCHXtxCFfcG6ZXgOUFfcGMF)%bTG_zqX1p+HFGd3VFFfcGMAZ{QE zFfcGMFflMSH8dbFFfcGMAZ{QEFfcGMFflMUHaC;GFB~;73NKP`Z*(9sIUq0~QVK6g nZf0*FGcX`9AW{lGJ_>VmVRCeMa%E-;F)%neH3}sqMNdWw5N)@k diff --git a/WebContent/images/raw/round-about.png b/WebContent/images/raw/round-about.png deleted file mode 100644 index e342a99cf8595ba6125688c2e858f1005d6db065..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 716 zcmV;-0yF)IP)XU((NT<`u#WI>ZPNxs1 zCs@?}-|2MtM;w!|DjtuAw&?kM7Wa+gg9td2$;1(WHo}Q@EQb62ZYmlMhwco75yG_{ zL&KFAnjscLuh%mbU9VU7P7p>2*Khrs*h)MP_;%mpOaPoguuvOvjW*9mjCnGf&8E}o`~UrZzuj(8@^bUMzmGN`TZREf_4mJr8}ll3OGKFB%O^5NZI^}j}~ z8~gnWz8k1p*WQ2cUm3h!>G6u*X62oXj2sROOacuIED8(|rdij8(!1+4x|XYW@*Q51 z`RkU+*}YdeSRPcyRp0t^t@U2IDwFJt_rK4oGI+&auYN7?j3J`aK>UCei!j4#fs85p z(*(ANH8R9pf9u1bks4{Y$!&*dgOe$9bc-rOgt89n0kK5S246*&z%LV1Z=SxzFx!cv z>4Asrsn35ZJsS*o_TNzSah$<$r0~zWEQUIc!+kTEF6>()SjXSOHFGD!^K_wVmdQN& zs)ZcM$())-l$~M>ezy=I1gQgFj0zu9k)+hhZb@<6BC;Q7YhyVZp diff --git a/WebContent/images/raw/sharp-right.png b/WebContent/images/raw/sharp-right.png deleted file mode 100644 index 11cffa6f095af9a94cc75a7d58d2cd3b3c30a351..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 746 zcmV2m2k7XGE000SaNLh0L01FZT01FZU(%pXi00004XF*Lt006O%3;baP0007cNkl@XCiwzRGGStrjcAn3?_e1G4labjz(V4JO!y&Skl=vm zPGUk>2pWm^E;JI;3YFgVF1&woX~@0aU4Q-edatFS*=&{qfGbvRVM7(3Z-<6qJO@3P zpkxF+02M?KfFN)Y1Rw}p1OW&F7eN4mz(o*%AaD@`AP8LH^_%df$z-zC>2&s6t=6Ga zeLkPRPp8vzGg^F}z{<6({_6Gm3EO=ARf@%8StbMNmqV}DvzEnFDwWG}xqKmQP_mt1 zS=JLQae`e6g~FYTF)2MU)@rqa3=m2~kOe|{2r@uu0YNkfZ6JsQp%nyCAhd%Z0)&kU%^FMzu(_+3{Y{!7>PtC%VJ=~l_dg5Bocj$>vp>-rx+!jFdB_aHt^R~ z`!_@&D(K@hl~+y13e$?-UqbOI_GjeauwT3#K2 zXC7_8=zwLC{!qm$2zEv-F9(EiEWYcdA7!1e2m&3E%jF(K^`Sfj8$`3&JZ9H?ZDS$W zV%Pk+2oPF95CuXz2sQ{m=Ljt!psLmCnO|)weT#I{d?ncSt3B2$jN-~I6=FI#y!)@cJFnM}Tk zYFnGjL8J%*5CkrQ00e=HAOJz&A_zbbxCjCe1TN_i+;VzbUfwwQrO^Bf*;B(XZe(G-^1nF5MzDQvkrM||cIROX)7eRoZIpKg!kU@_nFyY++|Jkv( cc1s%T8=$j8Qhsd4t^fc407*qoM6N<$f|b=Tq5uE@ diff --git a/WebContent/images/raw/slight-left.png b/WebContent/images/raw/slight-left.png deleted file mode 100644 index 2a3b41c29614b5eb85a2cb88b3a75841f111d256..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 635 zcmeAS@N?(olHy`uVBq!ia0vp^jv&mz1|<8wpL7LM>?NMQuIzW1x%ds0-v!^@3l!ok z@Q5sCVBi)4Va7{$>;3=*S<)SSftok=bN@+XWnf_9@^o<0zJ z)NaOzNaoDa(4H(k*@z>0@$UN!!iPKNABa5^Wd7)xdV%7M8&eiK3cD2+WiHzI@g1x3 z)(Fr>8IpH z3eyZ_pQNq0|Ni~?e|EJ$Rg<$^Tz_Pn&yeWQ;ONe27iL`8b>a2bKC!=Y0%C`@y`Ai$ z(Bdo65w`m4`@b`NbGlVGI#>xi|Ft~#Xp8fNiT8y{T7d4Je!8}+{G?&&#U&iO;9-== zlEA{F%%Geg!6?CanBxG41X?i8QabV3H@iPzZP@$ka*FRj0qpj3#r`ax%Q9Ad$>(;b zFBR12nj=1s52Ur>e)*w90hTMZir!u#`uv`6gUVZs?$3(Sy4F8!jt?-EFnGH9xvX
?NMQuIzW1x%drbB1}It0EIXU zJR*x37`TN%nDNrxx<5ccmUKs7pyrMJ+mzi`{bf{F=QEh-9Z z&5o8|ITodDu9O#Dc>8Uf>&|6m`fkSy^_)1=Pi>s{JaVQ(2lqrtmcYdqE2fm{=KfO> z7ta5gwe^?6>#AF}oW%{-Z{}>jK^;F9uzKMGRBCmVQ5@;KKOgYt{3` z7f<+=$SuserNiKJ`AcSVW+6wxwu-)|n%`>PPUK^`Ug~eQvvT9t-+veXKev@*;w;t> zk%p)038F4p0$E#c6;EQ=-zmD}{cr1)4l6>m^gWr6_=U4%GVD_FV7(yfsKtCsQ_U&)T0kD}GyUy7a;b9lyi#SH5|@ zj{7|e6B9ejuWEG}cE<%(I;T#xn(OcTY#CxJF!e8kd_lH6E5m~|z?8t?>FVdQ&MBb@ E0HUe&y#N3J diff --git a/WebContent/images/raw/target.png b/WebContent/images/raw/target.png deleted file mode 100644 index 3bcb3b732d07b6e99803c7fb9722ffd8130c65ef..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 489 zcmeAS@N?(olHy`uVBq!ia0vp^jv&mz1|<8wpL7LMEa{HEK*5du+g3=Lga}yiO=VEzW4Nx*tX;QyTd1s z+H$U5_xi7;-R#v96HVp$rk!MF5pZB&Y_S$xwd&TY)JTuM2hm$_tp?oyE=w_9z?NMQuIzW1IXES_+?4Z}fkK=G z9+AZi4BSE>%y{W;-5;PJOS+>kQ1ixq?mvmF3=B-ho-U3d6}R5rvh_dYAi@5Dy-A6C zat(tk8@F(=m_^rBEJmb{&zsU?clAiKyGnu*nak|yqx`TNO|M`Y&muRA#!*drW z4 zuWER&6uFa^`N3<3vR{jxALhROTBUwUpoE#jYhl2T38oPiYAEl z&nxf0`-)E0HMP#UwD#b%Q~ax5MOAg(QQKkmO>MmXl^@`!PqkF0u diff --git a/WebContent/images/raw/turn-right.png b/WebContent/images/raw/turn-right.png deleted file mode 100644 index fc759cf83f939002a1f638f48a4d6750d25ed840..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 656 zcmeAS@N?(olHy`uVBq!ia0vp^jv&mz1|<8wpL7LM>?NMQuIzW1IXER)ugxi*1Qg;d z@Q5sCVBi)4Va7{$>;3=*S<)SSftok=bN@+XWnf^E_jGX#skrs__J03E4kGLy+?ySz z`FFv`fAe)LE$XQa$i`GS<>g3^*N@&|f-#U3A0sdrrL+-Wd#{eJwhLVYvGfBqdCu~OtH*7z?agnug=ShhNhw;f-wvbN^^ z7dPK^Id6M@)!utMwHi8d<{l{TSpH0W-N~z2UoB5Ix*JRI_&IF#nC1HVdgJu%{j;4q ztS^OGF->wXm|Mya)Ve{>Axj{H0p!aBQ>OU7{Ur0co-MECVUB1*B1D2Pw6tVQC~tf2P220ixlJe&#yB!_fFjRuHpGl+w;k% zZ_SVkSi~W5EJEwQp?fitKof@|gJOpOm~kL}Zh=_a!k7Cby!-g&@~do2?g~!+$?A8@ W^(JSI#Wi5kVeoYIb6Mw<&;$VGX9ywy diff --git a/WebContent/images/raw/u-turn.png b/WebContent/images/raw/u-turn.png deleted file mode 100644 index a2e0e7888f2891cef85a4babd26180e70fdb5ef4..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 778 zcmV+l1NHogP)*oMqv8@9!<^1mP zHjzkt)7=%GoqvorSeUzD~|sq}R;8of|1!FAmW!!TUk z9p1LFD`GC%m%w9!<2bq1YV|1S@v33B=hbXBd#Y5zF~Gj0$FY|n3Q2$ymw;1s>?Mfi zDpHcAZLn$Tr)60mYqi>EnQ^<_?wd}hV@aExg60X6$pn|>cFxuHdc7^P^Y^J%tDp9r zzu9aG^-JmPkV>U~tBTE1<%z6VCp{*JLK5JJC6vqMFR_=v#+zmACCG#%07>AG1Rx0< zk^m%uLlS@_a7Y4>1WsTH%jGhqyYbp342Q#4x*M-u!YM%#fFy8sF1h0$nuEch@^BEu z1&w~cf3q+6cs#ytx7%+w9bc(b2Kjvchi(C!T}$pNYY*;X2S#McU&@j@JCVs6`(3tp zjES*j$9)J^v4ob8OeX)z7U2oN*s3MmFXIU;LAHoP3h;x_>>xu#R0Rl22rDAW0(?mb zDkACvd`s{vLZtx1F#hcO4AwM?#0pfOfSqz(*DMx`w&OU@4lMw|M2jVJxoyQ+C`q`e zGfXij)-rBNsPHv>PetdI5Jti#5l1HgB$VrTw??DU_<;MZR_k4q2f>Ymy%J6V`Y8=0 zfkP62BydOqkOU4%0FuD*GRBuIVba|eZJe>rW1gSW-4LDp2Mn{Ff(dEVV*mgE07*qo IM6N<$f~C+~761SM diff --git a/WebContent/images/small/continue.png b/WebContent/images/small/continue.png deleted file mode 100644 index 11784c269961dcaa3f0ed326b38e0b9fbcf73db4..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 345 zcmeAS@N?(olHy`uVBq!ia0vp^LLkh+1|-AI^@Rf|_7YEDSN1zB!fbL@97i_I0t#^! zctjR6FmQbUVMeDlCNqG7Ea{HEjtmSN`?>!lvI6-pJY5_^DsCnJ`Tu`ECo}WmQZ_Hf z3ktC{pVqBgcc-qdE=WXj$+~stPMB^p-9==F6O-;>@%{+`o{~12UFG%!X zvUKTJ4cysb3CGPEM0Enj4aO($CF#sHLraIV~mS52ukw zc(}Q=%C`Fdbz(Ws5=2?D{_!u_S6WuKk9{V$>7Uu1ohQv>?2-?O*PT0ePQKxaJ)07P zuwj=Quhc3w$ID`sY@FQO|C!ZX41V9gM{eO(pr08$UHx3vIVCg!04AY_t^fc4 diff --git a/WebContent/images/small/default.png b/WebContent/images/small/default.png deleted file mode 100644 index caa54d295ee683004100fb089469d417752b0415..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 166 zcmeAS@N?(olHy`uVBq!ia0vp^LLkh+1|-AI^@Rf|_7YEDSN1zB!fbLT?`!7I1qyK% zctjR6FmQbUVMeDlCNqG7Ea{HEjtmSN`?>!lvI6<0o-U3d6}OWA{Qtk7lbQK&DH|6f zx4{3Dl$1YSD;<5NNEu{ZSmC&st+%Av;ps$$4F#8%UQu9h=jDuv%#c$78o=P`>gTe~ HDWM4fMiVcn diff --git a/WebContent/images/small/round-about.png b/WebContent/images/small/round-about.png deleted file mode 100644 index 9641c26e29b2b2e069a6c41be5a66fabbbd73258..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 669 zcmV;O0%HA%P)U9xd=Kc?2BV$%p*8f05z-*9VAeUivvZJG;vY43I8<<93 zUf%!u`uZ2`?Cj193JQLPiGvISxeQq^O2A4S-jEu})bc1SZYadEVO5Opnf%2|64f^=;;~NnD>(?)a$B!RlO;6vxeFKYs z{`~n3PJ`Ik*bai|PoF-4!k`4*kfNd@_YWUFfYZ+3zkd(n45OHs7;a#IKLv#WFf9K1 z`}_Cy_4P?^+_+IZG&D3yK|$dYNDh=V0s{jra2f0l?%i36?imUjDkCGK z1(=G17zhA2H#Zev7%c^5bV6z=1ONa3SH~kKj888B3CP-S!BGgW00000NkvXXu0mjf D^m-$8 diff --git a/WebContent/images/small/sharp-left.png b/WebContent/images/small/sharp-left.png deleted file mode 100644 index 3961e8d4632f181bc081b92d5ce93f71b3ec1962..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 442 zcmV;r0Y(0aP)Y>d0fGjZnVBiN zySqz**fKIQ_RpU`U-$3dKYk`AravG@gB3C{aS$}<<;#~EhYlUu33PtKvuDpX01e?~ zW@i3uVq%gCOd7w43T;prLH++1hJl8B)YR1UI&7to+@ATb>sokUW@=sz%wimqS3 zzKtlCAR7dXoqtGTjIUq6E(3Z?i4=pt>Bz>$<{;1u)<6Rp;Sww?KS?%d;lhPKfYb>r z@?0c&jTrFt>(|$08zd$s28>j2GGYKGiN6HBh6~8a$$gKGj#mEr_b=mz4R07*qoM6N<$f_C4q%K!iX diff --git a/WebContent/images/small/sharp-right.png b/WebContent/images/small/sharp-right.png deleted file mode 100644 index 7ff55fa562a7e5b3e4918910b6f6205880ec1e6e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 402 zcmV;D0d4+?P)w^amrsFb1On*Sx&E wE&-!l9vT*}4jw#+Q!OJfuh{|V_mp}K0N@K`#u-dc4gdfE07*qoM6N<$g2Y~;DF6Tf diff --git a/WebContent/images/small/slight-left.png b/WebContent/images/small/slight-left.png deleted file mode 100644 index 81596f5bca463b554d24b21ad781006206087b67..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 348 zcmeAS@N?(olHy`uVBq!ia0vp^LLkh+1|-AI^@Rf|_7YEDSN1zB!fbMqs}>)A0Tkja z@Q5sCVBq=y!i-L9OlANDS<)SS9T^xl_H+M9WCikHd%8G=RNPAb^Z);TPG;uArEFY` z+yehoQd0hSt#tI6BGqtJL0VecQBiTBc1%o+e_}*vsA+pj^SwQlhd=)OoW3;w{yxtJ z17qXQ4_B;MkttIB_WAkw*KTji4OYCZkeBx^*vH3bfBoNIs-+JPweAfH3Sv`{JaX{h zNB4+`9s8FoIT95YXUCl)A>gsM>TA~QY172&rZZlisHbPi$=Ru+@Kw6w|EpK8)F#Nf zMQ_WAWbjGezfjC*Qm%kz!WD&rg#Sys9OL)ZRQCGMW1YXGv-9Nk7cVlN?yvuERQKb< r!?%aq`3qO2vRK{Z^Vq-Kq=&)NCGvjM)rdDhZ!>th`njxgN@xNAhzg8S diff --git a/WebContent/images/small/slight-right.png b/WebContent/images/small/slight-right.png deleted file mode 100644 index 1060453abd41f765c1f22bd736374505acd37155..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 344 zcmeAS@N?(olHy`uVBq!ia0vp^LLkh+1|-AI^@Rf|_7YEDSN1zB!fbLp$LrLYfkK=G z9+AZi3|t>Tn9*sC$qb+%OS+@4BLl<6e(pbstU&&APZ!6Kid)Hl{{P?4$;^DXl#Pp# zTi}06O3ELvm5x4Bq#PzWrlqCbv$3)1-??MQye0#4^Y6~m($cCTt_KV*sU9q;QLwiDT{)xt$dMzv!q!F|)zR0FPsz_;@3_TLN=oXO!|nQJ9zjvjxe`)Rr+O~G zJR-$%q)en$aAU$11uovC)YMkP|C={#_;Y;uG(nNS2Q>Ee_zKN<5uu{0dek8&p{vd| m``ViOKX{my_J5yJ#mnG3!ArP0JKYZGWd=`IKbLh*2~7ZyHG};C diff --git a/WebContent/images/small/target.png b/WebContent/images/small/target.png deleted file mode 100644 index 25607006dfb92f19b1c6f63d04da006fede02a54..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 373 zcmeAS@N?(olHy`uVBq!ia0vp^LLkh+1|-AI^@Rf|_7YEDSN1zB!kn54d4Jcu1PXB$ zctjR6FmQbUVMeDlCNqG7Ea{HEjtmSN`?>!lvNA9*vUs{UhE&{2{`3F;eokiQ!=-Fo zjNAhMQ&Lj??8>^T_3Usv|7H$O&cFFNIe%O?c{+%{Y|4m?yqRTZx3AsC#%6ot7ad7S z$?tF8@{Li>^%Iw*{J6EiDVOdxA zFZ#@xGw&Od6t4ec?Oa&RE1tj-b?D>Q*WsQ5YEO*SyqGIFBw2XQ?05Lnzramx+4&PS zJqN@@ME0nwsfm64^)-9@eEWKAcV(_g6_tDV#lAf>*xz!Ny~!PgireFdM%;ZJvK`LY|P$wG|JQ9J3_Y7@Q`>`Y=}f Rod^sc22WQ%mvv4FO#le^kAMIG diff --git a/WebContent/images/small/turn-left.png b/WebContent/images/small/turn-left.png deleted file mode 100644 index 9e2d7b4688827cb872e3e1573a7c75a7d16fa856..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 430 zcmV;f0a5;mP)Tq&$iel6B_wV2DpFVwhbMD-^yFlOk2MYqj zNH;Vzl$oEOe-V)T2c(V|3^d@Uyu7>xiq}@JUJW$w|1VO!0#wh!!NCD{G0bcKR8>_o zf#Jgf^jeI%x_Z5gjLdRu1^~Te0*r`dKqe#5Abw<%b&+F?hlgi@wzhUME|+w7cZ&fj zkn8{I>+8p01U3kqJ$v>ykV4;cx?AS3*5U#JUXQId;YyjjnL24KV Y0B+iawxLFCivR!s07*qoM6N<$f~XI<1poj5 diff --git a/WebContent/images/small/turn-right.png b/WebContent/images/small/turn-right.png deleted file mode 100644 index f56af46eb73bb488fd60f4c2107c283041be82fe..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 403 zcmV;E0c`$>P)D83KYRAZ48?25j~{3K^XCr_Dc)paV)_I0!9Nh21)BmH8JQ{S>gp4*$q5Ju z2(4Ya_82=m`*m?~agT!s557V1+OcEDID!8E405uzwss0GSDZO>h6`xOIayg*DT-nZ z7$HA^hPXd|{P-ENI18x;0bLCWlh+vGMXEu#zz{JAn1a8OY7jiIB_$>Q0|W9Ki2d!` xw+|#c2|4$J(h>**#Yp!usl^CBuL)AaFaXN}a?Pm*g%$t+002ovPDHLkV1n6+o8|xj diff --git a/WebContent/images/small/u-turn.png b/WebContent/images/small/u-turn.png deleted file mode 100644 index cf7c37b463886121a83d778081038f6db413b1c7..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 457 zcmV;)0XF`LP)p3RjXDpv$C>+y!n?1{98sw#ty5Cl$4a1fD|i~`yZ+S9e~t; zT*}1D%PWY}YcQaws5ou)>eUtK;$2-`hCr7e02#){#>Pv~ARu^WVq)?QU2x&Tg*Si( z{m14^l7P0h_IIeaDKiKcpp8L$_wMBYrX4PF3<3wXy}dol^XJcVXU&==_V@2!a7=vp z^2HVya}7K^JUcF5zI+0kW}sR`SiuscsHkW#6B83CAmND)n7R)E(-uFn<}+u`fL#0& zB(JQj?2cg&2nY!Y1py8F0ySj6ii!#!x-0JAzs~_o{WpR5j+~sF6;^|wE(-!0xL#gf zUI15k?BBni1*i`-4Wb)Fl~|($fSe~t4OamGV#0nGVL+Ai00000NkvXXu0mjffCab? diff --git a/WebContent/main.js b/WebContent/main.js index 233075b5b..0631c3743 100644 --- a/WebContent/main.js +++ b/WebContent/main.js @@ -71,6 +71,7 @@ OSRM.prefetchImages = function() { {id:'direction_6', url:'images/slight-left.png'}, {id:'direction_7', url:'images/turn-left.png'}, {id:'direction_8', url:'images/sharp-left.png'}, + {id:'direction_10', url:'images/head.png'}, {id:'direction_11', url:'images/round-about.png'}, {id:'direction_15', url:'images/target.png'} ]; From 0068d4062d4b4d7af5981baa0073019a37b27191 Mon Sep 17 00:00:00 2001 From: shiin Date: Tue, 24 Apr 2012 23:23:27 +0200 Subject: [PATCH 16/16] changed header area for normal routes --- WebContent/main.css | 29 ++-- WebContent/printing/OSRM.Printing.js | 6 +- WebContent/routing/OSRM.RoutingDescription.js | 147 ++++++++++-------- 3 files changed, 103 insertions(+), 79 deletions(-) diff --git a/WebContent/main.css b/WebContent/main.css index bf85c17bb..a40f9ba8a 100644 --- a/WebContent/main.css +++ b/WebContent/main.css @@ -248,6 +248,11 @@ html, body { font-weight:bold; margin-bottom:10px; } +.header-label +{ + font-weight:normal; + padding:0px 5px 0px 0px; +} .header-content { font-weight:normal; @@ -265,57 +270,57 @@ html, body { /* style for information-box table (search results, driving directions) */ -.results-table +.description { border-spacing:0px; width:100%; } -.results-odd +.description-body-odd { background-color: #FFFDE3; } -.results-even +.description-body-even { background-color: #FFF9BB; } -.result-counter +.description-body-counter { text-align:right; vertical-align:top; font-weight:bold; padding:1px 5px 1px 5px; } -.result-items +.description-body-items { text-align:left; vertical-align: middle; width:100%; padding:1px; } -.result-directions +.description-body-directions { text-align:left; vertical-align: middle; padding:1px 5px 1px 5px; } -.result-direction +.description-body-direction { width:18px; height:18px; } -.result-distance +.description-body-distance { text-align:right; vertical-align: middle; padding:1px 1px 1px 5px; } -.result-item +.description-body-item { cursor:pointer; color:#000000 } -.result-item:hover +.description-body-item:hover { color:#ff0000 } @@ -496,4 +501,8 @@ html, body { display:table-cell; text-align:center; vertical-align:middle; +} +.stretch +{ + width:100%; } \ No newline at end of file diff --git a/WebContent/printing/OSRM.Printing.js b/WebContent/printing/OSRM.Printing.js index b63f6638c..00cc2ae68 100644 --- a/WebContent/printing/OSRM.Printing.js +++ b/WebContent/printing/OSRM.Printing.js @@ -89,15 +89,15 @@ show: function(response) { body += ''; body += ''; - body += ''; + body += ''; body += ""; // build route description body += ''; if( response.route_instructions[i][1] != "" ) - body += OSRM.loc(OSRM.RoutingDescription.getDrivingInstruction(response.route_instructions[i][0])).replace(/\[(.*)\]/,"$1").replace(/%s/, response.route_instructions[i][1]).replace(/%d/, OSRM.loc(response.route_instructions[i][6])); + body += OSRM.loc(OSRM.RoutingDescription._getDrivingInstruction(response.route_instructions[i][0])).replace(/\[(.*)\]/,"$1").replace(/%s/, response.route_instructions[i][1]).replace(/%d/, OSRM.loc(response.route_instructions[i][6])); else - body += OSRM.loc(OSRM.RoutingDescription.getDrivingInstruction(response.route_instructions[i][0])).replace(/\[(.*)\]/,"").replace(/%d/, OSRM.loc(response.route_instructions[i][6])); + body += OSRM.loc(OSRM.RoutingDescription._getDrivingInstruction(response.route_instructions[i][0])).replace(/\[(.*)\]/,"").replace(/%d/, OSRM.loc(response.route_instructions[i][6])); body += ""; body += ''; diff --git a/WebContent/routing/OSRM.RoutingDescription.js b/WebContent/routing/OSRM.RoutingDescription.js index 915c51306..03c91ab7d 100644 --- a/WebContent/routing/OSRM.RoutingDescription.js +++ b/WebContent/routing/OSRM.RoutingDescription.js @@ -58,78 +58,53 @@ show: function(response) { var gpx_link = '['+OSRM.loc("GPX_FILE")+']'; // create route description - var route_desc = ""; - route_desc += ''; - + var body = ""; + + body += '
'; for(var i=0; i < response.route_instructions.length; i++){ //odd or even ? - var rowstyle='results-odd'; - if(i%2==0) { rowstyle='results-even'; } + var rowstyle='description-body-odd'; + if(i%2==0) { rowstyle='description-body-even'; } - route_desc += ''; + body += ''; - route_desc += ''; + body += ''; - route_desc += '"; + body += ''; + body += ""; - route_desc += '"; + body += ''+OSRM.Utils.metersToDistance(response.route_instructions[i][2])+''; + body += ""; - route_desc += ""; + body += ""; } - route_desc += '
'; - route_desc += ''; - route_desc += ''; + body += ''; + body += ''; - route_desc += '
'; + body += '
'; + body += '
'; // build route description if( response.route_instructions[i][1] != "" ) - route_desc += OSRM.loc(OSRM.RoutingDescription.getDrivingInstruction(response.route_instructions[i][0])).replace(/\[(.*)\]/,"$1").replace(/%s/, response.route_instructions[i][1]).replace(/%d/, OSRM.loc(response.route_instructions[i][6])); + body += OSRM.loc(OSRM.RoutingDescription._getDrivingInstruction(response.route_instructions[i][0])).replace(/\[(.*)\]/,"$1").replace(/%s/, response.route_instructions[i][1]).replace(/%d/, OSRM.loc(response.route_instructions[i][6])); else - route_desc += OSRM.loc(OSRM.RoutingDescription.getDrivingInstruction(response.route_instructions[i][0])).replace(/\[(.*)\]/,"").replace(/%d/, OSRM.loc(response.route_instructions[i][6])); + body += OSRM.loc(OSRM.RoutingDescription._getDrivingInstruction(response.route_instructions[i][0])).replace(/\[(.*)\]/,"").replace(/%d/, OSRM.loc(response.route_instructions[i][6])); - route_desc += '
'; - route_desc += "
'; + body += ''; if( i != response.route_instructions.length-1 ) - route_desc += ''+OSRM.Utils.metersToDistance(response.route_instructions[i][2])+''; - route_desc += "
'; + body += ''; - // create header - header = - '
' + OSRM.loc("ROUTE_DESCRIPTION") + '
' + - '
' + - '
' + - '
' + OSRM.loc("DISTANCE")+":" + '
' + - '
' + OSRM.Utils.metersToDistance(response.route_summary.total_distance) + '
' + - '' + - '
' + - '
' + - '
' + OSRM.loc("DURATION")+":" + '
' + - '
' + OSRM.Utils.secondsToTime(response.route_summary.total_time) + '
' + - '
' + gpx_link + '
' + - '
' + - '
'; + // build header + header = OSRM.RoutingDescription._buildHeader(OSRM.Utils.metersToDistance(response.route_summary.total_distance), OSRM.Utils.secondsToTime(response.route_summary.total_time), route_link, gpx_link); // update DOM document.getElementById('information-box-header').innerHTML = header; - document.getElementById('information-box').innerHTML = route_desc; + document.getElementById('information-box').innerHTML = body; }, // simple description showSimple: function(response) { - header = - '
' + OSRM.loc("ROUTE_DESCRIPTION") + '
' + - '
' + - '
' + - '
' + OSRM.loc("DISTANCE")+":" + '
' + - '
' + OSRM.Utils.metersToDistance(response.route_summary.total_distance) + '
' + - '' + - '
' + - '
' + - '
' + OSRM.loc("DURATION")+":" + '
' + - '
' + OSRM.Utils.secondsToTime(response.route_summary.total_time) + '
' + - '
' + - '
' + - '
'; + // build header + header = OSRM.RoutingDescription._buildHeader(OSRM.Utils.metersToDistance(response.route_summary.total_distance), OSRM.Utils.secondsToTime(response.route_summary.total_time), "", ""); // update DOM document.getElementById('information-box-header').innerHTML = header; @@ -138,28 +113,68 @@ showSimple: function(response) { // no description showNA: function( display_text ) { - header = - '
' + OSRM.loc("ROUTE_DESCRIPTION") + '
' + - '
' + - '
' + - '
' + OSRM.loc("DISTANCE")+":" + '
' + - '
' + "N/A" + '
' + - '' + - '
' + - '
' + - '
' + OSRM.loc("DURATION")+":" + '
' + - '
' + "N/A" + '
' + - '
' + - '
' + - '
'; + // build header + header = OSRM.RoutingDescription._buildHeader("N/A", "N/A", "", ""); // update DOM document.getElementById('information-box-header').innerHTML = header; document.getElementById('information-box').innerHTML = "
"+display_text+"
"; }, +// build header +_buildHeader: function(distance, duration, route_link, gpx_link) { + var temp = + '
' + OSRM.loc("ROUTE_DESCRIPTION") + '
' + + + '
' + + '
' + + + '
' + + '
' + + '
' + + '
' + OSRM.loc("DISTANCE")+":" + '
' + + '
' + distance + '
' + + '
' + + '
' + + '
' + OSRM.loc("DURATION")+":" + '
' + + '
' + duration + '
' + + '
' + + '
' + + '
' + + + '
' + + '
' + + '
' + + '' + + '
' + + '
' + + '
' + gpx_link + '
' + + '
' + + '
' + + '
' + + + '
' + + '
' + + + '
'; +// '
' + OSRM.loc("ROUTE_DESCRIPTION") + '
' + +// '
' + +// '
' + +// '
' + OSRM.loc("DISTANCE")+":" + '
' + +// '
' + distance + '
' + +// '' + +// '
' + +// '
' + +// '
' + OSRM.loc("DURATION")+":" + '
' + +// '
' + duration + '
' + +// '
' + gpx_link + '
' + +// '
' + +// '
'; + return temp; +}, + // retrieve driving instruction icon from instruction id -getDrivingInstructionIcon: function(server_instruction_id) { +_getDrivingInstructionIcon: function(server_instruction_id) { var local_icon_id = "direction_"; server_instruction_id = server_instruction_id.replace(/^11-\d{1,}$/,"11"); // dumb check, if there is a roundabout (all have the same icon) local_icon_id += server_instruction_id; @@ -171,7 +186,7 @@ getDrivingInstructionIcon: function(server_instruction_id) { }, // retrieve driving instructions from instruction ids -getDrivingInstruction: function(server_instruction_id) { +_getDrivingInstruction: function(server_instruction_id) { var local_instruction_id = "DIRECTION_"; server_instruction_id = server_instruction_id.replace(/^11-\d{2,}$/,"11-x"); // dumb check, if there are 10+ exits on a roundabout (say the same for exit 10+) local_instruction_id += server_instruction_id;