X-Git-Url: https://git.openstreetmap.org/rails.git/blobdiff_plain/2198b6ebbf46cdad39b75a461b9a72e5cde93c3a..69437cf0ad12550ebfaadea56d074ac9996b8ca0:/app/assets/javascripts/routing.js.erb diff --git a/app/assets/javascripts/routing.js.erb b/app/assets/javascripts/routing.js.erb index 30846479d..1f50fa480 100644 --- a/app/assets/javascripts/routing.js.erb +++ b/app/assets/javascripts/routing.js.erb @@ -7,7 +7,9 @@ https://github.com/apmon/openstreetmap-website/blob/9755c3ae0a8d0684d43760f91dc864ff42d8477a/app/views/routing/start.js.erb *** draggable start/end markers - + *** click each part + *** translation (including all alerts and presentation) + *** export GPX */ var TURN_INSTRUCTIONS=["", @@ -85,22 +87,31 @@ OSM.Routing=function(map,name,jqSearch) { r.setPolyline=function(line) { if (r.polyline) map.removeLayer(r.polyline); r.polyline=L.polyline(line, ROUTING_POLYLINE).addTo(r.map); - // *** zoom to fit + r.map.fitBounds(r.polyline.getBounds()); }; // Take an array of directions and write it out // (we use OSRM's route_instructions format) + // *** translations? r.setItinerary=function(steps) { $("#content").removeClass("overlay-sidebar"); $('#sidebar_content').empty(); - var html=""; + var html='

Directions

'; + html+=""; for (var i=0; i "; + instText+=TURN_INSTRUCTIONS[instCodes[0]]; + if (instCodes[1]) { instText+="exit "+instCodes[1]+" "; } + if (instCodes[0]!=15) { instText+=step[1] ? ""+step[1]+"" : "(unnamed)"; } + // Add to table + html+=""; + html+="
"; + html+=""+instText; } + html+="
"; $('#sidebar_content').html(html); }; @@ -147,7 +158,11 @@ OSM.Routing=function(map,name,jqSearch) { this.requestJSONP(url); }, gotRoute: function(data) { - // *** save hints + if (data.status==207) { + alert("Couldn't find route between those two places"); + return false; + } + // *** store hints var line=L.PolylineUtil.decode(data.route_geometry); for (i=0; i