@twinmatrix/spatialverse-sdk-web 0.0.2 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (143) hide show
  1. package/lib/cjs/index.js +9 -9
  2. package/lib/cjs/index.js.map +1 -1
  3. package/lib/cjs/meta-atlas-sdk/3DMap/CustomThreeJsWrapper/CustomThreeJsWrapper.js +213 -294
  4. package/lib/cjs/meta-atlas-sdk/3DMap/CustomThreeJsWrapper/CustomThreeJsWrapper.js.map +1 -1
  5. package/lib/cjs/meta-atlas-sdk/3DMap/CustomThreeJsWrapper/utility/utils.js +40 -41
  6. package/lib/cjs/meta-atlas-sdk/3DMap/CustomThreeJsWrapper/utility/utils.js.map +1 -1
  7. package/lib/cjs/meta-atlas-sdk/3DMap/MainMap.js +170 -196
  8. package/lib/cjs/meta-atlas-sdk/3DMap/MainMap.js.map +1 -1
  9. package/lib/cjs/meta-atlas-sdk/MetaAtlasCore/fetch-published-json.js +167 -215
  10. package/lib/cjs/meta-atlas-sdk/MetaAtlasCore/fetch-published-json.js.map +1 -1
  11. package/lib/cjs/meta-atlas-sdk/MetaAtlasCore/fetchMapObjectsData.js +28 -30
  12. package/lib/cjs/meta-atlas-sdk/MetaAtlasCore/fetchMapObjectsData.js.map +1 -1
  13. package/lib/cjs/meta-atlas-sdk/MetaAtlasCore/meta-atlas-sdk-core.js +861 -1170
  14. package/lib/cjs/meta-atlas-sdk/MetaAtlasCore/meta-atlas-sdk-core.js.map +1 -1
  15. package/lib/cjs/meta-atlas-sdk/MetaAtlasCore/routing-core/index.js +166 -159
  16. package/lib/cjs/meta-atlas-sdk/MetaAtlasCore/routing-core/index.js.map +1 -1
  17. package/lib/cjs/meta-atlas-sdk/MetaAtlasCore/routing-core/interfaces.js +6 -6
  18. package/lib/cjs/meta-atlas-sdk/MetaAtlasCore/routing-core/interfaces.js.map +1 -1
  19. package/lib/cjs/meta-atlas-sdk/MetaAtlasCore/routing-core/mapObjectsHelper.js +6 -6
  20. package/lib/cjs/meta-atlas-sdk/MetaAtlasCore/routing-core/mapObjectsHelper.js.map +1 -1
  21. package/lib/cjs/meta-atlas-sdk/MetaAtlasCore/routing-core/routeLayers.js +3 -3
  22. package/lib/cjs/meta-atlas-sdk/MetaAtlasCore/routing-core/routeLayers.js.map +1 -1
  23. package/lib/cjs/meta-atlas-sdk/MetaAtlasCore/routing-core/routing-helpers.js +523 -610
  24. package/lib/cjs/meta-atlas-sdk/MetaAtlasCore/routing-core/routing-helpers.js.map +1 -1
  25. package/lib/cjs/meta-atlas-sdk/MetaAtlasCore/routing-core/utils.js +149 -154
  26. package/lib/cjs/meta-atlas-sdk/MetaAtlasCore/routing-core/utils.js.map +1 -1
  27. package/lib/cjs/meta-atlas-sdk/customStyles.js +2 -2
  28. package/lib/cjs/meta-atlas-sdk/customStyles.js.map +1 -1
  29. package/lib/cjs/meta-atlas-sdk/customerLayer.js +15 -29
  30. package/lib/cjs/meta-atlas-sdk/customerLayer.js.map +1 -1
  31. package/lib/cjs/meta-atlas-sdk/customerLayerVariant.js +5 -5
  32. package/lib/cjs/meta-atlas-sdk/customerLayerVariant.js.map +1 -1
  33. package/lib/cjs/meta-atlas-sdk/meta-atlas-sdk.js +809 -1033
  34. package/lib/cjs/meta-atlas-sdk/meta-atlas-sdk.js.map +1 -1
  35. package/lib/cjs/meta-atlas-sdk/utils/helpers.js +32 -49
  36. package/lib/cjs/meta-atlas-sdk/utils/helpers.js.map +1 -1
  37. package/lib/cjs/meta-atlas-sdk/utils/local-storage.js +21 -34
  38. package/lib/cjs/meta-atlas-sdk/utils/local-storage.js.map +1 -1
  39. package/lib/cjs/meta-atlas-sdk/utils/mapobjects-store.js +6 -6
  40. package/lib/cjs/meta-atlas-sdk/utils/mapobjects-store.js.map +1 -1
  41. package/lib/cjs/meta-atlas-sdk/utils/routing-store.js +6 -6
  42. package/lib/cjs/meta-atlas-sdk/utils/routing-store.js.map +1 -1
  43. package/lib/cjs/meta-atlas-sdk/utils/routing-visualizer/index.js +363 -491
  44. package/lib/cjs/meta-atlas-sdk/utils/routing-visualizer/index.js.map +1 -1
  45. package/lib/cjs/react/MetaAtlasMap.js +127 -0
  46. package/lib/cjs/react/MetaAtlasMap.js.map +1 -0
  47. package/lib/cjs/react/hooks/useDrawing/index.js +17 -18
  48. package/lib/cjs/react/hooks/useDrawing/index.js.map +1 -1
  49. package/lib/cjs/react/hooks/useFocus/index.js +48 -55
  50. package/lib/cjs/react/hooks/useFocus/index.js.map +1 -1
  51. package/lib/cjs/react/hooks/useMapEvents/index.js +40 -47
  52. package/lib/cjs/react/hooks/useMapEvents/index.js.map +1 -1
  53. package/lib/cjs/react/hooks/useMapOverlays/index.js +20 -21
  54. package/lib/cjs/react/hooks/useMapOverlays/index.js.map +1 -1
  55. package/lib/cjs/react/hooks/useMetaAtlas/index.js +77 -95
  56. package/lib/cjs/react/hooks/useMetaAtlas/index.js.map +1 -1
  57. package/lib/cjs/react/hooks/useMetaAtlas.js +78 -96
  58. package/lib/cjs/react/hooks/useMetaAtlas.js.map +1 -1
  59. package/lib/cjs/react/hooks/useRouting/index.js +21 -20
  60. package/lib/cjs/react/hooks/useRouting/index.js.map +1 -1
  61. package/lib/cjs/react/hooks/useSearch/index.js +35 -34
  62. package/lib/cjs/react/hooks/useSearch/index.js.map +1 -1
  63. package/lib/cjs/react/hooks/useStampRally/index.js +26 -23
  64. package/lib/cjs/react/hooks/useStampRally/index.js.map +1 -1
  65. package/lib/cjs/react/hooks/useStampRally/utils.js +2 -2
  66. package/lib/cjs/react/hooks/useStampRally/utils.js.map +1 -1
  67. package/lib/cjs/react/index.js +31 -31
  68. package/lib/cjs/react/index.js.map +1 -1
  69. package/lib/cjs/react/stores/useMapDataStore.js +47 -62
  70. package/lib/cjs/react/stores/useMapDataStore.js.map +1 -1
  71. package/lib/cjs/react/stores/useMetaAtlasStore.js +27 -40
  72. package/lib/cjs/react/stores/useMetaAtlasStore.js.map +1 -1
  73. package/lib/esm/index.js +3 -7
  74. package/lib/esm/index.js.map +1 -1
  75. package/lib/esm/meta-atlas-sdk/3DMap/CustomThreeJsWrapper/CustomThreeJsWrapper.js +4 -3
  76. package/lib/esm/meta-atlas-sdk/3DMap/CustomThreeJsWrapper/CustomThreeJsWrapper.js.map +1 -1
  77. package/lib/esm/meta-atlas-sdk/3DMap/CustomThreeJsWrapper/utility/utils.js +14 -12
  78. package/lib/esm/meta-atlas-sdk/3DMap/CustomThreeJsWrapper/utility/utils.js.map +1 -1
  79. package/lib/esm/meta-atlas-sdk/3DMap/MainMap.js +204 -200
  80. package/lib/esm/meta-atlas-sdk/3DMap/MainMap.js.map +1 -1
  81. package/lib/esm/meta-atlas-sdk/MetaAtlasCore/fetch-published-json.js +6 -6
  82. package/lib/esm/meta-atlas-sdk/MetaAtlasCore/fetch-published-json.js.map +1 -1
  83. package/lib/esm/meta-atlas-sdk/MetaAtlasCore/fetchMapObjectsData.js +4 -3
  84. package/lib/esm/meta-atlas-sdk/MetaAtlasCore/fetchMapObjectsData.js.map +1 -1
  85. package/lib/esm/meta-atlas-sdk/MetaAtlasCore/meta-atlas-sdk-core.js +53 -42
  86. package/lib/esm/meta-atlas-sdk/MetaAtlasCore/meta-atlas-sdk-core.js.map +1 -1
  87. package/lib/esm/meta-atlas-sdk/MetaAtlasCore/routing-core/index.js +18 -16
  88. package/lib/esm/meta-atlas-sdk/MetaAtlasCore/routing-core/index.js.map +1 -1
  89. package/lib/esm/meta-atlas-sdk/MetaAtlasCore/routing-core/mapObjectsHelper.js +3 -3
  90. package/lib/esm/meta-atlas-sdk/MetaAtlasCore/routing-core/mapObjectsHelper.js.map +1 -1
  91. package/lib/esm/meta-atlas-sdk/MetaAtlasCore/routing-core/routing-helpers.js +73 -79
  92. package/lib/esm/meta-atlas-sdk/MetaAtlasCore/routing-core/routing-helpers.js.map +1 -1
  93. package/lib/esm/meta-atlas-sdk/MetaAtlasCore/routing-core/utils.js +16 -15
  94. package/lib/esm/meta-atlas-sdk/MetaAtlasCore/routing-core/utils.js.map +1 -1
  95. package/lib/esm/meta-atlas-sdk/customerLayer.js +4 -1
  96. package/lib/esm/meta-atlas-sdk/customerLayer.js.map +1 -1
  97. package/lib/esm/meta-atlas-sdk/meta-atlas-sdk.js +148 -124
  98. package/lib/esm/meta-atlas-sdk/meta-atlas-sdk.js.map +1 -1
  99. package/lib/esm/meta-atlas-sdk/utils/helpers.js +4 -2
  100. package/lib/esm/meta-atlas-sdk/utils/helpers.js.map +1 -1
  101. package/lib/esm/meta-atlas-sdk/utils/local-storage.js +6 -1
  102. package/lib/esm/meta-atlas-sdk/utils/local-storage.js.map +1 -1
  103. package/lib/esm/meta-atlas-sdk/utils/routing-visualizer/index.js +115 -109
  104. package/lib/esm/meta-atlas-sdk/utils/routing-visualizer/index.js.map +1 -1
  105. package/lib/esm/react/MetaAtlasMap.js +120 -0
  106. package/lib/esm/react/MetaAtlasMap.js.map +1 -0
  107. package/lib/esm/react/hooks/useDrawing/index.js +2 -2
  108. package/lib/esm/react/hooks/useDrawing/index.js.map +1 -1
  109. package/lib/esm/react/hooks/useFocus/index.js +4 -3
  110. package/lib/esm/react/hooks/useFocus/index.js.map +1 -1
  111. package/lib/esm/react/hooks/useMapEvents/index.js +9 -6
  112. package/lib/esm/react/hooks/useMapEvents/index.js.map +1 -1
  113. package/lib/esm/react/hooks/useMapOverlays/index.js +2 -2
  114. package/lib/esm/react/hooks/useMapOverlays/index.js.map +1 -1
  115. package/lib/esm/react/hooks/useMetaAtlas/index.js +162 -60
  116. package/lib/esm/react/hooks/useMetaAtlas/index.js.map +1 -1
  117. package/lib/esm/react/hooks/useMetaAtlas.js +162 -60
  118. package/lib/esm/react/hooks/useMetaAtlas.js.map +1 -1
  119. package/lib/esm/react/hooks/useRouting/index.js +2 -2
  120. package/lib/esm/react/hooks/useRouting/index.js.map +1 -1
  121. package/lib/esm/react/hooks/useSearch/index.js +2 -2
  122. package/lib/esm/react/hooks/useSearch/index.js.map +1 -1
  123. package/lib/esm/react/hooks/useStampRally/index.js +15 -12
  124. package/lib/esm/react/hooks/useStampRally/index.js.map +1 -1
  125. package/lib/esm/react/hooks/useStampRally/utils.js +1 -1
  126. package/lib/esm/react/hooks/useStampRally/utils.js.map +1 -1
  127. package/lib/esm/react/index.js +11 -15
  128. package/lib/esm/react/index.js.map +1 -1
  129. package/lib/esm/react/stores/useMapDataStore.js +17 -21
  130. package/lib/esm/react/stores/useMapDataStore.js.map +1 -1
  131. package/lib/types/meta-atlas-sdk/3DMap/CustomThreeJsWrapper/utility/CameraSync.d.ts +30 -0
  132. package/lib/types/meta-atlas-sdk/3DMap/CustomThreeJsWrapper/utility/CameraSync.d.ts.map +1 -0
  133. package/lib/types/meta-atlas-sdk/3DMap/CustomThreeJsWrapper/utility/CameraUtils.d.ts +5 -0
  134. package/lib/types/meta-atlas-sdk/3DMap/CustomThreeJsWrapper/utility/CameraUtils.d.ts.map +1 -0
  135. package/lib/types/meta-atlas-sdk/3DMap/CustomThreeJsWrapper/utility/constants.d.ts +21 -0
  136. package/lib/types/meta-atlas-sdk/3DMap/CustomThreeJsWrapper/utility/constants.d.ts.map +1 -0
  137. package/lib/types/meta-atlas-sdk/3DMap/CustomThreeJsWrapper/utility/suncalc.d.ts +27 -0
  138. package/lib/types/meta-atlas-sdk/3DMap/CustomThreeJsWrapper/utility/suncalc.d.ts.map +1 -0
  139. package/lib/types/meta-atlas-sdk/mapbox_draw_custom_modes/draw_marker.d.ts +18 -0
  140. package/lib/types/meta-atlas-sdk/mapbox_draw_custom_modes/draw_marker.d.ts.map +1 -0
  141. package/lib/types/meta-atlas-sdk/mapbox_draw_custom_modes/marker_select.d.ts +37 -0
  142. package/lib/types/meta-atlas-sdk/mapbox_draw_custom_modes/marker_select.d.ts.map +1 -0
  143. package/package.json +10 -7
