@twinmatrix/spatialverse-sdk-web 0.0.2 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (143) hide show
  1. package/lib/cjs/index.js +9 -9
  2. package/lib/cjs/index.js.map +1 -1
  3. package/lib/cjs/meta-atlas-sdk/3DMap/CustomThreeJsWrapper/CustomThreeJsWrapper.js +213 -294
  4. package/lib/cjs/meta-atlas-sdk/3DMap/CustomThreeJsWrapper/CustomThreeJsWrapper.js.map +1 -1
  5. package/lib/cjs/meta-atlas-sdk/3DMap/CustomThreeJsWrapper/utility/utils.js +40 -41
  6. package/lib/cjs/meta-atlas-sdk/3DMap/CustomThreeJsWrapper/utility/utils.js.map +1 -1
  7. package/lib/cjs/meta-atlas-sdk/3DMap/MainMap.js +170 -196
  8. package/lib/cjs/meta-atlas-sdk/3DMap/MainMap.js.map +1 -1
  9. package/lib/cjs/meta-atlas-sdk/MetaAtlasCore/fetch-published-json.js +167 -215
  10. package/lib/cjs/meta-atlas-sdk/MetaAtlasCore/fetch-published-json.js.map +1 -1
  11. package/lib/cjs/meta-atlas-sdk/MetaAtlasCore/fetchMapObjectsData.js +28 -30
  12. package/lib/cjs/meta-atlas-sdk/MetaAtlasCore/fetchMapObjectsData.js.map +1 -1
  13. package/lib/cjs/meta-atlas-sdk/MetaAtlasCore/meta-atlas-sdk-core.js +861 -1170
  14. package/lib/cjs/meta-atlas-sdk/MetaAtlasCore/meta-atlas-sdk-core.js.map +1 -1
  15. package/lib/cjs/meta-atlas-sdk/MetaAtlasCore/routing-core/index.js +166 -159
  16. package/lib/cjs/meta-atlas-sdk/MetaAtlasCore/routing-core/index.js.map +1 -1
  17. package/lib/cjs/meta-atlas-sdk/MetaAtlasCore/routing-core/interfaces.js +6 -6
  18. package/lib/cjs/meta-atlas-sdk/MetaAtlasCore/routing-core/interfaces.js.map +1 -1
  19. package/lib/cjs/meta-atlas-sdk/MetaAtlasCore/routing-core/mapObjectsHelper.js +6 -6
  20. package/lib/cjs/meta-atlas-sdk/MetaAtlasCore/routing-core/mapObjectsHelper.js.map +1 -1
  21. package/lib/cjs/meta-atlas-sdk/MetaAtlasCore/routing-core/routeLayers.js +3 -3
  22. package/lib/cjs/meta-atlas-sdk/MetaAtlasCore/routing-core/routeLayers.js.map +1 -1
  23. package/lib/cjs/meta-atlas-sdk/MetaAtlasCore/routing-core/routing-helpers.js +523 -610
  24. package/lib/cjs/meta-atlas-sdk/MetaAtlasCore/routing-core/routing-helpers.js.map +1 -1
  25. package/lib/cjs/meta-atlas-sdk/MetaAtlasCore/routing-core/utils.js +149 -154
  26. package/lib/cjs/meta-atlas-sdk/MetaAtlasCore/routing-core/utils.js.map +1 -1
  27. package/lib/cjs/meta-atlas-sdk/customStyles.js +2 -2
  28. package/lib/cjs/meta-atlas-sdk/customStyles.js.map +1 -1
  29. package/lib/cjs/meta-atlas-sdk/customerLayer.js +15 -29
  30. package/lib/cjs/meta-atlas-sdk/customerLayer.js.map +1 -1
  31. package/lib/cjs/meta-atlas-sdk/customerLayerVariant.js +5 -5
  32. package/lib/cjs/meta-atlas-sdk/customerLayerVariant.js.map +1 -1
  33. package/lib/cjs/meta-atlas-sdk/meta-atlas-sdk.js +809 -1033
  34. package/lib/cjs/meta-atlas-sdk/meta-atlas-sdk.js.map +1 -1
  35. package/lib/cjs/meta-atlas-sdk/utils/helpers.js +32 -49
  36. package/lib/cjs/meta-atlas-sdk/utils/helpers.js.map +1 -1
  37. package/lib/cjs/meta-atlas-sdk/utils/local-storage.js +21 -34
  38. package/lib/cjs/meta-atlas-sdk/utils/local-storage.js.map +1 -1
  39. package/lib/cjs/meta-atlas-sdk/utils/mapobjects-store.js +6 -6
  40. package/lib/cjs/meta-atlas-sdk/utils/mapobjects-store.js.map +1 -1
  41. package/lib/cjs/meta-atlas-sdk/utils/routing-store.js +6 -6
  42. package/lib/cjs/meta-atlas-sdk/utils/routing-store.js.map +1 -1
  43. package/lib/cjs/meta-atlas-sdk/utils/routing-visualizer/index.js +363 -491
  44. package/lib/cjs/meta-atlas-sdk/utils/routing-visualizer/index.js.map +1 -1
  45. package/lib/cjs/react/MetaAtlasMap.js +127 -0
  46. package/lib/cjs/react/MetaAtlasMap.js.map +1 -0
  47. package/lib/cjs/react/hooks/useDrawing/index.js +17 -18
  48. package/lib/cjs/react/hooks/useDrawing/index.js.map +1 -1
  49. package/lib/cjs/react/hooks/useFocus/index.js +48 -55
  50. package/lib/cjs/react/hooks/useFocus/index.js.map +1 -1
  51. package/lib/cjs/react/hooks/useMapEvents/index.js +40 -47
  52. package/lib/cjs/react/hooks/useMapEvents/index.js.map +1 -1
  53. package/lib/cjs/react/hooks/useMapOverlays/index.js +20 -21
  54. package/lib/cjs/react/hooks/useMapOverlays/index.js.map +1 -1
  55. package/lib/cjs/react/hooks/useMetaAtlas/index.js +77 -95
  56. package/lib/cjs/react/hooks/useMetaAtlas/index.js.map +1 -1
  57. package/lib/cjs/react/hooks/useMetaAtlas.js +78 -96
  58. package/lib/cjs/react/hooks/useMetaAtlas.js.map +1 -1
  59. package/lib/cjs/react/hooks/useRouting/index.js +21 -20
  60. package/lib/cjs/react/hooks/useRouting/index.js.map +1 -1
  61. package/lib/cjs/react/hooks/useSearch/index.js +35 -34
  62. package/lib/cjs/react/hooks/useSearch/index.js.map +1 -1
  63. package/lib/cjs/react/hooks/useStampRally/index.js +26 -23
  64. package/lib/cjs/react/hooks/useStampRally/index.js.map +1 -1
  65. package/lib/cjs/react/hooks/useStampRally/utils.js +2 -2
  66. package/lib/cjs/react/hooks/useStampRally/utils.js.map +1 -1
  67. package/lib/cjs/react/index.js +31 -31
  68. package/lib/cjs/react/index.js.map +1 -1
  69. package/lib/cjs/react/stores/useMapDataStore.js +47 -62
  70. package/lib/cjs/react/stores/useMapDataStore.js.map +1 -1
  71. package/lib/cjs/react/stores/useMetaAtlasStore.js +27 -40
  72. package/lib/cjs/react/stores/useMetaAtlasStore.js.map +1 -1
  73. package/lib/esm/index.js +3 -7
  74. package/lib/esm/index.js.map +1 -1
  75. package/lib/esm/meta-atlas-sdk/3DMap/CustomThreeJsWrapper/CustomThreeJsWrapper.js +4 -3
  76. package/lib/esm/meta-atlas-sdk/3DMap/CustomThreeJsWrapper/CustomThreeJsWrapper.js.map +1 -1
  77. package/lib/esm/meta-atlas-sdk/3DMap/CustomThreeJsWrapper/utility/utils.js +14 -12
  78. package/lib/esm/meta-atlas-sdk/3DMap/CustomThreeJsWrapper/utility/utils.js.map +1 -1
  79. package/lib/esm/meta-atlas-sdk/3DMap/MainMap.js +204 -200
  80. package/lib/esm/meta-atlas-sdk/3DMap/MainMap.js.map +1 -1
  81. package/lib/esm/meta-atlas-sdk/MetaAtlasCore/fetch-published-json.js +6 -6
  82. package/lib/esm/meta-atlas-sdk/MetaAtlasCore/fetch-published-json.js.map +1 -1
  83. package/lib/esm/meta-atlas-sdk/MetaAtlasCore/fetchMapObjectsData.js +4 -3
  84. package/lib/esm/meta-atlas-sdk/MetaAtlasCore/fetchMapObjectsData.js.map +1 -1
  85. package/lib/esm/meta-atlas-sdk/MetaAtlasCore/meta-atlas-sdk-core.js +53 -42
  86. package/lib/esm/meta-atlas-sdk/MetaAtlasCore/meta-atlas-sdk-core.js.map +1 -1
  87. package/lib/esm/meta-atlas-sdk/MetaAtlasCore/routing-core/index.js +18 -16
  88. package/lib/esm/meta-atlas-sdk/MetaAtlasCore/routing-core/index.js.map +1 -1
  89. package/lib/esm/meta-atlas-sdk/MetaAtlasCore/routing-core/mapObjectsHelper.js +3 -3
  90. package/lib/esm/meta-atlas-sdk/MetaAtlasCore/routing-core/mapObjectsHelper.js.map +1 -1
  91. package/lib/esm/meta-atlas-sdk/MetaAtlasCore/routing-core/routing-helpers.js +73 -79
  92. package/lib/esm/meta-atlas-sdk/MetaAtlasCore/routing-core/routing-helpers.js.map +1 -1
  93. package/lib/esm/meta-atlas-sdk/MetaAtlasCore/routing-core/utils.js +16 -15
  94. package/lib/esm/meta-atlas-sdk/MetaAtlasCore/routing-core/utils.js.map +1 -1
  95. package/lib/esm/meta-atlas-sdk/customerLayer.js +4 -1
  96. package/lib/esm/meta-atlas-sdk/customerLayer.js.map +1 -1
  97. package/lib/esm/meta-atlas-sdk/meta-atlas-sdk.js +148 -124
  98. package/lib/esm/meta-atlas-sdk/meta-atlas-sdk.js.map +1 -1
  99. package/lib/esm/meta-atlas-sdk/utils/helpers.js +4 -2
  100. package/lib/esm/meta-atlas-sdk/utils/helpers.js.map +1 -1
  101. package/lib/esm/meta-atlas-sdk/utils/local-storage.js +6 -1
  102. package/lib/esm/meta-atlas-sdk/utils/local-storage.js.map +1 -1
  103. package/lib/esm/meta-atlas-sdk/utils/routing-visualizer/index.js +115 -109
  104. package/lib/esm/meta-atlas-sdk/utils/routing-visualizer/index.js.map +1 -1
  105. package/lib/esm/react/MetaAtlasMap.js +120 -0
  106. package/lib/esm/react/MetaAtlasMap.js.map +1 -0
  107. package/lib/esm/react/hooks/useDrawing/index.js +2 -2
  108. package/lib/esm/react/hooks/useDrawing/index.js.map +1 -1
  109. package/lib/esm/react/hooks/useFocus/index.js +4 -3
  110. package/lib/esm/react/hooks/useFocus/index.js.map +1 -1
  111. package/lib/esm/react/hooks/useMapEvents/index.js +9 -6
  112. package/lib/esm/react/hooks/useMapEvents/index.js.map +1 -1
  113. package/lib/esm/react/hooks/useMapOverlays/index.js +2 -2
  114. package/lib/esm/react/hooks/useMapOverlays/index.js.map +1 -1
  115. package/lib/esm/react/hooks/useMetaAtlas/index.js +162 -60
  116. package/lib/esm/react/hooks/useMetaAtlas/index.js.map +1 -1
  117. package/lib/esm/react/hooks/useMetaAtlas.js +162 -60
  118. package/lib/esm/react/hooks/useMetaAtlas.js.map +1 -1
  119. package/lib/esm/react/hooks/useRouting/index.js +2 -2
  120. package/lib/esm/react/hooks/useRouting/index.js.map +1 -1
  121. package/lib/esm/react/hooks/useSearch/index.js +2 -2
  122. package/lib/esm/react/hooks/useSearch/index.js.map +1 -1
  123. package/lib/esm/react/hooks/useStampRally/index.js +15 -12
  124. package/lib/esm/react/hooks/useStampRally/index.js.map +1 -1
  125. package/lib/esm/react/hooks/useStampRally/utils.js +1 -1
  126. package/lib/esm/react/hooks/useStampRally/utils.js.map +1 -1
  127. package/lib/esm/react/index.js +11 -15
  128. package/lib/esm/react/index.js.map +1 -1
  129. package/lib/esm/react/stores/useMapDataStore.js +17 -21
  130. package/lib/esm/react/stores/useMapDataStore.js.map +1 -1
  131. package/lib/types/meta-atlas-sdk/3DMap/CustomThreeJsWrapper/utility/CameraSync.d.ts +30 -0
  132. package/lib/types/meta-atlas-sdk/3DMap/CustomThreeJsWrapper/utility/CameraSync.d.ts.map +1 -0
  133. package/lib/types/meta-atlas-sdk/3DMap/CustomThreeJsWrapper/utility/CameraUtils.d.ts +5 -0
  134. package/lib/types/meta-atlas-sdk/3DMap/CustomThreeJsWrapper/utility/CameraUtils.d.ts.map +1 -0
  135. package/lib/types/meta-atlas-sdk/3DMap/CustomThreeJsWrapper/utility/constants.d.ts +21 -0
  136. package/lib/types/meta-atlas-sdk/3DMap/CustomThreeJsWrapper/utility/constants.d.ts.map +1 -0
  137. package/lib/types/meta-atlas-sdk/3DMap/CustomThreeJsWrapper/utility/suncalc.d.ts +27 -0
  138. package/lib/types/meta-atlas-sdk/3DMap/CustomThreeJsWrapper/utility/suncalc.d.ts.map +1 -0
  139. package/lib/types/meta-atlas-sdk/mapbox_draw_custom_modes/draw_marker.d.ts +18 -0
  140. package/lib/types/meta-atlas-sdk/mapbox_draw_custom_modes/draw_marker.d.ts.map +1 -0
  141. package/lib/types/meta-atlas-sdk/mapbox_draw_custom_modes/marker_select.d.ts +37 -0
  142. package/lib/types/meta-atlas-sdk/mapbox_draw_custom_modes/marker_select.d.ts.map +1 -0
  143. package/package.json +10 -7
