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