@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,10 +1,15 @@
|
|
|
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
|
import { point, lineString } from '@turf/helpers';
|
|
2
7
|
import length from '@turf/length';
|
|
3
8
|
import { booleanDisjoint, booleanPointInPolygon, getCoord, getCoords, lineIntersect, lineSlice } from '@turf/turf';
|
|
4
9
|
import { cloneDeep } from 'lodash';
|
|
5
|
-
import { DISTANCE_UNIT, WALK_SPEED, Zone } from
|
|
6
|
-
import RoutingCore from
|
|
7
|
-
import { getImmigrationPolygonFeaturesForWhereTaxonomy, getEdge } from
|
|
10
|
+
import { DISTANCE_UNIT, WALK_SPEED, Zone } from "./interfaces.js";
|
|
11
|
+
import RoutingCore from "./index.js";
|
|
12
|
+
import { getImmigrationPolygonFeaturesForWhereTaxonomy, getEdge } from "./mapObjectsHelper.js";
|
|
8
13
|
export let ManeuverType = /*#__PURE__*/function (ManeuverType) {
|
|
9
14
|
ManeuverType["RouteOverview"] = "Route Overview";
|
|
10
15
|
ManeuverType["SectionOverview"] = "Section Overview";
|
|
@@ -66,7 +71,8 @@ function updateFeatureHighlightState(features, isHighlighted) {
|
|
|
66
71
|
}
|
|
67
72
|
return features;
|
|
68
73
|
}
|
|
69
|
-
export function highlightRouteSegment(pathFeatures, segmentToHighlight
|
|
74
|
+
export function highlightRouteSegment(pathFeatures, segmentToHighlight) {
|
|
75
|
+
let highlightNodeOnly = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
70
76
|
for (let index = 0; index < pathFeatures.length; index += 1) {
|
|
71
77
|
const segment = pathFeatures[index];
|
|
72
78
|
if (segment.properties.segmentNumber === segmentToHighlight) {
|
|
@@ -83,7 +89,8 @@ export function highlightRouteSegment(pathFeatures, segmentToHighlight, highligh
|
|
|
83
89
|
}
|
|
84
90
|
return pathFeatures;
|
|
85
91
|
}
|
|
86
|
-
function getRouteNode(coordinates, segmentNumber, isHighlighted, patchNumber
|
|
92
|
+
function getRouteNode(coordinates, segmentNumber, isHighlighted, patchNumber) {
|
|
93
|
+
let whereDimension = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : '';
|
|
87
94
|
if (coordinates.length === 0) {
|
|
88
95
|
return [];
|
|
89
96
|
}
|
|
@@ -98,7 +105,8 @@ function getRouteNode(coordinates, segmentNumber, isHighlighted, patchNumber, wh
|
|
|
98
105
|
updateFeatureHighlightState(features, isHighlighted);
|
|
99
106
|
return features;
|
|
100
107
|
}
|
|
101
|
-
function getRouteLine(coordinates, segmentNumber, isHighlighted, patchNumber, zone
|
|
108
|
+
function getRouteLine(coordinates, segmentNumber, isHighlighted, patchNumber, zone) {
|
|
109
|
+
let whereDimension = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : '';
|
|
102
110
|
if (coordinates.length === 0) {
|
|
103
111
|
return [];
|
|
104
112
|
}
|
|
@@ -110,24 +118,22 @@ function getRouteLine(coordinates, segmentNumber, isHighlighted, patchNumber, zo
|
|
|
110
118
|
zone
|
|
111
119
|
};
|
|
112
120
|
// const curved = smooth(coordinates, {iteration: 1});
|
|
113
|
-
const line = lineString(coordinates, {
|
|
114
|
-
...properties,
|
|
121
|
+
const line = lineString(coordinates, _objectSpread(_objectSpread({}, properties), {}, {
|
|
115
122
|
featureBelongsToLineString: true
|
|
116
|
-
});
|
|
117
|
-
const startPoint = point(coordinates[0], {
|
|
118
|
-
...properties,
|
|
123
|
+
}));
|
|
124
|
+
const startPoint = point(coordinates[0], _objectSpread(_objectSpread({}, properties), {}, {
|
|
119
125
|
featureBelongsToLineString: false
|
|
120
|
-
});
|
|
121
|
-
const endPoint = point(coordinates[coordinates.length - 1], {
|
|
122
|
-
...properties,
|
|
126
|
+
}));
|
|
127
|
+
const endPoint = point(coordinates[coordinates.length - 1], _objectSpread(_objectSpread({}, properties), {}, {
|
|
123
128
|
featureBelongsToLineString: false
|
|
124
|
-
});
|
|
129
|
+
}));
|
|
125
130
|
const features = [];
|
|
126
131
|
features.push(startPoint, line, endPoint);
|
|
127
132
|
updateFeatureHighlightState(features, isHighlighted);
|
|
128
133
|
return features;
|
|
129
134
|
}
|
|
130
|
-
export function getLineStringFeaturesOfRouteSegment(routeSegment
|
|
135
|
+
export function getLineStringFeaturesOfRouteSegment(routeSegment) {
|
|
136
|
+
let whereDimension = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
131
137
|
const lineFeatures = [];
|
|
132
138
|
for (let index = 0; index < routeSegment.features.length; index += 1) {
|
|
133
139
|
const feature = routeSegment.features[index];
|
|
@@ -143,7 +149,8 @@ export function getLineStringFeaturesOfRouteSegment(routeSegment, whereDimension
|
|
|
143
149
|
}
|
|
144
150
|
return lineFeatures;
|
|
145
151
|
}
|
|
146
|
-
export function generateOverviewSegment(route
|
|
152
|
+
export function generateOverviewSegment(route) {
|
|
153
|
+
let indexOffset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
147
154
|
const overviewSegment = cloneDeep(route.segments[1]);
|
|
148
155
|
const initialWhereDimension = route.segments.length > 1 ? route.segments[1].startEdge.whereDimension : '';
|
|
149
156
|
overviewSegment.coordinates = [];
|
|
@@ -179,8 +186,9 @@ export function generateOverviewSegment(route, indexOffset = 0) {
|
|
|
179
186
|
overviewSegment.distance = route.walkingDistance + route.transportDistance;
|
|
180
187
|
return overviewSegment;
|
|
181
188
|
}
|
|
182
|
-
export async function createRoute(startMapObjectId, endMapObjectId, wheelChairAccessibleRouteOnly
|
|
183
|
-
|
|
189
|
+
export async function createRoute(startMapObjectId, endMapObjectId, wheelChairAccessibleRouteOnly) {
|
|
190
|
+
let shouldAddOverviewSegment = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
|
|
191
|
+
let indexOffset = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
|
|
184
192
|
const path = RoutingCore.getRoute(startMapObjectId, endMapObjectId, wheelChairAccessibleRouteOnly);
|
|
185
193
|
const pathSegments = path.routes;
|
|
186
194
|
|
|
@@ -198,11 +206,10 @@ export async function createRoute(startMapObjectId, endMapObjectId, wheelChairAc
|
|
|
198
206
|
|
|
199
207
|
// Only add the starting static node for the very first node of route
|
|
200
208
|
if (optimizedPath.length === 0) {
|
|
201
|
-
const firstSegment = {
|
|
202
|
-
...createDefaultSegment(pathSegment),
|
|
209
|
+
const firstSegment = _objectSpread(_objectSpread({}, createDefaultSegment(pathSegment)), {}, {
|
|
203
210
|
maneuverType: ManeuverType.Static,
|
|
204
211
|
coordinates: [path[0]]
|
|
205
|
-
};
|
|
212
|
+
});
|
|
206
213
|
optimizedPath.push(firstSegment);
|
|
207
214
|
}
|
|
208
215
|
if (segmentIndex > 0 && optimizedPath.length > 0) {
|
|
@@ -210,12 +217,11 @@ export async function createRoute(startMapObjectId, endMapObjectId, wheelChairAc
|
|
|
210
217
|
const prevZone = prevPathSegment.geojson.properties.zone;
|
|
211
218
|
if (currentZone !== prevZone) {
|
|
212
219
|
const prevPath = prevPathSegment.geojson.geometry.coordinates;
|
|
213
|
-
const pathPoint = {
|
|
214
|
-
...createDefaultSegment(prevPathSegment),
|
|
220
|
+
const pathPoint = _objectSpread(_objectSpread({}, createDefaultSegment(prevPathSegment)), {}, {
|
|
215
221
|
maneuverType: ManeuverType.ChangeZone,
|
|
216
222
|
zone: currentZone,
|
|
217
223
|
coordinates: [prevPath[prevPath.length - 1]]
|
|
218
|
-
};
|
|
224
|
+
});
|
|
219
225
|
optimizedPath.push(pathPoint);
|
|
220
226
|
lastManeuverType = ManeuverType.ChangeZone;
|
|
221
227
|
}
|
|
@@ -227,12 +233,11 @@ export async function createRoute(startMapObjectId, endMapObjectId, wheelChairAc
|
|
|
227
233
|
const endPoint = path[index + 2];
|
|
228
234
|
|
|
229
235
|
// Keep updating endSegment on each iteration
|
|
230
|
-
endSegment = {
|
|
231
|
-
...createDefaultSegment(pathSegment),
|
|
236
|
+
endSegment = _objectSpread(_objectSpread({}, createDefaultSegment(pathSegment)), {}, {
|
|
232
237
|
maneuverType: ManeuverType.Static,
|
|
233
238
|
coordinates: [endPoint],
|
|
234
239
|
zone: currentZone
|
|
235
|
-
};
|
|
240
|
+
});
|
|
236
241
|
|
|
237
242
|
// const line = lineString([startPoint, midPoint]);
|
|
238
243
|
// const segmentDistance = length(line, { units: DISTANCE_UNIT });
|
|
@@ -273,11 +278,10 @@ export async function createRoute(startMapObjectId, endMapObjectId, wheelChairAc
|
|
|
273
278
|
// }
|
|
274
279
|
// }
|
|
275
280
|
|
|
276
|
-
const pathPoint = {
|
|
277
|
-
...createDefaultSegment(pathSegment),
|
|
281
|
+
const pathPoint = _objectSpread(_objectSpread({}, createDefaultSegment(pathSegment)), {}, {
|
|
278
282
|
maneuverType: currentManeuverType,
|
|
279
283
|
zone: currentZone
|
|
280
|
-
};
|
|
284
|
+
});
|
|
281
285
|
if (lastManeuverType === ManeuverType.ContinueStraight) {
|
|
282
286
|
// If last iteration of loop then use the end point as segment end else use mid point
|
|
283
287
|
// Use index + 3 because last two points are skipped by loop
|
|
@@ -298,24 +302,22 @@ export async function createRoute(startMapObjectId, endMapObjectId, wheelChairAc
|
|
|
298
302
|
if (currentManeuverType === ManeuverType.ContinueStraight) {
|
|
299
303
|
optimizedPath[optimizedPath.length - 1].coordinates.push(endPoint);
|
|
300
304
|
} else {
|
|
301
|
-
optimizedPath.push({
|
|
302
|
-
...createDefaultSegment(pathSegment),
|
|
305
|
+
optimizedPath.push(_objectSpread(_objectSpread({}, createDefaultSegment(pathSegment)), {}, {
|
|
303
306
|
maneuverType: ManeuverType.ContinueStraight,
|
|
304
307
|
coordinates: [midPoint, endPoint],
|
|
305
308
|
zone: currentZone
|
|
306
|
-
});
|
|
309
|
+
}));
|
|
307
310
|
}
|
|
308
311
|
}
|
|
309
312
|
}
|
|
310
313
|
lastManeuverType = currentManeuverType;
|
|
311
314
|
}
|
|
312
315
|
} else {
|
|
313
|
-
const pathPoint = {
|
|
314
|
-
...createDefaultSegment(pathSegment),
|
|
316
|
+
const pathPoint = _objectSpread(_objectSpread({}, createDefaultSegment(pathSegment)), {}, {
|
|
315
317
|
maneuverType: ManeuverType.ContinueStraight,
|
|
316
318
|
coordinates: path,
|
|
317
319
|
zone: currentZone
|
|
318
|
-
};
|
|
320
|
+
});
|
|
319
321
|
optimizedPath.push(pathPoint);
|
|
320
322
|
}
|
|
321
323
|
const removeExtraChangeZoneSegment = () => {
|
|
@@ -345,12 +347,11 @@ export async function createRoute(startMapObjectId, endMapObjectId, wheelChairAc
|
|
|
345
347
|
});
|
|
346
348
|
// Only add if length greater then min limit
|
|
347
349
|
if (lengthOfLineBeforeImmigration >= 10) {
|
|
348
|
-
const segmentBeforeImmigration = {
|
|
349
|
-
...createDefaultSegment(pathSegment),
|
|
350
|
+
const segmentBeforeImmigration = _objectSpread(_objectSpread({}, createDefaultSegment(pathSegment)), {}, {
|
|
350
351
|
maneuverType: ManeuverType.ContinueStraight,
|
|
351
352
|
zone: currentZone,
|
|
352
353
|
coordinates: getCoords(lineBeforeImmigration)
|
|
353
|
-
};
|
|
354
|
+
});
|
|
354
355
|
optimizedPath.push(segmentBeforeImmigration);
|
|
355
356
|
} else if (optimizedPath.length > 0) {
|
|
356
357
|
lastSegmentAdded = optimizedPath[optimizedPath.length - 1];
|
|
@@ -367,12 +368,11 @@ export async function createRoute(startMapObjectId, endMapObjectId, wheelChairAc
|
|
|
367
368
|
}
|
|
368
369
|
}
|
|
369
370
|
const immigrationLine = lineSlice(getCoord(intersects.features[0]), getCoord(intersects.features[1]), line);
|
|
370
|
-
const immigrationSegment = {
|
|
371
|
-
...createDefaultSegment(pathSegment),
|
|
371
|
+
const immigrationSegment = _objectSpread(_objectSpread({}, createDefaultSegment(pathSegment)), {}, {
|
|
372
372
|
maneuverType: ManeuverType.PassThroughImmigration,
|
|
373
373
|
zone: currentZone,
|
|
374
374
|
coordinates: getCoords(immigrationLine)
|
|
375
|
-
};
|
|
375
|
+
});
|
|
376
376
|
// The lineBeforeImmigration might not have been added due to length limit
|
|
377
377
|
// And if lineBeforeImmigration was supposed to be the the first segment then prepend this segment with coordinates of lineBeforeImmigration
|
|
378
378
|
if (optimizedPath.length === 0) {
|
|
@@ -384,12 +384,11 @@ export async function createRoute(startMapObjectId, endMapObjectId, wheelChairAc
|
|
|
384
384
|
optimizedPath.push(immigrationSegment);
|
|
385
385
|
const lineCoords = getCoords(line);
|
|
386
386
|
const lineAfterImmigration = lineSlice(getCoord(intersects.features[1]), lineCoords[lineCoords.length - 1], line);
|
|
387
|
-
const segmentAfterImmigration = {
|
|
388
|
-
...createDefaultSegment(pathSegment),
|
|
387
|
+
const segmentAfterImmigration = _objectSpread(_objectSpread({}, createDefaultSegment(pathSegment)), {}, {
|
|
389
388
|
maneuverType: ManeuverType.ContinueStraight,
|
|
390
389
|
zone: currentZone,
|
|
391
390
|
coordinates: getCoords(lineAfterImmigration)
|
|
392
|
-
};
|
|
391
|
+
});
|
|
393
392
|
optimizedPath.push(segmentAfterImmigration);
|
|
394
393
|
// line = segmentAfterImmigration;
|
|
395
394
|
} else if (intersects.features.length > 0) {
|
|
@@ -401,12 +400,11 @@ export async function createRoute(startMapObjectId, endMapObjectId, wheelChairAc
|
|
|
401
400
|
// One intersection point and start point is within polygon
|
|
402
401
|
// Means line start inside and exits the polygon
|
|
403
402
|
const immigrationLine = lineSlice(getCoords(line)[0], getCoord(intersects.features[0]), line);
|
|
404
|
-
const immigrationSegment = {
|
|
405
|
-
...createDefaultSegment(pathSegment),
|
|
403
|
+
const immigrationSegment = _objectSpread(_objectSpread({}, createDefaultSegment(pathSegment)), {}, {
|
|
406
404
|
maneuverType: ManeuverType.PassThroughImmigration,
|
|
407
405
|
zone: currentZone,
|
|
408
406
|
coordinates: getCoords(immigrationLine)
|
|
409
|
-
};
|
|
407
|
+
});
|
|
410
408
|
lastSegmentAdded = optimizedPath.length > 0 ? optimizedPath[optimizedPath.length - 1] : undefined;
|
|
411
409
|
if (lastSegmentAdded && lastSegmentAdded.maneuverType === ManeuverType.ChangeZone) {
|
|
412
410
|
// Remove change zone segment
|
|
@@ -428,12 +426,11 @@ export async function createRoute(startMapObjectId, endMapObjectId, wheelChairAc
|
|
|
428
426
|
optimizedPath.push(immigrationSegment);
|
|
429
427
|
const lineCoords = getCoords(line);
|
|
430
428
|
const lineAfterImmigration = lineSlice(getCoord(intersects.features[0]), lineCoords[lineCoords.length - 1], line);
|
|
431
|
-
const segmentAfterImmigration = {
|
|
432
|
-
...createDefaultSegment(pathSegment),
|
|
429
|
+
const segmentAfterImmigration = _objectSpread(_objectSpread({}, createDefaultSegment(pathSegment)), {}, {
|
|
433
430
|
maneuverType: ManeuverType.ContinueStraight,
|
|
434
431
|
zone: currentZone,
|
|
435
432
|
coordinates: getCoords(lineAfterImmigration)
|
|
436
|
-
};
|
|
433
|
+
});
|
|
437
434
|
optimizedPath.push(segmentAfterImmigration);
|
|
438
435
|
} else {
|
|
439
436
|
// line starts outside immigration and ends inside immigration
|
|
@@ -443,12 +440,11 @@ export async function createRoute(startMapObjectId, endMapObjectId, wheelChairAc
|
|
|
443
440
|
lastSegmentAdded.coordinates = getCoords(previousLine);
|
|
444
441
|
const lineCoords = getCoords(line);
|
|
445
442
|
const lineAfterImmigration = lineSlice(getCoord(intersects.features[0]), lineCoords[lineCoords.length - 1], line);
|
|
446
|
-
const segmentAfterImmigration = {
|
|
447
|
-
...createDefaultSegment(pathSegment),
|
|
443
|
+
const segmentAfterImmigration = _objectSpread(_objectSpread({}, createDefaultSegment(pathSegment)), {}, {
|
|
448
444
|
maneuverType: ManeuverType.PassThroughImmigration,
|
|
449
445
|
zone: currentZone,
|
|
450
446
|
coordinates: getCoords(lineAfterImmigration)
|
|
451
|
-
};
|
|
447
|
+
});
|
|
452
448
|
optimizedPath.push(segmentAfterImmigration);
|
|
453
449
|
// line = segmentAfterImmigration;
|
|
454
450
|
}
|
|
@@ -458,18 +454,16 @@ export async function createRoute(startMapObjectId, endMapObjectId, wheelChairAc
|
|
|
458
454
|
}
|
|
459
455
|
} else {
|
|
460
456
|
// Keep updating endSegment on each iteration
|
|
461
|
-
endSegment = {
|
|
462
|
-
...createDefaultSegment(pathSegment),
|
|
457
|
+
endSegment = _objectSpread(_objectSpread({}, createDefaultSegment(pathSegment)), {}, {
|
|
463
458
|
maneuverType: ManeuverType.Static,
|
|
464
459
|
coordinates: [pathSegment.geojson.geometry.coordinates[1]],
|
|
465
460
|
zone: currentZone,
|
|
466
461
|
isPortal: false
|
|
467
|
-
};
|
|
468
|
-
const enterPortalSegment = {
|
|
469
|
-
...createDefaultSegment(pathSegment),
|
|
462
|
+
});
|
|
463
|
+
const enterPortalSegment = _objectSpread(_objectSpread({}, createDefaultSegment(pathSegment)), {}, {
|
|
470
464
|
maneuverType: ManeuverType.EnterPortal,
|
|
471
465
|
coordinates: [pathSegment.geojson.geometry.coordinates[0]]
|
|
472
|
-
};
|
|
466
|
+
});
|
|
473
467
|
// // Only add this EnterPortal segment if previously same what dimension portal is not being continued
|
|
474
468
|
// // This is done to ensure Take Lift at A, Exit Lift at B, Take lift at B, Exit Lift at C is generated only as Take lift at A, Exit lift at C
|
|
475
469
|
// let lastSegmentAdded = (optimizedPath.length > 0) ? optimizedPath[optimizedPath.length - 1] : undefined;
|
|
@@ -481,11 +475,10 @@ export async function createRoute(startMapObjectId, endMapObjectId, wheelChairAc
|
|
|
481
475
|
// }
|
|
482
476
|
|
|
483
477
|
optimizedPath.push(enterPortalSegment);
|
|
484
|
-
const exitPortalSegment = {
|
|
485
|
-
...createDefaultSegment(pathSegment),
|
|
478
|
+
const exitPortalSegment = _objectSpread(_objectSpread({}, createDefaultSegment(pathSegment)), {}, {
|
|
486
479
|
maneuverType: ManeuverType.ExitPortal,
|
|
487
480
|
coordinates: [pathSegment.geojson.geometry.coordinates[1]]
|
|
488
|
-
};
|
|
481
|
+
});
|
|
489
482
|
// // This logic is tied to the above similar logic for EnterPortal
|
|
490
483
|
// // Only add this ExitPortal segment if previously same what dimension portal is not being continued
|
|
491
484
|
// // This is done to ensure Take Lift at A, Exit Lift at B, Take lift at B, Exit Lift at C is generated only as Take lift at A, Exit lift at C
|
|
@@ -507,12 +500,11 @@ export async function createRoute(startMapObjectId, endMapObjectId, wheelChairAc
|
|
|
507
500
|
if (lastSegmentAdded && lastSegmentAdded.maneuverType === ManeuverType.ExitPortal) {
|
|
508
501
|
optimizedPath.pop();
|
|
509
502
|
if (pathSegment.portalPath) {
|
|
510
|
-
const travelPortalSegment = {
|
|
511
|
-
...createDefaultSegment(pathSegment),
|
|
503
|
+
const travelPortalSegment = _objectSpread(_objectSpread({}, createDefaultSegment(pathSegment)), {}, {
|
|
512
504
|
maneuverType: ManeuverType.TravelPortal,
|
|
513
505
|
coordinates: pathSegment.portalPath.geometry.coordinates,
|
|
514
506
|
zone: currentZone
|
|
515
|
-
};
|
|
507
|
+
});
|
|
516
508
|
optimizedPath.push(travelPortalSegment);
|
|
517
509
|
}
|
|
518
510
|
optimizedPath.push(exitPortalSegment);
|
|
@@ -655,7 +647,8 @@ export async function createRoute(startMapObjectId, endMapObjectId, wheelChairAc
|
|
|
655
647
|
}
|
|
656
648
|
return route;
|
|
657
649
|
}
|
|
658
|
-
export function getPatch(route
|
|
650
|
+
export function getPatch(route) {
|
|
651
|
+
let patchNumber = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
659
652
|
let routefeatures = [];
|
|
660
653
|
for (let index = 0; index < route.segments.length; index += 1) {
|
|
661
654
|
const routeSegment = route.segments[index];
|
|
@@ -675,8 +668,9 @@ export function getFeaturesForPatch(route, patchNumber, overviewSegmentInfo) {
|
|
|
675
668
|
const nonHighlightedOverviewFeatures = [];
|
|
676
669
|
const highlightedOverviewFeatures = [];
|
|
677
670
|
for (let j = 0; j < routeSegment.features.length; j++) {
|
|
671
|
+
var _feature$properties;
|
|
678
672
|
const feature = routeSegment.features[j];
|
|
679
|
-
if (feature.properties
|
|
673
|
+
if (((_feature$properties = feature.properties) === null || _feature$properties === void 0 ? void 0 : _feature$properties.patchNumber) !== undefined && feature.properties.patchNumber === overviewSegmentInfo.patchNumberForOverviewFeatures) {
|
|
680
674
|
if (feature.properties.isNonHighlightedOverview !== undefined) {
|
|
681
675
|
if (feature.properties.isNonHighlightedOverview === '1') {
|
|
682
676
|
nonHighlightedOverviewFeatures.push(feature);
|
|
@@ -762,7 +756,7 @@ function getTerminalAndLevelName(whereDimension) {
|
|
|
762
756
|
terminalName = 'Level';
|
|
763
757
|
break;
|
|
764
758
|
}
|
|
765
|
-
const terminal = terminalName === 'Terminal' ?
|
|
759
|
+
const terminal = terminalName === 'Terminal' ? "".concat(terminalName, " ").concat(match[1][1]) : "".concat(terminalName);
|
|
766
760
|
const levelIdentifier = match[2][0];
|
|
767
761
|
let levelName;
|
|
768
762
|
switch (levelIdentifier) {
|
|
@@ -776,7 +770,7 @@ function getTerminalAndLevelName(whereDimension) {
|
|
|
776
770
|
levelName = 'Level';
|
|
777
771
|
break;
|
|
778
772
|
}
|
|
779
|
-
const level =
|
|
773
|
+
const level = "".concat(levelName, " ").concat(match[2].substring(1));
|
|
780
774
|
return {
|
|
781
775
|
Terminal: terminal,
|
|
782
776
|
Level: level
|
|
@@ -814,7 +808,7 @@ function convertSecondsToMinutes(timeInSeconds) {
|
|
|
814
808
|
}
|
|
815
809
|
export function formatTime(value) {
|
|
816
810
|
if (value < 60) return '<1 minute';
|
|
817
|
-
return
|
|
811
|
+
return "~".concat(convertSecondsToMinutes(value), " ").concat(convertSecondsToMinutes(value) > 1 ? 'minutes' : 'minute');
|
|
818
812
|
}
|
|
819
813
|
export function generateInstructions(route) {
|
|
820
814
|
const isFirstSegment = index => {
|
|
@@ -844,7 +838,7 @@ export function generateInstructions(route) {
|
|
|
844
838
|
}
|
|
845
839
|
rotueSegment.instructions.push(instruction);
|
|
846
840
|
} else if (rotueSegment.maneuverType === ManeuverType.ContinueStraight || rotueSegment.maneuverType === ManeuverType.PassThroughImmigration) {
|
|
847
|
-
const postfix = rotueSegment.maneuverType === ManeuverType.ContinueStraight ?
|
|
841
|
+
const postfix = rotueSegment.maneuverType === ManeuverType.ContinueStraight ? "Walk for ".concat(Math.ceil(rotueSegment.distance), " ").concat(route.distanceUnit) : getImmigrationInstruction(rotueSegment);
|
|
848
842
|
|
|
849
843
|
// 0th index if overview segment was not included, else 1st index
|
|
850
844
|
// if (index === 0
|
|
@@ -900,15 +894,15 @@ export function generateInstructions(route) {
|
|
|
900
894
|
// }
|
|
901
895
|
} else if (rotueSegment.maneuverType === ManeuverType.Static) {
|
|
902
896
|
if (isFirstSegment(index)) {
|
|
903
|
-
rotueSegment.instructions.push(
|
|
897
|
+
rotueSegment.instructions.push("Start at ".concat(rotueSegment.startEdge.name));
|
|
904
898
|
}
|
|
905
899
|
if (index === route.segments.length - 1) {
|
|
906
|
-
rotueSegment.instructions.push(
|
|
900
|
+
rotueSegment.instructions.push("Arrive at ".concat(rotueSegment.endEdge.name));
|
|
907
901
|
}
|
|
908
902
|
} else if (rotueSegment.maneuverType === ManeuverType.EnterPortal) {
|
|
909
|
-
let instruction =
|
|
903
|
+
let instruction = "Enter ".concat(rotueSegment.startEdge.name, " at ").concat(rotueSegment.startEdge.whereDimension.split('.').slice(-2).join(' ').toUpperCase());
|
|
910
904
|
if (isNonMovingPortalTaxonomy(rotueSegment.startEdge.whatDimension)) {
|
|
911
|
-
instruction =
|
|
905
|
+
instruction = "Continue to ".concat(getWhereDimensionNameForPortal(rotueSegment.startEdge.whatDimension, rotueSegment.endEdge.whereDimension));
|
|
912
906
|
rotueSegment.instructions.push(instruction);
|
|
913
907
|
} else if (isMovingPortalTaxonomy(rotueSegment.startEdge.whatDimension)) {
|
|
914
908
|
const nextRouteSegment = index + 1 <= route.segments.length - 1 ? route.segments[index + 1] : undefined;
|
|
@@ -917,12 +911,12 @@ export function generateInstructions(route) {
|
|
|
917
911
|
rotueSegment.instructions.push(instruction);
|
|
918
912
|
index += 1;
|
|
919
913
|
const name = getPortalName(nextRouteSegment.startEdge.whatDimension);
|
|
920
|
-
instruction =
|
|
914
|
+
instruction = "Take ".concat(name, " to ").concat(getWhereDimensionNameForPortal(rotueSegment.startEdge.whatDimension, rotueSegment.endEdge.whereDimension));
|
|
921
915
|
nextRouteSegment.instructions.push(instruction);
|
|
922
916
|
if (rotueSegment.description) nextRouteSegment.instructions.push(rotueSegment.description);
|
|
923
917
|
} else {
|
|
924
918
|
const name = getPortalName(rotueSegment.startEdge.whatDimension);
|
|
925
|
-
instruction =
|
|
919
|
+
instruction = "Take ".concat(name, " to ").concat(getWhereDimensionNameForPortal(rotueSegment.startEdge.whatDimension, rotueSegment.endEdge.whereDimension));
|
|
926
920
|
rotueSegment.instructions.push(instruction);
|
|
927
921
|
}
|
|
928
922
|
}
|