@@ -1,3 +1,8 @@
1
+ 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; }
2
+ 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; }
3
+ 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; }
4
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
5
+ 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); }
1
6
  // const maplibregl = require('maplibre-gl');
2
7
  import * as maplibregl from 'maplibre-gl';
3
8
  import $ from "jquery";
@@ -8,16 +13,16 @@ import length from '@turf/length';
8
13
  import area from '@turf/area';
9
14
  import cloneDeep from 'lodash/cloneDeep';
10
15
  import MapboxDraw from '@mapbox/mapbox-gl-draw';
11
- import { customStyles, mapBoxDrawDefaultStyles } from './customStyles';
12
- import DrawMarker from './mapbox_draw_custom_modes/draw_marker';
13
- import MarkerSelect from './mapbox_draw_custom_modes/marker_select';
14
- import { MetaAtlasCore } from './MetaAtlasCore/meta-atlas-sdk-core';
15
- import MainMap from './3DMap/MainMap';
16
+ import { customStyles, mapBoxDrawDefaultStyles } from "./customStyles.js";
17
+ import DrawMarker from "./mapbox_draw_custom_modes/draw_marker.js";
18
+ import MarkerSelect from "./mapbox_draw_custom_modes/marker_select.js";
19
+ import { MetaAtlasCore } from "./MetaAtlasCore/meta-atlas-sdk-core.js";
20
+ import MainMap from "./3DMap/MainMap.js";
16
21
  import { initializeApp } from 'firebase/app';
