@twinmatrix/spatialverse-sdk-web 0.0.2 → 0.0.3

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 (125) 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 +43 -45
  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 +241 -271
  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 +876 -1188
  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 +173 -163
  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 +546 -620
  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 +155 -160
  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 +832 -1060
  34. package/lib/cjs/meta-atlas-sdk/meta-atlas-sdk.js.map +1 -1
  35. package/lib/cjs/meta-atlas-sdk/utils/helpers.js +33 -50
  36. package/lib/cjs/meta-atlas-sdk/utils/helpers.js.map +1 -1
  37. package/lib/cjs/meta-atlas-sdk/utils/local-storage.js +18 -36
  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 +428 -556
  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 -50
  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 +30 -29
  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 +53 -64
  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 +2 -1
  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 +10 -9
  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 +2 -2
  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 +3 -3
  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 +22 -14
  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 +8 -8
  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 +18 -11
  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 +4 -3
  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 +80 -61
  98. package/lib/esm/meta-atlas-sdk/meta-atlas-sdk.js.map +1 -1
  99. package/lib/esm/meta-atlas-sdk/utils/helpers.js +3 -1
  100. package/lib/esm/meta-atlas-sdk/utils/helpers.js.map +1 -1
  101. package/lib/esm/meta-atlas-sdk/utils/routing-visualizer/index.js +19 -15
  102. package/lib/esm/meta-atlas-sdk/utils/routing-visualizer/index.js.map +1 -1
  103. package/lib/esm/react/MetaAtlasMap.js +120 -0
  104. package/lib/esm/react/MetaAtlasMap.js.map +1 -0
  105. package/lib/esm/react/hooks/useDrawing/index.js +2 -2
  106. package/lib/esm/react/hooks/useDrawing/index.js.map +1 -1
  107. package/lib/esm/react/hooks/useFocus/index.js +4 -3
  108. package/lib/esm/react/hooks/useFocus/index.js.map +1 -1
  109. package/lib/esm/react/hooks/useMapEvents/index.js +3 -3
  110. package/lib/esm/react/hooks/useMapEvents/index.js.map +1 -1
  111. package/lib/esm/react/hooks/useMapOverlays/index.js +2 -2
  112. package/lib/esm/react/hooks/useMapOverlays/index.js.map +1 -1
  113. package/lib/esm/react/hooks/useMetaAtlas/index.js +162 -60
  114. package/lib/esm/react/hooks/useMetaAtlas/index.js.map +1 -1
  115. package/lib/esm/react/hooks/useMetaAtlas.js +162 -60
  116. package/lib/esm/react/hooks/useMetaAtlas.js.map +1 -1
  117. package/lib/esm/react/hooks/useRouting/index.js +2 -2
  118. package/lib/esm/react/hooks/useRouting/index.js.map +1 -1
  119. package/lib/esm/react/hooks/useSearch/index.js +2 -2
  120. package/lib/esm/react/hooks/useSearch/index.js.map +1 -1
  121. package/lib/esm/react/hooks/useStampRally/index.js +8 -7
  122. package/lib/esm/react/hooks/useStampRally/index.js.map +1 -1
  123. package/lib/esm/react/index.js +11 -15
  124. package/lib/esm/react/index.js.map +1 -1
  125. package/package.json +9 -6
@@ -13,42 +13,27 @@ var _length = _interopRequireDefault(require("@turf/length"));
13
13
  var _area = _interopRequireDefault(require("@turf/area"));
14
14
  var _cloneDeep = _interopRequireDefault(require("lodash/cloneDeep"));
15
15
  var _mapboxGlDraw = _interopRequireDefault(require("@mapbox/mapbox-gl-draw"));
16
- var _customStyles = require("./customStyles");
17
- var _draw_marker = _interopRequireDefault(require("./mapbox_draw_custom_modes/draw_marker"));
18
- var _marker_select = _interopRequireDefault(require("./mapbox_draw_custom_modes/marker_select"));
19
- var _metaAtlasSdkCore = require("./MetaAtlasCore/meta-atlas-sdk-core");
20
- var _MainMap = _interopRequireDefault(require("./3DMap/MainMap"));
16
+ var _customStyles = require("./customStyles.js");
17
+ var _draw_marker = _interopRequireDefault(require("./mapbox_draw_custom_modes/draw_marker.js"));
18
+ var _marker_select = _interopRequireDefault(require("./mapbox_draw_custom_modes/marker_select.js"));
19
+ var _metaAtlasSdkCore = require("./MetaAtlasCore/meta-atlas-sdk-core.js");
20
+ var _MainMap = _interopRequireDefault(require("./3DMap/MainMap.js"));
21
21
  var _app = require("firebase/app");
22
22
  var _analytics = require("firebase/analytics");
23
- var _routingVisualizer = require("./utils/routing-visualizer");
24
- var _customerLayer = _interopRequireDefault(require("./customerLayer"));
25
- var _customerLayerVariant = _interopRequireDefault(require("./customerLayerVariant"));
23
+ var _index = require("./utils/routing-visualizer/index.js");
24
+ var _customerLayer = _interopRequireDefault(require("./customerLayer.js"));
25
+ var _customerLayerVariant = _interopRequireDefault(require("./customerLayerVariant.js"));
26
26
  var _booleanPointInPolygon = _interopRequireDefault(require("@turf/boolean-point-in-polygon"));
27
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
28
- function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
29
- 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); }
30
- 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 }; })(); }
31
- 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); }
32
- 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); }
33
- 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); }); }; }
34
- 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; }
35
- 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; }
36
- 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; } } }; }
37
- 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; } }
38
- 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; }
39
- function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
40
- function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
41
- function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
42
- 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; }
43
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
44
- 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); } // const maplibregl = require('maplibre-gl');
27
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
28
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
29
+ // const maplibregl = require('maplibre-gl');
45
30
  var FilterType = /*#__PURE__*/function (FilterType) {
46
31
  FilterType["Name"] = "title";
47
32
  FilterType["LocalRef"] = "localRef";
48
33
  FilterType["WhatTaxonomy"] = "dimension_what";
49
34
  return FilterType;
50
35
  }(FilterType || {});
