diff --git a/WebContent/OSRM.Localization.js b/WebContent/OSRM.Localization.js index 1fa979c9c..52cb267be 100644 --- a/WebContent/OSRM.Localization.js +++ b/WebContent/OSRM.Localization.js @@ -42,14 +42,13 @@ OSRM.Localization["de"] = { "GUI_START": "Start", "GUI_END": "Ziel", "GUI_RESET": "Reset", -"GUI_SEARCH": "Suchen", -"GUI_ROUTE": "Route", +"GUI_SEARCH": "Zeigen", "GUI_REVERSE": "Umdrehen", "GUI_OPTIONS": "Optionen", "GUI_HIGHLIGHT_UNNAMED_ROADS": "Unbenannte Straßen hervorheben", "GUI_START_TOOLTIP": "Startposition eingeben", "GUI_END_TOOLTIP": "Zielposition eingeben", -"GUI_LEGAL_NOTICE": "GUI2 v0.1 120313 - OSRM hosting by KIT - Geocoder by OSM", +"GUI_LEGAL_NOTICE": "GUI2 v0.1.1 120316 - OSRM hosting by KIT - Geocoder by OSM", // geocoder "SEARCH_RESULTS": "Suchergebnisse", "TIMED_OUT": "Zeitüberschreitung", @@ -82,15 +81,14 @@ OSRM.Localization["en"] = { //gui "GUI_START": "Start", "GUI_END": "End", -"GUI_RESET": "Reset", -"GUI_SEARCH": "Search", -"GUI_ROUTE": "Route", +"GUI_RESET": "  Reset  ", +"GUI_SEARCH": "  Show  ", "GUI_REVERSE": "Reverse", "GUI_OPTIONS": "Options", "GUI_HIGHLIGHT_UNNAMED_ROADS": "Highlight unnamed streets", "GUI_START_TOOLTIP": "Enter start", "GUI_END_TOOLTIP": "Enter destination", -"GUI_LEGAL_NOTICE": "GUI2 v0.1 120313 - OSRM hosting by KIT - Geocoder by OSM", +"GUI_LEGAL_NOTICE": "GUI2 v0.1.1 120316 - OSRM hosting by KIT - Geocoder by OSM", // geocoder "SEARCH_RESULTS": "Search Results", "TIMED_OUT": "Timed Out", diff --git a/WebContent/OSRM.Markers.js b/WebContent/OSRM.Markers.js index 8cca3c3d5..a4c42d8ed 100644 --- a/WebContent/OSRM.Markers.js +++ b/WebContent/OSRM.Markers.js @@ -75,11 +75,16 @@ toString: function() { OSRM.HighlightMarker = function( label, style, position) { OSRM.HighlightMarker.prototype.base.constructor.apply( this, arguments ); this.label = label ? label : "highlight_marker"; + + this.marker.on( 'click', this.onClick ); }; OSRM.inheritFrom( OSRM.HighlightMarker, OSRM.Marker ); OSRM.extend( OSRM.HighlightMarker, { toString: function() { return "OSRM.HighlightMarker: \""+this.label+"\", "+this.position+")"; +}, +onClick: function(e) { + this.parent.hide(); } }); @@ -143,6 +148,12 @@ onDragEnd: function(e) { OSRM.dragging = false; updateLocation( this.parent.label ); + if(my_route.isShown()==false) { + if(this.parent.label == "source") + updateReverseGeocoder("source"); + else if(this.parent.label == "target") + updateReverseGeocoder("target"); + } }, toString: function() { return "OSRM.RouteMarker: \""+this.label+"\", "+this.position+")"; diff --git a/WebContent/OSRM.base.js b/WebContent/OSRM.base.js index 61ed2caf3..35f2cd60d 100644 --- a/WebContent/OSRM.base.js +++ b/WebContent/OSRM.base.js @@ -19,7 +19,7 @@ or see http://www.gnu.org/licenses/agpl.txt. // [has to loaded before all other OSRM classes] OSRM = {}; -OSRM.VERSION = '0.1'; +OSRM.VERSION = '0.1.1'; // inheritance helper function (convenience function) diff --git a/WebContent/OSRM.config.js b/WebContent/OSRM.config.js index e6ca44af3..4c3adc09b 100644 --- a/WebContent/OSRM.config.js +++ b/WebContent/OSRM.config.js @@ -22,7 +22,7 @@ OSRM.DEFAULTS = { HOST_ROUTING_URL: 'http://router.project-osrm.org/viaroute', HOST_SHORTENER_URL: 'http://map.project-osrm.org/shorten/', WEBSITE_URL: document.URL.replace(/#*\?.*/i,""), - JSONP_TIMEOUT: 2000, + JSONP_TIMEOUT: 5000, ZOOM_LEVEL: 14, ONLOAD_LATITUDE: 48.84, ONLOAD_LONGITUDE: 10.10, diff --git a/WebContent/geocoder.js b/WebContent/geocoder.js index 47fdd7242..a145524dd 100644 --- a/WebContent/geocoder.js +++ b/WebContent/geocoder.js @@ -20,7 +20,7 @@ or see http://www.gnu.org/licenses/agpl.txt. // [TODO: better separation of GUI and geocoding routines, reverse geocoding] // some constants -OSRM.GEOCODE_POST = 'http://nominatim.openstreetmap.org/search?format=json'; +OSRM.GEOCODE_POST = 'http://nominatim.openstreetmap.org/search?format=json&bounded=1&viewbox=-27.0,72.0,46.0,36.0'; OSRM.SOURCE_MARKER_LABEL = "source"; OSRM.TARGET_MARKER_LABEL = "target"; @@ -40,7 +40,9 @@ function callGeocoder(marker_id, query) { if (marker_id == OSRM.SOURCE_MARKER_LABEL && my_markers.route[0] && my_markers.route[0].label == OSRM.SOURCE_MARKER_LABEL && my_markers.route[0].dirty_move == false && my_markers.route[0].dirty_type == false) return; if (marker_id == OSRM.TARGET_MARKER_LABEL && my_markers.route[my_markers.route.length-1] && my_markers.route[my_markers.route.length-1].label == OSRM.TARGET_MARKER_LABEL && my_markers.route[my_markers.route.length-1].dirty_move == false && my_markers.route[my_markers.route.length-1].dirty_type == false) - return; + return; + if(query=="") + return; //geo coordinates given -> go directly to drawing results if(query.match(/^\s*[-+]?[0-9]*\.?[0-9]+\s*[,;]\s*[-+]?[0-9]*\.?[0-9]+\s*$/)){ @@ -137,15 +139,15 @@ function showGeocoderResults_Timeout() { // - [upcoming feature: reverse geocoding (untested) ] - -OSRM.REVERSE_GEOCODE_POST = 'http://nominatim.openstreetmap.org/reverse?format=json'; +OSRM.REVERSE_GEOCODE_POST = 'http://nominatim.openstreetmap.org/reverse?format=json&bounded=1&viewbox=-27.0,72.0,46.0,36.0'; //update reverse geocoder informatiopn in input boxes function updateReverseGeocoder(marker_id) { - if (marker_id == OSRM.SOURCE_MARKER_LABEL ) { //&& my_markers.route[0].dirty == true ) { - document.getElementById("input-source-name").value = my_markers.route[0].getPosition().lat.toFixed(6) + ", " + my_markers.route[0].getPosition().lng.toFixed(6); + if (marker_id == OSRM.SOURCE_MARKER_LABEL && my_markers.hasSource()==true) { //&& my_markers.route[0].dirty == true ) { + //document.getElementById("input-source-name").value = my_markers.route[0].getPosition().lat.toFixed(6) + ", " + my_markers.route[0].getPosition().lng.toFixed(6); callReverseGeocoder("source", my_markers.route[0].getPosition().lat, my_markers.route[0].getPosition().lng); - } else if (marker_id == OSRM.TARGET_MARKER_LABEL ) { //&& my_markers.route[my_markers.route.length-1].dirty == true) { - document.getElementById("input-target-name").value = my_markers.route[my_markers.route.length-1].getPosition().lat.toFixed(6) + ", " + my_markers.route[my_markers.route.length-1].getPosition().lng.toFixed(6); + } else if (marker_id == OSRM.TARGET_MARKER_LABEL && my_markers.hasTarget()==true) { //&& my_markers.route[my_markers.route.length-1].dirty == true) { + //document.getElementById("input-target-name").value = my_markers.route[my_markers.route.length-1].getPosition().lat.toFixed(6) + ", " + my_markers.route[my_markers.route.length-1].getPosition().lng.toFixed(6); callReverseGeocoder("target", my_markers.route[my_markers.route.length-1].getPosition().lat, my_markers.route[my_markers.route.length-1].getPosition().lng); } } @@ -175,20 +177,28 @@ function showReverseGeocoderResults(marker_id, response) { var address = ""; if( response.address.road) address += response.address.road; - if( response.address.city) { - if( response.address.road) + if( response.address.city ) { + if( address != "" ) address += ", "; address += response.address.city; + } else if( response.address.village ) { + if( address != "" ) + address += ", "; + address += response.address.village; } + if( address == "" && response.address.country ) + address += response.address.country; if( address == "" ) return; if(marker_id == OSRM.SOURCE_MARKER_LABEL) { document.getElementById("input-source-name").value = address; - //my_markers.route[0].dirty = false; + my_markers.route[0].dirty_move = false; + my_markers.route[0].dirty_type = false; } else if(marker_id == OSRM.TARGET_MARKER_LABEL) { document.getElementById("input-target-name").value = address; - //my_markers.route[my_markers.route.length-1].dirty = false; + my_markers.route[my_markers.route.length-1].dirty_move = false; + my_markers.route[my_markers.route.length-1].dirty_type = false; } } diff --git a/WebContent/images/markers.pdf b/WebContent/images/markers.pdf index 94c2def87..4cf60451a 100644 Binary files a/WebContent/images/markers.pdf and b/WebContent/images/markers.pdf differ diff --git a/WebContent/images/target.png b/WebContent/images/target.png new file mode 100644 index 000000000..ee79b04c2 Binary files /dev/null and b/WebContent/images/target.png differ diff --git a/WebContent/main.html b/WebContent/main.html index c18c49644..412766365 100644 --- a/WebContent/main.html +++ b/WebContent/main.html @@ -89,17 +89,13 @@ or see http://www.gnu.org/licenses/agpl.txt. Start: - - - Suchen + Zeigen Ende: - - - Suchen + Zeigen @@ -108,8 +104,7 @@ or see http://www.gnu.org/licenses/agpl.txt. - - +
Reset Reverse Route Umdrehen
@@ -125,7 +120,7 @@ or see http://www.gnu.org/licenses/agpl.txt.
- +
diff --git a/WebContent/main.js b/WebContent/main.js index d4d97836d..b5bd0fbdb 100644 --- a/WebContent/main.js +++ b/WebContent/main.js @@ -41,9 +41,15 @@ function prefetchImages() { var images = [ 'images/marker-source.png', 'images/marker-target.png', 'images/marker-via.png', - 'images/marker-highlight.png' + 'images/marker-highlight.png', + 'images/cancel.png', + 'images/cancel_active.png', + 'images/cancel_hover.png', + 'images/restore.png', + 'images/restore_active.png', + 'images/restore_hover.png' ]; - + for(var i=0; i 0) - my_markers.setSource( positions[0] ); - if(positions.length > 1) - my_markers.setTarget( positions[positions.length-1] ); + if( positions.length > 0) { + onclickGeocoderResult("source", positions[0].lat, positions[0].lng, true, false ); + //my_markers.setSource( positions[0] ); + } + if(positions.length > 1) { + onclickGeocoderResult("target", positions[positions.length-1].lat, positions[positions.length-1].lng, true, false ); + //my_markers.setTarget( positions[positions.length-1] ); + } for(var i=1; i'; route_desc += ""; @@ -200,7 +201,7 @@ function showRouteDescriptionSimple(response) { headline = OSRM.loc("ROUTE_DESCRIPTION")+":
"; headline += "" + OSRM.loc("DISTANCE")+": " + getDistanceWithUnit(response.route_summary.total_distance) - + " - " + + "
" + OSRM.loc("DURATION")+": " + secondsToTime(response.route_summary.total_time) + "
"; headline += '

'; @@ -212,7 +213,7 @@ function showNoRouteDescription() { headline = OSRM.loc("ROUTE_DESCRIPTION")+":
"; headline += "" + OSRM.loc("DISTANCE")+": N/A" - + " - " + + "
" + OSRM.loc("DURATION")+": N/A" + "
"; headline += '

'; @@ -374,8 +375,13 @@ function snapRoute() { for(var i=0; i