From ee5e4ac5a440335e5a13f7f7b25511cafc2f432c Mon Sep 17 00:00:00 2001 From: Simon Legner Date: Tue, 6 Oct 2015 21:08:35 +0200 Subject: [PATCH] Add ferry routing information for OSRM Relates to #1000. Uses instruction code 18 to represent a ferry instruction. Ferry icon taken from Mapbox Maki set (CC0). --- app/assets/images/routing-sprite.png | Bin 1770 -> 1647 bytes .../javascripts/index/directions/osrm.js | 9 +++++++-- app/assets/stylesheets/common.scss | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/app/assets/images/routing-sprite.png b/app/assets/images/routing-sprite.png index 37d94886ddf07ea4074f92c01584394761984983..42ec7b4cdf94c3098160e40542d81ca645bc3b32 100644 GIT binary patch literal 1647 zcmZXUdpOg39LIke8=INK#)*+5m)w%e8t16owxlKZ$vu~C4bAG*YaQvmz9t4x6Y|IL za&!j(DH`Z#SqPYA9P$iUSh7+hYy1u6%`fvgNQX~YtZR*a7&?3zzGy8l^PZn21-as2zd?AK}aOhx;QvE zfP!1Y%*+h*^#nyvPfu4@S4T%@^XARk+S*`)#bUwy7c?5Z?uv?vC=?3x^#lcpM9Ry{ zuWvzt!@pk!M0O2OU@+KvLZQ&_iyuHB-!JxmJWZlLf-N=P-Ngft+5kl;C@LzURa7^s zX=rI_n{2bRwz0Lfvv(vAcRM*bJCjKJ_Pe@zlYN4N!zhQMQ&KaI9m^>wEG{WKS5?ia zyVKO#-uZ~f>*?+97YGIhUJZ|py_uMtnwk;MFDx#8mV8-SUTF|E-~m87V~?YqXL8^y zSrmuCp`Sv|U`m10P``pregT>25qnFFk3UW(rUvd;r)HosxxBiXX<;gA8=063qvqzL zH2NO@rjLJDVcks;7G@RPu2yQrvzVwMF4Il?W>L8Rf07vTn)vv^jouOP^( z^MG~byRTnMn}+34*W8X<7dVrV{#w^{Hk96J&?d%Wa%3W}APhPNuL<5(+x)qA0h5pdTlYr(_gvin8)up2*_B)1ybInOiL}(?hBHX9QJLN2^I$L0zd7Fat z9Pr4o)0|DRVq<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$f|-VHxBvhE diff --git a/app/assets/javascripts/index/directions/osrm.js b/app/assets/javascripts/index/directions/osrm.js index 4a42d5dc9..d9ce0a6b1 100644 --- a/app/assets/javascripts/index/directions/osrm.js +++ b/app/assets/javascripts/index/directions/osrm.js @@ -28,7 +28,8 @@ function OSRMEngine() { 'javascripts.directions.instructions.start', // 14 'javascripts.directions.instructions.destination', // 15 'javascripts.directions.instructions.against_oneway', // 16 - 'javascripts.directions.instructions.end_oneway' // 17 + 'javascripts.directions.instructions.end_oneway', // 17 + 'javascripts.directions.instructions.ferry' // 18 ]; var params = [ @@ -69,6 +70,10 @@ function OSRMEngine() { var s = data.route_instructions[i]; var linesegend; var instCodes = s[0].split('-'); + if (s[8] === 2) { + /* indicates a ferry in car routing mode, see https://github.com/Project-OSRM/osrm-backend/blob/6cbbd1e5a1b441eb27055f56956e1bac14832a58/profiles/car.lua#L151 */ + instCodes = ["18"]; + } var instText = "" + (i + 1) + ". "; var name = s[1] ? "" + s[1] + "" : I18n.t('javascripts.directions.instructions.unnamed'); if (instCodes[0] === "11" && instCodes[1]) { @@ -81,7 +86,7 @@ function OSRMEngine() { } else { linesegend = s[3] + 1; } - steps.push([line[s[3]], s[0].split('-')[0], instText, s[2], line.slice(s[3], linesegend)]); + steps.push([line[s[3]], instCodes[0], instText, s[2], line.slice(s[3], linesegend)]); } callback(false, { diff --git a/app/assets/stylesheets/common.scss b/app/assets/stylesheets/common.scss index 9b795aeab..3afef70e3 100644 --- a/app/assets/stylesheets/common.scss +++ b/app/assets/stylesheets/common.scss @@ -1003,7 +1003,7 @@ div.direction { height: 20px; background-repeat: no-repeat; } -@for $i from 1 through 17 { +@for $i from 1 through 18 { div.direction.i#{$i} { background-position: #{($i)*-20+20}px 0px; } } -- 2.39.5