@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
|
@@ -4,38 +4,18 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.MetaAtlasCore = exports.FilterType = void 0;
|
|
7
|
-
var
|
|
8
|
-
var
|
|
7
|
+
var _focustreeJson = _interopRequireDefault(require("./focustree.json.js"));
|
|
8
|
+
var _whatTaxonomiesJson = _interopRequireDefault(require("./whatTaxonomies.json.js"));
|
|
9
9
|
var _length = _interopRequireDefault(require("@turf/length"));
|
|
10
10
|
var _helpers = require("@turf/helpers");
|
|
11
11
|
var _center = _interopRequireDefault(require("@turf/center"));
|
|
12
12
|
var _lineSliceAlong = _interopRequireDefault(require("@turf/line-slice-along"));
|
|
13
13
|
var _booleanPointInPolygon = _interopRequireDefault(require("@turf/boolean-point-in-polygon"));
|
|
14
14
|
var _axios = _interopRequireDefault(require("axios"));
|
|
15
|
-
var _localStorage = require("../utils/local-storage");
|
|
16
|
-
var _fetchPublishedJson = require("./fetch-published-json");
|
|
17
|
-
var _mapobjectsStore = _interopRequireDefault(require("../utils/mapobjects-store"));
|
|
18
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : {
|
|
19
|
-
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); }
|
|
20
|
-
function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
|
|
21
|
-
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
22
|
-
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
|
|
23
|
-
function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
|
|
24
|
-
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; } } }; }
|
|
25
|
-
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; } }
|
|
26
|
-
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; }
|
|
27
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
28
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
29
|
-
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 }; })(); }
|
|
30
|
-
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); }
|
|
31
|
-
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); }
|
|
32
|
-
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); }); }; }
|
|
33
|
-
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
34
|
-
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); } }
|
|
35
|
-
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
36
|
-
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; }
|
|
37
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
38
|
-
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); }
|
|
15
|
+
var _localStorage = require("../utils/local-storage.js");
|
|
16
|
+
var _fetchPublishedJson = require("./fetch-published-json.js");
|
|
17
|
+
var _mapobjectsStore = _interopRequireDefault(require("../utils/mapobjects-store.js"));
|
|
18
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
39
19
|
// Type for clicked features that includes both metaFeature data and raw click event
|
|
40
20
|
var SortType = /*#__PURE__*/function (SortType) {
|
|
41
21
|
SortType["Name"] = "Name";
|
|
@@ -44,30 +24,28 @@ var SortType = /*#__PURE__*/function (SortType) {
|
|
|
44
24
|
SortType["RelevanceStrict"] = "RelevanceStrict";
|
|
45
25
|
return SortType;
|
|
46
26
|
}(SortType || {});
|
|
47
|
-
|
|
27
|
+
let FilterType = exports.FilterType = /*#__PURE__*/function (FilterType) {
|
|
48
28
|
FilterType["Name"] = "title";
|
|
49
29
|
FilterType["LocalRef"] = "localRef";
|
|
50
30
|
FilterType["WhatTaxonomy"] = "dimension_what";
|
|
51
31
|
return FilterType;
|
|
52
32
|
}({});
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
_defineProperty(this, "ignoredLayers", ['Aerodrome', 'Aerodrome names', 'Aerobridge', 'Aerobridge gates', 'Airplanes', 'Airplanes outline', 'Building Extrusion', 'Building icon', 'Building overlay', 'Building overlay outline', 'Building underlay', 'Building underlay icon', 'Building underlay selected outline', 'building_outline', 'Changi Airport Connector', 'Changi Airport Connector Text', 'Changi Walkway Text', 'T2 overlay outline copy', 'Building overlay base', 'Skytrain track outdoor']);
|
|
70
|
-
_defineProperty(this, "nonFloorLayers", ['where.changi', 'where.changi.tarmac', 'where.changi.tarmac.public', 'where.changi.tarmac.private', 'where.changi.terminals', 'where.changi.terminals.jewel', 'where.changi.terminals.t1', 'where.changi.terminals.t2', 'where.changi.terminals.t3', 'where.changi.terminals.t4', 'where.hkcec.main_bldg', 'where.gbtb.flower_dome', 'where.lima', 'where.lima.mahsuri_center', 'where.lima.maritime', 'where.malaysia', 'where.malaysia.bcck', 'where.malaysia.rmh', 'where.malaysia.pm', 'where.indonesia.fairmont_jakarta']);
|
|
33
|
+
class MetaAtlasCore {
|
|
34
|
+
defaultFocusedTaxonomy = 'where.changi';
|
|
35
|
+
searchableGeoJsonFeatures = [];
|
|
36
|
+
currentFocus = this.defaultFocusedTaxonomy;
|
|
37
|
+
// For ATOMS API
|
|
38
|
+
token = '';
|
|
39
|
+
empApi = '';
|
|
40
|
+
atomsAPIAccessToken = '';
|
|
41
|
+
apiRequestLimit = 5000;
|
|
42
|
+
|
|
43
|
+
// For Routing & Search
|
|
44
|
+
secretKeyForDecryption = '';
|
|
45
|
+
routingStatus = (() => _fetchPublishedJson.Status.Awaiting)();
|
|
46
|
+
searchStatus = (() => _fetchPublishedJson.Status.Awaiting)();
|
|
47
|
+
storage = (() => new _localStorage.LocalStorage())();
|
|
48
|
+
constructor() {
|
|
71
49
|
this.lastClicked = {
|
|
72
50
|
mapObjectId: null,
|
|
73
51
|
coordinates: null,
|
|
@@ -79,1275 +57,985 @@ var MetaAtlasCore = exports.MetaAtlasCore = /*#__PURE__*/function () {
|
|
|
79
57
|
clickEvent: null
|
|
80
58
|
};
|
|
81
59
|
}
|
|
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
|
-
data: data
|
|
107
|
-
};
|
|
108
|
-
(0, _axios["default"])(config).then(/*#__PURE__*/function () {
|
|
109
|
-
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(response) {
|
|
110
|
-
var _response$data;
|
|
111
|
-
return _regenerator().w(function (_context) {
|
|
112
|
-
while (1) switch (_context.n) {
|
|
113
|
-
case 0:
|
|
114
|
-
if (response !== null && response !== void 0 && (_response$data = response.data) !== null && _response$data !== void 0 && _response$data.accessToken) {
|
|
115
|
-
_this.atomsAPIAccessToken = response.data.accessToken;
|
|
116
|
-
onAuthenticationResponse({
|
|
117
|
-
authenticated: true
|
|
118
|
-
});
|
|
119
|
-
}
|
|
120
|
-
case 1:
|
|
121
|
-
return _context.a(2);
|
|
122
|
-
}
|
|
123
|
-
}, _callee);
|
|
124
|
-
}));
|
|
125
|
-
return function (_x) {
|
|
126
|
-
return _ref.apply(this, arguments);
|
|
127
|
-
};
|
|
128
|
-
}())["catch"](function (error) {
|
|
60
|
+
init(apiServerURL, token, secretKey, onAuthenticationResponse) {
|
|
61
|
+
this.empApi = apiServerURL;
|
|
62
|
+
this.token = token;
|
|
63
|
+
this.secretKeyForDecryption = secretKey;
|
|
64
|
+
this.getAtomsAPIAccessToken(onAuthenticationResponse);
|
|
65
|
+
}
|
|
66
|
+
getAtomsAPIAccessToken(onAuthenticationResponse) {
|
|
67
|
+
const data = JSON.stringify({
|
|
68
|
+
strategy: 'atomstoken',
|
|
69
|
+
atomsSdkToken: this.token,
|
|
70
|
+
clientEngine: 'API',
|
|
71
|
+
clientOS: 'Linux'
|
|
72
|
+
});
|
|
73
|
+
const config = {
|
|
74
|
+
method: 'post',
|
|
75
|
+
url: `${this.empApi}/authentication`,
|
|
76
|
+
headers: {
|
|
77
|
+
'Content-Type': 'application/json'
|
|
78
|
+
},
|
|
79
|
+
data: data
|
|
80
|
+
};
|
|
81
|
+
(0, _axios.default)(config).then(async response => {
|
|
82
|
+
if (response?.data?.accessToken) {
|
|
83
|
+
this.atomsAPIAccessToken = response.data.accessToken;
|
|
129
84
|
onAuthenticationResponse({
|
|
130
|
-
authenticated:
|
|
131
|
-
error: error
|
|
85
|
+
authenticated: true
|
|
132
86
|
});
|
|
133
|
-
});
|
|
134
|
-
}
|
|
135
|
-
}, {
|
|
136
|
-
key: "setupRouting",
|
|
137
|
-
value: function () {
|
|
138
|
-
var _setupRouting = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(onRoutingStatusUpdateCallback) {
|
|
139
|
-
var status;
|
|
140
|
-
return _regenerator().w(function (_context2) {
|
|
141
|
-
while (1) switch (_context2.n) {
|
|
142
|
-
case 0:
|
|
143
|
-
_context2.n = 1;
|
|
144
|
-
return (0, _fetchPublishedJson.getPublishedData)({
|
|
145
|
-
URL: this.empApi,
|
|
146
|
-
accessToken: this.atomsAPIAccessToken,
|
|
147
|
-
secretKey: this.secretKeyForDecryption,
|
|
148
|
-
publishedDataType: _fetchPublishedJson.PublishedDataType.Routing
|
|
149
|
-
}, this.storage);
|
|
150
|
-
case 1:
|
|
151
|
-
status = _context2.v;
|
|
152
|
-
this.routingStatus = status;
|
|
153
|
-
console.log('routing status: ', status);
|
|
154
|
-
if (onRoutingStatusUpdateCallback) {
|
|
155
|
-
onRoutingStatusUpdateCallback(status === _fetchPublishedJson.Status.Ready ? true : false);
|
|
156
|
-
}
|
|
157
|
-
case 2:
|
|
158
|
-
return _context2.a(2);
|
|
159
|
-
}
|
|
160
|
-
}, _callee2, this);
|
|
161
|
-
}));
|
|
162
|
-
function setupRouting(_x2) {
|
|
163
|
-
return _setupRouting.apply(this, arguments);
|
|
164
87
|
}
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
88
|
+
}).catch(function (error) {
|
|
89
|
+
onAuthenticationResponse({
|
|
90
|
+
authenticated: false,
|
|
91
|
+
error: error
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
async setupRouting(onRoutingStatusUpdateCallback) {
|
|
96
|
+
const status = await (0, _fetchPublishedJson.getPublishedData)({
|
|
97
|
+
URL: this.empApi,
|
|
98
|
+
accessToken: this.atomsAPIAccessToken,
|
|
99
|
+
secretKey: this.secretKeyForDecryption,
|
|
100
|
+
publishedDataType: _fetchPublishedJson.PublishedDataType.Routing
|
|
101
|
+
}, this.storage);
|
|
102
|
+
this.routingStatus = status;
|
|
103
|
+
console.log('routing status: ', status);
|
|
104
|
+
if (onRoutingStatusUpdateCallback) {
|
|
105
|
+
onRoutingStatusUpdateCallback(status === _fetchPublishedJson.Status.Ready ? true : false);
|
|
171
106
|
}
|
|
107
|
+
}
|
|
108
|
+
getRoutingStatus() {
|
|
109
|
+
return this.routingStatus;
|
|
110
|
+
}
|
|
172
111
|
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
this.lastClicked = featureData;
|
|
191
|
-
}
|
|
112
|
+
// last clicked related functionality
|
|
113
|
+
setLastClickedFeature(featureData) {
|
|
114
|
+
if (featureData.mapObjectId) {
|
|
115
|
+
this.getMapObjectById(featureData.mapObjectId, res => {
|
|
116
|
+
const mo = res?.[0];
|
|
117
|
+
if (mo) {
|
|
118
|
+
this.lastClicked = {
|
|
119
|
+
...featureData,
|
|
120
|
+
properties: {
|
|
121
|
+
...featureData.properties,
|
|
122
|
+
booth_info: mo.properties.booth_info
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
} else {
|
|
128
|
+
this.lastClicked = featureData;
|
|
192
129
|
}
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
clickedFeature = feature;
|
|
210
|
-
}
|
|
211
|
-
return clickedFeature;
|
|
130
|
+
}
|
|
131
|
+
getLastClickedFeature() {
|
|
132
|
+
let clickedFeature = this.lastClicked;
|
|
133
|
+
if (!this.lastClicked || this.lastClicked && (this.lastClicked.name === null || this.lastClicked.whereDimension === null)) {
|
|
134
|
+
const feature = {
|
|
135
|
+
mapObjectId: null,
|
|
136
|
+
coordinates: null,
|
|
137
|
+
name: null,
|
|
138
|
+
whatDimension: null,
|
|
139
|
+
whereDimension: null,
|
|
140
|
+
geometry: null,
|
|
141
|
+
properties: null,
|
|
142
|
+
clickEvent: null
|
|
143
|
+
};
|
|
144
|
+
this.setLastClickedFeature(feature);
|
|
145
|
+
clickedFeature = feature;
|
|
212
146
|
}
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
}
|
|
219
|
-
return false;
|
|
147
|
+
return clickedFeature;
|
|
148
|
+
}
|
|
149
|
+
isClickableFeature(feature) {
|
|
150
|
+
if (feature.properties.isSearchable && feature.properties.title !== 'Transit' && feature.properties.title !== 'Public') {
|
|
151
|
+
return true;
|
|
220
152
|
}
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
}
|
|
227
|
-
if (feature.lngLat) {
|
|
228
|
-
return feature.lngLat;
|
|
229
|
-
}
|
|
230
|
-
if (!feature.geometry) {
|
|
231
|
-
return null;
|
|
232
|
-
}
|
|
233
|
-
if (feature.geometry.type === 'Point') {
|
|
234
|
-
return feature.geometry.coordinates;
|
|
235
|
-
}
|
|
236
|
-
var gjson = (0, _helpers.feature)(feature.geometry);
|
|
237
|
-
if (gjson.geometry.type === 'LineString' || gjson.geometry.type === 'MultiLineString' && gjson.geometry.coordinates.length == 1) {
|
|
238
|
-
gjson = (0, _helpers.lineString)(feature.geometry.coordinates);
|
|
239
|
-
var gjsonLength = (0, _length["default"])(gjson);
|
|
240
|
-
var splicedLine = (0, _lineSliceAlong["default"])(gjson, gjsonLength / 2, gjsonLength);
|
|
241
|
-
return splicedLine.geometry.coordinates[0];
|
|
242
|
-
}
|
|
243
|
-
return (0, _center["default"])(gjson).geometry.coordinates;
|
|
153
|
+
return false;
|
|
154
|
+
}
|
|
155
|
+
getMidPointOfFeature(feature) {
|
|
156
|
+
if (!feature) {
|
|
157
|
+
return null;
|
|
244
158
|
}
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
}, {
|
|
248
|
-
key: "getFocusTree",
|
|
249
|
-
value: function getFocusTree() {
|
|
250
|
-
return _focustree["default"];
|
|
159
|
+
if (feature.lngLat) {
|
|
160
|
+
return feature.lngLat;
|
|
251
161
|
}
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
value: function getWhatTaxonomies() {
|
|
255
|
-
return _whatTaxonomies["default"];
|
|
162
|
+
if (!feature.geometry) {
|
|
163
|
+
return null;
|
|
256
164
|
}
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
value: function getCurrentFocus() {
|
|
260
|
-
return this.currentFocus;
|
|
165
|
+
if (feature.geometry.type === 'Point') {
|
|
166
|
+
return feature.geometry.coordinates;
|
|
261
167
|
}
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
return null;
|
|
168
|
+
let gjson = (0, _helpers.feature)(feature.geometry);
|
|
169
|
+
if (gjson.geometry.type === 'LineString' || gjson.geometry.type === 'MultiLineString' && gjson.geometry.coordinates.length == 1) {
|
|
170
|
+
gjson = (0, _helpers.lineString)(feature.geometry.coordinates);
|
|
171
|
+
let gjsonLength = (0, _length.default)(gjson);
|
|
172
|
+
let splicedLine = (0, _lineSliceAlong.default)(gjson, gjsonLength / 2, gjsonLength);
|
|
173
|
+
return splicedLine.geometry.coordinates[0];
|
|
271
174
|
}
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
175
|
+
return (0, _center.default)(gjson).geometry.coordinates;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
// focus control related methods
|
|
179
|
+
getFocusTree() {
|
|
180
|
+
return _focustreeJson.default;
|
|
181
|
+
}
|
|
182
|
+
getWhatTaxonomies() {
|
|
183
|
+
return _whatTaxonomiesJson.default;
|
|
184
|
+
}
|
|
185
|
+
getCurrentFocus() {
|
|
186
|
+
return this.currentFocus;
|
|
187
|
+
}
|
|
188
|
+
getCurrentFocusBuilding() {
|
|
189
|
+
for (let bld in _focustreeJson.default.site.buildings) {
|
|
190
|
+
if (this.currentFocus.includes(_focustreeJson.default.site.buildings[bld].taxonomyPath)) {
|
|
191
|
+
return _focustreeJson.default.site.buildings[bld];
|
|
283
192
|
}
|
|
284
|
-
return null;
|
|
285
193
|
}
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
//check if center in building bounds
|
|
293
|
-
var b = _focustree["default"].site.buildings[bIndex];
|
|
294
|
-
if (!b.hasOwnProperty('bounds')) {
|
|
295
|
-
continue;
|
|
296
|
-
}
|
|
297
|
-
var bounds = (0, _helpers.polygon)(b.bounds);
|
|
298
|
-
if ((0, _booleanPointInPolygon["default"])(centerPoint, bounds)) {
|
|
299
|
-
return b;
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
return null;
|
|
194
|
+
return null;
|
|
195
|
+
}
|
|
196
|
+
getCurrentFocusFloor() {
|
|
197
|
+
let currentBuilding = this.getCurrentFocusBuilding();
|
|
198
|
+
if (!currentBuilding) {
|
|
199
|
+
return;
|
|
303
200
|
}
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
//get user center
|
|
308
|
-
var centerPoint = (0, _helpers.point)(currentCenter);
|
|
309
|
-
//check building
|
|
310
|
-
if (building === null || building === undefined) {
|
|
311
|
-
return false;
|
|
312
|
-
}
|
|
313
|
-
//check if user is viewing building
|
|
314
|
-
if (!building.hasOwnProperty('bounds')) {
|
|
315
|
-
return false;
|
|
201
|
+
for (let f in currentBuilding.floors) {
|
|
202
|
+
if (this.currentFocus === currentBuilding.floors[f].taxonomyPath) {
|
|
203
|
+
return currentBuilding.floors[f];
|
|
316
204
|
}
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
205
|
+
}
|
|
206
|
+
return null;
|
|
207
|
+
}
|
|
208
|
+
getUserViewportBuilding(currentCenter) {
|
|
209
|
+
let centerPoint = (0, _helpers.point)(currentCenter);
|
|
210
|
+
//get building bounds
|
|
211
|
+
for (let bIndex in _focustreeJson.default.site.buildings) {
|
|
212
|
+
//check if center in building bounds
|
|
213
|
+
let b = _focustreeJson.default.site.buildings[bIndex];
|
|
214
|
+
if (!b.hasOwnProperty('bounds')) {
|
|
215
|
+
continue;
|
|
322
216
|
}
|
|
323
|
-
|
|
324
|
-
if (
|
|
325
|
-
return
|
|
217
|
+
let bounds = (0, _helpers.polygon)(b.bounds);
|
|
218
|
+
if ((0, _booleanPointInPolygon.default)(centerPoint, bounds)) {
|
|
219
|
+
return b;
|
|
326
220
|
}
|
|
327
|
-
var fBounds = (0, _helpers.polygon)(floor.bounds);
|
|
328
|
-
var isViewingFloor = (0, _booleanPointInPolygon["default"])(centerPoint, fBounds);
|
|
329
|
-
return isViewingBuilding || isViewingFloor;
|
|
330
221
|
}
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
222
|
+
return null;
|
|
223
|
+
}
|
|
224
|
+
checkUserViewport(currentCenter, building, floor) {
|
|
225
|
+
//get user center
|
|
226
|
+
let centerPoint = (0, _helpers.point)(currentCenter);
|
|
227
|
+
//check building
|
|
228
|
+
if (building === null || building === undefined) {
|
|
229
|
+
return false;
|
|
230
|
+
}
|
|
231
|
+
//check if user is viewing building
|
|
232
|
+
if (!building.hasOwnProperty('bounds')) {
|
|
233
|
+
return false;
|
|
234
|
+
}
|
|
235
|
+
let bBounds = (0, _helpers.polygon)(building.bounds);
|
|
236
|
+
let isViewingBuilding = (0, _booleanPointInPolygon.default)(centerPoint, bBounds);
|
|
237
|
+
//check floor
|
|
238
|
+
if (floor === null || floor === undefined) {
|
|
239
|
+
return isViewingBuilding;
|
|
240
|
+
}
|
|
241
|
+
//check if user is viewing floor
|
|
242
|
+
if (!floor.hasOwnProperty('bounds')) {
|
|
243
|
+
return isViewingBuilding;
|
|
244
|
+
}
|
|
245
|
+
let fBounds = (0, _helpers.polygon)(floor.bounds);
|
|
246
|
+
let isViewingFloor = (0, _booleanPointInPolygon.default)(centerPoint, fBounds);
|
|
247
|
+
return isViewingBuilding || isViewingFloor;
|
|
248
|
+
}
|
|
249
|
+
ignoredLayers = ['Aerodrome', 'Aerodrome names', 'Aerobridge', 'Aerobridge gates', 'Airplanes', 'Airplanes outline', 'Building Extrusion', 'Building icon', 'Building overlay', 'Building overlay outline', 'Building underlay', 'Building underlay icon', 'Building underlay selected outline', 'building_outline', 'Changi Airport Connector', 'Changi Airport Connector Text', 'Changi Walkway Text', 'T2 overlay outline copy', 'Building overlay base', 'Skytrain track outdoor'];
|
|
250
|
+
nonFloorLayers = ['where.changi', 'where.changi.tarmac', 'where.changi.tarmac.public', 'where.changi.tarmac.private', 'where.changi.terminals', 'where.changi.terminals.jewel', 'where.changi.terminals.t1', 'where.changi.terminals.t2', 'where.changi.terminals.t3', 'where.changi.terminals.t4', 'where.hkcec.main_bldg', 'where.gbtb.flower_dome', 'where.lima', 'where.lima.mahsuri_center', 'where.lima.maritime', 'where.malaysia', 'where.malaysia.bcck', 'where.malaysia.rmh', 'where.malaysia.pm', 'where.indonesia.fairmont_jakarta'];
|
|
251
|
+
filterBaseMapWhereDimension(layersData, whereTaxonomyPath) {
|
|
252
|
+
let dimensionWhere = whereTaxonomyPath;
|
|
253
|
+
if (!dimensionWhere) {
|
|
254
|
+
return;
|
|
255
|
+
}
|
|
256
|
+
this.currentFocus = dimensionWhere;
|
|
257
|
+
let whereFilters = [dimensionWhere];
|
|
340
258
|
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
if (building.floors && Array.isArray(building.floors)) {
|
|
352
|
-
var _iterator2 = _createForOfIteratorHelper(building.floors),
|
|
353
|
-
_step2;
|
|
354
|
-
try {
|
|
355
|
-
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
356
|
-
var floor = _step2.value;
|
|
357
|
-
if (floor.taxonomyPath) {
|
|
358
|
-
whereFilters.push(floor.taxonomyPath);
|
|
359
|
-
}
|
|
360
|
-
}
|
|
361
|
-
} catch (err) {
|
|
362
|
-
_iterator2.e(err);
|
|
363
|
-
} finally {
|
|
364
|
-
_iterator2.f();
|
|
365
|
-
}
|
|
259
|
+
// Check if dimensionWhere matches the site taxonomyPath
|
|
260
|
+
if (dimensionWhere === _focustreeJson.default.site.taxonomyPath) {
|
|
261
|
+
// If it equals site, add all floors of all buildings
|
|
262
|
+
whereFilters = [];
|
|
263
|
+
if (_focustreeJson.default.site.buildings && Array.isArray(_focustreeJson.default.site.buildings)) {
|
|
264
|
+
for (const building of _focustreeJson.default.site.buildings) {
|
|
265
|
+
if (building.floors && Array.isArray(building.floors)) {
|
|
266
|
+
for (const floor of building.floors) {
|
|
267
|
+
if (floor.taxonomyPath) {
|
|
268
|
+
whereFilters.push(floor.taxonomyPath);
|
|
366
269
|
}
|
|
367
270
|
}
|
|
368
|
-
} catch (err) {
|
|
369
|
-
_iterator.e(err);
|
|
370
|
-
} finally {
|
|
371
|
-
_iterator.f();
|
|
372
271
|
}
|
|
373
|
-
} else {
|
|
374
|
-
// If it equals a site and has no buildings, add the site itself
|
|
375
|
-
whereFilters = [_focustree["default"].site.taxonomyPath];
|
|
376
272
|
}
|
|
377
273
|
} else {
|
|
378
|
-
//
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
392
|
-
var _floor = _step4.value;
|
|
393
|
-
if (_floor.taxonomyPath) {
|
|
394
|
-
whereFilters.push(_floor.taxonomyPath);
|
|
395
|
-
}
|
|
396
|
-
}
|
|
397
|
-
} catch (err) {
|
|
398
|
-
_iterator4.e(err);
|
|
399
|
-
} finally {
|
|
400
|
-
_iterator4.f();
|
|
401
|
-
}
|
|
402
|
-
}
|
|
403
|
-
// If it equals a building, but has no floors, add the building itself
|
|
404
|
-
else {
|
|
405
|
-
whereFilters = [_building.taxonomyPath];
|
|
274
|
+
// If it equals a site and has no buildings, add the site itself
|
|
275
|
+
whereFilters = [_focustreeJson.default.site.taxonomyPath];
|
|
276
|
+
}
|
|
277
|
+
} else {
|
|
278
|
+
// Check if dimensionWhere matches any building's taxonomyPath
|
|
279
|
+
for (const building of _focustreeJson.default.site.buildings) {
|
|
280
|
+
if (dimensionWhere === building.taxonomyPath) {
|
|
281
|
+
// If it equals a building, add all floors of that building
|
|
282
|
+
whereFilters = [];
|
|
283
|
+
if (building.floors && Array.isArray(building.floors)) {
|
|
284
|
+
for (const floor of building.floors) {
|
|
285
|
+
if (floor.taxonomyPath) {
|
|
286
|
+
whereFilters.push(floor.taxonomyPath);
|
|
406
287
|
}
|
|
407
|
-
break;
|
|
408
288
|
}
|
|
409
289
|
}
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
_iterator3.f();
|
|
414
|
-
}
|
|
415
|
-
}
|
|
416
|
-
console.log('whereFilters: ', whereFilters);
|
|
417
|
-
if (layersData.length > 0) {
|
|
418
|
-
for (var index = 0; index < layersData.length; index += 1) {
|
|
419
|
-
var layerID = layersData[index].id;
|
|
420
|
-
if (!this.ignoredLayers.includes(layerID)) {
|
|
421
|
-
this.filterLayer(layersData[index], whereFilters);
|
|
290
|
+
// If it equals a building, but has no floors, add the building itself
|
|
291
|
+
else {
|
|
292
|
+
whereFilters = [building.taxonomyPath];
|
|
422
293
|
}
|
|
294
|
+
break;
|
|
423
295
|
}
|
|
424
296
|
}
|
|
425
|
-
return layersData;
|
|
426
297
|
}
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
var whereFilters = [];
|
|
435
|
-
whereFilters = [dimensionWhere];
|
|
436
|
-
for (var index = 0; index < layersData.length; index += 1) {
|
|
437
|
-
this.filterLayer(layersData[index], whereFilters);
|
|
298
|
+
console.log('whereFilters: ', whereFilters);
|
|
299
|
+
if (layersData.length > 0) {
|
|
300
|
+
for (let index = 0; index < layersData.length; index += 1) {
|
|
301
|
+
const layerID = layersData[index].id;
|
|
302
|
+
if (!this.ignoredLayers.includes(layerID)) {
|
|
303
|
+
this.filterLayer(layersData[index], whereFilters);
|
|
304
|
+
}
|
|
438
305
|
}
|
|
439
|
-
return layersData;
|
|
440
306
|
}
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
307
|
+
return layersData;
|
|
308
|
+
}
|
|
309
|
+
filterLayersWhereDimension(layersData, whereTaxonomyPath) {
|
|
310
|
+
let dimensionWhere = whereTaxonomyPath;
|
|
311
|
+
if (!dimensionWhere) {
|
|
312
|
+
return;
|
|
313
|
+
}
|
|
314
|
+
let whereFilters = [];
|
|
315
|
+
whereFilters = [dimensionWhere];
|
|
316
|
+
for (let index = 0; index < layersData.length; index += 1) {
|
|
317
|
+
this.filterLayer(layersData[index], whereFilters);
|
|
318
|
+
}
|
|
319
|
+
return layersData;
|
|
320
|
+
}
|
|
321
|
+
filterLayer(layer, whereFilters) {
|
|
322
|
+
const layerFilter = layer.filter;
|
|
323
|
+
if (layerFilter) {
|
|
324
|
+
let filterFound = false;
|
|
325
|
+
for (let fieldIndex = 0; fieldIndex < layerFilter.length; fieldIndex += 1) {
|
|
326
|
+
const field = layerFilter[fieldIndex];
|
|
327
|
+
if (Array.isArray(field[1]) && field[1][1] === 'dimension_where') {
|
|
328
|
+
//update already added where filter value
|
|
329
|
+
field[0] = 'in';
|
|
330
|
+
field[2] = ['literal', whereFilters];
|
|
331
|
+
filterFound = true;
|
|
332
|
+
break;
|
|
459
333
|
}
|
|
460
334
|
}
|
|
335
|
+
if (!filterFound) {
|
|
336
|
+
layerFilter.push(['in', ['get', 'dimension_where'], ['literal', whereFilters]]);
|
|
337
|
+
}
|
|
461
338
|
}
|
|
462
|
-
}
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
var splitstr = whereTaxonomyPath.split('.');
|
|
339
|
+
}
|
|
340
|
+
getLocationNameFromWhereTaxonomyPath(whereTaxonomyPath) {
|
|
341
|
+
if (whereTaxonomyPath.includes('where.')) {
|
|
342
|
+
const splitstr = whereTaxonomyPath.split('.');
|
|
467
343
|
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
return splitstr[splitstr.length - 1];
|
|
471
|
-
}
|
|
344
|
+
//if floor
|
|
345
|
+
if (!this.nonFloorLayers.includes(whereTaxonomyPath)) {
|
|
472
346
|
return splitstr[splitstr.length - 1];
|
|
473
347
|
}
|
|
348
|
+
return splitstr[splitstr.length - 1];
|
|
474
349
|
}
|
|
475
|
-
}
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
if (
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
return getConfigForNode(building.cameraConfigs);
|
|
497
|
-
}
|
|
350
|
+
}
|
|
351
|
+
getFlyToLocation(whereTaxonomyPath) {
|
|
352
|
+
let isMobile = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
353
|
+
let location = this.getLocationNameFromWhereTaxonomyPath(whereTaxonomyPath);
|
|
354
|
+
const getConfigForNode = node => {
|
|
355
|
+
const cameraConfigs = isMobile ? node.mobile : node.web;
|
|
356
|
+
return cameraConfigs;
|
|
357
|
+
};
|
|
358
|
+
if (this.getLocationNameFromWhereTaxonomyPath(_focustreeJson.default.site.taxonomyPath) === location) {
|
|
359
|
+
return getConfigForNode(_focustreeJson.default.site.cameraConfigs);
|
|
360
|
+
} else {
|
|
361
|
+
for (let index = 0; index < _focustreeJson.default.site.buildings.length; index++) {
|
|
362
|
+
const building = _focustreeJson.default.site.buildings[index];
|
|
363
|
+
if (this.getLocationNameFromWhereTaxonomyPath(building.taxonomyPath) !== location) {
|
|
364
|
+
for (let index = 0; index < building.floors.length; index++) {
|
|
365
|
+
const floor = building.floors[index];
|
|
366
|
+
if (this.getLocationNameFromWhereTaxonomyPath(floor.taxonomyPath) === location) {
|
|
367
|
+
if (floor.cameraConfigs) {
|
|
368
|
+
return getConfigForNode(floor.cameraConfigs);
|
|
369
|
+
} else {
|
|
370
|
+
return getConfigForNode(building.cameraConfigs);
|
|
498
371
|
}
|
|
499
372
|
}
|
|
500
|
-
} else {
|
|
501
|
-
return getConfigForNode(building.cameraConfigs);
|
|
502
373
|
}
|
|
374
|
+
} else {
|
|
375
|
+
return getConfigForNode(building.cameraConfigs);
|
|
503
376
|
}
|
|
504
377
|
}
|
|
505
|
-
console.warn('Invalid whereTaxonomy passed to getFlyToLocation');
|
|
506
|
-
return {
|
|
507
|
-
center: undefined,
|
|
508
|
-
zoom: undefined,
|
|
509
|
-
bearing: undefined
|
|
510
|
-
};
|
|
511
378
|
}
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
379
|
+
console.warn('Invalid whereTaxonomy passed to getFlyToLocation');
|
|
380
|
+
return {
|
|
381
|
+
center: undefined,
|
|
382
|
+
zoom: undefined,
|
|
383
|
+
bearing: undefined
|
|
384
|
+
};
|
|
385
|
+
}
|
|
386
|
+
filterLayersByCategories(layersData, filterType, filterValues, geomType, dimensionWhat, map) {
|
|
387
|
+
if (!filterValues) {
|
|
388
|
+
return;
|
|
389
|
+
}
|
|
390
|
+
for (let index = 0; index < layersData.length; index += 1) {
|
|
391
|
+
const layerID = layersData[index].id;
|
|
392
|
+
const layer = layersData[index];
|
|
393
|
+
let filter;
|
|
394
|
+
const layerFilter = layer.filter;
|
|
395
|
+
if (geomType) {
|
|
396
|
+
filter = ['any', ['!', ['all', ['==', ['geometry-type'], geomType], ['==', ['get', 'dimension_what'], dimensionWhat]]]];
|
|
397
|
+
for (let index = 0; index < filterValues.length; index++) {
|
|
398
|
+
const filterValue = filterValues[index];
|
|
399
|
+
filter[1][1].splice(1, 0, ['!', ['in', filterValue, ['get', filterType]]]);
|
|
400
|
+
}
|
|
401
|
+
} else {
|
|
402
|
+
filter = ['all'];
|
|
403
|
+
for (let index = 0; index < filterValues.length; index++) {
|
|
404
|
+
const filterValue = filterValues[index];
|
|
405
|
+
filter.push(['all', ['in', filterValue, ['get', filterType]]]);
|
|
535
406
|
}
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
for (var _index4 = 0; _index4 < filterValues.length; _index4++) {
|
|
555
|
-
var _filterValue2 = filterValues[_index4];
|
|
556
|
-
field[1][1].splice(1, 0, ['!', ['in', _filterValue2, ['get', filterType]]]);
|
|
557
|
-
}
|
|
558
|
-
filterFound = true;
|
|
559
|
-
break;
|
|
407
|
+
}
|
|
408
|
+
if (layerFilter) {
|
|
409
|
+
let filterFound = false;
|
|
410
|
+
for (let fieldIndex = 0; fieldIndex < layerFilter.length; fieldIndex += 1) {
|
|
411
|
+
let field = layerFilter[fieldIndex];
|
|
412
|
+
if (geomType) {
|
|
413
|
+
if (field[0] === 'any' && Array.isArray(field[1]) && Array.isArray(field[1][1]) &&
|
|
414
|
+
// Array.isArray(field[3][1]) &&
|
|
415
|
+
// Array.isArray(field[3][1]) &&
|
|
416
|
+
// Array.isArray(field[3][1][1]) &&
|
|
417
|
+
// Array.isArray(field[3][1][2]) &&
|
|
418
|
+
// Array.isArray(field[3][2]) &&
|
|
419
|
+
field[1][0] === '!' && field[1][1][0] === 'all') {
|
|
420
|
+
//update already added where filter value
|
|
421
|
+
const subField = field[1][1];
|
|
422
|
+
if (subField.length > 3) {
|
|
423
|
+
// purge all previous entries
|
|
424
|
+
subField.splice(1, subField.length - 3);
|
|
560
425
|
}
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
field[0] = '!';
|
|
565
|
-
field[1][2] = ['literal', filterValues];
|
|
566
|
-
filterFound = true;
|
|
567
|
-
break;
|
|
426
|
+
for (let index = 0; index < filterValues.length; index++) {
|
|
427
|
+
const filterValue = filterValues[index];
|
|
428
|
+
field[1][1].splice(1, 0, ['!', ['in', filterValue, ['get', filterType]]]);
|
|
568
429
|
}
|
|
430
|
+
filterFound = true;
|
|
431
|
+
break;
|
|
432
|
+
}
|
|
433
|
+
} else {
|
|
434
|
+
if (Array.isArray(field[1]) && Array.isArray(field[1][1]) && field[0] === '!' && field[1][1][1] === filterType) {
|
|
435
|
+
//update already added where filter value
|
|
436
|
+
field[0] = '!';
|
|
437
|
+
field[1][2] = ['literal', filterValues];
|
|
438
|
+
filterFound = true;
|
|
439
|
+
break;
|
|
569
440
|
}
|
|
570
|
-
}
|
|
571
|
-
if (!filterFound) {
|
|
572
|
-
layerFilter.push(filter);
|
|
573
441
|
}
|
|
574
442
|
}
|
|
575
|
-
if (
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
443
|
+
if (!filterFound) {
|
|
444
|
+
layerFilter.push(filter);
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
if (layerID.includes('Retail')) {
|
|
448
|
+
const layerStyle = layer.paint;
|
|
449
|
+
const styleFilter = ['case'];
|
|
450
|
+
for (let index = 0; index < filterValues.length; index++) {
|
|
451
|
+
const filterValue = filterValues[index];
|
|
452
|
+
styleFilter.push(["boolean", ['in', filterValue, ['get', filterType]], true]); // the category is enabled?
|
|
453
|
+
styleFilter.push(0.99); // when enabled
|
|
454
|
+
}
|
|
455
|
+
styleFilter.push(0.25); // when disabled
|
|
584
456
|
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
}
|
|
457
|
+
if (layer.type === 'fill') {
|
|
458
|
+
const property = 'fill-opacity';
|
|
459
|
+
layerStyle['fill-opacity'] = styleFilter;
|
|
460
|
+
map.setPaintProperty(layerID, property, layerStyle[property]);
|
|
461
|
+
}
|
|
462
|
+
if (layer.type === 'line') {
|
|
463
|
+
const property = 'line-opacity';
|
|
464
|
+
layerStyle['line-opacity'] = styleFilter;
|
|
465
|
+
map.setPaintProperty(layerID, property, layerStyle[property]);
|
|
595
466
|
}
|
|
596
467
|
}
|
|
597
|
-
return layersData;
|
|
598
468
|
}
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
469
|
+
return layersData;
|
|
470
|
+
}
|
|
471
|
+
filterLayersByType(layersData, filterType, filterValues, geomType) {
|
|
472
|
+
if (!filterValues) {
|
|
473
|
+
return;
|
|
474
|
+
}
|
|
475
|
+
for (let index = 0; index < layersData.length; index += 1) {
|
|
476
|
+
const layer = layersData[index];
|
|
477
|
+
let filter;
|
|
478
|
+
const layerFilter = layer.filter;
|
|
479
|
+
if (geomType) {
|
|
480
|
+
filter = ['case', ['!', ['in', ['get', filterType], ['literal', filterValues]]], true, ['all', ['in', ['get', filterType], ['literal', filterValues]], ['!=', ['geometry-type'], geomType]], true, false];
|
|
481
|
+
} else {
|
|
482
|
+
filter = ['in', ['get', filterType], ['literal', filterValues]];
|
|
604
483
|
}
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
filterFound = true;
|
|
628
|
-
break;
|
|
629
|
-
}
|
|
630
|
-
} else {
|
|
631
|
-
if (Array.isArray(field[1]) && field[0] === '!' && field[1][1] === filterType) {
|
|
632
|
-
//update already added where filter value
|
|
633
|
-
field[2] = ['literal', filterValues];
|
|
634
|
-
filterFound = true;
|
|
635
|
-
break;
|
|
636
|
-
}
|
|
484
|
+
if (layerFilter) {
|
|
485
|
+
let filterFound = false;
|
|
486
|
+
console.log('layerFilter: ', layerFilter);
|
|
487
|
+
for (let fieldIndex = 0; fieldIndex < layerFilter.length; fieldIndex += 1) {
|
|
488
|
+
let field = layerFilter[fieldIndex];
|
|
489
|
+
if (geomType) {
|
|
490
|
+
if (field[0] === 'case' && Array.isArray(field[1]) && Array.isArray(field[3]) && Array.isArray(field[3][1]) && Array.isArray(field[3][1]) && Array.isArray(field[3][1][1]) && Array.isArray(field[3][1][2]) && Array.isArray(field[3][2]) && field[3][1][1][1] === filterType && field[3][2][2] === geomType) {
|
|
491
|
+
//update already added where filter value
|
|
492
|
+
field[1][1][2] = ['literal', filterValues];
|
|
493
|
+
field[1][1][1] = ['get', filterType];
|
|
494
|
+
field[3][1][2] = ['literal', filterValues];
|
|
495
|
+
field[3][1][1] = ['get', filterType];
|
|
496
|
+
field[3][2][2] = geomType;
|
|
497
|
+
filterFound = true;
|
|
498
|
+
break;
|
|
499
|
+
}
|
|
500
|
+
} else {
|
|
501
|
+
if (Array.isArray(field[1]) && field[0] === '!' && field[1][1] === filterType) {
|
|
502
|
+
//update already added where filter value
|
|
503
|
+
field[2] = ['literal', filterValues];
|
|
504
|
+
filterFound = true;
|
|
505
|
+
break;
|
|
637
506
|
}
|
|
638
507
|
}
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
508
|
+
}
|
|
509
|
+
if (!filterFound) {
|
|
510
|
+
console.log('pushing: ', filterValues, filterType);
|
|
511
|
+
layerFilter.push(filter);
|
|
643
512
|
}
|
|
644
513
|
}
|
|
645
|
-
return layersData;
|
|
646
514
|
}
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
} else {
|
|
656
|
-
defClone[defClone.length - 1] = setRowForField(defClone[defClone.length - 1]);
|
|
657
|
-
}
|
|
658
|
-
return defClone;
|
|
515
|
+
return layersData;
|
|
516
|
+
}
|
|
517
|
+
createFilterForStyle(defValue, filterType, filterValues, value) {
|
|
518
|
+
function setRowForField(defCopy) {
|
|
519
|
+
if (Array.isArray(defCopy) && defCopy[0] === 'match') {
|
|
520
|
+
let defClone = [...defCopy];
|
|
521
|
+
if (Array.isArray(defClone[1]) && defClone[1][1] === filterType) {
|
|
522
|
+
setRowForValue(defClone, defCopy);
|
|
659
523
|
} else {
|
|
660
|
-
|
|
524
|
+
defClone[defClone.length - 1] = setRowForField(defClone[defClone.length - 1]);
|
|
661
525
|
}
|
|
526
|
+
return defClone;
|
|
527
|
+
} else {
|
|
528
|
+
return ['match', ['get', filterType], filterValues, value, defCopy];
|
|
662
529
|
}
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
530
|
+
}
|
|
531
|
+
function setRowForValue(defClone, defCopy) {
|
|
532
|
+
for (let i = 3; i < defCopy.length; i += 2) {
|
|
533
|
+
if (defClone[i] === value) {
|
|
534
|
+
const newFilterValues = pushArray(defClone[i - 1], filterValues);
|
|
535
|
+
defClone[i - 1] = newFilterValues;
|
|
536
|
+
return;
|
|
537
|
+
} else if (i + 2 === defCopy.length) {
|
|
538
|
+
defClone.splice(i + 1, 0, filterValues, value);
|
|
672
539
|
}
|
|
673
540
|
}
|
|
674
|
-
function pushArray(originalArray, newArray) {
|
|
675
|
-
var filteredArray = newArray.filter(function (item) {
|
|
676
|
-
return !originalArray.includes(item);
|
|
677
|
-
});
|
|
678
|
-
originalArray.push.apply(originalArray, _toConsumableArray(filteredArray));
|
|
679
|
-
return originalArray;
|
|
680
|
-
}
|
|
681
|
-
return setRowForField(defValue);
|
|
682
541
|
}
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
542
|
+
function pushArray(originalArray, newArray) {
|
|
543
|
+
const filteredArray = newArray.filter(item => !originalArray.includes(item));
|
|
544
|
+
originalArray.push(...filteredArray);
|
|
545
|
+
return originalArray;
|
|
546
|
+
}
|
|
547
|
+
return setRowForField(defValue);
|
|
548
|
+
}
|
|
549
|
+
styleLayersByType(layersData, filterType, filterValues, property, value) {
|
|
550
|
+
if (!filterValues) {
|
|
551
|
+
return;
|
|
552
|
+
}
|
|
553
|
+
for (let index = 0; index < layersData.length; index += 1) {
|
|
554
|
+
// if (layersData[index].isFireAlarmLayer) {
|
|
555
|
+
const layer = layersData[index];
|
|
556
|
+
const layerStyle = layer.paint;
|
|
557
|
+
const layerType = layer.type;
|
|
694
558
|
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
}
|
|
559
|
+
// TODO: add support for other layers later
|
|
560
|
+
if (layerType && layerType === 'fill' || layerType === 'line') {
|
|
561
|
+
if (layerStyle[property]) {
|
|
562
|
+
let defValue = layerStyle[property];
|
|
563
|
+
if (defValue) {
|
|
564
|
+
const filter = this.createFilterForStyle(defValue, filterType, filterValues, value);
|
|
565
|
+
layerStyle[property] = filter;
|
|
703
566
|
}
|
|
704
567
|
}
|
|
705
|
-
// }
|
|
706
568
|
}
|
|
707
|
-
|
|
569
|
+
// }
|
|
708
570
|
}
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
} else {
|
|
719
|
-
defClone = defClone[defClone.length - 1];
|
|
720
|
-
}
|
|
571
|
+
return layersData;
|
|
572
|
+
}
|
|
573
|
+
createFilterForClearStyle(defValue, filterType, filterValues) {
|
|
574
|
+
function setRowForField(defCopy) {
|
|
575
|
+
if (Array.isArray(defCopy) && defCopy[0] === 'match') {
|
|
576
|
+
let defClone = [...defCopy];
|
|
577
|
+
if (Array.isArray(defClone[1]) && defClone[1][1] === filterType) {
|
|
578
|
+
if (filterValues.length > 0) {
|
|
579
|
+
setRowForValue(defClone, defCopy);
|
|
721
580
|
} else {
|
|
722
|
-
defClone
|
|
581
|
+
defClone = defClone[defClone.length - 1];
|
|
723
582
|
}
|
|
724
|
-
|
|
583
|
+
} else {
|
|
584
|
+
defClone[defClone.length - 1] = setRowForField(defClone[defClone.length - 1]);
|
|
725
585
|
}
|
|
586
|
+
return defClone;
|
|
726
587
|
}
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
588
|
+
}
|
|
589
|
+
function setRowForValue(defClone, defCopy) {
|
|
590
|
+
for (let i = 2; i < defCopy.length; i += 2) {
|
|
591
|
+
if (Array.isArray(defClone[i])) {
|
|
592
|
+
filterValues.forEach(filterValue => {
|
|
593
|
+
const index = defClone[i].indexOf(filterValue);
|
|
594
|
+
if (index > -1) {
|
|
595
|
+
if (defClone[i].length > 1) {
|
|
596
|
+
defClone[i].splice(index, 1);
|
|
597
|
+
} else {
|
|
598
|
+
defClone[i] = [''];
|
|
738
599
|
}
|
|
739
|
-
}
|
|
740
|
-
}
|
|
741
|
-
};
|
|
742
|
-
for (var i = 2; i < defCopy.length; i += 2) {
|
|
743
|
-
_loop(i);
|
|
600
|
+
}
|
|
601
|
+
});
|
|
744
602
|
}
|
|
745
603
|
}
|
|
746
|
-
return setRowForField(defValue);
|
|
747
604
|
}
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
605
|
+
return setRowForField(defValue);
|
|
606
|
+
}
|
|
607
|
+
clearStyleLayersByType(layersData, filterType, filterValues, property) {
|
|
608
|
+
for (let index = 0; index < layersData.length; index += 1) {
|
|
609
|
+
// if (layersData[index].isFireAlarmLayer) {
|
|
610
|
+
const layer = layersData[index];
|
|
611
|
+
const layerStyle = layer.paint;
|
|
612
|
+
const layerType = layer.type;
|
|
756
613
|
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
}
|
|
614
|
+
// TODO: add support for other layers later
|
|
615
|
+
if (layerType && layerType === 'fill' || layerType === 'line') {
|
|
616
|
+
if (layerStyle[property]) {
|
|
617
|
+
let defValue = layerStyle[property];
|
|
618
|
+
if (defValue) {
|
|
619
|
+
const filter = this.createFilterForClearStyle(defValue, filterType, filterValues);
|
|
620
|
+
layerStyle[property] = filter;
|
|
765
621
|
}
|
|
766
622
|
}
|
|
767
|
-
// }
|
|
768
623
|
}
|
|
769
|
-
|
|
770
|
-
}
|
|
771
|
-
}, {
|
|
772
|
-
key: "normalize",
|
|
773
|
-
value: function normalize(string) {
|
|
774
|
-
return string.trim().toLowerCase();
|
|
624
|
+
// }
|
|
775
625
|
}
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
626
|
+
return layersData;
|
|
627
|
+
}
|
|
628
|
+
normalize(string) {
|
|
629
|
+
return string.trim().toLowerCase();
|
|
630
|
+
}
|
|
631
|
+
relevanceSort(metaFeatures, query) {
|
|
632
|
+
let isStrict = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
633
|
+
function score(metaFeature) {
|
|
634
|
+
const noMatch = [-1, 0, metaFeature.name];
|
|
635
|
+
if (metaFeature.name) {
|
|
636
|
+
const lowerStr = metaFeature.name.toLowerCase();
|
|
637
|
+
const lowerQuery = query.toLowerCase();
|
|
785
638
|
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
if (lowerStr.includes(lowerQuery)) {
|
|
803
|
-
return [0, -metaFeature.name.length, lowerStr];
|
|
804
|
-
} else {
|
|
805
|
-
return noMatch;
|
|
806
|
-
}
|
|
639
|
+
// 1. If the string is the same as the query
|
|
640
|
+
if (lowerStr === lowerQuery) {
|
|
641
|
+
return [1000, -metaFeature.name.length, lowerStr];
|
|
642
|
+
}
|
|
643
|
+
// 2. If the string starts with the query
|
|
644
|
+
else if (lowerStr.startsWith(lowerQuery)) {
|
|
645
|
+
return [500, -metaFeature.name.length, lowerStr];
|
|
646
|
+
}
|
|
647
|
+
// 3. If one of the words in the string starts with the query
|
|
648
|
+
else if (lowerStr.split(' ').some(word => word.startsWith(lowerQuery))) {
|
|
649
|
+
return [200, -metaFeature.name.length, lowerStr];
|
|
650
|
+
}
|
|
651
|
+
// 4. The string contains the query
|
|
652
|
+
else if (!isStrict) {
|
|
653
|
+
if (lowerStr.includes(lowerQuery)) {
|
|
654
|
+
return [0, -metaFeature.name.length, lowerStr];
|
|
807
655
|
} else {
|
|
808
656
|
return noMatch;
|
|
809
657
|
}
|
|
810
658
|
} else {
|
|
811
659
|
return noMatch;
|
|
812
660
|
}
|
|
661
|
+
} else {
|
|
662
|
+
return noMatch;
|
|
813
663
|
}
|
|
814
|
-
return metaFeatures.sort(function (a, b) {
|
|
815
|
-
var scoreA = score(a);
|
|
816
|
-
var scoreB = score(b);
|
|
817
|
-
return scoreB[0] - scoreA[0] || scoreB[1] - scoreA[1] || scoreA[2].localeCompare(scoreB[2]);
|
|
818
|
-
}).filter(function (s) {
|
|
819
|
-
return score(s)[0] >= 0;
|
|
820
|
-
});
|
|
821
664
|
}
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
665
|
+
return metaFeatures.sort((a, b) => {
|
|
666
|
+
const scoreA = score(a);
|
|
667
|
+
const scoreB = score(b);
|
|
668
|
+
return scoreB[0] - scoreA[0] || scoreB[1] - scoreA[1] || scoreA[2].localeCompare(scoreB[2]);
|
|
669
|
+
}).filter(s => score(s)[0] >= 0);
|
|
670
|
+
}
|
|
671
|
+
sort(metaFeatures, sortType) {
|
|
672
|
+
let query = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
|
|
673
|
+
const compare = (a, b) => {
|
|
674
|
+
if (!a || !b) {
|
|
675
|
+
return 0;
|
|
676
|
+
}
|
|
677
|
+
return a.localeCompare(b);
|
|
678
|
+
};
|
|
679
|
+
if (sortType === SortType.Name) {
|
|
680
|
+
return metaFeatures.sort((a, b) => {
|
|
681
|
+
return compare(a.name, b.name);
|
|
682
|
+
});
|
|
683
|
+
} else if (sortType === SortType.WhereDimension) {
|
|
684
|
+
return metaFeatures.sort((a, b) => {
|
|
685
|
+
const whereComparison = compare(a.whereDimension, b.whereDimension);
|
|
686
|
+
if (whereComparison === 0) {
|
|
834
687
|
return compare(a.name, b.name);
|
|
835
|
-
}
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
688
|
+
} else {
|
|
689
|
+
return whereComparison;
|
|
690
|
+
}
|
|
691
|
+
});
|
|
692
|
+
} else if (sortType === SortType.Relevance) {
|
|
693
|
+
return this.relevanceSort(metaFeatures, query);
|
|
694
|
+
} else if (sortType === SortType.RelevanceStrict) {
|
|
695
|
+
return this.relevanceSort(metaFeatures, query, true);
|
|
696
|
+
}
|
|
697
|
+
}
|
|
698
|
+
async setupMapObjectSearch(onSearchStatusUpdateCallback) {
|
|
699
|
+
const status = await (0, _fetchPublishedJson.getPublishedData)({
|
|
700
|
+
URL: this.empApi,
|
|
701
|
+
accessToken: this.atomsAPIAccessToken,
|
|
702
|
+
secretKey: this.secretKeyForDecryption,
|
|
703
|
+
publishedDataType: _fetchPublishedJson.PublishedDataType.MapObjects
|
|
704
|
+
}, this.storage);
|
|
705
|
+
this.searchStatus = status;
|
|
706
|
+
console.log('search status: ', status);
|
|
707
|
+
const mapObjects = _mapobjectsStore.default.getState().data;
|
|
708
|
+
for (let index = 0; index < mapObjects.length; index++) {
|
|
709
|
+
const mapObject = mapObjects[index];
|
|
710
|
+
if (mapObject) {
|
|
711
|
+
// Decide geometry type based on coordinates format:
|
|
712
|
+
// - Point: [lng, lat]
|
|
713
|
+
// - LineString: [[lng, lat], [lng, lat], ...]
|
|
714
|
+
const coords = mapObject.lngLat;
|
|
715
|
+
const geometry = Array.isArray(coords) && Array.isArray(coords[0]) ? {
|
|
716
|
+
type: 'LineString',
|
|
717
|
+
coordinates: coords
|
|
718
|
+
} : {
|
|
719
|
+
type: 'Point',
|
|
720
|
+
coordinates: coords
|
|
721
|
+
};
|
|
722
|
+
|
|
723
|
+
// Re-create geojson
|
|
724
|
+
const moJSON = {
|
|
725
|
+
mapObjectId: mapObject.mID,
|
|
726
|
+
coordinates: mapObject.lngLat,
|
|
727
|
+
name: mapObject.name,
|
|
728
|
+
whatDimension: mapObject.what,
|
|
729
|
+
whereDimension: mapObject.where,
|
|
730
|
+
geometry,
|
|
731
|
+
properties: {
|
|
732
|
+
myMapObjectId: mapObject.mID,
|
|
733
|
+
title: mapObject.name,
|
|
734
|
+
localRef: mapObject.localRef,
|
|
735
|
+
dimension_what: mapObject.what,
|
|
736
|
+
dimension_where: mapObject.where,
|
|
737
|
+
booth_info: {
|
|
738
|
+
overview: mapObject.overview,
|
|
739
|
+
images: mapObject.images,
|
|
740
|
+
videos: mapObject.videos,
|
|
741
|
+
files: mapObject.files,
|
|
742
|
+
products: mapObject.products,
|
|
743
|
+
logos: mapObject.logos
|
|
744
|
+
},
|
|
745
|
+
metadata: mapObject.metadata ? JSON.parse(mapObject.metadata) : null
|
|
843
746
|
}
|
|
844
|
-
}
|
|
845
|
-
|
|
846
|
-
return this.relevanceSort(metaFeatures, query);
|
|
847
|
-
} else if (sortType === SortType.RelevanceStrict) {
|
|
848
|
-
return this.relevanceSort(metaFeatures, query, true);
|
|
747
|
+
};
|
|
748
|
+
this.searchableGeoJsonFeatures.push(moJSON);
|
|
849
749
|
}
|
|
850
750
|
}
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
status = _context3.v;
|
|
868
|
-
this.searchStatus = status;
|
|
869
|
-
console.log('search status: ', status);
|
|
870
|
-
mapObjects = _mapobjectsStore["default"].getState().data;
|
|
871
|
-
for (index = 0; index < mapObjects.length; index++) {
|
|
872
|
-
mapObject = mapObjects[index];
|
|
873
|
-
if (mapObject) {
|
|
874
|
-
// Decide geometry type based on coordinates format:
|
|
875
|
-
// - Point: [lng, lat]
|
|
876
|
-
// - LineString: [[lng, lat], [lng, lat], ...]
|
|
877
|
-
coords = mapObject.lngLat;
|
|
878
|
-
geometry = Array.isArray(coords) && Array.isArray(coords[0]) ? {
|
|
879
|
-
type: 'LineString',
|
|
880
|
-
coordinates: coords
|
|
881
|
-
} : {
|
|
882
|
-
type: 'Point',
|
|
883
|
-
coordinates: coords
|
|
884
|
-
}; // Re-create geojson
|
|
885
|
-
moJSON = {
|
|
886
|
-
mapObjectId: mapObject.mID,
|
|
887
|
-
coordinates: mapObject.lngLat,
|
|
888
|
-
name: mapObject.name,
|
|
889
|
-
whatDimension: mapObject.what,
|
|
890
|
-
whereDimension: mapObject.where,
|
|
891
|
-
geometry: geometry,
|
|
892
|
-
properties: {
|
|
893
|
-
myMapObjectId: mapObject.mID,
|
|
894
|
-
title: mapObject.name,
|
|
895
|
-
localRef: mapObject.localRef,
|
|
896
|
-
dimension_what: mapObject.what,
|
|
897
|
-
dimension_where: mapObject.where,
|
|
898
|
-
booth_info: {
|
|
899
|
-
overview: mapObject.overview,
|
|
900
|
-
images: mapObject.images,
|
|
901
|
-
videos: mapObject.videos,
|
|
902
|
-
files: mapObject.files,
|
|
903
|
-
products: mapObject.products,
|
|
904
|
-
logos: mapObject.logos
|
|
905
|
-
},
|
|
906
|
-
metadata: mapObject.metadata ? JSON.parse(mapObject.metadata) : null
|
|
907
|
-
}
|
|
908
|
-
};
|
|
909
|
-
this.searchableGeoJsonFeatures.push(moJSON);
|
|
910
|
-
}
|
|
911
|
-
}
|
|
912
|
-
if (onSearchStatusUpdateCallback) {
|
|
913
|
-
onSearchStatusUpdateCallback(status === _fetchPublishedJson.Status.Ready ? true : false);
|
|
914
|
-
}
|
|
915
|
-
case 2:
|
|
916
|
-
return _context3.a(2);
|
|
917
|
-
}
|
|
918
|
-
}, _callee3, this);
|
|
919
|
-
}));
|
|
920
|
-
function setupMapObjectSearch(_x3) {
|
|
921
|
-
return _setupMapObjectSearch.apply(this, arguments);
|
|
751
|
+
if (onSearchStatusUpdateCallback) {
|
|
752
|
+
onSearchStatusUpdateCallback(status === _fetchPublishedJson.Status.Ready ? true : false);
|
|
753
|
+
}
|
|
754
|
+
}
|
|
755
|
+
getMapObjectsByFilteredLocalRef(boothId) {
|
|
756
|
+
let searchSubString = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
757
|
+
let sortType = arguments.length > 2 ? arguments[2] : undefined;
|
|
758
|
+
let onResponseCallback = arguments.length > 3 ? arguments[3] : undefined;
|
|
759
|
+
const uniqueIds = new Set();
|
|
760
|
+
const metaFeatures = [];
|
|
761
|
+
const boothIdToSearch = this.normalize(String(boothId));
|
|
762
|
+
for (const feature of this.searchableGeoJsonFeatures) {
|
|
763
|
+
const id = feature.properties.myMapObjectId;
|
|
764
|
+
const localRef = this.normalize(String(feature.properties.localRef));
|
|
765
|
+
if (searchSubString && !localRef.includes(boothIdToSearch)) {
|
|
766
|
+
continue;
|
|
922
767
|
}
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
}, {
|
|
926
|
-
key: "getMapObjectsByFilteredLocalRef",
|
|
927
|
-
value: function getMapObjectsByFilteredLocalRef(boothId) {
|
|
928
|
-
var searchSubString = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
929
|
-
var sortType = arguments.length > 2 ? arguments[2] : undefined;
|
|
930
|
-
var onResponseCallback = arguments.length > 3 ? arguments[3] : undefined;
|
|
931
|
-
var uniqueIds = new Set();
|
|
932
|
-
var metaFeatures = [];
|
|
933
|
-
var boothIdToSearch = this.normalize(String(boothId));
|
|
934
|
-
var _iterator5 = _createForOfIteratorHelper(this.searchableGeoJsonFeatures),
|
|
935
|
-
_step5;
|
|
936
|
-
try {
|
|
937
|
-
for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
|
|
938
|
-
var feature = _step5.value;
|
|
939
|
-
var id = feature.properties.myMapObjectId;
|
|
940
|
-
var localRef = this.normalize(String(feature.properties.localRef));
|
|
941
|
-
if (searchSubString && !localRef.includes(boothIdToSearch)) {
|
|
942
|
-
continue;
|
|
943
|
-
}
|
|
944
|
-
if (!searchSubString && localRef !== boothIdToSearch) {
|
|
945
|
-
continue;
|
|
946
|
-
}
|
|
947
|
-
if (uniqueIds.has(id)) {
|
|
948
|
-
continue;
|
|
949
|
-
}
|
|
950
|
-
uniqueIds.add(id);
|
|
951
|
-
var objFeature = {
|
|
952
|
-
mapObjectId: String(feature.properties.myMapObjectId),
|
|
953
|
-
coordinates: null,
|
|
954
|
-
name: feature.properties.title,
|
|
955
|
-
whatDimension: feature.properties.dimension_what,
|
|
956
|
-
whereDimension: feature.properties.dimension_where,
|
|
957
|
-
geometry: feature.geometry,
|
|
958
|
-
properties: feature.properties
|
|
959
|
-
};
|
|
960
|
-
metaFeatures.push(objFeature);
|
|
961
|
-
}
|
|
962
|
-
} catch (err) {
|
|
963
|
-
_iterator5.e(err);
|
|
964
|
-
} finally {
|
|
965
|
-
_iterator5.f();
|
|
768
|
+
if (!searchSubString && localRef !== boothIdToSearch) {
|
|
769
|
+
continue;
|
|
966
770
|
}
|
|
967
|
-
|
|
968
|
-
|
|
771
|
+
if (uniqueIds.has(id)) {
|
|
772
|
+
continue;
|
|
773
|
+
}
|
|
774
|
+
uniqueIds.add(id);
|
|
775
|
+
const objFeature = {
|
|
776
|
+
mapObjectId: String(feature.properties.myMapObjectId),
|
|
777
|
+
coordinates: null,
|
|
778
|
+
name: feature.properties.title,
|
|
779
|
+
whatDimension: feature.properties.dimension_what,
|
|
780
|
+
whereDimension: feature.properties.dimension_where,
|
|
781
|
+
geometry: feature.geometry,
|
|
782
|
+
properties: feature.properties
|
|
783
|
+
};
|
|
784
|
+
metaFeatures.push(objFeature);
|
|
969
785
|
}
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
}
|
|
992
|
-
if (uniqueIds.has(id)) {
|
|
993
|
-
continue;
|
|
994
|
-
}
|
|
995
|
-
uniqueIds.add(id);
|
|
996
|
-
var objFeature = {
|
|
997
|
-
mapObjectId: String(feature.properties.myMapObjectId),
|
|
998
|
-
coordinates: null,
|
|
999
|
-
name: feature.properties.title,
|
|
1000
|
-
whatDimension: feature.properties.dimension_what,
|
|
1001
|
-
whereDimension: feature.properties.dimension_where,
|
|
1002
|
-
geometry: feature.geometry,
|
|
1003
|
-
properties: feature.properties
|
|
1004
|
-
};
|
|
1005
|
-
metaFeatures.push(objFeature);
|
|
1006
|
-
}
|
|
1007
|
-
} catch (err) {
|
|
1008
|
-
_iterator6.e(err);
|
|
1009
|
-
} finally {
|
|
1010
|
-
_iterator6.f();
|
|
786
|
+
const sortedFeatures = this.sort(metaFeatures, sortType, boothId);
|
|
787
|
+
onResponseCallback(sortedFeatures);
|
|
788
|
+
}
|
|
789
|
+
getMapObjectsByName(name) {
|
|
790
|
+
let searchSubString = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
791
|
+
let sortType = arguments.length > 2 ? arguments[2] : undefined;
|
|
792
|
+
let onResponseCallback = arguments.length > 3 ? arguments[3] : undefined;
|
|
793
|
+
const uniqueIds = new Set();
|
|
794
|
+
const metaFeatures = [];
|
|
795
|
+
const nameToSearch = this.normalize(String(name));
|
|
796
|
+
for (const feature of this.searchableGeoJsonFeatures) {
|
|
797
|
+
const id = feature.properties.myMapObjectId;
|
|
798
|
+
const title = this.normalize(String(feature.properties.title));
|
|
799
|
+
if (searchSubString && !title.includes(nameToSearch)) {
|
|
800
|
+
continue;
|
|
801
|
+
}
|
|
802
|
+
if (!searchSubString && title !== nameToSearch) {
|
|
803
|
+
continue;
|
|
804
|
+
}
|
|
805
|
+
if (uniqueIds.has(id)) {
|
|
806
|
+
continue;
|
|
1011
807
|
}
|
|
1012
|
-
|
|
1013
|
-
|
|
808
|
+
uniqueIds.add(id);
|
|
809
|
+
const objFeature = {
|
|
810
|
+
mapObjectId: String(feature.properties.myMapObjectId),
|
|
811
|
+
coordinates: null,
|
|
812
|
+
name: feature.properties.title,
|
|
813
|
+
whatDimension: feature.properties.dimension_what,
|
|
814
|
+
whereDimension: feature.properties.dimension_where,
|
|
815
|
+
geometry: feature.geometry,
|
|
816
|
+
properties: feature.properties
|
|
817
|
+
};
|
|
818
|
+
metaFeatures.push(objFeature);
|
|
1014
819
|
}
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
properties: feature.properties
|
|
1034
|
-
};
|
|
1035
|
-
metaFeatures.push(objFeature);
|
|
1036
|
-
}
|
|
1037
|
-
}
|
|
1038
|
-
} catch (err) {
|
|
1039
|
-
_iterator7.e(err);
|
|
1040
|
-
} finally {
|
|
1041
|
-
_iterator7.f();
|
|
820
|
+
const sortedFeatures = this.sort(metaFeatures, sortType, name);
|
|
821
|
+
onResponseCallback(sortedFeatures);
|
|
822
|
+
}
|
|
823
|
+
getMapObjectById(idToSearch, onResponseCallback) {
|
|
824
|
+
let metaFeatures = [];
|
|
825
|
+
for (const feature of this.searchableGeoJsonFeatures) {
|
|
826
|
+
const id = String(feature.properties.myMapObjectId);
|
|
827
|
+
if (id === String(idToSearch)) {
|
|
828
|
+
const objFeature = {
|
|
829
|
+
mapObjectId: String(feature.properties.myMapObjectId),
|
|
830
|
+
coordinates: feature.coordinates,
|
|
831
|
+
name: feature.properties.title,
|
|
832
|
+
whatDimension: feature.properties.dimension_what,
|
|
833
|
+
whereDimension: feature.properties.dimension_where,
|
|
834
|
+
geometry: feature.geometry,
|
|
835
|
+
properties: feature.properties
|
|
836
|
+
};
|
|
837
|
+
metaFeatures.push(objFeature);
|
|
1042
838
|
}
|
|
1043
|
-
onResponseCallback(metaFeatures);
|
|
1044
839
|
}
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
geometry: feature.geometry,
|
|
1063
|
-
properties: feature.properties
|
|
1064
|
-
};
|
|
1065
|
-
metaFeatures.push(objFeature);
|
|
1066
|
-
}
|
|
1067
|
-
}
|
|
1068
|
-
} catch (err) {
|
|
1069
|
-
_iterator8.e(err);
|
|
1070
|
-
} finally {
|
|
1071
|
-
_iterator8.f();
|
|
840
|
+
onResponseCallback(metaFeatures);
|
|
841
|
+
}
|
|
842
|
+
getMapObjectByLocalRef(localRefToSearch, onResponseCallback) {
|
|
843
|
+
let metaFeatures = [];
|
|
844
|
+
for (const feature of this.searchableGeoJsonFeatures) {
|
|
845
|
+
const localRef = String(feature.properties.localRef);
|
|
846
|
+
if (localRef === String(localRefToSearch)) {
|
|
847
|
+
const objFeature = {
|
|
848
|
+
mapObjectId: String(feature.properties.myMapObjectId),
|
|
849
|
+
coordinates: feature.coordinates,
|
|
850
|
+
name: feature.properties.title,
|
|
851
|
+
whatDimension: feature.properties.dimension_what,
|
|
852
|
+
whereDimension: feature.properties.dimension_where,
|
|
853
|
+
geometry: feature.geometry,
|
|
854
|
+
properties: feature.properties
|
|
855
|
+
};
|
|
856
|
+
metaFeatures.push(objFeature);
|
|
1072
857
|
}
|
|
1073
|
-
onResponseCallback(metaFeatures);
|
|
1074
858
|
}
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
geometry: feature.geometry,
|
|
1093
|
-
properties: feature.properties
|
|
1094
|
-
};
|
|
1095
|
-
metaFeatures.push(objFeature);
|
|
1096
|
-
}
|
|
1097
|
-
}
|
|
1098
|
-
} catch (err) {
|
|
1099
|
-
_iterator9.e(err);
|
|
1100
|
-
} finally {
|
|
1101
|
-
_iterator9.f();
|
|
859
|
+
onResponseCallback(metaFeatures);
|
|
860
|
+
}
|
|
861
|
+
getMapObjectMatchingLocalRef(localRefToSearch, onResponseCallback) {
|
|
862
|
+
let metaFeatures = [];
|
|
863
|
+
for (const feature of this.searchableGeoJsonFeatures) {
|
|
864
|
+
const localRef = String(feature.properties.localRef);
|
|
865
|
+
if (localRef.includes(String(localRefToSearch))) {
|
|
866
|
+
const objFeature = {
|
|
867
|
+
mapObjectId: String(feature.properties.myMapObjectId),
|
|
868
|
+
coordinates: feature.coordinates,
|
|
869
|
+
name: feature.properties.title,
|
|
870
|
+
whatDimension: feature.properties.dimension_what,
|
|
871
|
+
whereDimension: feature.properties.dimension_where,
|
|
872
|
+
geometry: feature.geometry,
|
|
873
|
+
properties: feature.properties
|
|
874
|
+
};
|
|
875
|
+
metaFeatures.push(objFeature);
|
|
1102
876
|
}
|
|
1103
|
-
onResponseCallback(metaFeatures);
|
|
1104
877
|
}
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
coordinates: feature.coordinates,
|
|
1122
|
-
name: feature.properties.title,
|
|
1123
|
-
whatDimension: feature.properties.dimension_what,
|
|
1124
|
-
whereDimension: feature.properties.dimension_where,
|
|
1125
|
-
geometry: feature.geometry,
|
|
1126
|
-
properties: feature.properties
|
|
1127
|
-
};
|
|
1128
|
-
metaFeatures.push(objFeature);
|
|
1129
|
-
}
|
|
878
|
+
onResponseCallback(metaFeatures);
|
|
879
|
+
}
|
|
880
|
+
getMapObjectsMatchingLocalRefs(localRefsToSearch, onResponseCallback) {
|
|
881
|
+
let metaFeatures = [];
|
|
882
|
+
const localRefsArray = Array.isArray(localRefsToSearch) ? localRefsToSearch : [localRefsToSearch];
|
|
883
|
+
for (const feature of this.searchableGeoJsonFeatures) {
|
|
884
|
+
const localRef = String(feature.properties.localRef);
|
|
885
|
+
if (localRefsArray.some(ref => localRef.includes(String(ref)))) {
|
|
886
|
+
const objFeature = {
|
|
887
|
+
mapObjectId: String(feature.properties.myMapObjectId),
|
|
888
|
+
coordinates: feature.coordinates,
|
|
889
|
+
name: feature.properties.title,
|
|
890
|
+
whatDimension: feature.properties.dimension_what,
|
|
891
|
+
whereDimension: feature.properties.dimension_where,
|
|
892
|
+
geometry: feature.geometry,
|
|
893
|
+
properties: feature.properties
|
|
1130
894
|
};
|
|
1131
|
-
|
|
1132
|
-
_loop2();
|
|
1133
|
-
}
|
|
1134
|
-
} catch (err) {
|
|
1135
|
-
_iterator0.e(err);
|
|
1136
|
-
} finally {
|
|
1137
|
-
_iterator0.f();
|
|
895
|
+
metaFeatures.push(objFeature);
|
|
1138
896
|
}
|
|
1139
|
-
onResponseCallback(metaFeatures);
|
|
1140
897
|
}
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
geometry: feature.geometry,
|
|
1159
|
-
properties: feature.properties
|
|
1160
|
-
};
|
|
1161
|
-
metaFeatures.push(objFeature);
|
|
1162
|
-
}
|
|
1163
|
-
}
|
|
1164
|
-
} catch (err) {
|
|
1165
|
-
_iterator1.e(err);
|
|
1166
|
-
} finally {
|
|
1167
|
-
_iterator1.f();
|
|
898
|
+
onResponseCallback(metaFeatures);
|
|
899
|
+
}
|
|
900
|
+
getMapObjectsByWhatTaxonomy(whatTaxonomyPath, onResponseCallback) {
|
|
901
|
+
let metaFeatures = [];
|
|
902
|
+
for (const feature of this.searchableGeoJsonFeatures) {
|
|
903
|
+
const whatTaxonomy = String(feature.properties.dimension_what);
|
|
904
|
+
if (!whatTaxonomyPath || whatTaxonomy === String(whatTaxonomyPath)) {
|
|
905
|
+
const objFeature = {
|
|
906
|
+
mapObjectId: String(feature.properties.myMapObjectId),
|
|
907
|
+
coordinates: feature.coordinates,
|
|
908
|
+
name: feature.properties.title,
|
|
909
|
+
whatDimension: feature.properties.dimension_what,
|
|
910
|
+
whereDimension: feature.properties.dimension_where,
|
|
911
|
+
geometry: feature.geometry,
|
|
912
|
+
properties: feature.properties
|
|
913
|
+
};
|
|
914
|
+
metaFeatures.push(objFeature);
|
|
1168
915
|
}
|
|
1169
|
-
onResponseCallback(metaFeatures);
|
|
1170
916
|
}
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
geometry: feature.geometry,
|
|
1189
|
-
properties: feature.properties
|
|
1190
|
-
};
|
|
1191
|
-
metaFeatures.push(objFeature);
|
|
1192
|
-
}
|
|
1193
|
-
}
|
|
1194
|
-
} catch (err) {
|
|
1195
|
-
_iterator10.e(err);
|
|
1196
|
-
} finally {
|
|
1197
|
-
_iterator10.f();
|
|
917
|
+
onResponseCallback(metaFeatures);
|
|
918
|
+
}
|
|
919
|
+
getMapObjectsByWhereTaxonomy(whereTaxonomyPath, onResponseCallback) {
|
|
920
|
+
let metaFeatures = [];
|
|
921
|
+
for (const feature of this.searchableGeoJsonFeatures) {
|
|
922
|
+
const whereTaxonomy = String(feature.properties.dimension_where);
|
|
923
|
+
if (whereTaxonomy === String(whereTaxonomyPath)) {
|
|
924
|
+
const objFeature = {
|
|
925
|
+
mapObjectId: String(feature.properties.myMapObjectId),
|
|
926
|
+
coordinates: feature.coordinates,
|
|
927
|
+
name: feature.properties.title,
|
|
928
|
+
whatDimension: feature.properties.dimension_what,
|
|
929
|
+
whereDimension: feature.properties.dimension_where,
|
|
930
|
+
geometry: feature.geometry,
|
|
931
|
+
properties: feature.properties
|
|
932
|
+
};
|
|
933
|
+
metaFeatures.push(objFeature);
|
|
1198
934
|
}
|
|
1199
|
-
onResponseCallback(metaFeatures);
|
|
1200
935
|
}
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
geometry: feature.geometry,
|
|
1220
|
-
properties: feature.properties
|
|
1221
|
-
};
|
|
1222
|
-
metaFeatures.push(objFeature);
|
|
1223
|
-
}
|
|
1224
|
-
}
|
|
1225
|
-
} catch (err) {
|
|
1226
|
-
_iterator11.e(err);
|
|
1227
|
-
} finally {
|
|
1228
|
-
_iterator11.f();
|
|
936
|
+
onResponseCallback(metaFeatures);
|
|
937
|
+
}
|
|
938
|
+
getMapObjectsByWhatAndWhereTaxonomy(whatTaxonomyPath, whereTaxonomyPath, onResponseCallback) {
|
|
939
|
+
let metaFeatures = [];
|
|
940
|
+
for (const feature of this.searchableGeoJsonFeatures) {
|
|
941
|
+
const whereTaxonomy = String(feature.properties.dimension_where);
|
|
942
|
+
const whatTaxonomy = String(feature.properties.dimension_what);
|
|
943
|
+
if (whereTaxonomy === String(whereTaxonomyPath) && whatTaxonomy === String(whatTaxonomyPath)) {
|
|
944
|
+
const objFeature = {
|
|
945
|
+
mapObjectId: String(feature.properties.myMapObjectId),
|
|
946
|
+
coordinates: feature.coordinates,
|
|
947
|
+
name: feature.properties.title,
|
|
948
|
+
whatDimension: feature.properties.dimension_what,
|
|
949
|
+
whereDimension: feature.properties.dimension_where,
|
|
950
|
+
geometry: feature.geometry,
|
|
951
|
+
properties: feature.properties
|
|
952
|
+
};
|
|
953
|
+
metaFeatures.push(objFeature);
|
|
1229
954
|
}
|
|
1230
|
-
onResponseCallback(metaFeatures);
|
|
1231
955
|
}
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
geometry: feature.geometry,
|
|
1250
|
-
properties: feature.properties
|
|
1251
|
-
};
|
|
1252
|
-
metaFeatures.push(objFeature);
|
|
1253
|
-
}
|
|
1254
|
-
}
|
|
1255
|
-
} catch (err) {
|
|
1256
|
-
_iterator12.e(err);
|
|
1257
|
-
} finally {
|
|
1258
|
-
_iterator12.f();
|
|
956
|
+
onResponseCallback(metaFeatures);
|
|
957
|
+
}
|
|
958
|
+
getMapObjectsInWhatTaxonomy(whatTaxonomyPaths, onResponseCallback) {
|
|
959
|
+
let metaFeatures = [];
|
|
960
|
+
for (const feature of this.searchableGeoJsonFeatures) {
|
|
961
|
+
const whatTaxonomy = String(feature.properties.dimension_what);
|
|
962
|
+
if (whatTaxonomyPaths.includes(whatTaxonomy)) {
|
|
963
|
+
const objFeature = {
|
|
964
|
+
mapObjectId: String(feature.properties.myMapObjectId),
|
|
965
|
+
coordinates: feature.coordinates,
|
|
966
|
+
name: feature.properties.title,
|
|
967
|
+
whatDimension: feature.properties.dimension_what,
|
|
968
|
+
whereDimension: feature.properties.dimension_where,
|
|
969
|
+
geometry: feature.geometry,
|
|
970
|
+
properties: feature.properties
|
|
971
|
+
};
|
|
972
|
+
metaFeatures.push(objFeature);
|
|
1259
973
|
}
|
|
1260
|
-
onResponseCallback(metaFeatures);
|
|
1261
974
|
}
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
geometry: feature.geometry,
|
|
1280
|
-
properties: feature.properties
|
|
1281
|
-
};
|
|
1282
|
-
metaFeatures.push(objFeature);
|
|
1283
|
-
}
|
|
1284
|
-
}
|
|
1285
|
-
} catch (err) {
|
|
1286
|
-
_iterator13.e(err);
|
|
1287
|
-
} finally {
|
|
1288
|
-
_iterator13.f();
|
|
975
|
+
onResponseCallback(metaFeatures);
|
|
976
|
+
}
|
|
977
|
+
getMapObjectsInWhereTaxonomy(whereTaxonomyPaths, onResponseCallback) {
|
|
978
|
+
let metaFeatures = [];
|
|
979
|
+
for (const feature of this.searchableGeoJsonFeatures) {
|
|
980
|
+
const whereTaxonomy = String(feature.properties.dimension_where);
|
|
981
|
+
if (whereTaxonomyPaths.includes(whereTaxonomy)) {
|
|
982
|
+
const objFeature = {
|
|
983
|
+
mapObjectId: String(feature.properties.myMapObjectId),
|
|
984
|
+
coordinates: feature.coordinates,
|
|
985
|
+
name: feature.properties.title,
|
|
986
|
+
whatDimension: feature.properties.dimension_what,
|
|
987
|
+
whereDimension: feature.properties.dimension_where,
|
|
988
|
+
geometry: feature.geometry,
|
|
989
|
+
properties: feature.properties
|
|
990
|
+
};
|
|
991
|
+
metaFeatures.push(objFeature);
|
|
1289
992
|
}
|
|
1290
|
-
onResponseCallback(metaFeatures);
|
|
1291
993
|
}
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
geometry: feature.geometry,
|
|
1311
|
-
properties: feature.properties
|
|
1312
|
-
};
|
|
1313
|
-
metaFeatures.push(objFeature);
|
|
1314
|
-
}
|
|
1315
|
-
}
|
|
1316
|
-
} catch (err) {
|
|
1317
|
-
_iterator14.e(err);
|
|
1318
|
-
} finally {
|
|
1319
|
-
_iterator14.f();
|
|
994
|
+
onResponseCallback(metaFeatures);
|
|
995
|
+
}
|
|
996
|
+
getMapObjectsInWhatAndWhereTaxonomy(whatTaxonomyPaths, whereTaxonomyPaths, onResponseCallback) {
|
|
997
|
+
let metaFeatures = [];
|
|
998
|
+
for (const feature of this.searchableGeoJsonFeatures) {
|
|
999
|
+
const whereTaxonomy = String(feature.properties.dimension_where);
|
|
1000
|
+
const whatTaxonomy = String(feature.properties.dimension_what);
|
|
1001
|
+
if (whereTaxonomyPaths.includes(whereTaxonomy) && whatTaxonomyPaths.includes(whatTaxonomy)) {
|
|
1002
|
+
const objFeature = {
|
|
1003
|
+
mapObjectId: String(feature.properties.myMapObjectId),
|
|
1004
|
+
coordinates: feature.coordinates,
|
|
1005
|
+
name: feature.properties.title,
|
|
1006
|
+
whatDimension: feature.properties.dimension_what,
|
|
1007
|
+
whereDimension: feature.properties.dimension_where,
|
|
1008
|
+
geometry: feature.geometry,
|
|
1009
|
+
properties: feature.properties
|
|
1010
|
+
};
|
|
1011
|
+
metaFeatures.push(objFeature);
|
|
1320
1012
|
}
|
|
1321
|
-
onResponseCallback(metaFeatures);
|
|
1322
1013
|
}
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
reject(error);
|
|
1341
|
-
});
|
|
1014
|
+
onResponseCallback(metaFeatures);
|
|
1015
|
+
}
|
|
1016
|
+
getMapObjectsApi() {
|
|
1017
|
+
let query = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
1018
|
+
return new Promise((resolve, reject) => {
|
|
1019
|
+
(0, _axios.default)({
|
|
1020
|
+
url: `${this.empApi}/map-objects${query}`,
|
|
1021
|
+
headers: {
|
|
1022
|
+
Authorization: `Bearer ${this.atomsAPIAccessToken}`
|
|
1023
|
+
},
|
|
1024
|
+
method: 'get'
|
|
1025
|
+
}).then(response => {
|
|
1026
|
+
const data = response.data.data;
|
|
1027
|
+
let uniqueFeatures = data;
|
|
1028
|
+
resolve(uniqueFeatures);
|
|
1029
|
+
}).catch(function (error) {
|
|
1030
|
+
reject(error);
|
|
1342
1031
|
});
|
|
1343
|
-
}
|
|
1344
|
-
}
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
}();
|
|
1032
|
+
});
|
|
1033
|
+
}
|
|
1034
|
+
getMapObjectsByWhatTaxonomyAPI(whatTaxonomyPath, onResponseCallback) {
|
|
1035
|
+
let query = `?$limit=${this.apiRequestLimit}`;
|
|
1036
|
+
if (whatTaxonomyPath) query += `&taxonomy2Path=${whatTaxonomyPath}`;
|
|
1037
|
+
this.getMapObjectsApi(query).then(onResponseCallback).catch(onResponseCallback);
|
|
1038
|
+
}
|
|
1039
|
+
}
|
|
1040
|
+
exports.MetaAtlasCore = MetaAtlasCore;
|
|
1353
1041
|
//# sourceMappingURL=meta-atlas-sdk-core.js.map
|