@twinmatrix/spatialverse-sdk-web 0.0.2 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/index.js +9 -9
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/meta-atlas-sdk/3DMap/CustomThreeJsWrapper/CustomThreeJsWrapper.js +213 -294
- package/lib/cjs/meta-atlas-sdk/3DMap/CustomThreeJsWrapper/CustomThreeJsWrapper.js.map +1 -1
- package/lib/cjs/meta-atlas-sdk/3DMap/CustomThreeJsWrapper/utility/utils.js +40 -41
- package/lib/cjs/meta-atlas-sdk/3DMap/CustomThreeJsWrapper/utility/utils.js.map +1 -1
- package/lib/cjs/meta-atlas-sdk/3DMap/MainMap.js +170 -196
- package/lib/cjs/meta-atlas-sdk/3DMap/MainMap.js.map +1 -1
- package/lib/cjs/meta-atlas-sdk/MetaAtlasCore/fetch-published-json.js +167 -215
- package/lib/cjs/meta-atlas-sdk/MetaAtlasCore/fetch-published-json.js.map +1 -1
- package/lib/cjs/meta-atlas-sdk/MetaAtlasCore/fetchMapObjectsData.js +28 -30
- package/lib/cjs/meta-atlas-sdk/MetaAtlasCore/fetchMapObjectsData.js.map +1 -1
- package/lib/cjs/meta-atlas-sdk/MetaAtlasCore/meta-atlas-sdk-core.js +861 -1170
- package/lib/cjs/meta-atlas-sdk/MetaAtlasCore/meta-atlas-sdk-core.js.map +1 -1
- package/lib/cjs/meta-atlas-sdk/MetaAtlasCore/routing-core/index.js +166 -159
- package/lib/cjs/meta-atlas-sdk/MetaAtlasCore/routing-core/index.js.map +1 -1
- package/lib/cjs/meta-atlas-sdk/MetaAtlasCore/routing-core/interfaces.js +6 -6
- package/lib/cjs/meta-atlas-sdk/MetaAtlasCore/routing-core/interfaces.js.map +1 -1
- package/lib/cjs/meta-atlas-sdk/MetaAtlasCore/routing-core/mapObjectsHelper.js +6 -6
- package/lib/cjs/meta-atlas-sdk/MetaAtlasCore/routing-core/mapObjectsHelper.js.map +1 -1
- package/lib/cjs/meta-atlas-sdk/MetaAtlasCore/routing-core/routeLayers.js +3 -3
- package/lib/cjs/meta-atlas-sdk/MetaAtlasCore/routing-core/routeLayers.js.map +1 -1
- package/lib/cjs/meta-atlas-sdk/MetaAtlasCore/routing-core/routing-helpers.js +523 -610
- package/lib/cjs/meta-atlas-sdk/MetaAtlasCore/routing-core/routing-helpers.js.map +1 -1
- package/lib/cjs/meta-atlas-sdk/MetaAtlasCore/routing-core/utils.js +149 -154
- package/lib/cjs/meta-atlas-sdk/MetaAtlasCore/routing-core/utils.js.map +1 -1
- package/lib/cjs/meta-atlas-sdk/customStyles.js +2 -2
- package/lib/cjs/meta-atlas-sdk/customStyles.js.map +1 -1
- package/lib/cjs/meta-atlas-sdk/customerLayer.js +15 -29
- package/lib/cjs/meta-atlas-sdk/customerLayer.js.map +1 -1
- package/lib/cjs/meta-atlas-sdk/customerLayerVariant.js +5 -5
- package/lib/cjs/meta-atlas-sdk/customerLayerVariant.js.map +1 -1
- package/lib/cjs/meta-atlas-sdk/meta-atlas-sdk.js +809 -1033
- package/lib/cjs/meta-atlas-sdk/meta-atlas-sdk.js.map +1 -1
- package/lib/cjs/meta-atlas-sdk/utils/helpers.js +32 -49
- package/lib/cjs/meta-atlas-sdk/utils/helpers.js.map +1 -1
- package/lib/cjs/meta-atlas-sdk/utils/local-storage.js +21 -34
- package/lib/cjs/meta-atlas-sdk/utils/local-storage.js.map +1 -1
- package/lib/cjs/meta-atlas-sdk/utils/mapobjects-store.js +6 -6
- package/lib/cjs/meta-atlas-sdk/utils/mapobjects-store.js.map +1 -1
- package/lib/cjs/meta-atlas-sdk/utils/routing-store.js +6 -6
- package/lib/cjs/meta-atlas-sdk/utils/routing-store.js.map +1 -1
- package/lib/cjs/meta-atlas-sdk/utils/routing-visualizer/index.js +363 -491
- package/lib/cjs/meta-atlas-sdk/utils/routing-visualizer/index.js.map +1 -1
- package/lib/cjs/react/MetaAtlasMap.js +127 -0
- package/lib/cjs/react/MetaAtlasMap.js.map +1 -0
- package/lib/cjs/react/hooks/useDrawing/index.js +17 -18
- package/lib/cjs/react/hooks/useDrawing/index.js.map +1 -1
- package/lib/cjs/react/hooks/useFocus/index.js +48 -55
- package/lib/cjs/react/hooks/useFocus/index.js.map +1 -1
- package/lib/cjs/react/hooks/useMapEvents/index.js +40 -47
- package/lib/cjs/react/hooks/useMapEvents/index.js.map +1 -1
- package/lib/cjs/react/hooks/useMapOverlays/index.js +20 -21
- package/lib/cjs/react/hooks/useMapOverlays/index.js.map +1 -1
- package/lib/cjs/react/hooks/useMetaAtlas/index.js +77 -95
- package/lib/cjs/react/hooks/useMetaAtlas/index.js.map +1 -1
- package/lib/cjs/react/hooks/useMetaAtlas.js +78 -96
- package/lib/cjs/react/hooks/useMetaAtlas.js.map +1 -1
- package/lib/cjs/react/hooks/useRouting/index.js +21 -20
- package/lib/cjs/react/hooks/useRouting/index.js.map +1 -1
- package/lib/cjs/react/hooks/useSearch/index.js +35 -34
- package/lib/cjs/react/hooks/useSearch/index.js.map +1 -1
- package/lib/cjs/react/hooks/useStampRally/index.js +26 -23
- package/lib/cjs/react/hooks/useStampRally/index.js.map +1 -1
- package/lib/cjs/react/hooks/useStampRally/utils.js +2 -2
- package/lib/cjs/react/hooks/useStampRally/utils.js.map +1 -1
- package/lib/cjs/react/index.js +31 -31
- package/lib/cjs/react/index.js.map +1 -1
- package/lib/cjs/react/stores/useMapDataStore.js +47 -62
- package/lib/cjs/react/stores/useMapDataStore.js.map +1 -1
- package/lib/cjs/react/stores/useMetaAtlasStore.js +27 -40
- package/lib/cjs/react/stores/useMetaAtlasStore.js.map +1 -1
- package/lib/esm/index.js +3 -7
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/meta-atlas-sdk/3DMap/CustomThreeJsWrapper/CustomThreeJsWrapper.js +4 -3
- package/lib/esm/meta-atlas-sdk/3DMap/CustomThreeJsWrapper/CustomThreeJsWrapper.js.map +1 -1
- package/lib/esm/meta-atlas-sdk/3DMap/CustomThreeJsWrapper/utility/utils.js +14 -12
- package/lib/esm/meta-atlas-sdk/3DMap/CustomThreeJsWrapper/utility/utils.js.map +1 -1
- package/lib/esm/meta-atlas-sdk/3DMap/MainMap.js +204 -200
- package/lib/esm/meta-atlas-sdk/3DMap/MainMap.js.map +1 -1
- package/lib/esm/meta-atlas-sdk/MetaAtlasCore/fetch-published-json.js +6 -6
- package/lib/esm/meta-atlas-sdk/MetaAtlasCore/fetch-published-json.js.map +1 -1
- package/lib/esm/meta-atlas-sdk/MetaAtlasCore/fetchMapObjectsData.js +4 -3
- package/lib/esm/meta-atlas-sdk/MetaAtlasCore/fetchMapObjectsData.js.map +1 -1
- package/lib/esm/meta-atlas-sdk/MetaAtlasCore/meta-atlas-sdk-core.js +53 -42
- package/lib/esm/meta-atlas-sdk/MetaAtlasCore/meta-atlas-sdk-core.js.map +1 -1
- package/lib/esm/meta-atlas-sdk/MetaAtlasCore/routing-core/index.js +18 -16
- package/lib/esm/meta-atlas-sdk/MetaAtlasCore/routing-core/index.js.map +1 -1
- package/lib/esm/meta-atlas-sdk/MetaAtlasCore/routing-core/mapObjectsHelper.js +3 -3
- package/lib/esm/meta-atlas-sdk/MetaAtlasCore/routing-core/mapObjectsHelper.js.map +1 -1
- package/lib/esm/meta-atlas-sdk/MetaAtlasCore/routing-core/routing-helpers.js +73 -79
- package/lib/esm/meta-atlas-sdk/MetaAtlasCore/routing-core/routing-helpers.js.map +1 -1
- package/lib/esm/meta-atlas-sdk/MetaAtlasCore/routing-core/utils.js +16 -15
- package/lib/esm/meta-atlas-sdk/MetaAtlasCore/routing-core/utils.js.map +1 -1
- package/lib/esm/meta-atlas-sdk/customerLayer.js +4 -1
- package/lib/esm/meta-atlas-sdk/customerLayer.js.map +1 -1
- package/lib/esm/meta-atlas-sdk/meta-atlas-sdk.js +148 -124
- package/lib/esm/meta-atlas-sdk/meta-atlas-sdk.js.map +1 -1
- package/lib/esm/meta-atlas-sdk/utils/helpers.js +4 -2
- package/lib/esm/meta-atlas-sdk/utils/helpers.js.map +1 -1
- package/lib/esm/meta-atlas-sdk/utils/local-storage.js +6 -1
- package/lib/esm/meta-atlas-sdk/utils/local-storage.js.map +1 -1
- package/lib/esm/meta-atlas-sdk/utils/routing-visualizer/index.js +115 -109
- package/lib/esm/meta-atlas-sdk/utils/routing-visualizer/index.js.map +1 -1
- package/lib/esm/react/MetaAtlasMap.js +120 -0
- package/lib/esm/react/MetaAtlasMap.js.map +1 -0
- package/lib/esm/react/hooks/useDrawing/index.js +2 -2
- package/lib/esm/react/hooks/useDrawing/index.js.map +1 -1
- package/lib/esm/react/hooks/useFocus/index.js +4 -3
- package/lib/esm/react/hooks/useFocus/index.js.map +1 -1
- package/lib/esm/react/hooks/useMapEvents/index.js +9 -6
- package/lib/esm/react/hooks/useMapEvents/index.js.map +1 -1
- package/lib/esm/react/hooks/useMapOverlays/index.js +2 -2
- package/lib/esm/react/hooks/useMapOverlays/index.js.map +1 -1
- package/lib/esm/react/hooks/useMetaAtlas/index.js +162 -60
- package/lib/esm/react/hooks/useMetaAtlas/index.js.map +1 -1
- package/lib/esm/react/hooks/useMetaAtlas.js +162 -60
- package/lib/esm/react/hooks/useMetaAtlas.js.map +1 -1
- package/lib/esm/react/hooks/useRouting/index.js +2 -2
- package/lib/esm/react/hooks/useRouting/index.js.map +1 -1
- package/lib/esm/react/hooks/useSearch/index.js +2 -2
- package/lib/esm/react/hooks/useSearch/index.js.map +1 -1
- package/lib/esm/react/hooks/useStampRally/index.js +15 -12
- package/lib/esm/react/hooks/useStampRally/index.js.map +1 -1
- package/lib/esm/react/hooks/useStampRally/utils.js +1 -1
- package/lib/esm/react/hooks/useStampRally/utils.js.map +1 -1
- package/lib/esm/react/index.js +11 -15
- package/lib/esm/react/index.js.map +1 -1
- package/lib/esm/react/stores/useMapDataStore.js +17 -21
- package/lib/esm/react/stores/useMapDataStore.js.map +1 -1
- package/lib/types/meta-atlas-sdk/3DMap/CustomThreeJsWrapper/utility/CameraSync.d.ts +30 -0
- package/lib/types/meta-atlas-sdk/3DMap/CustomThreeJsWrapper/utility/CameraSync.d.ts.map +1 -0
- package/lib/types/meta-atlas-sdk/3DMap/CustomThreeJsWrapper/utility/CameraUtils.d.ts +5 -0
- package/lib/types/meta-atlas-sdk/3DMap/CustomThreeJsWrapper/utility/CameraUtils.d.ts.map +1 -0
- package/lib/types/meta-atlas-sdk/3DMap/CustomThreeJsWrapper/utility/constants.d.ts +21 -0
- package/lib/types/meta-atlas-sdk/3DMap/CustomThreeJsWrapper/utility/constants.d.ts.map +1 -0
- package/lib/types/meta-atlas-sdk/3DMap/CustomThreeJsWrapper/utility/suncalc.d.ts +27 -0
- package/lib/types/meta-atlas-sdk/3DMap/CustomThreeJsWrapper/utility/suncalc.d.ts.map +1 -0
- package/lib/types/meta-atlas-sdk/mapbox_draw_custom_modes/draw_marker.d.ts +18 -0
- package/lib/types/meta-atlas-sdk/mapbox_draw_custom_modes/draw_marker.d.ts.map +1 -0
- package/lib/types/meta-atlas-sdk/mapbox_draw_custom_modes/marker_select.d.ts +37 -0
- package/lib/types/meta-atlas-sdk/mapbox_draw_custom_modes/marker_select.d.ts.map +1 -0
- package/package.json +10 -7
|
@@ -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
|
|
12
|
-
import DrawMarker from
|
|
13
|
-
import MarkerSelect from
|
|
14
|
-
import { MetaAtlasCore } from
|
|
15
|
-
import MainMap from
|
|
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
|
|
19
|
-
import CustomerLayer from
|
|
20
|
-
import CustomerLayerVariant from
|
|
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
|
|
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(
|
|
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
|
|
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
|
|
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(
|
|
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(
|
|
434
|
+
console.log("Pin with ID: ".concat(targetPinId, " is now hidden."));
|
|
421
435
|
} else {
|
|
422
|
-
console.warn(
|
|
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(
|
|
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(
|
|
469
|
+
console.log("Pin with ID: ".concat(targetPinId, " is now visible."));
|
|
455
470
|
} else {
|
|
456
|
-
console.warn(
|
|
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(
|
|
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(
|
|
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
|
|
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
|
|
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(
|
|
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(
|
|
692
|
-
return this.metaAtlasCore.getMapObjectsByFilteredLocalRef(...
|
|
710
|
+
getMapObjectsByFilteredLocalRef() {
|
|
711
|
+
return this.metaAtlasCore.getMapObjectsByFilteredLocalRef(...arguments);
|
|
693
712
|
}
|
|
694
|
-
getMapObjectsByName(
|
|
695
|
-
return this.metaAtlasCore.getMapObjectsByName(...
|
|
713
|
+
getMapObjectsByName() {
|
|
714
|
+
return this.metaAtlasCore.getMapObjectsByName(...arguments);
|
|
696
715
|
}
|
|
697
|
-
getMapObjectById(
|
|
698
|
-
return this.metaAtlasCore.getMapObjectById(...
|
|
716
|
+
getMapObjectById() {
|
|
717
|
+
return this.metaAtlasCore.getMapObjectById(...arguments);
|
|
699
718
|
}
|
|
700
|
-
getMapObjectByLocalRef(
|
|
701
|
-
return this.metaAtlasCore.getMapObjectByLocalRef(...
|
|
719
|
+
getMapObjectByLocalRef() {
|
|
720
|
+
return this.metaAtlasCore.getMapObjectByLocalRef(...arguments);
|
|
702
721
|
}
|
|
703
|
-
getMapObjectMatchingLocalRef(
|
|
704
|
-
return this.metaAtlasCore.getMapObjectMatchingLocalRef(...
|
|
722
|
+
getMapObjectMatchingLocalRef() {
|
|
723
|
+
return this.metaAtlasCore.getMapObjectMatchingLocalRef(...arguments);
|
|
705
724
|
}
|
|
706
|
-
getMapObjectsMatchingLocalRefs(
|
|
707
|
-
return this.metaAtlasCore.getMapObjectsMatchingLocalRefs(...
|
|
725
|
+
getMapObjectsMatchingLocalRefs() {
|
|
726
|
+
return this.metaAtlasCore.getMapObjectsMatchingLocalRefs(...arguments);
|
|
708
727
|
}
|
|
709
|
-
getMapObjectsByWhatTaxonomy(
|
|
710
|
-
return this.metaAtlasCore.getMapObjectsByWhatTaxonomy(...
|
|
728
|
+
getMapObjectsByWhatTaxonomy() {
|
|
729
|
+
return this.metaAtlasCore.getMapObjectsByWhatTaxonomy(...arguments);
|
|
711
730
|
}
|
|
712
|
-
getMapObjectsByWhatTaxonomyAPI(
|
|
713
|
-
return this.metaAtlasCore.getMapObjectsByWhatTaxonomyAPI(...
|
|
731
|
+
getMapObjectsByWhatTaxonomyAPI() {
|
|
732
|
+
return this.metaAtlasCore.getMapObjectsByWhatTaxonomyAPI(...arguments);
|
|
714
733
|
}
|
|
715
|
-
getMapObjectsByWhereTaxonomy(
|
|
716
|
-
return this.metaAtlasCore.getMapObjectsByWhereTaxonomy(...
|
|
734
|
+
getMapObjectsByWhereTaxonomy() {
|
|
735
|
+
return this.metaAtlasCore.getMapObjectsByWhereTaxonomy(...arguments);
|
|
717
736
|
}
|
|
718
|
-
getMapObjectsByWhatAndWhereTaxonomy(
|
|
719
|
-
return this.metaAtlasCore.getMapObjectsByWhatAndWhereTaxonomy(...
|
|
737
|
+
getMapObjectsByWhatAndWhereTaxonomy() {
|
|
738
|
+
return this.metaAtlasCore.getMapObjectsByWhatAndWhereTaxonomy(...arguments);
|
|
720
739
|
}
|
|
721
|
-
getMapObjectsInWhatTaxonomy(
|
|
722
|
-
return this.metaAtlasCore.getMapObjectsInWhatTaxonomy(...
|
|
740
|
+
getMapObjectsInWhatTaxonomy() {
|
|
741
|
+
return this.metaAtlasCore.getMapObjectsInWhatTaxonomy(...arguments);
|
|
723
742
|
}
|
|
724
|
-
getMapObjectsInWhereTaxonomy(
|
|
725
|
-
return this.metaAtlasCore.getMapObjectsInWhereTaxonomy(...
|
|
743
|
+
getMapObjectsInWhereTaxonomy() {
|
|
744
|
+
return this.metaAtlasCore.getMapObjectsInWhereTaxonomy(...arguments);
|
|
726
745
|
}
|
|
727
746
|
|
|
728
747
|
// Routing
|
|
729
|
-
computeRoute(
|
|
730
|
-
return this.routingVisualizer.computeRoute(...
|
|
748
|
+
computeRoute() {
|
|
749
|
+
return this.routingVisualizer.computeRoute(...arguments);
|
|
731
750
|
}
|
|
732
|
-
computeRoutes(mapObjectIds
|
|
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
|
-
|
|
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(
|
|
763
|
-
return this.routingVisualizer.setActiveRoute(...
|
|
784
|
+
setActiveRoute() {
|
|
785
|
+
return this.routingVisualizer.setActiveRoute(...arguments);
|
|
764
786
|
}
|
|
765
|
-
getActiveRoute(
|
|
766
|
-
return this.routingVisualizer.getActiveRoute(...
|
|
787
|
+
getActiveRoute() {
|
|
788
|
+
return this.routingVisualizer.getActiveRoute(...arguments);
|
|
767
789
|
}
|
|
768
|
-
highlightRouteSegment(
|
|
769
|
-
return this.routingVisualizer.highlightRouteSegment(...
|
|
790
|
+
highlightRouteSegment() {
|
|
791
|
+
return this.routingVisualizer.highlightRouteSegment(...arguments);
|
|
770
792
|
}
|
|
771
|
-
clearRoute(
|
|
772
|
-
return this.routingVisualizer.clearRoute(...
|
|
793
|
+
clearRoute() {
|
|
794
|
+
return this.routingVisualizer.clearRoute(...arguments);
|
|
773
795
|
}
|
|
774
796
|
|
|
775
797
|
// Drawing
|
|
776
|
-
drawGeometryOnMap(type, onDrawEnd
|
|
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
|
|
917
|
-
|
|
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') {
|