@@ -20,24 +20,16 @@ var _helpers = require("@turf/helpers");
20
20
  var _length = _interopRequireDefault(require("@turf/length"));
21
21
  var _turf = require("@turf/turf");
22
22
  var _lodash = require("lodash");
23
- var _interfaces = require("./interfaces");
24
- var _ = _interopRequireDefault(require("."));
25
- var _mapObjectsHelper = require("./mapObjectsHelper");
26
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
27
- function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
28
- function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
29
- function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
30
- function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
31
- function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
32
- function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
33
- function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
34
- function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
23
+ var _interfaces = require("./interfaces.js");
24
+ var _index = _interopRequireDefault(require("./index.js"));
25
+ var _mapObjectsHelper = require("./mapObjectsHelper.js");
26
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
35
27
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
36
28
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
37
29
  function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
38
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
39
- function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
40
- var ManeuverType = exports.ManeuverType = /*#__PURE__*/function (ManeuverType) {
30
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
31
+ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
32
+ let ManeuverType = exports.ManeuverType = /*#__PURE__*/function (ManeuverType) {
41
33
  ManeuverType["RouteOverview"] = "Route Overview";
42
34
  ManeuverType["SectionOverview"] = "Section Overview";
43
35
  ManeuverType["LeftHairPinTurn"] = "Left hairpin turn";
@@ -54,9 +46,9 @@ var ManeuverType = exports.ManeuverType = /*#__PURE__*/function (ManeuverType) {
54
46
  return ManeuverType;
55
47
  }({});
56
48
  function createDefaultSegment(pathSegment) {
57
- var startMapObj = (0, _mapObjectsHelper.getEdge)(pathSegment.edges[0]);
58
- var endMapObj = (0, _mapObjectsHelper.getEdge)(pathSegment.edges[1]);
59
- var segment = {
49
+ const startMapObj = (0, _mapObjectsHelper.getEdge)(pathSegment.edges[0]);
50
+ const endMapObj = (0, _mapObjectsHelper.getEdge)(pathSegment.edges[1]);
51
+ const segment = {
60
52
  maneuverType: ManeuverType.Static,
61
53
  coordinates: [],
62
54
  distance: 0,
@@ -88,8 +80,8 @@ function isOverviewSegment(segment) {
88
80
  return segment.maneuverType === ManeuverType.RouteOverview || segment.maneuverType === ManeuverType.SectionOverview;
89
81
  }
90
82
  function updateFeatureHighlightState(features, isHighlighted) {
91
- for (var index = 0; index < features.length; index += 1) {
92
- var feature = features[index];
83
+ for (let index = 0; index < features.length; index += 1) {
84
+ const feature = features[index];
93
85
  if (isHighlighted) {
94
86
  feature.properties.highlight = true;
95
87
  } else {
@@ -99,9 +91,9 @@ function updateFeatureHighlightState(features, isHighlighted) {
99
91
  return features;
100
92
  }
101
93
  function highlightRouteSegment(pathFeatures, segmentToHighlight) {
102
- var highlightNodeOnly = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
103
- for (var index = 0; index < pathFeatures.length; index += 1) {
104
- var segment = pathFeatures[index];
94
+ let highlightNodeOnly = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
95
+ for (let index = 0; index < pathFeatures.length; index += 1) {
96
+ const segment = pathFeatures[index];
105
97
  if (segment.properties.segmentNumber === segmentToHighlight) {
106
98
  if (highlightNodeOnly) {
107
99
  if (segment.properties.startPoint === true) {
@@ -117,53 +109,53 @@ function highlightRouteSegment(pathFeatures, segmentToHighlight) {
117
109
  return pathFeatures;
118
110
  }
119
111
  function getRouteNode(coordinates, segmentNumber, isHighlighted, patchNumber) {
120
- var whereDimension = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : '';
112
+ let whereDimension = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : '';
121
113
  if (coordinates.length === 0) {
122
114
  return [];
123
115
  }
124
- var properties = {
125
- segmentNumber: segmentNumber,
116
+ const properties = {
117
+ segmentNumber,
126
118
  dimension_where: whereDimension,
127
- patchNumber: patchNumber,
119
+ patchNumber,
128
120
  isNode: true
129
121
  };
130
- var node = (0, _helpers.point)(coordinates, properties);
131
- var features = [node];
122
+ const node = (0, _helpers.point)(coordinates, properties);
123
+ const features = [node];
132
124
  updateFeatureHighlightState(features, isHighlighted);
133
125
  return features;
134
126
  }
135
127
  function getRouteLine(coordinates, segmentNumber, isHighlighted, patchNumber, zone) {
136
- var whereDimension = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : '';
128
+ let whereDimension = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : '';
137
129
  if (coordinates.length === 0) {
138
130
  return [];
139
131
  }
140
- var properties = {
141
- segmentNumber: segmentNumber,
132
+ const properties = {
133
+ segmentNumber,
142
134
  dimension_where: whereDimension,
143
- patchNumber: patchNumber,
135
+ patchNumber,
144
136
  isNode: false,
145
- zone: zone
137
+ zone
146
138
  };
147
139
  // const curved = smooth(coordinates, {iteration: 1});
148
- var line = (0, _helpers.lineString)(coordinates, _objectSpread(_objectSpread({}, properties), {}, {
140
+ const line = (0, _helpers.lineString)(coordinates, _objectSpread(_objectSpread({}, properties), {}, {
149
141
  featureBelongsToLineString: true
150
142
  }));
151
- var startPoint = (0, _helpers.point)(coordinates[0], _objectSpread(_objectSpread({}, properties), {}, {
143
+ const startPoint = (0, _helpers.point)(coordinates[0], _objectSpread(_objectSpread({}, properties), {}, {
152
144
  featureBelongsToLineString: false
153
145
  }));
154
- var endPoint = (0, _helpers.point)(coordinates[coordinates.length - 1], _objectSpread(_objectSpread({}, properties), {}, {
146
+ const endPoint = (0, _helpers.point)(coordinates[coordinates.length - 1], _objectSpread(_objectSpread({}, properties), {}, {
155
147
  featureBelongsToLineString: false
156
148
  }));
157
- var features = [];
149
+ const features = [];
158
150
  features.push(startPoint, line, endPoint);
159
151
  updateFeatureHighlightState(features, isHighlighted);
160
152
  return features;
161
153
  }
162
154
  function getLineStringFeaturesOfRouteSegment(routeSegment) {
163
- var whereDimension = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
164
- var lineFeatures = [];
165
- for (var index = 0; index < routeSegment.features.length; index += 1) {
166
- var feature = routeSegment.features[index];
155
+ let whereDimension = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
156
+ const lineFeatures = [];
157
+ for (let index = 0; index < routeSegment.features.length; index += 1) {
158
+ const feature = routeSegment.features[index];
167
159
  if (feature.properties.featureBelongsToLineString) {
168
160
  if (whereDimension !== '') {
169
161
  if (feature.properties.dimension_where && feature.properties.dimension_where === whereDimension) {
@@ -177,9 +169,9 @@ function getLineStringFeaturesOfRouteSegment(routeSegment) {
177
169
  return lineFeatures;
178
170
  }
179
171
  function generateOverviewSegment(route) {
180
- var indexOffset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
181
- var overviewSegment = (0, _lodash.cloneDeep)(route.segments[1]);
182
- var initialWhereDimension = route.segments.length > 1 ? route.segments[1].startEdge.whereDimension : '';
172
+ let indexOffset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
173
+ const overviewSegment = (0, _lodash.cloneDeep)(route.segments[1]);
174
+ const initialWhereDimension = route.segments.length > 1 ? route.segments[1].startEdge.whereDimension : '';
183
175
  overviewSegment.coordinates = [];
184
176
  overviewSegment.features = [];
185
177
  overviewSegment.time = 0;
@@ -188,14 +180,14 @@ function generateOverviewSegment(route) {
188
180
  overviewSegment.maneuverType = ManeuverType.RouteOverview;
189
181
  overviewSegment.patchNumber = indexOffset;
190
182
  overviewSegment.instructions = ['Overview'];
191
- for (var index = 1; index < route.segments.length; index += 1) {
183
+ for (let index = 1; index < route.segments.length; index += 1) {
192
184
  if (route.segments[index].maneuverType !== ManeuverType.SectionOverview) {
193
- for (var j = 0; j < route.segments[index].coordinates.length; j += 1) {
194
- var coord = route.segments[index].coordinates[j];
185
+ for (let j = 0; j < route.segments[index].coordinates.length; j += 1) {
186
+ const coord = route.segments[index].coordinates[j];
195
187
  overviewSegment.coordinates.push(coord);
196
188
  }
197
- for (var _j = 0; _j < route.segments[index].features.length; _j += 1) {
198
- var feature = (0, _lodash.cloneDeep)(route.segments[index].features[_j]);
189
+ for (let j = 0; j < route.segments[index].features.length; j += 1) {
190
+ const feature = (0, _lodash.cloneDeep)(route.segments[index].features[j]);
199
191
  if (feature.properties && !feature.properties.isNode) {
200
192
  // isNonHighlightedOverview is used in layer styling to decide the color of lines
201
193
  // features which are not on initialWhereDimension should be colored accordingly
@@ -213,551 +205,472 @@ function generateOverviewSegment(route) {
213
205
  overviewSegment.distance = route.walkingDistance + route.transportDistance;
214
206
  return overviewSegment;
215
207
  }
216
- function createRoute(_x, _x2, _x3) {
217
- return _createRoute.apply(this, arguments);
218
- }
219
- function _createRoute() {
220
- _createRoute = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(startMapObjectId, endMapObjectId, wheelChairAccessibleRouteOnly) {
221
- var shouldAddOverviewSegment,
222
- indexOffset,
223
- path,
224
- pathSegments,
225
- optimizedPath,
226
- endSegment,
227
- segmentIndex,
228
- pathSegment,
229
- currentZone,
230
- _path,
231
- lastManeuverType,
232
- firstSegment,
233
- prevPathSegment,
234
- prevZone,
235
- prevPath,
236
- pathPoint,
237
- index,
238
- startPoint,
239
- midPoint,
240
- endPoint,
241
- currentManeuverType,
242
- _pathPoint,
243
- _pathPoint2,
244
- removeExtraChangeZoneSegment,
245
- lastSegmentAdded,
246
- immigrationPolygonFeatures,
247
- line,
248
- _index,
249
- immigrationPolygonFeature,
250
- intersects,
251
- lineBeforeImmigration,
252
- lengthOfLineBeforeImmigration,
253
- segmentBeforeImmigration,
254
- coordsOfLastSegment,
255
- secondLastSegmentAdded,
256
- immigrationLine,
257
- immigrationSegment,
258
- lineCoords,
259
- lineAfterImmigration,
260
- segmentAfterImmigration,
261
- startPointWithinPolygon,
262
- _immigrationLine,
263
- _immigrationSegment,
264
- changeZoneSegment,
265
- _secondLastSegmentAdded,
266
- _lineCoords,
267
- _lineAfterImmigration,
268
- _segmentAfterImmigration,
269
- previousLine,
270
- _lineCoords2,
271
- _lineAfterImmigration2,
272
- _segmentAfterImmigration2,
273
- enterPortalSegment,
274
- exitPortalSegment,
275
- _lastSegmentAdded2,
276
- travelPortalSegment,
277
- route,
278
- addOverviewSegment,
279
- initialIndex,
280
- dummySegment,
281
- patchNumber,
282
- whereDimension,
283
- _index2,
284
- highlight,
285
- segment,
286
- segmentNumber,
287
- routeSegmentCoords,
288
- segmentDistance,
289
- startEdgeFeatures,
290
- features,
291
- _iterator,
292
- _step,
293
- feature,
294
- _nextRouteSegment,
295
- portalCost,
296
- _portalCost,
297
- _segmentDistance,
298
- nextRouteSegment,
299
- overviewSegment,
300
- _args = arguments;
301
- return _regenerator().w(function (_context) {
302
- while (1) switch (_context.n) {
303
- case 0:
304
- shouldAddOverviewSegment = _args.length > 3 && _args[3] !== undefined ? _args[3] : true;
305
- indexOffset = _args.length > 4 && _args[4] !== undefined ? _args[4] : 0;
306
- path = _["default"].getRoute(startMapObjectId, endMapObjectId, wheelChairAccessibleRouteOnly);
307
- pathSegments = path.routes; // Find optimized path (i.e. combine straight segments) & maneuvers list
308
- optimizedPath = [];
309
- for (segmentIndex = 0; pathSegments && segmentIndex < pathSegments.length; segmentIndex += 1) {
310
- pathSegment = pathSegments[segmentIndex];
311
- currentZone = pathSegment.geojson.properties.zone;
312
- if (!pathSegment.isPortal) {
313
- _path = pathSegment.geojson.geometry.coordinates; // Reset state for each segment of the path
314
- lastManeuverType = ManeuverType.Static; // Only add the starting static node for the very first node of route
315
- if (optimizedPath.length === 0) {
316
- firstSegment = _objectSpread(_objectSpread({}, createDefaultSegment(pathSegment)), {}, {
317
- maneuverType: ManeuverType.Static,
318
- coordinates: [_path[0]]
319
- });
320
- optimizedPath.push(firstSegment);
321
- }
322
- if (segmentIndex > 0 && optimizedPath.length > 0) {
323
- prevPathSegment = pathSegments[segmentIndex - 1];
324
- prevZone = prevPathSegment.geojson.properties.zone;
325
- if (currentZone !== prevZone) {
326
- prevPath = prevPathSegment.geojson.geometry.coordinates;
327
- pathPoint = _objectSpread(_objectSpread({}, createDefaultSegment(prevPathSegment)), {}, {
328
- maneuverType: ManeuverType.ChangeZone,
329
- zone: currentZone,
330
- coordinates: [prevPath[prevPath.length - 1]]
331
- });
332
- optimizedPath.push(pathPoint);
333
- lastManeuverType = ManeuverType.ChangeZone;
334
- }
335
- }
336
- if (_path.length > 2) {
337
- for (index = 0; index < _path.length - 2; index += 1) {
338
- startPoint = _path[index];
339
- midPoint = _path[index + 1];
340
- endPoint = _path[index + 2]; // Keep updating endSegment on each iteration
341
- endSegment = _objectSpread(_objectSpread({}, createDefaultSegment(pathSegment)), {}, {
342
- maneuverType: ManeuverType.Static,
343
- coordinates: [endPoint],
344
- zone: currentZone
345
- });
208
+ async function createRoute(startMapObjectId, endMapObjectId, wheelChairAccessibleRouteOnly) {
209
+ let shouldAddOverviewSegment = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
210
+ let indexOffset = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
211
+ const path = _index.default.getRoute(startMapObjectId, endMapObjectId, wheelChairAccessibleRouteOnly);
212
+ const pathSegments = path.routes;
213
+
214
+ // Find optimized path (i.e. combine straight segments) & maneuvers list
215
+ const optimizedPath = [];
216
+ let endSegment;
217
+ for (let segmentIndex = 0; pathSegments && segmentIndex < pathSegments.length; segmentIndex += 1) {
218
+ const pathSegment = pathSegments[segmentIndex];
219
+ const currentZone = pathSegment.geojson.properties.zone;
220
+ if (!pathSegment.isPortal) {
221
+ const path = pathSegment.geojson.geometry.coordinates;
346
222
 
347
- // const line = lineString([startPoint, midPoint]);
348
- // const segmentDistance = length(line, { units: DISTANCE_UNIT });
223
+ // Reset state for each segment of the path
224
+ let lastManeuverType = ManeuverType.Static;
349
225
 
350
- // Determine the maneuver type based on the angle of the turn
351
- currentManeuverType = void 0;
352
- currentManeuverType = ManeuverType.ContinueStraight;
353
- // if ((index === 0 || index === path.length - 3) && segmentDistance < 3) {
354
- // currentManeuverType = ManeuverType.ContinueStraight;
355
- // }
356
- // else {
357
- // // Calculate the bearings between the points
358
- // const bearing1 = bearing(startPoint, midPoint);
359
- // const bearing2 = bearing(midPoint, endPoint);
226
+ // Only add the starting static node for the very first node of route
227
+ if (optimizedPath.length === 0) {
228
+ const firstSegment = _objectSpread(_objectSpread({}, createDefaultSegment(pathSegment)), {}, {
229
+ maneuverType: ManeuverType.Static,
230
+ coordinates: [path[0]]
231
+ });
232
+ optimizedPath.push(firstSegment);
233
+ }
234
+ if (segmentIndex > 0 && optimizedPath.length > 0) {
235
+ const prevPathSegment = pathSegments[segmentIndex - 1];
236
+ const prevZone = prevPathSegment.geojson.properties.zone;
237
+ if (currentZone !== prevZone) {
238
+ const prevPath = prevPathSegment.geojson.geometry.coordinates;
239
+ const pathPoint = _objectSpread(_objectSpread({}, createDefaultSegment(prevPathSegment)), {}, {
240
+ maneuverType: ManeuverType.ChangeZone,
241
+ zone: currentZone,
242
+ coordinates: [prevPath[prevPath.length - 1]]
243
+ });
244
+ optimizedPath.push(pathPoint);
245
+ lastManeuverType = ManeuverType.ChangeZone;
246
+ }
247
+ }
248
+ if (path.length > 2) {
249
+ for (let index = 0; index < path.length - 2; index += 1) {
250
+ const startPoint = path[index];
251
+ const midPoint = path[index + 1];
252
+ const endPoint = path[index + 2];
360
253
 
361
- // // Calculate the angle between the bearings
362
- // let angle = bearing2 - bearing1;
363
- // if (angle < -180) {
364
- // angle += 360;
365
- // } else if (angle > 180) {
366
- // angle -= 360;
367
- // }
254
+ // Keep updating endSegment on each iteration
255
+ endSegment = _objectSpread(_objectSpread({}, createDefaultSegment(pathSegment)), {}, {
256
+ maneuverType: ManeuverType.Static,
257
+ coordinates: [endPoint],
258
+ zone: currentZone
259
+ });
368
260
 
369
- // if (angle < -140) {
370
- // currentManeuverType = ManeuverType.LeftHairPinTurn;
371
- // } else if (angle > 140) {
372
- // currentManeuverType = ManeuverType.RightHairPinTurn;
373
- // } else if (angle < -50) {
374
- // currentManeuverType = ManeuverType.LeftTurn;
375
- // } else if (angle > 50) {
376
- // currentManeuverType = ManeuverType.RightTurn;
377
- // // } else if (angle < -10) {
378
- // // currentManeuverType = 'Veer left';
379
- // // } else if (angle > 10) {
380
- // // currentManeuverType = 'Veer right';
381
- // } else {
382
- // currentManeuverType = ManeuverType.ContinueStraight;
383
- // }
384
- // }
385
- _pathPoint = _objectSpread(_objectSpread({}, createDefaultSegment(pathSegment)), {}, {
386
- maneuverType: currentManeuverType,
387
- zone: currentZone
388
- });
389
- if (lastManeuverType === ManeuverType.ContinueStraight) {
390
- // If last iteration of loop then use the end point as segment end else use mid point
391
- // Use index + 3 because last two points are skipped by loop
392
- if (index + 3 === _path.length) {
393
- optimizedPath[optimizedPath.length - 1].coordinates.push(midPoint, endPoint);
394
- } else {
395
- optimizedPath[optimizedPath.length - 1].coordinates.push(midPoint);
396
- }
397
- optimizedPath[optimizedPath.length - 1].maneuverType = currentManeuverType;
398
- } else {
399
- _pathPoint.coordinates.push(startPoint, midPoint);
400
- optimizedPath.push(_pathPoint);
261
+ // const line = lineString([startPoint, midPoint]);
262
+ // const segmentDistance = length(line, { units: DISTANCE_UNIT });
401
263
 
402
- // If reached end of path then add a ContinueStraight segment at end of path
403
- // Use index + 3 because last two points are skipped by loop
404
- if (index + 3 === _path.length) {
405
- // if a ContinueStraight segment was just added then extend that, else add a new ContinueStraight segment at end
406
- if (currentManeuverType === ManeuverType.ContinueStraight) {
407
- optimizedPath[optimizedPath.length - 1].coordinates.push(endPoint);
408
- } else {
409
- optimizedPath.push(_objectSpread(_objectSpread({}, createDefaultSegment(pathSegment)), {}, {
410
- maneuverType: ManeuverType.ContinueStraight,
411
- coordinates: [midPoint, endPoint],
412
- zone: currentZone
413
- }));
414
- }
415
- }
416
- }
417
- lastManeuverType = currentManeuverType;
418
- }
264
+ // Determine the maneuver type based on the angle of the turn
265
+ let currentManeuverType;
266
+ currentManeuverType = ManeuverType.ContinueStraight;
267
+ // if ((index === 0 || index === path.length - 3) && segmentDistance < 3) {
268
+ // currentManeuverType = ManeuverType.ContinueStraight;
269
+ // }
270
+ // else {
271
+ // // Calculate the bearings between the points
272
+ // const bearing1 = bearing(startPoint, midPoint);
273
+ // const bearing2 = bearing(midPoint, endPoint);
274
+
275
+ // // Calculate the angle between the bearings
276
+ // let angle = bearing2 - bearing1;
277
+ // if (angle < -180) {
278
+ // angle += 360;
279
+ // } else if (angle > 180) {
280
+ // angle -= 360;
281
+ // }
282
+
283
+ // if (angle < -140) {
284
+ // currentManeuverType = ManeuverType.LeftHairPinTurn;
285
+ // } else if (angle > 140) {
286
+ // currentManeuverType = ManeuverType.RightHairPinTurn;
287
+ // } else if (angle < -50) {
288
+ // currentManeuverType = ManeuverType.LeftTurn;
289
+ // } else if (angle > 50) {
290
+ // currentManeuverType = ManeuverType.RightTurn;
291
+ // // } else if (angle < -10) {
292
+ // // currentManeuverType = 'Veer left';
293
+ // // } else if (angle > 10) {
294
+ // // currentManeuverType = 'Veer right';
295
+ // } else {
296
+ // currentManeuverType = ManeuverType.ContinueStraight;
297
+ // }
298
+ // }
299
+
300
+ const pathPoint = _objectSpread(_objectSpread({}, createDefaultSegment(pathSegment)), {}, {
301
+ maneuverType: currentManeuverType,
302
+ zone: currentZone
303
+ });
304
+ if (lastManeuverType === ManeuverType.ContinueStraight) {
305
+ // If last iteration of loop then use the end point as segment end else use mid point
306
+ // Use index + 3 because last two points are skipped by loop
307
+ if (index + 3 === path.length) {
308
+ optimizedPath[optimizedPath.length - 1].coordinates.push(midPoint, endPoint);
309
+ } else {
310
+ optimizedPath[optimizedPath.length - 1].coordinates.push(midPoint);
311
+ }
312
+ optimizedPath[optimizedPath.length - 1].maneuverType = currentManeuverType;
313
+ } else {
314
+ pathPoint.coordinates.push(startPoint, midPoint);
315
+ optimizedPath.push(pathPoint);
316
+
317
+ // If reached end of path then add a ContinueStraight segment at end of path
318
+ // Use index + 3 because last two points are skipped by loop
319
+ if (index + 3 === path.length) {
320
+ // if a ContinueStraight segment was just added then extend that, else add a new ContinueStraight segment at end
321
+ if (currentManeuverType === ManeuverType.ContinueStraight) {
322
+ optimizedPath[optimizedPath.length - 1].coordinates.push(endPoint);
419
323
  } else {
420
- _pathPoint2 = _objectSpread(_objectSpread({}, createDefaultSegment(pathSegment)), {}, {
324
+ optimizedPath.push(_objectSpread(_objectSpread({}, createDefaultSegment(pathSegment)), {}, {
421
325
  maneuverType: ManeuverType.ContinueStraight,
422
- coordinates: _path,
326
+ coordinates: [midPoint, endPoint],
423
327
  zone: currentZone
424
- });
425
- optimizedPath.push(_pathPoint2);
328
+ }));
426
329
  }
427
- removeExtraChangeZoneSegment = function removeExtraChangeZoneSegment() {
428
- // When going from public to transit, hide the ChangeZone instruction, if the next step is PassThroughImmigration.
429
- if (optimizedPath.length > 0) {
430
- var _lastSegmentAdded = optimizedPath[optimizedPath.length - 1];
431
- if (_lastSegmentAdded.maneuverType === ManeuverType.ChangeZone) {
432
- if (_lastSegmentAdded.zone === _interfaces.Zone.Transit) optimizedPath.pop();
330
+ }
331
+ }
332
+ lastManeuverType = currentManeuverType;
333
+ }
334
+ } else {
335
+ const pathPoint = _objectSpread(_objectSpread({}, createDefaultSegment(pathSegment)), {}, {
336
+ maneuverType: ManeuverType.ContinueStraight,
337
+ coordinates: path,
338
+ zone: currentZone
339
+ });
340
+ optimizedPath.push(pathPoint);
341
+ }
342
+ const removeExtraChangeZoneSegment = () => {
343
+ // When going from public to transit, hide the ChangeZone instruction, if the next step is PassThroughImmigration.
344
+ if (optimizedPath.length > 0) {
345
+ const lastSegmentAdded = optimizedPath[optimizedPath.length - 1];
346
+ if (lastSegmentAdded.maneuverType === ManeuverType.ChangeZone) {
347
+ if (lastSegmentAdded.zone === _interfaces.Zone.Transit) optimizedPath.pop();
348
+ }
349
+ }
350
+ };
351
+ // Check if there are immigration crossings
352
+ let lastSegmentAdded = optimizedPath.length > 0 ? optimizedPath[optimizedPath.length - 1] : undefined;
353
+ if (lastSegmentAdded && lastSegmentAdded.maneuverType === ManeuverType.ContinueStraight) {
354
+ // Will add new segment, search for immigration crossings on the current non-vertical segment
355
+ const immigrationPolygonFeatures = (0, _mapObjectsHelper.getImmigrationPolygonFeaturesForWhereTaxonomy)(lastSegmentAdded.startEdge.whereDimension);
356
+ const line = (0, _helpers.lineString)(lastSegmentAdded.coordinates);
357
+ for (let index = 0; index < immigrationPolygonFeatures.length; index += 1) {
358
+ const immigrationPolygonFeature = immigrationPolygonFeatures[index];
359
+ if (!(0, _turf.booleanDisjoint)(line, immigrationPolygonFeature)) {
360
+ const intersects = (0, _turf.lineIntersect)(line, immigrationPolygonFeature);
361
+ if (intersects.features.length > 1) {
362
+ optimizedPath.pop();
363
+ const lineBeforeImmigration = (0, _turf.lineSlice)((0, _turf.getCoords)(line)[0], (0, _turf.getCoord)(intersects.features[0]), line);
364
+ const lengthOfLineBeforeImmigration = (0, _length.default)(lineBeforeImmigration, {
365
+ units: 'meters'
366
+ });
367
+ // Only add if length greater then min limit
368
+ if (lengthOfLineBeforeImmigration >= 10) {
369
+ const segmentBeforeImmigration = _objectSpread(_objectSpread({}, createDefaultSegment(pathSegment)), {}, {
370
+ maneuverType: ManeuverType.ContinueStraight,
371
+ zone: currentZone,
372
+ coordinates: (0, _turf.getCoords)(lineBeforeImmigration)
373
+ });
374
+ optimizedPath.push(segmentBeforeImmigration);
375
+ } else if (optimizedPath.length > 0) {
376
+ lastSegmentAdded = optimizedPath[optimizedPath.length - 1];
377
+ // If lastSegmentAdded is a change zone segment then move both lastSegmentAdded and also the second last segment
378
+ if (lastSegmentAdded.maneuverType === ManeuverType.ChangeZone) {
379
+ const coordsOfLastSegment = (0, _turf.getCoords)(lineBeforeImmigration);
380
+ lastSegmentAdded.coordinates = [coordsOfLastSegment[coordsOfLastSegment.length - 1]];
381
+ if (optimizedPath.length > 1) {
382
+ const secondLastSegmentAdded = optimizedPath[optimizedPath.length - 2];
383
+ secondLastSegmentAdded.coordinates = secondLastSegmentAdded.coordinates.concat((0, _turf.getCoords)(lineBeforeImmigration));
433
384
  }
385
+ } else {
386
+ lastSegmentAdded.coordinates.concat((0, _turf.getCoords)(lineBeforeImmigration));
434
387
  }
435
- }; // Check if there are immigration crossings
436
- lastSegmentAdded = optimizedPath.length > 0 ? optimizedPath[optimizedPath.length - 1] : undefined;
437
- if (lastSegmentAdded && lastSegmentAdded.maneuverType === ManeuverType.ContinueStraight) {
438
- // Will add new segment, search for immigration crossings on the current non-vertical segment
439
- immigrationPolygonFeatures = (0, _mapObjectsHelper.getImmigrationPolygonFeaturesForWhereTaxonomy)(lastSegmentAdded.startEdge.whereDimension);
440
- line = (0, _helpers.lineString)(lastSegmentAdded.coordinates);
441
- for (_index = 0; _index < immigrationPolygonFeatures.length; _index += 1) {
442
- immigrationPolygonFeature = immigrationPolygonFeatures[_index];
443
- if (!(0, _turf.booleanDisjoint)(line, immigrationPolygonFeature)) {
444
- intersects = (0, _turf.lineIntersect)(line, immigrationPolygonFeature);
445
- if (intersects.features.length > 1) {
446
- optimizedPath.pop();
447
- lineBeforeImmigration = (0, _turf.lineSlice)((0, _turf.getCoords)(line)[0], (0, _turf.getCoord)(intersects.features[0]), line);
448
- lengthOfLineBeforeImmigration = (0, _length["default"])(lineBeforeImmigration, {
449
- units: 'meters'
450
- }); // Only add if length greater then min limit
451
- if (lengthOfLineBeforeImmigration >= 10) {
452
- segmentBeforeImmigration = _objectSpread(_objectSpread({}, createDefaultSegment(pathSegment)), {}, {
453
- maneuverType: ManeuverType.ContinueStraight,
454
- zone: currentZone,
455
- coordinates: (0, _turf.getCoords)(lineBeforeImmigration)
456
- });
457
- optimizedPath.push(segmentBeforeImmigration);
458
- } else if (optimizedPath.length > 0) {
459
- lastSegmentAdded = optimizedPath[optimizedPath.length - 1];
460
- // If lastSegmentAdded is a change zone segment then move both lastSegmentAdded and also the second last segment
461
- if (lastSegmentAdded.maneuverType === ManeuverType.ChangeZone) {
462
- coordsOfLastSegment = (0, _turf.getCoords)(lineBeforeImmigration);
463
- lastSegmentAdded.coordinates = [coordsOfLastSegment[coordsOfLastSegment.length - 1]];
464
- if (optimizedPath.length > 1) {
465
- secondLastSegmentAdded = optimizedPath[optimizedPath.length - 2];
466
- secondLastSegmentAdded.coordinates = secondLastSegmentAdded.coordinates.concat((0, _turf.getCoords)(lineBeforeImmigration));
467
- }
468
- } else {
469
- lastSegmentAdded.coordinates.concat((0, _turf.getCoords)(lineBeforeImmigration));
470
- }
471
- }
472
- immigrationLine = (0, _turf.lineSlice)((0, _turf.getCoord)(intersects.features[0]), (0, _turf.getCoord)(intersects.features[1]), line);
473
- immigrationSegment = _objectSpread(_objectSpread({}, createDefaultSegment(pathSegment)), {}, {
474
- maneuverType: ManeuverType.PassThroughImmigration,
475
- zone: currentZone,
476
- coordinates: (0, _turf.getCoords)(immigrationLine)
477
- }); // The lineBeforeImmigration might not have been added due to length limit
478
- // And if lineBeforeImmigration was supposed to be the the first segment then prepend this segment with coordinates of lineBeforeImmigration
479
- if (optimizedPath.length === 0) {
480
- immigrationSegment.coordinates = lineBeforeImmigration.geometry.coordinates.concat(immigrationSegment.coordinates);
481
- }
388
+ }
389
+ const immigrationLine = (0, _turf.lineSlice)((0, _turf.getCoord)(intersects.features[0]), (0, _turf.getCoord)(intersects.features[1]), line);
390
+ const immigrationSegment = _objectSpread(_objectSpread({}, createDefaultSegment(pathSegment)), {}, {
391
+ maneuverType: ManeuverType.PassThroughImmigration,
392
+ zone: currentZone,
393
+ coordinates: (0, _turf.getCoords)(immigrationLine)
394
+ });
395
+ // The lineBeforeImmigration might not have been added due to length limit
396
+ // And if lineBeforeImmigration was supposed to be the the first segment then prepend this segment with coordinates of lineBeforeImmigration
397
+ if (optimizedPath.length === 0) {
398
+ immigrationSegment.coordinates = lineBeforeImmigration.geometry.coordinates.concat(immigrationSegment.coordinates);
399
+ }
482
400
 
483
- // When going from public to transit, hide the ChangeZone instruction, if the next step is PassThroughImmigration.
484
- removeExtraChangeZoneSegment();
485
- optimizedPath.push(immigrationSegment);
486
- lineCoords = (0, _turf.getCoords)(line);
487
- lineAfterImmigration = (0, _turf.lineSlice)((0, _turf.getCoord)(intersects.features[1]), lineCoords[lineCoords.length - 1], line);
488
- segmentAfterImmigration = _objectSpread(_objectSpread({}, createDefaultSegment(pathSegment)), {}, {
489
- maneuverType: ManeuverType.ContinueStraight,
490
- zone: currentZone,
491
- coordinates: (0, _turf.getCoords)(lineAfterImmigration)
492
- });
493
- optimizedPath.push(segmentAfterImmigration);
494
- // line = segmentAfterImmigration;
495
- } else if (intersects.features.length > 0) {
496
- // check if start point outside polygon then end inside polygon - valid
497
- startPointWithinPolygon = (0, _turf.booleanPointInPolygon)((0, _turf.getCoords)(line)[0], immigrationPolygonFeature);
498
- if (startPointWithinPolygon) {
499
- optimizedPath.pop();
401
+ // When going from public to transit, hide the ChangeZone instruction, if the next step is PassThroughImmigration.
402
+ removeExtraChangeZoneSegment();
403
+ optimizedPath.push(immigrationSegment);
404
+ const lineCoords = (0, _turf.getCoords)(line);
405
+ const lineAfterImmigration = (0, _turf.lineSlice)((0, _turf.getCoord)(intersects.features[1]), lineCoords[lineCoords.length - 1], line);
406
+ const segmentAfterImmigration = _objectSpread(_objectSpread({}, createDefaultSegment(pathSegment)), {}, {
407
+ maneuverType: ManeuverType.ContinueStraight,
408
+ zone: currentZone,
409
+ coordinates: (0, _turf.getCoords)(lineAfterImmigration)
410
+ });
411
+ optimizedPath.push(segmentAfterImmigration);
412
+ // line = segmentAfterImmigration;
413
+ } else if (intersects.features.length > 0) {
414
+ // check if start point outside polygon then end inside polygon - valid
415
+ const startPointWithinPolygon = (0, _turf.booleanPointInPolygon)((0, _turf.getCoords)(line)[0], immigrationPolygonFeature);
416
+ if (startPointWithinPolygon) {
417
+ optimizedPath.pop();
500
418
 
501
- // One intersection point and start point is within polygon
502
- // Means line start inside and exits the polygon
503
- _immigrationLine = (0, _turf.lineSlice)((0, _turf.getCoords)(line)[0], (0, _turf.getCoord)(intersects.features[0]), line);
504
- _immigrationSegment = _objectSpread(_objectSpread({}, createDefaultSegment(pathSegment)), {}, {
505
- maneuverType: ManeuverType.PassThroughImmigration,
506
- zone: currentZone,
507
- coordinates: (0, _turf.getCoords)(_immigrationLine)
508
- });
509
- lastSegmentAdded = optimizedPath.length > 0 ? optimizedPath[optimizedPath.length - 1] : undefined;
510
- if (lastSegmentAdded && lastSegmentAdded.maneuverType === ManeuverType.ChangeZone) {
511
- // Remove change zone segment
512
- changeZoneSegment = optimizedPath.pop();
513
- if (optimizedPath.length > 1) {
514
- _secondLastSegmentAdded = optimizedPath[optimizedPath.length - 1];
515
- if (_secondLastSegmentAdded.maneuverType === ManeuverType.PassThroughImmigration) {
516
- optimizedPath.pop();
419
+ // One intersection point and start point is within polygon
420
+ // Means line start inside and exits the polygon
421
+ const immigrationLine = (0, _turf.lineSlice)((0, _turf.getCoords)(line)[0], (0, _turf.getCoord)(intersects.features[0]), line);
422
+ const immigrationSegment = _objectSpread(_objectSpread({}, createDefaultSegment(pathSegment)), {}, {
423
+ maneuverType: ManeuverType.PassThroughImmigration,
424
+ zone: currentZone,
425
+ coordinates: (0, _turf.getCoords)(immigrationLine)
426
+ });
427
+ lastSegmentAdded = optimizedPath.length > 0 ? optimizedPath[optimizedPath.length - 1] : undefined;
428
+ if (lastSegmentAdded && lastSegmentAdded.maneuverType === ManeuverType.ChangeZone) {
429
+ // Remove change zone segment
430
+ const changeZoneSegment = optimizedPath.pop();
431
+ if (optimizedPath.length > 1) {
432
+ const secondLastSegmentAdded = optimizedPath[optimizedPath.length - 1];
433
+ if (secondLastSegmentAdded.maneuverType === ManeuverType.PassThroughImmigration) {
434
+ optimizedPath.pop();
517
435
 
518
- // Re add the change zone segment with updated coordinates
519
- changeZoneSegment.coordinates = [_secondLastSegmentAdded.coordinates[0]];
520
- optimizedPath.push(changeZoneSegment);
521
- _immigrationSegment.coordinates = _secondLastSegmentAdded.coordinates.concat(_immigrationSegment.coordinates);
522
- }
523
- }
524
- }
525
- // When going from public to transit, hide the ChangeZone instruction, if the next step is PassThroughImmigration.
526
- removeExtraChangeZoneSegment();
527
- optimizedPath.push(_immigrationSegment);
528
- _lineCoords = (0, _turf.getCoords)(line);
529
- _lineAfterImmigration = (0, _turf.lineSlice)((0, _turf.getCoord)(intersects.features[0]), _lineCoords[_lineCoords.length - 1], line);
530
- _segmentAfterImmigration = _objectSpread(_objectSpread({}, createDefaultSegment(pathSegment)), {}, {
531
- maneuverType: ManeuverType.ContinueStraight,
532
- zone: currentZone,
533
- coordinates: (0, _turf.getCoords)(_lineAfterImmigration)
534
- });
535
- optimizedPath.push(_segmentAfterImmigration);
536
- } else {
537
- // line starts outside immigration and ends inside immigration
538
- // this is not a valid case but lines are still divided into segments as the segments are used
539
- // by the logic under case 2(startPointWithinPolygon)
540
- previousLine = (0, _turf.lineSlice)((0, _turf.getCoords)(line)[0], (0, _turf.getCoord)(intersects.features[0]), line);
541
- lastSegmentAdded.coordinates = (0, _turf.getCoords)(previousLine);
542
- _lineCoords2 = (0, _turf.getCoords)(line);
543
- _lineAfterImmigration2 = (0, _turf.lineSlice)((0, _turf.getCoord)(intersects.features[0]), _lineCoords2[_lineCoords2.length - 1], line);
544
- _segmentAfterImmigration2 = _objectSpread(_objectSpread({}, createDefaultSegment(pathSegment)), {}, {
545
- maneuverType: ManeuverType.PassThroughImmigration,
546
- zone: currentZone,
547
- coordinates: (0, _turf.getCoords)(_lineAfterImmigration2)
548
- });
549
- optimizedPath.push(_segmentAfterImmigration2);
550
- // line = segmentAfterImmigration;
551
- }
436
+ // Re add the change zone segment with updated coordinates
437
+ changeZoneSegment.coordinates = [secondLastSegmentAdded.coordinates[0]];
438
+ optimizedPath.push(changeZoneSegment);
439
+ immigrationSegment.coordinates = secondLastSegmentAdded.coordinates.concat(immigrationSegment.coordinates);
552
440
  }
553
441
  }
554
442
  }
555
- }
556
- } else {
557
- // Keep updating endSegment on each iteration
558
- endSegment = _objectSpread(_objectSpread({}, createDefaultSegment(pathSegment)), {}, {
559
- maneuverType: ManeuverType.Static,
560
- coordinates: [pathSegment.geojson.geometry.coordinates[1]],
561
- zone: currentZone,
562
- isPortal: false
563
- });
564
- enterPortalSegment = _objectSpread(_objectSpread({}, createDefaultSegment(pathSegment)), {}, {
565
- maneuverType: ManeuverType.EnterPortal,
566
- coordinates: [pathSegment.geojson.geometry.coordinates[0]]
567
- }); // // Only add this EnterPortal segment if previously same what dimension portal is not being continued
568
- // // This is done to ensure Take Lift at A, Exit Lift at B, Take lift at B, Exit Lift at C is generated only as Take lift at A, Exit lift at C
569
- // let lastSegmentAdded = (optimizedPath.length > 0) ? optimizedPath[optimizedPath.length - 1] : undefined;
570
- // if (!lastSegmentAdded
571
- // || (lastSegmentAdded && lastSegmentAdded.maneuverType !== ManeuverType.ExitPortal)
572
- // || (lastSegmentAdded && lastSegmentAdded.maneuverType === ManeuverType.ExitPortal && lastSegmentAdded.startEdge.whatDimension !== enterPortalSegment.startEdge.whatDimension)) {
573
- // optimizedPath.push(enterPortalSegment);
574
- // lastSegmentAdded = enterPortalSegment;
575
- // }
576
- optimizedPath.push(enterPortalSegment);
577
- exitPortalSegment = _objectSpread(_objectSpread({}, createDefaultSegment(pathSegment)), {}, {
578
- maneuverType: ManeuverType.ExitPortal,
579
- coordinates: [pathSegment.geojson.geometry.coordinates[1]]
580
- }); // // This logic is tied to the above similar logic for EnterPortal
581
- // // Only add this ExitPortal segment if previously same what dimension portal is not being continued
582
- // // This is done to ensure Take Lift at A, Exit Lift at B, Take lift at B, Exit Lift at C is generated only as Take lift at A, Exit lift at C
583
- // if (lastSegmentAdded && lastSegmentAdded.maneuverType !== ManeuverType.ExitPortal) {
584
- // if (pathSegment.portalPath) {
585
- // const travelPortalSegment: RouteSegment = {
586
- // ...createDefaultSegment(pathSegment),
587
- // maneuverType: ManeuverType.TravelPortal,
588
- // coordinates: pathSegment.portalPath.geometry.coordinates,
589
- // zone: currentZone,
590
- // };
591
- // optimizedPath.push(travelPortalSegment);
592
- // }
593
- // optimizedPath.push(exitPortalSegment);
594
- // } else
595
- optimizedPath.push(exitPortalSegment);
596
- _lastSegmentAdded2 = optimizedPath.length > 0 ? optimizedPath[optimizedPath.length - 1] : undefined;
597
- if (_lastSegmentAdded2 && _lastSegmentAdded2.maneuverType === ManeuverType.ExitPortal) {
598
- optimizedPath.pop();
599
- if (pathSegment.portalPath) {
600
- travelPortalSegment = _objectSpread(_objectSpread({}, createDefaultSegment(pathSegment)), {}, {
601
- maneuverType: ManeuverType.TravelPortal,
602
- coordinates: pathSegment.portalPath.geometry.coordinates,
603
- zone: currentZone
604
- });
605
- optimizedPath.push(travelPortalSegment);
606
- }
607
- optimizedPath.push(exitPortalSegment);
443
+ // When going from public to transit, hide the ChangeZone instruction, if the next step is PassThroughImmigration.
444
+ removeExtraChangeZoneSegment();
445
+ optimizedPath.push(immigrationSegment);
446
+ const lineCoords = (0, _turf.getCoords)(line);
447
+ const lineAfterImmigration = (0, _turf.lineSlice)((0, _turf.getCoord)(intersects.features[0]), lineCoords[lineCoords.length - 1], line);
448
+ const segmentAfterImmigration = _objectSpread(_objectSpread({}, createDefaultSegment(pathSegment)), {}, {
449
+ maneuverType: ManeuverType.ContinueStraight,
450
+ zone: currentZone,
451
+ coordinates: (0, _turf.getCoords)(lineAfterImmigration)
452
+ });
453
+ optimizedPath.push(segmentAfterImmigration);
454
+ } else {
455
+ // line starts outside immigration and ends inside immigration
456
+ // this is not a valid case but lines are still divided into segments as the segments are used
457
+ // by the logic under case 2(startPointWithinPolygon)
458
+ const previousLine = (0, _turf.lineSlice)((0, _turf.getCoords)(line)[0], (0, _turf.getCoord)(intersects.features[0]), line);
459
+ lastSegmentAdded.coordinates = (0, _turf.getCoords)(previousLine);
460
+ const lineCoords = (0, _turf.getCoords)(line);
461
+ const lineAfterImmigration = (0, _turf.lineSlice)((0, _turf.getCoord)(intersects.features[0]), lineCoords[lineCoords.length - 1], line);
462
+ const segmentAfterImmigration = _objectSpread(_objectSpread({}, createDefaultSegment(pathSegment)), {}, {
463
+ maneuverType: ManeuverType.PassThroughImmigration,
464
+ zone: currentZone,
465
+ coordinates: (0, _turf.getCoords)(lineAfterImmigration)
466
+ });
467
+ optimizedPath.push(segmentAfterImmigration);
468
+ // line = segmentAfterImmigration;
608
469
  }
609
470
  }
610
471
  }
611
- if (endSegment) optimizedPath.push(endSegment);
612
- route = {
613
- segments: optimizedPath,
614
- walkingDistance: 0,
615
- transportDistance: 0,
616
- walkingTime: 0,
617
- transportTime: 0,
618
- distanceUnit: _interfaces.DISTANCE_UNIT,
619
- speed: _interfaces.WALK_SPEED
620
- }; // A patch denotes the segments which are directly connected to each other i.e. no portal in between, portal enter/exit can be part of the patch
621
- if (route.segments.length > 0) {
622
- addOverviewSegment = shouldAddOverviewSegment;
623
- initialIndex = 0;
624
- if (addOverviewSegment) {
625
- // Dummy overview segment at start of route
626
- dummySegment = (0, _lodash.cloneDeep)(route.segments[0]);
627
- dummySegment.maneuverType = ManeuverType.RouteOverview;
628
- route.segments.unshift(dummySegment);
629
- initialIndex = 1; // Because overview segment will be at 0th index of route
630
- }
472
+ }
473
+ }
474
+ } else {
475
+ // Keep updating endSegment on each iteration
476
+ endSegment = _objectSpread(_objectSpread({}, createDefaultSegment(pathSegment)), {}, {
477
+ maneuverType: ManeuverType.Static,
478
+ coordinates: [pathSegment.geojson.geometry.coordinates[1]],
479
+ zone: currentZone,
480
+ isPortal: false
481
+ });
482
+ const enterPortalSegment = _objectSpread(_objectSpread({}, createDefaultSegment(pathSegment)), {}, {
483
+ maneuverType: ManeuverType.EnterPortal,
484
+ coordinates: [pathSegment.geojson.geometry.coordinates[0]]
485
+ });
486
+ // // Only add this EnterPortal segment if previously same what dimension portal is not being continued
487
+ // // This is done to ensure Take Lift at A, Exit Lift at B, Take lift at B, Exit Lift at C is generated only as Take lift at A, Exit lift at C
488
+ // let lastSegmentAdded = (optimizedPath.length > 0) ? optimizedPath[optimizedPath.length - 1] : undefined;
489
+ // if (!lastSegmentAdded
490
+ // || (lastSegmentAdded && lastSegmentAdded.maneuverType !== ManeuverType.ExitPortal)
491
+ // || (lastSegmentAdded && lastSegmentAdded.maneuverType === ManeuverType.ExitPortal && lastSegmentAdded.startEdge.whatDimension !== enterPortalSegment.startEdge.whatDimension)) {
492
+ // optimizedPath.push(enterPortalSegment);
493
+ // lastSegmentAdded = enterPortalSegment;
494
+ // }
631
495
 
632
- // A patch denotes the segments which are directly connected to each other i.e. no portal in between, portal enter/exit can be part of the patch
633
- patchNumber = indexOffset + initialIndex;
634
- whereDimension = route.segments.length > initialIndex ? route.segments[initialIndex].startEdge.whereDimension : '';
635
- for (_index2 = initialIndex; _index2 < route.segments.length; _index2 += 1) {
636
- highlight = false;
637
- segment = route.segments[_index2];
638
- segmentNumber = indexOffset + _index2;
639
- if (!segment.isPortal) {
640
- // point feature if ManeuverType.Static else line feature
641
- if (segment.maneuverType === ManeuverType.Static || segment.maneuverType === ManeuverType.ChangeZone) {
642
- segment.features = getRouteNode(segment.coordinates[0], segmentNumber, highlight, patchNumber, segment.endEdge.whereDimension);
643
- segment.patchNumber = patchNumber;
644
- segment.whereDimension = whereDimension;
645
- } else {
646
- segment.features = getRouteLine(segment.coordinates, segmentNumber, highlight, patchNumber, segment.zone, segment.startEdge.whereDimension);
647
- segment.patchNumber = patchNumber;
648
- segment.whereDimension = whereDimension;
649
- }
650
- routeSegmentCoords = segment.coordinates;
651
- segmentDistance = void 0;
652
- if (routeSegmentCoords.length > 1) {
653
- segmentDistance = (0, _length["default"])((0, _helpers.lineString)(routeSegmentCoords), {
654
- units: route.distanceUnit
655
- });
656
- } else {
657
- segmentDistance = 0;
658
- }
659
- segment.distance = segmentDistance;
660
- if (segment.maneuverType !== ManeuverType.PassThroughImmigration) {
661
- segment.time = segment.distance / route.speed;
662
- } else {
663
- segment.time = 0;
664
- }
665
- } else {
666
- // if (
667
- // segment.maneuverType !== ManeuverType.EnterPortal
668
- // && segment.maneuverType !== ManeuverType.ExitPortal
669
- // ) {
670
- // console.warn('unexpected state in createRoute');
671
- // }
496
+ optimizedPath.push(enterPortalSegment);
497
+ const exitPortalSegment = _objectSpread(_objectSpread({}, createDefaultSegment(pathSegment)), {}, {
498
+ maneuverType: ManeuverType.ExitPortal,
499
+ coordinates: [pathSegment.geojson.geometry.coordinates[1]]
500
+ });
501
+ // // This logic is tied to the above similar logic for EnterPortal
502
+ // // Only add this ExitPortal segment if previously same what dimension portal is not being continued
503
+ // // This is done to ensure Take Lift at A, Exit Lift at B, Take lift at B, Exit Lift at C is generated only as Take lift at A, Exit lift at C
504
+ // if (lastSegmentAdded && lastSegmentAdded.maneuverType !== ManeuverType.ExitPortal) {
505
+ // if (pathSegment.portalPath) {
506
+ // const travelPortalSegment: RouteSegment = {
507
+ // ...createDefaultSegment(pathSegment),
508
+ // maneuverType: ManeuverType.TravelPortal,
509
+ // coordinates: pathSegment.portalPath.geometry.coordinates,
510
+ // zone: currentZone,
511
+ // };
512
+ // optimizedPath.push(travelPortalSegment);
513
+ // }
672
514
 
673
- if (segment.maneuverType === ManeuverType.EnterPortal) {
674
- startEdgeFeatures = getRouteNode(segment.coordinates[0], segmentNumber, highlight, patchNumber, segment.startEdge.whereDimension);
675
- features = []; // eslint-disable-next-line no-restricted-syntax
676
- _iterator = _createForOfIteratorHelper(startEdgeFeatures);
677
- try {
678
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
679
- feature = _step.value;
680
- features.push(feature);
681
- }
682
- } catch (err) {
683
- _iterator.e(err);
684
- } finally {
685
- _iterator.f();
686
- }
687
- segment.features = features;
688
- segment.patchNumber = patchNumber;
689
- segment.whereDimension = whereDimension;
515
+ // optimizedPath.push(exitPortalSegment);
516
+ // } else
517
+ optimizedPath.push(exitPortalSegment);
518
+ const lastSegmentAdded = optimizedPath.length > 0 ? optimizedPath[optimizedPath.length - 1] : undefined;
519
+ if (lastSegmentAdded && lastSegmentAdded.maneuverType === ManeuverType.ExitPortal) {
520
+ optimizedPath.pop();
521
+ if (pathSegment.portalPath) {
522
+ const travelPortalSegment = _objectSpread(_objectSpread({}, createDefaultSegment(pathSegment)), {}, {
523
+ maneuverType: ManeuverType.TravelPortal,
524
+ coordinates: pathSegment.portalPath.geometry.coordinates,
525
+ zone: currentZone
526
+ });
527
+ optimizedPath.push(travelPortalSegment);
528
+ }
529
+ optimizedPath.push(exitPortalSegment);
530
+ }
531
+ }
532
+ }
533
+ if (endSegment) optimizedPath.push(endSegment);
534
+ const route = {
535
+ segments: optimizedPath,
536
+ walkingDistance: 0,
537
+ transportDistance: 0,
538
+ walkingTime: 0,
539
+ transportTime: 0,
540
+ distanceUnit: _interfaces.DISTANCE_UNIT,
541
+ speed: _interfaces.WALK_SPEED
542
+ };
690
543
 
691
- // read next segment, if next segment is TravelPortal then do not include time of this enter portal segment
692
- _nextRouteSegment = route.segments.length >= _index2 + 2 ? route.segments[_index2 + 1] : undefined;
693
- if (_nextRouteSegment && _nextRouteSegment.maneuverType !== ManeuverType.TravelPortal) {
694
- portalCost = segment.cost;
695
- segment.time = portalCost || 0;
696
- } else {
697
- segment.time = 0;
698
- }
699
- segment.distance = 0;
700
- }
701
- if (segment.maneuverType === ManeuverType.TravelPortal) {
702
- segment.features = getRouteLine(segment.coordinates, segmentNumber, highlight, patchNumber, segment.zone, segment.startEdge.whereDimension);
703
- segment.patchNumber = patchNumber;
704
- segment.whereDimension = whereDimension;
705
- _portalCost = segment.cost;
706
- segment.time = _portalCost || 0;
707
- _segmentDistance = void 0;
708
- if (segment.coordinates.length > 1) {
709
- _segmentDistance = (0, _length["default"])((0, _helpers.lineString)(segment.coordinates), {
710
- units: route.distanceUnit
711
- });
712
- } else {
713
- _segmentDistance = 0;
714
- }
715
- segment.distance = _segmentDistance;
544
+ // A patch denotes the segments which are directly connected to each other i.e. no portal in between, portal enter/exit can be part of the patch
545
+ if (route.segments.length > 0) {
546
+ const addOverviewSegment = shouldAddOverviewSegment;
547
+ let initialIndex = 0;
548
+ if (addOverviewSegment) {
549
+ // Dummy overview segment at start of route
550
+ const dummySegment = (0, _lodash.cloneDeep)(route.segments[0]);
551
+ dummySegment.maneuverType = ManeuverType.RouteOverview;
552
+ route.segments.unshift(dummySegment);
553
+ initialIndex = 1; // Because overview segment will be at 0th index of route
554
+ }
716
555
 
717
- // Set time of previous enter portal instruction to zero, so that time in not shown in UI
718
- if (_index2 > 0) route.segments[_index2 - 1].time = 0;
719
- }
720
- if (segment.maneuverType === ManeuverType.ExitPortal) {
721
- // increment patch number to next value
722
- patchNumber += 1;
723
- whereDimension = segment.endEdge.whereDimension;
556
+ // A patch denotes the segments which are directly connected to each other i.e. no portal in between, portal enter/exit can be part of the patch
557
+ let patchNumber = indexOffset + initialIndex;
558
+ let whereDimension = route.segments.length > initialIndex ? route.segments[initialIndex].startEdge.whereDimension : '';
559
+ for (let index = initialIndex; index < route.segments.length; index += 1) {
560
+ const highlight = false;
561
+ const segment = route.segments[index];
562
+ const segmentNumber = indexOffset + index;
563
+ if (!segment.isPortal) {
564
+ // point feature if ManeuverType.Static else line feature
565
+ if (segment.maneuverType === ManeuverType.Static || segment.maneuverType === ManeuverType.ChangeZone) {
566
+ segment.features = getRouteNode(segment.coordinates[0], segmentNumber, highlight, patchNumber, segment.endEdge.whereDimension);
567
+ segment.patchNumber = patchNumber;
568
+ segment.whereDimension = whereDimension;
569
+ } else {
570
+ segment.features = getRouteLine(segment.coordinates, segmentNumber, highlight, patchNumber, segment.zone, segment.startEdge.whereDimension);
571
+ segment.patchNumber = patchNumber;
572
+ segment.whereDimension = whereDimension;
573
+ }
574
+ const routeSegmentCoords = segment.coordinates;
575
+ let segmentDistance;
576
+ if (routeSegmentCoords.length > 1) {
577
+ segmentDistance = (0, _length.default)((0, _helpers.lineString)(routeSegmentCoords), {
578
+ units: route.distanceUnit
579
+ });
580
+ } else {
581
+ segmentDistance = 0;
582
+ }
583
+ segment.distance = segmentDistance;
584
+ if (segment.maneuverType !== ManeuverType.PassThroughImmigration) {
585
+ segment.time = segment.distance / route.speed;
586
+ } else {
587
+ segment.time = 0;
588
+ }
589
+ } else {
590
+ // if (
591
+ // segment.maneuverType !== ManeuverType.EnterPortal
592
+ // && segment.maneuverType !== ManeuverType.ExitPortal
593
+ // ) {
594
+ // console.warn('unexpected state in createRoute');
595
+ // }
724
596
 
725
- // Remove ExitPortal segment from route, because its only used to calculate patch information since ATOMS-207
726
- route.segments.splice(_index2, 1);
727
- _index2 -= 1;
728
- }
597
+ if (segment.maneuverType === ManeuverType.EnterPortal) {
598
+ const startEdgeFeatures = getRouteNode(segment.coordinates[0], segmentNumber, highlight, patchNumber, segment.startEdge.whereDimension);
599
+ const features = [];
600
+ // eslint-disable-next-line no-restricted-syntax
601
+ for (const feature of startEdgeFeatures) {
602
+ features.push(feature);
603
+ }
604
+ segment.features = features;
605
+ segment.patchNumber = patchNumber;
606
+ segment.whereDimension = whereDimension;
729
607
 
730
- // read next segment
731
- nextRouteSegment = route.segments.length >= _index2 + 2 ? route.segments[_index2 + 1] : undefined;
732
- if (nextRouteSegment && nextRouteSegment.maneuverType === ManeuverType.TravelPortal) {
733
- patchNumber += 1;
734
- }
735
- }
736
- if (segment.maneuverType === ManeuverType.TravelPortal) {
737
- route.transportDistance += segment.distance;
738
- route.transportTime += segment.time;
739
- } else {
740
- route.walkingDistance += segment.distance;
741
- route.walkingTime += segment.time;
742
- }
743
- }
744
- if (addOverviewSegment) {
745
- // Generate and add actual overview segment
746
- overviewSegment = generateOverviewSegment(route, indexOffset);
747
- route.segments[0] = overviewSegment;
748
- }
608
+ // read next segment, if next segment is TravelPortal then do not include time of this enter portal segment
609
+ const nextRouteSegment = route.segments.length >= index + 2 ? route.segments[index + 1] : undefined;
610
+ if (nextRouteSegment && nextRouteSegment.maneuverType !== ManeuverType.TravelPortal) {
611
+ const portalCost = segment.cost;
612
+ segment.time = portalCost || 0;
613
+ } else {
614
+ segment.time = 0;
749
615
  }
750
- return _context.a(2, route);
616
+ segment.distance = 0;
617
+ }
618
+ if (segment.maneuverType === ManeuverType.TravelPortal) {
619
+ segment.features = getRouteLine(segment.coordinates, segmentNumber, highlight, patchNumber, segment.zone, segment.startEdge.whereDimension);
620
+ segment.patchNumber = patchNumber;
621
+ segment.whereDimension = whereDimension;
622
+ const portalCost = segment.cost;
623
+ segment.time = portalCost || 0;
624
+ let segmentDistance;
625
+ if (segment.coordinates.length > 1) {
626
+ segmentDistance = (0, _length.default)((0, _helpers.lineString)(segment.coordinates), {
627
+ units: route.distanceUnit
628
+ });
629
+ } else {
630
+ segmentDistance = 0;
631
+ }
632
+ segment.distance = segmentDistance;
633
+
634
+ // Set time of previous enter portal instruction to zero, so that time in not shown in UI
635
+ if (index > 0) route.segments[index - 1].time = 0;
636
+ }
637
+ if (segment.maneuverType === ManeuverType.ExitPortal) {
638
+ // increment patch number to next value
639
+ patchNumber += 1;
640
+ whereDimension = segment.endEdge.whereDimension;
641
+
642
+ // Remove ExitPortal segment from route, because its only used to calculate patch information since ATOMS-207
643
+ route.segments.splice(index, 1);
644
+ index -= 1;
645
+ }
646
+
647
+ // read next segment
648
+ const nextRouteSegment = route.segments.length >= index + 2 ? route.segments[index + 1] : undefined;
649
+ if (nextRouteSegment && nextRouteSegment.maneuverType === ManeuverType.TravelPortal) {
650
+ patchNumber += 1;
651
+ }
751
652
  }
752
- }, _callee);
753
- }));
754
- return _createRoute.apply(this, arguments);
653
+ if (segment.maneuverType === ManeuverType.TravelPortal) {
654
+ route.transportDistance += segment.distance;
655
+ route.transportTime += segment.time;
656
+ } else {
657
+ route.walkingDistance += segment.distance;
658
+ route.walkingTime += segment.time;
659
+ }
660
+ }
661
+ if (addOverviewSegment) {
662
+ // Generate and add actual overview segment
663
+ const overviewSegment = generateOverviewSegment(route, indexOffset);
664
+ route.segments[0] = overviewSegment;
665
+ }
666
+ }
667
+ return route;
755
668
  }
756
669
  function getPatch(route) {
757
- var patchNumber = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
758
- var routefeatures = [];
759
- for (var index = 0; index < route.segments.length; index += 1) {
760
- var routeSegment = route.segments[index];
670
+ let patchNumber = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
671
+ let routefeatures = [];
672
+ for (let index = 0; index < route.segments.length; index += 1) {
673
+ const routeSegment = route.segments[index];
761
674
  if (routeSegment.patchNumber === patchNumber) {
762
675
  routefeatures = routefeatures.concat(routeSegment.features);
763
676
  }
@@ -765,17 +678,17 @@ function getPatch(route) {
765
678
  return routefeatures;
766
679
  }
767
680
  function getFeaturesForPatch(route, patchNumber, overviewSegmentInfo) {
768
- var routefeatures = [];
769
- for (var index = 0; index < route.segments.length; index += 1) {
770
- var routeSegment = route.segments[index];
681
+ let routefeatures = [];
682
+ for (let index = 0; index < route.segments.length; index += 1) {
683
+ const routeSegment = route.segments[index];
771
684
  if (overviewSegmentInfo.includeOverviewFeatures) {
772
685
  // Return all features in default case
773
686
  if (isOverviewSegment(routeSegment)) {
774
- var nonHighlightedOverviewFeatures = [];
775
- var highlightedOverviewFeatures = [];
776
- for (var j = 0; j < routeSegment.features.length; j++) {
687
+ const nonHighlightedOverviewFeatures = [];
688
+ const highlightedOverviewFeatures = [];
689
+ for (let j = 0; j < routeSegment.features.length; j++) {
777
690
  var _feature$properties;
778
- var feature = routeSegment.features[j];
691
+ const feature = routeSegment.features[j];
779
692
  if (((_feature$properties = feature.properties) === null || _feature$properties === void 0 ? void 0 : _feature$properties.patchNumber) !== undefined && feature.properties.patchNumber === overviewSegmentInfo.patchNumberForOverviewFeatures) {
780
693
  if (feature.properties.isNonHighlightedOverview !== undefined) {
781
694
  if (feature.properties.isNonHighlightedOverview === '1') {
@@ -788,7 +701,7 @@ function getFeaturesForPatch(route, patchNumber, overviewSegmentInfo) {
788
701
  }
789
702
  // Sort the features such that non hihglighted features come first in the array
790
703
  // because on map they should be sorted below highlighted features in z dimension
791
- var overviewSegmentFeatures = nonHighlightedOverviewFeatures.concat(highlightedOverviewFeatures);
704
+ const overviewSegmentFeatures = nonHighlightedOverviewFeatures.concat(highlightedOverviewFeatures);
792
705
  routefeatures = routefeatures.concat(overviewSegmentFeatures);
793
706
  }
794
707
  } else if (routeSegment.patchNumber === patchNumber) {
@@ -845,12 +758,12 @@ function getPortalName(whatDimension) {
845
758
  }
846
759
  }
847
760
  function getTerminalAndLevelName(whereDimension) {
848
- var regex = /^(T\d+|JEWEL)([A-Za-z]\d+[A-Za-z]?)$/;
849
- var subDimension = whereDimension.split('.').slice(-2).join('').toUpperCase();
850
- var match = subDimension.match(regex);
761
+ const regex = /^(T\d+|JEWEL)([A-Za-z]\d+[A-Za-z]?)$/;
762
+ const subDimension = whereDimension.split('.').slice(-2).join('').toUpperCase();
763
+ const match = subDimension.match(regex);
851
764
  if (match) {
852
- var terminalIndicator = match[1][0];
853
- var terminalName;
765
+ const terminalIndicator = match[1][0];
766
+ let terminalName;
854
767
  switch (terminalIndicator) {
855
768
  case 'T':
856
769
  terminalName = 'Terminal';
@@ -862,9 +775,9 @@ function getTerminalAndLevelName(whereDimension) {
862
775
  terminalName = 'Level';
863
776
  break;
864
777
  }
865
- var terminal = terminalName === 'Terminal' ? "".concat(terminalName, " ").concat(match[1][1]) : "".concat(terminalName);
866
- var levelIdentifier = match[2][0];
867
- var levelName;
778
+ const terminal = terminalName === 'Terminal' ? "".concat(terminalName, " ").concat(match[1][1]) : "".concat(terminalName);
779
+ const levelIdentifier = match[2][0];
780
+ let levelName;
868
781
  switch (levelIdentifier) {
869
782
  case 'L':
870
783
  levelName = 'Level';
@@ -876,7 +789,7 @@ function getTerminalAndLevelName(whereDimension) {
876
789
  levelName = 'Level';
877
790
  break;
878
791
  }
879
- var level = "".concat(levelName, " ").concat(match[2].substring(1));
792
+ const level = "".concat(levelName, " ").concat(match[2].substring(1));
880
793
  return {
881
794
  Terminal: terminal,
882
795
  Level: level
@@ -885,7 +798,7 @@ function getTerminalAndLevelName(whereDimension) {
885
798
  return null; // Return null if the input doesn't match the expected format
886
799
  }
887
800
  function getWhereDimensionNameForPortal(portalDimension, whereDimension) {
888
- var terminalAndLevelName = getTerminalAndLevelName(whereDimension);
801
+ const terminalAndLevelName = getTerminalAndLevelName(whereDimension);
889
802
  if (terminalAndLevelName) {
890
803
  if (isCrossTerminalPortal(portalDimension)) {
891
804
  return terminalAndLevelName.Terminal;
@@ -901,10 +814,10 @@ function getWhereDimensionNameForPortal(portalDimension, whereDimension) {
901
814
  }
902
815
  function convertSecondsToMinutes(timeInSeconds) {
903
816
  // Calculate minutes
904
- var minutes = Math.floor(timeInSeconds / 60);
817
+ let minutes = Math.floor(timeInSeconds / 60);
905
818
 
906
819
  // Check for remaining seconds
907
- var remainingSeconds = timeInSeconds % 60;
820
+ const remainingSeconds = timeInSeconds % 60;
908
821
 
909
822
  // If there are remaining seconds and they are greater than 30, increment minutes
910
823
  if (remainingSeconds > 30) {
@@ -917,34 +830,34 @@ function formatTime(value) {
917
830
  return "~".concat(convertSecondsToMinutes(value), " ").concat(convertSecondsToMinutes(value) > 1 ? 'minutes' : 'minute');
918
831
  }
919
832
  function generateInstructions(route) {
920
- var isFirstSegment = function isFirstSegment(index) {
833
+ const isFirstSegment = index => {
921
834
  if (index === 0 || index === 1 && route.segments[index - 1].maneuverType === ManeuverType.RouteOverview) return true;
922
835
  return false;
923
836
  };
924
- var getImmigrationInstruction = function getImmigrationInstruction(segment) {
837
+ const getImmigrationInstruction = segment => {
925
838
  if (segment.startEdge.whereDimension.toLowerCase().includes('l1')) {
926
839
  return 'Clear Arrival Immigration';
927
840
  }
928
841
  return 'Clear Departure Immigration';
929
842
  };
930
- for (var index = 0; index < route.segments.length; index += 1) {
931
- var rotueSegment = route.segments[index];
843
+ for (let index = 0; index < route.segments.length; index += 1) {
844
+ const rotueSegment = route.segments[index];
932
845
  rotueSegment.instructions = []; // clear instructions array
933
846
 
934
847
  if (rotueSegment.maneuverType === ManeuverType.RouteOverview) {
935
- var instruction = 'Overview';
848
+ const instruction = 'Overview';
936
849
  rotueSegment.instructions.push(instruction);
937
850
  }
938
851
  if (index > 0 && rotueSegment.maneuverType === ManeuverType.ChangeZone) {
939
- var _instruction = '';
852
+ let instruction = '';
940
853
  if (route.segments[index - 1].zone === _interfaces.Zone.Public && rotueSegment.zone === _interfaces.Zone.Transit) {
941
- _instruction = getImmigrationInstruction(rotueSegment);
854
+ instruction = getImmigrationInstruction(rotueSegment);
942
855
  } else if (route.segments[index - 1].zone === _interfaces.Zone.Transit && rotueSegment.zone === _interfaces.Zone.Public) {
943
- _instruction = 'Exit Baggage Claim Hall';
856
+ instruction = 'Exit Baggage Claim Hall';
944
857
  }
945
- rotueSegment.instructions.push(_instruction);
858
+ rotueSegment.instructions.push(instruction);
946
859
  } else if (rotueSegment.maneuverType === ManeuverType.ContinueStraight || rotueSegment.maneuverType === ManeuverType.PassThroughImmigration) {
947
- var postfix = rotueSegment.maneuverType === ManeuverType.ContinueStraight ? "Walk for ".concat(Math.ceil(rotueSegment.distance), " ").concat(route.distanceUnit) : getImmigrationInstruction(rotueSegment);
860
+ const postfix = rotueSegment.maneuverType === ManeuverType.ContinueStraight ? "Walk for ".concat(Math.ceil(rotueSegment.distance), " ").concat(route.distanceUnit) : getImmigrationInstruction(rotueSegment);
948
861
 
949
862
  // 0th index if overview segment was not included, else 1st index
950
863
  // if (index === 0
@@ -957,9 +870,9 @@ function generateInstructions(route) {
957
870
  // } \n& ${postfix}`,
958
871
  // );
959
872
  // } else {
960
- var _instruction2 = void 0;
873
+ let instruction;
961
874
  if (route.segments[index - 1].maneuverType === ManeuverType.ChangeZone || route.segments[index - 1].maneuverType === ManeuverType.PassThroughImmigration) {
962
- _instruction2 = postfix;
875
+ instruction = postfix;
963
876
  // eslint-disable-next-line brace-style
964
877
  }
965
878
  // else if (route.segments[index - 1].maneuverType === ManeuverType.EnterPortal || route.segments[index - 1].maneuverType === ManeuverType.TravelPortal) {
@@ -994,9 +907,9 @@ function generateInstructions(route) {
994
907
  // // }
995
908
  // }
996
909
  else {
997
- _instruction2 = postfix;
910
+ instruction = postfix;
998
911
  }
999
- rotueSegment.instructions.push(_instruction2);
912
+ rotueSegment.instructions.push(instruction);
1000
913
  // }
1001
914
  } else if (rotueSegment.maneuverType === ManeuverType.Static) {
1002
915
  if (isFirstSegment(index)) {
@@ -1006,24 +919,24 @@ function generateInstructions(route) {
1006
919
  rotueSegment.instructions.push("Arrive at ".concat(rotueSegment.endEdge.name));
1007
920
  }
1008
921
  } else if (rotueSegment.maneuverType === ManeuverType.EnterPortal) {
1009
- var _instruction3 = "Enter ".concat(rotueSegment.startEdge.name, " at ").concat(rotueSegment.startEdge.whereDimension.split('.').slice(-2).join(' ').toUpperCase());
922
+ let instruction = "Enter ".concat(rotueSegment.startEdge.name, " at ").concat(rotueSegment.startEdge.whereDimension.split('.').slice(-2).join(' ').toUpperCase());
1010
923
  if (isNonMovingPortalTaxonomy(rotueSegment.startEdge.whatDimension)) {
1011
- _instruction3 = "Continue to ".concat(getWhereDimensionNameForPortal(rotueSegment.startEdge.whatDimension, rotueSegment.endEdge.whereDimension));
1012
- rotueSegment.instructions.push(_instruction3);
924
+ instruction = "Continue to ".concat(getWhereDimensionNameForPortal(rotueSegment.startEdge.whatDimension, rotueSegment.endEdge.whereDimension));
925
+ rotueSegment.instructions.push(instruction);
1013
926
  } else if (isMovingPortalTaxonomy(rotueSegment.startEdge.whatDimension)) {
1014
- var nextRouteSegment = index + 1 <= route.segments.length - 1 ? route.segments[index + 1] : undefined;
927
+ const nextRouteSegment = index + 1 <= route.segments.length - 1 ? route.segments[index + 1] : undefined;
1015
928
  if (nextRouteSegment && nextRouteSegment.maneuverType === ManeuverType.TravelPortal) {
1016
929
  // push the current enter portal instruction and increment index, since we want to skip the iteration on TravelPortal segment
1017
- rotueSegment.instructions.push(_instruction3);
930
+ rotueSegment.instructions.push(instruction);
1018
931
  index += 1;
1019
- var name = getPortalName(nextRouteSegment.startEdge.whatDimension);
1020
- _instruction3 = "Take ".concat(name, " to ").concat(getWhereDimensionNameForPortal(rotueSegment.startEdge.whatDimension, rotueSegment.endEdge.whereDimension));
1021
- nextRouteSegment.instructions.push(_instruction3);
932
+ const name = getPortalName(nextRouteSegment.startEdge.whatDimension);
933
+ instruction = "Take ".concat(name, " to ").concat(getWhereDimensionNameForPortal(rotueSegment.startEdge.whatDimension, rotueSegment.endEdge.whereDimension));
934
+ nextRouteSegment.instructions.push(instruction);
1022
935
  if (rotueSegment.description) nextRouteSegment.instructions.push(rotueSegment.description);
1023
936
  } else {
1024
- var _name = getPortalName(rotueSegment.startEdge.whatDimension);
1025
- _instruction3 = "Take ".concat(_name, " to ").concat(getWhereDimensionNameForPortal(rotueSegment.startEdge.whatDimension, rotueSegment.endEdge.whereDimension));
1026
- rotueSegment.instructions.push(_instruction3);
937
+ const name = getPortalName(rotueSegment.startEdge.whatDimension);
938
+ instruction = "Take ".concat(name, " to ").concat(getWhereDimensionNameForPortal(rotueSegment.startEdge.whatDimension, rotueSegment.endEdge.whereDimension));
939
+ rotueSegment.instructions.push(instruction);
1027
940
  }
1028
941
  }
1029
942
  }