X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/f2bf38606e281290fee8273e247afc54f08a0a47..6b0d4dcab2c72397dbbabd768e47323c0e2e42b2:/app/assets/javascripts/index/directions_engines/osrm.js diff --git a/app/assets/javascripts/index/directions_engines/osrm.js b/app/assets/javascripts/index/directions_engines/osrm.js index 706970ec5..69b78c25e 100644 --- a/app/assets/javascripts/index/directions_engines/osrm.js +++ b/app/assets/javascripts/index/directions_engines/osrm.js @@ -2,6 +2,8 @@ // Doesn't yet support hints function OSRMEngine() { + var previousPoints, hintData; + return { id: "osrm_car", creditline: 'OSRM', @@ -33,6 +35,13 @@ function OSRMEngine() { for (var i = 0; i < points.length; i++) { url += "&loc=" + points[i].lat + ',' + points[i].lng; + if (hintData && previousPoints && previousPoints[i].equals(points[i])) { + url += "&hint=" + hintData.locations[i]; + } + } + + if (hintData && hintData.checksum) { + url += "&checksum=" + hintData.checksum; } $.ajax({ @@ -42,6 +51,9 @@ function OSRMEngine() { if (data.status == 207) return callback(true); + previousPoints = points; + hintData = data.hint_data; + var line = L.PolylineUtil.decode(data.route_geometry); for (var i = 0; i < line.length; i++) { line[i].lat /= 10;