leaflet-routing-machine.js 164 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382
  1. (function e(t, n, r) {
  2. function s(o, u) {
  3. if (!n[o]) {
  4. if (!t[o]) {
  5. var a = typeof require == "function" && require;
  6. if (!u && a) return a(o, !0);
  7. if (i) return i(o, !0);
  8. var f = new Error("Cannot find module '" + o + "'");
  9. throw f.code = "MODULE_NOT_FOUND", f
  10. }
  11. var l = n[o] = {
  12. exports: {}
  13. };
  14. t[o][0].call(l.exports, function (e) {
  15. var n = t[o][1][e];
  16. return s(n ? n : e)
  17. }, l, l.exports, e, t, n, r)
  18. }
  19. return n[o].exports
  20. }
  21. var i = typeof require == "function" && require;
  22. for (var o = 0; o < r.length; o++) s(r[o]);
  23. return s
  24. })({
  25. 1: [function (_dereq_, module, exports) {
  26. function corslite(url, callback, cors) {
  27. var sent = false;
  28. if (typeof window.XMLHttpRequest === 'undefined') {
  29. return callback(Error('Browser not supported'));
  30. }
  31. if (typeof cors === 'undefined') {
  32. var m = url.match(/^\s*https?:\/\/[^\/]*/);
  33. cors = m && (m[0] !== location.protocol + '//' + location.hostname +
  34. (location.port ? ':' + location.port : ''));
  35. }
  36. var x = new window.XMLHttpRequest();
  37. function isSuccessful(status) {
  38. return status >= 200 && status < 300 || status === 304;
  39. }
  40. if (cors && !('withCredentials' in x)) {
  41. // IE8-9
  42. x = new window.XDomainRequest();
  43. // Ensure callback is never called synchronously, i.e., before
  44. // x.send() returns (this has been observed in the wild).
  45. // See https://github.com/mapbox/mapbox.js/issues/472
  46. var original = callback;
  47. callback = function () {
  48. if (sent) {
  49. original.apply(this, arguments);
  50. } else {
  51. var that = this,
  52. args = arguments;
  53. setTimeout(function () {
  54. original.apply(that, args);
  55. }, 0);
  56. }
  57. }
  58. }
  59. function loaded() {
  60. if (
  61. // XDomainRequest
  62. x.status === undefined ||
  63. // modern browsers
  64. isSuccessful(x.status)) callback.call(x, null, x);
  65. else callback.call(x, x, null);
  66. }
  67. // Both `onreadystatechange` and `onload` can fire. `onreadystatechange`
  68. // has [been supported for longer](http://stackoverflow.com/a/9181508/229001).
  69. if ('onload' in x) {
  70. x.onload = loaded;
  71. } else {
  72. x.onreadystatechange = function readystate() {
  73. if (x.readyState === 4) {
  74. loaded();
  75. }
  76. };
  77. }
  78. // Call the callback with the XMLHttpRequest object as an error and prevent
  79. // it from ever being called again by reassigning it to `noop`
  80. x.onerror = function error(evt) {
  81. // XDomainRequest provides no evt parameter
  82. callback.call(this, evt || true, null);
  83. callback = function () {};
  84. };
  85. // IE9 must have onprogress be set to a unique function.
  86. x.onprogress = function () {};
  87. x.ontimeout = function (evt) {
  88. callback.call(this, evt, null);
  89. callback = function () {};
  90. };
  91. x.onabort = function (evt) {
  92. callback.call(this, evt, null);
  93. callback = function () {};
  94. };
  95. // GET is the only supported HTTP Verb by XDomainRequest and is the
  96. // only one supported here.
  97. x.open('GET', url, true);
  98. // Send the request. Sending data is not supported.
  99. x.send(null);
  100. sent = true;
  101. return x;
  102. }
  103. if (typeof module !== 'undefined') module.exports = corslite;
  104. }, {}],
  105. 2: [function (_dereq_, module, exports) {
  106. module.exports = function (version, language, options) {
  107. // load instructions
  108. var instructions = _dereq_('./instructions').get(language);
  109. if (Object !== instructions.constructor) throw 'instructions must be object';
  110. if (!instructions[version]) {
  111. throw 'invalid version ' + version;
  112. }
  113. return {
  114. capitalizeFirstLetter: function (string) {
  115. return string.charAt(0).toUpperCase() + string.slice(1);
  116. },
  117. ordinalize: function (number) {
  118. // Transform numbers to their translated ordinalized value
  119. return instructions[version].constants.ordinalize[number.toString()] || '';
  120. },
  121. directionFromDegree: function (degree) {
  122. // Transform degrees to their translated compass direction
  123. if (!degree && degree !== 0) {
  124. // step had no bearing_after degree, ignoring
  125. return '';
  126. } else if (degree >= 0 && degree <= 20) {
  127. return instructions[version].constants.direction.north;
  128. } else if (degree > 20 && degree < 70) {
  129. return instructions[version].constants.direction.northeast;
  130. } else if (degree >= 70 && degree < 110) {
  131. return instructions[version].constants.direction.east;
  132. } else if (degree >= 110 && degree <= 160) {
  133. return instructions[version].constants.direction.southeast;
  134. } else if (degree > 160 && degree <= 200) {
  135. return instructions[version].constants.direction.south;
  136. } else if (degree > 200 && degree < 250) {
  137. return instructions[version].constants.direction.southwest;
  138. } else if (degree >= 250 && degree <= 290) {
  139. return instructions[version].constants.direction.west;
  140. } else if (degree > 290 && degree < 340) {
  141. return instructions[version].constants.direction.northwest;
  142. } else if (degree >= 340 && degree <= 360) {
  143. return instructions[version].constants.direction.north;
  144. } else {
  145. throw new Error('Degree ' + degree + ' invalid');
  146. }
  147. },
  148. laneConfig: function (step) {
  149. // Reduce any lane combination down to a contracted lane diagram
  150. if (!step.intersections || !step.intersections[0].lanes) throw new Error('No lanes object');
  151. var config = [];
  152. var currentLaneValidity = null;
  153. step.intersections[0].lanes.forEach(function (lane) {
  154. if (currentLaneValidity === null || currentLaneValidity !== lane.valid) {
  155. if (lane.valid) {
  156. config.push('o');
  157. } else {
  158. config.push('x');
  159. }
  160. currentLaneValidity = lane.valid;
  161. }
  162. });
  163. return config.join('');
  164. },
  165. compile: function (step) {
  166. if (!step.maneuver) throw new Error('No step maneuver provided');
  167. var type = step.maneuver.type;
  168. var modifier = step.maneuver.modifier;
  169. var mode = step.mode;
  170. if (!type) {
  171. throw new Error('Missing step maneuver type');
  172. }
  173. if (type !== 'depart' && type !== 'arrive' && !modifier) {
  174. throw new Error('Missing step maneuver modifier');
  175. }
  176. if (!instructions[version][type]) {
  177. // Log for debugging
  178. //console.log('Encountered unknown instruction type: ' + type); // eslint-disable-line no-//console
  179. // OSRM specification assumes turn types can be added without
  180. // major version changes. Unknown types are to be treated as
  181. // type `turn` by clients
  182. type = 'turn';
  183. }
  184. // Use special instructions if available, otherwise `defaultinstruction`
  185. var instructionObject;
  186. if (instructions[version].modes[mode]) {
  187. instructionObject = instructions[version].modes[mode];
  188. } else if (instructions[version][type][modifier]) {
  189. instructionObject = instructions[version][type][modifier];
  190. } else {
  191. instructionObject = instructions[version][type].default;
  192. }
  193. // Special case handling
  194. var laneInstruction;
  195. switch (type) {
  196. case 'use lane':
  197. laneInstruction = instructions[version].constants.lanes[this.laneConfig(step)];
  198. if (!laneInstruction) {
  199. // If the lane combination is not found, default to continue straight
  200. instructionObject = instructions[version]['use lane'].no_lanes;
  201. }
  202. break;
  203. case 'rotary':
  204. case 'roundabout':
  205. if (step.rotary_name && step.maneuver.exit && instructionObject.name_exit) {
  206. instructionObject = instructionObject.name_exit;
  207. } else if (step.rotary_name && instructionObject.name) {
  208. instructionObject = instructionObject.name;
  209. } else if (step.maneuver.exit && instructionObject.exit) {
  210. instructionObject = instructionObject.exit;
  211. } else {
  212. instructionObject = instructionObject.default;
  213. }
  214. break;
  215. default:
  216. // NOOP, since no special logic for that type
  217. }
  218. // Decide way_name with special handling for name and ref
  219. var wayName;
  220. var name = step.name || '';
  221. var ref = (step.ref || '').split(';')[0];
  222. // Remove hacks from Mapbox Directions mixing ref into name
  223. if (name === step.ref) {
  224. // if both are the same we assume that there used to be an empty name, with the ref being filled in for it
  225. // we only need to retain the ref then
  226. name = '';
  227. }
  228. name = name.replace(' (' + step.ref + ')', '');
  229. if (name && ref && name !== ref) {
  230. wayName = name + ' (' + ref + ')';
  231. } else if (!name && ref) {
  232. wayName = ref;
  233. } else {
  234. wayName = name;
  235. }
  236. // Decide which instruction string to use
  237. // Destination takes precedence over name
  238. var instruction;
  239. if (step.destinations && instructionObject.destination) {
  240. instruction = instructionObject.destination;
  241. } else if (wayName && instructionObject.name) {
  242. instruction = instructionObject.name;
  243. } else {
  244. instruction = instructionObject.default;
  245. }
  246. var tokenizedInstructionHook = ((options || {}).hooks || {}).tokenizedInstruction;
  247. if (tokenizedInstructionHook) {
  248. instruction = tokenizedInstructionHook(instruction);
  249. }
  250. // Replace tokens
  251. // NOOP if they don't exist
  252. var nthWaypoint = ''; // TODO, add correct waypoint counting
  253. instruction = instruction
  254. .replace('{way_name}', wayName)
  255. .replace('{destination}', (step.destinations || '').split(',')[0])
  256. .replace('{exit_number}', this.ordinalize(step.maneuver.exit || 1))
  257. .replace('{rotary_name}', step.rotary_name)
  258. .replace('{lane_instruction}', laneInstruction)
  259. .replace('{modifier}', instructions[version].constants.modifier[modifier])
  260. .replace('{direction}', this.directionFromDegree(step.maneuver.bearing_after))
  261. .replace('{nth}', nthWaypoint)
  262. .replace(/ {2}/g, ' '); // remove excess spaces
  263. if (instructions.meta.capitalizeFirstLetter) {
  264. instruction = this.capitalizeFirstLetter(instruction);
  265. }
  266. return instruction;
  267. }
  268. };
  269. };
  270. }, {
  271. "./instructions": 3
  272. }],
  273. 3: [function (_dereq_, module, exports) {
  274. var instructionsDe = _dereq_('./instructions/de.json');
  275. var instructionsEn = _dereq_('./instructions/en.json');
  276. var instructionsFr = _dereq_('./instructions/fr.json');
  277. var instructionsNl = _dereq_('./instructions/nl.json');
  278. var instructionsZhHans = _dereq_('./instructions/zh-Hans.json');
  279. module.exports = {
  280. get: function (language) {
  281. switch (language) {
  282. case 'en':
  283. return instructionsEn;
  284. case 'de':
  285. return instructionsDe;
  286. case 'fr':
  287. return instructionsFr;
  288. case 'nl':
  289. return instructionsNl;
  290. case 'zh':
  291. case 'zh-Hans':
  292. return instructionsZhHans;
  293. default:
  294. throw 'invalid language ' + language;
  295. }
  296. }
  297. };
  298. }, {
  299. "./instructions/de.json": 4,
  300. "./instructions/en.json": 5,
  301. "./instructions/fr.json": 6,
  302. "./instructions/nl.json": 7,
  303. "./instructions/zh-Hans.json": 8
  304. }],
  305. 4: [function (_dereq_, module, exports) {
  306. module.exports = {
  307. "meta": {
  308. "capitalizeFirstLetter": true
  309. },
  310. "v5": {
  311. "constants": {
  312. "ordinalize": {
  313. "1": "erste",
  314. "2": "zweite",
  315. "3": "dritte",
  316. "4": "vierte",
  317. "5": "fünfte",
  318. "6": "sechste",
  319. "7": "siebente",
  320. "8": "achte",
  321. "9": "neunte",
  322. "10": "zehnte"
  323. },
  324. "direction": {
  325. "north": "Norden",
  326. "northeast": "Nordosten",
  327. "east": "Osten",
  328. "southeast": "Südosten",
  329. "south": "Süden",
  330. "southwest": "Südwesten",
  331. "west": "Westen",
  332. "northwest": "Nordwesten"
  333. },
  334. "modifier": {
  335. "left": "links",
  336. "right": "rechts",
  337. "sharp left": "scharf links",
  338. "sharp right": "scharf rechts",
  339. "slight left": "leicht links",
  340. "slight right": "leicht rechts",
  341. "straight": "geradeaus",
  342. "uturn": "180°-Wendung"
  343. },
  344. "lanes": {
  345. "xo": "Rechts halten",
  346. "ox": "Links halten",
  347. "xox": "Mittlere Spur nutzen",
  348. "oxo": "Rechts oder links halten"
  349. }
  350. },
  351. "modes": {
  352. "ferry": {
  353. "default": "Fähre nehmen",
  354. "name": "Fähre nehmen {way_name}",
  355. "destination": "Fähre nehmen Richtung {destination}"
  356. }
  357. },
  358. "arrive": {
  359. "default": {
  360. "default": "Sie haben Ihr {nth} Ziel erreicht"
  361. },
  362. "left": {
  363. "default": "Sie haben Ihr {nth} Ziel erreicht, es befindet sich links von Ihnen"
  364. },
  365. "right": {
  366. "default": "Sie haben Ihr {nth} Ziel erreicht, es befindet sich rechts von Ihnen"
  367. },
  368. "sharp left": {
  369. "default": "Sie haben Ihr {nth} Ziel erreicht, es befindet sich links von Ihnen"
  370. },
  371. "sharp right": {
  372. "default": "Sie haben Ihr {nth} Ziel erreicht, es befindet sich rechts von Ihnen"
  373. },
  374. "slight right": {
  375. "default": "Sie haben Ihr {nth} Ziel erreicht, es befindet sich rechts von Ihnen"
  376. },
  377. "slight left": {
  378. "default": "Sie haben Ihr {nth} Ziel erreicht, es befindet sich links von Ihnen"
  379. },
  380. "straight": {
  381. "default": "Sie haben Ihr {nth} Ziel erreicht, es befindet sich direkt vor Ihnen"
  382. }
  383. },
  384. "continue": {
  385. "default": {
  386. "default": "{modifier} weiterfahren",
  387. "name": "{modifier} weiterfahren auf {way_name}",
  388. "destination": "{modifier} weiterfahren Richtung {destination}"
  389. },
  390. "slight left": {
  391. "default": "Leicht links weiter",
  392. "name": "Leicht links weiter auf {way_name}",
  393. "destination": "Leicht links weiter Richtung {destination}"
  394. },
  395. "slight right": {
  396. "default": "Leicht rechts weiter",
  397. "name": "Leicht rechts weiter auf {way_name}",
  398. "destination": "Leicht rechts weiter Richtung {destination}"
  399. },
  400. "uturn": {
  401. "default": "180°-Wendung",
  402. "name": "180°-Wendung auf {way_name}",
  403. "destination": "180°-Wendung Richtung {destination}"
  404. }
  405. },
  406. "depart": {
  407. "default": {
  408. "default": "Fahren Sie Richtung {direction}",
  409. "name": "Fahren Sie Richtung {direction} auf {way_name}"
  410. }
  411. },
  412. "end of road": {
  413. "default": {
  414. "default": "{modifier} abbiegen",
  415. "name": "{modifier} abbiegen auf {way_name}",
  416. "destination": "{modifier} abbiegen Richtung {destination}"
  417. },
  418. "straight": {
  419. "default": "Geradeaus weiterfahren",
  420. "name": "Geradeaus weiterfahren auf {way_name}",
  421. "destination": "Geradeaus weiterfahren Richtung {destination}"
  422. },
  423. "uturn": {
  424. "default": "180°-Wendung am Ende der Straße",
  425. "name": "180°-Wendung auf {way_name} am Ende der Straße",
  426. "destination": "180°-Wendung Richtung {destination} am Ende der Straße"
  427. }
  428. },
  429. "fork": {
  430. "default": {
  431. "default": "{modifier} halten an der Gabelung",
  432. "name": "{modifier} halten an der Gabelung auf {way_name}",
  433. "destination": "{modifier} halten an der Gabelung Richtung {destination}"
  434. },
  435. "slight left": {
  436. "default": "Links halten an der Gabelung",
  437. "name": "Links halten an der Gabelung auf {way_name}",
  438. "destination": "Links halten an der Gabelung Richtung {destination}"
  439. },
  440. "slight right": {
  441. "default": "Rechts halten an der Gabelung",
  442. "name": "Rechts halten an der Gabelung auf {way_name}",
  443. "destination": "Rechts halten an der Gabelung Richtung {destination}"
  444. },
  445. "sharp left": {
  446. "default": "Scharf links abbiegen an der Gabelung",
  447. "name": "Scharf links abbiegen an der Gabelung auf {way_name}",
  448. "destination": "Scharf links abbiegen an der Gabelung Richtung {destination}"
  449. },
  450. "sharp right": {
  451. "default": "Scharf rechts abbiegen an der Gabelung",
  452. "name": "Scharf rechts abbiegen an der Gabelung auf {way_name}",
  453. "destination": "Scharf rechts abbiegen an der Gabelung Richtung {destination}"
  454. },
  455. "uturn": {
  456. "default": "180°-Wendung",
  457. "name": "180°-Wendung auf {way_name}",
  458. "destination": "180°-Wendung Richtung {destination}"
  459. }
  460. },
  461. "merge": {
  462. "default": {
  463. "default": "{modifier} auffahren",
  464. "name": "{modifier} auffahren auf {way_name}",
  465. "destination": "{modifier} auffahren Richtung {destination}"
  466. },
  467. "slight left": {
  468. "default": "Leicht links auffahren",
  469. "name": "Leicht links auffahren auf {way_name}",
  470. "destination": "Leicht links auffahren Richtung {destination}"
  471. },
  472. "slight right": {
  473. "default": "Leicht rechts auffahren",
  474. "name": "Leicht rechts auffahren auf {way_name}",
  475. "destination": "Leicht rechts auffahren Richtung {destination}"
  476. },
  477. "sharp left": {
  478. "default": "Scharf links auffahren",
  479. "name": "Scharf links auffahren auf {way_name}",
  480. "destination": "Scharf links auffahren Richtung {destination}"
  481. },
  482. "sharp right": {
  483. "default": "Scharf rechts auffahren",
  484. "name": "Scharf rechts auffahren auf {way_name}",
  485. "destination": "Scharf rechts auffahren Richtung {destination}"
  486. },
  487. "uturn": {
  488. "default": "180°-Wendung",
  489. "name": "180°-Wendung auf {way_name}",
  490. "destination": "180°-Wendung Richtung {destination}"
  491. }
  492. },
  493. "new name": {
  494. "default": {
  495. "default": "{modifier} weiterfahren",
  496. "name": "{modifier} weiterfahren auf {way_name}",
  497. "destination": "{modifier} weiterfahren Richtung {destination}"
  498. },
  499. "sharp left": {
  500. "default": "Scharf links",
  501. "name": "Scharf links auf {way_name}",
  502. "destination": "Scharf links Richtung {destination}"
  503. },
  504. "sharp right": {
  505. "default": "Scharf rechts",
  506. "name": "Scharf rechts auf {way_name}",
  507. "destination": "Scharf rechts Richtung {destination}"
  508. },
  509. "slight left": {
  510. "default": "Leicht links weiter",
  511. "name": "Leicht links weiter auf {way_name}",
  512. "destination": "Leicht links weiter Richtung {destination}"
  513. },
  514. "slight right": {
  515. "default": "Leicht rechts weiter",
  516. "name": "Leicht rechts weiter auf {way_name}",
  517. "destination": "Leicht rechts weiter Richtung {destination}"
  518. },
  519. "uturn": {
  520. "default": "180°-Wendung",
  521. "name": "180°-Wendung auf {way_name}",
  522. "destination": "180°-Wendung Richtung {destination}"
  523. }
  524. },
  525. "notification": {
  526. "default": {
  527. "default": "{modifier} weiterfahren",
  528. "name": "{modifier} weiterfahren auf {way_name}",
  529. "destination": "{modifier} weiterfahren Richtung {destination}"
  530. },
  531. "uturn": {
  532. "default": "180°-Wendung",
  533. "name": "180°-Wendung auf {way_name}",
  534. "destination": "180°-Wendung Richtung {destination}"
  535. }
  536. },
  537. "off ramp": {
  538. "default": {
  539. "default": "Rampe nehmen",
  540. "name": "Rampe nehmen auf {way_name}",
  541. "destination": "Rampe nehmen Richtung {destination}"
  542. },
  543. "left": {
  544. "default": "Rampe auf der linken Seite nehmen",
  545. "name": "Rampe auf der linken Seite nehmen auf {way_name}",
  546. "destination": "Rampe auf der linken Seite nehmen Richtung {destination}"
  547. },
  548. "right": {
  549. "default": "Rampe auf der rechten Seite nehmen",
  550. "name": "Rampe auf der rechten Seite nehmen auf {way_name}",
  551. "destination": "Rampe auf der rechten Seite nehmen Richtung {destination}"
  552. },
  553. "sharp left": {
  554. "default": "Rampe auf der linken Seite nehmen",
  555. "name": "Rampe auf der linken Seite nehmen auf {way_name}",
  556. "destination": "Rampe auf der linken Seite nehmen Richtung {destination}"
  557. },
  558. "sharp right": {
  559. "default": "Rampe auf der rechten Seite nehmen",
  560. "name": "Rampe auf der rechten Seite nehmen auf {way_name}",
  561. "destination": "Rampe auf der rechten Seite nehmen Richtung {destination}"
  562. },
  563. "slight left": {
  564. "default": "Rampe auf der linken Seite nehmen",
  565. "name": "Rampe auf der linken Seite nehmen auf {way_name}",
  566. "destination": "Rampe auf der linken Seite nehmen Richtung {destination}"
  567. },
  568. "slight right": {
  569. "default": "Rampe auf der rechten Seite nehmen",
  570. "name": "Rampe auf der rechten Seite nehmen auf {way_name}",
  571. "destination": "Rampe auf der rechten Seite nehmen Richtung {destination}"
  572. }
  573. },
  574. "on ramp": {
  575. "default": {
  576. "default": "Rampe nehmen",
  577. "name": "Rampe nehmen auf {way_name}",
  578. "destination": "Rampe nehmen Richtung {destination}"
  579. },
  580. "left": {
  581. "default": "Rampe auf der linken Seite nehmen",
  582. "name": "Rampe auf der linken Seite nehmen auf {way_name}",
  583. "destination": "Rampe auf der linken Seite nehmen Richtung {destination}"
  584. },
  585. "right": {
  586. "default": "Rampe auf der rechten Seite nehmen",
  587. "name": "Rampe auf der rechten Seite nehmen auf {way_name}",
  588. "destination": "Rampe auf der rechten Seite nehmen Richtung {destination}"
  589. },
  590. "sharp left": {
  591. "default": "Rampe auf der linken Seite nehmen",
  592. "name": "Rampe auf der linken Seite nehmen auf {way_name}",
  593. "destination": "Rampe auf der linken Seite nehmen Richtung {destination}"
  594. },
  595. "sharp right": {
  596. "default": "Rampe auf der rechten Seite nehmen",
  597. "name": "Rampe auf der rechten Seite nehmen auf {way_name}",
  598. "destination": "Rampe auf der rechten Seite nehmen Richtung {destination}"
  599. },
  600. "slight left": {
  601. "default": "Rampe auf der linken Seite nehmen",
  602. "name": "Rampe auf der linken Seite nehmen auf {way_name}",
  603. "destination": "Rampe auf der linken Seite nehmen Richtung {destination}"
  604. },
  605. "slight right": {
  606. "default": "Rampe auf der rechten Seite nehmen",
  607. "name": "Rampe auf der rechten Seite nehmen auf {way_name}",
  608. "destination": "Rampe auf der rechten Seite nehmen Richtung {destination}"
  609. }
  610. },
  611. "rotary": {
  612. "default": {
  613. "default": {
  614. "default": "In den Kreisverkehr fahren",
  615. "name": "In den Kreisverkehr fahren und auf {way_name} verlassen",
  616. "destination": "In den Kreisverkehr fahren und Richtung {destination} verlassen"
  617. },
  618. "name": {
  619. "default": "In {rotary_name} fahren",
  620. "name": "In {rotary_name} fahren und auf {way_name} verlassen",
  621. "destination": "In {rotary_name} fahren und Richtung {destination} verlassen"
  622. },
  623. "exit": {
  624. "default": "In den Kreisverkehr fahren und {exit_number} Ausfahrt nehmen",
  625. "name": "In den Kreisverkehr fahren und {exit_number} Ausfahrt nehmen auf {way_name}",
  626. "destination": "In den Kreisverkehr fahren und {exit_number} Ausfahrt nehmen Richtung {destination}"
  627. },
  628. "name_exit": {
  629. "default": "In den Kreisverkehr fahren und {exit_number} Ausfahrt nehmen",
  630. "name": "In den Kreisverkehr fahren und {exit_number} Ausfahrt nehmen auf {way_name}",
  631. "destination": "In den Kreisverkehr fahren und {exit_number} Ausfahrt nehmen Richtung {destination}"
  632. }
  633. }
  634. },
  635. "roundabout": {
  636. "default": {
  637. "exit": {
  638. "default": "In den Kreisverkehr fahren und {exit_number} Ausfahrt nehmen",
  639. "name": "In den Kreisverkehr fahren und {exit_number} Ausfahrt nehmen auf {way_name}",
  640. "destination": "In den Kreisverkehr fahren und {exit_number} Ausfahrt nehmen Richtung {destination}"
  641. },
  642. "default": {
  643. "default": "In den Kreisverkehr fahren",
  644. "name": "In den Kreisverkehr fahren und auf {way_name} verlassen",
  645. "destination": "In den Kreisverkehr fahren und Richtung {destination} verlassen"
  646. }
  647. }
  648. },
  649. "roundabout turn": {
  650. "default": {
  651. "default": "Am Kreisverkehr {modifier}",
  652. "name": "Am Kreisverkehr {modifier} auf {way_name}",
  653. "destination": "Am Kreisverkehr {modifier} Richtung {destination}"
  654. },
  655. "left": {
  656. "default": "Am Kreisverkehr links",
  657. "name": "Am Kreisverkehr links auf {way_name}",
  658. "destination": "Am Kreisverkehr links Richtung {destination}"
  659. },
  660. "right": {
  661. "default": "Am Kreisverkehr rechts",
  662. "name": "Am Kreisverkehr rechts auf {way_name}",
  663. "destination": "Am Kreisverkehr rechts Richtung {destination}"
  664. },
  665. "straight": {
  666. "default": "Am Kreisverkehr geradeaus weiterfahren",
  667. "name": "Am Kreisverkehr geradeaus weiterfahren auf {way_name}",
  668. "destination": "Am Kreisverkehr geradeaus weiterfahren Richtung {destination}"
  669. }
  670. },
  671. "turn": {
  672. "default": {
  673. "default": "{modifier} abbiegen",
  674. "name": "{modifier} abbiegen auf {way_name}",
  675. "destination": "{modifier} abbiegen Richtung {destination}"
  676. },
  677. "left": {
  678. "default": "Links abbiegen",
  679. "name": "Links abbiegen auf {way_name}",
  680. "destination": "Links abbiegen Richtung {destination}"
  681. },
  682. "right": {
  683. "default": "Rechts abbiegen",
  684. "name": "Rechts abbiegen auf {way_name}",
  685. "destination": "Rechts abbiegen Richtung {destination}"
  686. },
  687. "straight": {
  688. "default": "Geradeaus weiterfahren",
  689. "name": "Geradeaus weiterfahren auf {way_name}",
  690. "destination": "Geradeaus weiterfahren Richtung {destination}"
  691. }
  692. },
  693. "use lane": {
  694. "no_lanes": {
  695. "default": "Geradeaus weiterfahren"
  696. },
  697. "default": {
  698. "default": "{lane_instruction}"
  699. }
  700. }
  701. }
  702. }
  703. }, {}],
  704. 5: [function (_dereq_, module, exports) {
  705. module.exports = {
  706. "meta": {
  707. "capitalizeFirstLetter": true
  708. },
  709. "v5": {
  710. "constants": {
  711. "ordinalize": {
  712. "1": "1st",
  713. "2": "2nd",
  714. "3": "3rd",
  715. "4": "4th",
  716. "5": "5th",
  717. "6": "6th",
  718. "7": "7th",
  719. "8": "8th",
  720. "9": "9th",
  721. "10": "10th"
  722. },
  723. "direction": {
  724. "north": "north",
  725. "northeast": "northeast",
  726. "east": "east",
  727. "southeast": "southeast",
  728. "south": "south",
  729. "southwest": "southwest",
  730. "west": "west",
  731. "northwest": "northwest"
  732. },
  733. "modifier": {
  734. "left": "left",
  735. "right": "right",
  736. "sharp left": "sharp left",
  737. "sharp right": "sharp right",
  738. "slight left": "slight left",
  739. "slight right": "slight right",
  740. "straight": "straight",
  741. "uturn": "U-turn"
  742. },
  743. "lanes": {
  744. "xo": "Keep right",
  745. "ox": "Keep left",
  746. "xox": "Keep in the middle",
  747. "oxo": "Keep left or right"
  748. }
  749. },
  750. "modes": {
  751. "ferry": {
  752. "default": "Take the ferry",
  753. "name": "Take the ferry {way_name}",
  754. "destination": "Take the ferry towards {destination}"
  755. }
  756. },
  757. "arrive": {
  758. "default": {
  759. "default": "You have arrived at your {nth} destination"
  760. },
  761. "left": {
  762. "default": "You have arrived at your {nth} destination, on the left"
  763. },
  764. "right": {
  765. "default": "You have arrived at your {nth} destination, on the right"
  766. },
  767. "sharp left": {
  768. "default": "You have arrived at your {nth} destination, on the left"
  769. },
  770. "sharp right": {
  771. "default": "You have arrived at your {nth} destination, on the right"
  772. },
  773. "slight right": {
  774. "default": "You have arrived at your {nth} destination, on the right"
  775. },
  776. "slight left": {
  777. "default": "You have arrived at your {nth} destination, on the left"
  778. },
  779. "straight": {
  780. "default": "You have arrived at your {nth} destination, straight ahead"
  781. }
  782. },
  783. "continue": {
  784. "default": {
  785. "default": "Continue {modifier}",
  786. "name": "Continue {modifier} onto {way_name}",
  787. "destination": "Continue {modifier} towards {destination}"
  788. },
  789. "slight left": {
  790. "default": "Continue slightly left",
  791. "name": "Continue slightly left onto {way_name}",
  792. "destination": "Continue slightly left towards {destination}"
  793. },
  794. "slight right": {
  795. "default": "Continue slightly right",
  796. "name": "Continue slightly right onto {way_name}",
  797. "destination": "Continue slightly right towards {destination}"
  798. },
  799. "uturn": {
  800. "default": "Make a U-turn",
  801. "name": "Make a U-turn onto {way_name}",
  802. "destination": "Make a U-turn towards {destination}"
  803. }
  804. },
  805. "depart": {
  806. "default": {
  807. "default": "Head {direction}",
  808. "name": "Head {direction} on {way_name}"
  809. }
  810. },
  811. "end of road": {
  812. "default": {
  813. "default": "Turn {modifier}",
  814. "name": "Turn {modifier} onto {way_name}",
  815. "destination": "Turn {modifier} towards {destination}"
  816. },
  817. "straight": {
  818. "default": "Continue straight",
  819. "name": "Continue straight onto {way_name}",
  820. "destination": "Continue straight towards {destination}"
  821. },
  822. "uturn": {
  823. "default": "Make a U-turn at the end of the road",
  824. "name": "Make a U-turn onto {way_name} at the end of the road",
  825. "destination": "Make a U-turn towards {destination} at the end of the road"
  826. }
  827. },
  828. "fork": {
  829. "default": {
  830. "default": "Keep {modifier} at the fork",
  831. "name": "Keep {modifier} at the fork onto {way_name}",
  832. "destination": "Keep {modifier} at the fork towards {destination}"
  833. },
  834. "slight left": {
  835. "default": "Keep left at the fork",
  836. "name": "Keep left at the fork onto {way_name}",
  837. "destination": "Keep left at the fork towards {destination}"
  838. },
  839. "slight right": {
  840. "default": "Keep right at the fork",
  841. "name": "Keep right at the fork onto {way_name}",
  842. "destination": "Keep right at the fork towards {destination}"
  843. },
  844. "sharp left": {
  845. "default": "Take a sharp left at the fork",
  846. "name": "Take a sharp left at the fork onto {way_name}",
  847. "destination": "Take a sharp left at the fork towards {destination}"
  848. },
  849. "sharp right": {
  850. "default": "Take a sharp right at the fork",
  851. "name": "Take a sharp right at the fork onto {way_name}",
  852. "destination": "Take a sharp right at the fork towards {destination}"
  853. },
  854. "uturn": {
  855. "default": "Make a U-turn",
  856. "name": "Make a U-turn onto {way_name}",
  857. "destination": "Make a U-turn towards {destination}"
  858. }
  859. },
  860. "merge": {
  861. "default": {
  862. "default": "Merge {modifier}",
  863. "name": "Merge {modifier} onto {way_name}",
  864. "destination": "Merge {modifier} towards {destination}"
  865. },
  866. "slight left": {
  867. "default": "Merge left",
  868. "name": "Merge left onto {way_name}",
  869. "destination": "Merge left towards {destination}"
  870. },
  871. "slight right": {
  872. "default": "Merge right",
  873. "name": "Merge right onto {way_name}",
  874. "destination": "Merge right towards {destination}"
  875. },
  876. "sharp left": {
  877. "default": "Merge left",
  878. "name": "Merge left onto {way_name}",
  879. "destination": "Merge left towards {destination}"
  880. },
  881. "sharp right": {
  882. "default": "Merge right",
  883. "name": "Merge right onto {way_name}",
  884. "destination": "Merge right towards {destination}"
  885. },
  886. "uturn": {
  887. "default": "Make a U-turn",
  888. "name": "Make a U-turn onto {way_name}",
  889. "destination": "Make a U-turn towards {destination}"
  890. }
  891. },
  892. "new name": {
  893. "default": {
  894. "default": "Continue {modifier}",
  895. "name": "Continue {modifier} onto {way_name}",
  896. "destination": "Continue {modifier} towards {destination}"
  897. },
  898. "sharp left": {
  899. "default": "Take a sharp left",
  900. "name": "Take a sharp left onto {way_name}",
  901. "destination": "Take a sharp left towards {destination}"
  902. },
  903. "sharp right": {
  904. "default": "Take a sharp right",
  905. "name": "Take a sharp right onto {way_name}",
  906. "destination": "Take a sharp right towards {destination}"
  907. },
  908. "slight left": {
  909. "default": "Continue slightly left",
  910. "name": "Continue slightly left onto {way_name}",
  911. "destination": "Continue slightly left towards {destination}"
  912. },
  913. "slight right": {
  914. "default": "Continue slightly right",
  915. "name": "Continue slightly right onto {way_name}",
  916. "destination": "Continue slightly right towards {destination}"
  917. },
  918. "uturn": {
  919. "default": "Make a U-turn",
  920. "name": "Make a U-turn onto {way_name}",
  921. "destination": "Make a U-turn towards {destination}"
  922. }
  923. },
  924. "notification": {
  925. "default": {
  926. "default": "Continue {modifier}",
  927. "name": "Continue {modifier} onto {way_name}",
  928. "destination": "Continue {modifier} towards {destination}"
  929. },
  930. "uturn": {
  931. "default": "Make a U-turn",
  932. "name": "Make a U-turn onto {way_name}",
  933. "destination": "Make a U-turn towards {destination}"
  934. }
  935. },
  936. "off ramp": {
  937. "default": {
  938. "default": "Take the ramp",
  939. "name": "Take the ramp onto {way_name}",
  940. "destination": "Take the ramp towards {destination}"
  941. },
  942. "left": {
  943. "default": "Take the ramp on the left",
  944. "name": "Take the ramp on the left onto {way_name}",
  945. "destination": "Take the ramp on the left towards {destination}"
  946. },
  947. "right": {
  948. "default": "Take the ramp on the right",
  949. "name": "Take the ramp on the right onto {way_name}",
  950. "destination": "Take the ramp on the right towards {destination}"
  951. },
  952. "sharp left": {
  953. "default": "Take the ramp on the left",
  954. "name": "Take the ramp on the left onto {way_name}",
  955. "destination": "Take the ramp on the left towards {destination}"
  956. },
  957. "sharp right": {
  958. "default": "Take the ramp on the right",
  959. "name": "Take the ramp on the right onto {way_name}",
  960. "destination": "Take the ramp on the right towards {destination}"
  961. },
  962. "slight left": {
  963. "default": "Take the ramp on the left",
  964. "name": "Take the ramp on the left onto {way_name}",
  965. "destination": "Take the ramp on the left towards {destination}"
  966. },
  967. "slight right": {
  968. "default": "Take the ramp on the right",
  969. "name": "Take the ramp on the right onto {way_name}",
  970. "destination": "Take the ramp on the right towards {destination}"
  971. }
  972. },
  973. "on ramp": {
  974. "default": {
  975. "default": "Take the ramp",
  976. "name": "Take the ramp onto {way_name}",
  977. "destination": "Take the ramp towards {destination}"
  978. },
  979. "left": {
  980. "default": "Take the ramp on the left",
  981. "name": "Take the ramp on the left onto {way_name}",
  982. "destination": "Take the ramp on the left towards {destination}"
  983. },
  984. "right": {
  985. "default": "Take the ramp on the right",
  986. "name": "Take the ramp on the right onto {way_name}",
  987. "destination": "Take the ramp on the right towards {destination}"
  988. },
  989. "sharp left": {
  990. "default": "Take the ramp on the left",
  991. "name": "Take the ramp on the left onto {way_name}",
  992. "destination": "Take the ramp on the left towards {destination}"
  993. },
  994. "sharp right": {
  995. "default": "Take the ramp on the right",
  996. "name": "Take the ramp on the right onto {way_name}",
  997. "destination": "Take the ramp on the right towards {destination}"
  998. },
  999. "slight left": {
  1000. "default": "Take the ramp on the left",
  1001. "name": "Take the ramp on the left onto {way_name}",
  1002. "destination": "Take the ramp on the left towards {destination}"
  1003. },
  1004. "slight right": {
  1005. "default": "Take the ramp on the right",
  1006. "name": "Take the ramp on the right onto {way_name}",
  1007. "destination": "Take the ramp on the right towards {destination}"
  1008. }
  1009. },
  1010. "rotary": {
  1011. "default": {
  1012. "default": {
  1013. "default": "Enter the rotary",
  1014. "name": "Enter the rotary and exit onto {way_name}",
  1015. "destination": "Enter the rotary and exit towards {destination}"
  1016. },
  1017. "name": {
  1018. "default": "Enter {rotary_name}",
  1019. "name": "Enter {rotary_name} and exit onto {way_name}",
  1020. "destination": "Enter {rotary_name} and exit towards {destination}"
  1021. },
  1022. "exit": {
  1023. "default": "Enter the rotary and take the {exit_number} exit",
  1024. "name": "Enter the rotary and take the {exit_number} exit onto {way_name}",
  1025. "destination": "Enter the rotary and take the {exit_number} exit towards {destination}"
  1026. },
  1027. "name_exit": {
  1028. "default": "Enter {rotary_name} and take the {exit_number} exit",
  1029. "name": "Enter {rotary_name} and take the {exit_number} exit onto {way_name}",
  1030. "destination": "Enter {rotary_name} and take the {exit_number} exit towards {destination}"
  1031. }
  1032. }
  1033. },
  1034. "roundabout": {
  1035. "default": {
  1036. "exit": {
  1037. "default": "Enter the roundabout and take the {exit_number} exit",
  1038. "name": "Enter the roundabout and take the {exit_number} exit onto {way_name}",
  1039. "destination": "Enter the roundabout and take the {exit_number} exit towards {destination}"
  1040. },
  1041. "default": {
  1042. "default": "Enter the roundabout",
  1043. "name": "Enter the roundabout and exit onto {way_name}",
  1044. "destination": "Enter the roundabout and exit towards {destination}"
  1045. }
  1046. }
  1047. },
  1048. "roundabout turn": {
  1049. "default": {
  1050. "default": "At the roundabout make a {modifier}",
  1051. "name": "At the roundabout make a {modifier} onto {way_name}",
  1052. "destination": "At the roundabout make a {modifier} towards {destination}"
  1053. },
  1054. "left": {
  1055. "default": "At the roundabout turn left",
  1056. "name": "At the roundabout turn left onto {way_name}",
  1057. "destination": "At the roundabout turn left towards {destination}"
  1058. },
  1059. "right": {
  1060. "default": "At the roundabout turn right",
  1061. "name": "At the roundabout turn right onto {way_name}",
  1062. "destination": "At the roundabout turn right towards {destination}"
  1063. },
  1064. "straight": {
  1065. "default": "At the roundabout continue straight",
  1066. "name": "At the roundabout continue straight onto {way_name}",
  1067. "destination": "At the roundabout continue straight towards {destination}"
  1068. }
  1069. },
  1070. "turn": {
  1071. "default": {
  1072. "default": "Make a {modifier}",
  1073. "name": "Make a {modifier} onto {way_name}",
  1074. "destination": "Make a {modifier} towards {destination}"
  1075. },
  1076. "left": {
  1077. "default": "Turn left",
  1078. "name": "Turn left onto {way_name}",
  1079. "destination": "Turn left towards {destination}"
  1080. },
  1081. "right": {
  1082. "default": "Turn right",
  1083. "name": "Turn right onto {way_name}",
  1084. "destination": "Turn right towards {destination}"
  1085. },
  1086. "straight": {
  1087. "default": "Go straight",
  1088. "name": "Go straight onto {way_name}",
  1089. "destination": "Go straight towards {destination}"
  1090. }
  1091. },
  1092. "use lane": {
  1093. "no_lanes": {
  1094. "default": "Continue straight"
  1095. },
  1096. "default": {
  1097. "default": "{lane_instruction}"
  1098. }
  1099. }
  1100. }
  1101. }
  1102. }, {}],
  1103. 6: [function (_dereq_, module, exports) {
  1104. module.exports = {
  1105. "meta": {
  1106. "capitalizeFirstLetter": true
  1107. },
  1108. "v5": {
  1109. "constants": {
  1110. "ordinalize": {
  1111. "1": "première",
  1112. "2": "seconde",
  1113. "3": "troisième",
  1114. "4": "quatrième",
  1115. "5": "cinquième",
  1116. "6": "sixième",
  1117. "7": "setpième",
  1118. "8": "huitième",
  1119. "9": "neuvième",
  1120. "10": "dixième"
  1121. },
  1122. "direction": {
  1123. "north": "le nord",
  1124. "northeast": "le nord-est",
  1125. "east": "l'est",
  1126. "southeast": "le sud-est",
  1127. "south": "le sud",
  1128. "southwest": "le sud-ouest",
  1129. "west": "l'ouest",
  1130. "northwest": "le nord-ouest"
  1131. },
  1132. "modifier": {
  1133. "left": "à gauche",
  1134. "right": "à droite",
  1135. "sharp left": "franchement à gauche",
  1136. "sharp right": "franchement à droite",
  1137. "slight left": "légèrement à gauche",
  1138. "slight right": "légèrement à droite",
  1139. "straight": "tout droit",
  1140. "uturn": "demi-tour"
  1141. },
  1142. "lanes": {
  1143. "xo": "Serrer à droite",
  1144. "ox": "Serrer à gauche",
  1145. "xox": "Rester au milieu",
  1146. "oxo": "Rester à gauche ou à droite"
  1147. }
  1148. },
  1149. "modes": {
  1150. "ferry": {
  1151. "default": "Prendre le ferry",
  1152. "name": "Prendre le ferry {way_name}",
  1153. "destination": "Prendre le ferry en direction de {destination}"
  1154. }
  1155. },
  1156. "arrive": {
  1157. "default": {
  1158. "default": "Vous êtes arrivés à votre {nth} destination"
  1159. },
  1160. "left": {
  1161. "default": "Vous êtes arrivés à votre {nth} destination, sur la gauche"
  1162. },
  1163. "right": {
  1164. "default": "Vous êtes arrivés à votre {nth} destination, sur la droite"
  1165. },
  1166. "sharp left": {
  1167. "default": "Vous êtes arrivés à votre {nth} destination, sur la gauche"
  1168. },
  1169. "sharp right": {
  1170. "default": "Vous êtes arrivés à votre {nth} destination, sur la droite"
  1171. },
  1172. "slight right": {
  1173. "default": "Vous êtes arrivés à votre {nth} destination, sur la droite"
  1174. },
  1175. "slight left": {
  1176. "default": "Vous êtes arrivés à votre {nth} destination, sur la gauche"
  1177. },
  1178. "straight": {
  1179. "default": "Vous êtes arrivés à votre {nth} destination, droit devant"
  1180. }
  1181. },
  1182. "continue": {
  1183. "default": {
  1184. "default": "Continuer {modifier}",
  1185. "name": "Continuer {modifier} sur {way_name}",
  1186. "destination": "Continuer {modifier} en direction de {destination}"
  1187. },
  1188. "slight left": {
  1189. "default": "Continuer légèrement à gauche",
  1190. "name": "Continuer légèrement à gauche sur {way_name}",
  1191. "destination": "Continuer légèrement à gauche en direction de {destination}"
  1192. },
  1193. "slight right": {
  1194. "default": "Continuer légèrement à droite",
  1195. "name": "Continuer légèrement à droite sur {way_name}",
  1196. "destination": "Continuer légèrement à droite en direction de {destination}"
  1197. },
  1198. "uturn": {
  1199. "default": "Faire demi-tour",
  1200. "name": "Faire demi-tour sur {way_name}",
  1201. "destination": "Faire demi-tour en direction de {destination}"
  1202. }
  1203. },
  1204. "depart": {
  1205. "default": {
  1206. "default": "Rouler vers {direction}",
  1207. "name": "Rouler vers {direction} sur {way_name}"
  1208. }
  1209. },
  1210. "end of road": {
  1211. "default": {
  1212. "default": "Tourner {modifier}",
  1213. "name": "Tourner {modifier} sur {way_name}",
  1214. "destination": "Tourner {modifier} en direction de {destination}"
  1215. },
  1216. "straight": {
  1217. "default": "Continuer tout droit",
  1218. "name": "Continuer tout droit sur {way_name}",
  1219. "destination": "Continuer tout droit en direction de {destination}"
  1220. },
  1221. "uturn": {
  1222. "default": "Faire demi-tour à la fin de la route",
  1223. "name": "Faire demi-tour à la fin de la route {way_name}",
  1224. "destination": "Faire demi-tour à la fin de la route en direction de {destination}"
  1225. }
  1226. },
  1227. "fork": {
  1228. "default": {
  1229. "default": "Rester {modifier} à l'embranchement",
  1230. "name": "Rester {modifier} à l'embranchement sur {way_name}",
  1231. "destination": "Rester {modifier} à l'embranchement en direction de {destination}"
  1232. },
  1233. "slight left": {
  1234. "default": "Rester à gauche à l'embranchement",
  1235. "name": "Rester à gauche à l'embranchement sur {way_name}",
  1236. "destination": "Rester à gauche à l'embranchement en direction de {destination}"
  1237. },
  1238. "slight right": {
  1239. "default": "Rester à droite à l'embranchement",
  1240. "name": "Rester à droite à l'embranchement sur {way_name}",
  1241. "destination": "Rester à droite à l'embranchement en direction de {destination}"
  1242. },
  1243. "sharp left": {
  1244. "default": "Prendre à gauche à l'embranchement",
  1245. "name": "Prendre à gauche à l'embranchement sur {way_name}",
  1246. "destination": "Prendre à gauche à l'embranchement en direction de {destination}"
  1247. },
  1248. "sharp right": {
  1249. "default": "Prendre à droite à l'embranchement",
  1250. "name": "Prendre à droite à l'embranchement sur {way_name}",
  1251. "destination": "Prendre à droite à l'embranchement en direction de {destination}"
  1252. },
  1253. "uturn": {
  1254. "default": "Faire demi-tour",
  1255. "name": "Faire demi-tour sur {way_name}",
  1256. "destination": "Faire demi-tour en direction de {destination}"
  1257. }
  1258. },
  1259. "merge": {
  1260. "default": {
  1261. "default": "Rejoindre {modifier}",
  1262. "name": "Rejoindre {modifier} sur {way_name}",
  1263. "destination": "Rejoindre {modifier} en direction de {destination}"
  1264. },
  1265. "slight left": {
  1266. "default": "Rejoindre légèrement par la gauche",
  1267. "name": "Rejoindre {way_name} légèrement par la gauche",
  1268. "destination": "Rejoindre légèrement par la gauche la route en direction de {destination}"
  1269. },
  1270. "slight right": {
  1271. "default": "Rejoindre légèrement par la droite",
  1272. "name": "Rejoindre {way_name} légèrement par la droite",
  1273. "destination": "Rejoindre légèrement par la droite la route en direction de {destination}"
  1274. },
  1275. "sharp left": {
  1276. "default": "Rejoindre par la gauche",
  1277. "name": "Rejoindre {way_name} par la gauche",
  1278. "destination": "Rejoindre par la gauche la route en direction de {destination}"
  1279. },
  1280. "sharp right": {
  1281. "default": "Rejoindre par la droite",
  1282. "name": "Rejoindre {way_name} par la droite",
  1283. "destination": "Rejoindre par la droite la route en direction de {destination}"
  1284. },
  1285. "uturn": {
  1286. "default": "Fair demi-tour",
  1287. "name": "Fair demi-tour sur {way_name}",
  1288. "destination": "Fair demi-tour en direction de {destination}"
  1289. }
  1290. },
  1291. "new name": {
  1292. "default": {
  1293. "default": "Continuer {modifier}",
  1294. "name": "Continuer {modifier} sur {way_name}",
  1295. "destination": "Continuer {modifier} en direction de {destination}"
  1296. },
  1297. "sharp left": {
  1298. "default": "Prendre à gauche",
  1299. "name": "Prendre à gauche sur {way_name}",
  1300. "destination": "Prendre à gauche en direction de {destination}"
  1301. },
  1302. "sharp right": {
  1303. "default": "Prendre à droite",
  1304. "name": "Prendre à droite sur {way_name}",
  1305. "destination": "Prendre à droite en direction de {destination}"
  1306. },
  1307. "slight left": {
  1308. "default": "Continuer légèrement à gauche",
  1309. "name": "Continuer légèrement à gauche sur {way_name}",
  1310. "destination": "Continuer légèrement à gauche en direction de {destination}"
  1311. },
  1312. "slight right": {
  1313. "default": "Continuer légèrement à droite",
  1314. "name": "Continuer légèrement à droite sur {way_name}",
  1315. "destination": "Continuer légèrement à droite en direction de {destination}"
  1316. },
  1317. "uturn": {
  1318. "default": "Fair demi-tour",
  1319. "name": "Fair demi-tour sur {way_name}",
  1320. "destination": "Fair demi-tour en direction de {destination}"
  1321. }
  1322. },
  1323. "notification": {
  1324. "default": {
  1325. "default": "Continuer {modifier}",
  1326. "name": "Continuer {modifier} sur {way_name}",
  1327. "destination": "Continuer {modifier} en direction de {destination}"
  1328. },
  1329. "uturn": {
  1330. "default": "Fair demi-tour",
  1331. "name": "Fair demi-tour sur {way_name}",
  1332. "destination": "Fair demi-tour en direction de {destination}"
  1333. }
  1334. },
  1335. "off ramp": {
  1336. "default": {
  1337. "default": "Prendre la sortie",
  1338. "name": "Prendre la sortie sur {way_name}",
  1339. "destination": "Prendre la sortie en direction de {destination}"
  1340. },
  1341. "left": {
  1342. "default": "Prendre la sortie à gauche",
  1343. "name": "Prendre la sortie à gauche sur {way_name}",
  1344. "destination": "Prendre la sortie à gauche en direction de {destination}"
  1345. },
  1346. "right": {
  1347. "default": "Prendre la sortie à droite",
  1348. "name": "Prendre la sortie à droite sur {way_name}",
  1349. "destination": "Prendre la sortie à droite en direction de {destination}"
  1350. },
  1351. "sharp left": {
  1352. "default": "Prendre la sortie à gauche",
  1353. "name": "Prendre la sortie à gauche sur {way_name}",
  1354. "destination": "Prendre la sortie à gauche en direction de {destination}"
  1355. },
  1356. "sharp right": {
  1357. "default": "Prendre la sortie à droite",
  1358. "name": "Prendre la sortie à droite sur {way_name}",
  1359. "destination": "Prendre la sortie à droite en direction de {destination}"
  1360. },
  1361. "slight left": {
  1362. "default": "Prendre la sortie à gauche",
  1363. "name": "Prendre la sortie à gauche sur {way_name}",
  1364. "destination": "Prendre la sortie à gauche en direction de {destination}"
  1365. },
  1366. "slight right": {
  1367. "default": "Prendre la sortie à droite",
  1368. "name": "Prendre la sortie à droite sur {way_name}",
  1369. "destination": "Prendre la sortie à droite en direction de {destination}"
  1370. }
  1371. },
  1372. "on ramp": {
  1373. "default": {
  1374. "default": "Prendre la sortie",
  1375. "name": "Prendre la sortie sur {way_name}",
  1376. "destination": "Prendre la sortie en direction de {destination}"
  1377. },
  1378. "left": {
  1379. "default": "Prendre la sortie à gauche",
  1380. "name": "Prendre la sortie à gauche sur {way_name}",
  1381. "destination": "Prendre la sortie à gauche en direction de {destination}"
  1382. },
  1383. "right": {
  1384. "default": "Prendre la sortie à droite",
  1385. "name": "Prendre la sortie à droite sur {way_name}",
  1386. "destination": "Prendre la sortie à droite en direction de {destination}"
  1387. },
  1388. "sharp left": {
  1389. "default": "Prendre la sortie à gauche",
  1390. "name": "Prendre la sortie à gauche sur {way_name}",
  1391. "destination": "Prendre la sortie à gauche en direction de {destination}"
  1392. },
  1393. "sharp right": {
  1394. "default": "Prendre la sortie à droite",
  1395. "name": "Prendre la sortie à droite sur {way_name}",
  1396. "destination": "Prendre la sortie à droite en direction de {destination}"
  1397. },
  1398. "slight left": {
  1399. "default": "Prendre la sortie à gauche",
  1400. "name": "Prendre la sortie à gauche sur {way_name}",
  1401. "destination": "Prendre la sortie à gauche en direction de {destination}"
  1402. },
  1403. "slight right": {
  1404. "default": "Prendre la sortie à droite",
  1405. "name": "Prendre la sortie à droite sur {way_name}",
  1406. "destination": "Prendre la sortie à droite en direction de {destination}"
  1407. }
  1408. },
  1409. "rotary": {
  1410. "default": {
  1411. "default": {
  1412. "default": "Entrer dans le rond-point",
  1413. "name": "Entrer dans le rond-point et sortir par {way_name}",
  1414. "destination": "Entrer dans le rond-point et sortir en direction de {destination}"
  1415. },
  1416. "name": {
  1417. "default": "Entrer dans le rond-point {rotary_name}",
  1418. "name": "Entrer dans le rond-point {rotary_name} et sortir par {way_name}",
  1419. "destination": "Entrer dans le rond-point {rotary_name} et sortir en direction de {destination}"
  1420. },
  1421. "exit": {
  1422. "default": "Entrer dans le rond-point et prendre la {exit_number} sortie",
  1423. "name": "Entrer dans le rond-point et prendre la {exit_number} sortie sur {way_name}",
  1424. "destination": "Entrer dans le rond-point et prendre la {exit_number} sortie en direction de {destination}"
  1425. },
  1426. "name_exit": {
  1427. "default": "Entrer dans le rond-point {rotary_name} et prendre la {exit_number} sortie",
  1428. "name": "Entrer dans le rond-point {rotary_name} et prendre la {exit_number} sortie sur {way_name}",
  1429. "destination": "Entrer dans le rond-point {rotary_name} et prendre la {exit_number} sortie en direction de {destination}"
  1430. }
  1431. }
  1432. },
  1433. "roundabout": {
  1434. "default": {
  1435. "exit": {
  1436. "default": "Entrer dans le rond-point et prendre la {exit_number} sortie",
  1437. "name": "Entrer dans le rond-point et prendre la {exit_number} sortie sur {way_name}",
  1438. "destination": "Entrer dans le rond-point et prendre la {exit_number} sortie en direction de {destination}"
  1439. },
  1440. "default": {
  1441. "default": "Entrer dans le rond-point",
  1442. "name": "Entrer dans le rond-point et sortir par {way_name}",
  1443. "destination": "Entrer dans le rond-point et sortir en direction de {destination}"
  1444. }
  1445. }
  1446. },
  1447. "roundabout turn": {
  1448. "default": {
  1449. "default": "Au rond-point, tourner {modifier}",
  1450. "name": "Au rond-point, tourner {modifier} sur {way_name}",
  1451. "destination": "Au rond-point, tourner {modifier} en direction de {destination}"
  1452. },
  1453. "left": {
  1454. "default": "Au rond-point, tourner à gauche",
  1455. "name": "Au rond-point, tourner à gauche sur {way_name}",
  1456. "destination": "Au rond-point, tourner à gauche en direction de {destination}"
  1457. },
  1458. "right": {
  1459. "default": "Au rond-point, tourner à droite",
  1460. "name": "Au rond-point, tourner à droite sur {way_name}",
  1461. "destination": "Au rond-point, tourner à droite en direction de {destination}"
  1462. },
  1463. "straight": {
  1464. "default": "Au rond-point, continuer tout droit",
  1465. "name": "Au rond-point, continuer tout droit sur {way_name}",
  1466. "destination": "Au rond-point, continuer tout droit en direction de {destination}"
  1467. }
  1468. },
  1469. "turn": {
  1470. "default": {
  1471. "default": "Tourner {modifier}",
  1472. "name": "Tourner {modifier} sur {way_name}",
  1473. "destination": "Tourner {modifier} en direction de {destination}"
  1474. },
  1475. "left": {
  1476. "default": "Tourner à gauche",
  1477. "name": "Tourner à gauche sur {way_name}",
  1478. "destination": "Tourner à gauche en direction de {destination}"
  1479. },
  1480. "right": {
  1481. "default": "Tourner à droite",
  1482. "name": "Tourner à droite sur {way_name}",
  1483. "destination": "Tourner à droite en direction de {destination}"
  1484. },
  1485. "straight": {
  1486. "default": "Aller tout droit",
  1487. "name": "Aller tout droit sur {way_name}",
  1488. "destination": "Aller tout droit en direction de {destination}"
  1489. }
  1490. },
  1491. "use lane": {
  1492. "no_lanes": {
  1493. "default": "Continuer tout droit"
  1494. },
  1495. "default": {
  1496. "default": "{lane_instruction} pour continuer {modifier}"
  1497. },
  1498. "straight": {
  1499. "default": "{lane_instruction}"
  1500. },
  1501. "left": {
  1502. "default": "{lane_instruction} pour tourner à gauche"
  1503. },
  1504. "right": {
  1505. "default": "{lane_instruction} pour tourner à droite"
  1506. }
  1507. }
  1508. }
  1509. }
  1510. }, {}],
  1511. 7: [function (_dereq_, module, exports) {
  1512. module.exports = {
  1513. "meta": {
  1514. "capitalizeFirstLetter": true
  1515. },
  1516. "v5": {
  1517. "constants": {
  1518. "ordinalize": {
  1519. "1": "eerste",
  1520. "2": "tweede",
  1521. "3": "derde",
  1522. "4": "vierde",
  1523. "5": "vijfde",
  1524. "6": "zesde",
  1525. "7": "zevende",
  1526. "8": "achtste",
  1527. "9": "negende",
  1528. "10": "tiende"
  1529. },
  1530. "direction": {
  1531. "north": "noord",
  1532. "northeast": "noordoost",
  1533. "east": "oost",
  1534. "southeast": "zuidoost",
  1535. "south": "zuid",
  1536. "southwest": "zuidwest",
  1537. "west": "west",
  1538. "northwest": "noordwest"
  1539. },
  1540. "modifier": {
  1541. "left": "links",
  1542. "right": "rechts",
  1543. "sharp left": "linksaf",
  1544. "sharp right": "rechtsaf",
  1545. "slight left": "links",
  1546. "slight right": "rechts",
  1547. "straight": "rechtdoor",
  1548. "uturn": "omkeren"
  1549. },
  1550. "lanes": {
  1551. "xo": "Rechts aanhouden",
  1552. "ox": "Links aanhouden",
  1553. "xox": "In het midden blijven",
  1554. "oxo": "Links of rechts blijven"
  1555. }
  1556. },
  1557. "modes": {
  1558. "ferry": {
  1559. "default": "Neem het veer",
  1560. "name": "Neem het veer {way_name}",
  1561. "destination": "Neem het veer naar {destination}"
  1562. }
  1563. },
  1564. "arrive": {
  1565. "default": {
  1566. "default": "Je bent gearriveerd op de {nth} bestemming."
  1567. },
  1568. "left": {
  1569. "default": "Je bent gearriveerd. De {nth} bestemming bevindt zich links."
  1570. },
  1571. "right": {
  1572. "default": "Je bent gearriveerd. De {nth} bestemming bevindt zich rechts."
  1573. },
  1574. "sharp left": {
  1575. "default": "Je bent gearriveerd. De {nth} bestemming bevindt zich links."
  1576. },
  1577. "sharp right": {
  1578. "default": "Je bent gearriveerd. De {nth} bestemming bevindt zich rechts."
  1579. },
  1580. "slight right": {
  1581. "default": "Je bent gearriveerd. De {nth} bestemming bevindt zich rechts."
  1582. },
  1583. "slight left": {
  1584. "default": "Je bent gearriveerd. De {nth} bestemming bevindt zich links."
  1585. },
  1586. "straight": {
  1587. "default": "Je bent gearriveerd. De {nth} bestemming bevindt zich voor je."
  1588. }
  1589. },
  1590. "continue": {
  1591. "default": {
  1592. "default": "Ga {modifier}",
  1593. "name": "Ga {modifier} naar {way_name}",
  1594. "destination": "Ga {modifier} richting {destination}"
  1595. },
  1596. "slight left": {
  1597. "default": "Links aanhouden",
  1598. "name": "Links aanhouden naar {way_name}",
  1599. "destination": "Links aanhouden richting {destination}"
  1600. },
  1601. "slight right": {
  1602. "default": "Rechts aanhouden",
  1603. "name": "Rechts aanhouden naar {way_name}",
  1604. "destination": "Rechts aanhouden richting {destination}"
  1605. },
  1606. "uturn": {
  1607. "default": "Keer om",
  1608. "name": "Keer om naar {way_name}",
  1609. "destination": "Keer om richting {destination}"
  1610. }
  1611. },
  1612. "depart": {
  1613. "default": {
  1614. "default": "Vertrek in {direction}elijke richting",
  1615. "name": "Neem {way_name} in {direction}elijke richting"
  1616. }
  1617. },
  1618. "end of road": {
  1619. "default": {
  1620. "default": "Ga {modifier}",
  1621. "name": "Ga {modifier} naar {way_name}",
  1622. "destination": "Ga {modifier} richting {destination}"
  1623. },
  1624. "straight": {
  1625. "default": "Ga in de aangegeven richting",
  1626. "name": "Ga naar {way_name}",
  1627. "destination": "Ga richting {destination}"
  1628. },
  1629. "uturn": {
  1630. "default": "Keer om",
  1631. "name": "Keer om naar {way_name}",
  1632. "destination": "Keer om richting {destination}"
  1633. }
  1634. },
  1635. "fork": {
  1636. "default": {
  1637. "default": "Ga {modifier} op de splitsing",
  1638. "name": "Ga {modifier} op de splitsing naar {way_name}",
  1639. "destination": "Ga {modifier} op de splitsing richting {destination}"
  1640. },
  1641. "slight left": {
  1642. "default": "Links aanhouden op de splitsing",
  1643. "name": "Links aanhouden op de splitsing naar {way_name}",
  1644. "destination": "Links aanhouden op de splitsing richting {destination}"
  1645. },
  1646. "slight right": {
  1647. "default": "Rechts aanhouden op de splitsing",
  1648. "name": "Rechts aanhouden op de splitsing naar {way_name}",
  1649. "destination": "Rechts aanhouden op de splitsing richting {destination}"
  1650. },
  1651. "sharp left": {
  1652. "default": "Linksaf op de splitsing",
  1653. "name": "Linksaf op de splitsing naar {way_name}",
  1654. "destination": "Linksaf op de splitsing richting {destination}"
  1655. },
  1656. "sharp right": {
  1657. "default": "Rechtsaf op de splitsing",
  1658. "name": "Rechtsaf op de splitsing naar {way_name}",
  1659. "destination": "Rechtsaf op de splitsing richting {destination}"
  1660. },
  1661. "uturn": {
  1662. "default": "Keer om",
  1663. "name": "Keer om naar {way_name}",
  1664. "destination": "Keer om richting {destination}"
  1665. }
  1666. },
  1667. "merge": {
  1668. "default": {
  1669. "default": "Bij de splitsing {modifier}",
  1670. "name": "Bij de splitsing {modifier} naar {way_name}",
  1671. "destination": "Bij de splitsing {modifier} richting {destination}"
  1672. },
  1673. "slight left": {
  1674. "default": "Bij de splitsing links aanhouden",
  1675. "name": "Bij de splitsing links aanhouden naar {way_name}",
  1676. "destination": "Bij de splitsing links aanhouden richting {destination}"
  1677. },
  1678. "slight right": {
  1679. "default": "Bij de splitsing rechts aanhouden",
  1680. "name": "Bij de splitsing rechts aanhouden naar {way_name}",
  1681. "destination": "Bij de splitsing rechts aanhouden richting {destination}"
  1682. },
  1683. "sharp left": {
  1684. "default": "Bij de splitsing linksaf",
  1685. "name": "Bij de splitsing linksaf naar {way_name}",
  1686. "destination": "Bij de splitsing linksaf richting {destination}"
  1687. },
  1688. "sharp right": {
  1689. "default": "Bij de splitsing rechtsaf",
  1690. "name": "Bij de splitsing rechtsaf naar {way_name}",
  1691. "destination": "Bij de splitsing rechtsaf richting {destination}"
  1692. },
  1693. "uturn": {
  1694. "default": "Keer om",
  1695. "name": "Keer om naar {way_name}",
  1696. "destination": "Keer om richting {destination}"
  1697. }
  1698. },
  1699. "new name": {
  1700. "default": {
  1701. "default": "Ga {modifier}",
  1702. "name": "Ga {modifier} naar {way_name}",
  1703. "destination": "Ga {modifier} richting {destination}"
  1704. },
  1705. "sharp left": {
  1706. "default": "Linksaf",
  1707. "name": "Linksaf naar {way_name}",
  1708. "destination": "Linksaf richting {destination}"
  1709. },
  1710. "sharp right": {
  1711. "default": "Rechtsaf",
  1712. "name": "Rechtsaf naar {way_name}",
  1713. "destination": "Rechtsaf richting {destination}"
  1714. },
  1715. "slight left": {
  1716. "default": "Links aanhouden",
  1717. "name": "Links aanhouden naar {way_name}",
  1718. "destination": "Links aanhouden richting {destination}"
  1719. },
  1720. "slight right": {
  1721. "default": "Rechts aanhouden",
  1722. "name": "Rechts aanhouden naar {way_name}",
  1723. "destination": "Rechts aanhouden richting {destination}"
  1724. },
  1725. "uturn": {
  1726. "default": "Keer om",
  1727. "name": "Keer om naar {way_name}",
  1728. "destination": "Keer om richting {destination}"
  1729. }
  1730. },
  1731. "notification": {
  1732. "default": {
  1733. "default": "Ga {modifier}",
  1734. "name": "Ga {modifier} naar {way_name}",
  1735. "destination": "Ga {modifier} richting {destination}"
  1736. },
  1737. "uturn": {
  1738. "default": "Keer om",
  1739. "name": "Keer om naar {way_name}",
  1740. "destination": "Keer om richting {destination}"
  1741. }
  1742. },
  1743. "off ramp": {
  1744. "default": {
  1745. "default": "Neem de afrit",
  1746. "name": "Neem de afrit naar {way_name}",
  1747. "destination": "Neem de afrit richting {destination}"
  1748. },
  1749. "left": {
  1750. "default": "Neem de afrit links",
  1751. "name": "Neem de afrit links naar {way_name}",
  1752. "destination": "Neem de afrit links richting {destination}"
  1753. },
  1754. "right": {
  1755. "default": "Neem de afrit rechts",
  1756. "name": "Neem de afrit rechts naar {way_name}",
  1757. "destination": "Neem de afrit rechts richting {destination}"
  1758. },
  1759. "sharp left": {
  1760. "default": "Neem de afrit links",
  1761. "name": "Neem de afrit links naar {way_name}",
  1762. "destination": "Neem de afrit links richting {destination}"
  1763. },
  1764. "sharp right": {
  1765. "default": "Neem de afrit rechts",
  1766. "name": "Neem de afrit rechts naar {way_name}",
  1767. "destination": "Neem de afrit rechts richting {destination}"
  1768. },
  1769. "slight left": {
  1770. "default": "Neem de afrit links",
  1771. "name": "Neem de afrit links naar {way_name}",
  1772. "destination": "Neem de afrit links richting {destination}"
  1773. },
  1774. "slight right": {
  1775. "default": "Neem de afrit rechts",
  1776. "name": "Neem de afrit rechts naar {way_name}",
  1777. "destination": "Neem de afrit rechts richting {destination}"
  1778. }
  1779. },
  1780. "on ramp": {
  1781. "default": {
  1782. "default": "Neem de oprit",
  1783. "name": "Neem de oprit naar {way_name}",
  1784. "destination": "Neem de oprit richting {destination}"
  1785. },
  1786. "left": {
  1787. "default": "Neem de oprit links",
  1788. "name": "Neem de oprit links naar {way_name}",
  1789. "destination": "Neem de oprit links richting {destination}"
  1790. },
  1791. "right": {
  1792. "default": "Neem de oprit rechts",
  1793. "name": "Neem de oprit rechts naar {way_name}",
  1794. "destination": "Neem de oprit rechts richting {destination}"
  1795. },
  1796. "sharp left": {
  1797. "default": "Neem de oprit links",
  1798. "name": "Neem de oprit links naar {way_name}",
  1799. "destination": "Neem de oprit links richting {destination}"
  1800. },
  1801. "sharp right": {
  1802. "default": "Neem de oprit rechts",
  1803. "name": "Neem de oprit rechts naar {way_name}",
  1804. "destination": "Neem de oprit rechts richting {destination}"
  1805. },
  1806. "slight left": {
  1807. "default": "Neem de oprit links",
  1808. "name": "Neem de oprit links naar {way_name}",
  1809. "destination": "Neem de oprit links richting {destination}"
  1810. },
  1811. "slight right": {
  1812. "default": "Neem de oprit rechts",
  1813. "name": "Neem de oprit rechts naar {way_name}",
  1814. "destination": "Neem de oprit rechts richting {destination}"
  1815. }
  1816. },
  1817. "rotary": {
  1818. "default": {
  1819. "default": {
  1820. "default": "Ga het knooppunt op",
  1821. "name": "Verlaat het knooppunt naar {way_name}",
  1822. "destination": "Verlaat het knooppunt richting {destination}"
  1823. },
  1824. "name": {
  1825. "default": "Ga het knooppunt {rotary_name} op",
  1826. "name": "Verlaat het knooppunt {rotary_name} naar {way_name}",
  1827. "destination": "Verlaat het knooppunt {rotary_name} richting {destination}"
  1828. },
  1829. "exit": {
  1830. "default": "Ga het knooppunt op en neem afslag {exit_number}",
  1831. "name": "Ga het knooppunt op en neem afslag {exit_number} naar {way_name}",
  1832. "destination": "Ga het knooppunt op en neem afslag {exit_number} richting {destination}"
  1833. },
  1834. "name_exit": {
  1835. "default": "Ga het knooppunt {rotary_name} op en neem afslag {exit_number}",
  1836. "name": "Ga het knooppunt {rotary_name} op en neem afslag {exit_number} naar {way_name}",
  1837. "destination": "Ga het knooppunt {rotary_name} op en neem afslag {exit_number} richting {destination}"
  1838. }
  1839. }
  1840. },
  1841. "roundabout": {
  1842. "default": {
  1843. "exit": {
  1844. "default": "Ga de rotonde op en neem afslag {exit_number}",
  1845. "name": "Ga de rotonde op en neem afslag {exit_number} naar {way_name}",
  1846. "destination": "Ga de rotonde op en neem afslag {exit_number} richting {destination}"
  1847. },
  1848. "default": {
  1849. "default": "Ga de rotonde op",
  1850. "name": "Verlaat de rotonde naar {way_name}",
  1851. "destination": "Verlaat de rotonde richting {destination}"
  1852. }
  1853. }
  1854. },
  1855. "roundabout turn": {
  1856. "default": {
  1857. "default": "Ga {modifier} op de rotonde",
  1858. "name": "Ga {modifier} op de rotonde naar {way_name}",
  1859. "destination": "Ga {modifier} op de rotonde richting {destination}"
  1860. },
  1861. "left": {
  1862. "default": "Ga links op de rotonde",
  1863. "name": "Ga links op de rotonde naar {way_name}",
  1864. "destination": "Ga links op de rotonde richting {destination}"
  1865. },
  1866. "right": {
  1867. "default": "Ga rechts op de rotonde",
  1868. "name": "Ga rechts op de rotonde naar {way_name}",
  1869. "destination": "Ga rechts op de rotonde richting {destination}"
  1870. },
  1871. "straight": {
  1872. "default": "Rechtdoor op de rotonde",
  1873. "name": "Rechtdoor op de rotonde naar {way_name}",
  1874. "destination": "Rechtdoor op de rotonde richting {destination}"
  1875. }
  1876. },
  1877. "turn": {
  1878. "default": {
  1879. "default": "Ga {modifier}",
  1880. "name": "Ga {modifier} naar {way_name}",
  1881. "destination": "Ga {modifier} richting {destination}"
  1882. },
  1883. "left": {
  1884. "default": "Ga linksaf",
  1885. "name": "Ga linksaf naar {way_name}",
  1886. "destination": "Ga linksaf richting {destination}"
  1887. },
  1888. "right": {
  1889. "default": "Ga rechtsaf",
  1890. "name": "Ga rechtsaf naar {way_name}",
  1891. "destination": "Ga rechtsaf richting {destination}"
  1892. },
  1893. "straight": {
  1894. "default": "Ga rechtdoor",
  1895. "name": "Ga rechtdoor naar {way_name}",
  1896. "destination": "Ga rechtdoor richting {destination}"
  1897. }
  1898. },
  1899. "use lane": {
  1900. "no_lanes": {
  1901. "default": "Rechtdoor"
  1902. },
  1903. "default": {
  1904. "default": "{lane_instruction} ga {modifier}"
  1905. },
  1906. "straight": {
  1907. "default": "{lane_instruction}"
  1908. },
  1909. "left": {
  1910. "default": "{lane_instruction} om links te gaan"
  1911. },
  1912. "right": {
  1913. "default": "{lane_instruction} om rechts te gaan"
  1914. }
  1915. }
  1916. }
  1917. }
  1918. }, {}],
  1919. 8: [function (_dereq_, module, exports) {
  1920. module.exports = {
  1921. "meta": {
  1922. "capitalizeFirstLetter": false
  1923. },
  1924. "v5": {
  1925. "constants": {
  1926. "ordinalize": {
  1927. "1": "第一",
  1928. "2": "第二",
  1929. "3": "第三",
  1930. "4": "第四",
  1931. "5": "第五",
  1932. "6": "第六",
  1933. "7": "第七",
  1934. "8": "第八",
  1935. "9": "第九",
  1936. "10": "第十"
  1937. },
  1938. "direction": {
  1939. "north": "北",
  1940. "northeast": "东北",
  1941. "east": "东",
  1942. "southeast": "东南",
  1943. "south": "南",
  1944. "southwest": "西南",
  1945. "west": "西",
  1946. "northwest": "西北"
  1947. },
  1948. "modifier": {
  1949. "left": "向左",
  1950. "right": "向右",
  1951. "sharp left": "向左",
  1952. "sharp right": "向右",
  1953. "slight left": "向左",
  1954. "slight right": "向右",
  1955. "straight": "直行",
  1956. "uturn": "调头"
  1957. },
  1958. "lanes": {
  1959. "xo": "靠右直行",
  1960. "ox": "靠左直行",
  1961. "xox": "保持在道路中间直行",
  1962. "oxo": "保持在道路两侧直行"
  1963. }
  1964. },
  1965. "modes": {
  1966. "ferry": {
  1967. "default": "乘坐轮渡",
  1968. "name": "乘坐{way_name}轮渡",
  1969. "destination": "乘坐开往{destination}的轮渡"
  1970. }
  1971. },
  1972. "arrive": {
  1973. "default": {
  1974. "default": "您已经到达您的{nth}个目的地"
  1975. },
  1976. "left": {
  1977. "default": "您已经到达您的{nth}个目的地,在道路左侧"
  1978. },
  1979. "right": {
  1980. "default": "您已经到达您的{nth}个目的地,在道路右侧"
  1981. },
  1982. "sharp left": {
  1983. "default": "您已经到达您的{nth}个目的地,在道路左侧"
  1984. },
  1985. "sharp right": {
  1986. "default": "您已经到达您的{nth}个目的地,在道路右侧"
  1987. },
  1988. "slight right": {
  1989. "default": "您已经到达您的{nth}个目的地,在道路右侧"
  1990. },
  1991. "slight left": {
  1992. "default": "您已经到达您的{nth}个目的地,在道路左侧"
  1993. },
  1994. "straight": {
  1995. "default": "您已经到达您的{nth}个目的地,在您正前方"
  1996. }
  1997. },
  1998. "continue": {
  1999. "default": {
  2000. "default": "继续{modifier}",
  2001. "name": "继续{modifier},上{way_name}",
  2002. "destination": "继续{modifier}行驶,前往{destination}"
  2003. },
  2004. "uturn": {
  2005. "default": "调头",
  2006. "name": "调头上{way_name}",
  2007. "destination": "调头后前往{destination}"
  2008. }
  2009. },
  2010. "depart": {
  2011. "default": {
  2012. "default": "出发向{direction}",
  2013. "name": "出发向{direction},上{way_name}"
  2014. }
  2015. },
  2016. "end of road": {
  2017. "default": {
  2018. "default": "{modifier}行驶",
  2019. "name": "{modifier}行驶,上{way_name}",
  2020. "destination": "{modifier}行驶,前往{destination}"
  2021. },
  2022. "straight": {
  2023. "default": "继续直行",
  2024. "name": "继续直行,上{way_name}",
  2025. "destination": "继续直行,前往{destination}"
  2026. },
  2027. "uturn": {
  2028. "default": "在道路尽头调头",
  2029. "name": "在道路尽头调头上{way_name}",
  2030. "destination": "在道路尽头调头,前往{destination}"
  2031. }
  2032. },
  2033. "fork": {
  2034. "default": {
  2035. "default": "在岔道保持{modifier}",
  2036. "name": "在岔道保持{modifier},上{way_name}",
  2037. "destination": "在岔道保持{modifier},前往{destination}"
  2038. },
  2039. "uturn": {
  2040. "default": "调头",
  2041. "name": "调头,上{way_name}",
  2042. "destination": "调头,前往{destination}"
  2043. }
  2044. },
  2045. "merge": {
  2046. "default": {
  2047. "default": "{modifier}并道",
  2048. "name": "{modifier}并道,上{way_name}",
  2049. "destination": "{modifier}并道,前往{destination}"
  2050. },
  2051. "uturn": {
  2052. "default": "调头",
  2053. "name": "调头,上{way_name}",
  2054. "destination": "调头,前往{destination}"
  2055. }
  2056. },
  2057. "new name": {
  2058. "default": {
  2059. "default": "继续{modifier}",
  2060. "name": "继续{modifier},上{way_name}",
  2061. "destination": "继续{modifier},前往{destination}"
  2062. },
  2063. "uturn": {
  2064. "default": "调头",
  2065. "name": "调头,上{way_name}",
  2066. "destination": "调头,前往{destination}"
  2067. }
  2068. },
  2069. "notification": {
  2070. "default": {
  2071. "default": "继续{modifier}",
  2072. "name": "继续{modifier},上{way_name}",
  2073. "destination": "继续{modifier},前往{destination}"
  2074. },
  2075. "uturn": {
  2076. "default": "调头",
  2077. "name": "调头,上{way_name}",
  2078. "destination": "调头,前往{destination}"
  2079. }
  2080. },
  2081. "off ramp": {
  2082. "default": {
  2083. "default": "上匝道",
  2084. "name": "通过匝道驶入{way_name}",
  2085. "destination": "通过匝道前往{destination}"
  2086. },
  2087. "left": {
  2088. "default": "通过左边的匝道",
  2089. "name": "通过左边的匝道驶入{way_name}",
  2090. "destination": "通过左边的匝道前往{destination}"
  2091. },
  2092. "right": {
  2093. "default": "通过右边的匝道",
  2094. "name": "通过右边的匝道驶入{way_name}",
  2095. "destination": "通过右边的匝道前往{destination}"
  2096. }
  2097. },
  2098. "on ramp": {
  2099. "default": {
  2100. "default": "通过匝道",
  2101. "name": "通过匝道驶入{way_name}",
  2102. "destination": "通过匝道前往{destination}"
  2103. },
  2104. "left": {
  2105. "default": "通过左边的匝道",
  2106. "name": "通过左边的匝道驶入{way_name}",
  2107. "destination": "通过左边的匝道前往{destination}"
  2108. },
  2109. "right": {
  2110. "default": "通过右边的匝道",
  2111. "name": "通过右边的匝道驶入{way_name}",
  2112. "destination": "通过右边的匝道前往{destination}"
  2113. }
  2114. },
  2115. "rotary": {
  2116. "default": {
  2117. "default": {
  2118. "default": "进入环岛",
  2119. "name": "通过环岛后驶入{way_name}",
  2120. "destination": "通过环岛前往{destination}"
  2121. },
  2122. "name": {
  2123. "default": "进入{rotary_name}环岛",
  2124. "name": "通过{rotary_name}环岛后驶入{way_name}",
  2125. "destination": "通过{rotary_name}环岛后前往{destination}"
  2126. },
  2127. "exit": {
  2128. "default": "进入环岛并从{exit_number}出口驶出",
  2129. "name": "进入环岛后从{exit_number}出口驶出进入{way_name}",
  2130. "destination": "进入环岛后从{exit_number}出口驶出前往{destination}"
  2131. },
  2132. "name_exit": {
  2133. "default": "进入{rotary_name}环岛后从{exit_number}出口驶出",
  2134. "name": "进入{rotary_name}环岛后从{exit_number}出口驶出进入{way_name}",
  2135. "destination": "进入{rotary_name}环岛后从{exit_number}出口驶出前往{destination}"
  2136. }
  2137. }
  2138. },
  2139. "roundabout": {
  2140. "default": {
  2141. "exit": {
  2142. "default": "进入环岛后从{exit_number}出口驶出",
  2143. "name": "进入环岛后从{exit_number}出口驶出前往{way_name}",
  2144. "destination": "进入环岛后从{exit_number}出口驶出前往{destination}"
  2145. },
  2146. "default": {
  2147. "default": "进入环岛",
  2148. "name": "通过环岛后驶入{way_name}",
  2149. "destination": "通过环岛后前往{destination}"
  2150. }
  2151. }
  2152. },
  2153. "roundabout turn": {
  2154. "default": {
  2155. "default": "在环岛{modifier}行驶",
  2156. "name": "在环岛{modifier}行驶,上{way_name}",
  2157. "destination": "在环岛{modifier}行驶,前往{destination}"
  2158. },
  2159. "left": {
  2160. "default": "在环岛左转",
  2161. "name": "在环岛左转,上{way_name}",
  2162. "destination": "在环岛左转,前往{destination}"
  2163. },
  2164. "right": {
  2165. "default": "在环岛右转",
  2166. "name": "在环岛右转,上{way_name}",
  2167. "destination": "在环岛右转,前往{destination}"
  2168. },
  2169. "straight": {
  2170. "default": "在环岛继续直行",
  2171. "name": "在环岛继续直行,上{way_name}",
  2172. "destination": "在环岛继续直行,前往{destination}"
  2173. }
  2174. },
  2175. "turn": {
  2176. "default": {
  2177. "default": "{modifier}转弯",
  2178. "name": "{modifier}转弯,上{way_name}",
  2179. "destination": "{modifier}转弯,前往{destination}"
  2180. },
  2181. "left": {
  2182. "default": "左转",
  2183. "name": "左转,上{way_name}",
  2184. "destination": "左转,前往{destination}"
  2185. },
  2186. "right": {
  2187. "default": "右转",
  2188. "name": "右转,上{way_name}",
  2189. "destination": "右转,前往{destination}"
  2190. },
  2191. "straight": {
  2192. "default": "直行",
  2193. "name": "直行,上{way_name}",
  2194. "destination": "直行,前往{destination}"
  2195. }
  2196. },
  2197. "use lane": {
  2198. "no_lanes": {
  2199. "default": "继续直行"
  2200. },
  2201. "default": {
  2202. "default": "{lane_instruction}然后{modifier}"
  2203. },
  2204. "straight": {
  2205. "default": "{lane_instruction}"
  2206. },
  2207. "left": {
  2208. "default": "{lane_instruction}然后左转"
  2209. },
  2210. "right": {
  2211. "default": "{lane_instruction}然后右转"
  2212. }
  2213. }
  2214. }
  2215. }
  2216. }, {}],
  2217. 9: [function (_dereq_, module, exports) {
  2218. 'use strict';
  2219. /**
  2220. * Based off of [the offical Google document](https://developers.google.com/maps/documentation/utilities/polylinealgorithm)
  2221. *
  2222. * Some parts from [this implementation](http://facstaff.unca.edu/mcmcclur/GoogleMaps/EncodePolyline/PolylineEncoder.js)
  2223. * by [Mark McClure](http://facstaff.unca.edu/mcmcclur/)
  2224. *
  2225. * @module polyline
  2226. */
  2227. var polyline = {};
  2228. function encode(coordinate, factor) {
  2229. coordinate = Math.round(coordinate * factor);
  2230. coordinate <<= 1;
  2231. if (coordinate < 0) {
  2232. coordinate = ~coordinate;
  2233. }
  2234. var output = '';
  2235. while (coordinate >= 0x20) {
  2236. output += String.fromCharCode((0x20 | (coordinate & 0x1f)) + 63);
  2237. coordinate >>= 5;
  2238. }
  2239. output += String.fromCharCode(coordinate + 63);
  2240. return output;
  2241. }
  2242. /**
  2243. * Decodes to a [latitude, longitude] coordinates array.
  2244. *
  2245. * This is adapted from the implementation in Project-OSRM.
  2246. *
  2247. * @param {String} str
  2248. * @param {Number} precision
  2249. * @returns {Array}
  2250. *
  2251. * @see https://github.com/Project-OSRM/osrm-frontend/blob/master/WebContent/routing/OSRM.RoutingGeometry.js
  2252. */
  2253. polyline.decode = function (str, precision) {
  2254. var index = 0,
  2255. lat = 0,
  2256. lng = 0,
  2257. coordinates = [],
  2258. shift = 0,
  2259. result = 0,
  2260. byte = null,
  2261. latitude_change,
  2262. longitude_change,
  2263. factor = Math.pow(10, precision || 5);
  2264. // Coordinates have variable length when encoded, so just keep
  2265. // track of whether we've hit the end of the string. In each
  2266. // loop iteration, a single coordinate is decoded.
  2267. while (index < str.length) {
  2268. // Reset shift, result, and byte
  2269. byte = null;
  2270. shift = 0;
  2271. result = 0;
  2272. do {
  2273. byte = str.charCodeAt(index++) - 63;
  2274. result |= (byte & 0x1f) << shift;
  2275. shift += 5;
  2276. } while (byte >= 0x20);
  2277. latitude_change = ((result & 1) ? ~(result >> 1) : (result >> 1));
  2278. shift = result = 0;
  2279. do {
  2280. byte = str.charCodeAt(index++) - 63;
  2281. result |= (byte & 0x1f) << shift;
  2282. shift += 5;
  2283. } while (byte >= 0x20);
  2284. longitude_change = ((result & 1) ? ~(result >> 1) : (result >> 1));
  2285. lat += latitude_change;
  2286. lng += longitude_change;
  2287. coordinates.push([lat / factor, lng / factor]);
  2288. }
  2289. return coordinates;
  2290. };
  2291. /**
  2292. * Encodes the given [latitude, longitude] coordinates array.
  2293. *
  2294. * @param {Array.<Array.<Number>>} coordinates
  2295. * @param {Number} precision
  2296. * @returns {String}
  2297. */
  2298. polyline.encode = function (coordinates, precision) {
  2299. if (!coordinates.length) {
  2300. return '';
  2301. }
  2302. var factor = Math.pow(10, precision || 5),
  2303. output = encode(coordinates[0][0], factor) + encode(coordinates[0][1], factor);
  2304. for (var i = 1; i < coordinates.length; i++) {
  2305. var a = coordinates[i],
  2306. b = coordinates[i - 1];
  2307. output += encode(a[0] - b[0], factor);
  2308. output += encode(a[1] - b[1], factor);
  2309. }
  2310. return output;
  2311. };
  2312. function flipped(coords) {
  2313. var flipped = [];
  2314. for (var i = 0; i < coords.length; i++) {
  2315. flipped.push(coords[i].slice().reverse());
  2316. }
  2317. return flipped;
  2318. }
  2319. /**
  2320. * Encodes a GeoJSON LineString feature/geometry.
  2321. *
  2322. * @param {Object} geojson
  2323. * @param {Number} precision
  2324. * @returns {String}
  2325. */
  2326. polyline.fromGeoJSON = function (geojson, precision) {
  2327. if (geojson && geojson.type === 'Feature') {
  2328. geojson = geojson.geometry;
  2329. }
  2330. if (!geojson || geojson.type !== 'LineString') {
  2331. throw new Error('Input must be a GeoJSON LineString');
  2332. }
  2333. return polyline.encode(flipped(geojson.coordinates), precision);
  2334. };
  2335. /**
  2336. * Decodes to a GeoJSON LineString geometry.
  2337. *
  2338. * @param {String} str
  2339. * @param {Number} precision
  2340. * @returns {Object}
  2341. */
  2342. polyline.toGeoJSON = function (str, precision) {
  2343. var coords = polyline.decode(str, precision);
  2344. return {
  2345. type: 'LineString',
  2346. coordinates: flipped(coords)
  2347. };
  2348. };
  2349. if (typeof module === 'object' && module.exports) {
  2350. module.exports = polyline;
  2351. }
  2352. }, {}],
  2353. 10: [function (_dereq_, module, exports) {
  2354. (function (global) {
  2355. (function () {
  2356. 'use strict';
  2357. var L = (typeof window !== "undefined" ? window.L : typeof global !== "undefined" ? global.L : null);
  2358. module.exports = L.Class.extend({
  2359. options: {
  2360. timeout: 500,
  2361. blurTimeout: 100,
  2362. noResultsMessage: 'No results found.'
  2363. },
  2364. initialize: function (elem, callback, context, options) {
  2365. L.setOptions(this, options);
  2366. this._elem = elem;
  2367. this._resultFn = options.resultFn ? L.Util.bind(options.resultFn, options.resultContext) : null;
  2368. this._autocomplete = options.autocompleteFn ? L.Util.bind(options.autocompleteFn, options.autocompleteContext) : null;
  2369. this._selectFn = L.Util.bind(callback, context);
  2370. this._container = L.DomUtil.create('div', 'leaflet-routing-geocoder-result');
  2371. this._resultTable = L.DomUtil.create('table', '', this._container);
  2372. // TODO: looks a bit like a kludge to register same for input and keypress -
  2373. // browsers supporting both will get duplicate events; just registering
  2374. // input will not catch enter, though.
  2375. L.DomEvent.addListener(this._elem, 'input', this._keyPressed, this);
  2376. L.DomEvent.addListener(this._elem, 'keypress', this._keyPressed, this);
  2377. L.DomEvent.addListener(this._elem, 'keydown', this._keyDown, this);
  2378. L.DomEvent.addListener(this._elem, 'blur', function () {
  2379. if (this._isOpen) {
  2380. this.close();
  2381. }
  2382. }, this);
  2383. },
  2384. close: function () {
  2385. L.DomUtil.removeClass(this._container, 'leaflet-routing-geocoder-result-open');
  2386. this._isOpen = false;
  2387. },
  2388. _open: function () {
  2389. var rect = this._elem.getBoundingClientRect();
  2390. if (!this._container.parentElement) {
  2391. // See notes section under https://developer.mozilla.org/en-US/docs/Web/API/Window/scrollX
  2392. // This abomination is required to support all flavors of IE
  2393. var scrollX = (window.pageXOffset !== undefined) ? window.pageXOffset :
  2394. (document.documentElement || document.body.parentNode || document.body).scrollLeft;
  2395. var scrollY = (window.pageYOffset !== undefined) ? window.pageYOffset :
  2396. (document.documentElement || document.body.parentNode || document.body).scrollTop;
  2397. this._container.style.left = (rect.left + scrollX) + 'px';
  2398. this._container.style.top = (rect.bottom + scrollY) + 'px';
  2399. this._container.style.width = (rect.right - rect.left) + 'px';
  2400. //document.body.appendChild(this._container);
  2401. }
  2402. L.DomUtil.addClass(this._container, 'leaflet-routing-geocoder-result-open');
  2403. this._isOpen = true;
  2404. },
  2405. _setResults: function (results) {
  2406. var i,
  2407. tr,
  2408. td,
  2409. text;
  2410. delete this._selection;
  2411. this._results = results;
  2412. while (this._resultTable.firstChild) {
  2413. this._resultTable.removeChild(this._resultTable.firstChild);
  2414. }
  2415. for (i = 0; i < results.length; i++) {
  2416. tr = L.DomUtil.create('tr', '', this._resultTable);
  2417. tr.setAttribute('data-result-index', i);
  2418. td = L.DomUtil.create('td', '', tr);
  2419. text = document.createTextNode(results[i].name);
  2420. //td.appendChild(text);
  2421. // mousedown + click because:
  2422. // http://stackoverflow.com/questions/10652852/jquery-fire-click-before-blur-event
  2423. L.DomEvent.addListener(td, 'mousedown', L.DomEvent.preventDefault);
  2424. L.DomEvent.addListener(td, 'click', this._createClickListener(results[i]));
  2425. }
  2426. if (!i) {
  2427. tr = L.DomUtil.create('tr', '', this._resultTable);
  2428. td = L.DomUtil.create('td', 'leaflet-routing-geocoder-no-results', tr);
  2429. td.innerHTML = this.options.noResultsMessage;
  2430. }
  2431. this._open();
  2432. if (results.length > 0) {
  2433. // Select the first entry
  2434. this._select(1);
  2435. }
  2436. },
  2437. _createClickListener: function (r) {
  2438. var resultSelected = this._resultSelected(r);
  2439. return L.bind(function () {
  2440. this._elem.blur();
  2441. resultSelected();
  2442. }, this);
  2443. },
  2444. _resultSelected: function (r) {
  2445. return L.bind(function () {
  2446. this.close();
  2447. this._elem.value = r.name;
  2448. this._lastCompletedText = r.name;
  2449. this._selectFn(r);
  2450. }, this);
  2451. },
  2452. _keyPressed: function (e) {
  2453. var index;
  2454. if (this._isOpen && e.keyCode === 13 && this._selection) {
  2455. index = parseInt(this._selection.getAttribute('data-result-index'), 10);
  2456. this._resultSelected(this._results[index])();
  2457. L.DomEvent.preventDefault(e);
  2458. return;
  2459. }
  2460. if (e.keyCode === 13) {
  2461. this._complete(this._resultFn, true);
  2462. return;
  2463. }
  2464. if (this._autocomplete && document.activeElement === this._elem) {
  2465. if (this._timer) {
  2466. clearTimeout(this._timer);
  2467. }
  2468. this._timer = setTimeout(L.Util.bind(function () {
  2469. this._complete(this._autocomplete);
  2470. }, this),
  2471. this.options.timeout);
  2472. return;
  2473. }
  2474. this._unselect();
  2475. },
  2476. _select: function (dir) {
  2477. var sel = this._selection;
  2478. if (sel) {
  2479. L.DomUtil.removeClass(sel.firstChild, 'leaflet-routing-geocoder-selected');
  2480. sel = sel[dir > 0 ? 'nextSibling' : 'previousSibling'];
  2481. }
  2482. if (!sel) {
  2483. sel = this._resultTable[dir > 0 ? 'firstChild' : 'lastChild'];
  2484. }
  2485. if (sel) {
  2486. L.DomUtil.addClass(sel.firstChild, 'leaflet-routing-geocoder-selected');
  2487. this._selection = sel;
  2488. }
  2489. },
  2490. _unselect: function () {
  2491. if (this._selection) {
  2492. L.DomUtil.removeClass(this._selection.firstChild, 'leaflet-routing-geocoder-selected');
  2493. }
  2494. delete this._selection;
  2495. },
  2496. _keyDown: function (e) {
  2497. if (this._isOpen) {
  2498. switch (e.keyCode) {
  2499. // Escape
  2500. case 27:
  2501. this.close();
  2502. L.DomEvent.preventDefault(e);
  2503. return;
  2504. // Up
  2505. case 38:
  2506. this._select(-1);
  2507. L.DomEvent.preventDefault(e);
  2508. return;
  2509. // Down
  2510. case 40:
  2511. this._select(1);
  2512. L.DomEvent.preventDefault(e);
  2513. return;
  2514. }
  2515. }
  2516. },
  2517. _complete: function (completeFn, trySelect) {
  2518. var v = this._elem.value;
  2519. function completeResults(results) {
  2520. this._lastCompletedText = v;
  2521. if (trySelect && results.length === 1) {
  2522. this._resultSelected(results[0])();
  2523. } else {
  2524. this._setResults(results);
  2525. }
  2526. }
  2527. if (!v) {
  2528. return;
  2529. }
  2530. if (v !== this._lastCompletedText) {
  2531. completeFn(v, completeResults, this);
  2532. } else if (trySelect) {
  2533. completeResults.call(this, this._results);
  2534. }
  2535. }
  2536. });
  2537. })();
  2538. }).call(this, typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
  2539. }, {}],
  2540. 11: [function (_dereq_, module, exports) {
  2541. (function (global) {
  2542. (function () {
  2543. 'use strict';
  2544. var L = (typeof window !== "undefined" ? window.L : typeof global !== "undefined" ? global.L : null);
  2545. var Itinerary = _dereq_('./itinerary');
  2546. var Line = _dereq_('./line');
  2547. var Plan = _dereq_('./plan');
  2548. var OSRMv1 = _dereq_('./osrm-v1');
  2549. module.exports = Itinerary.extend({
  2550. options: {
  2551. fitSelectedRoutes: 'smart',
  2552. routeLine: function (route, options) {
  2553. return new Line(route, options);
  2554. },
  2555. autoRoute: true,
  2556. routeWhileDragging: false,
  2557. routeDragInterval: 500,
  2558. waypointMode: 'connect',
  2559. showAlternatives: false,
  2560. defaultErrorHandler: function (e) {
  2561. //console.error('Routing error:', e.error);
  2562. }
  2563. },
  2564. initialize: function (options) {
  2565. L.Util.setOptions(this, options);
  2566. this._router = this.options.router || new OSRMv1(options);
  2567. this._plan = this.options.plan || new Plan(this.options.waypoints, options);
  2568. this._requestCount = 0;
  2569. Itinerary.prototype.initialize.call(this, options);
  2570. this.on('routeselected', this._routeSelected, this);
  2571. if (this.options.defaultErrorHandler) {
  2572. this.on('routingerror', this.options.defaultErrorHandler);
  2573. }
  2574. this._plan.on('waypointschanged', this._onWaypointsChanged, this);
  2575. if (options.routeWhileDragging) {
  2576. this._setupRouteDragging();
  2577. }
  2578. if (this.options.autoRoute) {
  2579. this.route();
  2580. }
  2581. },
  2582. _onZoomEnd: function () {
  2583. if (!this._selectedRoute ||
  2584. !this._router.requiresMoreDetail) {
  2585. return;
  2586. }
  2587. var map = this._map;
  2588. if (this._router.requiresMoreDetail(this._selectedRoute,
  2589. map.getZoom(), map.getBounds())) {
  2590. this.route({
  2591. callback: L.bind(function (err, routes) {
  2592. var i;
  2593. if (!err) {
  2594. for (i = 0; i < routes.length; i++) {
  2595. this._routes[i].properties = routes[i].properties;
  2596. }
  2597. this._updateLineCallback(err, routes);
  2598. }
  2599. }, this),
  2600. simplifyGeometry: false,
  2601. geometryOnly: true
  2602. });
  2603. }
  2604. },
  2605. onAdd: function (map) {
  2606. var container = Itinerary.prototype.onAdd.call(this, map);
  2607. this._map = map;
  2608. this._map.addLayer(this._plan);
  2609. this._map.on('zoomend', this._onZoomEnd, this);
  2610. if (this._plan.options.geocoder) {
  2611. container.insertBefore(this._plan.createGeocoders(), container.firstChild);
  2612. }
  2613. return container;
  2614. },
  2615. onRemove: function (map) {
  2616. map.off('zoomend', this._onZoomEnd, this);
  2617. if (this._line) {
  2618. map.removeLayer(this._line);
  2619. }
  2620. map.removeLayer(this._plan);
  2621. if (this._alternatives && this._alternatives.length > 0) {
  2622. for (var i = 0, len = this._alternatives.length; i < len; i++) {
  2623. map.removeLayer(this._alternatives[i]);
  2624. }
  2625. }
  2626. return Itinerary.prototype.onRemove.call(this, map);
  2627. },
  2628. getWaypoints: function () {
  2629. return this._plan.getWaypoints();
  2630. },
  2631. setWaypoints: function (waypoints) {
  2632. this._plan.setWaypoints(waypoints);
  2633. return this;
  2634. },
  2635. spliceWaypoints: function () {
  2636. var removed = this._plan.spliceWaypoints.apply(this._plan, arguments);
  2637. return removed;
  2638. },
  2639. getPlan: function () {
  2640. return this._plan;
  2641. },
  2642. getRouter: function () {
  2643. return this._router;
  2644. },
  2645. _routeSelected: function (e) {
  2646. var route = this._selectedRoute = e.route,
  2647. alternatives = this.options.showAlternatives && e.alternatives,
  2648. fitMode = this.options.fitSelectedRoutes,
  2649. fitBounds =
  2650. (fitMode === 'smart' && !this._waypointsVisible()) ||
  2651. (fitMode !== 'smart' && fitMode);
  2652. this._updateLines({
  2653. route: route,
  2654. alternatives: alternatives
  2655. });
  2656. if (fitBounds) {
  2657. this._map.fitBounds(this._line.getBounds());
  2658. }
  2659. if (this.options.waypointMode === 'snap') {
  2660. this._plan.off('waypointschanged', this._onWaypointsChanged, this);
  2661. this.setWaypoints(route.waypoints);
  2662. this._plan.on('waypointschanged', this._onWaypointsChanged, this);
  2663. }
  2664. },
  2665. _waypointsVisible: function () {
  2666. var wps = this.getWaypoints(),
  2667. mapSize,
  2668. bounds,
  2669. boundsSize,
  2670. i,
  2671. p;
  2672. try {
  2673. mapSize = this._map.getSize();
  2674. for (i = 0; i < wps.length; i++) {
  2675. p = this._map.latLngToLayerPoint(wps[i].latLng);
  2676. if (bounds) {
  2677. bounds.extend(p);
  2678. } else {
  2679. bounds = L.bounds([p]);
  2680. }
  2681. }
  2682. boundsSize = bounds.getSize();
  2683. return (boundsSize.x > mapSize.x / 5 ||
  2684. boundsSize.y > mapSize.y / 5) && this._waypointsInViewport();
  2685. } catch (e) {
  2686. return false;
  2687. }
  2688. },
  2689. _waypointsInViewport: function () {
  2690. var wps = this.getWaypoints(),
  2691. mapBounds,
  2692. i;
  2693. try {
  2694. mapBounds = this._map.getBounds();
  2695. } catch (e) {
  2696. return false;
  2697. }
  2698. for (i = 0; i < wps.length; i++) {
  2699. if (mapBounds.contains(wps[i].latLng)) {
  2700. return true;
  2701. }
  2702. }
  2703. return false;
  2704. },
  2705. _updateLines: function (routes) {
  2706. var addWaypoints = this.options.addWaypoints !== undefined ?
  2707. this.options.addWaypoints : true;
  2708. this._clearLines();
  2709. // add alternatives first so they lie below the main route
  2710. this._alternatives = [];
  2711. if (routes.alternatives) routes.alternatives.forEach(function (alt, i) {
  2712. this._alternatives[i] = this.options.routeLine(alt,
  2713. L.extend({
  2714. isAlternative: true
  2715. }, this.options.altLineOptions || this.options.lineOptions));
  2716. this._alternatives[i].addTo(this._map);
  2717. this._hookAltEvents(this._alternatives[i]);
  2718. }, this);
  2719. this._line = this.options.routeLine(routes.route,
  2720. L.extend({
  2721. addWaypoints: addWaypoints,
  2722. extendToWaypoints: this.options.waypointMode === 'connect'
  2723. }, this.options.lineOptions));
  2724. this._line.addTo(this._map);
  2725. this._hookEvents(this._line);
  2726. },
  2727. _hookEvents: function (l) {
  2728. l.on('linetouched', function (e) {
  2729. this._plan.dragNewWaypoint(e);
  2730. }, this);
  2731. },
  2732. _hookAltEvents: function (l) {
  2733. l.on('linetouched', function (e) {
  2734. var alts = this._routes.slice();
  2735. var selected = alts.splice(e.target._route.routesIndex, 1)[0];
  2736. this.fire('routeselected', {
  2737. route: selected,
  2738. alternatives: alts
  2739. });
  2740. }, this);
  2741. },
  2742. _onWaypointsChanged: function (e) {
  2743. if (this.options.autoRoute) {
  2744. this.route({});
  2745. }
  2746. if (!this._plan.isReady()) {
  2747. this._clearLines();
  2748. this._clearAlts();
  2749. }
  2750. this.fire('waypointschanged', {
  2751. waypoints: e.waypoints
  2752. });
  2753. },
  2754. _setupRouteDragging: function () {
  2755. var timer = 0,
  2756. waypoints;
  2757. this._plan.on('waypointdrag', L.bind(function (e) {
  2758. waypoints = e.waypoints;
  2759. if (!timer) {
  2760. timer = setTimeout(L.bind(function () {
  2761. this.route({
  2762. waypoints: waypoints,
  2763. geometryOnly: true,
  2764. callback: L.bind(this._updateLineCallback, this)
  2765. });
  2766. timer = undefined;
  2767. }, this), this.options.routeDragInterval);
  2768. }
  2769. }, this));
  2770. this._plan.on('waypointdragend', function () {
  2771. if (timer) {
  2772. clearTimeout(timer);
  2773. timer = undefined;
  2774. }
  2775. this.route();
  2776. }, this);
  2777. },
  2778. _updateLineCallback: function (err, routes) {
  2779. if (!err) {
  2780. routes = routes.slice();
  2781. var selected = routes.splice(this._selectedRoute.routesIndex, 1)[0];
  2782. this._updateLines({
  2783. route: selected,
  2784. alternatives: routes
  2785. });
  2786. } else if (err.type !== 'abort') {
  2787. this._clearLines();
  2788. }
  2789. },
  2790. route: function (options) {
  2791. var ts = ++this._requestCount,
  2792. wps;
  2793. if (this._pendingRequest && this._pendingRequest.abort) {
  2794. this._pendingRequest.abort();
  2795. this._pendingRequest = null;
  2796. }
  2797. options = options || {};
  2798. if (this._plan.isReady()) {
  2799. if (this.options.useZoomParameter) {
  2800. options.z = this._map && this._map.getZoom();
  2801. }
  2802. wps = options && options.waypoints || this._plan.getWaypoints();
  2803. this.fire('routingstart', {
  2804. waypoints: wps
  2805. });
  2806. this._pendingRequest = this._router.route(wps, function (err, routes) {
  2807. this._pendingRequest = null;
  2808. if (options.callback) {
  2809. return options.callback.call(this, err, routes);
  2810. }
  2811. // Prevent race among multiple requests,
  2812. // by checking the current request's count
  2813. // against the last request's; ignore result if
  2814. // this isn't the last request.
  2815. if (ts === this._requestCount) {
  2816. this._clearLines();
  2817. this._clearAlts();
  2818. if (err && err.type !== 'abort') {
  2819. this.fire('routingerror', {
  2820. error: err
  2821. });
  2822. return;
  2823. }
  2824. routes.forEach(function (route, i) {
  2825. route.routesIndex = i;
  2826. });
  2827. if (!options.geometryOnly) {
  2828. this.fire('routesfound', {
  2829. waypoints: wps,
  2830. routes: routes
  2831. });
  2832. this.setAlternatives(routes);
  2833. } else {
  2834. var selectedRoute = routes.splice(0, 1)[0];
  2835. this._routeSelected({
  2836. route: selectedRoute,
  2837. alternatives: routes
  2838. });
  2839. }
  2840. }
  2841. }, this, options);
  2842. }
  2843. },
  2844. _clearLines: function () {
  2845. // if (this._line) {
  2846. // this._map.removeLayer(this._line);
  2847. // delete this._line;
  2848. // }
  2849. // if (this._alternatives && this._alternatives.length) {
  2850. // for (var i in this._alternatives) {
  2851. // this._map.removeLayer(this._alternatives[i]);
  2852. // }
  2853. // this._alternatives = [];
  2854. // }
  2855. }
  2856. });
  2857. })();
  2858. }).call(this, typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
  2859. }, {
  2860. "./itinerary": 17,
  2861. "./line": 18,
  2862. "./osrm-v1": 21,
  2863. "./plan": 22
  2864. }],
  2865. 12: [function (_dereq_, module, exports) {
  2866. (function (global) {
  2867. (function () {
  2868. 'use strict';
  2869. var L = (typeof window !== "undefined" ? window.L : typeof global !== "undefined" ? global.L : null);
  2870. module.exports = L.Control.extend({
  2871. options: {
  2872. header: 'Routing error',
  2873. formatMessage: function (error) {
  2874. if (error.status < 0) {
  2875. return 'Calculating the route caused an error. Technical description follows: <code><pre>' +
  2876. error.message + '</pre></code';
  2877. } else {
  2878. return 'The route could not be calculated. ' +
  2879. error.message;
  2880. }
  2881. }
  2882. },
  2883. initialize: function (routingControl, options) {
  2884. L.Control.prototype.initialize.call(this, options);
  2885. routingControl
  2886. .on('routingerror', L.bind(function (e) {
  2887. if (this._element) {
  2888. this._element.children[1].innerHTML = this.options.formatMessage(e.error);
  2889. this._element.style.visibility = 'visible';
  2890. }
  2891. }, this))
  2892. .on('routingstart', L.bind(function () {
  2893. if (this._element) {
  2894. this._element.style.visibility = 'hidden';
  2895. }
  2896. }, this));
  2897. },
  2898. onAdd: function () {
  2899. var header,
  2900. message;
  2901. this._element = L.DomUtil.create('div', 'leaflet-bar leaflet-routing-error');
  2902. this._element.style.visibility = 'hidden';
  2903. header = L.DomUtil.create('h3', null, this._element);
  2904. message = L.DomUtil.create('span', null, this._element);
  2905. header.innerHTML = this.options.header;
  2906. return this._element;
  2907. },
  2908. onRemove: function () {
  2909. delete this._element;
  2910. }
  2911. });
  2912. })();
  2913. }).call(this, typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
  2914. }, {}],
  2915. 13: [function (_dereq_, module, exports) {
  2916. (function (global) {
  2917. (function () {
  2918. 'use strict';
  2919. var L = (typeof window !== "undefined" ? window.L : typeof global !== "undefined" ? global.L : null);
  2920. var Localization = _dereq_('./localization');
  2921. module.exports = L.Class.extend({
  2922. options: {
  2923. units: 'metric',
  2924. unitNames: null,
  2925. language: 'en',
  2926. roundingSensitivity: 1,
  2927. distanceTemplate: '{value} {unit}'
  2928. },
  2929. initialize: function (options) {
  2930. L.setOptions(this, options);
  2931. var langs = L.Util.isArray(this.options.language) ?
  2932. this.options.language : [this.options.language, 'en'];
  2933. this._localization = new Localization(langs);
  2934. },
  2935. formatDistance: function (d /* Number (meters) */ , sensitivity) {
  2936. var un = this.options.unitNames || this._localization.localize('units'),
  2937. simpleRounding = sensitivity <= 0,
  2938. round = simpleRounding ? function (v) {
  2939. return v;
  2940. } : L.bind(this._round, this),
  2941. v,
  2942. yards,
  2943. data,
  2944. pow10;
  2945. if (this.options.units === 'imperial') {
  2946. yards = d / 0.9144;
  2947. if (yards >= 1000) {
  2948. data = {
  2949. value: round(d / 1609.344, sensitivity),
  2950. unit: un.miles
  2951. };
  2952. } else {
  2953. data = {
  2954. value: round(yards, sensitivity),
  2955. unit: un.yards
  2956. };
  2957. }
  2958. } else {
  2959. v = round(d, sensitivity);
  2960. data = {
  2961. value: v >= 1000 ? (v / 1000) : v,
  2962. unit: v >= 1000 ? un.kilometers : un.meters
  2963. };
  2964. }
  2965. if (simpleRounding) {
  2966. data.value = data.value.toFixed(-sensitivity);
  2967. }
  2968. return L.Util.template(this.options.distanceTemplate, data);
  2969. },
  2970. _round: function (d, sensitivity) {
  2971. var s = sensitivity || this.options.roundingSensitivity,
  2972. pow10 = Math.pow(10, (Math.floor(d / s) + '').length - 1),
  2973. r = Math.floor(d / pow10),
  2974. p = (r > 5) ? pow10 : pow10 / 2;
  2975. return Math.round(d / p) * p;
  2976. },
  2977. formatTime: function (t /* Number (seconds) */ ) {
  2978. var un = this.options.unitNames || this._localization.localize('units');
  2979. // More than 30 seconds precision looks ridiculous
  2980. t = Math.round(t / 30) * 30;
  2981. if (t > 86400) {
  2982. return Math.round(t / 3600) + ' ' + un.hours;
  2983. } else if (t > 3600) {
  2984. return Math.floor(t / 3600) + ' ' + un.hours + ' ' +
  2985. Math.round((t % 3600) / 60) + ' ' + un.minutes;
  2986. } else if (t > 300) {
  2987. return Math.round(t / 60) + ' ' + un.minutes;
  2988. } else if (t > 60) {
  2989. return Math.floor(t / 60) + ' ' + un.minutes +
  2990. (t % 60 !== 0 ? ' ' + (t % 60) + ' ' + un.seconds : '');
  2991. } else {
  2992. return t + ' ' + un.seconds;
  2993. }
  2994. },
  2995. formatInstruction: function (instr, i) {
  2996. if (instr.text === undefined) {
  2997. return this.capitalize(L.Util.template(this._getInstructionTemplate(instr, i),
  2998. L.extend({}, instr, {
  2999. exitStr: instr.exit ? this._localization.localize('formatOrder')(instr.exit) : '',
  3000. dir: this._localization.localize(['directions', instr.direction]),
  3001. modifier: this._localization.localize(['directions', instr.modifier])
  3002. })));
  3003. } else {
  3004. return instr.text;
  3005. }
  3006. },
  3007. getIconName: function (instr, i) {
  3008. switch (instr.type) {
  3009. case 'Head':
  3010. if (i === 0) {
  3011. return 'depart';
  3012. }
  3013. break;
  3014. case 'WaypointReached':
  3015. return 'via';
  3016. case 'Roundabout':
  3017. return 'enter-roundabout';
  3018. case 'DestinationReached':
  3019. return 'arrive';
  3020. }
  3021. switch (instr.modifier) {
  3022. case 'Straight':
  3023. return 'continue';
  3024. case 'SlightRight':
  3025. return 'bear-right';
  3026. case 'Right':
  3027. return 'turn-right';
  3028. case 'SharpRight':
  3029. return 'sharp-right';
  3030. case 'TurnAround':
  3031. case 'Uturn':
  3032. return 'u-turn';
  3033. case 'SharpLeft':
  3034. return 'sharp-left';
  3035. case 'Left':
  3036. return 'turn-left';
  3037. case 'SlightLeft':
  3038. return 'bear-left';
  3039. }
  3040. },
  3041. capitalize: function (s) {
  3042. return s.charAt(0).toUpperCase() + s.substring(1);
  3043. },
  3044. _getInstructionTemplate: function (instr, i) {
  3045. var type = instr.type === 'Straight' ? (i === 0 ? 'Head' : 'Continue') : instr.type,
  3046. strings = this._localization.localize(['instructions', type]);
  3047. if (!strings) {
  3048. strings = [
  3049. this._localization.localize(['directions', type]),
  3050. ' ' + this._localization.localize(['instructions', 'Onto'])
  3051. ];
  3052. }
  3053. return strings[0] + (strings.length > 1 && instr.road ? strings[1] : '');
  3054. }
  3055. });
  3056. })();
  3057. }).call(this, typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
  3058. }, {
  3059. "./localization": 19
  3060. }],
  3061. 14: [function (_dereq_, module, exports) {
  3062. (function (global) {
  3063. (function () {
  3064. 'use strict';
  3065. var L = (typeof window !== "undefined" ? window.L : typeof global !== "undefined" ? global.L : null);
  3066. var Autocomplete = _dereq_('./autocomplete');
  3067. var Localization = _dereq_('./localization');
  3068. function selectInputText(input) {
  3069. if (input.setSelectionRange) {
  3070. // On iOS, select() doesn't work
  3071. input.setSelectionRange(0, 9999);
  3072. } else {
  3073. // On at least IE8, setSeleectionRange doesn't exist
  3074. input.select();
  3075. }
  3076. }
  3077. module.exports = L.Class.extend({
  3078. includes: L.Mixin.Events,
  3079. options: {
  3080. createGeocoder: function (i, nWps, options) {
  3081. var container = L.DomUtil.create('div', 'leaflet-routing-geocoder'),
  3082. input = L.DomUtil.create('input', '', container),
  3083. remove = options.addWaypoints ? L.DomUtil.create('span', 'leaflet-routing-remove-waypoint', container) : undefined;
  3084. input.disabled = !options.addWaypoints;
  3085. return {
  3086. container: container,
  3087. input: input,
  3088. closeButton: remove
  3089. };
  3090. },
  3091. geocoderPlaceholder: function (i, numberWaypoints, geocoderElement) {
  3092. var l = new Localization(geocoderElement.options.language).localize('ui');
  3093. return i === 0 ?
  3094. l.startPlaceholder :
  3095. (i < numberWaypoints - 1 ?
  3096. L.Util.template(l.viaPlaceholder, {
  3097. viaNumber: i
  3098. }) :
  3099. l.endPlaceholder);
  3100. },
  3101. geocoderClass: function () {
  3102. return '';
  3103. },
  3104. waypointNameFallback: function (latLng) {
  3105. var ns = latLng.lat < 0 ? 'S' : 'N',
  3106. ew = latLng.lng < 0 ? 'W' : 'E',
  3107. lat = (Math.round(Math.abs(latLng.lat) * 10000) / 10000).toString(),
  3108. lng = (Math.round(Math.abs(latLng.lng) * 10000) / 10000).toString();
  3109. return ns + lat + ', ' + ew + lng;
  3110. },
  3111. maxGeocoderTolerance: 200,
  3112. autocompleteOptions: {},
  3113. language: 'en',
  3114. },
  3115. initialize: function (wp, i, nWps, options) {
  3116. L.setOptions(this, options);
  3117. var g = this.options.createGeocoder(i, nWps, this.options),
  3118. closeButton = g.closeButton,
  3119. geocoderInput = g.input;
  3120. geocoderInput.setAttribute('placeholder', this.options.geocoderPlaceholder(i, nWps, this));
  3121. geocoderInput.className = this.options.geocoderClass(i, nWps);
  3122. this._element = g;
  3123. this._waypoint = wp;
  3124. this.update();
  3125. // This has to be here, or geocoder's value will not be properly
  3126. // initialized.
  3127. // TODO: look into why and make _updateWaypointName fix this.
  3128. geocoderInput.value = wp.name;
  3129. L.DomEvent.addListener(geocoderInput, 'click', function () {
  3130. selectInputText(this);
  3131. }, geocoderInput);
  3132. if (closeButton) {
  3133. L.DomEvent.addListener(closeButton, 'click', function () {
  3134. this.fire('delete', {
  3135. waypoint: this._waypoint
  3136. });
  3137. }, this);
  3138. }
  3139. new Autocomplete(geocoderInput, function (r) {
  3140. geocoderInput.value = r.name;
  3141. wp.name = r.name;
  3142. wp.latLng = r.center;
  3143. this.fire('geocoded', {
  3144. waypoint: wp,
  3145. value: r
  3146. });
  3147. }, this, L.extend({
  3148. resultFn: this.options.geocoder.geocode,
  3149. resultContext: this.options.geocoder,
  3150. autocompleteFn: this.options.geocoder.suggest,
  3151. autocompleteContext: this.options.geocoder
  3152. }, this.options.autocompleteOptions));
  3153. },
  3154. getContainer: function () {
  3155. return this._element.container;
  3156. },
  3157. setValue: function (v) {
  3158. this._element.input.value = v;
  3159. },
  3160. update: function (force) {
  3161. var wp = this._waypoint,
  3162. wpCoords;
  3163. wp.name = wp.name || '';
  3164. if (wp.latLng && (force || !wp.name)) {
  3165. wpCoords = this.options.waypointNameFallback(wp.latLng);
  3166. if (this.options.geocoder && this.options.geocoder.reverse) {
  3167. this.options.geocoder.reverse(wp.latLng, 67108864 /* zoom 18 */ , function (rs) {
  3168. if (rs.length > 0 && rs[0].center.distanceTo(wp.latLng) < this.options.maxGeocoderTolerance) {
  3169. wp.name = rs[0].name;
  3170. } else {
  3171. wp.name = wpCoords;
  3172. }
  3173. this._update();
  3174. }, this);
  3175. } else {
  3176. wp.name = wpCoords;
  3177. this._update();
  3178. }
  3179. }
  3180. },
  3181. focus: function () {
  3182. var input = this._element.input;
  3183. input.focus();
  3184. selectInputText(input);
  3185. },
  3186. _update: function () {
  3187. var wp = this._waypoint,
  3188. value = wp && wp.name ? wp.name : '';
  3189. this.setValue(value);
  3190. this.fire('reversegeocoded', {
  3191. waypoint: wp,
  3192. value: value
  3193. });
  3194. }
  3195. });
  3196. })();
  3197. }).call(this, typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
  3198. }, {
  3199. "./autocomplete": 10,
  3200. "./localization": 19
  3201. }],
  3202. 15: [function (_dereq_, module, exports) {
  3203. (function (global) {
  3204. var L = (typeof window !== "undefined" ? window.L : typeof global !== "undefined" ? global.L : null),
  3205. Control = _dereq_('./control'),
  3206. Itinerary = _dereq_('./itinerary'),
  3207. Line = _dereq_('./line'),
  3208. OSRMv1 = _dereq_('./osrm-v1'),
  3209. Plan = _dereq_('./plan'),
  3210. Waypoint = _dereq_('./waypoint'),
  3211. Autocomplete = _dereq_('./autocomplete'),
  3212. Formatter = _dereq_('./formatter'),
  3213. GeocoderElement = _dereq_('./geocoder-element'),
  3214. Localization = _dereq_('./localization'),
  3215. ItineraryBuilder = _dereq_('./itinerary-builder'),
  3216. Mapbox = _dereq_('./mapbox'),
  3217. ErrorControl = _dereq_('./error-control');
  3218. L.routing = {
  3219. control: function (options) {
  3220. return new Control(options);
  3221. },
  3222. itinerary: function (options) {
  3223. return Itinerary(options);
  3224. },
  3225. line: function (route, options) {
  3226. return new Line(route, options);
  3227. },
  3228. plan: function (waypoints, options) {
  3229. return new Plan(waypoints, options);
  3230. },
  3231. waypoint: function (latLng, name, options) {
  3232. return new Waypoint(latLng, name, options);
  3233. },
  3234. osrmv1: function (options) {
  3235. return new OSRMv1(options);
  3236. },
  3237. localization: function (options) {
  3238. return new Localization(options);
  3239. },
  3240. formatter: function (options) {
  3241. return new Formatter(options);
  3242. },
  3243. geocoderElement: function (wp, i, nWps, plan) {
  3244. return new L.Routing.GeocoderElement(wp, i, nWps, plan);
  3245. },
  3246. itineraryBuilder: function (options) {
  3247. return new ItineraryBuilder(options);
  3248. },
  3249. mapbox: function (accessToken, options) {
  3250. return new Mapbox(accessToken, options);
  3251. },
  3252. errorControl: function (routingControl, options) {
  3253. return new ErrorControl(routingControl, options);
  3254. },
  3255. autocomplete: function (elem, callback, context, options) {
  3256. return new Autocomplete(elem, callback, context, options);
  3257. }
  3258. };
  3259. module.exports = L.Routing = {
  3260. Control: Control,
  3261. Itinerary: Itinerary,
  3262. Line: Line,
  3263. OSRMv1: OSRMv1,
  3264. Plan: Plan,
  3265. Waypoint: Waypoint,
  3266. Autocomplete: Autocomplete,
  3267. Formatter: Formatter,
  3268. GeocoderElement: GeocoderElement,
  3269. Localization: Localization,
  3270. Formatter: Formatter,
  3271. ItineraryBuilder: ItineraryBuilder,
  3272. // Legacy; remove these in next major release
  3273. control: L.routing.control,
  3274. itinerary: L.routing.itinerary,
  3275. line: L.routing.line,
  3276. plan: L.routing.plan,
  3277. waypoint: L.routing.waypoint,
  3278. osrmv1: L.routing.osrmv1,
  3279. geocoderElement: L.routing.geocoderElement,
  3280. mapbox: L.routing.mapbox,
  3281. errorControl: L.routing.errorControl,
  3282. };
  3283. }).call(this, typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
  3284. }, {
  3285. "./autocomplete": 10,
  3286. "./control": 11,
  3287. "./error-control": 12,
  3288. "./formatter": 13,
  3289. "./geocoder-element": 14,
  3290. "./itinerary": 17,
  3291. "./itinerary-builder": 16,
  3292. "./line": 18,
  3293. "./localization": 19,
  3294. "./mapbox": 20,
  3295. "./osrm-v1": 21,
  3296. "./plan": 22,
  3297. "./waypoint": 23
  3298. }],
  3299. 16: [function (_dereq_, module, exports) {
  3300. (function (global) {
  3301. (function () {
  3302. 'use strict';
  3303. var L = (typeof window !== "undefined" ? window.L : typeof global !== "undefined" ? global.L : null);
  3304. module.exports = L.Class.extend({
  3305. options: {
  3306. containerClassName: ''
  3307. },
  3308. initialize: function (options) {
  3309. L.setOptions(this, options);
  3310. },
  3311. createContainer: function (className) {
  3312. var table = L.DomUtil.create('table', className || ''),
  3313. colgroup = L.DomUtil.create('colgroup', '', table);
  3314. L.DomUtil.create('col', 'leaflet-routing-instruction-icon', colgroup);
  3315. L.DomUtil.create('col', 'leaflet-routing-instruction-text', colgroup);
  3316. L.DomUtil.create('col', 'leaflet-routing-instruction-distance', colgroup);
  3317. return table;
  3318. },
  3319. createStepsContainer: function () {
  3320. return L.DomUtil.create('tbody', '');
  3321. },
  3322. createStep: function (text, distance, icon, steps) {
  3323. var row = L.DomUtil.create('tr', '', steps),
  3324. span,
  3325. td;
  3326. td = L.DomUtil.create('td', '', row);
  3327. //span = L.DomUtil.create('span', 'leaflet-routing-icon leaflet-routing-icon-' + icon, td);
  3328. ////td.appendChild(span);
  3329. //td = L.DomUtil.create('td', '', row);
  3330. ////td.appendChild(document.createTextNode(text));
  3331. //td = L.DomUtil.create('td', '', row);
  3332. //td.appendChild(document.createTextNode(distance));
  3333. return row;
  3334. }
  3335. });
  3336. })();
  3337. }).call(this, typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
  3338. }, {}],
  3339. 17: [function (_dereq_, module, exports) {
  3340. (function (global) {
  3341. (function () {
  3342. 'use strict';
  3343. var L = (typeof window !== "undefined" ? window.L : typeof global !== "undefined" ? global.L : null);
  3344. var Formatter = _dereq_('./formatter');
  3345. var ItineraryBuilder = _dereq_('./itinerary-builder');
  3346. module.exports = L.Control.extend({
  3347. includes: L.Mixin.Events,
  3348. options: {
  3349. pointMarkerStyle: {
  3350. radius: 5,
  3351. color: '#03f',
  3352. fillColor: 'white',
  3353. opacity: 1,
  3354. fillOpacity: 0.7
  3355. },
  3356. summaryTemplate: '<h2>{name}</h2><h3>{distance}, {time}</h3>',
  3357. timeTemplate: '{time}',
  3358. containerClassName: '',
  3359. alternativeClassName: '',
  3360. minimizedClassName: '',
  3361. itineraryClassName: '',
  3362. totalDistanceRoundingSensitivity: -1,
  3363. show: true,
  3364. collapsible: undefined,
  3365. collapseBtn: function (itinerary) {
  3366. var collapseBtn = L.DomUtil.create('span', itinerary.options.collapseBtnClass);
  3367. L.DomEvent.on(collapseBtn, 'click', itinerary._toggle, itinerary);
  3368. itinerary._container.insertBefore(collapseBtn, itinerary._container.firstChild);
  3369. },
  3370. collapseBtnClass: 'leaflet-routing-collapse-btn'
  3371. },
  3372. initialize: function (options) {
  3373. L.setOptions(this, options);
  3374. this._formatter = this.options.formatter || new Formatter(this.options);
  3375. this._itineraryBuilder = this.options.itineraryBuilder || new ItineraryBuilder({
  3376. containerClassName: this.options.itineraryClassName
  3377. });
  3378. },
  3379. onAdd: function (map) {
  3380. var collapsible = this.options.collapsible;
  3381. collapsible = collapsible || (collapsible === undefined && map.getSize().x <= 640);
  3382. this._container = L.DomUtil.create('div', 'leaflet-routing-container leaflet-bar ' +
  3383. (!this.options.show ? 'leaflet-routing-container-hide ' : '') +
  3384. (collapsible ? 'leaflet-routing-collapsible ' : '') +
  3385. this.options.containerClassName);
  3386. this._altContainer = this.createAlternativesContainer();
  3387. //this._container.appendChild(this._altContainer);
  3388. L.DomEvent.disableClickPropagation(this._container);
  3389. L.DomEvent.addListener(this._container, 'mousewheel', function (e) {
  3390. L.DomEvent.stopPropagation(e);
  3391. });
  3392. if (collapsible) {
  3393. this.options.collapseBtn(this);
  3394. }
  3395. return this._container;
  3396. },
  3397. onRemove: function () {},
  3398. createAlternativesContainer: function () {
  3399. return L.DomUtil.create('div', 'leaflet-routing-alternatives-container');
  3400. },
  3401. setAlternatives: function (routes) {
  3402. var i,
  3403. alt,
  3404. altDiv;
  3405. this._clearAlts();
  3406. this._routes = routes;
  3407. for (i = 0; i < this._routes.length; i++) {
  3408. alt = this._routes[i];
  3409. altDiv = this._createAlternative(alt, i);
  3410. //this._altContainer.appendChild(altDiv);
  3411. this._altElements.push(altDiv);
  3412. }
  3413. this._selectRoute({
  3414. route: this._routes[0],
  3415. alternatives: this._routes.slice(1)
  3416. });
  3417. return this;
  3418. },
  3419. show: function () {
  3420. L.DomUtil.removeClass(this._container, 'leaflet-routing-container-hide');
  3421. },
  3422. hide: function () {
  3423. L.DomUtil.addClass(this._container, 'leaflet-routing-container-hide');
  3424. },
  3425. _toggle: function () {
  3426. var collapsed = L.DomUtil.hasClass(this._container, 'leaflet-routing-container-hide');
  3427. this[collapsed ? 'show' : 'hide']();
  3428. },
  3429. _createAlternative: function (alt, i) {
  3430. var altDiv = L.DomUtil.create('div', 'leaflet-routing-alt ' +
  3431. this.options.alternativeClassName +
  3432. (i > 0 ? ' leaflet-routing-alt-minimized ' + this.options.minimizedClassName : '')),
  3433. template = this.options.summaryTemplate,
  3434. data = L.extend({
  3435. name: alt.name,
  3436. distance: this._formatter.formatDistance(alt.summary.totalDistance, this.options.totalDistanceRoundingSensitivity),
  3437. time: this._formatter.formatTime(alt.summary.totalTime)
  3438. }, alt);
  3439. altDiv.innerHTML = typeof (template) === 'function' ? template(data) : L.Util.template(template, data);
  3440. L.DomEvent.addListener(altDiv, 'click', this._onAltClicked, this);
  3441. this.on('routeselected', this._selectAlt, this);
  3442. //altDiv.appendChild(this._createItineraryContainer(alt));
  3443. return altDiv;
  3444. },
  3445. _clearAlts: function () {
  3446. var el = this._altContainer;
  3447. while (el && el.firstChild) {
  3448. el.removeChild(el.firstChild);
  3449. }
  3450. this._altElements = [];
  3451. },
  3452. _createItineraryContainer: function (r) {
  3453. var container = this._itineraryBuilder.createContainer(),
  3454. steps = this._itineraryBuilder.createStepsContainer(),
  3455. i,
  3456. instr,
  3457. step,
  3458. distance,
  3459. text,
  3460. icon;
  3461. //container.appendChild(steps);
  3462. for (i = 0; i < r.instructions.length; i++) {
  3463. instr = r.instructions[i];
  3464. text = this._formatter.formatInstruction(instr, i);
  3465. distance = this._formatter.formatDistance(instr.distance);
  3466. icon = this._formatter.getIconName(instr, i);
  3467. step = this._itineraryBuilder.createStep(text, distance, icon, steps);
  3468. this._addRowListeners(step, r.coordinates[instr.index]);
  3469. }
  3470. return container;
  3471. },
  3472. _addRowListeners: function (row, coordinate) {
  3473. L.DomEvent.addListener(row, 'mouseover', function () {
  3474. this._marker = L.circleMarker(coordinate,
  3475. this.options.pointMarkerStyle).addTo(this._map);
  3476. }, this);
  3477. L.DomEvent.addListener(row, 'mouseout', function () {
  3478. if (this._marker) {
  3479. this._map.removeLayer(this._marker);
  3480. delete this._marker;
  3481. }
  3482. }, this);
  3483. L.DomEvent.addListener(row, 'click', function (e) {
  3484. this._map.panTo(coordinate);
  3485. L.DomEvent.stopPropagation(e);
  3486. }, this);
  3487. },
  3488. _onAltClicked: function (e) {
  3489. var altElem = e.target || window.event.srcElement;
  3490. while (!L.DomUtil.hasClass(altElem, 'leaflet-routing-alt')) {
  3491. altElem = altElem.parentElement;
  3492. }
  3493. var j = this._altElements.indexOf(altElem);
  3494. var alts = this._routes.slice();
  3495. var route = alts.splice(j, 1)[0];
  3496. this.fire('routeselected', {
  3497. route: route,
  3498. alternatives: alts
  3499. });
  3500. },
  3501. _selectAlt: function (e) {
  3502. var altElem,
  3503. j,
  3504. n,
  3505. classFn;
  3506. altElem = this._altElements[e.route.routesIndex];
  3507. if (L.DomUtil.hasClass(altElem, 'leaflet-routing-alt-minimized')) {
  3508. for (j = 0; j < this._altElements.length; j++) {
  3509. n = this._altElements[j];
  3510. classFn = j === e.route.routesIndex ? 'removeClass' : 'addClass';
  3511. L.DomUtil[classFn](n, 'leaflet-routing-alt-minimized');
  3512. if (this.options.minimizedClassName) {
  3513. L.DomUtil[classFn](n, this.options.minimizedClassName);
  3514. }
  3515. if (j !== e.route.routesIndex) n.scrollTop = 0;
  3516. }
  3517. }
  3518. L.DomEvent.stop(e);
  3519. },
  3520. _selectRoute: function (routes) {
  3521. if (this._marker) {
  3522. this._map.removeLayer(this._marker);
  3523. delete this._marker;
  3524. }
  3525. this.fire('routeselected', routes);
  3526. }
  3527. });
  3528. })();
  3529. }).call(this, typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
  3530. }, {
  3531. "./formatter": 13,
  3532. "./itinerary-builder": 16
  3533. }],
  3534. 18: [function (_dereq_, module, exports) {
  3535. (function (global) {
  3536. (function () {
  3537. 'use strict';
  3538. var L = (typeof window !== "undefined" ? window.L : typeof global !== "undefined" ? global.L : null);
  3539. module.exports = L.LayerGroup.extend({
  3540. includes: L.Mixin.Events,
  3541. options: {
  3542. styles: [{
  3543. color: 'black',
  3544. opacity: 0.15,
  3545. weight: 9
  3546. },
  3547. {
  3548. color: 'white',
  3549. opacity: 0.8,
  3550. weight: 6
  3551. },
  3552. {
  3553. color: 'red',
  3554. opacity: 1,
  3555. weight: 2
  3556. }
  3557. ],
  3558. missingRouteStyles: [{
  3559. color: 'black',
  3560. opacity: 0.15,
  3561. weight: 7
  3562. },
  3563. {
  3564. color: 'white',
  3565. opacity: 0.6,
  3566. weight: 4
  3567. },
  3568. {
  3569. color: 'gray',
  3570. opacity: 0.8,
  3571. weight: 2,
  3572. dashArray: '7,12'
  3573. }
  3574. ],
  3575. addWaypoints: true,
  3576. extendToWaypoints: true,
  3577. missingRouteTolerance: 10
  3578. },
  3579. initialize: function (route, options) {
  3580. L.setOptions(this, options);
  3581. L.LayerGroup.prototype.initialize.call(this, options);
  3582. this._route = route;
  3583. if (this.options.extendToWaypoints) {
  3584. this._extendToWaypoints();
  3585. }
  3586. this._addSegment(
  3587. route.coordinates,
  3588. this.options.styles,
  3589. this.options.addWaypoints);
  3590. },
  3591. getBounds: function () {
  3592. return L.latLngBounds(this._route.coordinates);
  3593. },
  3594. _findWaypointIndices: function () {
  3595. var wps = this._route.inputWaypoints,
  3596. indices = [],
  3597. i;
  3598. for (i = 0; i < wps.length; i++) {
  3599. indices.push(this._findClosestRoutePoint(wps[i].latLng));
  3600. }
  3601. return indices;
  3602. },
  3603. _findClosestRoutePoint: function (latlng) {
  3604. var minDist = Number.MAX_VALUE,
  3605. minIndex,
  3606. i,
  3607. d;
  3608. for (i = this._route.coordinates.length - 1; i >= 0; i--) {
  3609. // TODO: maybe do this in pixel space instead?
  3610. d = latlng.distanceTo(this._route.coordinates[i]);
  3611. if (d < minDist) {
  3612. minIndex = i;
  3613. minDist = d;
  3614. }
  3615. }
  3616. return minIndex;
  3617. },
  3618. _extendToWaypoints: function () {
  3619. var wps = this._route.inputWaypoints,
  3620. wpIndices = this._getWaypointIndices(),
  3621. i,
  3622. wpLatLng,
  3623. routeCoord;
  3624. for (i = 0; i < wps.length; i++) {
  3625. wpLatLng = wps[i].latLng;
  3626. routeCoord = L.latLng(this._route.coordinates[wpIndices[i]]);
  3627. if (wpLatLng.distanceTo(routeCoord) >
  3628. this.options.missingRouteTolerance) {
  3629. this._addSegment([wpLatLng, routeCoord],
  3630. this.options.missingRouteStyles);
  3631. }
  3632. }
  3633. },
  3634. _addSegment: function (coords, styles, mouselistener) {
  3635. var i,
  3636. pl;
  3637. for (i = 0; i < styles.length; i++) {
  3638. pl = L.polyline(coords, styles[i]);
  3639. this.addLayer(pl);
  3640. if (mouselistener) {
  3641. pl.on('mousedown', this._onLineTouched, this);
  3642. }
  3643. }
  3644. },
  3645. _findNearestWpBefore: function (i) {
  3646. var wpIndices = this._getWaypointIndices(),
  3647. j = wpIndices.length - 1;
  3648. while (j >= 0 && wpIndices[j] > i) {
  3649. j--;
  3650. }
  3651. return j;
  3652. },
  3653. _onLineTouched: function (e) {
  3654. var afterIndex = this._findNearestWpBefore(this._findClosestRoutePoint(e.latlng));
  3655. this.fire('linetouched', {
  3656. afterIndex: afterIndex,
  3657. latlng: e.latlng
  3658. });
  3659. },
  3660. _getWaypointIndices: function () {
  3661. if (!this._wpIndices) {
  3662. this._wpIndices = this._route.waypointIndices || this._findWaypointIndices();
  3663. }
  3664. return this._wpIndices;
  3665. }
  3666. });
  3667. })();
  3668. }).call(this, typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
  3669. }, {}],
  3670. 19: [function (_dereq_, module, exports) {
  3671. (function () {
  3672. 'use strict';
  3673. var spanish = {
  3674. directions: {
  3675. N: 'norte',
  3676. NE: 'noreste',
  3677. E: 'este',
  3678. SE: 'sureste',
  3679. S: 'sur',
  3680. SW: 'suroeste',
  3681. W: 'oeste',
  3682. NW: 'noroeste',
  3683. SlightRight: 'leve giro a la derecha',
  3684. Right: 'derecha',
  3685. SharpRight: 'giro pronunciado a la derecha',
  3686. SlightLeft: 'leve giro a la izquierda',
  3687. Left: 'izquierda',
  3688. SharpLeft: 'giro pronunciado a la izquierda',
  3689. Uturn: 'media vuelta'
  3690. },
  3691. instructions: {
  3692. // instruction, postfix if the road is named
  3693. 'Head': ['Derecho {dir}', ' sobre {road}'],
  3694. 'Continue': ['Continuar {dir}', ' en {road}'],
  3695. 'TurnAround': ['Dar vuelta'],
  3696. 'WaypointReached': ['Llegó a un punto del camino'],
  3697. 'Roundabout': ['Tomar {exitStr} salida en la rotonda', ' en {road}'],
  3698. 'DestinationReached': ['Llegada a destino'],
  3699. 'Fork': ['En el cruce gira a {modifier}', ' hacia {road}'],
  3700. 'Merge': ['Incorpórate {modifier}', ' hacia {road}'],
  3701. 'OnRamp': ['Gira {modifier} en la salida', ' hacia {road}'],
  3702. 'OffRamp': ['Toma la salida {modifier}', ' hacia {road}'],
  3703. 'EndOfRoad': ['Gira {modifier} al final de la carretera', ' hacia {road}'],
  3704. 'Onto': 'hacia {road}'
  3705. },
  3706. formatOrder: function (n) {
  3707. return n + 'º';
  3708. },
  3709. ui: {
  3710. startPlaceholder: 'Inicio',
  3711. viaPlaceholder: 'Via {viaNumber}',
  3712. endPlaceholder: 'Destino'
  3713. },
  3714. units: {
  3715. meters: 'm',
  3716. kilometers: 'km',
  3717. yards: 'yd',
  3718. miles: 'mi',
  3719. hours: 'h',
  3720. minutes: 'min',
  3721. seconds: 's'
  3722. }
  3723. };
  3724. L.Routing = L.Routing || {};
  3725. var Localization = L.Class.extend({
  3726. initialize: function (langs) {
  3727. this._langs = L.Util.isArray(langs) ? langs : [langs, 'en'];
  3728. for (var i = 0, l = this._langs.length; i < l; i++) {
  3729. if (!Localization[this._langs[i]]) {
  3730. throw new Error('No localization for language "' + this._langs[i] + '".');
  3731. }
  3732. }
  3733. },
  3734. localize: function (keys) {
  3735. var dict,
  3736. key,
  3737. value;
  3738. keys = L.Util.isArray(keys) ? keys : [keys];
  3739. for (var i = 0, l = this._langs.length; i < l; i++) {
  3740. dict = Localization[this._langs[i]];
  3741. for (var j = 0, nKeys = keys.length; dict && j < nKeys; j++) {
  3742. key = keys[j];
  3743. value = dict[key];
  3744. dict = value;
  3745. }
  3746. if (value) {
  3747. return value;
  3748. }
  3749. }
  3750. }
  3751. });
  3752. module.exports = L.extend(Localization, {
  3753. 'en': {
  3754. directions: {
  3755. N: 'north',
  3756. NE: 'northeast',
  3757. E: 'east',
  3758. SE: 'southeast',
  3759. S: 'south',
  3760. SW: 'southwest',
  3761. W: 'west',
  3762. NW: 'northwest',
  3763. SlightRight: 'slight right',
  3764. Right: 'right',
  3765. SharpRight: 'sharp right',
  3766. SlightLeft: 'slight left',
  3767. Left: 'left',
  3768. SharpLeft: 'sharp left',
  3769. Uturn: 'Turn around'
  3770. },
  3771. instructions: {
  3772. // instruction, postfix if the road is named
  3773. 'Head': ['Head {dir}', ' on {road}'],
  3774. 'Continue': ['Continue {dir}'],
  3775. 'TurnAround': ['Turn around'],
  3776. 'WaypointReached': ['Waypoint reached'],
  3777. 'Roundabout': ['Take the {exitStr} exit in the roundabout', ' onto {road}'],
  3778. 'DestinationReached': ['Destination reached'],
  3779. 'Fork': ['At the fork, turn {modifier}', ' onto {road}'],
  3780. 'Merge': ['Merge {modifier}', ' onto {road}'],
  3781. 'OnRamp': ['Turn {modifier} on the ramp', ' onto {road}'],
  3782. 'OffRamp': ['Take the ramp on the {modifier}', ' onto {road}'],
  3783. 'EndOfRoad': ['Turn {modifier} at the end of the road', ' onto {road}'],
  3784. 'Onto': 'onto {road}'
  3785. },
  3786. formatOrder: function (n) {
  3787. var i = n % 10 - 1,
  3788. suffix = ['st', 'nd', 'rd'];
  3789. return suffix[i] ? n + suffix[i] : n + 'th';
  3790. },
  3791. ui: {
  3792. startPlaceholder: 'Start',
  3793. viaPlaceholder: 'Via {viaNumber}',
  3794. endPlaceholder: 'End'
  3795. },
  3796. units: {
  3797. meters: 'm',
  3798. kilometers: 'km',
  3799. yards: 'yd',
  3800. miles: 'mi',
  3801. hours: 'h',
  3802. minutes: 'min',
  3803. seconds: 's'
  3804. }
  3805. },
  3806. 'de': {
  3807. directions: {
  3808. N: 'Norden',
  3809. NE: 'Nordosten',
  3810. E: 'Osten',
  3811. SE: 'Südosten',
  3812. S: 'Süden',
  3813. SW: 'Südwesten',
  3814. W: 'Westen',
  3815. NW: 'Nordwesten',
  3816. SlightRight: 'leicht rechts',
  3817. Right: 'rechts',
  3818. SharpRight: 'scharf rechts',
  3819. SlightLeft: 'leicht links',
  3820. Left: 'links',
  3821. SharpLeft: 'scharf links',
  3822. Uturn: 'Wenden'
  3823. },
  3824. instructions: {
  3825. // instruction, postfix if the road is named
  3826. 'Head': ['Richtung {dir}', ' auf {road}'],
  3827. 'Continue': ['Geradeaus Richtung {dir}', ' auf {road}'],
  3828. 'SlightRight': ['Leicht rechts abbiegen', ' auf {road}'],
  3829. 'Right': ['Rechts abbiegen', ' auf {road}'],
  3830. 'SharpRight': ['Scharf rechts abbiegen', ' auf {road}'],
  3831. 'TurnAround': ['Wenden'],
  3832. 'SharpLeft': ['Scharf links abbiegen', ' auf {road}'],
  3833. 'Left': ['Links abbiegen', ' auf {road}'],
  3834. 'SlightLeft': ['Leicht links abbiegen', ' auf {road}'],
  3835. 'WaypointReached': ['Zwischenhalt erreicht'],
  3836. 'Roundabout': ['Nehmen Sie die {exitStr} Ausfahrt im Kreisverkehr', ' auf {road}'],
  3837. 'DestinationReached': ['Sie haben ihr Ziel erreicht'],
  3838. 'Fork': ['An der Kreuzung {modifier}', ' auf {road}'],
  3839. 'Merge': ['Fahren Sie {modifier} weiter', ' auf {road}'],
  3840. 'OnRamp': ['Fahren Sie {modifier} auf die Auffahrt', ' auf {road}'],
  3841. 'OffRamp': ['Nehmen Sie die Ausfahrt {modifier}', ' auf {road}'],
  3842. 'EndOfRoad': ['Fahren Sie {modifier} am Ende der Straße', ' auf {road}'],
  3843. 'Onto': 'auf {road}'
  3844. },
  3845. formatOrder: function (n) {
  3846. return n + '.';
  3847. },
  3848. ui: {
  3849. startPlaceholder: 'Start',
  3850. viaPlaceholder: 'Via {viaNumber}',
  3851. endPlaceholder: 'Ziel'
  3852. }
  3853. },
  3854. 'sv': {
  3855. directions: {
  3856. N: 'norr',
  3857. NE: 'nordost',
  3858. E: 'öst',
  3859. SE: 'sydost',
  3860. S: 'syd',
  3861. SW: 'sydväst',
  3862. W: 'väst',
  3863. NW: 'nordväst',
  3864. SlightRight: 'svagt höger',
  3865. Right: 'höger',
  3866. SharpRight: 'skarpt höger',
  3867. SlightLeft: 'svagt vänster',
  3868. Left: 'vänster',
  3869. SharpLeft: 'skarpt vänster',
  3870. Uturn: 'Vänd'
  3871. },
  3872. instructions: {
  3873. // instruction, postfix if the road is named
  3874. 'Head': ['Åk åt {dir}', ' till {road}'],
  3875. 'Continue': ['Fortsätt {dir}'],
  3876. 'SlightRight': ['Svagt höger', ' till {road}'],
  3877. 'Right': ['Sväng höger', ' till {road}'],
  3878. 'SharpRight': ['Skarpt höger', ' till {road}'],
  3879. 'TurnAround': ['Vänd'],
  3880. 'SharpLeft': ['Skarpt vänster', ' till {road}'],
  3881. 'Left': ['Sväng vänster', ' till {road}'],
  3882. 'SlightLeft': ['Svagt vänster', ' till {road}'],
  3883. 'WaypointReached': ['Viapunkt nådd'],
  3884. 'Roundabout': ['Tag {exitStr} avfarten i rondellen', ' till {road}'],
  3885. 'DestinationReached': ['Framme vid resans mål'],
  3886. 'Fork': ['Tag av {modifier}', ' till {road}'],
  3887. 'Merge': ['Anslut {modifier} ', ' till {road}'],
  3888. 'OnRamp': ['Tag påfarten {modifier}', ' till {road}'],
  3889. 'OffRamp': ['Tag avfarten {modifier}', ' till {road}'],
  3890. 'EndOfRoad': ['Sväng {modifier} vid vägens slut', ' till {road}'],
  3891. 'Onto': 'till {road}'
  3892. },
  3893. formatOrder: function (n) {
  3894. return ['första', 'andra', 'tredje', 'fjärde', 'femte',
  3895. 'sjätte', 'sjunde', 'åttonde', 'nionde', 'tionde'
  3896. /* Can't possibly be more than ten exits, can there? */
  3897. ][n - 1];
  3898. },
  3899. ui: {
  3900. startPlaceholder: 'Från',
  3901. viaPlaceholder: 'Via {viaNumber}',
  3902. endPlaceholder: 'Till'
  3903. }
  3904. },
  3905. 'es': spanish,
  3906. 'sp': spanish,
  3907. 'nl': {
  3908. directions: {
  3909. N: 'noordelijke',
  3910. NE: 'noordoostelijke',
  3911. E: 'oostelijke',
  3912. SE: 'zuidoostelijke',
  3913. S: 'zuidelijke',
  3914. SW: 'zuidewestelijke',
  3915. W: 'westelijke',
  3916. NW: 'noordwestelijke'
  3917. },
  3918. instructions: {
  3919. // instruction, postfix if the road is named
  3920. 'Head': ['Vertrek in {dir} richting', ' de {road} op'],
  3921. 'Continue': ['Ga in {dir} richting', ' de {road} op'],
  3922. 'SlightRight': ['Volg de weg naar rechts', ' de {road} op'],
  3923. 'Right': ['Ga rechtsaf', ' de {road} op'],
  3924. 'SharpRight': ['Ga scherpe bocht naar rechts', ' de {road} op'],
  3925. 'TurnAround': ['Keer om'],
  3926. 'SharpLeft': ['Ga scherpe bocht naar links', ' de {road} op'],
  3927. 'Left': ['Ga linksaf', ' de {road} op'],
  3928. 'SlightLeft': ['Volg de weg naar links', ' de {road} op'],
  3929. 'WaypointReached': ['Aangekomen bij tussenpunt'],
  3930. 'Roundabout': ['Neem de {exitStr} afslag op de rotonde', ' de {road} op'],
  3931. 'DestinationReached': ['Aangekomen op eindpunt'],
  3932. },
  3933. formatOrder: function (n) {
  3934. if (n === 1 || n >= 20) {
  3935. return n + 'ste';
  3936. } else {
  3937. return n + 'de';
  3938. }
  3939. },
  3940. ui: {
  3941. startPlaceholder: 'Vertrekpunt',
  3942. viaPlaceholder: 'Via {viaNumber}',
  3943. endPlaceholder: 'Bestemming'
  3944. }
  3945. },
  3946. 'fr': {
  3947. directions: {
  3948. N: 'nord',
  3949. NE: 'nord-est',
  3950. E: 'est',
  3951. SE: 'sud-est',
  3952. S: 'sud',
  3953. SW: 'sud-ouest',
  3954. W: 'ouest',
  3955. NW: 'nord-ouest'
  3956. },
  3957. instructions: {
  3958. // instruction, postfix if the road is named
  3959. 'Head': ['Tout droit au {dir}', ' sur {road}'],
  3960. 'Continue': ['Continuer au {dir}', ' sur {road}'],
  3961. 'SlightRight': ['Légèrement à droite', ' sur {road}'],
  3962. 'Right': ['A droite', ' sur {road}'],
  3963. 'SharpRight': ['Complètement à droite', ' sur {road}'],
  3964. 'TurnAround': ['Faire demi-tour'],
  3965. 'SharpLeft': ['Complètement à gauche', ' sur {road}'],
  3966. 'Left': ['A gauche', ' sur {road}'],
  3967. 'SlightLeft': ['Légèrement à gauche', ' sur {road}'],
  3968. 'WaypointReached': ['Point d\'étape atteint'],
  3969. 'Roundabout': ['Au rond-point, prenez la {exitStr} sortie', ' sur {road}'],
  3970. 'DestinationReached': ['Destination atteinte'],
  3971. },
  3972. formatOrder: function (n) {
  3973. return n + 'º';
  3974. },
  3975. ui: {
  3976. startPlaceholder: 'Départ',
  3977. viaPlaceholder: 'Intermédiaire {viaNumber}',
  3978. endPlaceholder: 'Arrivée'
  3979. }
  3980. },
  3981. 'it': {
  3982. directions: {
  3983. N: 'nord',
  3984. NE: 'nord-est',
  3985. E: 'est',
  3986. SE: 'sud-est',
  3987. S: 'sud',
  3988. SW: 'sud-ovest',
  3989. W: 'ovest',
  3990. NW: 'nord-ovest'
  3991. },
  3992. instructions: {
  3993. // instruction, postfix if the road is named
  3994. 'Head': ['Dritto verso {dir}', ' su {road}'],
  3995. 'Continue': ['Continuare verso {dir}', ' su {road}'],
  3996. 'SlightRight': ['Mantenere la destra', ' su {road}'],
  3997. 'Right': ['A destra', ' su {road}'],
  3998. 'SharpRight': ['Strettamente a destra', ' su {road}'],
  3999. 'TurnAround': ['Fare inversione di marcia'],
  4000. 'SharpLeft': ['Strettamente a sinistra', ' su {road}'],
  4001. 'Left': ['A sinistra', ' sur {road}'],
  4002. 'SlightLeft': ['Mantenere la sinistra', ' su {road}'],
  4003. 'WaypointReached': ['Punto di passaggio raggiunto'],
  4004. 'Roundabout': ['Alla rotonda, prendere la {exitStr} uscita'],
  4005. 'DestinationReached': ['Destinazione raggiunta'],
  4006. },
  4007. formatOrder: function (n) {
  4008. return n + 'º';
  4009. },
  4010. ui: {
  4011. startPlaceholder: 'Partenza',
  4012. viaPlaceholder: 'Intermedia {viaNumber}',
  4013. endPlaceholder: 'Destinazione'
  4014. }
  4015. },
  4016. 'pt': {
  4017. directions: {
  4018. N: 'norte',
  4019. NE: 'nordeste',
  4020. E: 'leste',
  4021. SE: 'sudeste',
  4022. S: 'sul',
  4023. SW: 'sudoeste',
  4024. W: 'oeste',
  4025. NW: 'noroeste',
  4026. SlightRight: 'curva ligeira a direita',
  4027. Right: 'direita',
  4028. SharpRight: 'curva fechada a direita',
  4029. SlightLeft: 'ligeira a esquerda',
  4030. Left: 'esquerda',
  4031. SharpLeft: 'curva fechada a esquerda',
  4032. Uturn: 'Meia volta'
  4033. },
  4034. instructions: {
  4035. // instruction, postfix if the road is named
  4036. 'Head': ['Siga {dir}', ' na {road}'],
  4037. 'Continue': ['Continue {dir}', ' na {road}'],
  4038. 'SlightRight': ['Curva ligeira a direita', ' na {road}'],
  4039. 'Right': ['Curva a direita', ' na {road}'],
  4040. 'SharpRight': ['Curva fechada a direita', ' na {road}'],
  4041. 'TurnAround': ['Retorne'],
  4042. 'SharpLeft': ['Curva fechada a esquerda', ' na {road}'],
  4043. 'Left': ['Curva a esquerda', ' na {road}'],
  4044. 'SlightLeft': ['Curva ligueira a esquerda', ' na {road}'],
  4045. 'WaypointReached': ['Ponto de interesse atingido'],
  4046. 'Roundabout': ['Pegue a {exitStr} saída na rotatória', ' na {road}'],
  4047. 'DestinationReached': ['Destino atingido'],
  4048. 'Fork': ['Na encruzilhada, vire a {modifier}', ' na {road}'],
  4049. 'Merge': ['Entre à {modifier}', ' na {road}'],
  4050. 'OnRamp': ['Vire {modifier} na rampa', ' na {road}'],
  4051. 'OffRamp': ['Entre na rampa na {modifier}', ' na {road}'],
  4052. 'EndOfRoad': ['Vire {modifier} no fim da rua', ' na {road}'],
  4053. 'Onto': 'na {road}'
  4054. },
  4055. formatOrder: function (n) {
  4056. return n + 'º';
  4057. },
  4058. ui: {
  4059. startPlaceholder: 'Origem',
  4060. viaPlaceholder: 'Intermédio {viaNumber}',
  4061. endPlaceholder: 'Destino'
  4062. }
  4063. },
  4064. 'sk': {
  4065. directions: {
  4066. N: 'sever',
  4067. NE: 'serverovýchod',
  4068. E: 'východ',
  4069. SE: 'juhovýchod',
  4070. S: 'juh',
  4071. SW: 'juhozápad',
  4072. W: 'západ',
  4073. NW: 'serverozápad'
  4074. },
  4075. instructions: {
  4076. // instruction, postfix if the road is named
  4077. 'Head': ['Mierte na {dir}', ' na {road}'],
  4078. 'Continue': ['Pokračujte na {dir}', ' na {road}'],
  4079. 'SlightRight': ['Mierne doprava', ' na {road}'],
  4080. 'Right': ['Doprava', ' na {road}'],
  4081. 'SharpRight': ['Prudko doprava', ' na {road}'],
  4082. 'TurnAround': ['Otočte sa'],
  4083. 'SharpLeft': ['Prudko doľava', ' na {road}'],
  4084. 'Left': ['Doľava', ' na {road}'],
  4085. 'SlightLeft': ['Mierne doľava', ' na {road}'],
  4086. 'WaypointReached': ['Ste v prejazdovom bode.'],
  4087. 'Roundabout': ['Odbočte na {exitStr} výjazde', ' na {road}'],
  4088. 'DestinationReached': ['Prišli ste do cieľa.'],
  4089. },
  4090. formatOrder: function (n) {
  4091. var i = n % 10 - 1,
  4092. suffix = ['.', '.', '.'];
  4093. return suffix[i] ? n + suffix[i] : n + '.';
  4094. },
  4095. ui: {
  4096. startPlaceholder: 'Začiatok',
  4097. viaPlaceholder: 'Cez {viaNumber}',
  4098. endPlaceholder: 'Koniec'
  4099. }
  4100. },
  4101. 'el': {
  4102. directions: {
  4103. N: 'βόρεια',
  4104. NE: 'βορειοανατολικά',
  4105. E: 'ανατολικά',
  4106. SE: 'νοτιοανατολικά',
  4107. S: 'νότια',
  4108. SW: 'νοτιοδυτικά',
  4109. W: 'δυτικά',
  4110. NW: 'βορειοδυτικά'
  4111. },
  4112. instructions: {
  4113. // instruction, postfix if the road is named
  4114. 'Head': ['Κατευθυνθείτε {dir}', ' στην {road}'],
  4115. 'Continue': ['Συνεχίστε {dir}', ' στην {road}'],
  4116. 'SlightRight': ['Ελαφρώς δεξιά', ' στην {road}'],
  4117. 'Right': ['Δεξιά', ' στην {road}'],
  4118. 'SharpRight': ['Απότομη δεξιά στροφή', ' στην {road}'],
  4119. 'TurnAround': ['Κάντε αναστροφή'],
  4120. 'SharpLeft': ['Απότομη αριστερή στροφή', ' στην {road}'],
  4121. 'Left': ['Αριστερά', ' στην {road}'],
  4122. 'SlightLeft': ['Ελαφρώς αριστερά', ' στην {road}'],
  4123. 'WaypointReached': ['Φτάσατε στο σημείο αναφοράς'],
  4124. 'Roundabout': ['Ακολουθήστε την {exitStr} έξοδο στο κυκλικό κόμβο', ' στην {road}'],
  4125. 'DestinationReached': ['Φτάσατε στον προορισμό σας'],
  4126. },
  4127. formatOrder: function (n) {
  4128. return n + 'º';
  4129. },
  4130. ui: {
  4131. startPlaceholder: 'Αφετηρία',
  4132. viaPlaceholder: 'μέσω {viaNumber}',
  4133. endPlaceholder: 'Προορισμός'
  4134. }
  4135. },
  4136. 'ca': {
  4137. directions: {
  4138. N: 'nord',
  4139. NE: 'nord-est',
  4140. E: 'est',
  4141. SE: 'sud-est',
  4142. S: 'sud',
  4143. SW: 'sud-oest',
  4144. W: 'oest',
  4145. NW: 'nord-oest',
  4146. SlightRight: 'lleu gir a la dreta',
  4147. Right: 'dreta',
  4148. SharpRight: 'gir pronunciat a la dreta',
  4149. SlightLeft: 'gir pronunciat a l\'esquerra',
  4150. Left: 'esquerra',
  4151. SharpLeft: 'lleu gir a l\'esquerra',
  4152. Uturn: 'mitja volta'
  4153. },
  4154. instructions: {
  4155. 'Head': ['Recte {dir}', ' sobre {road}'],
  4156. 'Continue': ['Continuar {dir}'],
  4157. 'TurnAround': ['Donar la volta'],
  4158. 'WaypointReached': ['Ha arribat a un punt del camí'],
  4159. 'Roundabout': ['Agafar {exitStr} sortida a la rotonda', ' a {road}'],
  4160. 'DestinationReached': ['Arribada al destí'],
  4161. 'Fork': ['A la cruïlla gira a la {modifier}', ' cap a {road}'],
  4162. 'Merge': ['Incorpora\'t {modifier}', ' a {road}'],
  4163. 'OnRamp': ['Gira {modifier} a la sortida', ' cap a {road}'],
  4164. 'OffRamp': ['Pren la sortida {modifier}', ' cap a {road}'],
  4165. 'EndOfRoad': ['Gira {modifier} al final de la carretera', ' cap a {road}'],
  4166. 'Onto': 'cap a {road}'
  4167. },
  4168. formatOrder: function (n) {
  4169. return n + 'º';
  4170. },
  4171. ui: {
  4172. startPlaceholder: 'Origen',
  4173. viaPlaceholder: 'Via {viaNumber}',
  4174. endPlaceholder: 'Destí'
  4175. },
  4176. units: {
  4177. meters: 'm',
  4178. kilometers: 'km',
  4179. yards: 'yd',
  4180. miles: 'mi',
  4181. hours: 'h',
  4182. minutes: 'min',
  4183. seconds: 's'
  4184. }
  4185. },
  4186. 'ru': {
  4187. directions: {
  4188. N: 'север',
  4189. NE: 'северовосток',
  4190. E: 'восток',
  4191. SE: 'юговосток',
  4192. S: 'юг',
  4193. SW: 'югозапад',
  4194. W: 'запад',
  4195. NW: 'северозапад',
  4196. SlightRight: 'плавно направо',
  4197. Right: 'направо',
  4198. SharpRight: 'резко направо',
  4199. SlightLeft: 'плавно налево',
  4200. Left: 'налево',
  4201. SharpLeft: 'резко налево',
  4202. Uturn: 'развернуться'
  4203. },
  4204. instructions: {
  4205. 'Head': ['Начать движение на {dir}', ' по {road}'],
  4206. 'Continue': ['Продолжать движение на {dir}', ' по {road}'],
  4207. 'SlightRight': ['Плавный поворот направо', ' на {road}'],
  4208. 'Right': ['Направо', ' на {road}'],
  4209. 'SharpRight': ['Резкий поворот направо', ' на {road}'],
  4210. 'TurnAround': ['Развернуться'],
  4211. 'SharpLeft': ['Резкий поворот налево', ' на {road}'],
  4212. 'Left': ['Поворот налево', ' на {road}'],
  4213. 'SlightLeft': ['Плавный поворот налево', ' на {road}'],
  4214. 'WaypointReached': ['Точка достигнута'],
  4215. 'Roundabout': ['{exitStr} съезд с кольца', ' на {road}'],
  4216. 'DestinationReached': ['Окончание маршрута'],
  4217. 'Fork': ['На развилке поверните {modifier}', ' на {road}'],
  4218. 'Merge': ['Перестройтесь {modifier}', ' на {road}'],
  4219. 'OnRamp': ['Поверните {modifier} на съезд', ' на {road}'],
  4220. 'OffRamp': ['Съезжайте на {modifier}', ' на {road}'],
  4221. 'EndOfRoad': ['Поверните {modifier} в конце дороги', ' на {road}'],
  4222. 'Onto': 'на {road}'
  4223. },
  4224. formatOrder: function (n) {
  4225. return n + '-й';
  4226. },
  4227. ui: {
  4228. startPlaceholder: 'Начало',
  4229. viaPlaceholder: 'Через {viaNumber}',
  4230. endPlaceholder: 'Конец'
  4231. },
  4232. units: {
  4233. meters: 'м',
  4234. kilometers: 'км',
  4235. yards: 'ярд',
  4236. miles: 'ми',
  4237. hours: 'ч',
  4238. minutes: 'м',
  4239. seconds: 'с'
  4240. }
  4241. }
  4242. });
  4243. })();
  4244. }, {}],
  4245. 20: [function (_dereq_, module, exports) {
  4246. (function (global) {
  4247. (function () {
  4248. 'use strict';
  4249. var L = (typeof window !== "undefined" ? window.L : typeof global !== "undefined" ? global.L : null);
  4250. var OSRMv1 = _dereq_('./osrm-v1');
  4251. /**
  4252. * Works against OSRM's new API in version 5.0; this has
  4253. * the API version v1.
  4254. */
  4255. module.exports = OSRMv1.extend({
  4256. options: {
  4257. serviceUrl: 'https://api.mapbox.com/directions/v5',
  4258. profile: 'mapbox/driving',
  4259. useHints: false
  4260. },
  4261. initialize: function (accessToken, options) {
  4262. L.Routing.OSRMv1.prototype.initialize.call(this, options);
  4263. this.options.requestParameters = this.options.requestParameters || {};
  4264. /* jshint camelcase: false */
  4265. this.options.requestParameters.access_token = accessToken;
  4266. /* jshint camelcase: true */
  4267. }
  4268. });
  4269. })();
  4270. }).call(this, typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
  4271. }, {
  4272. "./osrm-v1": 21
  4273. }],
  4274. 21: [function (_dereq_, module, exports) {
  4275. (function (global) {
  4276. (function () {
  4277. 'use strict';
  4278. var L = (typeof window !== "undefined" ? window.L : typeof global !== "undefined" ? global.L : null),
  4279. corslite = _dereq_('corslite'),
  4280. polyline = _dereq_('polyline'),
  4281. osrmTextInstructions = _dereq_('osrm-text-instructions');
  4282. // Ignore camelcase naming for this file, since OSRM's API uses
  4283. // underscores.
  4284. /* jshint camelcase: false */
  4285. var Waypoint = _dereq_('./waypoint');
  4286. /**
  4287. * Works against OSRM's new API in version 5.0; this has
  4288. * the API version v1.
  4289. */
  4290. module.exports = L.Class.extend({
  4291. options: {
  4292. //serviceUrl: 'https://router.project-osrm.org/route/v1',
  4293. serviceUrl: onemapUrlConfigNetwork.routeSearchDataUrl,
  4294. profile: 'driving',
  4295. timeout: 30 * 1000,
  4296. routingOptions: {
  4297. alternatives: true,
  4298. steps: true
  4299. },
  4300. polylinePrecision: 5,
  4301. useHints: true,
  4302. suppressDemoServerWarning: false,
  4303. language: 'zh'
  4304. },
  4305. initialize: function (options) {
  4306. L.Util.setOptions(this, options);
  4307. this._hints = {
  4308. locations: {}
  4309. };
  4310. },
  4311. route: function (waypoints, callback, context, options) {
  4312. var timedOut = false,
  4313. wps = [],
  4314. url,
  4315. timer,
  4316. wp,
  4317. i,
  4318. xhr;
  4319. options = L.extend({}, this.options.routingOptions, options);
  4320. url = this.buildRouteUrl(waypoints, options);
  4321. if (this.options.requestParameters) {
  4322. url += L.Util.getParamString(this.options.requestParameters, url);
  4323. }
  4324. timer = setTimeout(function () {
  4325. timedOut = true;
  4326. callback.call(context || callback, {
  4327. status: -1,
  4328. message: 'OSRM request timed out.'
  4329. });
  4330. }, this.options.timeout);
  4331. // Create a copy of the waypoints, since they
  4332. // might otherwise be asynchronously modified while
  4333. // the request is being processed.
  4334. for (i = 0; i < waypoints.length; i++) {
  4335. wp = waypoints[i];
  4336. wps.push(new Waypoint(wp.latLng, wp.name, wp.options));
  4337. }
  4338. return xhr = corslite(url, L.bind(function (err, resp) {
  4339. var data,
  4340. error = {};
  4341. clearTimeout(timer);
  4342. if (!timedOut) {
  4343. if (!err) {
  4344. try {
  4345. data = JSON.parse(resp.responseText);
  4346. try {
  4347. return this._routeDone(data, wps, options, callback, context);
  4348. } catch (ex) {
  4349. error.status = -3;
  4350. error.message = ex.toString();
  4351. }
  4352. } catch (ex) {
  4353. error.status = -2;
  4354. error.message = 'Error parsing OSRM response: ' + ex.toString();
  4355. }
  4356. } else {
  4357. error.message = 'HTTP request failed: ' + err.type +
  4358. (err.target && err.target.status ? ' HTTP ' + err.target.status + ': ' + err.target.statusText : '');
  4359. error.url = url;
  4360. error.status = -1;
  4361. error.target = err;
  4362. }
  4363. callback.call(context || callback, error);
  4364. } else {
  4365. xhr.abort();
  4366. }
  4367. }, this));
  4368. },
  4369. requiresMoreDetail: function (route, zoom, bounds) {
  4370. if (!route.properties.isSimplified) {
  4371. return false;
  4372. }
  4373. var waypoints = route.inputWaypoints,
  4374. i;
  4375. for (i = 0; i < waypoints.length; ++i) {
  4376. if (!bounds.contains(waypoints[i].latLng)) {
  4377. return true;
  4378. }
  4379. }
  4380. return false;
  4381. },
  4382. _routeDone: function (response, inputWaypoints, options, callback, context) {
  4383. var alts = [],
  4384. actualWaypoints,
  4385. i,
  4386. route;
  4387. context = context || callback;
  4388. if (response.code !== 'Ok') {
  4389. callback.call(context, {
  4390. status: response.code
  4391. });
  4392. return;
  4393. }
  4394. actualWaypoints = this._toWaypoints(inputWaypoints, response.waypoints);
  4395. for (i = 0; i < response.routes.length; i++) {
  4396. route = this._convertRoute(response.routes[i]);
  4397. route.inputWaypoints = inputWaypoints;
  4398. route.waypoints = actualWaypoints;
  4399. route.properties = {
  4400. isSimplified: !options || !options.geometryOnly || options.simplifyGeometry
  4401. };
  4402. alts.push(route);
  4403. }
  4404. this._saveHintData(response.waypoints, inputWaypoints);
  4405. routingControl.options.callback(alts);
  4406. //delete routingControl;
  4407. //callback.call(context, null, alts);
  4408. },
  4409. _convertRoute: function (responseRoute) {
  4410. var result = {
  4411. name: '',
  4412. coordinates: [],
  4413. instructions: [],
  4414. summary: {
  4415. totalDistance: responseRoute.distance,
  4416. totalTime: responseRoute.duration
  4417. }
  4418. },
  4419. legNames = [],
  4420. waypointIndices = [],
  4421. index = 0,
  4422. legCount = responseRoute.legs.length,
  4423. hasSteps = responseRoute.legs[0].steps.length > 0,
  4424. i,
  4425. j,
  4426. leg,
  4427. step,
  4428. geometry,
  4429. type,
  4430. modifier,
  4431. text,
  4432. stepToText;
  4433. if (this.options.stepToText) {
  4434. stepToText = this.options.stepToText;
  4435. } else {
  4436. var textInstructions = osrmTextInstructions('v5', this.options.language);
  4437. stepToText = textInstructions.compile.bind(textInstructions);
  4438. }
  4439. for (i = 0; i < legCount; i++) {
  4440. leg = responseRoute.legs[i];
  4441. legNames.push(leg.summary && leg.summary.charAt(0).toUpperCase() + leg.summary.substring(1));
  4442. for (j = 0; j < leg.steps.length; j++) {
  4443. step = leg.steps[j];
  4444. geometry = this._decodePolyline(step.geometry);
  4445. result.coordinates.push.apply(result.coordinates, geometry);
  4446. type = this._maneuverToInstructionType(step.maneuver, i === legCount - 1);
  4447. modifier = this._maneuverToModifier(step.maneuver);
  4448. text = stepToText(step);
  4449. if (type) {
  4450. if ((i == 0 && step.maneuver.type == 'depart') || step.maneuver.type == 'arrive') {
  4451. waypointIndices.push(index);
  4452. }
  4453. result.instructions.push({
  4454. type: type,
  4455. distance: step.distance,
  4456. time: step.duration,
  4457. road: step.name,
  4458. direction: this._bearingToDirection(step.maneuver.bearing_after),
  4459. exit: step.maneuver.exit,
  4460. index: index,
  4461. mode: step.mode,
  4462. modifier: modifier,
  4463. text: text
  4464. });
  4465. }
  4466. index += geometry.length;
  4467. }
  4468. }
  4469. result.name = legNames.join(', ');
  4470. if (!hasSteps) {
  4471. result.coordinates = this._decodePolyline(responseRoute.geometry);
  4472. } else {
  4473. result.waypointIndices = waypointIndices;
  4474. }
  4475. return result;
  4476. },
  4477. _bearingToDirection: function (bearing) {
  4478. var oct = Math.round(bearing / 45) % 8;
  4479. return ['N', 'NE', 'E', 'SE', 'S', 'SW', 'W', 'NW'][oct];
  4480. },
  4481. _maneuverToInstructionType: function (maneuver, lastLeg) {
  4482. switch (maneuver.type) {
  4483. case 'new name':
  4484. return 'Continue';
  4485. case 'depart':
  4486. return 'Head';
  4487. case 'arrive':
  4488. return lastLeg ? 'DestinationReached' : 'WaypointReached';
  4489. case 'roundabout':
  4490. case 'rotary':
  4491. return 'Roundabout';
  4492. case 'merge':
  4493. case 'fork':
  4494. case 'on ramp':
  4495. case 'off ramp':
  4496. case 'end of road':
  4497. return this._camelCase(maneuver.type);
  4498. // These are all reduced to the same instruction in the current model
  4499. //case 'turn':
  4500. //case 'ramp': // deprecated in v5.1
  4501. default:
  4502. return this._camelCase(maneuver.modifier);
  4503. }
  4504. },
  4505. _maneuverToModifier: function (maneuver) {
  4506. var modifier = maneuver.modifier;
  4507. switch (maneuver.type) {
  4508. case 'merge':
  4509. case 'fork':
  4510. case 'on ramp':
  4511. case 'off ramp':
  4512. case 'end of road':
  4513. modifier = this._leftOrRight(modifier);
  4514. }
  4515. return modifier && this._camelCase(modifier);
  4516. },
  4517. _camelCase: function (s) {
  4518. var words = s.split(' '),
  4519. result = '';
  4520. for (var i = 0, l = words.length; i < l; i++) {
  4521. result += words[i].charAt(0).toUpperCase() + words[i].substring(1);
  4522. }
  4523. return result;
  4524. },
  4525. _leftOrRight: function (d) {
  4526. return d.indexOf('left') >= 0 ? 'Left' : 'Right';
  4527. },
  4528. _decodePolyline: function (routeGeometry) {
  4529. var cs = polyline.decode(routeGeometry, this.options.polylinePrecision),
  4530. result = new Array(cs.length),
  4531. i;
  4532. for (i = cs.length - 1; i >= 0; i--) {
  4533. result[i] = L.latLng(cs[i]);
  4534. }
  4535. return result;
  4536. },
  4537. _toWaypoints: function (inputWaypoints, vias) {
  4538. var wps = [],
  4539. i,
  4540. viaLoc;
  4541. for (i = 0; i < vias.length; i++) {
  4542. viaLoc = vias[i].location;
  4543. wps.push(new Waypoint(L.latLng(viaLoc[1], viaLoc[0]),
  4544. inputWaypoints[i].name,
  4545. inputWaypoints[i].options));
  4546. }
  4547. return wps;
  4548. },
  4549. buildRouteUrl: function (waypoints, options) {
  4550. var locs = [],
  4551. hints = [],
  4552. wp,
  4553. latLng,
  4554. computeInstructions,
  4555. computeAlternative = true;
  4556. for (var i = 0; i < waypoints.length; i++) {
  4557. wp = waypoints[i];
  4558. latLng = wp.latLng;
  4559. locs.push(latLng.lng + ',' + latLng.lat);
  4560. hints.push(this._hints.locations[this._locationKey(latLng)] || '');
  4561. }
  4562. computeInstructions =
  4563. true;
  4564. return this.options.serviceUrl + '/' + this.options.profile + '/' +
  4565. locs.join(';') + '?' +
  4566. (options.geometryOnly ? (options.simplifyGeometry ? '' : 'overview=full') : 'overview=false') +
  4567. '&alternatives=' + computeAlternative.toString() +
  4568. '&steps=' + computeInstructions.toString() +
  4569. (this.options.useHints ? '&hints=' + hints.join(';') : '') +
  4570. (options.allowUTurns ? '&continue_straight=' + !options.allowUTurns : '');
  4571. },
  4572. _locationKey: function (location) {
  4573. return location.lat + ',' + location.lng;
  4574. },
  4575. _saveHintData: function (actualWaypoints, waypoints) {
  4576. var loc;
  4577. this._hints = {
  4578. locations: {}
  4579. };
  4580. for (var i = actualWaypoints.length - 1; i >= 0; i--) {
  4581. loc = waypoints[i].latLng;
  4582. this._hints.locations[this._locationKey(loc)] = actualWaypoints[i].hint;
  4583. }
  4584. },
  4585. });
  4586. })();
  4587. }).call(this, typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
  4588. }, {
  4589. "./waypoint": 23,
  4590. "corslite": 1,
  4591. "osrm-text-instructions": 2,
  4592. "polyline": 9
  4593. }],
  4594. 22: [function (_dereq_, module, exports) {
  4595. (function (global) {
  4596. (function () {
  4597. 'use strict';
  4598. var L = (typeof window !== "undefined" ? window.L : typeof global !== "undefined" ? global.L : null);
  4599. var GeocoderElement = _dereq_('./geocoder-element');
  4600. var Waypoint = _dereq_('./waypoint');
  4601. module.exports = (L.Layer || L.Class).extend({
  4602. includes: L.Mixin.Events,
  4603. options: {
  4604. dragStyles: [{
  4605. color: 'black',
  4606. opacity: 0.15,
  4607. weight: 9
  4608. },
  4609. {
  4610. color: 'white',
  4611. opacity: 0.8,
  4612. weight: 6
  4613. },
  4614. {
  4615. color: 'red',
  4616. opacity: 1,
  4617. weight: 2,
  4618. dashArray: '7,12'
  4619. }
  4620. ],
  4621. draggableWaypoints: true,
  4622. routeWhileDragging: false,
  4623. addWaypoints: true,
  4624. reverseWaypoints: false,
  4625. addButtonClassName: '',
  4626. language: 'en',
  4627. createGeocoderElement: function (wp, i, nWps, plan) {
  4628. return new GeocoderElement(wp, i, nWps, plan);
  4629. },
  4630. createMarker: function (i, wp, wl) {
  4631. var options = {
  4632. draggable: this.draggableWaypoints
  4633. };
  4634. if (i == 0) {
  4635. options.icon = L.icon({
  4636. iconUrl: L.DefaultImagePath + '/ico_p_2.png',
  4637. iconSize: [25, 25],
  4638. iconAnchor: [12, 25],
  4639. popupAnchor: [0, -25]
  4640. });
  4641. } else if (i !== (wl - 1)) {
  4642. options.icon = L.icon({
  4643. iconUrl: L.DefaultImagePath + '/ico_p_4.png',
  4644. iconSize: [25, 25],
  4645. iconAnchor: [12, 25],
  4646. popupAnchor: [0, -25]
  4647. });
  4648. } else {
  4649. options.icon = L.icon({
  4650. iconUrl: L.DefaultImagePath + '/ico_p_1.png',
  4651. iconSize: [25, 25],
  4652. iconAnchor: [12, 25],
  4653. popupAnchor: [0, -25]
  4654. });
  4655. }
  4656. var marker = L.marker(wp.latLng, options);
  4657. marker.bindPopup('<p>' + wp.latLng.lng + '<br/>' + wp.latLng.lat + '</p>')
  4658. return marker;
  4659. },
  4660. geocodersClassName: ''
  4661. },
  4662. initialize: function (waypoints, options) {
  4663. L.Util.setOptions(this, options);
  4664. this._waypoints = [];
  4665. this.setWaypoints(waypoints);
  4666. },
  4667. isReady: function () {
  4668. var i;
  4669. for (i = 0; i < this._waypoints.length; i++) {
  4670. if (!this._waypoints[i].latLng) {
  4671. return false;
  4672. }
  4673. }
  4674. return true;
  4675. },
  4676. getWaypoints: function () {
  4677. var i,
  4678. wps = [];
  4679. for (i = 0; i < this._waypoints.length; i++) {
  4680. wps.push(this._waypoints[i]);
  4681. }
  4682. return wps;
  4683. },
  4684. setWaypoints: function (waypoints) {
  4685. var args = [0, this._waypoints.length].concat(waypoints);
  4686. this.spliceWaypoints.apply(this, args);
  4687. return this;
  4688. },
  4689. spliceWaypoints: function () {
  4690. var args = [arguments[0], arguments[1]],
  4691. i;
  4692. for (i = 2; i < arguments.length; i++) {
  4693. args.push(arguments[i] && arguments[i].hasOwnProperty('latLng') ? arguments[i] : new Waypoint(arguments[i]));
  4694. }
  4695. [].splice.apply(this._waypoints, args);
  4696. // Make sure there's always at least two waypoints
  4697. while (this._waypoints.length < 2) {
  4698. this.spliceWaypoints(this._waypoints.length, 0, null);
  4699. }
  4700. this._updateMarkers();
  4701. this._fireChanged.apply(this, args);
  4702. },
  4703. onAdd: function (map) {
  4704. this._map = map;
  4705. this._updateMarkers();
  4706. },
  4707. onRemove: function () {
  4708. var i;
  4709. this._removeMarkers();
  4710. if (this._newWp) {
  4711. for (i = 0; i < this._newWp.lines.length; i++) {
  4712. this._map.removeLayer(this._newWp.lines[i]);
  4713. }
  4714. }
  4715. delete this._map;
  4716. },
  4717. createGeocoders: function () {
  4718. var container = L.DomUtil.create('div', 'leaflet-routing-geocoders ' + this.options.geocodersClassName),
  4719. waypoints = this._waypoints,
  4720. addWpBtn,
  4721. reverseBtn;
  4722. this._geocoderContainer = container;
  4723. this._geocoderElems = [];
  4724. if (this.options.addWaypoints) {
  4725. addWpBtn = L.DomUtil.create('button', 'leaflet-routing-add-waypoint ' + this.options.addButtonClassName, container);
  4726. addWpBtn.setAttribute('type', 'button');
  4727. L.DomEvent.addListener(addWpBtn, 'click', function () {
  4728. this.spliceWaypoints(waypoints.length, 0, null);
  4729. }, this);
  4730. }
  4731. if (this.options.reverseWaypoints) {
  4732. reverseBtn = L.DomUtil.create('button', 'leaflet-routing-reverse-waypoints', container);
  4733. reverseBtn.setAttribute('type', 'button');
  4734. L.DomEvent.addListener(reverseBtn, 'click', function () {
  4735. this._waypoints.reverse();
  4736. this.setWaypoints(this._waypoints);
  4737. }, this);
  4738. }
  4739. this._updateGeocoders();
  4740. this.on('waypointsspliced', this._updateGeocoders);
  4741. return container;
  4742. },
  4743. _createGeocoder: function (i) {
  4744. var geocoder = this.options.createGeocoderElement(this._waypoints[i], i, this._waypoints.length, this.options);
  4745. geocoder
  4746. .on('delete', function () {
  4747. if (i > 0 || this._waypoints.length > 2) {
  4748. this.spliceWaypoints(i, 1);
  4749. } else {
  4750. this.spliceWaypoints(i, 1, new Waypoint());
  4751. }
  4752. }, this)
  4753. .on('geocoded', function (e) {
  4754. this._updateMarkers();
  4755. this._fireChanged();
  4756. this._focusGeocoder(i + 1);
  4757. this.fire('waypointgeocoded', {
  4758. waypointIndex: i,
  4759. waypoint: e.waypoint
  4760. });
  4761. }, this)
  4762. .on('reversegeocoded', function (e) {
  4763. this.fire('waypointgeocoded', {
  4764. waypointIndex: i,
  4765. waypoint: e.waypoint
  4766. });
  4767. }, this);
  4768. return geocoder;
  4769. },
  4770. _updateGeocoders: function () {
  4771. var elems = [],
  4772. i,
  4773. geocoderElem;
  4774. for (i = 0; i < this._geocoderElems.length; i++) {
  4775. this._geocoderContainer.removeChild(this._geocoderElems[i].getContainer());
  4776. }
  4777. for (i = this._waypoints.length - 1; i >= 0; i--) {
  4778. geocoderElem = this._createGeocoder(i);
  4779. this._geocoderContainer.insertBefore(geocoderElem.getContainer(), this._geocoderContainer.firstChild);
  4780. elems.push(geocoderElem);
  4781. }
  4782. this._geocoderElems = elems.reverse();
  4783. },
  4784. _removeMarkers: function () {
  4785. var i;
  4786. if (this._markers) {
  4787. for (i = 0; i < this._markers.length; i++) {
  4788. if (this._markers[i]) {
  4789. this._map.removeLayer(this._markers[i]);
  4790. }
  4791. }
  4792. }
  4793. this._markers = [];
  4794. },
  4795. _updateMarkers: function () {
  4796. var i,
  4797. m;
  4798. if (!this._map) {
  4799. return;
  4800. }
  4801. this._removeMarkers();
  4802. for (i = 0; i < this._waypoints.length; i++) {
  4803. if (this._waypoints[i].latLng) {
  4804. m = this.options.createMarker(i, this._waypoints[i], this._waypoints.length);
  4805. if (m) {
  4806. m.addTo(this._map);
  4807. if (this.options.draggableWaypoints) {
  4808. this._hookWaypointEvents(m, i);
  4809. }
  4810. }
  4811. } else {
  4812. m = null;
  4813. }
  4814. this._markers.push(m);
  4815. }
  4816. },
  4817. _fireChanged: function () {
  4818. this.fire('waypointschanged', {
  4819. waypoints: this.getWaypoints()
  4820. });
  4821. if (arguments.length >= 2) {
  4822. this.fire('waypointsspliced', {
  4823. index: Array.prototype.shift.call(arguments),
  4824. nRemoved: Array.prototype.shift.call(arguments),
  4825. added: arguments
  4826. });
  4827. }
  4828. },
  4829. _hookWaypointEvents: function (m, i, trackMouseMove) {
  4830. var eventLatLng = function (e) {
  4831. return trackMouseMove ? e.latlng : e.target.getLatLng();
  4832. },
  4833. dragStart = L.bind(function (e) {
  4834. this.fire('waypointdragstart', {
  4835. index: i,
  4836. latlng: eventLatLng(e)
  4837. });
  4838. }, this),
  4839. drag = L.bind(function (e) {
  4840. this._waypoints[i].latLng = eventLatLng(e);
  4841. this.fire('waypointdrag', {
  4842. index: i,
  4843. latlng: eventLatLng(e)
  4844. });
  4845. }, this),
  4846. dragEnd = L.bind(function (e) {
  4847. this._waypoints[i].latLng = eventLatLng(e);
  4848. this._waypoints[i].name = '';
  4849. if (this._geocoderElems) {
  4850. this._geocoderElems[i].update(true);
  4851. }
  4852. this.fire('waypointdragend', {
  4853. index: i,
  4854. latlng: eventLatLng(e)
  4855. });
  4856. this._fireChanged();
  4857. }, this),
  4858. mouseMove,
  4859. mouseUp;
  4860. if (trackMouseMove) {
  4861. mouseMove = L.bind(function (e) {
  4862. this._markers[i].setLatLng(e.latlng);
  4863. drag(e);
  4864. }, this);
  4865. mouseUp = L.bind(function (e) {
  4866. this._map.dragging.enable();
  4867. this._map.off('mouseup', mouseUp);
  4868. this._map.off('mousemove', mouseMove);
  4869. dragEnd(e);
  4870. }, this);
  4871. this._map.dragging.disable();
  4872. this._map.on('mousemove', mouseMove);
  4873. this._map.on('mouseup', mouseUp);
  4874. dragStart({
  4875. latlng: this._waypoints[i].latLng
  4876. });
  4877. } else {
  4878. m.on('dragstart', dragStart);
  4879. m.on('drag', drag);
  4880. m.on('dragend', dragEnd);
  4881. }
  4882. },
  4883. dragNewWaypoint: function (e) {
  4884. var newWpIndex = e.afterIndex + 1;
  4885. if (this.options.routeWhileDragging) {
  4886. this.spliceWaypoints(newWpIndex, 0, e.latlng);
  4887. this._hookWaypointEvents(this._markers[newWpIndex], newWpIndex, true);
  4888. } else {
  4889. this._dragNewWaypoint(newWpIndex, e.latlng);
  4890. }
  4891. },
  4892. _dragNewWaypoint: function (newWpIndex, initialLatLng) {
  4893. var wp = new Waypoint(initialLatLng),
  4894. prevWp = this._waypoints[newWpIndex - 1],
  4895. nextWp = this._waypoints[newWpIndex],
  4896. marker = this.options.createMarker(newWpIndex, wp, this._waypoints.length + 1),
  4897. lines = [],
  4898. draggingEnabled = this._map.dragging.enabled(),
  4899. mouseMove = L.bind(function (e) {
  4900. var i,
  4901. latLngs;
  4902. if (marker) {
  4903. marker.setLatLng(e.latlng);
  4904. }
  4905. for (i = 0; i < lines.length; i++) {
  4906. latLngs = lines[i].getLatLngs();
  4907. latLngs.splice(1, 1, e.latlng);
  4908. lines[i].setLatLngs(latLngs);
  4909. }
  4910. L.DomEvent.stop(e);
  4911. }, this),
  4912. mouseUp = L.bind(function (e) {
  4913. var i;
  4914. if (marker) {
  4915. this._map.removeLayer(marker);
  4916. }
  4917. for (i = 0; i < lines.length; i++) {
  4918. this._map.removeLayer(lines[i]);
  4919. }
  4920. this._map.off('mousemove', mouseMove);
  4921. this._map.off('mouseup', mouseUp);
  4922. this.spliceWaypoints(newWpIndex, 0, e.latlng);
  4923. if (draggingEnabled) {
  4924. this._map.dragging.enable();
  4925. }
  4926. }, this),
  4927. i;
  4928. if (marker) {
  4929. marker.addTo(this._map);
  4930. }
  4931. for (i = 0; i < this.options.dragStyles.length; i++) {
  4932. lines.push(L.polyline([prevWp.latLng, initialLatLng, nextWp.latLng],
  4933. this.options.dragStyles[i]).addTo(this._map));
  4934. }
  4935. if (draggingEnabled) {
  4936. this._map.dragging.disable();
  4937. }
  4938. this._map.on('mousemove', mouseMove);
  4939. this._map.on('mouseup', mouseUp);
  4940. },
  4941. _focusGeocoder: function (i) {
  4942. if (this._geocoderElems[i]) {
  4943. this._geocoderElems[i].focus();
  4944. } else {
  4945. document.activeElement.blur();
  4946. }
  4947. }
  4948. });
  4949. })();
  4950. }).call(this, typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
  4951. }, {
  4952. "./geocoder-element": 14,
  4953. "./waypoint": 23
  4954. }],
  4955. 23: [function (_dereq_, module, exports) {
  4956. (function (global) {
  4957. (function () {
  4958. 'use strict';
  4959. var L = (typeof window !== "undefined" ? window.L : typeof global !== "undefined" ? global.L : null);
  4960. module.exports = L.Class.extend({
  4961. options: {
  4962. allowUTurn: false,
  4963. },
  4964. initialize: function (latLng, name, options) {
  4965. L.Util.setOptions(this, options);
  4966. this.latLng = L.latLng(latLng);
  4967. this.name = name;
  4968. }
  4969. });
  4970. })();
  4971. }).call(this, typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
  4972. }, {}]
  4973. }, {}, [15]);