51
- var EventSource = exports.EventSource = /*#__PURE__*/function (EventSource) {
36
+ let EventSource = exports.EventSource = /*#__PURE__*/function (EventSource) {
52
37
  EventSource["UrlLoad"] = "url_load";
53
38
  EventSource["MapClick"] = "map_click";
54
39
  EventSource["BannerClick"] = "banner_click";
@@ -60,81 +45,93 @@ var EventSource = exports.EventSource = /*#__PURE__*/function (EventSource) {
60
45
  EventSource["StampRallyClick"] = "stamp_rally_click";
61
46
  return EventSource;
62
47
  }({});
63
- var DEFAULT_MAP_STYLE = exports.DEFAULT_MAP_STYLE = 'https://api.maptiler.com/maps/01985ac8-56d2-707b-afa8-68abfe8f18be/style.json?key=12H5hrITUbJ1sDrVPqkq';
64
- var MetaAtlasSdk = exports.MetaAtlasSdk = /*#__PURE__*/function () {
65
- function MetaAtlasSdk(accessToken, secretKey) {
66
- var _this = this;
67
- var onLoad = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : function () {};
68
- var onLoadFail = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : function (errorMessage) {};
69
- var onRoutingStatusUpdate = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : function () {};
70
- var onSearchStatusUpdate = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : function () {};
71
- _classCallCheck(this, MetaAtlasSdk);
72
- _defineProperty(this, "onLoadCallback", undefined);
73
- _defineProperty(this, "onLoadFailCallback", undefined);
74
- _defineProperty(this, "mapLoaded", false);
75
- _defineProperty(this, "onFailCallbackSent", false);
76
- _defineProperty(this, "UserLayers", []);
77
- _defineProperty(this, "defaultFocusedTaxonomy", 'where.gbtb');
78
- _defineProperty(this, "currentFocus", this.defaultFocusedTaxonomy);
79
- _defineProperty(this, "apiAuthenticationCallbackReceived", false);
80
- _defineProperty(this, "routingVisualizer", new _routingVisualizer.RoutingVisualizer(this));
81
- // When token middleware is online that will check the tokens.
82
- _defineProperty(this, "tileServer", 'https://atoms-map-tiles-middleware.sandbox.spatialverse.online');
83
- // HOST = 'https://atoms-sdk.qa.cag.spatialverse.online/2.0.0/';
84
- _defineProperty(this, "HOST", 'https://atoms-sdk.sandbox.spatialverse.online/');
85
- //empApiURL = 'https://atoms-api.changiairport.com';
86
- _defineProperty(this, "empApiURL", 'https://atoms-api.sandbox.spatialverse.online');
87
- // empApiURL = 'https://atoms-api.dev.cag.spatialverse.online';
88
- _defineProperty(this, "mapBoxDrawSourceID", 'drawnDataSource');
89
- _defineProperty(this, "drawGeojsonData", {
90
- type: 'FeatureCollection',
91
- features: []
92
- });
93
- _defineProperty(this, "popups", []);
94
- _defineProperty(this, "markers", []);
95
- _defineProperty(this, "addCustomerLayer", function (map, jsonToPass, onLoaded) {
96
- var customerLayerUrl = jsonToPass.customerLayerUrl;
97
- var sourceLayer = jsonToPass.sourceLayer;
98
- _jquery["default"].getJSON(customerLayerUrl, function (customerLayers) {
99
- _this.CustomerLayers = customerLayers;
100
- var _iterator = _createForOfIteratorHelper(_this.CustomerLayers),
101
- _step;
102
- try {
103
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
104
- var layer = _step.value;
105
- layer["source-layer"] = sourceLayer;
106
- map.addLayer(layer);
107
- _this.map.on('click', layer.id, function (e) {
108
- //setup new clicked feature
109
- var clickedFeature = e.features[0];
110
- _this.overRideSelectionOfDrawnPointGeometry(clickedFeature);
111
- console.log('clickedFeature: ', clickedFeature);
112
- _this.logAnalyticsEvent('feature_clicked', {
113
- feature_clicked: clickedFeature.properties.title
114
- });
115
- if (clickedFeature.properties.isSearchable && clickedFeature.properties.title != 'Transit' && clickedFeature.properties.title != 'Public') {
116
- var coords = clickedFeature.geometry.type === "Polygon" ? JSON.parse(clickedFeature.properties.center) : clickedFeature.geometry.coordinates;
117
- _this.metaAtlasCore.setLastClickedFeature({
118
- mapObjectId: clickedFeature.properties.myMapObjectId,
119
- coordinates: coords,
120
- name: clickedFeature.properties.title,
121
- whatDimension: clickedFeature.properties.dimension_what,
122
- whereDimension: clickedFeature.properties.dimension_where,
123
- geometry: clickedFeature.geometry,
124
- properties: clickedFeature.properties,
125
- clickEvent: e
126
- });
127
- }
128
- });
129
- }
130
- } catch (err) {
131
- _iterator.e(err);
132
- } finally {
133
- _iterator.f();
134
- }
135
- onLoaded();
136
- });
48
+ const DEFAULT_MAP_STYLE = exports.DEFAULT_MAP_STYLE = 'https://api.maptiler.com/maps/01985ac8-56d2-707b-afa8-68abfe8f18be/style.json?key=12H5hrITUbJ1sDrVPqkq';
49
+ class MetaAtlasSdk {
50
+ onLoadCallback = (() => undefined)();
51
+ onLoadFailCallback = (() => undefined)();
52
+ mapLoaded = false;
53
+ onFailCallbackSent = false;
54
+ UserLayers = [];
55
+ defaultFocusedTaxonomy = 'where.gbtb';
56
+ currentFocus = this.defaultFocusedTaxonomy;
57
+ apiAuthenticationCallbackReceived = false;
58
+ routingVisualizer = (() => new _index.RoutingVisualizer(this))();
59
+ // When token middleware is online that will check the tokens.
60
+ tileServer = 'https://atoms-map-tiles-middleware.sandbox.spatialverse.online';
61
+ // HOST = 'https://atoms-sdk.qa.cag.spatialverse.online/2.0.0/';
62
+ HOST = 'https://atoms-sdk.sandbox.spatialverse.online/';
63
+ //empApiURL = 'https://atoms-api.changiairport.com';
64
+ empApiURL = 'https://atoms-api.sandbox.spatialverse.online';
65
+ // empApiURL = 'https://atoms-api.dev.cag.spatialverse.online';
66
+
67
+ mapBoxDrawSourceID = 'drawnDataSource';
68
+ drawGeojsonData = (() => ({
69
+ type: 'FeatureCollection',
70
+ features: []
71
+ }))();
72
+ popups = [];
73
+ markers = [];
74
+ setupFirebase() {
75
+ const firebaseConfig = {
76
+ apiKey: "AIzaSyBDWO2wNkotbgjbkyqVrC_OEAJ3mbvlheI",
77
+ authDomain: "tmt-lenovo-tech-day-26-id.firebaseapp.com",
78
+ projectId: "tmt-lenovo-tech-day-26-id",
79
+ storageBucket: "tmt-lenovo-tech-day-26-id.firebasestorage.app",
80
+ messagingSenderId: "618619544262",
81
+ appId: "1:618619544262:web:cb7a7953a908aeed212dc7",
82
+ measurementId: "G-HN2FS1L0P4"
83
+ };
84
+ this.firebaseApp = (0, _app.initializeApp)(firebaseConfig);
85
+ this.analytics = (0, _analytics.getAnalytics)(this.firebaseApp);
86
+ console.log('analytics: ', this.analytics);
87
+ }
88
+ logAnalyticsEvent(eventName, properties) {
89
+ console.log('logAnalyticsEvent: ', eventName, properties);
90
+ if (!this.analytics) {
91
+ console.warn('Analytics is not initialized. Event not logged:', eventName);
92
+ return;
93
+ }
94
+ if (properties) (0, _analytics.logEvent)(this.analytics, eventName, properties);else (0, _analytics.logEvent)(this.analytics, eventName);
95
+ }
96
+ onLoad() {
97
+ if (this.mapLoaded === true && this.apiAuthenticationCallbackReceived === true) {
98
+ // Setup routing visualizer
99
+ this.routingVisualizer.setupRouting(this.map);
100
+
101
+ // this.map3D.init(this.map);
102
+
103
+ if (this.onLoadCallback) {
104
+ this.onLoadCallback();
105
+ }
106
+ }
107
+ }
108
+ onLoadFail(message) {
109
+ if (this.onFailCallbackSent === false) {
110
+ this.onFailCallbackSent = true;
111
+ if (this.onLoadFailCallback) {
112
+ this.onLoadFailCallback(message);
113
+ }
114
+ }
115
+ }
116
+ initMetaAtlasCore(onRoutingStatusUpdate, onSearchStatusUpdate) {
117
+ this.metaAtlasCore.init(this.empApiURL, this.accessToken, this.secretKey, data => {
118
+ this.apiAuthenticationCallbackReceived = true;
119
+ if (data.authenticated) {
120
+ // Load routing data
121
+ this.metaAtlasCore.setupRouting(onRoutingStatusUpdate);
122
+ this.metaAtlasCore.setupMapObjectSearch(onSearchStatusUpdate);
123
+ this.map3D = new _MainMap.default(this.metaAtlasCore);
124
+ this.onLoad();
125
+ } else {
126
+ this.onLoadFail('Failed to authenticate token');
127
+ }
137
128
  });
129
+ }
130
+ constructor(accessToken, secretKey) {
131
+ let onLoad = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : () => {};
132
+ let onLoadFail = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : errorMessage => {};
133
+ let onRoutingStatusUpdate = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : () => {};
134
+ let onSearchStatusUpdate = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : () => {};
138
135
  this.accessToken = accessToken;
139
136
  this.secretKey = secretKey;
140
137
  this.onLoadCallback = onLoad;
@@ -142,1054 +139,829 @@ var MetaAtlasSdk = exports.MetaAtlasSdk = /*#__PURE__*/function () {
142
139
  this.map = null;
143
140
  this.mapBoxDraw = null;
144
141
  this.maplibregl = maplibregl;
145
- this.CustomerLayers = _customerLayer["default"];
146
- this.CustomerLayersVariant = _customerLayerVariant["default"];
142
+ this.CustomerLayers = _customerLayer.default;
143
+ this.CustomerLayersVariant = _customerLayerVariant.default;
147
144
  this.roleName = "changipublic";
148
145
  this.verNum = "1";
149
146
  this.metaAtlasCore = new _metaAtlasSdkCore.MetaAtlasCore();
150
147
  this.initMetaAtlasCore(onRoutingStatusUpdate, onSearchStatusUpdate);
151
148
  this.setupFirebase();
152
149
  }
153
- return _createClass(MetaAtlasSdk, [{
154
- key: "setupFirebase",
155
- value: function setupFirebase() {
156
- var firebaseConfig = {
157
- apiKey: "AIzaSyBDWO2wNkotbgjbkyqVrC_OEAJ3mbvlheI",
158
- authDomain: "tmt-lenovo-tech-day-26-id.firebaseapp.com",
159
- projectId: "tmt-lenovo-tech-day-26-id",
160
- storageBucket: "tmt-lenovo-tech-day-26-id.firebasestorage.app",
161
- messagingSenderId: "618619544262",
162
- appId: "1:618619544262:web:cb7a7953a908aeed212dc7",
163
- measurementId: "G-HN2FS1L0P4"
164
- };
165
- this.firebaseApp = (0, _app.initializeApp)(firebaseConfig);
166
- this.analytics = (0, _analytics.getAnalytics)(this.firebaseApp);
167
- console.log('analytics: ', this.analytics);
168
- }
169
- }, {
170
- key: "logAnalyticsEvent",
171
- value: function logAnalyticsEvent(eventName, properties) {
172
- console.log('logAnalyticsEvent: ', eventName, properties);
173
- if (!this.analytics) {
174
- console.warn('Analytics is not initialized. Event not logged:', eventName);
175
- return;
176
- }
177
- if (properties) (0, _analytics.logEvent)(this.analytics, eventName, properties);else (0, _analytics.logEvent)(this.analytics, eventName);
178
- }
179
- }, {
180
- key: "onLoad",
181
- value: function onLoad() {
182
- if (this.mapLoaded === true && this.apiAuthenticationCallbackReceived === true) {
183
- // Setup routing visualizer
184
- this.routingVisualizer.setupRouting(this.map);
185
-
186
- // this.map3D.init(this.map);
150
+ setupMap(role, mapDivOrMap) {
151
+ this.roleName = role;
187
152
 
188
- if (this.onLoadCallback) {
189
- this.onLoadCallback();
190
- }
191
- }
192
- }
193
- }, {
194
- key: "onLoadFail",
195
- value: function onLoadFail(message) {
196
- if (this.onFailCallbackSent === false) {
197
- this.onFailCallbackSent = true;
198
- if (this.onLoadFailCallback) {
199
- this.onLoadFailCallback(message);
200
- }
201
- }
202
- }
203
- }, {
204
- key: "initMetaAtlasCore",
205
- value: function initMetaAtlasCore(onRoutingStatusUpdate, onSearchStatusUpdate) {
206
- var _this2 = this;
207
- this.metaAtlasCore.init(this.empApiURL, this.accessToken, this.secretKey, function (data) {
208
- _this2.apiAuthenticationCallbackReceived = true;
209
- if (data.authenticated) {
210
- // Load routing data
211
- _this2.metaAtlasCore.setupRouting(onRoutingStatusUpdate);
212
- _this2.metaAtlasCore.setupMapObjectSearch(onSearchStatusUpdate);
213
- _this2.map3D = new _MainMap["default"](_this2.metaAtlasCore);
214
- _this2.onLoad();
215
- } else {
216
- _this2.onLoadFail('Failed to authenticate token');
217
- }
153
+ // Support both vanilla (string DOM ID) and React (Map instance) modes
154
+ if (typeof mapDivOrMap === 'string') {
155
+ // Vanilla mode: create new map instance
156
+ this.map = new maplibregl.Map({
157
+ container: mapDivOrMap,
158
+ style: DEFAULT_MAP_STYLE,
159
+ center: [110.40560122701005, 1.5626614114987702],
160
+ zoom: 18,
161
+ pitch: 42,
162
+ bearing: 23.4,
163
+ antialias: true,
164
+ attributionControl: false
218
165
  });
166
+ } else {
167
+ // React mode: use provided map instance
168
+ this.map = mapDivOrMap;
219
169
  }
220
- }, {
221
- key: "setupMap",
222
- value: function setupMap(role, mapDivOrMap) {
223
- var _this3 = this;
224
- this.roleName = role;
225
170
 
226
- // Support both vanilla (string DOM ID) and React (Map instance) modes
227
- if (typeof mapDivOrMap === 'string') {
228
- // Vanilla mode: create new map instance
229
- this.map = new maplibregl.Map({
230
- container: mapDivOrMap,
231
- style: DEFAULT_MAP_STYLE,
232
- center: [110.40560122701005, 1.5626614114987702],
233
- zoom: 18,
234
- pitch: 42,
235
- bearing: 23.4,
236
- antialias: true,
237
- attributionControl: false
171
+ // Initialize map setup (common for both modes)
172
+ const setupLayers = () => {
173
+ this.map.addSource('custom', {
174
+ type: 'vector',
175
+ url: this.tileServer + '/' + this.roleName + '/' + this.verNum + '/geojson?accessToken=' + this.accessToken
176
+ });
177
+ this.logAnalyticsEvent('open_app', {
178
+ type: 'web',
179
+ token: this.accessToken
180
+ });
181
+ this.map.on('click', e => {
182
+ // Reset last clicks
183
+ this.metaAtlasCore.setLastClickedFeature({
184
+ mapObjectId: null,
185
+ coordinates: null,
186
+ name: null,
187
+ whatDimension: null,
188
+ whereDimension: null,
189
+ geometry: null,
190
+ properties: null,
191
+ clickEvent: e
238
192
  });
239
- } else {
240
- // React mode: use provided map instance
241
- this.map = mapDivOrMap;
242
- }
193
+ this.lastClickedDrawing = this.setDrawing();
194
+ });
243
195
 
244
- // Initialize map setup (common for both modes)
245
- var setupLayers = function setupLayers() {
246
- _this3.map.addSource('custom', {
247
- type: 'vector',
248
- url: _this3.tileServer + '/' + _this3.roleName + '/' + _this3.verNum + '/geojson?accessToken=' + _this3.accessToken
249
- });
250
- _this3.logAnalyticsEvent('open_app', {
251
- type: 'web',
252
- token: _this3.accessToken
253
- });
254
- _this3.map.on('click', function (e) {
255
- // Reset last clicks
256
- _this3.metaAtlasCore.setLastClickedFeature({
257
- mapObjectId: null,
258
- coordinates: null,
259
- name: null,
260
- whatDimension: null,
261
- whereDimension: null,
262
- geometry: null,
263
- properties: null,
264
- clickEvent: e
196
+ // Setup map box draw after customerLayers so that draw geomertry shows up on top
197
+ const layersToAdd = this.CustomerLayers;
198
+ for (const layer of layersToAdd) {
199
+ layer["source-layer"] = 'geojson';
200
+ this.map.addLayer(layer);
201
+ this.map.on('click', layer.id, e => {
202
+ //setup new clicked feature
203
+ var clickedFeature = e.features[0];
204
+ console.log(clickedFeature);
205
+ this.logAnalyticsEvent('feature_clicked', {
206
+ feature_clicked: clickedFeature.properties.title
265
207
  });
266
- _this3.lastClickedDrawing = _this3.setDrawing();
267
- });
268
-
269
- // Setup map box draw after customerLayers so that draw geomertry shows up on top
270
- var layersToAdd = _this3.CustomerLayers;
271
- var _iterator2 = _createForOfIteratorHelper(layersToAdd),
272
- _step2;
273
- try {
274
- for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
275
- var layer = _step2.value;
276
- layer["source-layer"] = 'geojson';
277
- _this3.map.addLayer(layer);
278
- _this3.map.on('click', layer.id, function (e) {
279
- //setup new clicked feature
280
- var clickedFeature = e.features[0];
281
- console.log(clickedFeature);
282
- _this3.logAnalyticsEvent('feature_clicked', {
283
- feature_clicked: clickedFeature.properties.title
284
- });
285
- _this3.overRideSelectionOfDrawnPointGeometry(clickedFeature);
286
- if (clickedFeature.properties.dimension_what.includes('what.infra.garden') || clickedFeature.properties.isSearchable && clickedFeature.properties.title != 'Transit' && clickedFeature.properties.title != 'Public') {
287
- var coords = clickedFeature.geometry.type === "Polygon" || clickedFeature.geometry.type === "MultiPolygon" ? JSON.parse(clickedFeature.properties.center) : clickedFeature.geometry.coordinates;
288
- _this3.metaAtlasCore.setLastClickedFeature({
289
- mapObjectId: clickedFeature.properties.myMapObjectId,
290
- coordinates: coords,
291
- name: clickedFeature.properties.title,
292
- whatDimension: clickedFeature.properties.dimension_what,
293
- whereDimension: clickedFeature.properties.dimension_where,
294
- geometry: clickedFeature.geometry,
295
- properties: clickedFeature.properties,
296
- clickEvent: e
297
- });
298
- }
208
+ this.overRideSelectionOfDrawnPointGeometry(clickedFeature);
209
+ if (clickedFeature.properties.dimension_what.includes('what.infra.garden') || clickedFeature.properties.isSearchable && clickedFeature.properties.title != 'Transit' && clickedFeature.properties.title != 'Public') {
210
+ const coords = clickedFeature.geometry.type === "Polygon" || clickedFeature.geometry.type === "MultiPolygon" ? JSON.parse(clickedFeature.properties.center) : clickedFeature.geometry.coordinates;
211
+ this.metaAtlasCore.setLastClickedFeature({
212
+ mapObjectId: clickedFeature.properties.myMapObjectId,
213
+ coordinates: coords,
214
+ name: clickedFeature.properties.title,
215
+ whatDimension: clickedFeature.properties.dimension_what,
216
+ whereDimension: clickedFeature.properties.dimension_where,
217
+ geometry: clickedFeature.geometry,
218
+ properties: clickedFeature.properties,
219
+ clickEvent: e
299
220
  });
300
221
  }
301
- } catch (err) {
302
- _iterator2.e(err);
303
- } finally {
304
- _iterator2.f();
305
- }
306
- _this3.mapLoaded = true;
307
- _this3.setupMapBoxDraw();
308
- };
309
-
310
- // Check if map is already loaded (React mode with pre-existing map instance)
311
- if (this.map.loaded()) {
312
- // Map is already loaded, execute initialization directly
313
- setupLayers();
314
- } else {
315
- // Map not loaded yet, wait for load event (Vanilla mode)
316
- this.map.on('load', setupLayers);
222
+ });
317
223
  }
318
- this.map.on('error', function (error) {
319
- _this3.onLoadFail(error.message);
224
+ this.mapLoaded = true;
225
+ this.setupMapBoxDraw();
226
+ };
227
+
228
+ // Check if map is already loaded (React mode with pre-existing map instance)
229
+ if (this.map.loaded()) {
230
+ // Map is already loaded, execute initialization directly
231
+ setupLayers();
232
+ } else {
233
+ // Map not loaded yet, wait for load event (Vanilla mode)
234
+ this.map.on('load', setupLayers);
235
+ }
236
+ this.map.on('error', error => {
237
+ this.onLoadFail(error.message);
238
+ });
239
+ }
240
+ setupMapBoxDraw() {
241
+ this.mapBoxDraw = new _mapboxGlDraw.default({
242
+ displayControlsDefault: false,
243
+ userProperties: true,
244
+ modes: {
245
+ ..._mapboxGlDraw.default.modes,
246
+ draw_marker: _draw_marker.default,
247
+ marker_select: _marker_select.default
248
+ },
249
+ styles: _customStyles.mapBoxDrawDefaultStyles
250
+ });
251
+ this.map.addControl(this.mapBoxDraw);
252
+ this.map.addSource(this.mapBoxDrawSourceID, {
253
+ 'type': 'geojson',
254
+ 'data': this.drawGeojsonData
255
+ });
256
+ for (let index = 0; index < _customStyles.customStyles.length; index++) {
257
+ const element = _customStyles.customStyles[index];
258
+ element['source'] = this.mapBoxDrawSourceID;
259
+ this.map.addLayer(element);
260
+ this.map.on('click', element.id, e => {
261
+ this.metaAtlasCore.setLastClickedFeature({
262
+ mapObjectId: null,
263
+ coordinates: null,
264
+ name: null,
265
+ whatDimension: null,
266
+ whereDimension: null,
267
+ geometry: null,
268
+ properties: null,
269
+ clickEvent: e
270
+ });
271
+ var clickedFeature = e.features[0];
272
+ this.overRideSelectionOfDrawnPointGeometry(clickedFeature);
273
+ if (clickedFeature.properties.id) this.lastClickedDrawing = this.getDrawingById(clickedFeature.properties.id);else this.lastClickedDrawing = this.setDrawing();
320
274
  });
321
275
  }
322
- }, {
323
- key: "setupMapBoxDraw",
324
- value: function setupMapBoxDraw() {
325
- var _this4 = this;
326
- this.mapBoxDraw = new _mapboxGlDraw["default"]({
327
- displayControlsDefault: false,
328
- userProperties: true,
329
- modes: _objectSpread(_objectSpread({}, _mapboxGlDraw["default"].modes), {}, {
330
- draw_marker: _draw_marker["default"],
331
- marker_select: _marker_select["default"]
332
- }),
333
- styles: _customStyles.mapBoxDrawDefaultStyles
334
- });
335
- this.map.addControl(this.mapBoxDraw);
336
- this.map.addSource(this.mapBoxDrawSourceID, {
337
- 'type': 'geojson',
338
- 'data': this.drawGeojsonData
339
- });
340
- for (var index = 0; index < _customStyles.customStyles.length; index++) {
341
- var element = _customStyles.customStyles[index];
342
- element['source'] = this.mapBoxDrawSourceID;
343
- this.map.addLayer(element);
344
- this.map.on('click', element.id, function (e) {
345
- _this4.metaAtlasCore.setLastClickedFeature({
346
- mapObjectId: null,
347
- coordinates: null,
348
- name: null,
349
- whatDimension: null,
350
- whereDimension: null,
351
- geometry: null,
352
- properties: null,
353
- clickEvent: e
276
+ this.mapLoaded = true;
277
+ this.onLoad();
278
+ }
279
+ addCustomerLayer = (map, jsonToPass, onLoaded) => {
280
+ let customerLayerUrl = jsonToPass.customerLayerUrl;
281
+ let sourceLayer = jsonToPass.sourceLayer;
282
+ _jquery.default.getJSON(customerLayerUrl, customerLayers => {
283
+ this.CustomerLayers = customerLayers;
284
+ for (const layer of this.CustomerLayers) {
285
+ layer["source-layer"] = sourceLayer;
286
+ map.addLayer(layer);
287
+ this.map.on('click', layer.id, e => {
288
+ //setup new clicked feature
289
+ const clickedFeature = e.features[0];
290
+ this.overRideSelectionOfDrawnPointGeometry(clickedFeature);
291
+ console.log('clickedFeature: ', clickedFeature);
292
+ this.logAnalyticsEvent('feature_clicked', {
293
+ feature_clicked: clickedFeature.properties.title
354
294
  });
355
- var clickedFeature = e.features[0];
356
- _this4.overRideSelectionOfDrawnPointGeometry(clickedFeature);
357
- if (clickedFeature.properties.id) _this4.lastClickedDrawing = _this4.getDrawingById(clickedFeature.properties.id);else _this4.lastClickedDrawing = _this4.setDrawing();
295
+ if (clickedFeature.properties.isSearchable && clickedFeature.properties.title != 'Transit' && clickedFeature.properties.title != 'Public') {
296
+ const coords = clickedFeature.geometry.type === "Polygon" ? JSON.parse(clickedFeature.properties.center) : clickedFeature.geometry.coordinates;
297
+ this.metaAtlasCore.setLastClickedFeature({
298
+ mapObjectId: clickedFeature.properties.myMapObjectId,
299
+ coordinates: coords,
300
+ name: clickedFeature.properties.title,
301
+ whatDimension: clickedFeature.properties.dimension_what,
302
+ whereDimension: clickedFeature.properties.dimension_where,
303
+ geometry: clickedFeature.geometry,
304
+ properties: clickedFeature.properties,
305
+ clickEvent: e
306
+ });
307
+ }
358
308
  });
359
309
  }
360
- this.mapLoaded = true;
361
- this.onLoad();
362
- }
363
- }, {
364
- key: "overRideSelectionOfDrawnPointGeometry",
365
- value: function overRideSelectionOfDrawnPointGeometry(feature) {
366
- // Check if a drawn point geometry is currently selected, it will be consider selected both in highlighted & non-highlighted state.
367
- if (this.mapBoxDraw && this.mapBoxDraw.getMode() === 'simple_select' && this.mapBoxDraw.getAll().features.length === 1) {
368
- var mapBoxDrawFeature = this.mapBoxDraw.getAll().features;
369
- // If the passed in feature is not a drawn feature, then unselect drawn point type geometry
370
- if (feature.properties.id === undefined) this.mapBoxDraw.deleteAll();
371
- // If the passed in feature is a drawn feature, then unselect drawn point type geometry & highlight the passed in drawn geometry
372
- else if (feature.properties.id !== undefined && mapBoxDrawFeature[0].id !== feature.properties.id) {
373
- this.mapBoxDraw.deleteAll();
374
- var directSelectOptions = {
375
- featureId: feature.properties.id
376
- };
377
- // TODO: figure out why this doesn't work
378
- // this.mapBoxDraw.changeMode('direct_select', directSelectOptions)
379
- }
380
- }
381
- }
382
- }, {
383
- key: "getFocusTree",
384
- value: function getFocusTree() {
385
- return this.metaAtlasCore.getFocusTree();
386
- }
387
- }, {
388
- key: "setDrawing",
389
- value: function setDrawing() {
390
- var id = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
391
- var where = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
392
- var geom = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
393
- var props = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
394
- var clickedFeature = {
395
- "id": id,
396
- "where": where,
397
- "geometry": geom,
398
- "properties": props
399
- };
400
- return clickedFeature;
401
- }
402
- }, {
403
- key: "getLastClickedFeature",
404
- value: function getLastClickedFeature() {
405
- return this.metaAtlasCore.getLastClickedFeature();
406
- }
407
- }, {
408
- key: "getLastClickedDrawing",
409
- value: function getLastClickedDrawing() {
410
- var clickedDrawing = this.lastClickedDrawing;
411
- if (!this.lastClickedDrawing || this.lastClickedDrawing && (this.lastClickedDrawing.id === null || this.lastClickedDrawing.where === null)) {
412
- clickedDrawing = this.setDrawing();
310
+ onLoaded();
311
+ });
312
+ };
313
+ overRideSelectionOfDrawnPointGeometry(feature) {
314
+ // Check if a drawn point geometry is currently selected, it will be consider selected both in highlighted & non-highlighted state.
315
+ if (this.mapBoxDraw && this.mapBoxDraw.getMode() === 'simple_select' && this.mapBoxDraw.getAll().features.length === 1) {
316
+ const mapBoxDrawFeature = this.mapBoxDraw.getAll().features;
317
+ // If the passed in feature is not a drawn feature, then unselect drawn point type geometry
318
+ if (feature.properties.id === undefined) this.mapBoxDraw.deleteAll();
319
+ // If the passed in feature is a drawn feature, then unselect drawn point type geometry & highlight the passed in drawn geometry
320
+ else if (feature.properties.id !== undefined && mapBoxDrawFeature[0].id !== feature.properties.id) {
321
+ this.mapBoxDraw.deleteAll();
322
+ const directSelectOptions = {
323
+ featureId: feature.properties.id
324
+ };
325
+ // TODO: figure out why this doesn't work
326
+ // this.mapBoxDraw.changeMode('direct_select', directSelectOptions)
413
327
  }
414
- return clickedDrawing;
415
328
  }
416
- }, {
417
- key: "getMidPointOfFeature",
418
- value: function getMidPointOfFeature(feature) {
419
- return this.metaAtlasCore.getMidPointOfFeature(feature);
329
+ }
330
+ getFocusTree() {
331
+ return this.metaAtlasCore.getFocusTree();
332
+ }
333
+ setDrawing() {
334
+ let id = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
335
+ let where = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
336
+ let geom = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
337
+ let props = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
338
+ const clickedFeature = {
339
+ "id": id,
340
+ "where": where,
341
+ "geometry": geom,
342
+ "properties": props
343
+ };
344
+ return clickedFeature;
345
+ }
346
+ getLastClickedFeature() {
347
+ return this.metaAtlasCore.getLastClickedFeature();
348
+ }
349
+ getLastClickedDrawing() {
350
+ let clickedDrawing = this.lastClickedDrawing;
351
+ if (!this.lastClickedDrawing || this.lastClickedDrawing && (this.lastClickedDrawing.id === null || this.lastClickedDrawing.where === null)) {
352
+ clickedDrawing = this.setDrawing();
420
353
  }
421
- }, {
422
- key: "dropPin",
423
- value: function dropPin(mapItemSelected, popupStyle) {
424
- var replaceLast = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
425
- var pinObj = {
426
- feature: mapItemSelected,
427
- popupStyle: popupStyle
428
- };
429
- var markerElement = document.createElement('div');
430
- markerElement.innerHTML = pinObj.popupStyle;
431
- var popup = new maplibregl.Marker({
432
- element: markerElement
433
- }).setLngLat(this.getMidPointOfFeature(pinObj.feature)).addTo(this.map);
434
- if (replaceLast) {
435
- if (this.popups.length > 1) {
436
- this.popups[this.popups.length - 1].popup.remove();
437
- this.popups[this.popups.length - 1].popup = popup;
438
- this.popups[this.popups.length - 1].id = pinObj.feature.mapObjectId;
439
- } else {
440
- if (this.popups.length > 0) this.popups[this.popups.length - 1].popup.remove();
441
- this.popups = [{
442
- popup: popup,
443
- id: pinObj.feature.mapObjectId
444
- }];
445
- }
354
+ return clickedDrawing;
355
+ }
356
+ getMidPointOfFeature(feature) {
357
+ return this.metaAtlasCore.getMidPointOfFeature(feature);
358
+ }
359
+ dropPin(mapItemSelected, popupStyle) {
360
+ let replaceLast = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
361
+ const pinObj = {
362
+ feature: mapItemSelected,
363
+ popupStyle: popupStyle
364
+ };
365
+ const markerElement = document.createElement('div');
366
+ markerElement.innerHTML = pinObj.popupStyle;
367
+ const popup = new maplibregl.Marker({
368
+ element: markerElement
369
+ }).setLngLat(this.getMidPointOfFeature(pinObj.feature)).addTo(this.map);
370
+ if (replaceLast) {
371
+ if (this.popups.length > 1) {
372
+ this.popups[this.popups.length - 1].popup.remove();
373
+ this.popups[this.popups.length - 1].popup = popup;
374
+ this.popups[this.popups.length - 1].id = pinObj.feature.mapObjectId;
446
375
  } else {
447
- this.popups.push({
376
+ if (this.popups.length > 0) this.popups[this.popups.length - 1].popup.remove();
377
+ this.popups = [{
448
378
  popup: popup,
449
379
  id: pinObj.feature.mapObjectId
450
- });
380
+ }];
451
381
  }
452
- return this.popups[this.popups.length - 1].id;
382
+ } else {
383
+ this.popups.push({
384
+ popup: popup,
385
+ id: pinObj.feature.mapObjectId
386
+ });
453
387
  }
454
- }, {
455
- key: "dropMarkerForRouting",
456
- value: function dropMarkerForRouting(destinations) {
457
- var _this5 = this;
458
- destinations.forEach(function (destination) {
459
- var _destination$selected, _destination$selected2;
460
- console.log(destination.selectedLocation, 'destination.selectedLocation');
461
- var coordinates = (_destination$selected = destination.selectedLocation) !== null && _destination$selected !== void 0 && _destination$selected.coordinates ? destination.selectedLocation.coordinates : (_destination$selected2 = destination.selectedLocation) === null || _destination$selected2 === void 0 || (_destination$selected2 = _destination$selected2.geometry) === null || _destination$selected2 === void 0 ? void 0 : _destination$selected2.coordinates;
462
- console.log(coordinates, 'Coordinates'); // Debugging line
388
+ return this.popups[this.popups.length - 1].id;
389
+ }
390
+ dropMarkerForRouting(destinations) {
391
+ destinations.forEach(destination => {
392
+ console.log(destination.selectedLocation, 'destination.selectedLocation');
393
+ const coordinates = destination.selectedLocation?.coordinates ? destination.selectedLocation.coordinates : destination.selectedLocation?.geometry?.coordinates;
394
+ console.log(coordinates, 'Coordinates'); // Debugging line
463
395
 
464
- if (coordinates && coordinates.length === 2) {
465
- var marker = new _this5.maplibregl.Marker({
466
- color: '#188689'
467
- }).setLngLat([coordinates[0], coordinates[1]]) // Ensure correct format
468
- .addTo(_this5.map);
469
- _this5.markers.push(marker);
470
- } else {
471
- console.error('Invalid coordinates:', coordinates);
472
- }
396
+ if (coordinates && coordinates.length === 2) {
397
+ const marker = new this.maplibregl.Marker({
398
+ color: '#188689'
399
+ }).setLngLat([coordinates[0], coordinates[1]]) // Ensure correct format
400
+ .addTo(this.map);
401
+ this.markers.push(marker);
402
+ } else {
403
+ console.error('Invalid coordinates:', coordinates);
404
+ }
405
+ });
406
+ }
407
+ clearMarker() {
408
+ if (this.markers && this.markers.length > 0) {
409
+ this.markers.forEach(marker => {
410
+ marker.remove();
473
411
  });
474
412
  }
475
- }, {
476
- key: "clearMarker",
477
- value: function clearMarker() {
478
- if (this.markers && this.markers.length > 0) {
479
- this.markers.forEach(function (marker) {
480
- marker.remove();
481
- });
413
+ this.markers = [];
414
+ }
415
+ extractLocation(text) {
416
+ const match = text.match(/^(?:[^_]*_){3}([^_]*)/);
417
+ return match ? match[1] : null;
418
+ }
419
+ hidePin() {
420
+ let pinId = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '-1';
421
+ let targetPinId;
422
+ if (pinId === '-1') {
423
+ const lastPin = this.popups[this.popups.length - 1];
424
+ if (!lastPin) {
425
+ console.warn('No pins available to hide.');
426
+ return;
482
427
  }
483
- this.markers = [];
484
- }
485
- }, {
486
- key: "extractLocation",
487
- value: function extractLocation(text) {
488
- var match = text.match(/^(?:[^_]*_){3}([^_]*)/);
489
- return match ? match[1] : null;
428
+ targetPinId = lastPin.id;
429
+ } else {
430
+ targetPinId = pinId;
490
431
  }
491
- }, {
492
- key: "hidePin",
493
- value: function hidePin() {
494
- var pinId = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '-1';
495
- var targetPinId;
496
- if (pinId === '-1') {
497
- var lastPin = this.popups[this.popups.length - 1];
498
- if (!lastPin) {
499
- console.warn('No pins available to hide.');
500
- return;
501
- }
502
- targetPinId = lastPin.id;
503
- } else {
504
- targetPinId = pinId;
432
+ const pinToHide = this.popups.find(pin => pin.id === targetPinId);
433
+ if (pinToHide) {
434
+ let popupElem = pinToHide.popup.getElement();
435
+ if (popupElem) {
436
+ popupElem.style.display = 'none';
505
437
  }
506
- var pinToHide = this.popups.find(function (pin) {
507
- return pin.id === targetPinId;
508
- });
509
- if (pinToHide) {
510
- var popupElem = pinToHide.popup.getElement();
438
+ console.log(`Pin with ID: ${targetPinId} is now hidden.`);
439
+ } else {
440
+ console.warn(`Pin with ID: ${targetPinId} not found.`);
441
+ }
442
+ }
443
+ hidePins() {
444
+ if (this.popups.length > 0) {
445
+ this.popups.forEach(obj => {
446
+ let popupElem = obj.popup.getElement();
511
447
  if (popupElem) {
448
+ console.log(popupElem.style.display);
512
449
  popupElem.style.display = 'none';
513
450
  }
514
- console.log("Pin with ID: ".concat(targetPinId, " is now hidden."));
515
- } else {
516
- console.warn("Pin with ID: ".concat(targetPinId, " not found."));
517
- }
451
+ });
518
452
  }
519
- }, {
520
- key: "hidePins",
521
- value: function hidePins() {
522
- if (this.popups.length > 0) {
523
- this.popups.forEach(function (obj) {
524
- var popupElem = obj.popup.getElement();
525
- if (popupElem) {
526
- console.log(popupElem.style.display);
527
- popupElem.style.display = 'none';
528
- }
529
- });
453
+ }
454
+ showPin() {
455
+ let pinId = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '-1';
456
+ let targetPinId;
457
+ if (pinId === '-1') {
458
+ const lastPin = this.popups[this.popups.length - 1];
459
+ if (!lastPin) {
460
+ console.warn('No pins available to show.');
461
+ return;
530
462
  }
463
+ targetPinId = lastPin.id;
464
+ } else {
465
+ targetPinId = pinId;
531
466
  }
532
- }, {
533
- key: "showPin",
534
- value: function showPin() {
535
- var pinId = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '-1';
536
- var targetPinId;
537
- if (pinId === '-1') {
538
- var lastPin = this.popups[this.popups.length - 1];
539
- if (!lastPin) {
540
- console.warn('No pins available to show.');
541
- return;
542
- }
543
- targetPinId = lastPin.id;
544
- } else {
545
- targetPinId = pinId;
467
+ const pinToHide = this.popups.find(pin => pin.id === targetPinId);
468
+ if (pinToHide) {
469
+ let popupElem = pinToHide.popup.getElement();
470
+ if (popupElem) {
471
+ popupElem.style.display = 'flex';
546
472
  }
547
- var pinToHide = this.popups.find(function (pin) {
548
- return pin.id === targetPinId;
549
- });
550
- if (pinToHide) {
551
- var popupElem = pinToHide.popup.getElement();
473
+ console.log(`Pin with ID: ${targetPinId} is now visible.`);
474
+ } else {
475
+ console.warn(`Pin with ID: ${targetPinId} not found.`);
476
+ }
477
+ }
478
+ showPins() {
479
+ if (this.popups.length > 0) {
480
+ this.popups.forEach(obj => {
481
+ let popupElem = obj.popup.getElement();
552
482
  if (popupElem) {
553
483
  popupElem.style.display = 'flex';
554
484
  }
555
- console.log("Pin with ID: ".concat(targetPinId, " is now visible."));
556
- } else {
557
- console.warn("Pin with ID: ".concat(targetPinId, " not found."));
558
- }
559
- }
560
- }, {
561
- key: "showPins",
562
- value: function showPins() {
563
- if (this.popups.length > 0) {
564
- this.popups.forEach(function (obj) {
565
- var popupElem = obj.popup.getElement();
566
- if (popupElem) {
567
- popupElem.style.display = 'flex';
568
- }
569
- });
570
- }
485
+ });
571
486
  }
572
- }, {
573
- key: "clearPin",
574
- value: function clearPin() {
575
- var pinId = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '-1';
576
- var targetPinIndex;
577
- if (pinId === '-1') {
578
- targetPinIndex = this.popups.length - 1;
579
- if (targetPinIndex < 0) {
580
- console.warn('No pins available to clear.');
581
- return;
582
- }
583
- } else {
584
- targetPinIndex = this.popups.findIndex(function (pin) {
585
- return pin.id === pinId;
586
- });
587
- if (targetPinIndex === -1) {
588
- console.warn("Pin with ID: ".concat(pinId, " not found."));
589
- return;
590
- }
591
- }
592
- if (this.popups[targetPinIndex]) {
593
- this.popups[targetPinIndex].popup.remove();
594
- this.popups.splice(targetPinIndex, 1);
487
+ }
488
+ clearPin() {
489
+ let pinId = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '-1';
490
+ let targetPinIndex;
491
+ if (pinId === '-1') {
492
+ targetPinIndex = this.popups.length - 1;
493
+ if (targetPinIndex < 0) {
494
+ console.warn('No pins available to clear.');
495
+ return;
595
496
  }
596
- }
597
- }, {
598
- key: "clearPins",
599
- value: function clearPins() {
600
- if (this.popups.length > 0) {
601
- this.popups.forEach(function (obj) {
602
- obj.popup.remove();
603
- });
604
- this.popups.length = 0;
497
+ } else {
498
+ targetPinIndex = this.popups.findIndex(pin => pin.id === pinId);
499
+ if (targetPinIndex === -1) {
500
+ console.warn(`Pin with ID: ${pinId} not found.`);
501
+ return;
605
502
  }
606
503
  }
607
- }, {
608
- key: "removePin",
609
- value: function removePin() {
610
- (0, _jquery["default"])('.mapboxgl-popup').remove();
611
- }
612
- }, {
613
- key: "getCurrentFocus",
614
- value: function getCurrentFocus() {
615
- return this.metaAtlasCore.getCurrentFocus();
504
+ if (this.popups[targetPinIndex]) {
505
+ this.popups[targetPinIndex].popup.remove();
506
+ this.popups.splice(targetPinIndex, 1);
616
507
  }
617
- }, {
618
- key: "getCurrentFocusBuilding",
619
- value: function getCurrentFocusBuilding() {
620
- return this.metaAtlasCore.getCurrentFocusBuilding();
621
- }
622
- }, {
623
- key: "getCurrentFocusFloor",
624
- value: function getCurrentFocusFloor() {
625
- return this.metaAtlasCore.getCurrentFocusFloor();
626
- }
627
- }, {
628
- key: "addUserLayer",
629
- value: function addUserLayer(layer) {
630
- var _this6 = this;
631
- this.UserLayers.push(layer);
632
- this.map.addLayer(layer);
633
- this.map.on('click', layer.id, function (e) {
634
- //setup new clicked feature
635
- var clickedFeature = e.features[0];
636
- var coords = clickedFeature.geometry.type === "Polygon" ? JSON.parse(clickedFeature.properties.center) : clickedFeature.geometry.coordinates;
637
- _this6.metaAtlasCore.setLastClickedFeature({
638
- mapObjectId: clickedFeature.properties.id,
639
- coordinates: coords,
640
- name: clickedFeature.properties.name,
641
- whatDimension: clickedFeature.properties.dimension_what,
642
- whereDimension: clickedFeature.properties.dimension_where,
643
- geometry: clickedFeature.geometry,
644
- properties: clickedFeature.properties,
645
- clickEvent: e
646
- });
508
+ }
509
+ clearPins() {
510
+ if (this.popups.length > 0) {
511
+ this.popups.forEach(obj => {
512
+ obj.popup.remove();
647
513
  });
514
+ this.popups.length = 0;
648
515
  }
649
- }, {
650
- key: "filterWhereDimension",
651
- value: function filterWhereDimension(dimensionWhere) {
652
- // filter user layers
653
- var userLayers = (0, _cloneDeep["default"])(this.UserLayers);
654
- if (userLayers.length > 0) {
655
- var updatedUserLayersData = this.metaAtlasCore.filterBaseMapWhereDimension(userLayers, dimensionWhere);
656
- for (var index = 0; index < updatedUserLayersData.length; index++) {
657
- var layerID = updatedUserLayersData[index].id;
658
- var layerFilter = updatedUserLayersData[index].filter;
659
- userLayers[index].filter = layerFilter;
660
- this.map.setFilter(layerID, layerFilter);
661
- }
516
+ }
517
+ removePin() {
518
+ (0, _jquery.default)('.mapboxgl-popup').remove();
519
+ }
520
+ getCurrentFocus() {
521
+ return this.metaAtlasCore.getCurrentFocus();
522
+ }
523
+ getCurrentFocusBuilding() {
524
+ return this.metaAtlasCore.getCurrentFocusBuilding();
525
+ }
526
+ getCurrentFocusFloor() {
527
+ return this.metaAtlasCore.getCurrentFocusFloor();
528
+ }
529
+ addUserLayer(layer) {
530
+ this.UserLayers.push(layer);
531
+ this.map.addLayer(layer);
532
+ this.map.on('click', layer.id, e => {
533
+ //setup new clicked feature
534
+ var clickedFeature = e.features[0];
535
+ const coords = clickedFeature.geometry.type === "Polygon" ? JSON.parse(clickedFeature.properties.center) : clickedFeature.geometry.coordinates;
536
+ this.metaAtlasCore.setLastClickedFeature({
537
+ mapObjectId: clickedFeature.properties.id,
538
+ coordinates: coords,
539
+ name: clickedFeature.properties.name,
540
+ whatDimension: clickedFeature.properties.dimension_what,
541
+ whereDimension: clickedFeature.properties.dimension_where,
542
+ geometry: clickedFeature.geometry,
543
+ properties: clickedFeature.properties,
544
+ clickEvent: e
545
+ });
546
+ });
547
+ }
548
+ filterWhereDimension(dimensionWhere) {
549
+ // filter user layers
550
+ let userLayers = (0, _cloneDeep.default)(this.UserLayers);
551
+ if (userLayers.length > 0) {
552
+ let updatedUserLayersData = this.metaAtlasCore.filterBaseMapWhereDimension(userLayers, dimensionWhere);
553
+ for (let index = 0; index < updatedUserLayersData.length; index++) {
554
+ const layerID = updatedUserLayersData[index].id;
555
+ const layerFilter = updatedUserLayersData[index].filter;
556
+ userLayers[index].filter = layerFilter;
557
+ this.map.setFilter(layerID, layerFilter);
662
558
  }
559
+ }
663
560
 
664
- // filter basemap layers
665
- var layers = (0, _cloneDeep["default"])(this.CustomerLayers);
666
- for (var _index = 0; _index < layers.length; _index += 1) {
667
- var _layerID = layers[_index].id;
668
- var _layerFilter = this.map.getFilter(_layerID);
669
- layers[_index].filter = _layerFilter;
670
- }
671
- var updatedLayersData = this.metaAtlasCore.filterBaseMapWhereDimension(layers, dimensionWhere);
672
- for (var _index2 = 0; _index2 < updatedLayersData.length; _index2 += 1) {
673
- var _layerID2 = updatedLayersData[_index2].id;
674
- var _layerFilter2 = updatedLayersData[_index2].filter;
675
- this.map.setFilter(_layerID2, _layerFilter2);
676
- }
561
+ // filter basemap layers
562
+ let layers = (0, _cloneDeep.default)(this.CustomerLayers);
563
+ for (let index = 0; index < layers.length; index += 1) {
564
+ const layerID = layers[index].id;
565
+ const layerFilter = this.map.getFilter(layerID);
566
+ layers[index].filter = layerFilter;
567
+ }
568
+ let updatedLayersData = this.metaAtlasCore.filterBaseMapWhereDimension(layers, dimensionWhere);
569
+ for (let index = 0; index < updatedLayersData.length; index += 1) {
570
+ const layerID = updatedLayersData[index].id;
571
+ const layerFilter = updatedLayersData[index].filter;
572
+ this.map.setFilter(layerID, layerFilter);
573
+ }
677
574
 
678
- // // filter non-basemap layers
679
- // layers = cloneDeep(customStyles.concat(routeLayers));
680
- // for (let index = 0; index < layers.length; index += 1) {
681
- // const layerID = layers[index].id;
682
- // const layerFilter = this.map.getFilter(layerID);
683
- // layers[index].filter = layerFilter;
684
- // }
685
- // updatedLayersData =
686
- // this.metaAtlasCore.filterLayersWhereDimension(
687
- // layers,
688
- // dimensionWhere,
689
- // );
575
+ // // filter non-basemap layers
576
+ // layers = cloneDeep(customStyles.concat(routeLayers));
577
+ // for (let index = 0; index < layers.length; index += 1) {
578
+ // const layerID = layers[index].id;
579
+ // const layerFilter = this.map.getFilter(layerID);
580
+ // layers[index].filter = layerFilter;
581
+ // }
582
+ // updatedLayersData =
583
+ // this.metaAtlasCore.filterLayersWhereDimension(
584
+ // layers,
585
+ // dimensionWhere,
586
+ // );
690
587
 
691
- // for (let index = 0; index < updatedLayersData.length; index += 1) {
692
- // const layerID = updatedLayersData[index].id;
693
- // const layerFilter = updatedLayersData[index].filter;
694
- // }
695
- }
696
- }, {
697
- key: "focusTo",
698
- value: function focusTo(whereTaxonomyPath) {
699
- var moveCamera = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
700
- var map = this.map;
701
- var dimensionWhere = whereTaxonomyPath;
702
- if (!dimensionWhere || !map) return;
703
- console.log(whereTaxonomyPath, 'whereTaxonomyPath');
704
- this.filterWhereDimension(dimensionWhere);
705
- var isMobile = window.innerWidth < 768;
706
- if (moveCamera) {
707
- var flyToConfig = this.metaAtlasCore.getFlyToLocation(dimensionWhere, isMobile);
708
- this.map.flyTo({
709
- center: flyToConfig.center ? flyToConfig.center : this.map.getCenter(),
710
- zoom: flyToConfig.zoom ? flyToConfig.zoom : this.map.getZoom(),
711
- bearing: flyToConfig.bearing ? flyToConfig.bearing : this.map.getBearing(),
712
- speed: 0.8
713
- });
588
+ // for (let index = 0; index < updatedLayersData.length; index += 1) {
589
+ // const layerID = updatedLayersData[index].id;
590
+ // const layerFilter = updatedLayersData[index].filter;
591
+ // }
592
+ }
593
+ focusTo(whereTaxonomyPath) {
594
+ let moveCamera = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
595
+ const map = this.map;
596
+ let dimensionWhere = whereTaxonomyPath;
597
+ if (!dimensionWhere || !map) return;
598
+ console.log(whereTaxonomyPath, 'whereTaxonomyPath');
599
+ this.filterWhereDimension(dimensionWhere);
600
+ const isMobile = window.innerWidth < 768;
601
+ if (moveCamera) {
602
+ const flyToConfig = this.metaAtlasCore.getFlyToLocation(dimensionWhere, isMobile);
603
+ this.map.flyTo({
604
+ center: flyToConfig.center ? flyToConfig.center : this.map.getCenter(),
605
+ zoom: flyToConfig.zoom ? flyToConfig.zoom : this.map.getZoom(),
606
+ bearing: flyToConfig.bearing ? flyToConfig.bearing : this.map.getBearing(),
607
+ speed: 0.8
608
+ });
714
609
 
715
- // track inside so that only user requested focus is tracked
716
- // logEvent(this.analytics, 'focus_changed', { location: dimensionWhere });
717
- }
610
+ // track inside so that only user requested focus is tracked
611
+ // logEvent(this.analytics, 'focus_changed', { location: dimensionWhere });
718
612
  }
719
- }, {
720
- key: "filterLayersByCategories",
721
- value: function filterLayersByCategories(filterType, filterValues, geomType, dimensionWhat) {
722
- var map = this.map;
723
- if (!filterValues || !map) return;
724
- var layers = (0, _cloneDeep["default"])(this.CustomerLayers);
725
- for (var index = 0; index < layers.length; index += 1) {
726
- var layerID = layers[index].id;
727
- var layerFilter = this.map.getFilter(layerID);
728
- layers[index].filter = layerFilter;
729
- }
730
- var updatedLayersData = this.metaAtlasCore.filterLayersByCategories(layers, filterType, filterValues, geomType, dimensionWhat, this.map);
731
- for (var _index3 = 0; _index3 < updatedLayersData.length; _index3 += 1) {
732
- var _layerID3 = updatedLayersData[_index3].id;
733
- var _layerFilter3 = updatedLayersData[_index3].filter;
734
- this.map.setFilter(_layerID3, _layerFilter3);
735
- }
613
+ }
614
+ filterLayersByCategories(filterType, filterValues, geomType, dimensionWhat) {
615
+ const map = this.map;
616
+ if (!filterValues || !map) return;
617
+ let layers = (0, _cloneDeep.default)(this.CustomerLayers);
618
+ for (let index = 0; index < layers.length; index += 1) {
619
+ const layerID = layers[index].id;
620
+ const layerFilter = this.map.getFilter(layerID);
621
+ layers[index].filter = layerFilter;
622
+ }
623
+ let updatedLayersData = this.metaAtlasCore.filterLayersByCategories(layers, filterType, filterValues, geomType, dimensionWhat, this.map);
624
+ for (let index = 0; index < updatedLayersData.length; index += 1) {
625
+ const layerID = updatedLayersData[index].id;
626
+ const layerFilter = updatedLayersData[index].filter;
627
+ this.map.setFilter(layerID, layerFilter);
736
628
  }
737
- }, {
738
- key: "filterLayersByType",
739
- value: function filterLayersByType(filterType, filterValues) {
740
- var geomType = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
741
- var map = this.map;
742
- if (!filterValues || !map) return;
743
- var userLayers = (0, _cloneDeep["default"])(this.UserLayers);
744
- if (userLayers.length > 0) {
745
- var updatedUserLayersData = this.metaAtlasCore.filterLayersByType(userLayers, filterType, filterValues, geomType);
746
- for (var index = 0; index < updatedUserLayersData.length; index++) {
747
- var layerID = updatedUserLayersData[index].id;
748
- var layerFilter = updatedUserLayersData[index].filter;
749
- userLayers[index].filter = layerFilter;
750
- this.map.setFilter(layerID, layerFilter);
751
- }
629
+ }
630
+ filterLayersByType(filterType, filterValues) {
631
+ let geomType = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
632
+ const map = this.map;
633
+ if (!filterValues || !map) return;
634
+ let userLayers = (0, _cloneDeep.default)(this.UserLayers);
635
+ if (userLayers.length > 0) {
636
+ let updatedUserLayersData = this.metaAtlasCore.filterLayersByType(userLayers, filterType, filterValues, geomType);
637
+ for (let index = 0; index < updatedUserLayersData.length; index++) {
638
+ const layerID = updatedUserLayersData[index].id;
639
+ const layerFilter = updatedUserLayersData[index].filter;
640
+ userLayers[index].filter = layerFilter;
641
+ this.map.setFilter(layerID, layerFilter);
752
642
  }
753
643
  }
754
- }, {
755
- key: "styleLayersByType",
756
- value: function styleLayersByType(filterType, filterValues, property, value) {
757
- if (!filterValues || !this.map) return;
758
- var styleJson = this.map.getStyle();
759
- var layers = styleJson.layers;
760
- var updatedLayersData = this.metaAtlasCore.styleLayersByType(layers, filterType, filterValues, property, value);
761
- for (var index = 0; index < updatedLayersData.length; index += 1) {
762
- var layerID = updatedLayersData[index].id;
763
- var layerStyle = updatedLayersData[index].paint;
764
- var layerType = updatedLayersData[index].type;
765
- if (layerType && (layerType === 'fill' || layerType === 'line')) {
766
- if (layerStyle[property]) {
767
- this.map.setPaintProperty(layerID, property, layerStyle[property]);
768
- }
644
+ }
645
+ styleLayersByType(filterType, filterValues, property, value) {
646
+ if (!filterValues || !this.map) return;
647
+ let styleJson = this.map.getStyle();
648
+ let layers = styleJson.layers;
649
+ let updatedLayersData = this.metaAtlasCore.styleLayersByType(layers, filterType, filterValues, property, value);
650
+ for (let index = 0; index < updatedLayersData.length; index += 1) {
651
+ const layerID = updatedLayersData[index].id;
652
+ const layerStyle = updatedLayersData[index].paint;
653
+ const layerType = updatedLayersData[index].type;
654
+ if (layerType && (layerType === 'fill' || layerType === 'line')) {
655
+ if (layerStyle[property]) {
656
+ this.map.setPaintProperty(layerID, property, layerStyle[property]);
769
657
  }
770
658
  }
771
659
  }
772
- }, {
773
- key: "clearStyleLayersByType",
774
- value: function clearStyleLayersByType(filterType, filterValues, property) {
775
- if (!this.map) return;
776
- var styleJson = this.map.getStyle();
777
- var layers = styleJson.layers;
778
- var updatedLayersData = this.metaAtlasCore.clearStyleLayersByType(layers, filterType, filterValues, property);
779
- for (var index = 0; index < updatedLayersData.length; index += 1) {
780
- var layerID = updatedLayersData[index].id;
781
- var layerStyle = updatedLayersData[index].paint;
782
- var layerType = updatedLayersData[index].type;
783
- if (layerType && (layerType === 'fill' || layerType === 'line')) {
784
- if (layerStyle[property]) {
785
- this.map.setPaintProperty(layerID, property, layerStyle[property]);
786
- }
660
+ }
661
+ clearStyleLayersByType(filterType, filterValues, property) {
662
+ if (!this.map) return;
663
+ let styleJson = this.map.getStyle();
664
+ let layers = styleJson.layers;
665
+ let updatedLayersData = this.metaAtlasCore.clearStyleLayersByType(layers, filterType, filterValues, property);
666
+ for (let index = 0; index < updatedLayersData.length; index += 1) {
667
+ const layerID = updatedLayersData[index].id;
668
+ const layerStyle = updatedLayersData[index].paint;
669
+ const layerType = updatedLayersData[index].type;
670
+ if (layerType && (layerType === 'fill' || layerType === 'line')) {
671
+ if (layerStyle[property]) {
672
+ this.map.setPaintProperty(layerID, property, layerStyle[property]);
787
673
  }
788
674
  }
789
675
  }
790
- }, {
791
- key: "changeTerminalInFocusToUserViewpoint",
792
- value: function changeTerminalInFocusToUserViewpoint() {
793
- var defaultFloor = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
794
- var center = this.map.getCenter().wrap();
795
- var centerArray = [center.lng, center.lat];
796
- // console.log('center: ', center);
797
- if (this.metaAtlasCore.checkUserViewport(centerArray, this.getCurrentFocusBuilding(), this.getCurrentFocusFloor())) return true;
798
- //get building to focus to
799
- var building = this.metaAtlasCore.getUserViewportBuilding(centerArray);
800
- // console.log("focus to:");
801
- // console.log(building);
802
- if (!building) return false;
803
- //focus to default floor provided
804
- if (building["name"] in defaultFloor) {
805
- this.focusTo(defaultFloor[building["name"]], false);
806
- return true;
807
- }
808
- //focus to default floor in focusTree
809
- // if (!building.hasOwnProperty("defaultFloorPath")) return true;
810
- // this.focusTo(building["defaultFloorPath"], false);
811
-
676
+ }
677
+ changeTerminalInFocusToUserViewpoint() {
678
+ let defaultFloor = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
679
+ let center = this.map.getCenter().wrap();
680
+ const centerArray = [center.lng, center.lat];
681
+ // console.log('center: ', center);
682
+ if (this.metaAtlasCore.checkUserViewport(centerArray, this.getCurrentFocusBuilding(), this.getCurrentFocusFloor())) return true;
683
+ //get building to focus to
684
+ let building = this.metaAtlasCore.getUserViewportBuilding(centerArray);
685
+ // console.log("focus to:");
686
+ // console.log(building);
687
+ if (!building) return false;
688
+ //focus to default floor provided
689
+ if (building["name"] in defaultFloor) {
690
+ this.focusTo(defaultFloor[building["name"]], false);
812
691
  return true;
813
692
  }
814
- }, {
815
- key: "isLocationWithinHongKong",
816
- value: function isLocationWithinHongKong(location) {
817
- // Define the polygon coordinates
818
- var polygonCoordinates = [[103.59716039266556, 1.2570288388163817], [103.5792058079661, 1.2001127572538621], [103.69481581677104, 1.2005505778590049], [103.9124604166791, 1.2408297702235416], [104.07843084598773, 1.3003717948835174], [104.09332001378709, 1.3428384139758691], [104.06568408463107, 1.4395702492902842], [104.01405273250049, 1.430831826129534], [103.94486100905976, 1.4264524124152587], [103.88661860370877, 1.4347670822090777], [103.84020398120549, 1.470670314084117], [103.79466396668937, 1.467591709607774], [103.75700361138325, 1.4470255906078648], [103.72197278477057, 1.4605952336399213], [103.68041038922672, 1.4408697939934143], [103.64577440712543, 1.379174061413977], [103.59716039266556, 1.2570288388163817], [103.59716039266556, 1.2570288388163817] // Close the polygon by repeating the first point
819
- ];
693
+ //focus to default floor in focusTree
694
+ // if (!building.hasOwnProperty("defaultFloorPath")) return true;
695
+ // this.focusTo(building["defaultFloorPath"], false);
820
696
 
821
- // Create the polygon using Turf.js
822
- var polygon = (0, _helpers.polygon)([polygonCoordinates]);
697
+ return true;
698
+ }
699
+ isLocationWithinHongKong(location) {
700
+ // Define the polygon coordinates
701
+ const polygonCoordinates = [[103.59716039266556, 1.2570288388163817], [103.5792058079661, 1.2001127572538621], [103.69481581677104, 1.2005505778590049], [103.9124604166791, 1.2408297702235416], [104.07843084598773, 1.3003717948835174], [104.09332001378709, 1.3428384139758691], [104.06568408463107, 1.4395702492902842], [104.01405273250049, 1.430831826129534], [103.94486100905976, 1.4264524124152587], [103.88661860370877, 1.4347670822090777], [103.84020398120549, 1.470670314084117], [103.79466396668937, 1.467591709607774], [103.75700361138325, 1.4470255906078648], [103.72197278477057, 1.4605952336399213], [103.68041038922672, 1.4408697939934143], [103.64577440712543, 1.379174061413977], [103.59716039266556, 1.2570288388163817], [103.59716039266556, 1.2570288388163817] // Close the polygon by repeating the first point
702
+ ];
823
703
 
824
- // Define the point to check
825
- var point = (0, _helpers.point)(location); // Replace with your point's coordinates
704
+ // Create the polygon using Turf.js
705
+ const polygon = (0, _helpers.polygon)([polygonCoordinates]);
826
706
 
827
- // Check if the point is within the polygon
828
- var isInside = (0, _booleanPointInPolygon["default"])(point, polygon);
829
- return isInside;
830
- }
831
- }, {
832
- key: "getMapObjectsByFilteredLocalRef",
833
- value: function getMapObjectsByFilteredLocalRef() {
834
- var _this$metaAtlasCore;
835
- return (_this$metaAtlasCore = this.metaAtlasCore).getMapObjectsByFilteredLocalRef.apply(_this$metaAtlasCore, arguments);
836
- }
837
- }, {
838
- key: "getMapObjectsByName",
839
- value: function getMapObjectsByName() {
840
- var _this$metaAtlasCore2;
841
- return (_this$metaAtlasCore2 = this.metaAtlasCore).getMapObjectsByName.apply(_this$metaAtlasCore2, arguments);
842
- }
843
- }, {
844
- key: "getMapObjectById",
845
- value: function getMapObjectById() {
846
- var _this$metaAtlasCore3;
847
- return (_this$metaAtlasCore3 = this.metaAtlasCore).getMapObjectById.apply(_this$metaAtlasCore3, arguments);
848
- }
849
- }, {
850
- key: "getMapObjectByLocalRef",
851
- value: function getMapObjectByLocalRef() {
852
- var _this$metaAtlasCore4;
853
- return (_this$metaAtlasCore4 = this.metaAtlasCore).getMapObjectByLocalRef.apply(_this$metaAtlasCore4, arguments);
854
- }
855
- }, {
856
- key: "getMapObjectMatchingLocalRef",
857
- value: function getMapObjectMatchingLocalRef() {
858
- var _this$metaAtlasCore5;
859
- return (_this$metaAtlasCore5 = this.metaAtlasCore).getMapObjectMatchingLocalRef.apply(_this$metaAtlasCore5, arguments);
860
- }
861
- }, {
862
- key: "getMapObjectsMatchingLocalRefs",
863
- value: function getMapObjectsMatchingLocalRefs() {
864
- var _this$metaAtlasCore6;
865
- return (_this$metaAtlasCore6 = this.metaAtlasCore).getMapObjectsMatchingLocalRefs.apply(_this$metaAtlasCore6, arguments);
866
- }
867
- }, {
868
- key: "getMapObjectsByWhatTaxonomy",
869
- value: function getMapObjectsByWhatTaxonomy() {
870
- var _this$metaAtlasCore7;
871
- return (_this$metaAtlasCore7 = this.metaAtlasCore).getMapObjectsByWhatTaxonomy.apply(_this$metaAtlasCore7, arguments);
872
- }
873
- }, {
874
- key: "getMapObjectsByWhatTaxonomyAPI",
875
- value: function getMapObjectsByWhatTaxonomyAPI() {
876
- var _this$metaAtlasCore8;
877
- return (_this$metaAtlasCore8 = this.metaAtlasCore).getMapObjectsByWhatTaxonomyAPI.apply(_this$metaAtlasCore8, arguments);
878
- }
879
- }, {
880
- key: "getMapObjectsByWhereTaxonomy",
881
- value: function getMapObjectsByWhereTaxonomy() {
882
- var _this$metaAtlasCore9;
883
- return (_this$metaAtlasCore9 = this.metaAtlasCore).getMapObjectsByWhereTaxonomy.apply(_this$metaAtlasCore9, arguments);
884
- }
885
- }, {
886
- key: "getMapObjectsByWhatAndWhereTaxonomy",
887
- value: function getMapObjectsByWhatAndWhereTaxonomy() {
888
- var _this$metaAtlasCore0;
889
- return (_this$metaAtlasCore0 = this.metaAtlasCore).getMapObjectsByWhatAndWhereTaxonomy.apply(_this$metaAtlasCore0, arguments);
890
- }
891
- }, {
892
- key: "getMapObjectsInWhatTaxonomy",
893
- value: function getMapObjectsInWhatTaxonomy() {
894
- var _this$metaAtlasCore1;
895
- return (_this$metaAtlasCore1 = this.metaAtlasCore).getMapObjectsInWhatTaxonomy.apply(_this$metaAtlasCore1, arguments);
896
- }
897
- }, {
898
- key: "getMapObjectsInWhereTaxonomy",
899
- value: function getMapObjectsInWhereTaxonomy() {
900
- var _this$metaAtlasCore10;
901
- return (_this$metaAtlasCore10 = this.metaAtlasCore).getMapObjectsInWhereTaxonomy.apply(_this$metaAtlasCore10, arguments);
902
- }
707
+ // Define the point to check
708
+ const point = (0, _helpers.point)(location); // Replace with your point's coordinates
903
709
 
904
- // Routing
905
- }, {
906
- key: "computeRoute",
907
- value: function computeRoute() {
908
- var _this$routingVisualiz;
909
- return (_this$routingVisualiz = this.routingVisualizer).computeRoute.apply(_this$routingVisualiz, arguments);
910
- }
911
- }, {
912
- key: "computeRoutes",
913
- value: function computeRoutes(mapObjectIds) {
914
- var _this7 = this;
915
- var wheelChairAccessibleRouteOnly = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
916
- var source = arguments.length > 2 ? arguments[2] : undefined;
917
- var ref = this;
918
- var logRouteEvent = /*#__PURE__*/function () {
919
- var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2() {
920
- var getNameByIdAsync, getNamesFromIds, names;
921
- return _regenerator().w(function (_context2) {
922
- while (1) switch (_context2.n) {
923
- case 0:
924
- getNameByIdAsync = function getNameByIdAsync(id) {
925
- return new Promise(function (resolve) {
926
- if (typeof id !== 'string') resolve('User GPS Location');
927
- ref.getMapObjectById(id, function (mapObj) {
928
- var _mapObj$;
929
- resolve((_mapObj$ = mapObj[0]) === null || _mapObj$ === void 0 ? void 0 : _mapObj$.name);
930
- });
931
- });
932
- };
933
- getNamesFromIds = /*#__PURE__*/function () {
934
- var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(idList) {
935
- var namePromises;
936
- return _regenerator().w(function (_context) {
937
- while (1) switch (_context.n) {
938
- case 0:
939
- namePromises = idList.map(function (id) {
940
- return getNameByIdAsync(id);
941
- });
942
- _context.n = 1;
943
- return Promise.all(namePromises);
944
- case 1:
945
- return _context.a(2, _context.v);
946
- }
947
- }, _callee);
948
- }));
949
- return function getNamesFromIds(_x) {
950
- return _ref2.apply(this, arguments);
951
- };
952
- }();
953
- _context2.n = 1;
954
- return getNamesFromIds(mapObjectIds);
955
- case 1:
956
- names = _context2.v;
957
- names.forEach(function (name) {
958
- _this7.logAnalyticsEvent('route_per_object', {
959
- destination: name,
960
- route_per_object_event_source: source
961
- });
962
- });
963
- _this7.logAnalyticsEvent('route', {
964
- destinations: names,
965
- route_event_source: source
966
- });
967
- case 2:
968
- return _context2.a(2);
969
- }
970
- }, _callee2);
971
- }));
972
- return function logRouteEvent() {
973
- return _ref.apply(this, arguments);
974
- };
975
- }();
976
- logRouteEvent();
977
- return this.routingVisualizer.computeRoutes(mapObjectIds, wheelChairAccessibleRouteOnly);
978
- }
979
- }, {
980
- key: "setActiveRoute",
981
- value: function setActiveRoute() {
982
- var _this$routingVisualiz2;
983
- return (_this$routingVisualiz2 = this.routingVisualizer).setActiveRoute.apply(_this$routingVisualiz2, arguments);
984
- }
985
- }, {
986
- key: "getActiveRoute",
987
- value: function getActiveRoute() {
988
- var _this$routingVisualiz3;
989
- return (_this$routingVisualiz3 = this.routingVisualizer).getActiveRoute.apply(_this$routingVisualiz3, arguments);
990
- }
991
- }, {
992
- key: "highlightRouteSegment",
993
- value: function highlightRouteSegment() {
994
- var _this$routingVisualiz4;
995
- return (_this$routingVisualiz4 = this.routingVisualizer).highlightRouteSegment.apply(_this$routingVisualiz4, arguments);
996
- }
997
- }, {
998
- key: "clearRoute",
999
- value: function clearRoute() {
1000
- var _this$routingVisualiz5;
1001
- return (_this$routingVisualiz5 = this.routingVisualizer).clearRoute.apply(_this$routingVisualiz5, arguments);
1002
- }
710
+ // Check if the point is within the polygon
711
+ const isInside = (0, _booleanPointInPolygon.default)(point, polygon);
712
+ return isInside;
713
+ }
714
+ getMapObjectsByFilteredLocalRef() {
715
+ return this.metaAtlasCore.getMapObjectsByFilteredLocalRef(...arguments);
716
+ }
717
+ getMapObjectsByName() {
718
+ return this.metaAtlasCore.getMapObjectsByName(...arguments);
719
+ }
720
+ getMapObjectById() {
721
+ return this.metaAtlasCore.getMapObjectById(...arguments);
722
+ }
723
+ getMapObjectByLocalRef() {
724
+ return this.metaAtlasCore.getMapObjectByLocalRef(...arguments);
725
+ }
726
+ getMapObjectMatchingLocalRef() {
727
+ return this.metaAtlasCore.getMapObjectMatchingLocalRef(...arguments);
728
+ }
729
+ getMapObjectsMatchingLocalRefs() {
730
+ return this.metaAtlasCore.getMapObjectsMatchingLocalRefs(...arguments);
731
+ }
732
+ getMapObjectsByWhatTaxonomy() {
733
+ return this.metaAtlasCore.getMapObjectsByWhatTaxonomy(...arguments);
734
+ }
735
+ getMapObjectsByWhatTaxonomyAPI() {
736
+ return this.metaAtlasCore.getMapObjectsByWhatTaxonomyAPI(...arguments);
737
+ }
738
+ getMapObjectsByWhereTaxonomy() {
739
+ return this.metaAtlasCore.getMapObjectsByWhereTaxonomy(...arguments);
740
+ }
741
+ getMapObjectsByWhatAndWhereTaxonomy() {
742
+ return this.metaAtlasCore.getMapObjectsByWhatAndWhereTaxonomy(...arguments);
743
+ }
744
+ getMapObjectsInWhatTaxonomy() {
745
+ return this.metaAtlasCore.getMapObjectsInWhatTaxonomy(...arguments);
746
+ }
747
+ getMapObjectsInWhereTaxonomy() {
748
+ return this.metaAtlasCore.getMapObjectsInWhereTaxonomy(...arguments);
749
+ }
1003
750
 
1004
- // Drawing
1005
- }, {
1006
- key: "drawGeometryOnMap",
1007
- value: function drawGeometryOnMap(type, onDrawEnd) {
1008
- var _this8 = this;
1009
- var onlyVisibleAtCurrentFocus = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
1010
- //if already in edit mode
1011
- if (this.mapBoxDraw.getMode() !== 'simple_select') return false;
1012
- var modeChanged = false;
1013
- if (type === 'draw_point') {
1014
- this.mapBoxDraw.changeMode("draw_point");
1015
- modeChanged = true;
1016
- } else if (type === 'draw_line_string') {
1017
- this.mapBoxDraw.changeMode("draw_line_string");
1018
- modeChanged = true;
1019
- } else if (type === 'draw_polygon') {
1020
- this.mapBoxDraw.changeMode("draw_polygon");
1021
- modeChanged = true;
1022
- } else if (type === 'draw_marker') {
1023
- this.mapBoxDraw.changeMode("draw_marker");
1024
- modeChanged = true;
1025
- } else console.warn("Unsupported mode passed to drawGeometryOnMap");
1026
- if (modeChanged) {
1027
- this.map.once('draw.create', function (drawings) {
1028
- var finalDrawing = drawings['features'][0];
1029
- finalDrawing.properties.id = finalDrawing.id;
1030
- if (onlyVisibleAtCurrentFocus) finalDrawing.properties.dimension_where = _this8.getCurrentFocus();else finalDrawing.properties.dimension_where = _this8.defaultFocusedTaxonomy;
1031
- onDrawEnd(finalDrawing);
751
+ // Routing
752
+ computeRoute() {
753
+ return this.routingVisualizer.computeRoute(...arguments);
754
+ }
755
+ computeRoutes(mapObjectIds) {
756
+ let wheelChairAccessibleRouteOnly = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
757
+ let source = arguments.length > 2 ? arguments[2] : undefined;
758
+ const ref = this;
759
+ const logRouteEvent = async () => {
760
+ const getNameByIdAsync = id => {
761
+ return new Promise(resolve => {
762
+ if (typeof id !== 'string') resolve('User GPS Location');
763
+ ref.getMapObjectById(id, mapObj => {
764
+ resolve(mapObj[0]?.name);
765
+ });
1032
766
  });
1033
- this.map.once('draw.modechange', function () {
1034
- _this8.mapBoxDraw.deleteAll();
1035
- // if (this.mapBoxDraw.getMode() === 'simple_select') onDrawEnd();
1036
- // else console.warn("Unexpected mode received in mode change callback");
767
+ };
768
+ const getNamesFromIds = async idList => {
769
+ const namePromises = idList.map(id => getNameByIdAsync(id));
770
+ return await Promise.all(namePromises);
771
+ };
772
+ const names = await getNamesFromIds(mapObjectIds);
773
+ names.forEach(name => {
774
+ this.logAnalyticsEvent('route_per_object', {
775
+ destination: name,
776
+ route_per_object_event_source: source
1037
777
  });
778
+ });
779
+ this.logAnalyticsEvent('route', {
780
+ destinations: names,
781
+ route_event_source: source
782
+ });
783
+ };
784
+ logRouteEvent();
785
+ return this.routingVisualizer.computeRoutes(mapObjectIds, wheelChairAccessibleRouteOnly);
786
+ }
787
+ setActiveRoute() {
788
+ return this.routingVisualizer.setActiveRoute(...arguments);
789
+ }
790
+ getActiveRoute() {
791
+ return this.routingVisualizer.getActiveRoute(...arguments);
792
+ }
793
+ highlightRouteSegment() {
794
+ return this.routingVisualizer.highlightRouteSegment(...arguments);
795
+ }
796
+ clearRoute() {
797
+ return this.routingVisualizer.clearRoute(...arguments);
798
+ }
799
+
800
+ // Drawing
801
+ drawGeometryOnMap(type, onDrawEnd) {
802
+ let onlyVisibleAtCurrentFocus = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
803
+ //if already in edit mode
804
+ if (this.mapBoxDraw.getMode() !== 'simple_select') return false;
805
+ let modeChanged = false;
806
+ if (type === 'draw_point') {
807
+ this.mapBoxDraw.changeMode("draw_point");
808
+ modeChanged = true;
809
+ } else if (type === 'draw_line_string') {
810
+ this.mapBoxDraw.changeMode("draw_line_string");
811
+ modeChanged = true;
812
+ } else if (type === 'draw_polygon') {
813
+ this.mapBoxDraw.changeMode("draw_polygon");
814
+ modeChanged = true;
815
+ } else if (type === 'draw_marker') {
816
+ this.mapBoxDraw.changeMode("draw_marker");
817
+ modeChanged = true;
818
+ } else console.warn("Unsupported mode passed to drawGeometryOnMap");
819
+ if (modeChanged) {
820
+ this.map.once('draw.create', drawings => {
821
+ let finalDrawing = drawings['features'][0];
822
+ finalDrawing.properties.id = finalDrawing.id;
823
+ if (onlyVisibleAtCurrentFocus) finalDrawing.properties.dimension_where = this.getCurrentFocus();else finalDrawing.properties.dimension_where = this.defaultFocusedTaxonomy;
824
+ onDrawEnd(finalDrawing);
825
+ });
826
+ this.map.once('draw.modechange', () => {
827
+ this.mapBoxDraw.deleteAll();
828
+ // if (this.mapBoxDraw.getMode() === 'simple_select') onDrawEnd();
829
+ // else console.warn("Unexpected mode received in mode change callback");
830
+ });
831
+ }
832
+ return modeChanged;
833
+ }
834
+ isInDrawMode() {
835
+ return this.mapBoxDraw && this.mapBoxDraw.getAll().features.length > 0;
836
+ }
837
+ addDrawingsToBaseMap(drawings) {
838
+ this.drawGeojsonData.features = this.drawGeojsonData.features.concat(drawings);
839
+ this.map.getSource(this.mapBoxDrawSourceID).setData(this.drawGeojsonData);
840
+ }
841
+ getDrawingById(id) {
842
+ for (let index = 0; index < this.drawGeojsonData.features.length; index++) {
843
+ const drawing = this.drawGeojsonData.features[index];
844
+ if (drawing.id === id) {
845
+ return drawing;
1038
846
  }
1039
- return modeChanged;
1040
847
  }
1041
- }, {
1042
- key: "isInDrawMode",
1043
- value: function isInDrawMode() {
1044
- return this.mapBoxDraw && this.mapBoxDraw.getAll().features.length > 0;
848
+ return undefined;
849
+ }
850
+ editDrawing(id) {
851
+ if (id === undefined) {
852
+ console.warn("maplibregl.Feature data passed to editDrawing does not contain an id. Edit request cancelled. Make sure the feature data passed in was created using draw");
853
+ return false;
1045
854
  }
1046
- }, {
1047
- key: "addDrawingsToBaseMap",
1048
- value: function addDrawingsToBaseMap(drawings) {
1049
- this.drawGeojsonData.features = this.drawGeojsonData.features.concat(drawings);
1050
- this.map.getSource(this.mapBoxDrawSourceID).setData(this.drawGeojsonData);
855
+ let drawing = this.getDrawingById(id);
856
+ if (drawing === undefined) {
857
+ console.warn("There is no data against the id passed in to editDrawing, operation cancelled.");
858
+ return false;
1051
859
  }
1052
- }, {
1053
- key: "getDrawingById",
1054
- value: function getDrawingById(id) {
1055
- for (var index = 0; index < this.drawGeojsonData.features.length; index++) {
1056
- var drawing = this.drawGeojsonData.features[index];
1057
- if (drawing.id === id) {
1058
- return drawing;
860
+ let featureCollection = {
861
+ type: 'FeatureCollection',
862
+ features: [drawing]
863
+ };
864
+ //console.log(featureCollection)
865
+ this.mapBoxDraw.set(featureCollection);
866
+ const saveEditsToBaseMap = featureId => {
867
+ const updatedFeature = this.mapBoxDraw.get(featureId);
868
+ this.mapBoxDraw.deleteAll();
869
+ if (updatedFeature) {
870
+ let featureFoundInBaseMapData = false;
871
+ for (let index = 0; index < this.drawGeojsonData.features.length; index++) {
872
+ const feature = this.drawGeojsonData.features[index];
873
+ if (feature.id === updatedFeature.id) {
874
+ this.drawGeojsonData.features[index] = updatedFeature;
875
+ featureFoundInBaseMapData = true;
876
+ }
1059
877
  }
878
+ if (featureFoundInBaseMapData) this.map.getSource(this.mapBoxDrawSourceID).setData(this.drawGeojsonData);else console.warn("Edited feature data not found in base map. Make sure addFeaturesToBaseMap was called on feature data before editing.");
1060
879
  }
1061
- return undefined;
1062
- }
1063
- }, {
1064
- key: "editDrawing",
1065
- value: function editDrawing(id) {
1066
- var _this9 = this;
1067
- if (id === undefined) {
1068
- console.warn("maplibregl.Feature data passed to editDrawing does not contain an id. Edit request cancelled. Make sure the feature data passed in was created using draw");
1069
- return false;
1070
- }
1071
- var drawing = this.getDrawingById(id);
1072
- if (drawing === undefined) {
1073
- console.warn("There is no data against the id passed in to editDrawing, operation cancelled.");
1074
- return false;
880
+ };
881
+ if (drawing.geometry.type !== 'Point') {
882
+ if (drawing.properties.marker !== undefined) {
883
+ this.mapBoxDraw.changeMode('marker_select', {
884
+ featureId: drawing.id
885
+ });
886
+ } else {
887
+ this.mapBoxDraw.changeMode('direct_select', {
888
+ featureId: drawing.id
889
+ });
1075
890
  }
1076
- var featureCollection = {
1077
- type: 'FeatureCollection',
1078
- features: [drawing]
1079
- };
1080
- //console.log(featureCollection)
1081
- this.mapBoxDraw.set(featureCollection);
1082
- var saveEditsToBaseMap = function saveEditsToBaseMap(featureId) {
1083
- var updatedFeature = _this9.mapBoxDraw.get(featureId);
1084
- _this9.mapBoxDraw.deleteAll();
1085
- if (updatedFeature) {
1086
- var featureFoundInBaseMapData = false;
1087
- for (var index = 0; index < _this9.drawGeojsonData.features.length; index++) {
1088
- var feature = _this9.drawGeojsonData.features[index];
1089
- if (feature.id === updatedFeature.id) {
1090
- _this9.drawGeojsonData.features[index] = updatedFeature;
1091
- featureFoundInBaseMapData = true;
1092
- }
891
+ this.map.once('draw.modechange', () => {
892
+ if (this.mapBoxDraw.getMode() !== 'simple_select') return;
893
+ saveEditsToBaseMap(drawing.id);
894
+ });
895
+ } else {
896
+ let featureToEditSelectedAlready = false;
897
+ const onSelectionChanged = selectionData => {
898
+ //console.log(selectionData, drawing)
899
+ if (selectionData.features.length > 0 && selectionData.features[0].id === drawing.id) {
900
+ if (!featureToEditSelectedAlready) {
901
+ featureToEditSelectedAlready = true;
1093
902
  }
1094
- if (featureFoundInBaseMapData) _this9.map.getSource(_this9.mapBoxDrawSourceID).setData(_this9.drawGeojsonData);else console.warn("Edited feature data not found in base map. Make sure addFeaturesToBaseMap was called on feature data before editing.");
903
+ } else if (featureToEditSelectedAlready) {
904
+ saveEditsToBaseMap(drawing.id);
905
+ this.map.off('draw.selectionchange', onSelectionChanged);
1095
906
  }
1096
907
  };
1097
- if (drawing.geometry.type !== 'Point') {
1098
- if (drawing.properties.marker !== undefined) {
1099
- this.mapBoxDraw.changeMode('marker_select', {
1100
- featureId: drawing.id
1101
- });
1102
- } else {
1103
- this.mapBoxDraw.changeMode('direct_select', {
1104
- featureId: drawing.id
1105
- });
1106
- }
1107
- this.map.once('draw.modechange', function () {
1108
- if (_this9.mapBoxDraw.getMode() !== 'simple_select') return;
1109
- saveEditsToBaseMap(drawing.id);
1110
- });
1111
- } else {
1112
- var featureToEditSelectedAlready = false;
1113
- var _onSelectionChanged = function onSelectionChanged(selectionData) {
1114
- //console.log(selectionData, drawing)
1115
- if (selectionData.features.length > 0 && selectionData.features[0].id === drawing.id) {
1116
- if (!featureToEditSelectedAlready) {
1117
- featureToEditSelectedAlready = true;
1118
- }
1119
- } else if (featureToEditSelectedAlready) {
1120
- saveEditsToBaseMap(drawing.id);
1121
- _this9.map.off('draw.selectionchange', _onSelectionChanged);
1122
- }
1123
- };
1124
- this.map.on('draw.selectionchange', _onSelectionChanged);
1125
- }
1126
- return true;
908
+ this.map.on('draw.selectionchange', onSelectionChanged);
1127
909
  }
1128
- }, {
1129
- key: "removeDrawing",
1130
- value: function removeDrawing(id) {
1131
- for (var index = 0; index < this.drawGeojsonData.features.length; index++) {
1132
- var drawing = this.drawGeojsonData.features[index];
1133
- if (drawing.id === id) {
1134
- this.drawGeojsonData.features.splice(index, 1);
1135
- this.map.getSource(this.mapBoxDrawSourceID).setData(this.drawGeojsonData);
1136
- return true;
1137
- }
910
+ return true;
911
+ }
912
+ removeDrawing(id) {
913
+ for (let index = 0; index < this.drawGeojsonData.features.length; index++) {
914
+ const drawing = this.drawGeojsonData.features[index];
915
+ if (drawing.id === id) {
916
+ this.drawGeojsonData.features.splice(index, 1);
917
+ this.map.getSource(this.mapBoxDrawSourceID).setData(this.drawGeojsonData);
918
+ return true;
1138
919
  }
1139
- return false;
1140
920
  }
1141
- }, {
1142
- key: "createMarker",
1143
- value: function createMarker(options) {
1144
- if (options === undefined) options = {};
1145
- options.draggable = true;
1146
- options.color = '#FFB52E';
1147
- var marker = new maplibregl.Marker(options).setLngLat(this.map.getCenter()).addTo(this.map);
1148
- this.map.once('click', function () {
1149
- marker.setDraggable(false);
921
+ return false;
922
+ }
923
+ createMarker(options) {
924
+ if (options === undefined) options = {};
925
+ options.draggable = true;
926
+ options.color = '#FFB52E';
927
+ const marker = new maplibregl.Marker(options).setLngLat(this.map.getCenter()).addTo(this.map);
928
+ this.map.once('click', () => {
929
+ marker.setDraggable(false);
1150
930
 
1151
- // update color
1152
- var color = '#3FB1CE';
1153
- var markerElement = marker.getElement();
1154
- markerElement.querySelectorAll('svg g[fill="' + marker._color + '"]')[0].setAttribute("fill", color);
1155
- marker._color = color;
1156
- });
1157
- return marker;
1158
- }
1159
- }, {
1160
- key: "getCoordinates",
1161
- value: function getCoordinates(feature) {
1162
- return (0, _invariant.getCoords)(feature);
1163
- }
1164
- }, {
1165
- key: "getLength",
1166
- value: function getLength(feature) {
1167
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
1168
- units: 'kilometers'
1169
- };
1170
- if (feature.geometry && feature.geometry.type) {
1171
- var type = feature.geometry.type;
1172
- if (type === 'LineString' || type === 'MultiLineString') {
1173
- return (0, _length["default"])(feature, options);
1174
- }
1175
- }
1176
- console.warn("Unsupported geometry type provided to getLength");
1177
- return undefined;
1178
- }
1179
- }, {
1180
- key: "getArea",
1181
- value: function getArea(feature) {
1182
- return (0, _area["default"])(feature);
1183
- }
931
+ // update color
932
+ const color = '#3FB1CE';
933
+ let markerElement = marker.getElement();
934
+ markerElement.querySelectorAll('svg g[fill="' + marker._color + '"]')[0].setAttribute("fill", color);
935
+ marker._color = color;
936
+ });
937
+ return marker;
938
+ }
939
+ getCoordinates(feature) {
940
+ return (0, _invariant.getCoords)(feature);
941
+ }
942
+ getLength(feature) {
943
+ let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
944
+ units: 'kilometers'
945
+ };
946
+ if (feature.geometry && feature.geometry.type) {
947
+ const type = feature.geometry.type;
948
+ if (type === 'LineString' || type === 'MultiLineString') {
949
+ return (0, _length.default)(feature, options);
950
+ }
951
+ }
952
+ console.warn("Unsupported geometry type provided to getLength");
953
+ return undefined;
954
+ }
955
+ getArea(feature) {
956
+ return (0, _area.default)(feature);
957
+ }
1184
958
 
1185
- /**
1186
- * Get the 3D map instance for 3D model operations
1187
- */
1188
- }, {
1189
- key: "getMap3D",
1190
- value: function getMap3D() {
1191
- return this.map3D;
1192
- }
1193
- }]);
1194
- }();
959
+ /**
960
+ * Get the 3D map instance for 3D model operations
961
+ */
962
+ getMap3D() {
963
+ return this.map3D;
964
+ }
965
+ }
966
+ exports.MetaAtlasSdk = MetaAtlasSdk;
1195
967
  //# sourceMappingURL=meta-atlas-sdk.js.map