@expofp/floorplan 3.0.0-alpha.16 → 3.0.0-alpha.17
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/browser/Debug-CUZihF0D.js +40 -0
- package/dist/browser/{Demo-CXdISYQf.js → Demo-CR3VLKTk.js} +7 -7
- package/dist/browser/{Free-CVgHQ8yt.js → Free-DQNZneql.js} +10 -10
- package/dist/browser/Gallery-DuHTiSqx.js +71 -0
- package/dist/browser/{GpsLoader-BiwFO3QG.js → GpsLoader-DmtF8nSh.js} +46 -46
- package/dist/browser/{KioskStore-NqUeUutQ.js → KioskStore-B7BTukd0.js} +9 -9
- package/dist/browser/{Mapbox-PHCrBnx5.js → Mapbox-3GevGU_j.js} +6 -6
- package/dist/browser/{SetKioskMode-DMQej1ec.js → SetKioskMode-D3066R7_.js} +50 -50
- package/dist/browser/{ShowKiosk-BWlBMcI7.js → ShowKiosk-3jaagNzR.js} +6 -6
- package/dist/browser/{ThreeComponent-Dmt2HPyX.js → ThreeComponent-DNFBzo3g.js} +7 -7
- package/dist/browser/{ViewerMenuPanel-CuqRZ7m1.js → ViewerMenuPanel-BLo85uoZ.js} +14 -14
- package/dist/browser/{boolean-editor-zsvPcNpX.js → boolean-editor-DKH9ubYi.js} +5 -5
- package/dist/browser/bundle.json +30 -30
- package/dist/browser/{client-B2kCMH8A.js → client-meZ2tCS0.js} +4 -4
- package/dist/browser/{data-BtD6blv7.js → data-SQHwxPrN.js} +5 -5
- package/dist/browser/{debug-overlay-CF0imHRX.js → debug-overlay-C4TVlyAN.js} +9 -9
- package/dist/browser/{debug-ui-Zt7T7T-N.js → debug-ui-CVsP8oRC.js} +5 -5
- package/dist/browser/{favicon-Dj8hNa7i.js → favicon-Cimz_lqt.js} +1 -1
- package/dist/browser/{fetch-retry.umd-B-swKpFA.js → fetch-retry.umd-XH7ZZmae.js} +2 -2
- package/dist/browser/{flex-COa6XN1F.js → flex-Bq6tPjvK.js} +5 -5
- package/dist/browser/{floorplan.ready-CNnM_Yyc.js → floorplan.ready-ClV1c-bq.js} +12287 -11918
- package/dist/browser/{index-atMSRNM1.js → index-3PCrVVmD.js} +12 -12
- package/dist/browser/{index-CqICVJZO.js → index-BuXQKG6_.js} +4 -4
- package/dist/browser/{index-CgWDjED_.js → index-C1A1q6hi.js} +6 -6
- package/dist/browser/{index-C04zJbbt.js → index-C3wwaChX.js} +2397 -2374
- package/dist/browser/{index-B1P-x0sk.js → index-CcKlEKDb.js} +5 -5
- package/dist/browser/{index-BeS6l0j-.js → index-CfyxM29w.js} +18 -18
- package/dist/browser/{index-BEcZnTgd.js → index-DkMgYVuZ.js} +3 -3
- package/dist/browser/index.js +4 -4
- package/dist/browser/{jsx-runtime-DAY7g56y.js → jsx-runtime-rSp8ZldI.js} +1 -1
- package/dist/browser/locales/ar.json +48 -4
- package/dist/browser/locales/de.json +48 -4
- package/dist/browser/locales/es.json +48 -4
- package/dist/browser/locales/fr.json +48 -4
- package/dist/browser/locales/he.json +48 -4
- package/dist/browser/locales/it.json +48 -4
- package/dist/browser/locales/kk.json +48 -4
- package/dist/browser/locales/ko.json +48 -4
- package/dist/browser/locales/mn.json +48 -4
- package/dist/browser/locales/nl.json +48 -4
- package/dist/browser/locales/pl.json +49 -5
- package/dist/browser/locales/pt.json +48 -4
- package/dist/browser/locales/ru.json +49 -5
- package/dist/browser/locales/sv.json +48 -4
- package/dist/browser/locales/th.json +48 -4
- package/dist/browser/locales/tr.json +48 -4
- package/dist/browser/locales/uk.json +48 -4
- package/dist/browser/locales/vi.json +48 -4
- package/dist/browser/locales/zh.json +48 -4
- package/dist/browser/{main-DZpmA53N.js → main-C1uhxJ8U.js} +1 -1
- package/dist/browser/{particles.min-DXab_WLN.js → particles.min-DkmJkLkl.js} +2 -2
- package/dist/esm/RouteCutIn.d.ts +0 -1
- package/dist/esm/RouteCutIn.js +1 -1
- package/dist/esm/components/Booth/BoothOnHold.d.ts +2 -2
- package/dist/esm/components/Booth/BoothOnHold.js +1 -1
- package/dist/esm/components/Booth/BoothReserved.d.ts +2 -1
- package/dist/esm/components/Booth/BoothReserved.js +1 -1
- package/dist/esm/components/Booth/BoothWithoutExhibitor.d.ts +2 -2
- package/dist/esm/components/Booth/BoothWithoutExhibitor.js +1 -1
- package/dist/esm/components/Exhibitor.js +1 -1
- package/dist/esm/components/Gallery/GalleryControls/GalleryControls.d.ts +2 -2
- package/dist/esm/components/Gallery/GalleryControls/GalleryControls.js +1 -1
- package/dist/esm/components/Gallery/GalleryModal/GalleryModal.d.ts +2 -2
- package/dist/esm/components/Gallery/GalleryModal/GalleryModal.js +1 -1
- package/dist/esm/components/Language.js +1 -1
- package/dist/esm/components/LanguageRow.d.ts +0 -1
- package/dist/esm/components/LanguageRow.js +1 -1
- package/dist/esm/components/Layout.js +1 -1
- package/dist/esm/components/List.js +1 -1
- package/dist/esm/components/Map/drawing/config/config-markers.js +1 -1
- package/dist/esm/components/Map/drawing/config/config-wf.d.ts +0 -2
- package/dist/esm/components/Map/drawing/config/config-wf.js +1 -1
- package/dist/esm/components/Map/drawing/config/route-snapping/snapPositionToRoute.d.ts +1 -1
- package/dist/esm/components/Map/drawing/config/route-snapping/snapPositionToRoute.js +1 -1
- package/dist/esm/components/Map/drawing/config/route-snapping/splitRouteByPoint.d.ts +1 -1
- package/dist/esm/components/Map/drawing/config/route-snapping/splitRouteByPoint.js +1 -1
- package/dist/esm/components/Map/drawing/config/route-snapping/types.d.ts +1 -1
- package/dist/esm/components/Map/drawing/config/route-snapping/utils.d.ts +1 -1
- package/dist/esm/components/Map/traffic/useManageTraffic.js +1 -1
- package/dist/esm/components/MarketMaterialList.d.ts +3 -3
- package/dist/esm/components/MarketMaterialList.js +1 -1
- package/dist/esm/components/Menu.js +1 -1
- package/dist/esm/components/MobileToggleButton.js +1 -1
- package/dist/esm/components/MultiSelectGroups.d.ts +2 -2
- package/dist/esm/components/MultiSelectGroups.js +1 -1
- package/dist/esm/components/OverlayContainer.js +1 -1
- package/dist/esm/components/RebookingNotes.d.ts +2 -2
- package/dist/esm/components/RebookingNotes.js +1 -1
- package/dist/esm/components/RebookingRadioGroup.d.ts +2 -2
- package/dist/esm/components/RebookingRadioGroup.js +1 -1
- package/dist/esm/components/RouteQR.d.ts +2 -2
- package/dist/esm/components/RouteQR.js +1 -1
- package/dist/esm/components/Sessions.js +1 -1
- package/dist/esm/components/Share.d.ts +2 -2
- package/dist/esm/components/Share.js +1 -1
- package/dist/esm/components/SidebarActions.js +1 -1
- package/dist/esm/components/WayfindingTemplate.d.ts +2 -2
- package/dist/esm/components/WayfindingTemplate.js +1 -1
- package/dist/esm/components/gps/GpsPermissionRequest.d.ts +4 -2
- package/dist/esm/components/gps/GpsPermissionRequest.js +1 -1
- package/dist/esm/constants.d.ts +1 -0
- package/dist/esm/constants.js +1 -1
- package/dist/esm/floorplan.loader.js +1 -1
- package/dist/esm/floorplan.ready.js +1 -1
- package/dist/esm/load.js +3 -3
- package/dist/esm/services/routing.js +1 -1
- package/dist/esm/store/RootStore.d.ts +0 -2
- package/dist/esm/store/RootStore.js +1 -1
- package/dist/esm/store/RouteStore.d.ts +1 -1
- package/dist/esm/store/RouteStore.js +1 -1
- package/dist/esm/store/SearchStore.js +1 -1
- package/dist/esm/store/UIState.d.ts +1 -2
- package/dist/esm/store/UIState.js +1 -1
- package/dist/esm/store/init/index.js +1 -1
- package/dist/esm/store/search-buttons/SearchButtonsStore.d.ts +1 -1
- package/dist/esm/store/search-buttons/SearchButtonsStore.js +1 -1
- package/dist/esm/store/types.d.ts +0 -2
- package/dist/esm/tools/sentry.js +1 -1
- package/dist/esm/utils/i18n.d.ts +5 -3
- package/dist/esm/utils/i18n.js +1 -1
- package/dist/esm/utils/mapEntity.js +1 -1
- package/dist/esm/utils/math.d.ts +7 -0
- package/dist/esm/utils/math.js +1 -0
- package/dist/esm/utils/use-shadow.d.ts +1 -1
- package/dist/esm/utils/use-shadow.js +1 -1
- package/dist/esm/wayfinding/_PLAN-public-api.d.ts +220 -0
- package/dist/esm/wayfinding/_PLAN-public-api.js +1 -0
- package/dist/esm/{utils/wayfinding.d.ts → wayfinding/__integration__/legacy/legacyWayfinding.d.ts} +5 -4
- package/dist/esm/wayfinding/__integration__/legacy/legacyWayfinding.js +1 -0
- package/dist/esm/wayfinding/__tests__/helpers.d.ts +21 -0
- package/dist/esm/wayfinding/__tests__/helpers.js +1 -0
- package/dist/esm/wayfinding/adapters/boothToWaypoint.d.ts +12 -0
- package/dist/esm/wayfinding/adapters/boothToWaypoint.js +1 -0
- package/dist/esm/wayfinding/adapters/graphDataSource.d.ts +3 -0
- package/dist/esm/wayfinding/adapters/graphDataSource.js +1 -0
- package/dist/esm/wayfinding/graph/buildGraph.d.ts +3 -0
- package/dist/esm/wayfinding/graph/buildGraph.js +1 -0
- package/dist/esm/wayfinding/graph/buildNGraph.d.ts +9 -0
- package/dist/esm/wayfinding/graph/buildNGraph.js +1 -0
- package/dist/esm/wayfinding/graph/constants.d.ts +3 -0
- package/dist/esm/wayfinding/graph/constants.js +1 -0
- package/dist/esm/wayfinding/graph/findShortestPath.d.ts +14 -0
- package/dist/esm/wayfinding/graph/findShortestPath.js +1 -0
- package/dist/esm/wayfinding/graph/graphCache.d.ts +6 -0
- package/dist/esm/wayfinding/graph/graphCache.js +1 -0
- package/dist/esm/wayfinding/graph/graphHelpers.d.ts +8 -0
- package/dist/esm/wayfinding/graph/graphHelpers.js +1 -0
- package/dist/esm/wayfinding/graph/linkCost.d.ts +4 -0
- package/dist/esm/wayfinding/graph/linkCost.js +1 -0
- package/dist/esm/wayfinding/graph/pathfinder/aStarPathFinder.d.ts +3 -0
- package/dist/esm/wayfinding/graph/pathfinder/aStarPathFinder.js +1 -0
- package/dist/esm/wayfinding/graph/pathfinder/parseNodeId.d.ts +9 -0
- package/dist/esm/wayfinding/graph/pathfinder/parseNodeId.js +1 -0
- package/dist/esm/wayfinding/index.d.ts +18 -0
- package/dist/esm/wayfinding/index.js +1 -0
- package/dist/esm/wayfinding/rendering/computeTransitionPoints.d.ts +31 -0
- package/dist/esm/wayfinding/rendering/computeTransitionPoints.js +1 -0
- package/dist/esm/wayfinding/rendering/normalizeRouteDirection.d.ts +19 -0
- package/dist/esm/wayfinding/rendering/normalizeRouteDirection.js +1 -0
- package/dist/esm/wayfinding/rendering/routeGeometry.d.ts +16 -0
- package/dist/esm/wayfinding/rendering/routeGeometry.js +1 -0
- package/dist/esm/wayfinding/routing/buildMultiPointRoute.d.ts +11 -0
- package/dist/esm/wayfinding/routing/buildMultiPointRoute.js +1 -0
- package/dist/esm/wayfinding/routing/buildRoute.d.ts +9 -0
- package/dist/esm/wayfinding/routing/buildRoute.js +1 -0
- package/dist/esm/wayfinding/routing/findNearestGraphPoint.d.ts +21 -0
- package/dist/esm/wayfinding/routing/findNearestGraphPoint.js +1 -0
- package/dist/esm/wayfinding/routing/getGraphLines.d.ts +14 -0
- package/dist/esm/wayfinding/routing/getGraphLines.js +1 -0
- package/dist/esm/wayfinding/routing/getRouteLength.d.ts +3 -0
- package/dist/esm/wayfinding/routing/getRouteLength.js +1 -0
- package/dist/esm/wayfinding/routing/routeResult.d.ts +4 -0
- package/dist/esm/wayfinding/routing/routeResult.js +1 -0
- package/dist/esm/wayfinding/types.d.ts +76 -0
- package/dist/esm/wayfinding/types.js +1 -0
- package/package.json +3 -3
- package/dist/browser/Debug-DazuGIJc.js +0 -40
- package/dist/browser/Gallery-BMcvPLO_.js +0 -288
- package/dist/esm/store/LanguageStore.d.ts +0 -19
- package/dist/esm/store/LanguageStore.js +0 -1
- package/dist/esm/store/init/init-language.d.ts +0 -3
- package/dist/esm/store/init/init-language.js +0 -1
- package/dist/esm/utils/toRadians.d.ts +0 -3
- package/dist/esm/utils/toRadians.js +0 -1
- package/dist/esm/utils/wayfinding.js +0 -1
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
export type Unsubscribe = () => void;
|
|
2
|
+
export interface Point {
|
|
3
|
+
x: number;
|
|
4
|
+
y: number;
|
|
5
|
+
layer: string;
|
|
6
|
+
}
|
|
7
|
+
export interface RouteEstimation {
|
|
8
|
+
/** Длина маршрута в единицах пространства */
|
|
9
|
+
distance: number;
|
|
10
|
+
/** Примерное время в секундах */
|
|
11
|
+
duration: number;
|
|
12
|
+
}
|
|
13
|
+
export interface Route {
|
|
14
|
+
points: Point[];
|
|
15
|
+
estimation: RouteEstimation;
|
|
16
|
+
}
|
|
17
|
+
export interface RouteResult {
|
|
18
|
+
primary: Route;
|
|
19
|
+
alternatives: Route[];
|
|
20
|
+
}
|
|
21
|
+
export interface RouteRequest {
|
|
22
|
+
from: Point;
|
|
23
|
+
to: Point;
|
|
24
|
+
}
|
|
25
|
+
export interface MultiPointRouteRequest {
|
|
26
|
+
points: [Point, Point, ...Point[]];
|
|
27
|
+
/**
|
|
28
|
+
* false (дефолт) — маршрут строится в переданном порядке точек.
|
|
29
|
+
* true — порядок промежуточных точек оптимизируется (TSP).
|
|
30
|
+
* Старт и финиш (первая и последняя точки) всегда фиксированы.
|
|
31
|
+
*/
|
|
32
|
+
optimize?: boolean;
|
|
33
|
+
}
|
|
34
|
+
export type ManeuverType = 'straight' | 'turn-left' | 'turn-right' | 'turn-slight-left' | 'turn-slight-right' | 'u-turn' | 'take-elevator' | 'take-stairs' | 'take-escalator' | 'exit-building' | 'enter-building' | 'change-layer' | 'arrive';
|
|
35
|
+
export interface Instruction {
|
|
36
|
+
type: ManeuverType;
|
|
37
|
+
/** Локализованный текст */
|
|
38
|
+
text: string;
|
|
39
|
+
/** Расстояние до следующего манёвра */
|
|
40
|
+
distance: number;
|
|
41
|
+
bearing?: number;
|
|
42
|
+
isLayerTransition: boolean;
|
|
43
|
+
}
|
|
44
|
+
export interface NavigationProgress {
|
|
45
|
+
status: 'active' | 'paused' | 'arrived' | 'off-route';
|
|
46
|
+
currentInstruction: Instruction;
|
|
47
|
+
nextInstruction: Instruction | null;
|
|
48
|
+
distanceToNextManeuver: number;
|
|
49
|
+
distanceToDestination: number;
|
|
50
|
+
/** Секунды */
|
|
51
|
+
timeToDestination: number;
|
|
52
|
+
currentLayer: string;
|
|
53
|
+
/** Позиция пользователя привязанная к маршруту */
|
|
54
|
+
snappedPoint: Point;
|
|
55
|
+
offRouteDistance?: number;
|
|
56
|
+
}
|
|
57
|
+
export interface UserPosition {
|
|
58
|
+
point: Point;
|
|
59
|
+
heading?: number;
|
|
60
|
+
}
|
|
61
|
+
export interface MarkerIcon {
|
|
62
|
+
svg: string;
|
|
63
|
+
width?: number;
|
|
64
|
+
height?: number;
|
|
65
|
+
}
|
|
66
|
+
export interface RouteLineStyle {
|
|
67
|
+
color?: string;
|
|
68
|
+
width?: number;
|
|
69
|
+
opacity?: number;
|
|
70
|
+
}
|
|
71
|
+
export type RouteAnimation = (lines: LineDef[], route: Route) => () => void;
|
|
72
|
+
export interface LineDef {
|
|
73
|
+
points: [Vector2Like, Vector2Like];
|
|
74
|
+
color: string;
|
|
75
|
+
width: number;
|
|
76
|
+
}
|
|
77
|
+
export interface Vector2Like {
|
|
78
|
+
x: number;
|
|
79
|
+
y: number;
|
|
80
|
+
}
|
|
81
|
+
export interface RendererStyle {
|
|
82
|
+
route?: RouteLineStyle;
|
|
83
|
+
animation?: RouteAnimation;
|
|
84
|
+
alternativeRoute?: {
|
|
85
|
+
line?: RouteLineStyle;
|
|
86
|
+
opacity?: number;
|
|
87
|
+
};
|
|
88
|
+
markers?: {
|
|
89
|
+
origin?: MarkerIcon;
|
|
90
|
+
destination?: MarkerIcon;
|
|
91
|
+
waypoint?: MarkerIcon;
|
|
92
|
+
userPosition?: MarkerIcon;
|
|
93
|
+
layerTransition?: {
|
|
94
|
+
up?: MarkerIcon;
|
|
95
|
+
down?: MarkerIcon;
|
|
96
|
+
/** Переход без смены уровня (например переход между корпусами на одном этаже) */
|
|
97
|
+
same?: MarkerIcon;
|
|
98
|
+
};
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Рендерер — единственная визуальная зависимость wayfinding-модуля.
|
|
103
|
+
* Реализуй этот интерфейс если хочешь использовать свой рендерер.
|
|
104
|
+
*/
|
|
105
|
+
export interface WayfindingRenderer {
|
|
106
|
+
renderRoute(route: Route, style: RendererStyle): void;
|
|
107
|
+
renderAlternatives(routes: Route[], style: RendererStyle): void;
|
|
108
|
+
clearRoute(): void;
|
|
109
|
+
renderPosition(position: UserPosition): void;
|
|
110
|
+
clearPosition(): void;
|
|
111
|
+
/** Переключить отображаемый слой */
|
|
112
|
+
setActiveLayer(layerId: string): void;
|
|
113
|
+
destroy(): void;
|
|
114
|
+
}
|
|
115
|
+
export interface WayfindingEventMap {
|
|
116
|
+
'route:ready': {
|
|
117
|
+
result: RouteResult;
|
|
118
|
+
};
|
|
119
|
+
'route:error': {
|
|
120
|
+
error: WayfindingError;
|
|
121
|
+
};
|
|
122
|
+
'route:cleared': Record<string, never>;
|
|
123
|
+
'navigation:started': {
|
|
124
|
+
route: Route;
|
|
125
|
+
};
|
|
126
|
+
'navigation:progress': {
|
|
127
|
+
progress: NavigationProgress;
|
|
128
|
+
};
|
|
129
|
+
'navigation:instruction': {
|
|
130
|
+
instruction: Instruction;
|
|
131
|
+
};
|
|
132
|
+
'navigation:deviation': {
|
|
133
|
+
offRouteDistance: number;
|
|
134
|
+
};
|
|
135
|
+
'navigation:rerouting': Record<string, never>;
|
|
136
|
+
'navigation:rerouted': {
|
|
137
|
+
result: RouteResult;
|
|
138
|
+
};
|
|
139
|
+
'navigation:arrived': Record<string, never>;
|
|
140
|
+
'navigation:stopped': Record<string, never>;
|
|
141
|
+
'navigation:paused': Record<string, never>;
|
|
142
|
+
'navigation:resumed': Record<string, never>;
|
|
143
|
+
'location:update': {
|
|
144
|
+
position: UserPosition;
|
|
145
|
+
};
|
|
146
|
+
'location:lost': Record<string, never>;
|
|
147
|
+
'layer:change': {
|
|
148
|
+
from: string | null;
|
|
149
|
+
to: string;
|
|
150
|
+
};
|
|
151
|
+
'error': {
|
|
152
|
+
error: WayfindingError;
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
export type WayfindingEventName = keyof WayfindingEventMap;
|
|
156
|
+
export type WayfindingErrorCode = 'NO_ROUTE_FOUND' | 'SPACE_NOT_LOADED' | 'LOCATION_UNAVAILABLE' | 'UNKNOWN';
|
|
157
|
+
export interface WayfindingError {
|
|
158
|
+
code: WayfindingErrorCode;
|
|
159
|
+
message: string;
|
|
160
|
+
cause?: unknown;
|
|
161
|
+
}
|
|
162
|
+
export interface WayfindingEngineConfig {
|
|
163
|
+
/**
|
|
164
|
+
* Данные пространства — передаются как есть.
|
|
165
|
+
* Engine сам определяет формат (lines/lineEnds, GeoJSON, NavMesh, Grid…)
|
|
166
|
+
* через зарегистрированные адаптеры.
|
|
167
|
+
*/
|
|
168
|
+
space: unknown;
|
|
169
|
+
/**
|
|
170
|
+
* Рендерер — рисует маршрут, маркеры, анимацию.
|
|
171
|
+
* Передай свой если уже есть своя карта.
|
|
172
|
+
*/
|
|
173
|
+
renderer: WayfindingRenderer;
|
|
174
|
+
/** Начальный стиль. Незаданные поля — дефолты рендерера. */
|
|
175
|
+
style?: RendererStyle;
|
|
176
|
+
rerouting?: {
|
|
177
|
+
/** Включить автоматический перерасчёт маршрута. По умолчанию false. */
|
|
178
|
+
enabled: boolean;
|
|
179
|
+
/** Расстояние отклонения от маршрута в единицах пространства после которого запускается перерасчёт */
|
|
180
|
+
threshold: number;
|
|
181
|
+
};
|
|
182
|
+
locale?: string;
|
|
183
|
+
}
|
|
184
|
+
export interface WayfindingEngine {
|
|
185
|
+
destroy(): void;
|
|
186
|
+
/** Построить маршрут. Результат также придёт событием 'route:ready'. */
|
|
187
|
+
route(request: RouteRequest): Promise<RouteResult>;
|
|
188
|
+
/** Построить маршрут через несколько точек в заданном порядке. */
|
|
189
|
+
routeMultiPoint(request: MultiPointRouteRequest): Promise<RouteResult>;
|
|
190
|
+
getCurrentRoute(): RouteResult | null;
|
|
191
|
+
clearRoute(): void;
|
|
192
|
+
startNavigation(): Promise<void>;
|
|
193
|
+
pauseNavigation(): void;
|
|
194
|
+
resumeNavigation(): void;
|
|
195
|
+
stopNavigation(): void;
|
|
196
|
+
getProgress(): NavigationProgress | null;
|
|
197
|
+
/**
|
|
198
|
+
* Обновить позицию пользователя.
|
|
199
|
+
* Если position.point.layer === 'unknown' — engine определит слой автоматически
|
|
200
|
+
* через snap к ближайшему узлу пространства и выдаст 'location:update'
|
|
201
|
+
* с разрешённым layer.
|
|
202
|
+
*/
|
|
203
|
+
updatePosition(position: UserPosition): void;
|
|
204
|
+
on<E extends WayfindingEventName>(event: E, handler: (payload: WayfindingEventMap[E]) => void): Unsubscribe;
|
|
205
|
+
once<E extends WayfindingEventName>(event: E, handler: (payload: WayfindingEventMap[E]) => void): Unsubscribe;
|
|
206
|
+
/** Текущее состояние — для синхронного чтения при первом рендере */
|
|
207
|
+
getState(): WayfindingState;
|
|
208
|
+
}
|
|
209
|
+
/** Factory function — создаёт и инициализирует engine. */
|
|
210
|
+
export declare function createWayfindingEngine(config: WayfindingEngineConfig): Promise<WayfindingEngine>;
|
|
211
|
+
export interface WayfindingState {
|
|
212
|
+
route: RouteResult | null;
|
|
213
|
+
progress: NavigationProgress | null;
|
|
214
|
+
/** Текущий активный слой карты */
|
|
215
|
+
activeLayer: string | null;
|
|
216
|
+
/** Последняя известная позиция пользователя с разрешённым layer */
|
|
217
|
+
userPosition: UserPosition | null;
|
|
218
|
+
spaceLoaded: boolean;
|
|
219
|
+
}
|
|
220
|
+
//# sourceMappingURL=_PLAN-public-api.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{};
|
package/dist/esm/{utils/wayfinding.d.ts → wayfinding/__integration__/legacy/legacyWayfinding.d.ts}
RENAMED
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import { Booth } from "
|
|
1
|
+
import { Booth } from "../../../store/BoothStore";
|
|
2
2
|
export declare class RouteLine {
|
|
3
3
|
p0: RoutePoint;
|
|
4
4
|
p1: RoutePoint;
|
|
5
5
|
unaccessible: boolean;
|
|
6
6
|
unidirection: boolean;
|
|
7
7
|
virtual: boolean;
|
|
8
|
-
ended: boolean;
|
|
9
8
|
weight: number;
|
|
10
|
-
constructor(p0: RoutePoint, p1: RoutePoint, unaccessible: boolean, unidirection: boolean, virtual: boolean,
|
|
9
|
+
constructor(p0: RoutePoint, p1: RoutePoint, unaccessible: boolean, unidirection: boolean, virtual: boolean, weight: number);
|
|
11
10
|
}
|
|
12
11
|
export declare class RoutePoint {
|
|
13
12
|
layer: string;
|
|
@@ -20,7 +19,9 @@ type Sublines = {
|
|
|
20
19
|
lineEnds: RoutePoint[];
|
|
21
20
|
};
|
|
22
21
|
export declare let sublines: () => Sublines;
|
|
22
|
+
export declare function resetPathFinder(): void;
|
|
23
|
+
export declare function setSublines(fn: () => Sublines): void;
|
|
23
24
|
export declare function getGraphLines(fromBooth: Booth, toBooth: Booth, onlyAccessible?: boolean, waypoints?: Booth[]): RouteLine[];
|
|
24
25
|
export declare function getRouteLength(routeLines: RouteLine[]): number;
|
|
25
26
|
export {};
|
|
26
|
-
//# sourceMappingURL=
|
|
27
|
+
//# sourceMappingURL=legacyWayfinding.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{lineAngle as L,lineLength as w,Point as u,pointInsideRectangle as F,Rect as I}from"simple-geometry";import $ from"../../../core/Polygon";import M from"../../graph/utils/a-star/a-star";import S from"ngraph.graph";export class RouteLine{p0;p1;unaccessible;unidirection;virtual;weight;constructor(n,r,s,a,i,t){this.p0=n,this.p1=r,this.unaccessible=s,this.unidirection=a,this.virtual=i,this.weight=t}}export class RoutePoint{layer;x;y;constructor(n,r,s){this.layer=n,this.x=r,this.y=s}}const P=e=>`${e.layer}_${e.x}_${e.y}`,b=(e,n)=>e.layer===n.layer&&w(e,n)<=1,W=(e,n,r)=>b(e.p0,n)&&b(e.p1,r)&&e.p0.layer===n.layer&&e.p1.layer===r.layer||b(e.p0,r)&&b(e.p1,n)&&e.p0.layer===r.layer&&e.p1.layer===n.layer;function _(e){const n=e.split("_");return[n[0],parseFloat(n[1]),parseFloat(n[2])]}export let sublines=()=>window.__wfData;let g={finder:null,oriented:!0,onlyAccessible:!1};export function resetPathFinder(){g.finder=null}export function setSublines(e){sublines=e}const k=0;function T(e,n){const r=S(),s=performance.now();let{lines:a}=sublines();a.forEach(t=>{(!n||!t.unaccessible)&&(r.addLink(P(t.p0),P(t.p1),{distance:t.virtual?k:w(t.p0,t.p1)/(t.weight||4)}),e&&!t.unidirection&&r.addLink(P(t.p1),P(t.p0),{distance:t.virtual?k:w(t.p1,t.p0)/(t.weight||4)}))}),g.oriented=e,g.onlyAccessible=n,g.finder=M(r,{oriented:e,distance(t,o,p){var d=1;if(o.parent){const h=_(o.parent?.node.id),f=_(o.node.id),m=_(t.id);var y=L({x:h[1],y:h[2]},{x:f[1],y:f[2]}),x=L({x:f[1],y:f[2]},{x:m[1],y:m[2]});y!==x&&(d=1.01)}return d*p.data.distance}});const i=performance.now();console.debug(`WF. Graph created. ~ ${i-s}ms.`)}function j(e,n,r){return e.filter(s=>W(s,n,r))[0]}export function getGraphLines(e,n,r=!1,s=[]){let a=performance.now();const i=$.fromRect(e.rect).rotate(e.rotate,e.rect.cx,e.rect.cy),t=$.fromRect(n.rect).rotate(n.rotate,n.rect.cx,n.rect.cy),o=new I(new u(i.x1,i.y1),new u(i.x2,i.y2),new u(i.x3,i.y3),new u(i.x4,i.y4)),p=new I(new u(t.x1,t.y1),new u(t.x2,t.y2),new u(t.x3,t.y3),new u(t.x4,t.y4)),d=new Map(s.map(l=>{const c=$.fromRect(l.rect).rotate(l.rotate,l.rect.cx,l.rect.cy);return[l.id,new I(new u(c.x1,c.y1),new u(c.x2,c.y2),new u(c.x3,c.y3),new u(c.x4,c.y4))]}));(!g.finder||g.onlyAccessible!==r)&&T(g.oriented,r);const y=[],x=[];let{lines:h,lineEnds:f}=sublines();for(let l=0;l<f.length;l++){const c=f[l],R=(c.layer===e.layer?.name||!e.layer)&&F(c,o),v=(c.layer===n.layer?.name||!n.layer)&&F(c,p);R&&y.push(c),v&&x.push(c)}const m=[],A=[y,...s.reduce((l,c)=>{const R=d.get(c.id);if(R){const v=f.filter(G=>(G.layer===c.layer?.name||!c.layer)&&F(G,R));v.length>0&&l.push(v)}return l},[]),x];if(m.push(...A.slice(1).map((l,c)=>D(A[c],l)).reverse().flat()),!m.length)return console.debug(`WF. Get graph lines: 0 ~ ${performance.now()-a}ms.`),[];const E=m.flatMap(l=>U(l.points,h));return console.debug(`WF. Get graph lines: ${E.length} ~ ${performance.now()-a}ms.`),E}function D(e,n){const r=[];for(let s=0;s<e.length;s++)for(let a=0;a<n.length;a++)try{const i=g.finder.find(P(e[s]),P(n[a]));if(!i.length)continue;let t=0,o=[];for(let p=0;p<i.length;p++){const d=i[p],y=i[p+1],x=d.id,h=_(x);o.push(new RoutePoint(h[0],h[1],h[2])),y&&(t+=d.links.find(f=>f.toId===x&&f.fromId===y.id).data.distance)}r.push({distance:t,points:o})}catch(i){console.warn(i)}return r.sort((s,a)=>s.distance-a.distance).slice(0,1)}function U(e,n){let r=[];for(let s=1;s<e.length;s++){const a=e[s-1],i=e[s];let t=j(n,a,i);if(!t)continue;let o=new RouteLine(a,i,t.unaccessible,t.unidirection,t.virtual,t.weight);w(t.p0,i)<w(t.p0,a)&&(o.p0=a,o.p1=i);const p=r[r.length-1],d=p?L(p.p0,p.p1):null,y=L(o.p0,o.p1);!p||p.virtual!==o.virtual||Math.abs(y-d)>5?r.push(o):p.p1=o.p1}return r}export function getRouteLength(e){return e.reduce((n,r)=>n+w(r.p0,r.p1),0)}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { GraphBuildOptions, GraphDataSource, GraphInstance, PathNode, RouteLine, RoutePoint } from "../types";
|
|
2
|
+
export declare function makePoint(layer: string, x: number, y: number): RoutePoint;
|
|
3
|
+
/** Creates a simple linear graph: p0 — p1 — p2 — ... */
|
|
4
|
+
export declare function makeLinearGraph(layerName: string, ...coords: [number, number][]): {
|
|
5
|
+
points: RoutePoint[];
|
|
6
|
+
lines: RouteLine[];
|
|
7
|
+
};
|
|
8
|
+
export declare function makeLine(p0: RoutePoint, p1: RoutePoint, overrides?: Partial<Omit<RouteLine, "p0" | "p1">>): RouteLine;
|
|
9
|
+
export declare function makeNode(layer: string, x: number, y: number): PathNode;
|
|
10
|
+
export declare function createMockDataSource(options?: {
|
|
11
|
+
lines?: RouteLine[];
|
|
12
|
+
lineEnds?: RoutePoint[];
|
|
13
|
+
}): GraphDataSource;
|
|
14
|
+
export declare function createMockGraph(options?: {
|
|
15
|
+
lines?: RouteLine[];
|
|
16
|
+
lineEnds?: RoutePoint[];
|
|
17
|
+
hasNodeResult?: boolean | ((id: string) => boolean);
|
|
18
|
+
findResult?: PathNode[] | ((fromId: string, toId: string) => PathNode[]);
|
|
19
|
+
graphOptions?: GraphBuildOptions;
|
|
20
|
+
}): GraphInstance;
|
|
21
|
+
//# sourceMappingURL=helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{vi as u}from"vitest";export function makePoint(e,t,n){return{layer:e,x:t,y:n}}export function makeLinearGraph(e,...t){const n=t.map(([i,r])=>makePoint(e,i,r)),o=n.slice(1).map((i,r)=>makeLine(n[r],i));return{points:n,lines:o}}export function makeLine(e,t,n={}){return{p0:e,p1:t,unaccessible:!1,unidirection:!1,virtual:!1,weight:4,...n}}export function makeNode(e,t,n){return{id:`${e}_${t}_${n}`,layer:e,x:t,y:n}}export function createMockDataSource(e={}){return{getLines:()=>e.lines??[],getLineEnds:()=>e.lineEnds??[]}}export function createMockGraph(e={}){const{lines:t=[],lineEnds:n=[],hasNodeResult:o=!0,findResult:i=[],graphOptions:r}=e;return{finder:{build:u.fn(),hasNode:typeof o=="function"?u.fn(o):u.fn().mockReturnValue(o),find:typeof i=="function"?u.fn(i):u.fn().mockReturnValue(i)},dataSource:{getLines:()=>t,getLineEnds:()=>n},options:r??{oriented:!0}}}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Booth } from "../../store/BoothStore";
|
|
2
|
+
import type { RouteWaypoint } from "../types";
|
|
3
|
+
/**
|
|
4
|
+
* Converts a MobX Booth entity to a framework-free RouteWaypoint.
|
|
5
|
+
*
|
|
6
|
+
* This adapter is exported as a public API for current consumers (RouteStore,
|
|
7
|
+
* config-wf.ts). In Phase 7, it will become an internal detail of
|
|
8
|
+
* MobxStateAdapter — the Booth→RouteWaypoint conversion will happen inside
|
|
9
|
+
* the state port, and callers will work with RouteWaypoint directly.
|
|
10
|
+
*/
|
|
11
|
+
export declare function boothToWaypoint(booth: Booth): RouteWaypoint;
|
|
12
|
+
//# sourceMappingURL=boothToWaypoint.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Point as t,Rect as c}from"simple-geometry";import n from"../../core/Polygon";export function boothToWaypoint(r){const e=n.fromRect(r.rect).rotate(r.rotate,r.rect.cx,r.rect.cy);return{x:r.rect.cx,y:r.rect.cy,layer:r.layer?.name,rect:new c(new t(e.x1,e.y1),new t(e.x2,e.y2),new t(e.x3,e.y3),new t(e.x4,e.y4))}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function n(){return window.__wfData}export const graphDataSource={getLines:()=>n()?.lines??[],getLineEnds:()=>n()?.lineEnds??[]};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export function buildGraph(l,i,e){return i.build(l.getLines(),{oriented:e.oriented??!0,onlyAccessible:e.onlyAccessible??!1}),{finder:i,dataSource:l,options:e}}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Graph } from "ngraph.graph";
|
|
2
|
+
import type { PathFinderOptions, RouteLine } from "../types";
|
|
3
|
+
type LinkData = {
|
|
4
|
+
distance: number;
|
|
5
|
+
};
|
|
6
|
+
/** Builds an ngraph instance from route lines, filtering and linking per options. */
|
|
7
|
+
export declare function buildNGraph(lines: RouteLine[], options: PathFinderOptions): Graph<unknown, LinkData>;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=buildNGraph.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import p from"ngraph.graph";import{toNodeId as c}from"./graphHelpers";import{linkCost as a}from"./linkCost";export function buildNGraph(e,d){const{oriented:s,onlyAccessible:f}=d,n=p();for(const o of e){if(f&&o.unaccessible)continue;const t=c(o.p0),i=c(o.p1),r=a(o);n.addLink(t,i,{distance:r}),s&&!o.unidirection&&n.addLink(i,t,{distance:r})}return n}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const VIRTUAL_LINE_PENALTY=0;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { GraphInstance, ShortestPathResult, RoutePoint, RouteLine } from "../types";
|
|
2
|
+
/** Computes the weighted path cost matching the graph link distance formula. */
|
|
3
|
+
export declare function computeWeightedPathCost(points: RoutePoint[], lines: RouteLine[]): number;
|
|
4
|
+
/**
|
|
5
|
+
* Finds the shortest path between candidate point sets by trying all from×to
|
|
6
|
+
* pairs and picking the one with the lowest weighted cost.
|
|
7
|
+
*
|
|
8
|
+
* Complexity is O(N×M × A*) where N = |from|, M = |to|. In practice N, M ≤ 5
|
|
9
|
+
* (rect-based booth candidates) or = 1 (nearest-point fallback), so the brute
|
|
10
|
+
* force approach is acceptable. Multi-source A* would reduce this to a single
|
|
11
|
+
* traversal but adds significant implementation complexity.
|
|
12
|
+
*/
|
|
13
|
+
export declare function findShortestPath(graph: GraphInstance, from: RoutePoint[], to: RoutePoint[]): ShortestPathResult | null;
|
|
14
|
+
//# sourceMappingURL=findShortestPath.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{toNodeId as m,buildRouteSegments as p,findLineByEndpoints as P}from"./graphHelpers";import{linkCost as b}from"./linkCost";import{getRouteLength as x}from"../routing/getRouteLength";function y(t,o,n){return{layer:t,x:o,y:n}}export function computeWeightedPathCost(t,o){let n=0;for(let e=1;e<t.length;e++){const i=P(o,t[e-1],t[e]);i&&(n+=b(i))}return n}export function findShortestPath(t,o,n){const e=t.dataSource.getLines();let i=null,d=1/0;for(const a of o)for(const g of n){const s=m(a),r=m(g);if(!t.finder.hasNode(s)||!t.finder.hasNode(r)){console.debug(`WF. findShortestPath: node not in graph, skipping pair ${s} \u2192 ${r}`);continue}const u=t.finder.find(s,r);if(!u.length)continue;const l=u.map(c=>y(c.layer,c.x,c.y)),f=p(l,e);if(!f.length)continue;const h=computeWeightedPathCost(l,e);h<d&&(d=h,i={lines:f,distance:x(f)})}return i}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { GraphDataSource, GraphInstance } from "../types";
|
|
2
|
+
export interface GraphCache {
|
|
3
|
+
getOrBuild(dataSource: GraphDataSource, onlyAccessible: boolean): GraphInstance;
|
|
4
|
+
}
|
|
5
|
+
export declare function createGraphCache(): GraphCache;
|
|
6
|
+
//# sourceMappingURL=graphCache.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{buildGraph as i}from"./buildGraph";import{createAStarPathFinder as u}from"./pathfinder/aStarPathFinder";export function createGraphCache(){let r=null,t=!1;return{getOrBuild(a,e){if(r&&t===e)return r;const n=u();return r=i(a,n,{oriented:!0,onlyAccessible:e}),t=e,r}}}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { RouteLine, RoutePoint } from "../types";
|
|
2
|
+
export declare const toNodeId: (p: RoutePoint) => string;
|
|
3
|
+
export declare const arePointsClose: (p1: RoutePoint, p2: RoutePoint) => boolean;
|
|
4
|
+
export declare const matchesLine: (line: RouteLine, p0: RoutePoint, p1: RoutePoint) => boolean;
|
|
5
|
+
export declare function findLineByEndpoints(lines: RouteLine[], p0: RoutePoint, p1: RoutePoint): RouteLine | undefined;
|
|
6
|
+
export declare function canMergeSegments(lastSegment: RouteLine, segment: RouteLine): boolean;
|
|
7
|
+
export declare function buildRouteSegments(points: RoutePoint[], lines: RouteLine[]): RouteLine[];
|
|
8
|
+
//# sourceMappingURL=graphHelpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{lineAngle as u,lineLength as a}from"simple-geometry";export const toNodeId=n=>`${n.layer}_${n.x}_${n.y}`;const f=1;export const arePointsClose=(n,e)=>n.layer===e.layer&&a(n,e)<=f,matchesLine=(n,e,t)=>arePointsClose(n.p0,e)&&arePointsClose(n.p1,t)||arePointsClose(n.p0,t)&&arePointsClose(n.p1,e);export function findLineByEndpoints(n,e,t){return n.find(o=>matchesLine(o,e,t))}const p=5;export function canMergeSegments(n,e){if(n.virtual!==e.virtual)return!1;const t=u(n.p0,n.p1),o=u(e.p0,e.p1);let i=Math.abs(o-t);return i>180&&(i=360-i),i<=p}export function buildRouteSegments(n,e){const t=[];for(let o=1;o<n.length;o++){const i=n[o-1],s=n[o],r=findLineByEndpoints(e,i,s);if(!r){console.warn(`WF: buildRouteSegments \u2014 no line found between ${toNodeId(i)} and ${toNodeId(s)}`);continue}const c={p0:i,p1:s,unaccessible:r.unaccessible,unidirection:r.unidirection,virtual:r.virtual,weight:r.weight},l=t[t.length-1];l&&canMergeSegments(l,c)?t[t.length-1]={...l,p1:c.p1}:t.push(c)}return t}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{lineLength as r}from"simple-geometry";import{VIRTUAL_LINE_PENALTY as o}from"./constants";const L=4;export function linkCost(t){return t.virtual?t.virtualLength??o:r(t.p0,t.p1)/(t.weight||L)}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{lineAngle as f}from"simple-geometry";import h from"../utils/a-star/a-star";import{buildNGraph as y}from"../buildNGraph";import{parseNodeId as l}from"./parseNodeId";const g=1.01;function x(){return function(n,e,t){let r=1;if(e.parent){const[,a,c]=l(e.parent.node.id),[,o,d]=l(e.node.id),[,s,u]=l(n.id),p=f({x:a,y:c},{x:o,y:d}),m=f({x:o,y:d},{x:s,y:u});p!==m&&(r=g)}return r*t.data.distance}}export function createAStarPathFinder(){let i=null,n=null;return{build(e,t){n=y(e,t),i=h(n,{oriented:t.oriented,distance:x()})},hasNode(e){return n?!!n.hasNode(e):!1},find(e,t){if(!i)return[];const r=i.find(e,t);return r.length?r.map(a=>{const[c,o,d]=l(a.id);return{id:a.id,layer:c,x:o,y:d}}):[]}}}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Decodes a node ID created by `pointId` back into [layer, x, y].
|
|
3
|
+
*
|
|
4
|
+
* Point IDs are formatted as "{layer}_{x}_{y}". Since layer names may
|
|
5
|
+
* contain underscores (e.g. "floor_1"), we parse from the right where
|
|
6
|
+
* x and y are always the last two segments.
|
|
7
|
+
*/
|
|
8
|
+
export declare function parseNodeId(id: string): [string, number, number];
|
|
9
|
+
//# sourceMappingURL=parseNodeId.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export function parseNodeId(e){const t=e.lastIndexOf("_"),s=e.lastIndexOf("_",t-1);if(s===-1)throw new Error(`WF: invalid node ID format "${e}", expected "{layer}_{x}_{y}"`);return[e.substring(0,s),parseFloat(e.substring(s+1,t)),parseFloat(e.substring(t+1))]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export type { RoutePoint, RouteLine, RouteResult, } from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* TODO: The exports below are temporary. They exist because RouteStore and config-wf.ts call wayfinding functions directly.
|
|
4
|
+
* When WayfindingRuntime and WayfindingStore are created (ARCHITECTURE.md phases 7-8), these will
|
|
5
|
+
* become internal implementation details and should be removed from the
|
|
6
|
+
* public barrel.
|
|
7
|
+
*/
|
|
8
|
+
export type { RouteWaypoint } from "./types";
|
|
9
|
+
export { getGraphLines } from "./routing/getGraphLines";
|
|
10
|
+
export { getRouteLength } from "./routing/getRouteLength";
|
|
11
|
+
export { computeTransitionPoints } from "./rendering/computeTransitionPoints";
|
|
12
|
+
export { normalizeRouteDirection } from "./rendering/normalizeRouteDirection";
|
|
13
|
+
export { bezierCurve, splitPolyLine } from "./rendering/routeGeometry";
|
|
14
|
+
export { createGraphCache } from "./graph/graphCache";
|
|
15
|
+
export type { GraphCache } from "./graph/graphCache";
|
|
16
|
+
export { boothToWaypoint } from "./adapters/boothToWaypoint";
|
|
17
|
+
export { graphDataSource } from "./adapters/graphDataSource";
|
|
18
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{getGraphLines}from"./routing/getGraphLines";export{getRouteLength}from"./routing/getRouteLength";export{computeTransitionPoints}from"./rendering/computeTransitionPoints";export{normalizeRouteDirection}from"./rendering/normalizeRouteDirection";export{bezierCurve,splitPolyLine}from"./rendering/routeGeometry";export{createGraphCache}from"./graph/graphCache";export{boothToWaypoint}from"./adapters/boothToWaypoint";export{graphDataSource}from"./adapters/graphDataSource";
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { RouteLine } from "../types";
|
|
2
|
+
interface TransitionPointsInput {
|
|
3
|
+
/** Full route including virtual lines */
|
|
4
|
+
readonly routeLines: RouteLine[];
|
|
5
|
+
/** Current floor name (null = single-floor) */
|
|
6
|
+
readonly currentLayerName: string | null;
|
|
7
|
+
/** Floor names ordered low → high (from layerStore.floors) */
|
|
8
|
+
readonly floorOrder: string[];
|
|
9
|
+
}
|
|
10
|
+
interface TransitionPointDef {
|
|
11
|
+
readonly x: number;
|
|
12
|
+
readonly y: number;
|
|
13
|
+
/** Floor where the icon is rendered */
|
|
14
|
+
readonly layer: string;
|
|
15
|
+
/** Floor the transition leads to (for click-to-switch) */
|
|
16
|
+
readonly targetLayer: string;
|
|
17
|
+
readonly direction: "up" | "down" | "neutral";
|
|
18
|
+
/** Whether this is an entry (arriving from another floor) or exit (leaving to another floor) in walking direction */
|
|
19
|
+
readonly role: "entry" | "exit";
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Computes deduplicated, correctly-directed transition points for the
|
|
23
|
+
* current floor.
|
|
24
|
+
*
|
|
25
|
+
* Works directly with the full `routeLines` array (including virtual lines)
|
|
26
|
+
* and does NOT depend on `routeNextFloor` — the target floor is read from
|
|
27
|
+
* the opposite endpoint of each virtual line.
|
|
28
|
+
*/
|
|
29
|
+
export declare function computeTransitionPoints(input: TransitionPointsInput): TransitionPointDef[];
|
|
30
|
+
export {};
|
|
31
|
+
//# sourceMappingURL=computeTransitionPoints.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function s(o,n){return o.toLowerCase()===n.toLowerCase()}function p(o,n){return o.findIndex(r=>s(r,n))}function x(o,n,r){const a=p(o,n),t=p(o,r);return a===-1||t===-1?"neutral":t>a?"up":"down"}function d(o,n,r){return o.find(a=>s(a.p0.layer,n)?!r.has(a.p1.layer.toLowerCase()):s(a.p1.layer,n)?!r.has(a.p0.layer.toLowerCase()):!1)}function C(o,n,r,a){if(n.has(a.toLowerCase()))return a;let t=a;const l=new Set([r.toLowerCase(),t.toLowerCase()]);let u=d(o,t,l);for(;u&&(t=s(u.p0.layer,t)?u.p1.layer:u.p0.layer,!n.has(t.toLowerCase()));)l.add(t.toLowerCase()),u=d(o,t,l);return t}export function computeTransitionPoints(o){const{routeLines:n,currentLayerName:r,floorOrder:a}=o,t=n.filter(e=>e.virtual&&!s(e.p0.layer,e.p1.layer)),l=new Set;for(const e of n)e.virtual||(l.add(e.p0.layer.toLowerCase()),l.add(e.p1.layer.toLowerCase()));const w=(r?t.filter(e=>s(e.p0.layer,r)||s(e.p1.layer,r)):t).map(e=>{const c=r?s(e.p0.layer,r):!0,i=c?e.p0:e.p1,L=c?e.p1:e.p0,f=C(t,l,i.layer,L.layer);return{x:i.x,y:i.y,layer:i.layer,targetLayer:f,direction:x(a,i.layer,f),role:r&&c?"entry":"exit"}}),y=new Set;return w.filter(e=>{const c=`${e.x}:${e.y}`;return y.has(c)?!1:(y.add(c),!0)})}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { RouteLine, RoutePoint } from "../types";
|
|
2
|
+
/**
|
|
3
|
+
* Ensures that `routeLines` run in the from→to direction.
|
|
4
|
+
*
|
|
5
|
+
* A* returns paths in target→source order. For rendering (arrow animation,
|
|
6
|
+
* route progress split) the lines must go from the origin to the destination.
|
|
7
|
+
*
|
|
8
|
+
* The function projects `from` and `to` onto `entireRouteLines` (the full
|
|
9
|
+
* multi-floor route) and reverses `routeLines` if `from` is closer to the
|
|
10
|
+
* polyline end than to its start.
|
|
11
|
+
*
|
|
12
|
+
* @param entireRouteLines Full route across all floors (used to determine direction).
|
|
13
|
+
* @param routeLines Lines to normalize (may be a floor-filtered subset).
|
|
14
|
+
* @param from Route origin (user-selected "from" point).
|
|
15
|
+
* @param to Route destination (user-selected "to" point).
|
|
16
|
+
* @returns Lines guaranteed to run from→to, or the original array unchanged.
|
|
17
|
+
*/
|
|
18
|
+
export declare function normalizeRouteDirection(entireRouteLines: RouteLine[], routeLines: RouteLine[], from: RoutePoint, to: RoutePoint): RouteLine[];
|
|
19
|
+
//# sourceMappingURL=normalizeRouteDirection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function l(n,r,d){let a=0,p=1/0,e=1/0;const s=d.reduce((c,t)=>c+t,0);for(let c=0;c<r.length;c++){const t=r[c],f=d[c];if(t.p0.layer!==n.layer){a+=f;continue}const o=t.p1.x-t.p0.x,y=t.p1.y-t.p0.y,h=o*o+y*y;if(h<1e-10){a+=f;continue}const i=((n.x-t.p0.x)*o+(n.y-t.p0.y)*y)/h,u=Math.max(0,Math.min(1,i)),x=t.p0.x+o*u,g=t.p0.y+y*u,m=Math.hypot(n.x-x,n.y-g);m<p&&(p=m,e=a+f*u),a+=f}return{found:e!==1/0,fromStart:e,total:s}}export function normalizeRouteDirection(n,r,d,a){if(!r.length)return r;const p=n.map(o=>Math.hypot(o.p1.x-o.p0.x,o.p1.y-o.p0.y)),e=l(d,n,p),s=e.found?e:l(a,n,p);if(!s.found)return r;const c=s.fromStart,t=s.total-s.fromStart;return(e.found?t<c:c<t)?r.slice().reverse().map(o=>({...o,p0:o.p1,p1:o.p0})):r}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Point, Line } from "simple-geometry";
|
|
2
|
+
/**
|
|
3
|
+
* Recursive De Casteljau interpolation for a Bézier curve.
|
|
4
|
+
* Returns the point on the curve defined by `controlPoints` at parameter `t` (0–1).
|
|
5
|
+
*/
|
|
6
|
+
export declare function bezierCurve(controlPoints: Point[], t: number): Point;
|
|
7
|
+
/**
|
|
8
|
+
* Splits a polyline (sequence of line segments) into evenly spaced points
|
|
9
|
+
* separated by `interval` units. Preserves the first and last points of the polyline.
|
|
10
|
+
*
|
|
11
|
+
* When segments meet at an angle, the remaining distance from the previous segment
|
|
12
|
+
* is projected onto the next segment direction (cosine correction) to maintain
|
|
13
|
+
* visually consistent spacing around corners.
|
|
14
|
+
*/
|
|
15
|
+
export declare function splitPolyLine(lines: Line[], interval: number): Point[];
|
|
16
|
+
//# sourceMappingURL=routeGeometry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export function bezierCurve(t,e){if(t.length===0)return{x:0,y:0};if(t.length===1)return t[0];const s=[];for(let n=0;n<t.length-1;n++){const c=(1-e)*t[n].x+e*t[n+1].x,x=(1-e)*t[n].y+e*t[n+1].y;s.push({x:c,y:x})}return bezierCurve(s,e)}export function splitPolyLine(t,e){if(t.length===0)return[];if(e<=0)return[t[0].p0,t[t.length-1].p1];const s=[];let n=0;for(let o=0;o<t.length;o++){const M=t[o],p=M.p0,l=M.p1,u=l.x-p.x,a=l.y-p.y,h=Math.sqrt(u*u+a*a);if(h===0)continue;const w=u/h,X=a/h;let r=0;for(;n+r*e<=h;){const f=n+r*e,g=p.x+w*f,i=p.y+X*f;s.push({x:g,y:i}),r++}const Y=n+(r-1)*e;let y=h-Y;if(y=Math.max(y,0),o<t.length-1){const f=t[o+1],g=f.p0,i=f.p1,d=i.x-g.x,D=i.y-g.y,L=Math.sqrt(d*d+D*D);if(L===0)n=0;else{const q=d/L,b=D/L,z=w*q+X*b,A=y*z;n=e-A}}else n=e-y;n=Math.max(n,0)}const c=t[0].p0;(s.length===0||s[0].x!==c.x||s[0].y!==c.y)&&s.unshift(c);const x=t[t.length-1].p1,m=s[s.length-1];return(m.x!==x.x||m.y!==x.y)&&s.push(x),s}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { GraphInstance, RoutePoint, RouteResult } from "../types";
|
|
2
|
+
/**
|
|
3
|
+
* Builds a route through an ordered sequence of pre-resolved candidate groups.
|
|
4
|
+
* Each group is a `RoutePoint[]` — the candidate graph points for one waypoint.
|
|
5
|
+
*
|
|
6
|
+
* Intermediate groups with no candidates (empty arrays) are silently skipped —
|
|
7
|
+
* adjacent groups are connected directly. This matches the legacy behavior
|
|
8
|
+
* where unreachable waypoints were omitted.
|
|
9
|
+
*/
|
|
10
|
+
export declare function buildMultiPointRoute(graph: GraphInstance, candidateGroups: RoutePoint[][]): RouteResult;
|
|
11
|
+
//# sourceMappingURL=buildMultiPointRoute.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{buildRoute as u}from"./buildRoute";import{emptyResult as o}from"./routeResult";export function buildMultiPointRoute(i,r){if(r.length<2)return o();const e=r.filter((t,l)=>l===0||l===r.length-1?!0:t.length>0);if(e.length<2)return o();if(e.length===2)return u(i,e[0],e[1]);const n=[];for(let t=0;t<e.length-1;t++)n.push(u(i,e[t],e[t+1]));n.reverse();const s=n.flatMap(t=>t.lines),f=n.reduce((t,l)=>t+l.totalDistance,0);return{lines:s,totalDistance:f}}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { GraphInstance, RouteResult, RoutePoint } from "../types";
|
|
2
|
+
/**
|
|
3
|
+
* Builds a route between two sets of candidate graph points.
|
|
4
|
+
*
|
|
5
|
+
* This is pure pathfinding — it does not resolve waypoints to graph points.
|
|
6
|
+
* Resolution is the caller's responsibility (see `getGraphLines`).
|
|
7
|
+
*/
|
|
8
|
+
export declare function buildRoute(graph: GraphInstance, fromCandidates: RoutePoint[], toCandidates: RoutePoint[]): RouteResult;
|
|
9
|
+
//# sourceMappingURL=buildRoute.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{findShortestPath as l}from"../graph/findShortestPath";import{emptyResult as n}from"./routeResult";export function buildRoute(i,e,r){if(!e.length||!r.length)return n();const t=l(i,e,r);return t?{lines:t.lines,totalDistance:t.distance}:n()}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Rect as SGRect } from "simple-geometry";
|
|
2
|
+
import type { GraphDataSource, GraphInstance, RoutePoint } from "../types";
|
|
3
|
+
/**
|
|
4
|
+
* Finds all graph endpoints (lineEnds) that fall inside the given containment rect.
|
|
5
|
+
* Uses simple-geometry's pointInsideRectangle for ~1% tolerance at boundaries,
|
|
6
|
+
* matching the legacy wayfinding behavior.
|
|
7
|
+
*
|
|
8
|
+
* The rect is a simple-geometry Rect (4-point polygon) — it may be rotated,
|
|
9
|
+
* not necessarily axis-aligned.
|
|
10
|
+
*/
|
|
11
|
+
export declare function findGraphPointsInRect(dataSource: GraphDataSource, containmentRect: SGRect, layer?: string): RoutePoint[];
|
|
12
|
+
/**
|
|
13
|
+
* Finds the nearest graph endpoint by Euclidean distance from an arbitrary point.
|
|
14
|
+
* Generalizes the old rect-based filtering for point-to-point routing.
|
|
15
|
+
*/
|
|
16
|
+
export declare function findNearestGraphPoint(graph: GraphInstance, point: {
|
|
17
|
+
x: number;
|
|
18
|
+
y: number;
|
|
19
|
+
layer?: string;
|
|
20
|
+
}): RoutePoint | null;
|
|
21
|
+
//# sourceMappingURL=findNearestGraphPoint.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{lineLength as a,pointInsideRectangle as c}from"simple-geometry";export function findGraphPointsInRect(i,n,t){return i.getLineEnds().filter(e=>(!t||e.layer===t)&&c(e,n))}export function findNearestGraphPoint(i,n){const t=i.dataSource.getLineEnds();let e=null,o=1/0;for(const r of t){if(n.layer&&r.layer!==n.layer)continue;const s=a(r,n);s<o&&(o=s,e=r)}return e}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { RouteWaypoint, RouteLine, GraphDataSource } from "../types";
|
|
2
|
+
/**
|
|
3
|
+
* High-level routing: resolves waypoints to route lines using a cached graph.
|
|
4
|
+
* Accepts `GraphDataSource` explicitly — no global configuration.
|
|
5
|
+
*
|
|
6
|
+
* Orchestrates two steps:
|
|
7
|
+
* 1. Resolve: waypoint → candidate graph points (via resolveWaypointCandidates)
|
|
8
|
+
* 2. Route: candidate points → shortest path via A* (via buildRoute / buildMultiPointRoute)
|
|
9
|
+
*
|
|
10
|
+
* Returns lines in **target→source** order — the convention used throughout
|
|
11
|
+
* the pipeline (see `aStarPathFinder.find()` JSDoc for rationale).
|
|
12
|
+
*/
|
|
13
|
+
export declare function getGraphLines(dataSource: GraphDataSource, from: RouteWaypoint, to: RouteWaypoint, onlyAccessible?: boolean, waypoints?: RouteWaypoint[]): RouteLine[];
|
|
14
|
+
//# sourceMappingURL=getGraphLines.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createGraphCache as f}from"../graph/graphCache";import{buildRoute as m}from"./buildRoute";import{buildMultiPointRoute as h}from"./buildMultiPointRoute";import{findGraphPointsInRect as p,findNearestGraphPoint as g}from"./findNearestGraphPoint";const C=f();function o(r,e){if(e.rect)return p(r.dataSource,e.rect,e.layer);const n=g(r,{x:e.x,y:e.y,layer:e.layer});return n?[n]:[]}export function getGraphLines(r,e,n,l=!1,a=[]){const u=performance.now(),t=C.getOrBuild(r,l),s=o(t,e),c=o(t,n),i=a.length>0?h(t,[s,...a.map(d=>o(t,d)),c]):m(t,s,c);return console.debug(`WF. Get graph lines: ${i.lines.length} ~ ${performance.now()-u}ms.`),i.lines}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{lineLength as n}from"simple-geometry";export function getRouteLength(t){return t.reduce((r,e)=>r+n(e.p0,e.p1),0)}
|