atriusmaps-node-sdk 3.3.1064 → 3.3.1065
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 +1 -1
- package/dist/cjs/plugins/wayfinder/src/navGraphDebug.js +6 -1
- package/dist/package.json.js +1 -1
- package/dist/plugins/wayfinder/src/navGraphDebug.js +1 -1
- package/dist/types/plugins/wayfinder/src/navGraphDebug.d.ts +3 -0
- package/dist/types/plugins/wayfinder/src/types.d.ts +64 -0
- package/dist/types/src/utils/geom.d.ts +47 -0
- package/package.json +1 -1
package/dist/cjs/package.json.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var R = require('ramda');
|
|
4
|
+
var geom = require('../../../src/utils/geom.js');
|
|
4
5
|
|
|
5
6
|
function _interopNamespaceDefault(e) {
|
|
6
7
|
var n = Object.create(null);
|
|
@@ -64,9 +65,13 @@ const toOrphanedNodesArray = R__namespace.pipe(
|
|
|
64
65
|
R__namespace.flatten
|
|
65
66
|
);
|
|
66
67
|
const getNavEdgeFeatures = (nodes) => Object.values(nodes).flatMap((node) => node.edges).map((edge) => mapEdge(edge, nodes));
|
|
67
|
-
const
|
|
68
|
+
const toPathCoordinates = (path) => path && path.length > 0 ? path.flatMap(
|
|
69
|
+
(p) => geom.bezierCurveTo(p.start.lng, p.start.lat, p.in.lng, p.in.lat, p.out.lng, p.out.lat, p.end.lng, p.end.lat)
|
|
70
|
+
).map((el) => [el.x, el.y]) : void 0;
|
|
71
|
+
const mapEdge = ({ src, dst, type, isDriveway, path }, nodeMap) => ({
|
|
68
72
|
startCoordinates: [nodeMap[src].lng, nodeMap[src].lat],
|
|
69
73
|
endCoordinates: [nodeMap[dst].lng, nodeMap[dst].lat],
|
|
74
|
+
pathCoordinates: toPathCoordinates(path),
|
|
70
75
|
isDriveway,
|
|
71
76
|
ordinal: nodeMap[src].ordinal,
|
|
72
77
|
category: getEdgeCategory(type),
|
package/dist/package.json.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var a="3.3.
|
|
1
|
+
var a="3.3.1065",e={version:a};export{e as default,a as version};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as a from"ramda";function
|
|
1
|
+
import*as a from"ramda";import{bezierCurveTo as e}from"../../../src/utils/geom.js";function s(e,s){const t=Object.values(e),n=function(a,e){const s=[e],t=new Set;for(;s.length;){const e=s.splice(0,1)[0];e&&!t.has(e)&&(t.add(e),e.edges.forEach(e=>{t.has(a[e.dst])||s.push(a[e.dst])}))}return t}(e,s||t[0]),o=t.filter(a=>!n.has(a));return console.log(`${o.length} Orphaned nodes found from ${t.length} total`),{orphaned:o,orphanedByFloor:a.groupBy(a=>a.floorId,o),connected:Array.from(n)}}const t=a=>({nodes:o(a),edges:l(a)}),n=e=>a.map(a.pipe(a.assoc("isOrphaned",e),a.dissoc("edges"))),o=a.pipe(s,a.pick(["connected","orphaned"]),a.evolve({connected:n(!1),orphaned:n(!0)}),a.values,a.flatten),l=a=>Object.values(a).flatMap(a=>a.edges).map(e=>d(e,a)),r=a=>a&&a.length>0?a.flatMap(a=>e(a.start.lng,a.start.lat,a.in.lng,a.in.lat,a.out.lng,a.out.lat,a.end.lng,a.end.lat)).map(a=>[a.x,a.y]):void 0,d=({src:a,dst:e,type:s,isDriveway:t,path:n},o)=>({startCoordinates:[o[a].lng,o[a].lat],endCoordinates:[o[e].lng,o[e].lat],pathCoordinates:r(n),isDriveway:t,ordinal:o[a].ordinal,category:c(s),defaultStrokeColor:i(s)}),i=a.cond([[a.equals("Stairs"),a.always("#EFBC9B")],[a.equals("Elevator"),a.always("#A491D3")],[a.equals("Escalator"),a.always("#563F1B")],[a.equals("Ramp"),a.always("#DBD053")],[a.T,a.always("#FF0000")]]),c=a.cond([[a.equals("Train"),a.always("nav.train")],[a.equals("Bus"),a.always("nav.transit")],[a.equals("Security Checkpoint"),a.always("nav.secure")],[a.equals("Ground"),a.always("nav.primary")],[a.T,a.always("")]]);export{t as enrichDebugNavGraph,s as orphanTest};
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import type { BezierPoint } from './types.ts';
|
|
1
2
|
interface NavEdge {
|
|
2
3
|
src: string;
|
|
3
4
|
dst: string;
|
|
4
5
|
type: string;
|
|
5
6
|
isDriveway: boolean;
|
|
7
|
+
path?: BezierPoint[];
|
|
6
8
|
}
|
|
7
9
|
interface NavNode {
|
|
8
10
|
edges: NavEdge[];
|
|
@@ -28,6 +30,7 @@ export declare const enrichDebugNavGraph: (nodes: NodeMap) => {
|
|
|
28
30
|
edges: {
|
|
29
31
|
startCoordinates: number[];
|
|
30
32
|
endCoordinates: number[];
|
|
33
|
+
pathCoordinates: number[][] | undefined;
|
|
31
34
|
isDriveway: boolean;
|
|
32
35
|
ordinal: number;
|
|
33
36
|
category: string;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
export type AnyRecord = Record<string, any>;
|
|
2
|
+
export type NodeId = string | number;
|
|
3
|
+
export type TranslateFn = (...args: any[]) => any;
|
|
4
|
+
export type Endpoint = AnyRecord;
|
|
5
|
+
export type Poi = AnyRecord;
|
|
6
|
+
export type RouteOptions = AnyRecord;
|
|
7
|
+
export type Path = AnyRecord[] | null | undefined;
|
|
8
|
+
export type Coordinate = {
|
|
9
|
+
lat: number;
|
|
10
|
+
lng: number;
|
|
11
|
+
};
|
|
12
|
+
export type CurvePoint = {
|
|
13
|
+
x: number;
|
|
14
|
+
y: number;
|
|
15
|
+
};
|
|
16
|
+
export type BezierPoint = {
|
|
17
|
+
end: Coordinate;
|
|
18
|
+
in: Coordinate;
|
|
19
|
+
out: Coordinate;
|
|
20
|
+
start: Coordinate;
|
|
21
|
+
};
|
|
22
|
+
export type NavEdge = AnyRecord & {
|
|
23
|
+
distance: number;
|
|
24
|
+
dst: NodeId;
|
|
25
|
+
isAccessible?: boolean;
|
|
26
|
+
o?: string;
|
|
27
|
+
path?: BezierPoint[] | null;
|
|
28
|
+
securityLane?: AnyRecord;
|
|
29
|
+
securityWaitTimes?: AnyRecord;
|
|
30
|
+
transitTime: number;
|
|
31
|
+
type: string;
|
|
32
|
+
waitTime: number;
|
|
33
|
+
};
|
|
34
|
+
export type NavNode = AnyRecord & {
|
|
35
|
+
edges: NavEdge[];
|
|
36
|
+
floorId: string;
|
|
37
|
+
id: NodeId;
|
|
38
|
+
lat: number;
|
|
39
|
+
lng: number;
|
|
40
|
+
ordinal: number;
|
|
41
|
+
structureId?: string;
|
|
42
|
+
};
|
|
43
|
+
export type NodesMap = Record<NodeId, NavNode>;
|
|
44
|
+
export type GeoDb = Record<string, NavNode[]>;
|
|
45
|
+
export type SecurityWaitTimes = Record<string, AnyRecord>;
|
|
46
|
+
export type SecurityLanesMap = Record<string, AnyRecord> | AnyRecord[];
|
|
47
|
+
export type Waypoint = AnyRecord & {
|
|
48
|
+
curvedPathForward?: BezierPoint[];
|
|
49
|
+
distance: number;
|
|
50
|
+
eta: number;
|
|
51
|
+
position: Coordinate & {
|
|
52
|
+
floorId: string;
|
|
53
|
+
ordinal: number;
|
|
54
|
+
structureId: string;
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
export type Segment = AnyRecord & {
|
|
58
|
+
waypoints: Waypoint[];
|
|
59
|
+
};
|
|
60
|
+
export type Graph = AnyRecord & {
|
|
61
|
+
findShortestPath: (...args: any[]) => any;
|
|
62
|
+
};
|
|
63
|
+
export type WayfinderApp = AnyRecord;
|
|
64
|
+
export type WayfinderConfig = AnyRecord;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
declare const pointInPolygon: (point: number[], vs: number[][]) => boolean;
|
|
2
|
+
declare const isPointWithinBounds: (lat: number, lng: number, n: number, s: number, e: number, w: number) => boolean;
|
|
3
|
+
/**
|
|
4
|
+
* Pass in a structures array and a lat,lng and ord, and this will return the structure and floor
|
|
5
|
+
* at that point or nulls if no structure exists at that point/ord. This runs very quickly as we very often
|
|
6
|
+
* can skip the slowest path (which runs pointInPolygon). Without preciseFlag we sometimes return
|
|
7
|
+
* a structure when the point falls outside it - but won't return a wrong structure. In some cases this
|
|
8
|
+
* is actually desired behavior anyway (such as structure selector)
|
|
9
|
+
* @param {object} structures the venue data structures
|
|
10
|
+
* @param {float} lat latitude of point to check
|
|
11
|
+
* @param {float} lng longitude of point to check
|
|
12
|
+
* @param {[float]} mapviewBBox the minx,miny,maxx,maxy lat lng values that define the viewable map (not req if preciseFlag === true)
|
|
13
|
+
* @param {boolean} preciseFlag if false, we provide a fuzzy reading, allowing for the map center to be "close enough" to a building/floor
|
|
14
|
+
* @returns {structure: object, floor: object} structure/building and floor that contains the point passed (or {structure:null,floor:null})
|
|
15
|
+
*/
|
|
16
|
+
declare function getStructureAndFloorAtPoint(structures: any[], lat: number, lng: number, ord: number, mapviewBBox: any, preciseFlag?: boolean): any;
|
|
17
|
+
declare function getStructureAndFloorAtPointForCL(structures: any[], lat: number, lng: number, clfloor: number, mapviewBBox: any, preciseFlag?: boolean): any;
|
|
18
|
+
/**
|
|
19
|
+
* given a building and ord, return the floor (or undefined if doesn't exist)
|
|
20
|
+
*/
|
|
21
|
+
declare const ordToFloor: (building: any, ord: number) => unknown;
|
|
22
|
+
/**
|
|
23
|
+
* Return the floor based on its ID (pass in buildings array and floorId)
|
|
24
|
+
*/
|
|
25
|
+
declare const getFloor: (structures: any[], selectedLevelId: string) => any;
|
|
26
|
+
declare const getFloorAt: (structures: any[], lat: number, lng: number, ord: number, mapviewBBox: any, preciseFlag: boolean) => any;
|
|
27
|
+
declare const getFloorAtPrecise: (structures: any[], lat: number, lng: number, ord: number) => any;
|
|
28
|
+
declare const getStructureForFloorId: (structures: any[], floorId: string) => any;
|
|
29
|
+
declare const getFloorForBuildingAndCLFloor: (buildings: any[], building: any, clFloor: number) => any;
|
|
30
|
+
/**
|
|
31
|
+
* Calculate the points for a bezier cubic curve
|
|
32
|
+
*
|
|
33
|
+
* @param {number} fromX - Starting point x
|
|
34
|
+
* @param {number} fromY - Starting point y
|
|
35
|
+
* @param {number} cpX - Control point x
|
|
36
|
+
* @param {number} cpY - Control point y
|
|
37
|
+
* @param {number} cpX2 - Second Control point x
|
|
38
|
+
* @param {number} cpY2 - Second Control point y
|
|
39
|
+
* @param {number} toX - Destination point x
|
|
40
|
+
* @param {number} toY - Destination point y
|
|
41
|
+
* @return {Object[]} Array of points of the curve
|
|
42
|
+
*/
|
|
43
|
+
declare function bezierCurveTo(fromX: number, fromY: number, cpX: number, cpY: number, cpX2: number, cpY2: number, toX: number, toY: number): {
|
|
44
|
+
x: number;
|
|
45
|
+
y: number;
|
|
46
|
+
}[];
|
|
47
|
+
export { bezierCurveTo, getFloor, getFloorAt, getFloorAtPrecise, getFloorForBuildingAndCLFloor, getStructureAndFloorAtPointForCL, getStructureAndFloorAtPoint, getStructureForFloorId, isPointWithinBounds, ordToFloor, pointInPolygon, };
|
package/package.json
CHANGED