17
22
  import { getAnalytics, logEvent } from "firebase/analytics";
18
- import { RoutingVisualizer } from './utils/routing-visualizer';
19
- import CustomerLayer from './customerLayer';
20
- import CustomerLayerVariant from './customerLayerVariant';
23
+ import { RoutingVisualizer } from "./utils/routing-visualizer/index.js";
24
+ import CustomerLayer from "./customerLayer.js";
25
+ import CustomerLayerVariant from "./customerLayerVariant.js";
21
26
  import booleanPointInPolygon from '@turf/boolean-point-in-polygon';
22
27
  var FilterType = /*#__PURE__*/function (FilterType) {
23
28
  FilterType["Name"] = "title";
@@ -39,30 +44,6 @@ export let EventSource = /*#__PURE__*/function (EventSource) {
39
44
  }({});
40
45
  export const DEFAULT_MAP_STYLE = 'https://api.maptiler.com/maps/01985ac8-56d2-707b-afa8-68abfe8f18be/style.json?key=12H5hrITUbJ1sDrVPqkq';
41
46
  export class MetaAtlasSdk {
42
- onLoadCallback = undefined;
43
- onLoadFailCallback = undefined;
44
- mapLoaded = false;
45
- onFailCallbackSent = false;
46
- UserLayers = [];
47
- defaultFocusedTaxonomy = 'where.gbtb';
48
- currentFocus = this.defaultFocusedTaxonomy;
49
- apiAuthenticationCallbackReceived = false;
50
- routingVisualizer = new RoutingVisualizer(this);
51
- // When token middleware is online that will check the tokens.
52
- tileServer = 'https://atoms-map-tiles-middleware.sandbox.spatialverse.online';
53
- // HOST = 'https://atoms-sdk.qa.cag.spatialverse.online/2.0.0/';
54
- HOST = 'https://atoms-sdk.sandbox.spatialverse.online/';
55
- //empApiURL = 'https://atoms-api.changiairport.com';
56
- empApiURL = 'https://atoms-api.sandbox.spatialverse.online';
57
- // empApiURL = 'https://atoms-api.dev.cag.spatialverse.online';
58
-
59
- mapBoxDrawSourceID = 'drawnDataSource';
60
- drawGeojsonData = {
61
- type: 'FeatureCollection',
62
- features: []
63
- };
64
- popups = [];
65
- markers = [];
66
47
  setupFirebase() {
67
48
  const firebaseConfig = {
68
49
  apiKey: "AIzaSyBDWO2wNkotbgjbkyqVrC_OEAJ3mbvlheI",
@@ -119,7 +100,68 @@ export class MetaAtlasSdk {
119
100
  }
120
101
  });
121
102
  }
122
- constructor(accessToken, secretKey, onLoad = () => {}, onLoadFail = errorMessage => {}, onRoutingStatusUpdate = () => {}, onSearchStatusUpdate = () => {}) {
103
+ constructor(accessToken, secretKey) {
104
+ let onLoad = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : () => {};
105
+ let onLoadFail = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : errorMessage => {};
106
+ let onRoutingStatusUpdate = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : () => {};
107
+ let onSearchStatusUpdate = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : () => {};
108
+ _defineProperty(this, "onLoadCallback", undefined);
109
+ _defineProperty(this, "onLoadFailCallback", undefined);
110
+ _defineProperty(this, "mapLoaded", false);
111
+ _defineProperty(this, "onFailCallbackSent", false);
112
+ _defineProperty(this, "UserLayers", []);
113
+ _defineProperty(this, "defaultFocusedTaxonomy", 'where.gbtb');
114
+ _defineProperty(this, "currentFocus", this.defaultFocusedTaxonomy);
115
+ _defineProperty(this, "apiAuthenticationCallbackReceived", false);
116
+ _defineProperty(this, "routingVisualizer", new RoutingVisualizer(this));
117
+ // When token middleware is online that will check the tokens.
118
+ _defineProperty(this, "tileServer", 'https://atoms-map-tiles-middleware.sandbox.spatialverse.online');
119
+ // HOST = 'https://atoms-sdk.qa.cag.spatialverse.online/2.0.0/';
120
+ _defineProperty(this, "HOST", 'https://atoms-sdk.sandbox.spatialverse.online/');
121
+ //empApiURL = 'https://atoms-api.changiairport.com';
122
+ _defineProperty(this, "empApiURL", 'https://atoms-api.sandbox.spatialverse.online');
123
+ // empApiURL = 'https://atoms-api.dev.cag.spatialverse.online';
124
+ _defineProperty(this, "mapBoxDrawSourceID", 'drawnDataSource');
125
+ _defineProperty(this, "drawGeojsonData", {
126
+ type: 'FeatureCollection',
127
+ features: []
128
+ });
129
+ _defineProperty(this, "popups", []);
130
+ _defineProperty(this, "markers", []);
131
+ _defineProperty(this, "addCustomerLayer", (map, jsonToPass, onLoaded) => {
132
+ let customerLayerUrl = jsonToPass.customerLayerUrl;
133
+ let sourceLayer = jsonToPass.sourceLayer;
134
+ $.getJSON(customerLayerUrl, customerLayers => {
135
+ this.CustomerLayers = customerLayers;
136
+ for (const layer of this.CustomerLayers) {
137
+ layer["source-layer"] = sourceLayer;
138
+ map.addLayer(layer);
139
+ this.map.on('click', layer.id, e => {
140
+ //setup new clicked feature
141
+ const clickedFeature = e.features[0];
142
+ this.overRideSelectionOfDrawnPointGeometry(clickedFeature);
143
+ console.log('clickedFeature: ', clickedFeature);
144
+ this.logAnalyticsEvent('feature_clicked', {
145
+ feature_clicked: clickedFeature.properties.title
146
+ });
147
+ if (clickedFeature.properties.isSearchable && clickedFeature.properties.title != 'Transit' && clickedFeature.properties.title != 'Public') {
148
+ const coords = clickedFeature.geometry.type === "Polygon" ? JSON.parse(clickedFeature.properties.center) : clickedFeature.geometry.coordinates;
149
+ this.metaAtlasCore.setLastClickedFeature({
150
+ mapObjectId: clickedFeature.properties.myMapObjectId,
151
+ coordinates: coords,
152
+ name: clickedFeature.properties.title,
153
+ whatDimension: clickedFeature.properties.dimension_what,
154
+ whereDimension: clickedFeature.properties.dimension_where,
155
+ geometry: clickedFeature.geometry,
156
+ properties: clickedFeature.properties,
157
+ clickEvent: e
158
+ });
159
+ }
160
+ });
161
+ }
162
+ onLoaded();
163
+ });
164
+ });
123
165
  this.accessToken = accessToken;
124
166
  this.secretKey = secretKey;
125
167
  this.onLoadCallback = onLoad;
@@ -229,11 +271,10 @@ export class MetaAtlasSdk {
229
271
  this.mapBoxDraw = new MapboxDraw({
230
272
  displayControlsDefault: false,
231
273
  userProperties: true,
232
- modes: {
233
- ...MapboxDraw.modes,
274
+ modes: _objectSpread(_objectSpread({}, MapboxDraw.modes), {}, {
234
275
  draw_marker: DrawMarker,
235
276
  marker_select: MarkerSelect
236
- },
277
+ }),
237
278
  styles: mapBoxDrawDefaultStyles
238
279
  });
239
280
  this.map.addControl(this.mapBoxDraw);
@@ -264,40 +305,6 @@ export class MetaAtlasSdk {
264
305
  this.mapLoaded = true;
265
306
  this.onLoad();
266
307
  }
267
- addCustomerLayer = (map, jsonToPass, onLoaded) => {
268
- let customerLayerUrl = jsonToPass.customerLayerUrl;
269
- let sourceLayer = jsonToPass.sourceLayer;
270
- $.getJSON(customerLayerUrl, customerLayers => {
271
- this.CustomerLayers = customerLayers;
272
- for (const layer of this.CustomerLayers) {
273
- layer["source-layer"] = sourceLayer;
274
- map.addLayer(layer);
275
- this.map.on('click', layer.id, e => {
276
- //setup new clicked feature
277
- const clickedFeature = e.features[0];
278
- this.overRideSelectionOfDrawnPointGeometry(clickedFeature);
279
- console.log('clickedFeature: ', clickedFeature);
280
- this.logAnalyticsEvent('feature_clicked', {
281
- feature_clicked: clickedFeature.properties.title
282
- });
283
- if (clickedFeature.properties.isSearchable && clickedFeature.properties.title != 'Transit' && clickedFeature.properties.title != 'Public') {
284
- const coords = clickedFeature.geometry.type === "Polygon" ? JSON.parse(clickedFeature.properties.center) : clickedFeature.geometry.coordinates;
285
- this.metaAtlasCore.setLastClickedFeature({
286
- mapObjectId: clickedFeature.properties.myMapObjectId,
287
- coordinates: coords,
288
- name: clickedFeature.properties.title,
289
- whatDimension: clickedFeature.properties.dimension_what,
290
- whereDimension: clickedFeature.properties.dimension_where,
291
- geometry: clickedFeature.geometry,
292
- properties: clickedFeature.properties,
293
- clickEvent: e
294
- });
295
- }
296
- });
297
- }
298
- onLoaded();
299
- });
300
- };
301
308
  overRideSelectionOfDrawnPointGeometry(feature) {
302
309
  // Check if a drawn point geometry is currently selected, it will be consider selected both in highlighted & non-highlighted state.
303
310
  if (this.mapBoxDraw && this.mapBoxDraw.getMode() === 'simple_select' && this.mapBoxDraw.getAll().features.length === 1) {
@@ -318,7 +325,11 @@ export class MetaAtlasSdk {
318
325
  getFocusTree() {
319
326
  return this.metaAtlasCore.getFocusTree();
320
327
  }
321
- setDrawing(id = null, where = null, geom = null, props = null) {
328
+ setDrawing() {
329
+ let id = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
330
+ let where = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
331
+ let geom = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
332
+ let props = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
322
333
  const clickedFeature = {
323
334
  "id": id,
324
335
  "where": where,
@@ -340,7 +351,8 @@ export class MetaAtlasSdk {
340
351
  getMidPointOfFeature(feature) {
341
352
  return this.metaAtlasCore.getMidPointOfFeature(feature);
342
353
  }
343
- dropPin(mapItemSelected, popupStyle, replaceLast = true) {
354
+ dropPin(mapItemSelected, popupStyle) {
355
+ let replaceLast = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
344
356
  const pinObj = {
345
357
  feature: mapItemSelected,
346
358
  popupStyle: popupStyle
@@ -372,8 +384,9 @@ export class MetaAtlasSdk {
372
384
  }
373
385
  dropMarkerForRouting(destinations) {
374
386
  destinations.forEach(destination => {
387
+ var _destination$selected, _destination$selected2;
375
388
  console.log(destination.selectedLocation, 'destination.selectedLocation');
376
- const coordinates = destination.selectedLocation?.coordinates ? destination.selectedLocation.coordinates : destination.selectedLocation?.geometry?.coordinates;
389
+ const coordinates = (_destination$selected = destination.selectedLocation) !== null && _destination$selected !== void 0 && _destination$selected.coordinates ? destination.selectedLocation.coordinates : (_destination$selected2 = destination.selectedLocation) === null || _destination$selected2 === void 0 || (_destination$selected2 = _destination$selected2.geometry) === null || _destination$selected2 === void 0 ? void 0 : _destination$selected2.coordinates;
377
390
  console.log(coordinates, 'Coordinates'); // Debugging line
378
391
 
379
392
  if (coordinates && coordinates.length === 2) {
@@ -399,7 +412,8 @@ export class MetaAtlasSdk {
399
412
  const match = text.match(/^(?:[^_]*_){3}([^_]*)/);
400
413
  return match ? match[1] : null;
401
414
  }
402
- hidePin(pinId = '-1') {
415
+ hidePin() {
416
+ let pinId = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '-1';
403
417
  let targetPinId;
404
418
  if (pinId === '-1') {
405
419
  const lastPin = this.popups[this.popups.length - 1];
@@ -417,9 +431,9 @@ export class MetaAtlasSdk {
417
431
  if (popupElem) {
418
432
  popupElem.style.display = 'none';
419
433
  }
420
- console.log(`Pin with ID: ${targetPinId} is now hidden.`);
434
+ console.log("Pin with ID: ".concat(targetPinId, " is now hidden."));
421
435
  } else {
422
- console.warn(`Pin with ID: ${targetPinId} not found.`);
436
+ console.warn("Pin with ID: ".concat(targetPinId, " not found."));
423
437
  }
424
438
  }
425
439
  hidePins() {
@@ -433,7 +447,8 @@ export class MetaAtlasSdk {
433
447
  });
434
448
  }
435
449
  }
436
- showPin(pinId = '-1') {
450
+ showPin() {
451
+ let pinId = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '-1';
437
452
  let targetPinId;
438
453
  if (pinId === '-1') {
439
454
  const lastPin = this.popups[this.popups.length - 1];
@@ -451,9 +466,9 @@ export class MetaAtlasSdk {
451
466
  if (popupElem) {
452
467
  popupElem.style.display = 'flex';
453
468
  }
454
- console.log(`Pin with ID: ${targetPinId} is now visible.`);
469
+ console.log("Pin with ID: ".concat(targetPinId, " is now visible."));
455
470
  } else {
456
- console.warn(`Pin with ID: ${targetPinId} not found.`);
471
+ console.warn("Pin with ID: ".concat(targetPinId, " not found."));
457
472
  }
458
473
  }
459
474
  showPins() {
@@ -466,7 +481,8 @@ export class MetaAtlasSdk {
466
481
  });
467
482
  }
468
483
  }
469
- clearPin(pinId = '-1') {
484
+ clearPin() {
485
+ let pinId = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '-1';
470
486
  let targetPinIndex;
471
487
  if (pinId === '-1') {
472
488
  targetPinIndex = this.popups.length - 1;
@@ -477,7 +493,7 @@ export class MetaAtlasSdk {
477
493
  } else {
478
494
  targetPinIndex = this.popups.findIndex(pin => pin.id === pinId);
479
495
  if (targetPinIndex === -1) {
480
- console.warn(`Pin with ID: ${pinId} not found.`);
496
+ console.warn("Pin with ID: ".concat(pinId, " not found."));
481
497
  return;
482
498
  }
483
499
  }
@@ -570,7 +586,8 @@ export class MetaAtlasSdk {
570
586
  // const layerFilter = updatedLayersData[index].filter;
571
587
  // }
572
588
  }
573
- focusTo(whereTaxonomyPath, moveCamera = true) {
589
+ focusTo(whereTaxonomyPath) {
590
+ let moveCamera = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
574
591
  const map = this.map;
575
592
  let dimensionWhere = whereTaxonomyPath;
576
593
  if (!dimensionWhere || !map) return;
@@ -606,7 +623,8 @@ export class MetaAtlasSdk {
606
623
  this.map.setFilter(layerID, layerFilter);
607
624
  }
608
625
  }
609
- filterLayersByType(filterType, filterValues, geomType = '') {
626
+ filterLayersByType(filterType, filterValues) {
627
+ let geomType = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
610
628
  const map = this.map;
611
629
  if (!filterValues || !map) return;
612
630
  let userLayers = cloneDeep(this.UserLayers);
@@ -652,7 +670,8 @@ export class MetaAtlasSdk {
652
670
  }
653
671
  }
654
672
  }
655
- changeTerminalInFocusToUserViewpoint(defaultFloor = {}) {
673
+ changeTerminalInFocusToUserViewpoint() {
674
+ let defaultFloor = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
656
675
  let center = this.map.getCenter().wrap();
657
676
  const centerArray = [center.lng, center.lat];
658
677
  // console.log('center: ', center);
@@ -688,55 +707,58 @@ export class MetaAtlasSdk {
688
707
  const isInside = booleanPointInPolygon(point, polygon);
689
708
  return isInside;
690
709
  }
691
- getMapObjectsByFilteredLocalRef(...args) {
692
- return this.metaAtlasCore.getMapObjectsByFilteredLocalRef(...args);
710
+ getMapObjectsByFilteredLocalRef() {
711
+ return this.metaAtlasCore.getMapObjectsByFilteredLocalRef(...arguments);
693
712
  }
694
- getMapObjectsByName(...args) {
695
- return this.metaAtlasCore.getMapObjectsByName(...args);
713
+ getMapObjectsByName() {
714
+ return this.metaAtlasCore.getMapObjectsByName(...arguments);
696
715
  }
697
- getMapObjectById(...args) {
698
- return this.metaAtlasCore.getMapObjectById(...args);
716
+ getMapObjectById() {
717
+ return this.metaAtlasCore.getMapObjectById(...arguments);
699
718
  }
700
- getMapObjectByLocalRef(...args) {
701
- return this.metaAtlasCore.getMapObjectByLocalRef(...args);
719
+ getMapObjectByLocalRef() {
720
+ return this.metaAtlasCore.getMapObjectByLocalRef(...arguments);
702
721
  }
703
- getMapObjectMatchingLocalRef(...args) {
704
- return this.metaAtlasCore.getMapObjectMatchingLocalRef(...args);
722
+ getMapObjectMatchingLocalRef() {
723
+ return this.metaAtlasCore.getMapObjectMatchingLocalRef(...arguments);
705
724
  }
706
- getMapObjectsMatchingLocalRefs(...args) {
707
- return this.metaAtlasCore.getMapObjectsMatchingLocalRefs(...args);
725
+ getMapObjectsMatchingLocalRefs() {
726
+ return this.metaAtlasCore.getMapObjectsMatchingLocalRefs(...arguments);
708
727
  }
709
- getMapObjectsByWhatTaxonomy(...args) {
710
- return this.metaAtlasCore.getMapObjectsByWhatTaxonomy(...args);
728
+ getMapObjectsByWhatTaxonomy() {
729
+ return this.metaAtlasCore.getMapObjectsByWhatTaxonomy(...arguments);
711
730
  }
712
- getMapObjectsByWhatTaxonomyAPI(...args) {
713
- return this.metaAtlasCore.getMapObjectsByWhatTaxonomyAPI(...args);
731
+ getMapObjectsByWhatTaxonomyAPI() {
732
+ return this.metaAtlasCore.getMapObjectsByWhatTaxonomyAPI(...arguments);
714
733
  }
715
- getMapObjectsByWhereTaxonomy(...args) {
716
- return this.metaAtlasCore.getMapObjectsByWhereTaxonomy(...args);
734
+ getMapObjectsByWhereTaxonomy() {
735
+ return this.metaAtlasCore.getMapObjectsByWhereTaxonomy(...arguments);
717
736
  }
718
- getMapObjectsByWhatAndWhereTaxonomy(...args) {
719
- return this.metaAtlasCore.getMapObjectsByWhatAndWhereTaxonomy(...args);
737
+ getMapObjectsByWhatAndWhereTaxonomy() {
738
+ return this.metaAtlasCore.getMapObjectsByWhatAndWhereTaxonomy(...arguments);
720
739
  }
721
- getMapObjectsInWhatTaxonomy(...args) {
722
- return this.metaAtlasCore.getMapObjectsInWhatTaxonomy(...args);
740
+ getMapObjectsInWhatTaxonomy() {
741
+ return this.metaAtlasCore.getMapObjectsInWhatTaxonomy(...arguments);
723
742
  }
724
- getMapObjectsInWhereTaxonomy(...args) {
725
- return this.metaAtlasCore.getMapObjectsInWhereTaxonomy(...args);
743
+ getMapObjectsInWhereTaxonomy() {
744
+ return this.metaAtlasCore.getMapObjectsInWhereTaxonomy(...arguments);
726
745
  }
727
746
 
728
747
  // Routing
729
- computeRoute(...args) {
730
- return this.routingVisualizer.computeRoute(...args);
748
+ computeRoute() {
749
+ return this.routingVisualizer.computeRoute(...arguments);
731
750
  }
732
- computeRoutes(mapObjectIds, wheelChairAccessibleRouteOnly = false, source) {
751
+ computeRoutes(mapObjectIds) {
752
+ let wheelChairAccessibleRouteOnly = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
753
+ let source = arguments.length > 2 ? arguments[2] : undefined;
733
754
  const ref = this;
734
755
  const logRouteEvent = async () => {
735
756
  const getNameByIdAsync = id => {
736
757
  return new Promise(resolve => {
737
758
  if (typeof id !== 'string') resolve('User GPS Location');
738
759
  ref.getMapObjectById(id, mapObj => {
739
- resolve(mapObj[0]?.name);
760
+ var _mapObj$;
761
+ resolve((_mapObj$ = mapObj[0]) === null || _mapObj$ === void 0 ? void 0 : _mapObj$.name);
740
762
  });
741
763
  });
742
764
  };
@@ -759,21 +781,22 @@ export class MetaAtlasSdk {
759
781
  logRouteEvent();
760
782
  return this.routingVisualizer.computeRoutes(mapObjectIds, wheelChairAccessibleRouteOnly);
761
783
  }
762
- setActiveRoute(...args) {
763
- return this.routingVisualizer.setActiveRoute(...args);
784
+ setActiveRoute() {
785
+ return this.routingVisualizer.setActiveRoute(...arguments);
764
786
  }
765
- getActiveRoute(...args) {
766
- return this.routingVisualizer.getActiveRoute(...args);
787
+ getActiveRoute() {
788
+ return this.routingVisualizer.getActiveRoute(...arguments);
767
789
  }
768
- highlightRouteSegment(...args) {
769
- return this.routingVisualizer.highlightRouteSegment(...args);
790
+ highlightRouteSegment() {
791
+ return this.routingVisualizer.highlightRouteSegment(...arguments);
770
792
  }
771
- clearRoute(...args) {
772
- return this.routingVisualizer.clearRoute(...args);
793
+ clearRoute() {
794
+ return this.routingVisualizer.clearRoute(...arguments);
773
795
  }
774
796
 
775
797
  // Drawing
776
- drawGeometryOnMap(type, onDrawEnd, onlyVisibleAtCurrentFocus = false) {
798
+ drawGeometryOnMap(type, onDrawEnd) {
799
+ let onlyVisibleAtCurrentFocus = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
777
800
  //if already in edit mode
778
801
  if (this.mapBoxDraw.getMode() !== 'simple_select') return false;
779
802
  let modeChanged = false;
@@ -913,9 +936,10 @@ export class MetaAtlasSdk {
913
936
  getCoordinates(feature) {
914
937
  return getCoords(feature);
915
938
  }
916
- getLength(feature, options = {
917
- units: 'kilometers'
918
- }) {
939
+ getLength(feature) {
940
+ let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
941
+ units: 'kilometers'
942
+ };
919
943
  if (feature.geometry && feature.geometry.type) {
920
944
  const type = feature.geometry.type;
921
945
  if (type === 'LineString' || type === 'MultiLineString') {