Skip to content

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
...
  • 19 commits
  • 23 files changed
  • 0 commit comments
  • 1 contributor
Commits on Mar 28, 2012
@DennisSchiefer DennisSchiefer added functions to test JSONP timings 49cc0bf
@DennisSchiefer DennisSchiefer modified JSONP statistics,
rearranged OSRM debug so that it works in IE
0ab287e
Commits on Apr 03, 2012
@DennisSchiefer DennisSchiefer Merge branch 'trial/dragging' into develop
Conflicts:
	WebContent/OSRM.JSONP.js
	WebContent/OSRM.debug.js
	WebContent/main.html
bab2887
Commits on Apr 04, 2012
@DennisSchiefer DennisSchiefer added bugtracker URL to readme 060c7e4
@DennisSchiefer DennisSchiefer bugfix, so that markers will use correct mousepointer again 0f032f7
Commits on Apr 05, 2012
@DennisSchiefer DennisSchiefer drag marker can no longer be removed by clicking on it f273f0c
@DennisSchiefer DennisSchiefer corrected bug in reverse geocoder timeout handler 4ff4fcf
Commits on Apr 11, 2012
@DennisSchiefer DennisSchiefer Merge branch 'trial/printing' into develop
Conflicts:
	WebContent/OSRM.debug.js
