atriusmaps-node-sdk 3.3.1098 → 3.3.1100
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
CHANGED
|
@@ -195,11 +195,13 @@ const buildSegments = (waypoints, fromEndpoint, toEndpoint, floorIdToNameMap, T,
|
|
|
195
195
|
const startWaypoint = R__namespace.last(segment.waypoints);
|
|
196
196
|
const coordinates = segment.coordinates;
|
|
197
197
|
const shouldDrawSegment = !(segment.levelDifference && segment.waypoints.every((waypoint) => waypoint.isPortal));
|
|
198
|
+
const isPortal = startWaypoint.isPortal && segment.type !== "Security Checkpoint";
|
|
198
199
|
const cookedSegment = {
|
|
199
200
|
levelId: startWaypoint.position.structureId,
|
|
200
201
|
ordinalId: `ordinal: ${startWaypoint.position.ordinal}`,
|
|
201
202
|
coordinates,
|
|
202
|
-
shouldDrawSegment
|
|
203
|
+
shouldDrawSegment,
|
|
204
|
+
...isPortal ? { isPortal: true } : {}
|
|
203
205
|
};
|
|
204
206
|
const badges = [];
|
|
205
207
|
if (segmentCategories.WALKING_TO_PORTAL === segment.segmentCategory) {
|
package/dist/package.json.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var a="3.3.
|
|
1
|
+
var a="3.3.1100",e={version:a};export{e as default,a as version};
|
|
@@ -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=>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]]),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&&r&&(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:"AccessibleStairs"===t.type?t.levelDifference>0?t.segmentCategory=o.ACCESSIBLE_STAIRS_UP:t.levelDifference<0?t.segmentCategory=o.ACCESSIBLE_STAIRS_DOWN:t.segmentCategory=o.ACCESSIBLE_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&&t){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){const n=e.head(o.waypoints);if(0===n?.levelDifference){const n=e.last(t[a-1].waypoints);o.waypoints=e.prepend(n,o.waypoints)}}})})(a),a},s=(t,s,i,p,l,y,g,c,C)=>{let m=r(t);m=(e=>e.map(e=>({...e,coordinates:n(e)})))(m),s&&m[0]?.coordinates.unshift([s.lng,s.lat]),i&&e.last(m)?.coordinates.push([i.lng,i.lat]);return{segments:m.map((t,a)=>{const n=e.last(t.waypoints),r=t.coordinates,s=!(t.levelDifference&&t.waypoints.every(e=>e.isPortal)),i={levelId:n.position.structureId,ordinalId:`ordinal: ${n.position.ordinal}`,coordinates:r,shouldDrawSegment:s},
|
|
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=>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]]),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&&r&&(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:"AccessibleStairs"===t.type?t.levelDifference>0?t.segmentCategory=o.ACCESSIBLE_STAIRS_UP:t.levelDifference<0?t.segmentCategory=o.ACCESSIBLE_STAIRS_DOWN:t.segmentCategory=o.ACCESSIBLE_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&&t){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){const n=e.head(o.waypoints);if(0===n?.levelDifference){const n=e.last(t[a-1].waypoints);o.waypoints=e.prepend(n,o.waypoints)}}})})(a),a},s=(t,s,i,p,l,y,g,c,C)=>{let m=r(t);m=(e=>e.map(e=>({...e,coordinates:n(e)})))(m),s&&m[0]?.coordinates.unshift([s.lng,s.lat]),i&&e.last(m)?.coordinates.push([i.lng,i.lat]);return{segments:m.map((t,a)=>{const n=e.last(t.waypoints),r=t.coordinates,s=!(t.levelDifference&&t.waypoints.every(e=>e.isPortal)),i=n.isPortal&&"Security Checkpoint"!==t.type,p={levelId:n.position.structureId,ordinalId:`ordinal: ${n.position.ordinal}`,coordinates:r,shouldDrawSegment:s,...i?{isPortal:!0}:{}},l=[];if(o.WALKING_TO_PORTAL===t.segmentCategory){const t=m[a+1];l.push({canonicalName:`wayfinding.${t.segmentCategory}`,coordinates:e.last(r)})}else o.START!==t.segmentCategory&&l.push({canonicalName:`wayfinding.${t.segmentCategory}`,coordinates:e.last(r)});if(p.badges=l,p.segmentType=(e=>"Train"===e.type?"nav.train":"Bus"===e.type?"nav.transit":"Security Checkpoint"===e.type?"nav.secure":"nav.primary")(t),"Train"===t.type||"Bus"===t.type){const e=e=>({floorId:e.position.floorId,ordinal:e.position.ordinal,structureId:e.position.structureId,...e.poiId?{poiId:e.poiId}:{}});p.transit={entry:e(t.waypoints[0]),exit:e(t.waypoints.at(-1))}}return t.poiId&&(p.poiId=t.poiId),p}),steps:a(m,e.prop("title",s),e.prop("title",i),p,l,y,g,c,C)}};export{s as buildSegments};
|
|
@@ -23,6 +23,8 @@ export type PreviewSegment = {
|
|
|
23
23
|
coordinates: Coordinate[];
|
|
24
24
|
ordinalId: string;
|
|
25
25
|
segmentType: string;
|
|
26
|
+
/** Set when the segment is a portal (elevator, stairs, escalator, train, ...). */
|
|
27
|
+
isPortal?: boolean;
|
|
26
28
|
poiId?: string | number;
|
|
27
29
|
badges?: {
|
|
28
30
|
canonicalName: string;
|
package/package.json
CHANGED