atriusmaps-node-sdk 3.3.584 → 3.3.586
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/dist/cjs/package.json.js +2 -1
- package/dist/cjs/plugins/wayfinder/src/segmentBuilder.js +2 -2
- package/dist/cjs/plugins/wayfinder/src/stepBuilder.js +53 -6
- package/dist/cjs/plugins/wayfinder/src/wayfinder.js +7 -1
- package/dist/cjs/src/utils/distance.js +6 -0
- package/dist/cjs/src/utils/geodesy.js +19 -0
- package/dist/package.json.js +1 -1
- package/dist/plugins/wayfinder/src/segmentBuilder.js +1 -1
- package/dist/plugins/wayfinder/src/stepBuilder.js +1 -1
- package/dist/plugins/wayfinder/src/wayfinder.js +1 -1
- package/dist/src/utils/distance.js +1 -0
- package/dist/src/utils/geodesy.js +1 -1
- package/package.json +1 -1
package/dist/cjs/package.json.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var name = "web-engine";
|
|
6
|
-
var version = "3.3.
|
|
6
|
+
var version = "3.3.586";
|
|
7
7
|
var license = "UNLICENSED";
|
|
8
8
|
var type = "module";
|
|
9
9
|
var main = "src/main.js";
|
|
@@ -70,6 +70,7 @@ var dependencies = {
|
|
|
70
70
|
"@turf/area": "^7.2.0",
|
|
71
71
|
"@turf/bbox-clip": "^7.2.0",
|
|
72
72
|
"@turf/bbox-polygon": "^7.2.0",
|
|
73
|
+
"@turf/bearing": "^7.2.0",
|
|
73
74
|
"@turf/circle": "^7.2.0",
|
|
74
75
|
"@turf/helpers": "^7.2.0",
|
|
75
76
|
"@turf/point-to-line-distance": "^7.2.0",
|
|
@@ -217,7 +217,7 @@ const getSegmentType = (segment) => {
|
|
|
217
217
|
* @param {boolean} requiresAccessibility
|
|
218
218
|
* @return {{steps: Step[], segments: Segment[]}}
|
|
219
219
|
*/
|
|
220
|
-
const buildSegments = (waypoints, fromEndpoint, toEndpoint, floorIdToNameMap, T, queueTypes, requiresAccessibility, securityPois) => {
|
|
220
|
+
const buildSegments = (waypoints, fromEndpoint, toEndpoint, floorIdToNameMap, T, queueTypes, requiresAccessibility, securityPois, currentUnits) => {
|
|
221
221
|
let rawSegments = createSegments(waypoints);
|
|
222
222
|
rawSegments = addCurveLineCoordinates(rawSegments);
|
|
223
223
|
|
|
@@ -259,7 +259,7 @@ const buildSegments = (waypoints, fromEndpoint, toEndpoint, floorIdToNameMap, T,
|
|
|
259
259
|
return cookedSegment
|
|
260
260
|
});
|
|
261
261
|
|
|
262
|
-
const steps = stepBuilder(rawSegments, R__namespace.prop('title', fromEndpoint), R__namespace.prop('title', toEndpoint), floorIdToNameMap, T, queueTypes, requiresAccessibility, securityPois);
|
|
262
|
+
const steps = stepBuilder(rawSegments, R__namespace.prop('title', fromEndpoint), R__namespace.prop('title', toEndpoint), floorIdToNameMap, T, queueTypes, requiresAccessibility, securityPois, currentUnits);
|
|
263
263
|
|
|
264
264
|
return { segments, steps }
|
|
265
265
|
};
|
|
@@ -1,11 +1,34 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var bearing = require('@turf/bearing');
|
|
4
|
+
var helpers = require('@turf/helpers');
|
|
3
5
|
var R = require('ramda');
|
|
4
6
|
var bounds = require('../../../src/utils/bounds.js');
|
|
7
|
+
var distance = require('../../../src/utils/distance.js');
|
|
5
8
|
var geodesy = require('../../../src/utils/geodesy.js');
|
|
6
9
|
var segmentBadges = require('./segmentBadges.js');
|
|
7
10
|
var segmentCategories = require('./segmentCategories.js');
|
|
8
11
|
|
|
12
|
+
/**
|
|
13
|
+
* Calculate the general direction of a segment based on its waypoints.
|
|
14
|
+
* @param {Object} segment - The segment object.
|
|
15
|
+
* @param {Array} segment.waypoints - An array of waypoints.
|
|
16
|
+
* waypoint {
|
|
17
|
+
* position: { lat, lng, floorId, ordinal, structureId },
|
|
18
|
+
* }
|
|
19
|
+
* @returns {string} - The general direction of the segment.
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
const calculateSegmentGeneralDirection = ({ waypoints }) => {
|
|
23
|
+
const [firstWaypoint] = waypoints;
|
|
24
|
+
const lastWaypoint = waypoints[waypoints.length - 1];
|
|
25
|
+
const from = helpers.point([firstWaypoint.position.lng, firstWaypoint.position.lat]);
|
|
26
|
+
const to = helpers.point([lastWaypoint.position.lng, lastWaypoint.position.lat]);
|
|
27
|
+
const bearingDegrees = bearing.bearing(from, to);
|
|
28
|
+
// Convert bearing to general direction
|
|
29
|
+
return geodesy.bearingToDirection(bearingDegrees) // returns cardinal direction 'north', 'northeast' etc as a string
|
|
30
|
+
};
|
|
31
|
+
|
|
9
32
|
/**
|
|
10
33
|
* @typedef Step
|
|
11
34
|
* @property {string} primaryText
|
|
@@ -34,27 +57,31 @@ var segmentCategories = require('./segmentCategories.js');
|
|
|
34
57
|
* @param {boolean} requiresAccessibility
|
|
35
58
|
* @return {Step[]} steps - list of navigation steps
|
|
36
59
|
*/
|
|
37
|
-
function getSteps (segments, startName = '', destinationName = '', floorIdToNameMap, T, queueTypes = {}, requiresAccessibility, securityPois = []) {
|
|
60
|
+
function getSteps (segments, startName = '', destinationName = '', floorIdToNameMap, T, queueTypes = {}, requiresAccessibility, securityPois = [], currentUnits) {
|
|
38
61
|
return segments.map((segment, index) => {
|
|
39
62
|
const securityWaitTimes = findPropWaypoints('securityWaitTimes')(segment.waypoints);
|
|
40
63
|
const eta = (securityWaitTimes && !securityWaitTimes.isTemporarilyClosed) // if there is dynamic wait time and checkpoint is open, then use it
|
|
41
64
|
? securityWaitTimes.queueTime
|
|
42
65
|
: Math.round(calculateSegmentEta(segment.waypoints));
|
|
43
|
-
const distance = Math.round(calculateSegmentDistance(segment.waypoints));
|
|
66
|
+
const distance$1 = Math.round(calculateSegmentDistance(segment.waypoints)); // this is meters
|
|
67
|
+
const currentUnitsDistance = currentUnits === 'yards' ? distance.metersToYards(distance$1) : distance$1;
|
|
44
68
|
const icon = getIcon(segment.segmentCategory);
|
|
45
69
|
const animationAnchor = getAnimationAnchor(segment.segmentCategory, segment.waypoints);
|
|
70
|
+
const direction = calculateSegmentGeneralDirection(segment); // returns string like 'north', 'southwest', etc.
|
|
46
71
|
const primaryText = getPrimaryText(segments, index, startName, destinationName, floorIdToNameMap, T, securityPois, queueTypes);
|
|
47
|
-
const secondaryText = getSecondaryText(segment, eta, T);
|
|
72
|
+
const secondaryText = getSecondaryText(segment, eta, T, false); // this is old but apparently relied on by customers using JS SDK and Mobile SDK
|
|
73
|
+
const secondaryTextUI = getSecondaryText(segment, eta, T, true, direction, currentUnits, currentUnitsDistance); // this is used in Webengine UI
|
|
48
74
|
const bounds$1 = bounds.findBoundsOfWaypoints(segment.waypoints);
|
|
49
75
|
const isAccessible = checkIfAccessible(segment);
|
|
50
76
|
|
|
51
77
|
const step = {
|
|
52
78
|
primaryText,
|
|
53
79
|
secondaryText,
|
|
80
|
+
secondaryTextUI,
|
|
54
81
|
icon,
|
|
55
82
|
animationAnchor,
|
|
56
83
|
eta,
|
|
57
|
-
distance,
|
|
84
|
+
distance: distance$1,
|
|
58
85
|
bounds: bounds$1,
|
|
59
86
|
isAccessible,
|
|
60
87
|
securityWaitTimes
|
|
@@ -205,8 +232,9 @@ function getLevelName (segment, floorIdToNameMap) {
|
|
|
205
232
|
return floorIdToNameMap[R.last(segment.waypoints).position.floorId]
|
|
206
233
|
}
|
|
207
234
|
|
|
208
|
-
function getSecondaryText (segment, minutes, T) {
|
|
235
|
+
function getSecondaryText (segment, minutes, T, ui, direction, currentUnits, currentUnitsDistance) {
|
|
209
236
|
const zeroOrOtherKeys = translateZeroOrOther(minutes, T);
|
|
237
|
+
|
|
210
238
|
const travelVerb = 'Proceed';
|
|
211
239
|
switch (segment.segmentCategory) {
|
|
212
240
|
case segmentCategories.START: return T('wayfinder:Begin route at')
|
|
@@ -222,7 +250,13 @@ function getSecondaryText (segment, minutes, T) {
|
|
|
222
250
|
case segmentCategories.WALK:
|
|
223
251
|
case segmentCategories.WALKING_TO_SECURITY_CHECKPOINT:
|
|
224
252
|
case segmentCategories.WALKING_TO_PORTAL:
|
|
225
|
-
case segmentCategories.WALKING_TO_END:
|
|
253
|
+
case segmentCategories.WALKING_TO_END: {
|
|
254
|
+
if (!ui) {
|
|
255
|
+
return zeroOrOtherKeys(`${travelVerb} <1 minute to`, `${travelVerb} xx minute to`)
|
|
256
|
+
} else {
|
|
257
|
+
return createSecondaryTextWithHeading(currentUnitsDistance, currentUnits, direction, travelVerb, T)
|
|
258
|
+
}
|
|
259
|
+
}
|
|
226
260
|
case segmentCategories.WALK_DOWN: return zeroOrOtherKeys(`${travelVerb} <1 minute down to`, `${travelVerb} xx minute down to`)
|
|
227
261
|
case segmentCategories.WALK_UP: return zeroOrOtherKeys(`${travelVerb} <1 minute up to`, `${travelVerb} xx minute up to`)
|
|
228
262
|
case segmentCategories.TRAIN: return zeroOrOtherKeys('Take train <1 minute', 'Take train xx minute')
|
|
@@ -237,6 +271,19 @@ function getSecondaryText (segment, minutes, T) {
|
|
|
237
271
|
}
|
|
238
272
|
}
|
|
239
273
|
|
|
274
|
+
const createSecondaryTextWithHeading = (currentUnitsDistance, currentUnits, direction, travelVerb, T) => {
|
|
275
|
+
if (currentUnitsDistance > 1) {
|
|
276
|
+
return currentUnits === 'meters'
|
|
277
|
+
? T(`wayfinder:__travelVerb__ __direction__ __count__ meters_plural to`, { direction, travelVerb, count: currentUnitsDistance })
|
|
278
|
+
: T(`wayfinder:__travelVerb__ __direction__ __count__ yards_plural to`, { direction, travelVerb, count: currentUnitsDistance })
|
|
279
|
+
}
|
|
280
|
+
if (currentUnitsDistance <= 1) {
|
|
281
|
+
return currentUnits === 'meters'
|
|
282
|
+
? T(`wayfinder:__travelVerb__ __direction__ __count__ meter to`, { direction, travelVerb, count: currentUnitsDistance })
|
|
283
|
+
: T(`wayfinder:__travelVerb__ __direction__ __count__ yard to`, { direction, travelVerb, count: currentUnitsDistance })
|
|
284
|
+
}
|
|
285
|
+
};
|
|
286
|
+
|
|
240
287
|
const translateZeroOrOther = (count, T) => (zeroKey, otherKey) => count === 0
|
|
241
288
|
? T('wayfinder:' + zeroKey)
|
|
242
289
|
: T('wayfinder:' + otherKey, { count });
|
|
@@ -311,6 +311,9 @@ function create (app, config) {
|
|
|
311
311
|
const securityPois = Object.values(allPois).filter(
|
|
312
312
|
poi => poi.category && poi.category.startsWith('security')
|
|
313
313
|
);
|
|
314
|
+
|
|
315
|
+
const currentUnits = await app.bus.getFirst('directions/getPreferredUnits') || 'meters'; // can be 'meters' or 'yards'
|
|
316
|
+
|
|
314
317
|
return graphLoadedProm
|
|
315
318
|
.then(async graph => {
|
|
316
319
|
options.compareFindPaths = config.compareFindPaths;
|
|
@@ -328,11 +331,14 @@ function create (app, config) {
|
|
|
328
331
|
translate,
|
|
329
332
|
queueTypes,
|
|
330
333
|
isAccessible,
|
|
331
|
-
securityPois
|
|
334
|
+
securityPois,
|
|
335
|
+
currentUnits
|
|
336
|
+
);
|
|
332
337
|
|
|
333
338
|
log.info('route', route);
|
|
334
339
|
const time = Math.round(route.waypoints.reduce((total, { eta }) => total + eta, 0));
|
|
335
340
|
const distance = Math.round(route.waypoints.reduce((total, { distance }) => total + distance, 0));
|
|
341
|
+
|
|
336
342
|
return { ...route, segments, steps, time, distance }
|
|
337
343
|
})
|
|
338
344
|
}
|
|
@@ -34,5 +34,24 @@ function distance (lat1, lng1, lat2, lng2) {
|
|
|
34
34
|
return R * c
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
+
function bearingToDirection (deg) {
|
|
38
|
+
const names = [
|
|
39
|
+
'north', // 0
|
|
40
|
+
'northeast', // 45
|
|
41
|
+
'east', // 90
|
|
42
|
+
'southeast', // 135
|
|
43
|
+
'south', // 180 / -180
|
|
44
|
+
'southwest', // -135
|
|
45
|
+
'west', // -90
|
|
46
|
+
'northwest' // -45
|
|
47
|
+
];
|
|
48
|
+
// normalize -180..180
|
|
49
|
+
const d = ((deg + 180) % 360) - 180;
|
|
50
|
+
|
|
51
|
+
const index = Math.round(d / 45);
|
|
52
|
+
return names[(index + 8) % 8]
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
exports.bearingToDirection = bearingToDirection;
|
|
37
56
|
exports.distance = distance;
|
|
38
57
|
exports.toRadians = toRadians;
|
package/dist/package.json.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var e="web-engine",s="3.3.
|
|
1
|
+
var e="web-engine",s="3.3.586",t="UNLICENSED",o="module",r="src/main.js",l=["demo","deploy","nodesdk","src/extModules/flexapi","services/*","libraries/*"],i={colors:"cat utils/colors1.txt && node utils/processColors.js | pbcopy && cat utils/colors2.txt","cypress:comp":"cypress open --component --browser chrome","cypress:comp:ci":"cypress run --component","playwright:ci":"yarn playwright test --grep-invert sdk","playwright:ui":"yarn playwright test --ui --grep-invert sdk","playwright:sdk":"yarn start-server-and-test 'cd ./deploy && yarn buildDev && yarn serveLocal' 8085 'cd ./test/sdk && npx http-server' 8080 'yarn playwright test sdk --ui'",demo:"cd demo/ && yarn start",dev:"yarn mol e2e",goProd:"cd deploy && scripts/goProd.sh",goStaging:"deploy/scripts/goStaging.sh",lint:"eslint .",mod:"demo/startMod.sh",mol:"demo/startMol.sh","mol:build":"demo/startMolBuild.sh",molProd:"cd deploy && yarn buildAndRunMol",prepare:"husky",test:"jest --no-cache --verbose","test-watch":"jest --verbose --watch","test:vitest":"vitest run"},a=["defaults"],n={react:"^18.3.1"},p={"@azure/event-hubs":"^5.12.2","@csstools/normalize.css":"^11.0.1","@dnd-kit/core":"^6.3.1","@dnd-kit/modifiers":"^9.0.0","@dnd-kit/sortable":"^10.0.0","@dnd-kit/utilities":"^3.2.2","@locus-labs/mod-badge":"^0.1.102","@locus-labs/mod-footer":"^0.0.111","@locus-labs/mod-header":"^0.0.105","@locus-labs/mod-location-marker":"^0.0.104","@locus-labs/mod-map-legend":"^0.0.104","@locus-labs/mod-offscreen-indicator":"^0.0.104","@locus-labs/mod-pin":"^0.0.104","@locus-labs/mod-qr-code-card":"^0.0.104","@locus-labs/mod-qr-code-window":"^0.0.105","@locus-labs/mod-walk-time-matrix":"^0.0.103","@locus-labs/mol-desktop-icon":"^0.1.131","@locus-labs/mol-desktop-tooltip":"^0.3.102","@locus-labs/mol-mobile-box":"^0.1.115","@locus-labs/mol-mobile-icon":"^0.1.118","@locus-labs/mol-mobile-text":"^0.1.116","@mapbox/mapbox-gl-draw":"^1.5.0","@mapbox/mapbox-gl-draw-static-mode":"^1.0.1","@microsoft/applicationinsights-web":"^3.3.6","@turf/area":"^7.2.0","@turf/bbox-clip":"^7.2.0","@turf/bbox-polygon":"^7.2.0","@turf/bearing":"^7.2.0","@turf/circle":"^7.2.0","@turf/helpers":"^7.2.0","@turf/point-to-line-distance":"^7.2.0","@vitejs/plugin-react":"^4.3.4","axe-core":"^4.10.3",browserslist:"^4.27.0","crypto-browserify":"^3.12.1","cypress-multi-reporters":"^2.0.5","cypress-real-events":"^1.14.0","file-loader":"^6.2.0",flexsearch:"^0.7.43","h3-js":"^4.1.0",i18next:"^20.6.1","i18next-browser-languagedetector":"^6.1.1","jest-transform-css":"6.0.2",jsdom:"^25.0.1",jsonschema:"^1.5.0",luxon:"^3.5.0","maplibre-gl":"^4.7.1","mini-css-extract-plugin":"^2.9.2","mocha-junit-reporter":"^2.2.1",mochawesome:"^7.1.3","node-polyfill-webpack-plugin":"^4.1.0","path-browserify":"^1.0.1","prop-types":"^15.8.1",ramda:"^0.30.1",react:"^18.3.1","react-compound-slider":"^3.4.0","react-dom":"^18.3.1","react-json-editor-ajrm":"^2.5.14","react-qr-svg":"^2.4.0","react-svg":"^16.3.0","react-virtualized-auto-sizer":"^1.0.25","react-window":"^1.8.11","smoothscroll-polyfill":"^0.4.4","styled-components":"^6.1.15","styled-normalize":"^8.1.1","throttle-debounce":"^5.0.2",trackjs:"^3.10.4","ua-parser-js":"^0.7.40",uuid:"11.1.0",zousan:"^3.0.1","zousan-plus":"^4.0.1"},c={"@applitools/eyes-playwright":"^1.40.5","@axe-core/playwright":"^4.10.2","@azure/identity":"^4.13.0","@azure/playwright":"^1.0.0","@babel/core":"^7.26.10","@babel/eslint-parser":"^7.26.10","@babel/plugin-proposal-class-properties":"^7.18.6","@babel/plugin-syntax-dynamic-import":"^7.8.3","@babel/plugin-syntax-import-assertions":"^7.26.0","@babel/plugin-transform-modules-commonjs":"^7.26.3","@babel/plugin-transform-runtime":"^7.26.10","@babel/preset-env":"^7.26.9","@babel/preset-react":"^7.26.3","@playwright/test":"^1.56.0","@testing-library/jest-dom":"^6.6.3","@types/react":"^19.0.10","@types/react-dom":"^19.0.4","@typescript-eslint/eslint-plugin":"^8.26.1","@typescript-eslint/parser":"^8.26.1","babel-jest":"^29.7.0","babel-loader":"^10.0.0","babel-plugin-inline-json-import":"^0.3.2","babel-plugin-module-resolver":"^5.0.2","babel-plugin-styled-components":"^2.1.4","chai-colors":"^1.0.1","css-loader":"^7.1.2",cypress:"^14.2.0","cypress-wait-until":"^3.0.2",eslint:"^8.57.1","eslint-config-standard":"^17.1.0","eslint-import-resolver-typescript":"^3.9.1","eslint-plugin-cypress":"^2.15.2","eslint-plugin-import":"^2.31.0","eslint-plugin-jest":"^28.11.0","eslint-plugin-n":"^17.16.2","eslint-plugin-node":"^11.1.0","eslint-plugin-playwright":"^2.2.2","eslint-plugin-promise":"^5.2.0","eslint-plugin-react":"^7.37.4","eslint-plugin-standard":"^5.0.0","fetch-mock-jest":"^1.5.1",glob:"^11.0.1",husky:"^9.1.7",jest:"29.7.0","jest-environment-jsdom":"^29.7.0","lint-staged":"^15.5.0","node-fetch":"^2.7.0","null-loader":"^4.0.1",nx:"19.8.14","nx-remotecache-azure":"^19.0.0","os-browserify":"^0.3.0","start-server-and-test":"^2.0.11",typescript:"^5.8.2",vite:"^4.3.9",vitest:"^2.1.9","webpack-merge":"^6.0.1"},d="yarn@4.7.0",m={node:"22.x"},u={},b={name:e,version:s,private:!0,license:t,type:o,main:r,workspaces:l,scripts:i,"lint-staged":{"*.js":["eslint --fix"]},browserslist:a,resolutions:n,dependencies:p,devDependencies:c,packageManager:d,engines:m,nx:u};export{a as browserslist,b as default,p as dependencies,c as devDependencies,m as engines,t as license,r as main,e as name,u as nx,d as packageManager,n as resolutions,i as scripts,o as type,s as version,l as workspaces};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as e from"ramda";import{bezierCurveTo as t}from"../../../src/utils/geom.js";import o from"./segmentCategories.js";import a from"./stepBuilder.js";const n=e.map(e.converge(e.assoc("coordinates"),[e=>e.waypoints.flatMap(((e,o)=>o>0&&e.curvedPathForward&&e.curvedPathForward.length>0?e.curvedPathForward.flatMap((e=>t(e.start.lng,e.start.lat,e.in.lng,e.in.lat,e.out.lng,e.out.lat,e.end.lng,e.end.lat))).map((e=>[e.x,e.y])):[[e.position.lng,e.position.lat]])),e.identity])),r=t=>{const a=[];let n={segmentCategory:void 0,waypoints:[]},r=null,s=[];return n.waypoints=[t[0]],n.type=t[0].isPortal?t[0].portalType:"Walk",a.push(n),n={segmentCategory:void 0,waypoints:[]},t.forEach((e=>{s.push(e),r?(r.isPortal===e.isPortal&&r.isSecurityCheckpoint===e.isSecurityCheckpoint||(n.waypoints=s,e.isPortal||r.isPortal?(s.length>1&&s.pop(),s=!e.isPortal||"train"!==e.portalType.toLowerCase()&&"bus"!==e.portalType.toLowerCase()?[e]:[s[s.length-1],e]):s=[],r.poiId&&(n.poiId=r.poiId),a.push(n),n={segmentCategory:void 0,waypoints:[]},n.type=e.isPortal?e.portalType:"Walk"),n.levelDifference=e.levelDifference,r=e):(n.type=e.isPortal?e.portalType:"Walk",r=e)})),n.waypoints=s,0===s.length&&(n.waypoints=[r]),a.push(n),(e=>{e.forEach(((t,a)=>{0===a?t.segmentCategory=o.START:t.waypoints[t.waypoints.length-1].isDestination?t.segmentCategory=o.WALKING_TO_END:"Security Checkpoint"===t.type?t.segmentCategory=o.SECURITY_CHECKPOINT:"Bus"===t.type?t.segmentCategory=o.BUS:"Train"===t.type?t.segmentCategory=o.TRAIN:"Stairs"===t.type?t.levelDifference>0?t.segmentCategory=o.STAIRS_UP:t.levelDifference<0?t.segmentCategory=o.STAIRS_DOWN:t.segmentCategory=o.STAIRS:"Elevator"===t.type?t.levelDifference>0?t.segmentCategory=o.ELEVATOR_UP:t.levelDifference<0?t.segmentCategory=o.ELEVATOR_DOWN:t.segmentCategory=o.ELEVATOR:"Escalator"===t.type?t.levelDifference>0?t.segmentCategory=o.ESCALATOR_UP:t.levelDifference<0?t.segmentCategory=o.ESCALATOR_DOWN:t.segmentCategory=o.ESCALATOR:"Ramp"===t.type?t.levelDifference>0?t.segmentCategory=o.RAMP_UP:t.levelDifference<0?t.segmentCategory=o.RAMP_DOWN:t.segmentCategory=o.RAMP:"Security Checkpoint"===e[a+1].type?t.segmentCategory=o.WALKING_TO_SECURITY_CHECKPOINT:"Walk"!==e[a+1].type&&(t.segmentCategory=o.WALKING_TO_PORTAL)}))})(a),((e,t)=>{if(1===e.length){const a={segmentCategory:void 0,waypoints:[]};a.segmentCategory=o.WALKING_TO_END,a.type="Walk",a.waypoints=[t],e.push(a)}})(a,r),(t=>{t.forEach(((o,a)=>{if(a>1&&0===e.head(o.waypoints).levelDifference){const n=e.last(t[a-1].waypoints);o.waypoints=e.prepend(n,o.waypoints)}}))})(a),a},s=(t,s,i,p,l,g,y,c)=>{let
|
|
1
|
+
import*as e from"ramda";import{bezierCurveTo as t}from"../../../src/utils/geom.js";import o from"./segmentCategories.js";import a from"./stepBuilder.js";const n=e.map(e.converge(e.assoc("coordinates"),[e=>e.waypoints.flatMap(((e,o)=>o>0&&e.curvedPathForward&&e.curvedPathForward.length>0?e.curvedPathForward.flatMap((e=>t(e.start.lng,e.start.lat,e.in.lng,e.in.lat,e.out.lng,e.out.lat,e.end.lng,e.end.lat))).map((e=>[e.x,e.y])):[[e.position.lng,e.position.lat]])),e.identity])),r=t=>{const a=[];let n={segmentCategory:void 0,waypoints:[]},r=null,s=[];return n.waypoints=[t[0]],n.type=t[0].isPortal?t[0].portalType:"Walk",a.push(n),n={segmentCategory:void 0,waypoints:[]},t.forEach((e=>{s.push(e),r?(r.isPortal===e.isPortal&&r.isSecurityCheckpoint===e.isSecurityCheckpoint||(n.waypoints=s,e.isPortal||r.isPortal?(s.length>1&&s.pop(),s=!e.isPortal||"train"!==e.portalType.toLowerCase()&&"bus"!==e.portalType.toLowerCase()?[e]:[s[s.length-1],e]):s=[],r.poiId&&(n.poiId=r.poiId),a.push(n),n={segmentCategory:void 0,waypoints:[]},n.type=e.isPortal?e.portalType:"Walk"),n.levelDifference=e.levelDifference,r=e):(n.type=e.isPortal?e.portalType:"Walk",r=e)})),n.waypoints=s,0===s.length&&(n.waypoints=[r]),a.push(n),(e=>{e.forEach(((t,a)=>{0===a?t.segmentCategory=o.START:t.waypoints[t.waypoints.length-1].isDestination?t.segmentCategory=o.WALKING_TO_END:"Security Checkpoint"===t.type?t.segmentCategory=o.SECURITY_CHECKPOINT:"Bus"===t.type?t.segmentCategory=o.BUS:"Train"===t.type?t.segmentCategory=o.TRAIN:"Stairs"===t.type?t.levelDifference>0?t.segmentCategory=o.STAIRS_UP:t.levelDifference<0?t.segmentCategory=o.STAIRS_DOWN:t.segmentCategory=o.STAIRS:"Elevator"===t.type?t.levelDifference>0?t.segmentCategory=o.ELEVATOR_UP:t.levelDifference<0?t.segmentCategory=o.ELEVATOR_DOWN:t.segmentCategory=o.ELEVATOR:"Escalator"===t.type?t.levelDifference>0?t.segmentCategory=o.ESCALATOR_UP:t.levelDifference<0?t.segmentCategory=o.ESCALATOR_DOWN:t.segmentCategory=o.ESCALATOR:"Ramp"===t.type?t.levelDifference>0?t.segmentCategory=o.RAMP_UP:t.levelDifference<0?t.segmentCategory=o.RAMP_DOWN:t.segmentCategory=o.RAMP:"Security Checkpoint"===e[a+1].type?t.segmentCategory=o.WALKING_TO_SECURITY_CHECKPOINT:"Walk"!==e[a+1].type&&(t.segmentCategory=o.WALKING_TO_PORTAL)}))})(a),((e,t)=>{if(1===e.length){const a={segmentCategory:void 0,waypoints:[]};a.segmentCategory=o.WALKING_TO_END,a.type="Walk",a.waypoints=[t],e.push(a)}})(a,r),(t=>{t.forEach(((o,a)=>{if(a>1&&0===e.head(o.waypoints).levelDifference){const n=e.last(t[a-1].waypoints);o.waypoints=e.prepend(n,o.waypoints)}}))})(a),a},s=(t,s,i,p,l,g,y,c,m)=>{let C=r(t);C=n(C),s&&C[0].coordinates.unshift([s.lng,s.lat]),i&&e.last(C).coordinates.push([i.lng,i.lat]);return{segments:C.map(((t,a)=>{const n=e.last(t.waypoints),r=t.coordinates,s=!(t.levelDifference&&t.waypoints.every(e.prop("isPortal"))),i={levelId:n.position.structureId,ordinalId:`ordinal: ${n.position.ordinal}`,coordinates:r,shouldDrawSegment:s},p=[];if(o.WALKING_TO_PORTAL===t.segmentCategory){const t=C[a+1];p.push({canonicalName:`wayfinding.${t.segmentCategory}`,coordinates:e.last(r)})}else o.START!==t.segmentCategory&&p.push({canonicalName:`wayfinding.${t.segmentCategory}`,coordinates:e.last(r)});return i.badges=p,i.segmentType=(e=>"Train"===e.type?"nav.train":"Bus"===e.type?"nav.transit":"Security Checkpoint"===e.type?"nav.secure":"nav.primary")(t),t.poiId&&(i.poiId=t.poiId),i})),steps:a(C,e.prop("title",s),e.prop("title",i),p,l,g,y,c,m)}};export{s as buildSegments};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{compose as
|
|
1
|
+
import{bearing as e}from"@turf/bearing";import{point as t}from"@turf/helpers";import{compose as r,not as n,includes as a,__ as s,toLower as i,prop as o,find as c,drop as u,last as _,propEq as T}from"ramda";import{findBoundsOfWaypoints as A}from"../../../src/utils/bounds.js";import{metersToYards as d}from"../../../src/utils/distance.js";import{bearingToDirection as R,distance as l}from"../../../src/utils/geodesy.js";import O from"./segmentBadges.js";import p from"./segmentCategories.js";function y(r,n="",a="",s,i,c={},u,_=[],T){return r.map(((u,l)=>{const y=I("securityWaitTimes")(u.waypoints),m=y&&!y.isTemporarilyClosed?y.queueTime:Math.round(1===(L=u.waypoints).length?L[0].eta:L.map(o("eta")).slice(1).reduce(((e,t)=>e+t),0));var L;const W=Math.round(function(e){return 1===e.length?e[0].distance:e.map((e=>e.distance)).slice(1).reduce(((e,t)=>e+t),0)}(u.waypoints)),C="yards"===T?d(W):W,U=function(e){switch(e){case p.START:return O.START;case p.WALKING_TO_END:return O.END;case p.ELEVATOR:return O.ELEVATOR;case p.ELEVATOR_UP:return O.ELEVATOR_UP;case p.ELEVATOR_DOWN:return O.ELEVATOR_DOWN;case p.STAIRS:return O.STAIRS;case p.STAIRS_UP:return O.STAIRS_UP;case p.STAIRS_DOWN:return O.STAIRS_DOWN;case p.ESCALATOR:return O.ESCALATOR;case p.ESCALATOR_UP:return O.ESCALATOR_UP;case p.ESCALATOR_DOWN:return O.ESCALATOR_DOWN;case p.WALKING_TO_PORTAL:case p.WALK:case p.WALK_DOWN:case p.WALK_UP:return O.WALK;case p.TRAIN:return O.TRAIN;case p.TRAIN_UP:return O.TRAIN_UP;case p.TRAIN_DOWN:return O.TRAIN_DOWN;case p.BUS:return O.BUS;case p.BUS_UP:return O.BUS_UP;case p.BUS_DOWN:return O.BUS_DOWN;case p.SECURITY_CHECKPOINT:return O.SECURITY_CHECKPOINT;case p.RAMP:return O.RAMP;case p.RAMP_UP:return O.RAMP_UP;case p.RAMP_DOWN:return O.RAMP_DOWN;default:return O.WALK}}(u.segmentCategory),g=function(e,t){let r;switch(e){case p.START:r=0;break;case p.WALKING_TO_END:r=t.length-1;break;case p.WALKING_TO_PORTAL:r=Math.min(t.length-1,Math.ceil(t.length/2));break;default:r=t.length-1}return t[r].position}(u.segmentCategory,u.waypoints),D=(({waypoints:r})=>{const[n]=r,a=r[r.length-1],s=t([n.position.lng,n.position.lat]),i=t([a.position.lng,a.position.lat]),o=e(s,i);return R(o)})(u),K=function(e,t,r,n,a,s,i,o){const c=e[t];switch(c.segmentCategory){case p.START:return S(c.waypoints[0].position,r);case p.WALKING_TO_END:return S(c.waypoints[c.waypoints.length-1].position,n);case p.WALKING_TO_SECURITY_CHECKPOINT:{const r=e[t+1].waypoints,n=w(o,r),a=s("wayfinder:Security Lane"),u=n?`${n} ${a}`:null,_=P(r,i);return u||_||s(`wayfinder:${c.type}`)}case p.WALKING_TO_PORTAL:return s(`wayfinder:${e[t+1].type}`);case p.SECURITY_CHECKPOINT:{const e=w(o,c.waypoints),t=s("wayfinder:Security Lane"),r=e?`${e} ${t}`:null,n=P(c.waypoints,i);return r||n||f(c,a)}case p.ELEVATOR:case p.ELEVATOR_DOWN:case p.ELEVATOR_UP:case p.ESCALATOR:case p.ESCALATOR_DOWN:case p.ESCALATOR_UP:case p.STAIRS:case p.STAIRS_DOWN:case p.STAIRS_UP:return f(c,a);default:return s(`wayfinder:${c.type}`)}}(r,l,n,a,s,i,_,c),h={primaryText:K,secondaryText:E(u,m,i,!1),secondaryTextUI:E(u,m,i,!0,D,T,C),icon:U,animationAnchor:g,eta:m,distance:W,bounds:A(u.waypoints),isAccessible:N(u),securityWaitTimes:y};return u.poiId&&(h.poiId=u.poiId),h}))}function S(e,t){return e.name?e.name:t}function f(e,t){return t[_(e.waypoints).position.floorId]}function E(e,t,r,n,a,s,i){const o=L(t,r),c="Proceed";switch(e.segmentCategory){case p.START:return r("wayfinder:Begin route at");case p.ELEVATOR:return r("wayfinder:Take elevator to");case p.ELEVATOR_UP:return r("wayfinder:Take elevator up to");case p.ELEVATOR_DOWN:return r("wayfinder:Take elevator down to");case p.STAIRS:return r("wayfinder:Take stairs to");case p.STAIRS_UP:return r("wayfinder:Take stairs up to");case p.STAIRS_DOWN:return r("wayfinder:Take stairs down to");case p.ESCALATOR:return r("wayfinder:Take escalator to");case p.ESCALATOR_UP:return r("wayfinder:Take escalator up to");case p.ESCALATOR_DOWN:return r("wayfinder:Take escalator down to");case p.WALK:case p.WALKING_TO_SECURITY_CHECKPOINT:case p.WALKING_TO_PORTAL:case p.WALKING_TO_END:return n?m(i,s,a,c,r):o(`${c} <1 minute to`,`${c} xx minute to`);case p.WALK_DOWN:return o(`${c} <1 minute down to`,`${c} xx minute down to`);case p.WALK_UP:return o(`${c} <1 minute up to`,`${c} xx minute up to`);case p.TRAIN:return o("Take train <1 minute","Take train xx minute");case p.BUS:return o("Take bus <1 minute","Take bus xx minute");case p.SECURITY_CHECKPOINT:return r("wayfinder:Through");case p.RAMP:return r("wayfinder:Take ramp to");case p.RAMP_UP:return r("wayfinder:Take ramp up to");case p.RAMP_DOWN:return r("wayfinder:Take ramp down to");default:return""}}const m=(e,t,r,n,a)=>e>1?a("meters"===t?"wayfinder:__travelVerb__ __direction__ __count__ meters_plural to":"wayfinder:__travelVerb__ __direction__ __count__ yards_plural to",{direction:r,travelVerb:n,count:e}):e<=1?a("meters"===t?"wayfinder:__travelVerb__ __direction__ __count__ meter to":"wayfinder:__travelVerb__ __direction__ __count__ yard to",{direction:r,travelVerb:n,count:e}):void 0,L=(e,t)=>(r,n)=>0===e?t("wayfinder:"+r):t("wayfinder:"+n,{count:e}),N=r(n,a(s,["escalator","stairs"]),i,o("type")),w=(e,t)=>{const r=I("securityLane")(t);if(!r)return;const n=o(r.type,e),a=c(T(r.id,"id"),n);return o("displayText",a)},I=e=>r(o(e),c(o(e)),u(1)),P=(e,t)=>{if(!e||0===e.length)return null;const r=e[0],{lat:n,lng:a,floorId:s}=r.position,i=t.filter((e=>e.position&&e.position.floorId===s));let o=null,c=1/0;return i.forEach((e=>{const t=l(n,a,e.position.latitude,e.position.longitude);t<c&&(c=t,o=e)})),o?o.name:null};export{y as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as t from"ramda";import n from"zousan";import{buildStructuresLookup as o}from"../../../src/utils/buildStructureLookup.js";import{distance as e}from"../../../src/utils/geodesy.js";import{findRoute as i}from"./findRoute.js";import{createNavGraph as r}from"./navGraph.js";import{enrichDebugNavGraph as a}from"./navGraphDebug.js";import{buildSegments as s}from"./segmentBuilder.js";const u={SECURITY:"SecurityLane",IMMIGRATION:"ImmigrationLane"};function d(d,l){const p=d.log.sublog("wayfinder"),c=async()=>{d.bus.send("venueData/loadNavGraph")};let f=new n;d.bus.on("wayfinder/_getNavGraph",(()=>f)),d.bus.on("venueData/navGraphLoaded",(async({navGraphData:t,structures:n})=>{const e=o(n),i=await m(),a=r(t,e.floorIdToOrdinal,e.floorIdToStructureId,i);f.resolve(a)})),d.bus.on("poi/setDynamicRouting",(async({idValuesMap:t})=>{const n=await f,o=Object.values(t).filter((t=>t.position&&void 0!==t.position.floorId&&t.position.latitude&&t.position.longitude)).map((t=>n.findClosestNode(t.position.floorId,t.position.latitude,t.position.longitude).id));n.addNodesToAvoid(o)}));const m=async()=>{const n=await d.bus.get("poi/getByCategoryId",{categoryId:"security"});return t.pipe(t.map(y),t.filter(t.identity))(n)},y=n=>n.queue&&{type:t.path(["queue","queueType"],n),id:t.path(["queue","queueSubtype"],n)};d.bus.on("wayfinder/showNavLineFromPhysicalLocation",(async({toEndpoint:t,selectedSecurityLanes:n=null,requiresAccessibility:o})=>async function(t,n,o){const e=await T({fromEndpoint:t,toEndpoint:n,options:o});if(e){const{segments:t}=e;o.primary&&d.bus.send("map/resetNavlineFeatures"),d.bus.send("map/showNavlineFeatures",{segments:t,category:o.primary?"primary":"alternative"})}return e}(await d.bus.getFirst("user/getPhysicalLocation"),t,{selectedSecurityLanes:n,requiresAccessibility:o,primary:!0})));const g=(t,n)=>d.bus.get("poi/getById",{id:t}).then((o=>{if(o&&o.position)return w(o,n);throw Error("Unknown POI ID "+t)}));const h=["lat","lng","floorId","ordinal"],I=t.pipe(t.pick(h),t.keys,t.propEq(h.length,"length"),Boolean),w=(t,n)=>({lat:t.position.latitude,lng:t.position.longitude,floorId:t.position.floorId,ordinal:n(t.position.floorId),title:t.name});async function T({fromEndpoint:t,toEndpoint:n,options:o={}}){const e=await d.bus.get("poi/getAll")||{},r=Array.isArray(e)?e[0]:e,a=Object.values(r).filter((t=>t.category&&t.category.startsWith("security")));return f.then((async e=>{o.compareFindPaths=l.compareFindPaths;const r=i(e,t,n,o);if(!r)return null;const
|
|
1
|
+
import*as t from"ramda";import n from"zousan";import{buildStructuresLookup as o}from"../../../src/utils/buildStructureLookup.js";import{distance as e}from"../../../src/utils/geodesy.js";import{findRoute as i}from"./findRoute.js";import{createNavGraph as r}from"./navGraph.js";import{enrichDebugNavGraph as a}from"./navGraphDebug.js";import{buildSegments as s}from"./segmentBuilder.js";const u={SECURITY:"SecurityLane",IMMIGRATION:"ImmigrationLane"};function d(d,l){const p=d.log.sublog("wayfinder"),c=async()=>{d.bus.send("venueData/loadNavGraph")};let f=new n;d.bus.on("wayfinder/_getNavGraph",(()=>f)),d.bus.on("venueData/navGraphLoaded",(async({navGraphData:t,structures:n})=>{const e=o(n),i=await m(),a=r(t,e.floorIdToOrdinal,e.floorIdToStructureId,i);f.resolve(a)})),d.bus.on("poi/setDynamicRouting",(async({idValuesMap:t})=>{const n=await f,o=Object.values(t).filter((t=>t.position&&void 0!==t.position.floorId&&t.position.latitude&&t.position.longitude)).map((t=>n.findClosestNode(t.position.floorId,t.position.latitude,t.position.longitude).id));n.addNodesToAvoid(o)}));const m=async()=>{const n=await d.bus.get("poi/getByCategoryId",{categoryId:"security"});return t.pipe(t.map(y),t.filter(t.identity))(n)},y=n=>n.queue&&{type:t.path(["queue","queueType"],n),id:t.path(["queue","queueSubtype"],n)};d.bus.on("wayfinder/showNavLineFromPhysicalLocation",(async({toEndpoint:t,selectedSecurityLanes:n=null,requiresAccessibility:o})=>async function(t,n,o){const e=await T({fromEndpoint:t,toEndpoint:n,options:o});if(e){const{segments:t}=e;o.primary&&d.bus.send("map/resetNavlineFeatures"),d.bus.send("map/showNavlineFeatures",{segments:t,category:o.primary?"primary":"alternative"})}return e}(await d.bus.getFirst("user/getPhysicalLocation"),t,{selectedSecurityLanes:n,requiresAccessibility:o,primary:!0})));const g=(t,n)=>d.bus.get("poi/getById",{id:t}).then((o=>{if(o&&o.position)return w(o,n);throw Error("Unknown POI ID "+t)}));const h=["lat","lng","floorId","ordinal"],I=t.pipe(t.pick(h),t.keys,t.propEq(h.length,"length"),Boolean),w=(t,n)=>({lat:t.position.latitude,lng:t.position.longitude,floorId:t.position.floorId,ordinal:n(t.position.floorId),title:t.name});async function T({fromEndpoint:t,toEndpoint:n,options:o={}}){const e=await d.bus.get("poi/getAll")||{},r=Array.isArray(e)?e[0]:e,a=Object.values(r).filter((t=>t.category&&t.category.startsWith("security"))),u=await d.bus.getFirst("directions/getPreferredUnits")||"meters";return f.then((async e=>{o.compareFindPaths=l.compareFindPaths;const r=i(e,t,n,o);if(!r)return null;const c=await d.bus.get("venueData/getFloorIdToNameMap"),f=await d.bus.get("venueData/getQueueTypes"),m=d.gt(),y=o.requiresAccessibility,{steps:g,segments:h}=s(r.waypoints,t,n,c,m,f,y,a,u);p.info("route",r);const I=Math.round(r.waypoints.reduce(((t,{eta:n})=>t+n),0)),w=Math.round(r.waypoints.reduce(((t,{distance:n})=>t+n),0));return{...r,segments:h,steps:g,time:I,distance:w}}))}function b(n,o,e,i){let r=t.clone(n);return r=E(r,e,i),o&&o.length?{...r,transitTime:v(o,"transitTime"),distance:v(o,"distance")}:(r.distance="start"===i?O(r,e):O(e,r),r.transitTime=S(r.distance),r)}function v(n,o){return t.aperture(2,n).map((([n,o])=>{return(e=o.id,n=>t.find((t=>t.dst===e),n.edges))(n);var e})).map(t.prop(o)).reduce(((t,n)=>t+n),0)}function E(t,n,o){return{...t,[o+"Information"]:{lat:n?.lat||n?.position?.latitude,lng:n?.lng||n?.position?.longitude,floorId:n?.floorId||n?.position?.floorId}}}function O(t,n){return e(n?.lat||n?.position?.latitude,n?.lng||n?.position?.longitude,t?.lat||t?.position?.latitude,t?.lng||t?.position?.longitude)}function S(t){return t/60}function L(n){const o=n.filter((t=>null!==t));return t.sortBy(t.propOr(1/0,"transitTime"),o)}function N(t,n){return t&&t.length?v(t,"transitTime"):S(n)}function P(t,n,o){return t&&t.length?v(t,"distance"):O(o,n)}return d.bus.on("wayfinder/getNavigationEndpoint",(({ep:t})=>async function(t){return f.then((n=>{if(!t)throw Error("wayfinder: Invalid endpoint definition",t);if("number"==typeof t)return g(t,n.floorIdToOrdinal);if("string"==typeof t){if(t.match(/^\d+$/))return g(parseInt(t),n.floorIdToOrdinal);if(t.indexOf(",")>0){let[o,e,i,r]=t.split(",");if(!n.floorIdToStructureId(i))throw Error("Unknown floorId in endpoint: "+i);return r||(r="Starting Point"),{lat:parseFloat(o),lng:parseFloat(e),ordinal:n.floorIdToOrdinal(i),floorId:i,title:r}}}if(I(t))return t;if(t.latitude)return{lat:t.latitude,lng:t.longitude,floorId:t.floorId,ordinal:n.floorIdToOrdinal(t.floorId),title:t.title};if(t.position&&t.name)return w(t,n.floorIdToOrdinal);throw Error("Invalid start or end point: "+t)}))}(t))),d.bus.on("wayfinder/checkIfPathHasSecurity",(({fromEndpoint:n,toEndpoint:o,options:e={}})=>f.then((r=>{e.compareFindPaths=l.compareFindPaths;const a=i(r,n,o,e);if(!a)return{routeExists:!1};const s=n=>Boolean(a.waypoints.find(t.pathEq(n,["securityLane","type"])));return{routeExists:!0,queues:a.waypoints.filter((n=>t.pathEq(u.SECURITY,["securityLane","type"],n)||t.pathEq(u.IMMIGRATION,["securityLane","type"],n))),hasSecurity:s(u.SECURITY),hasImmigration:s(u.IMMIGRATION)}})))),d.bus.on("wayfinder/getRoute",T),d.bus.on("wayfinder/addPathTimeMultiple",(async({pois:n,startLocation:o,options:e={}})=>o?f.then((i=>function(n,o,e,i){try{const r=t.clone(e),a=r.map((t=>w(t,n.floorIdToOrdinal))),s=n.findAllShortestPaths(i,a,o);return L(r.map(((t,n)=>b(t,s[n],i,"start"))))}catch(t){return p.error(t),e}}(i,e,n,o))):n)),d.bus.on("wayfinder/multipointAddPathTimeMultiple",(async({pois:n,startLocation:o,endLocation:e,currentLocation:i,options:r={}})=>o||e||i?f.then((a=>function(n,o,e,i,r,a){try{const s=i?w(i,n.floorIdToOrdinal):a,u=r?w(r,n.floorIdToOrdinal):null,d=t.clone(e),l=d.map((t=>w(t,n.floorIdToOrdinal)));let p,c,f;return s&&(p=n.findAllShortestPaths(s,l,o)),u&&(c=function(t,n,o,e){const i=[];for(const r of n)i.push(t.findShortestPath(r,o,e));return i}(n,l,u,o)),f=s&&u?d.map(((n,o)=>function(n,o,e,i,r){const a=P(o,i,n),s=P(e,n,r);if(!a||!s)return null;const u=N(o,a),d=N(e,s);let l=t.clone(n);return l=E(l,i,"start"),l=E(l,r,"end"),{...l,transitTime:u+d,distance:a+s,startInformation:{...l.startInformation,transitTime:u,distance:a},endInformation:{...l.endInformation,transitTime:d,distance:s}}}(n,p[o],c[o],s,u))):s?d.map(((t,n)=>b(t,p[n],s,"start"))):d.map(((t,n)=>b(t,c[n],u,"end"))),L(f)}catch(t){return p.error(t),e}}(a,r,n,o,e,i))):n)),d.bus.on("venueData/loadNewVenue",(()=>{f=new n,c()})),d.bus.on("poi/setDynamicData",(({plugin:t,idValuesMap:n})=>{"security"===t&&f.then((t=>t.updateWithSecurityWaitTime(n)))})),d.bus.on("wayfinder/getNavGraphFeatures",(()=>f.then((({_nodes:t})=>a(t))))),{init:c,internal:{resolveNavGraph:t=>f.resolve(t),prepareSecurityLanes:m}}}export{u as SecurityLaneType,d as create};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const o=o=>Math.round(1.0936132983377*o);export{o as metersToYards};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const t=t=>t*Math.PI/180;function
|
|
1
|
+
const t=t=>t*Math.PI/180;function s(s,n,h,a){const o=t(s),r=t(h),M=t(h-s),e=t(a-n),u=Math.sin(M/2)*Math.sin(M/2)+Math.cos(o)*Math.cos(r)*Math.sin(e/2)*Math.sin(e/2);return 6371e3*(2*Math.atan2(Math.sqrt(u),Math.sqrt(1-u)))}function n(t){const s=(t+180)%360-180;return["north","northeast","east","southeast","south","southwest","west","northwest"][(Math.round(s/45)+8)%8]}export{n as bearingToDirection,s as distance,t as toRadians};
|
package/package.json
CHANGED