9b599c9
@DennisSchiefer DennisSchiefer changed legal string in html file 01e4afe
Commits on Apr 12, 2012
@DennisSchiefer DennisSchiefer corrected error in route description,
made dropdown button more beautiful
393334c
@DennisSchiefer DennisSchiefer added newline to readme 61073eb
Commits on Apr 13, 2012
@DennisSchiefer DennisSchiefer reworked loading of images and icons (-> easier to add new ones),
adapted routing description to use new description ids,
fixed bug with localization dropdown and FF3,
added localization for "(found X results)"
73aeab3
Commits on Apr 14, 2012
@DennisSchiefer DennisSchiefer made it easier to remove localization and on-demand loading of new
language packs,
added parameter to say whether to use on-demand reloading,
added parameter for the directory that contains the localization files,
corrected a small bug when the string for the HEAD_ON instruction was
not available,
899d216
@DennisSchiefer DennisSchiefer moved list of supported languages and tileservers to config file bf68185
@DennisSchiefer DennisSchiefer use geocode even if no route is found c2d5208
Commits on Apr 15, 2012
@DennisSchiefer DennisSchiefer corrected error in via computation when no road was visible 25310ff
@DennisSchiefer DennisSchiefer removed fixed with from input boxes 5c4488d
@DennisSchiefer DennisSchiefer fixed error with translation of east to German 253b591
@DennisSchiefer DennisSchiefer continued work on printing support 47369a0
View
9 README.md
@@ -24,7 +24,7 @@ Branches
Bugtracking
-----------
-Please use the OSRM-Project bug tracker for submitting any bug reports or feature requests.
+Please use the OSRM-Project bug tracker [(4)] for submitting any bug reports or feature requests.
Integration into Project-OSRM repository
----------------------------------------
@@ -45,10 +45,11 @@ References
----------
[(1)] Cloudmade Leaflet: http://leaflet.cloudmade.com/
[(2)] Project OSRM: http://project-osrm.org/
-[(3)] Project OSRM Frontend: http://map.project-osrm.org/
-
+[(3)] Project OSRM Frontend: http://map.project-osrm.org/
+[(4)] Project OSRM Bugtracker: https://github.com/DennisOSRM/Project-OSRM/issues/
[(1)]: http://leaflet.cloudmade.com/ "Cloudmade Leaflet"
[(2)]: http://project-osrm.org/ "Project OSRM"
-[(3)]: http://map.project-osrm.org/ "Project-OSRM Frontend"
+[(3)]: http://map.project-osrm.org/ "Project-OSRM Frontend"
+[(4)]: https://github.com/DennisOSRM/Project-OSRM/issues/ "Project-OSRM Bugtracker"
View
3 WebContent/L.MouseMarker.js
@@ -39,7 +39,8 @@ L.MouseMarker = L.Marker.extend({
if (this._icon) {
this._icon = options.icon.switchIcon( this._icon );
- this._icon.title = options.title;
+ if (this.options.clickable) // TODO: only needed until Leaflet 0.4
+ this._icon.className += ' leaflet-clickable';
}
var panes = this._map._panes;
View
7 WebContent/OSRM.GUI.js
@@ -63,11 +63,14 @@ init: function() {
document.getElementById('main-wrapper').addEventListener("webkitTransitionEnd", OSRM.GUI.onMainTransitionEnd, false);
document.getElementById('main-wrapper').addEventListener("oTransitionEnd", OSRM.GUI.onMainTransitionEnd, false);
document.getElementById('main-wrapper').addEventListener("MSTransitionEnd", OSRM.GUI.onMainTransitionEnd, false);
- }
+ }
+
+ // set default language
+ OSRM.Localization.setLanguage( OSRM.DEFAULTS.LANGUAGE );
},
// set language dependent labels
-setLanguage: function() {
+setLabels: function() {
document.getElementById("open-josm").innerHTML = OSRM.loc("OPEN_JOSM");
document.getElementById("open-osmbugs").innerHTML = OSRM.loc("OPEN_OSMBUGS");
document.getElementById("gui-reset").innerHTML = OSRM.loc("GUI_RESET");
View
13 WebContent/OSRM.Geocoder.js
@@ -43,7 +43,7 @@ call: function(marker_id, query) {
}
//build request for geocoder
- var call = OSRM.DEFAULTS.HOST_GEOCODER_URL + "?format=json" + OSRM.DEFAULTS.GEOCODER_BOUNDS + "&accept-language="+OSRM.DEFAULTS.LANGUAGE+"&q=" + query;
+ var call = OSRM.DEFAULTS.HOST_GEOCODER_URL + "?format=json" + 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} );
},
@@ -105,13 +105,14 @@ _showResults: function(response, parameters) {
document.getElementById('information-box-header').innerHTML =
"<div class='header-title'>"+OSRM.loc("SEARCH_RESULTS")+"</div>" +
+ "<div class='header-content'>("+OSRM.loc("FOUND_X_RESULTS").replace(/%i/,response.length)+")</div>";
"<div class='header-content'>(found "+response.length+" results)"+"</div>";
document.getElementById('information-box').innerHTML = html;
},
_showResults_Empty: function(parameters) {
document.getElementById('information-box-header').innerHTML =
"<div class='header-title'>"+OSRM.loc("SEARCH_RESULTS")+"</div>" +
- "<div class='header-content'>(found 0 results)"+"</div>";
+ "<div class='header-content'>("+OSRM.loc("FOUND_X_RESULTS").replace(/%i/,0)+")</div>";
if(parameters.marker_id == OSRM.C.SOURCE_LABEL)
document.getElementById('information-box').innerHTML = "<div class='no-results big-font'>"+OSRM.loc("NO_RESULTS_FOUND_SOURCE")+": "+parameters.query +"</div>";
else if(parameters.marker_id == OSRM.C.TARGET_LABEL)
@@ -122,7 +123,7 @@ _showResults_Empty: function(parameters) {
_showResults_Timeout: function() {
document.getElementById('information-box-header').innerHTML =
"<div class='header-title'>"+OSRM.loc("SEARCH_RESULTS")+"</div>" +
- "<div class='header-content'>(found 0 results)"+"</div>";
+ "<div class='header-content'>("+OSRM.loc("FOUND_X_RESULTS").replace(/%i/,0)+")</div>";
document.getElementById('information-box').innerHTML = "<div class='no-results big-font'>"+OSRM.loc("TIMED_OUT")+"</div>";
},
@@ -154,7 +155,7 @@ updateAddress: function(marker_id, do_fallback_to_lat_lng) {
} else
return;
- var call = OSRM.DEFAULTS.HOST_REVERSE_GEOCODER_URL + "?format=json" + "&accept-language="+OSRM.DEFAULTS.LANGUAGE + "&lat=" + lat + "&lon=" + lng;
+ var call = OSRM.DEFAULTS.HOST_REVERSE_GEOCODER_URL + "?format=json" + "&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} );
},
@@ -210,7 +211,7 @@ _showReverseResults_Timeout: function(response, parameters) {
if(!parameters.do_fallback)
return;
- updateLocation(parameters.marker_id);
+ OSRM.Geocoder.updateLocation(parameters.marker_id);
}
-};
+};
View
2 WebContent/OSRM.JSONP.js
@@ -100,4 +100,4 @@ OSRM.JSONP = {
OSRM.JSONP.timeouts = {};
OSRM.JSONP.timers = {};
}
-};
+};
View
52 WebContent/OSRM.Map.js
@@ -72,56 +72,34 @@ init: function() {
OSRM.GUI.init();
// setup tile servers
- var osmorgURL = 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
- osmorgAttribution = 'Map data &copy; 2011 OpenStreetMap contributors, Imagery &copy; 2011 Mapnik',
- osmorgOptions = {maxZoom: 18, attribution: osmorgAttribution};
-
- var osmdeURL = 'http://{s}.tile.openstreetmap.de/tiles/osmde/{z}/{x}/{y}.png',
- osmdeAttribution = 'Map data &copy; 2011 OpenStreetMap contributors, Imagery &copy; 2011 Mapnik',
- osmdeOptions = {maxZoom: 18, attribution: osmdeAttribution};
-
- var mapquestURL = 'http://otile{s}.mqcdn.com/tiles/1.0.0/osm/{z}/{x}/{y}.png',
- mapquestAttribution = 'Map data &copy; 2011 OpenStreetMap contributors, Imagery &copy; 2011 MapQuest',
- mapquestOptions = {maxZoom: 18, attribution: mapquestAttribution, subdomains: '1234'};
-
- var cloudmadeURL = 'http://{s}.tile.cloudmade.com/BC9A493B41014CAABB98F0471D759707/997/256/{z}/{x}/{y}.png',
- cloudmadeAttribution = 'Map data &copy; 2011 OpenStreetMap contributors, Imagery &copy; 2011 CloudMade',
- cloudmadeOptions = {maxZoom: 18, attribution: cloudmadeAttribution};
-
- var osmorg = new L.TileLayer(osmorgURL, osmorgOptions),
- osmde = new L.TileLayer(osmdeURL, osmdeOptions),
- mapquest = new L.TileLayer(mapquestURL, mapquestOptions),
- cloudmade = new L.TileLayer(cloudmadeURL, cloudmadeOptions);
+ var tile_servers = OSRM.DEFAULTS.TILE_SERVERS;
+ var base_maps = {};
+ for(var i=0, size=tile_servers.length; i<size; i++) {
+ tile_servers[i].options.attribution = tile_servers[i].attribution;
+ base_maps[ tile_servers[i].display_name ] = new L.TileLayer( tile_servers[i].url, tile_servers[i].options );
+ }
// setup map
OSRM.G.map = new OSRM.MapView('map', {
- center: new L.LatLng(51.505, -0.09),
- zoom: 13,
- zoomAnimation: false, // false: removes animations and hiding of routes during zoom
- fadeAnimation: false,
- layers: [osmorg]
+ center: new L.LatLng(OSRM.DEFAULTS.ONLOAD_LATITUDE, OSRM.DEFAULTS.ONLOAD_LONGITUDE),
+ zoom: OSRM.DEFAULTS.ZOOM_LEVEL,
+ layers: [base_maps[tile_servers[0].display_name]],
+ zoomAnimation: false, // remove animations -> routes are not hidden during zoom
+ fadeAnimation: false
});
- // add tileservers
- var baseMaps = {
- "osm.org": osmorg,
- "osm.de": osmde,
- "MapQuest": mapquest,
- "CloudMade": cloudmade
- };
-
- var overlayMaps = {};
- var layersControl = new L.Control.Layers(baseMaps, overlayMaps);
+ // add layer control
+ var layersControl = new L.Control.Layers(base_maps, {});
OSRM.G.map.addControl(layersControl);
// move zoom markers
getElementsByClassName(document,'leaflet-control-zoom')[0].style.left=(OSRM.GUI.width+10)+"px";
getElementsByClassName(document,'leaflet-control-zoom')[0].style.top="5px";
- // initial map position and zoom
+ // initial correct map position and zoom (respect UI visibility, use browser position)
var position = new L.LatLng( OSRM.DEFAULTS.ONLOAD_LATITUDE, OSRM.DEFAULTS.ONLOAD_LONGITUDE);
OSRM.G.map.setViewUI( position, OSRM.DEFAULTS.ZOOM_LEVEL);
- if (navigator.geolocation && document.URL.indexOf("file://") == -1)
+ if (navigator.geolocation && document.URL.indexOf("file://") == -1) // convenience during development, as FF doesn't save rights for local files
navigator.geolocation.getCurrentPosition(OSRM.Map.geolocationResponse);
// map events
View
3 WebContent/OSRM.Markers.js
@@ -144,7 +144,8 @@ OSRM.DragMarker = function ( label, style, position ) {
OSRM.inheritFrom( OSRM.DragMarker, OSRM.RouteMarker );
OSRM.extend( OSRM.DragMarker, {
onClick: function(e) {
- this.parent.hide();
+ if( this.parent != OSRM.G.markers.dragger)
+ this.parent.hide();
},
onDragStart: function(e) {
var new_via_index = OSRM.Via.findViaIndex( e.target.getLatLng() );
View
2 WebContent/OSRM.Via.js
@@ -80,7 +80,7 @@ drawDragMarker: function(event) {
// get distance to route
var minpoint = OSRM.G.route._current_route.route.closestLayerPoint( event.layerPoint );
- var min_dist = minpoint._sqDist;
+ var min_dist = minpoint ? minpoint._sqDist : 1000;
// get distance to markers
var mouse = event.latlng;
View
35 WebContent/OSRM.config.js
@@ -24,13 +24,44 @@ OSRM.DEFAULTS = {
HOST_GEOCODER_URL: 'http://nominatim.openstreetmap.org/search',
HOST_REVERSE_GEOCODER_URL: 'http://nominatim.openstreetmap.org/reverse',
WEBSITE_URL: document.URL.replace(/#*(\?.*|$)/i,""), // truncates URL before first ?, and removes tailing #
- JSONP_TIMEOUT: 5000,
+ JSONP_TIMEOUT: 10000,
ZOOM_LEVEL: 14,
ONLOAD_LATITUDE: 48.84,
ONLOAD_LONGITUDE: 10.10,
ONLOAD_SOURCE: "",
ONLOAD_TARGET: "",
HIGHLIGHT_ZOOM_LEVEL: 16,
+ GEOCODER_BOUNDS: '', // the world is not enough!
+ //GEOCODER_BOUNDS: '&bounded=1&viewbox=-27.0,72.0,46.0,36.0', // bounds for Europe
+
LANGUAGE: "en",
- GEOCODER_BOUNDS: '&bounded=1&viewbox=-27.0,72.0,46.0,36.0'
+ LANGUAGE_FILES_DIRECTORY: "localization/",
+ LANUGAGE_ONDEMAND_RELOADING: true,
+ LANGUAGE_SUPPORTED: [
+ {display_name:"en", encoding:"en"},
+ {display_name:"de", encoding:"de"}
+ ],
+
+ TILE_SERVERS: [
+ { display_name: 'osm.org',
+ url:'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
+ attribution:'Map data &copy; 2011 OpenStreetMap contributors, Imagery &copy; 2011 Mapnik',
+ options:{maxZoom: 18}
+ },
+ { display_name: 'osm.de',
+ url:'http://{s}.tile.openstreetmap.de/tiles/osmde/{z}/{x}/{y}.png',
+ attribution:'Map data &copy; 2011 OpenStreetMap contributors, Imagery &copy; 2011 Mapnik',
+ options:{maxZoom: 18}
+ },
+ { display_name: 'MapQuest',
+ url:'http://otile{s}.mqcdn.com/tiles/1.0.0/osm/{z}/{x}/{y}.png',
+ attribution:'Map data &copy; 2011 OpenStreetMap contributors, Imagery &copy; 2011 MapQuest',
+ options:{maxZoom: 18, subdomains: '1234'}
+ },
+ { display_name: 'CloudMade',
+ url:'http://{s}.tile.cloudmade.com/BC9A493B41014CAABB98F0471D759707/997/256/{z}/{x}/{y}.png',
+ attribution:'Map data &copy; 2011 OpenStreetMap contributors, Imagery &copy; 2011 CloudMade',
+ options:{maxZoom: 18}
+ }
+ ]
};
View
2 WebContent/OSRM.debug.js
@@ -65,5 +65,5 @@ OSRM.debug.init = function() {
// onload event
if(document.addEventListener) // FF, CH
document.addEventListener("DOMContentLoaded", OSRM.debug.init, false);
-else // IE
+else
document.onreadystatechange = function(){if(document.readyState == "interactive" || document.readyState == "complete") OSRM.debug.init();};
View
BIN WebContent/images/selector.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
43 WebContent/localization/OSRM.Locale.de.js
@@ -35,6 +35,7 @@ OSRM.Localization["de"] = {
"GUI_LEGAL_NOTICE": "GUI2 v"+OSRM.VERSION+" "+OSRM.DATE+" - OSRM hosting by <a href='http://algo2.iti.kit.edu/'>KIT</a> - Geocoder by <a href='http://www.osm.org/'>OSM</a>",
// geocoder
"SEARCH_RESULTS": "Suchergebnisse",
+"FOUND_X_RESULTS": "%i Ergebnisse gefunden",
"TIMED_OUT": "Zeitüberschreitung",
"NO_RESULTS_FOUND": "Keine Ergebnisse gefunden",
"NO_RESULTS_FOUND_SOURCE": "Keine Ergebnisse gefunden für Start",
@@ -51,7 +52,7 @@ OSRM.Localization["de"] = {
"NO_ROUTE_FOUND": "Keine Route hierher möglich",
// directions
"N": "Norden",
-"O": "Ost",
+"E": "Ost",
"S": "Süden",
"W": "Westen",
"NE": "Nordost",
@@ -60,28 +61,28 @@ OSRM.Localization["de"] = {
"NW": "Nordwest",
// driving directions
"DIRECTION_0":"Unbekannte Anweisung[ auf <b>%s</b>]",
-"DIRECTION_1":"Links abbiegen[ auf <b>%s</b>]",
-"DIRECTION_2":"Rechts abbiegen[ auf <b>%s</b>]",
-"DIRECTION_3":"Wenden[ auf <b>%s</b>]",
-"DIRECTION_4":"Fahren Sie Richtung <b>%s</b>",
-"DIRECTION_5":"Geradeaus weiterfahren[ auf <b>%s</b>]",
+"DIRECTION_1":"Geradeaus weiterfahren[ auf <b>%s</b>]",
+"DIRECTION_2":"Leicht rechts abbiegen[ auf <b>%s</b>]",
+"DIRECTION_3":"Rechts abbiegen[ auf <b>%s</b>]",
+"DIRECTION_4":"Scharf rechts abbiegen[ auf <b>%s</b>]",
+"DIRECTION_5":"Wenden[ auf <b>%s</b>]",
"DIRECTION_6":"Leicht links abbiegen[ auf <b>%s</b>]",
-"DIRECTION_7":"Leicht rechts abbiegen[ auf <b>%s</b>]",
+"DIRECTION_7":"Links abbiegen[ auf <b>%s</b>]",
"DIRECTION_8":"Scharf links abbiegen[ auf <b>%s</b>]",
-"DIRECTION_9":"Scharf rechts abbiegen[ auf <b>%s</b>]",
-"DIRECTION_10":"In den Kreisverkehr einfahren und bei erster Möglichkeit[ in Richtung <b>%s</b>] verlassen",
-"DIRECTION_11":"In den Kreisverkehr einfahren und bei zweiter Möglichkeit[ in Richtung <b>%s</b>] verlassen",
-"DIRECTION_12":"In den Kreisverkehr einfahren und bei dritter Möglichkeit[ in Richtung <b>%s</b>] verlassen",
-"DIRECTION_13":"In den Kreisverkehr einfahren und bei vierter Möglichkeit[ in Richtung <b>%s</b>] verlassen",
-"DIRECTION_14":"In den Kreisverkehr einfahren und bei fünfter Möglichkeit[ in Richtung <b>%s</b>] verlassen",
-"DIRECTION_15":"In den Kreisverkehr einfahren und bei sechster Möglichkeit[ in Richtung <b>%s</b>] verlassen",
-"DIRECTION_16":"In den Kreisverkehr einfahren und bei siebter Möglichkeit[ in Richtung <b>%s</b>] verlassen",
-"DIRECTION_17":"In den Kreisverkehr einfahren und bei achter Möglichkeit[ in Richtung <b>%s</b>] verlassen",
-"DIRECTION_18":"In den Kreisverkehr einfahren und bei neunter Möglichkeit[ in Richtung <b>%s</b>] verlassen",
-"DIRECTION_19":"In den Kreisverkehr einfahren und bei zehnter Möglichkeit[ in Richtung <b>%s</b>] verlassen",
-"DIRECTION_20":"In den Kreisverkehr einfahren und bei einer der vielen Möglichkeiten[ in Richtung <b>%s</b>] verlassen",
-"DIRECTION_21":"Sie haben Ihr Ziel erreicht"
+"DIRECTION_10":"Fahren Sie Richtung <b>%s</b>",
+"DIRECTION_11-1":"In den Kreisverkehr einfahren und bei erster Möglichkeit[ in Richtung <b>%s</b>] verlassen",
+"DIRECTION_11-2":"In den Kreisverkehr einfahren und bei zweiter Möglichkeit[ in Richtung <b>%s</b>] verlassen",
+"DIRECTION_11-3":"In den Kreisverkehr einfahren und bei dritter Möglichkeit[ in Richtung <b>%s</b>] verlassen",
+"DIRECTION_11-4":"In den Kreisverkehr einfahren und bei vierter Möglichkeit[ in Richtung <b>%s</b>] verlassen",
+"DIRECTION_11-5":"In den Kreisverkehr einfahren und bei fünfter Möglichkeit[ in Richtung <b>%s</b>] verlassen",
+"DIRECTION_11-6":"In den Kreisverkehr einfahren und bei sechster Möglichkeit[ in Richtung <b>%s</b>] verlassen",
+"DIRECTION_11-7":"In den Kreisverkehr einfahren und bei siebter Möglichkeit[ in Richtung <b>%s</b>] verlassen",
+"DIRECTION_11-8":"In den Kreisverkehr einfahren und bei achter Möglichkeit[ in Richtung <b>%s</b>] verlassen",
+"DIRECTION_11-9":"In den Kreisverkehr einfahren und bei neunter Möglichkeit[ in Richtung <b>%s</b>] verlassen",
+"DIRECTION_11-x":"In den Kreisverkehr einfahren und bei einer der vielen Möglichkeiten[ in Richtung <b>%s</b>] verlassen",
+"DIRECTION_15":"Sie haben Ihr Ziel erreicht"
};
// set GUI language on load
-OSRM.Localization.change("de");
+if( OSRM.DEFAULTS.LANUGAGE_ONDEMAND_RELOADING==true )
+ OSRM.Localization.setLanguage("de");
View
41 WebContent/localization/OSRM.Locale.en.js
@@ -35,6 +35,7 @@ OSRM.Localization["en"] = {
"GUI_LEGAL_NOTICE": "GUI2 v"+OSRM.VERSION+" "+OSRM.DATE+" - OSRM hosting by <a href='http://algo2.iti.kit.edu/'>KIT</a> - Geocoder by <a href='http://www.osm.org/'>OSM</a>",
// geocoder
"SEARCH_RESULTS": "Search Results",
+"FOUND_X_RESULTS": "found %i results",
"TIMED_OUT": "Timed Out",
"NO_RESULTS_FOUND": "No results found",
"NO_RESULTS_FOUND_SOURCE": "No results found for start",
@@ -60,28 +61,28 @@ OSRM.Localization["en"] = {
"NW": "northwest",
// driving directions
"DIRECTION_0":"Unknown instruction[ on <b>%s</b>]",
-"DIRECTION_1":"Turn left[ on <b>%s</b>]",
-"DIRECTION_2":"Turn right[ on <b>%s</b>]",
-"DIRECTION_3":"U-Turn[ on <b>%s</b>]",
-"DIRECTION_4":"Head <b>%s</b>",
-"DIRECTION_5":"Continue[ on <b>%s</b>]",
+"DIRECTION_1":"Continue[ on <b>%s</b>]",
+"DIRECTION_2":"Turn slight right[ on <b>%s</b>]",
+"DIRECTION_3":"Turn right[ on <b>%s</b>]",
+"DIRECTION_4":"Turn sharp right[ on <b>%s</b>]",
+"DIRECTION_5":"U-Turn[ on <b>%s</b>]",
"DIRECTION_6":"Turn slight left[ on <b>%s</b>]",
-"DIRECTION_7":"Turn slight right[ on <b>%s</b>]",
+"DIRECTION_7":"Turn left[ on <b>%s</b>]",
"DIRECTION_8":"Turn sharp left[ on <b>%s</b>]",
-"DIRECTION_9":"Turn sharp right[ on <b>%s</b>]",
-"DIRECTION_10":"Enter roundabout and leave at first exit[ on <b>%s</b>]",
-"DIRECTION_11":"Enter roundabout and leave at second exit[ on <b>%s</b>]",
-"DIRECTION_12":"Enter roundabout and leave at third exit[ on <b>%s</b>]",
-"DIRECTION_13":"Enter roundabout and leave at fourth exit[ on <b>%s</b>]",
-"DIRECTION_14":"Enter roundabout and leave at fifth exit[ on <b>%s</b>]",
-"DIRECTION_15":"Enter roundabout and leave at sixth exit[ on <b>%s</b>]",
-"DIRECTION_16":"Enter roundabout and leave at seventh exit[ on <b>%s</b>]",
-"DIRECTION_17":"Enter roundabout and leave at eighth exit[ on <b>%s</b>]",
-"DIRECTION_18":"Enter roundabout and leave at nineth exit[ on <b>%s</b>]",
-"DIRECTION_19":"Enter roundabout and leave at tenth exit[ on <b>%s</b>]",
-"DIRECTION_20":"Enter roundabout and leave at one of the too many exits[ on <b>%s</b>]",
-"DIRECTION_21":"You have reached your destination"
+"DIRECTION_10":"Head <b>%s</b>",
+"DIRECTION_11-1":"Enter roundabout and leave at first exit[ on <b>%s</b>]",
+"DIRECTION_11-2":"Enter roundabout and leave at second exit[ on <b>%s</b>]",
+"DIRECTION_11-3":"Enter roundabout and leave at third exit[ on <b>%s</b>]",
+"DIRECTION_11-4":"Enter roundabout and leave at fourth exit[ on <b>%s</b>]",
+"DIRECTION_11-5":"Enter roundabout and leave at fifth exit[ on <b>%s</b>]",
+"DIRECTION_11-6":"Enter roundabout and leave at sixth exit[ on <b>%s</b>]",
+"DIRECTION_11-7":"Enter roundabout and leave at seventh exit[ on <b>%s</b>]",
+"DIRECTION_11-8":"Enter roundabout and leave at eighth exit[ on <b>%s</b>]",
+"DIRECTION_11-9":"Enter roundabout and leave at nineth exit[ on <b>%s</b>]",
+"DIRECTION_11-x":"Enter roundabout and leave at one of the too many exits[ on <b>%s</b>]",
+"DIRECTION_15":"You have reached your destination"
};
//set GUI language on load
-OSRM.Localization.change("en");
+if( OSRM.DEFAULTS.LANUGAGE_ONDEMAND_RELOADING == true )
+ OSRM.Localization.setLanguage("en");
View
70 WebContent/localization/OSRM.Localization.js
@@ -20,10 +20,8 @@ or see http://www.gnu.org/licenses/agpl.txt.
OSRM.Localization = {
-
-supported_languages: [ {display_name:"en", encoding:"en"},
- {display_name:"de", encoding:"de"}
-],
+
+current_language: OSRM.DEFAULTS.LANGUAGE,
// initialize localization
init: function() {
@@ -31,30 +29,50 @@ init: function() {
var select = document.createElement('select');
select.id = "gui-language-toggle";
select.className = "top-left-button";
- select.onchange = function() { OSRM.Localization.change(this.value); };
-
+ select.onchange = function() { OSRM.Localization.setLanguage(this.value); };
+
// fill dropdown menu
- for(var i=0, size=OSRM.Localization.supported_languages.length; i<size; i++) {
+ var supported_languages = OSRM.DEFAULTS.LANGUAGE_SUPPORTED;
+ for(var i=0, size=supported_languages.length; i<size; i++) {
var option=document.createElement("option");
- option.innerHTML = OSRM.Localization.supported_languages[i].display_name;
- option.value = OSRM.Localization.supported_languages[i].encoding;
+ option.innerHTML = supported_languages[i].display_name;
+ option.value = supported_languages[i].encoding;
select.appendChild(option);
}
+ select.value = OSRM.DEFAULTS.LANGUAGE;
// add element to DOM
var input_mask_header = document.getElementById('input-mask-header');
input_mask_header.insertBefore(select,input_mask_header.firstChild);
- // initialize default language
- OSRM.Localization.change( OSRM.DEFAULTS.LANGUAGE );
+ // create visible dropdown menu
+ var textnode = document.createTextNode(OSRM.DEFAULTS.LANGUAGE);
+ var myspan = document.createElement("span");
+ myspan.className = "styled-select";
+ myspan.id = "styled-select" + select.id;
+ myspan.appendChild(textnode);
+ select.parentNode.insertBefore(myspan, select);
+ myspan.style.width = (select.clientWidth-2)+"px";
+ myspan.style.height = (select.clientHeight)+"px";
},
// perform language change
-change: function(language) {
- OSRM.DEFAULTS.LANGUAGE = language;
- document.getElementById('gui-language-toggle').value = language;
+setLanguage: function(language) {
if( OSRM.Localization[language]) {
- OSRM.GUI.setLanguage();
+ OSRM.Localization.current_language = language;
+ // update selector
+ if( select = document.getElementById('gui-language-toggle') ) { // yes, = not == !
+ var option = select.getElementsByTagName("option");
+ select.value = language;
+ for(var i = 0; i < option.length; i++)
+ if(option[i].selected == true) {
+ document.getElementById("styled-select" + select.id).childNodes[0].nodeValue = option[i].childNodes[0].nodeValue;
+ break;
+ }
+ }
+ // change gui language
+ OSRM.GUI.setLabels();
+ // requery data
if( OSRM.G.markers.route.length > 1)
OSRM.Routing.getRoute();
else if(OSRM.G.markers.route.length > 0 && document.getElementById('information-box').innerHTML != "" ) {
@@ -66,20 +84,26 @@ change: function(language) {
document.getElementById('information-box').innerHTML = "";
document.getElementById('information-box-header').innerHTML = "";
}
- } else {
- var script = document.createElement('script');
- script.type = 'text/javascript';
- script.src = "localization/OSRM.Locale."+language+".js";
- document.head.appendChild(script);
+ } else if(OSRM.DEFAULTS.LANUGAGE_ONDEMAND_RELOADING==true) {
+ var supported_languages = OSRM.DEFAULTS.LANGUAGE_SUPPORTED;
+ for(var i=0, size=supported_languages.length; i<size; i++) {
+ if( supported_languages[i].encoding == language) {
+ var script = document.createElement('script');
+ script.type = 'text/javascript';
+ script.src = OSRM.DEFAULTS.LANGUAGE_FILES_DIRECTORY + "OSRM.Locale."+language+".js";
+ document.head.appendChild(script);
+ break;
+ }
+ }
}
},
// if existing, return localized string -> English string -> input string
translate: function(text) {
- if( OSRM.Localization[OSRM.DEFAULTS.LANGUAGE] && OSRM.Localization[OSRM.DEFAULTS.LANGUAGE][text] )
+ if( OSRM.Localization[OSRM.Localization.current_language] && OSRM.Localization[OSRM.Localization.current_language][text] )
+ return OSRM.Localization[OSRM.Localization.current_language][text];
+ else if( OSRM.Localization[OSRM.DEFAULTS.LANGUAGE] && OSRM.Localization[OSRM.DEFAULTS.LANGUAGE][text] )
return OSRM.Localization[OSRM.DEFAULTS.LANGUAGE][text];
- else if( OSRM.Localization["en"] && OSRM.Localization["en"][text] )
- return OSRM.Localization["en"][text];
else
return text;
}
View
28 WebContent/main.css
@@ -128,9 +128,24 @@ html, body {
/* styles for main-input input-mask-header */
#gui-language-toggle
{
+ position:absolute;
border: 0px;
text-decoration:none;
+ opacity: 0;
+ filter: alpha(opacity=0);
+ z-index: 5;
+}
+
+.styled-select
+{
+ position:absolute;
+ background: url("images/selector.png");
+ background-repeat:no-repeat;
+ background-position: top right;
+ padding: 1px 1px 1px 1px;
+ overflow: hidden;
}
+
.top-left-button
{
float:left;
@@ -150,10 +165,18 @@ html, body {
{
padding-bottom:4px;
}
+.input-label
+{
+ margin:0px 2px 0px 0px;
+}
+.input-delete
+{
+ margin:0px 15px 0px 6px;
+ visibility:hidden;
+}
.input-box
{
- width: 250px;
- padding-right: 2px;
+ width: 100%;
}
@@ -355,7 +378,6 @@ html, body {
.delete-marker
{
background-image:url("images/cancel.png");
- visibility:hidden;
}
.delete-marker:hover
{
View
10 WebContent/main.html
@@ -99,15 +99,15 @@
<!-- source/target input -->
<div class="full">
<div id="input-source" class="input-marker">
- <div class="left"><span id="gui-search-source-label">Start:</span></div>
+ <div class="left"><span id="gui-search-source-label" class="input-label">Start:</span></div>
<div class="center input-box"><input id="gui-input-source" class="input-box" type="text" maxlength="200" value="" title="Startposition eingeben" /></div>
- <div class="center"><div id="gui-delete-source" class="iconic-button delete-marker"></div></div>
+ <div class="left"><div id="gui-delete-source" class="iconic-button delete-marker input-delete"></div></div>
<div class="right"><a class="button" id="gui-search-source">Zeigen</a></div>
</div>
<div id="input-target" class="input-marker">
- <div class="left"><span id="gui-search-target-label">Ende:</span></div>
+ <div class="left"><span id="gui-search-target-label" class="input-label">Ende:</span></div>
<div class="center input-box"><input id="gui-input-target" class="input-box" type="text" maxlength="200" value="" title="Zielposition eingeben" /></div>
- <div class="center"><div id="gui-delete-target" class="iconic-button delete-marker"></div></div>
+ <div class="left"><div id="gui-delete-target" class="iconic-button delete-marker input-delete"></div></div>
<div class="right"><a class="button" id="gui-search-target">Zeigen</a></div>
</div>
</div>
@@ -147,7 +147,7 @@
<div id="main-output" class="gui-box">
<div id="information-box-header"></div>
<div id="information-box"></div>
- <div id="legal-notice" class="small-font">GUI2 v0.1.3 120402 - OSRM hosting by <a href='http://algo2.iti.kit.edu/'>KIT</a> - Geocoder by <a href='http://www.osm.org/'>OSM</a></div>
+ <div id="legal-notice" class="small-font">GUI2 - OSRM hosting by <a href='http://algo2.iti.kit.edu/'>KIT</a> - Geocoder by <a href='http://www.osm.org/'>OSM</a></div>
</div>
</div>
View
106 WebContent/main.js
@@ -38,73 +38,72 @@ OSRM.init = function() {
// prefetch images
OSRM.GLOBALS.images = {};
OSRM.prefetchImages = function() {
- var image_names = [ 'marker-source',
- 'marker-target',
- 'marker-via',
- 'marker-highlight',
- 'marker-source-drag',
- 'marker-target-drag',
- 'marker-via-drag',
- 'marker-highlight-drag',
- 'marker-drag',
- 'cancel',
- 'cancel_active',
- 'cancel_hover',
- 'restore',
- 'restore_active',
- 'restore_hover',
- 'printer',
- 'printer_active',
- 'printer_hover',
- 'printer_inactive',
- 'turn-left',
- 'turn-right',
- 'u-turn',
- 'continue',
- 'slight-left',
- 'slight-right',
- 'sharp-left',
- 'sharp-right',
- 'round-about',
- 'target',
- 'default'
+ var image_list = [ {id:'marker-shadow', url:L.ROOT_URL + 'images/marker-shadow.png'},
+ {id:'marker-source', url:'images/marker-source.png'},
+ {id:'marker-target', url:'images/marker-target.png'},
+ {id:'marker-via', url:'images/marker-via.png'},
+ {id:'marker-highlight', url:'images/marker-highlight.png'},
+ {id:'marker-source-drag', url:'images/marker-source-drag.png'},
+ {id:'marker-target-drag', url:'images/marker-target-drag.png'},
+ {id:'marker-via-drag', url:'images/marker-via-drag.png'},
+ {id:'marker-highlight-drag', url:'images/marker-highlight-drag.png'},
+ {id:'marker-drag', url:'images/marker-drag.png'},
+ {id:'cancel', url:'images/cancel.png'},
+ {id:'cancel_active', url:'images/cancel_active.png'},
+ {id:'cancel_hover', url:'images/cancel_hover.png'},
+ {id:'restore', url:'images/restore.png'},
+ {id:'restore_active', url:'images/restore_active.png'},
+ {id:'restore_hover', url:'images/restore_hover.png'},
+ {id:'printer', url:'images/printer.png'},
+ {id:'printer_active', url:'images/printer_active.png'},
+ {id:'printer_hover', url:'images/printer_hover.png'},
+ {id:'printer_inactive', url:'images/printer_inactive.png'},
+ {id:'direction_0', url:'images/default.png'},
+ {id:'direction_1', url:'images/continue.png'},
+ {id:'direction_2', url:'images/slight-right.png'},
+ {id:'direction_3', url:'images/turn-right.png'},
+ {id:'direction_4', url:'images/sharp-right.png'},
+ {id:'direction_5', url:'images/u-turn.png'},
+ {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_11', url:'images/round-about.png'},
+ {id:'direction_15', url:'images/target.png'},
+ {id:'favicon', url:'images/osrm-favicon.ico'},
];
- for(var i=0; i<image_names.length; i++) {
- OSRM.G.images[image_names[i]] = new Image();
- OSRM.G.images[image_names[i]].src = 'images/'+image_names[i]+'.png';
+ for(var i=0; i<image_list.length; i++) {
+ OSRM.G.images[image_list[i].id] = new Image();
+ OSRM.G.images[image_list[i].id].src = image_list[i].url;
}
-
- OSRM.G.images["favicon"] = new Image();
- OSRM.G.images["favicon"].src = 'images/osrm-favicon.ico';
};
// prefetch icons
OSRM.GLOBALS.icons = {};
OSRM.prefetchIcons = function() {
- var image_names = [ 'marker-source',
- 'marker-target',
- 'marker-via',
- 'marker-highlight',
- 'marker-source-drag',
- 'marker-target-drag',
- 'marker-via-drag',
- 'marker-highlight-drag',
- 'marker-drag'
+ var icon_list = [ {id:'marker-source', image_id:'marker-source'},
+ {id:'marker-target', image_id:'marker-target'},
+ {id:'marker-via', image_id:'marker-via'},
+ {id:'marker-highlight', image_id:'marker-highlight'},
+ {id:'marker-source-drag', image_id:'marker-source-drag'},
+ {id:'marker-target-drag', image_id:'marker-target-drag'},
+ {id:'marker-via-drag', image_id:'marker-via-drag'},
+ {id:'marker-highlight-drag', image_id:'marker-highlight-drag'}
+ //{id:'marker-drag', image_id:'marker-drag'} // special treatment because of size
];
- for(var i=0; i<image_names.length; i++) {
+ for(var i=0; i<icon_list.length; i++) {
var icon = {
- iconUrl: 'images/'+image_names[i]+'.png', iconSize: new L.Point(25, 41), iconAnchor: new L.Point(13, 41),
- shadowUrl: L.ROOT_URL + 'images/marker-shadow.png', shadowSize: new L.Point(41, 41),
+ iconUrl: OSRM.G.images[icon_list[i].image_id].src, iconSize: new L.Point(25, 41), iconAnchor: new L.Point(13, 41),
+ shadowUrl: OSRM.G.images["marker-shadow"].src, shadowSize: new L.Point(41, 41),
popupAnchor: new L.Point(0, -33)
};
- OSRM.G.icons[image_names[i]] = new L.SwitchableIcon(icon);
+ OSRM.G.icons[icon_list[i].id] = new L.SwitchableIcon(icon);
}
// special values for drag marker
- OSRM.G.icons['marker-drag'] = new L.SwitchableIcon( {iconUrl: 'images/marker-drag.png', iconSize: new L.Point(18, 18) } );
+ OSRM.G.icons['marker-drag'] = new L.SwitchableIcon( {iconUrl: OSRM.G.images["marker-drag"].src, iconSize: new L.Point(18, 18) } );
};
@@ -127,12 +126,7 @@ OSRM.parseParameters = function(){
continue;
if(name_val[0] == 'hl') {
- for(var i=0, size=OSRM.Localization.supported_languages.length; i<size; i++) {
- if( OSRM.Localization.supported_languages[i].encoding == name_val[1]) {
- OSRM.Localization.change(name_val[1]);
- break;
- }
- }
+ OSRM.Localization.setLanguage(name_val[1]);
}
else if(name_val[0] == 'loc') {
var coordinates = unescape(name_val[1]).split(',');
View
81 WebContent/printing/OSRM.Printing.js
@@ -36,15 +36,29 @@ init: function() {
},
windowLoaded: function(){
- OSRM.printwindow.initialize();
OSRM.Printing.show( OSRM.G.response );
OSRM.printwindow.focus();
},
show: function(response) {
+ // create header
+ header =
+ '<div class="full">' +
+ '<div class="left">' +
+ '<div class="header-title base-font">' + OSRM.loc("ROUTE_DESCRIPTION") + '</div>' +
+ '<div class="header-content">' + OSRM.loc("DISTANCE")+": " + OSRM.Utils.metersToDistance(response.route_summary.total_distance) + '</div>' +
+ '<div class="header-content">' + OSRM.loc("DURATION")+": " + OSRM.Utils.secondsToTime(response.route_summary.total_time) + '</div>' +
+ '</div>' +
+ '<div class="right">' +
+ '</div>' +
+ '</div>';
+
// create route description
- var route_desc = "";
- route_desc += '<table class="results-table">';
+ var route_desc = '';
+ route_desc += '<table id="thetable" class="results-table medium-font">';
+ route_desc += '<thead style="display:table-header-group;"><tr><td colspan="3">'+header+'</td></tr></thead>';
+ route_desc += '</thead>';
+ route_desc += '<tbody stlye="display:table-row-group">';
for(var i=0; i < response.route_instructions.length; i++){
//odd or even ?
@@ -54,20 +68,21 @@ show: function(response) {
route_desc += '<tr class="'+rowstyle+'">';
route_desc += '<td class="result-directions">';
- route_desc += '<img width="18px" src="../images/'+OSRM.RoutingDescription.getDirectionIcon(response.route_instructions[i][0])+'" alt="" />';
+ route_desc += '<img width="18px" src="'+OSRM.RoutingDescription.getDrivingInstructionIcon(response.route_instructions[i][0])+'" alt="" />';
route_desc += "</td>";
route_desc += '<td class="result-items">';
- route_desc += '<span class="result-item">';
- route_desc += response.route_instructions[i][0];
+ route_desc += '<div class="result-item">';
+
+ // build route description
if( i == 0 )
- route_desc += ' ' + OSRM.loc( response.route_instructions[i][6] );
- if( response.route_instructions[i][1] != "" ) {
- route_desc += ' on ';
- route_desc += '<b>' + response.route_instructions[i][1] + '</b>';
- }
- //route_desc += ' for ';
- route_desc += '</span>';
+ 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]);
+ else
+ route_desc += OSRM.loc(OSRM.RoutingDescription.getDrivingInstruction(response.route_instructions[i][0])).replace(/\[(.*)\]/,"");
+
+ route_desc += '</div>';
route_desc += "</td>";
route_desc += '<td class="result-distance">';
@@ -76,29 +91,31 @@ show: function(response) {
route_desc += "</td>";
route_desc += "</tr>";
- }
-
- route_desc += '</table>';
- headline = "";
- headline += OSRM.loc("ROUTE_DESCRIPTION")+":<br/>";
- headline += '<div style="float:left;width:40%">';
- headline += "<span class='route-summary'>"
- + OSRM.loc("DISTANCE")+": " + OSRM.Utils.metersToDistance(response.route_summary.total_distance)
- + "<br/>"
- + OSRM.loc("DURATION")+": " + OSRM.Utils.secondsToTime(response.route_summary.total_time)
- + "</span>";
- headline += '</div>';
-
- var output = "";
- output += route_desc;
-
- OSRM.printwindow.document.getElementById('description-headline').innerHTML = headline;
- OSRM.printwindow.document.getElementById('description').innerHTML = output;
+ }
+ route_desc += '</tbody>';
+ route_desc += '</table>';
+
+ // put everything in DOM
+ OSRM.printwindow.document.getElementById('description').innerHTML = route_desc;
+
+ // init map
+ var map = OSRM.printwindow.initialize();
+ 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<size; i++)
+ map.addLayer( new L.MouseMarker( markers[i].getPosition(), {draggable:false,clickable:false,icon:OSRM.G.icons['marker-via']} ) );
+ map.addLayer( new L.MouseMarker( markers[markers.length-1].getPosition(), {draggable:false,clickable:false,icon:OSRM.G.icons['marker-target']} ));
+ var route = new L.DashedPolyline();
+ route.setLatLngs( OSRM.G.route.getPositions() );
+ route.setStyle( {dashed:false,clickable:false,color:'#0033FF', weight:5} );
+ map.addLayer( route );
+ var bounds = new L.LatLngBounds( OSRM.G.route.getPositions() );
+ map.fitBounds( bounds );
},
// react to click
print: function() {
- OSRM.printwindow = window.open("printing/printing.html","","width=400,height=300,left=100,top=100,dependent=yes,location=no,menubar=no,scrollbars=yes,status=no,toolbar=no,resizable=yes");
+ 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.windowLoaded, false);
}
View
210 WebContent/printing/printing.css
@@ -17,89 +17,207 @@ or see http://www.gnu.org/licenses/agpl.txt.
/* OSRM CSS styles for printing*/
+/* page setup */
+body
+{
+ margin: 8px;
+}
+
-/* printer button */
-.printer-inactive
+/* route description box */
+#description
{
- cursor:pointer;
- width:16px;
- height:16px;
- background-image:url("../images/printer_inactive.png");
+ width:500px;
+ margin:5px;
}
-.printer
+
+
+/* route map box */
+#map
{
- cursor:pointer;
- width:16px;
- height:16px;
- background-image:url("../images/printer.png");
+ width:500px;
+ height:500px;
+ margin:5px;
}
-.printer:hover
+
+
+/* styles for information-box-header */
+div.header-title
{
- background-image:url("../images/printer_hover.png");
+ font-weight:bold;
+ margin-bottom:10px;
}
-.printer:active
+.header-content
{
- background-image:url("../images/printer_active.png");
+ font-weight:normal;
}
-
-/* route summary */
-.route-summary
+.result-link
{
- font-size: 12px;
+ color:#0000ff;
+ text-decoration:none;
+ cursor:pointer;
}
-
-/* route description box */
-#description
+.result-link:hover
{
- position:absolute;
- bottom:15px;
- top:60px;
- width:380px;
- font-size:12px;
- margin:5px;
+ color:#ff0000;
}
+
+
+/* style for information-box table (search results, driving directions) */
.results-table
{
border-spacing:0px;
+ width:100%;
}
.results-odd
{
- background-color: #FAF3E9; //#ffffff;
+ background-color: #FFFDE3;
}
.results-even
{
- background-color: #F2DE9C; //#ffffe0;
+ 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-left:1px;
- padding-right:1px;
- padding-top:1px;
- padding-bottom:1px;
+ padding:1px;
}
-.result-direction
+.result-directions
{
- width:30px;
- padding-left:1px;
- padding-right:1px;
- padding-top:1px;
- padding-bottom:1px;
+ text-align:left;
+ vertical-align: middle;
+ padding:1px 5px 1px 5px;
}
.result-distance
{
text-align:right;
- vertical-align: middle;
- width:30px;
- padding-left:1px;
- padding-right:1px;
- padding-top:1px;
- padding-bottom:1px;
+ vertical-align: middle;
+ padding:1px 1px 1px 5px;
}
.result-item
{
cursor:pointer;
color:#000000
}
+.no-results
+{
+ text-align:center;
+ margin:28px;
+}
+
+
+/* header area */
+#printing-header
+{
+ left:0px;
+ right:0px;
+ top:0px;
+ height:20px;
+}
+.top-left-button
+{
+ float:left;
+}
+.top-right-button
+{
+ float:right;
+}
+
+
+/* utility styles */
+@media print {
+.quad
+{
+ page-break-before:always;
+}
+}
+@media screen {
+.quad
+{
+ min-width:10px;
+ min-height:10px;
+}
+}
+
+
+/* iconic buttons */
+.iconic-button
+{
+ cursor:pointer;
+ width:16px;
+ height:16px;
+ background-repeat:no-repeat;
+ background-position:center;
+}
+
+#gui-printer
+{
+ background-image:url("../images/printer.png");
+}
+#gui-printer:hover
+{
+ background-image:url("../images/printer_hover.png");
+}
+#gui-printer:active
+{
+ background-image:url("../images/printer_active.png");
+}
+
+
+/* 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;
+}
+}
View
48 WebContent/printing/printing.html
@@ -39,34 +39,30 @@
<!-- scripts -->
<script src="../leaflet/leaflet-src.js" type="text/javascript"></script>
+
<script>
function initialize() {
-/* // setup map
+ // setup events
+ document.getElementById('gui-printer').onclick= printsite;
+
+ // setup map
var osmorgURL = 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
osmorgOptions = {maxZoom: 18};
var osmorg = new L.TileLayer(osmorgURL, osmorgOptions);
- var temp1 = new L.Map("map1", {
+ var temp1 = new L.Map("map", {
center: new L.LatLng(51.505, -0.09),
zoom: 13,
- zoomAnimation: false, // false: removes animations and hiding of routes during zoom
+ zoomAnimation: false,
fadeAnimation: false,
layers: [osmorg],
attributionControl: false,
- zoomControl: false
+ zoomControl: false,
+ dragging:false,
+ scrollWheelZoom:false,
+ touchZoom:false,
+ doubleClickZoom:false
});
-
- var osmorgURL = 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
- osmorgOptions = {maxZoom: 18, attributionControl:false};
- var osmorg = new L.TileLayer(osmorgURL, osmorgOptions);
- var temp2 = new L.Map("map2", {
- center: new L.LatLng(51.505, -0.09),
- zoom: 13,
- zoomAnimation: false, // false: removes animations and hiding of routes during zoom
- fadeAnimation: false,
- layers: [osmorg],
- attributionControl: false,
- zoomControl: false
- }); */
+ return temp1;
}
function printsite() {
@@ -78,14 +74,20 @@
<!-- body -->
-<body>
-<div style="position:absolute;right:5px;top:5px;" class="printer" onclick="printsite();"></div>
-<!--maps-->
-<!-- <div id="map1" style='width:100px;height:100px'></div>
-<div id="map2" style='width:100px;height:100px'></div> -->
+<body class="base-font">
+
+<!-- header -->
+<div id="printing-header">
+<div id="gui-printer" class="iconic-button top-right-button"></div>
+</div>
+
<!--description-->
-<div id="description-headline"></div>
<div id="description"></div>
+<!--map-->
+<div class="quad"></div>
+<div class="header-title">Übersichtskarte</div>
+<div id="map"></div>
+
</body>
</html>
View
105 WebContent/printing/printing_screen.css
@@ -0,0 +1,105 @@
+/*
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU AFFERO General Public License as published by
+the Free Software Foundation; either version 3 of the License, or
+any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU Affero General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+or see http://www.gnu.org/licenses/agpl.txt.
+*/
+
+/* OSRM CSS styles for printing*/
+
+
+/* printer button */
+.printer-inactive
+{
+ cursor:pointer;
+ width:16px;
+ height:16px;
+ background-image:url("../images/printer_inactive.png");
+}
+.printer
+{
+ cursor:pointer;
+ width:16px;
+ height:16px;
+ background-image:url("../images/printer.png");
+}
+.printer:hover
+{
+ background-image:url("../images/printer_hover.png");
+}
+.printer:active
+{
+ background-image:url("../images/printer_active.png");
+}
+
+/* route summary */
+.route-summary
+{
+ font-size: 12px;
+}
+
+/* route description box */
+#description
+{
+ position:absolute;
+ bottom:15px;
+ top:60px;
+ width:380px;
+ font-size:12px;
+ margin:5px;
+}
+.results-table
+{
+ border-spacing:0px;
+}
+.results-odd
+{
+ background-color: #FAF3E9; //#ffffff;
+}
+.results-even
+{
+ background-color: #F2DE9C; //#ffffe0;
+}
+.result-items
+{
+ text-align:left;
+ vertical-align: middle;
+ width:100%;
+ padding-left:1px;
+ padding-right:1px;
+ padding-top:1px;
+ padding-bottom:1px;
+}
+.result-direction
+{
+ width:30px;
+ padding-left:1px;
+ padding-right:1px;
+ padding-top:1px;
+ padding-bottom:1px;
+}
+.result-distance
+{
+ text-align:right;
+ vertical-align: middle;
+ width:30px;
+ padding-left:1px;
+ padding-right:1px;
+ padding-top:1px;
+ padding-bottom:1px;
+}
+.result-item
+{
+ cursor:pointer;
+ color:#000000
+}
View
4 WebContent/routing/OSRM.Routing.js
@@ -48,6 +48,7 @@ timeoutRoute: function() {
OSRM.RoutingGeometry.showNA();
OSRM.RoutingNoNames.showNA();
OSRM.RoutingDescription.showNA( OSRM.loc("TIMED_OUT") );
+ OSRM.Routing._snapRoute();
},
showRouteSimple: function(response) {
if(!response)
@@ -77,6 +78,7 @@ showRoute: function(response) {
OSRM.RoutingGeometry.showNA();
OSRM.RoutingNoNames.showNA();
OSRM.RoutingDescription.showNA( OSRM.loc("NO_ROUTE_FOUND") );
+ OSRM.Routing._snapRoute();
} else {
OSRM.RoutingGeometry.show(response);
OSRM.RoutingNoNames.show(response);
@@ -146,4 +148,4 @@ _snapRoute: function() {
OSRM.Geocoder.updateAddress(OSRM.C.TARGET_LABEL);
}
-};
+};
View
56 WebContent/routing/OSRM.RoutingDescription.js
@@ -66,7 +66,7 @@ show: function(response) {
route_desc += '<tr class="'+rowstyle+'">';
route_desc += '<td class="result-directions">';
- route_desc += '<img width="18px" src="'+OSRM.G.images[OSRM.RoutingDescription.getDirectionIcon(response.route_instructions[i][0])].src+'" alt="" />';
+ route_desc += '<img width="18px" src="'+OSRM.RoutingDescription.getDrivingInstructionIcon(response.route_instructions[i][0])+'" alt="" />';
route_desc += "</td>";
route_desc += '<td class="result-items">';
@@ -74,11 +74,11 @@ show: function(response) {
// build route description
if( i == 0 )
- route_desc += OSRM.loc("DIRECTION_"+OSRM.RoutingDescription.mapDirectionId(response.route_instructions[i][0])).replace(/%s/, OSRM.loc(response.route_instructions[i][6]) );
+ 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("DIRECTION_"+OSRM.RoutingDescription.mapDirectionId(response.route_instructions[i][0])).replace(/\[(.*)\]/,"$1").replace(/%s/, 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]);
else
- route_desc += OSRM.loc("DIRECTION_"+OSRM.RoutingDescription.mapDirectionId(response.route_instructions[i][0])).replace(/\[(.*)\]/,"");
+ route_desc += OSRM.loc(OSRM.RoutingDescription.getDrivingInstruction(response.route_instructions[i][0])).replace(/\[(.*)\]/,"");
route_desc += '</div>';
route_desc += "</td>";
@@ -147,36 +147,28 @@ showNA: function( display_text ) {
document.getElementById('information-box').innerHTML = "<div class='no-results big-font'>"+display_text+"</div>";
},
-//map driving instruction ids to internal ids
-mapDirectionId: function(name) {
- var directions = {
- "Turn left":1,
- "Turn right":2,
- "U-Turn":3,
- "Head":4,
- "Continue":5,
- "Turn slight left":6,
- "Turn slight right":7,
- "Turn sharp left":8,
- "Turn sharp right":9,
- "Enter roundabout and leave at first exit":10,
- "Enter roundabout and leave at second exit":11,
- "Enter roundabout and leave at third exit":12,
- "Enter roundabout and leave at fourth exit":13,
- "Enter roundabout and leave at fifth exit":14,
- "Enter roundabout and leave at sixth exit":15,
- "Enter roundabout and leave at seventh exit":16,
- "Enter roundabout and leave at eighth exit":17,
- "Enter roundabout and leave at nineth exit":18,
- "Enter roundabout and leave at tenth exit":19,
- "Enter roundabout and leave at one of the too many exit":20,
- "You have reached your destination":21
- };
+// retrieve driving instruction icon from 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;
- if( directions[name] )
- return directions[name];
+ if( OSRM.G.images[local_icon_id] )
+ return OSRM.G.images[local_icon_id].src;
else
- return 0;
+ return OSRM.G.images["direction_0"].src;
+},
+
+// retrieve driving instructions from instruction ids
+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;
+
+ var description = OSRM.loc( local_instruction_id );
+ if( description == local_instruction_id)
+ return OSRM.loc("DIRECTION_0");
+ return description;
}
};

No commit comments for this range

Something went wrong with that request. Please try again.