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