@stadiamaps/ferrostar 0.46.0 → 0.46.1
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/ferrostar.d.ts +459 -472
- package/ferrostar_bg.js +213 -226
- package/ferrostar_bg.wasm +0 -0
- package/package.json +1 -1
package/ferrostar.d.ts
CHANGED
|
@@ -1,136 +1,54 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
*/
|
|
6
|
-
export function locationSimulationFromPolyline(polyline: string, precision: number, resample_distance: number | null | undefined, bias: LocationBias): any;
|
|
7
|
-
/**
|
|
8
|
-
* JavaScript wrapper for `advance_location_simulation`.
|
|
9
|
-
*/
|
|
10
|
-
export function advanceLocationSimulation(state: any): any;
|
|
11
|
-
/**
|
|
12
|
-
* JavaScript wrapper for `location_simulation_from_route`.
|
|
13
|
-
*/
|
|
14
|
-
export function locationSimulationFromRoute(route: any, resample_distance: number | null | undefined, bias: LocationBias): any;
|
|
15
|
-
/**
|
|
16
|
-
* JavaScript wrapper for `location_simulation_from_coordinates`.
|
|
17
|
-
*/
|
|
18
|
-
export function locationSimulationFromCoordinates(coordinates: any, resample_distance: number | null | undefined, bias: LocationBias): any;
|
|
19
|
-
/**
|
|
20
|
-
* The broad class of maneuver to perform.
|
|
21
|
-
*
|
|
22
|
-
* This is usually combined with [`ManeuverModifier`] in [`VisualInstructionContent`].
|
|
23
|
-
*/
|
|
24
|
-
export type ManeuverType = "turn" | "new name" | "depart" | "arrive" | "merge" | "on ramp" | "off ramp" | "fork" | "end of road" | "continue" | "roundabout" | "rotary" | "roundabout turn" | "notification" | "exit roundabout" | "exit rotary";
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* The lane type blocked by the incident.
|
|
28
|
-
*/
|
|
29
|
-
export type BlockedLane = "left" | "left center" | "left turn lane" | "center" | "right" | "right center" | "right turn lane" | "hov";
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* A waypoint along a route.
|
|
33
|
-
*
|
|
34
|
-
* Within the context of Ferrostar, a route request consists of exactly one [`UserLocation`]
|
|
35
|
-
* and at least one [`Waypoint`]. The route starts from the user\'s location (which may
|
|
36
|
-
* contain other useful information like their current course for the [`crate::routing_adapters::RouteRequestGenerator`]
|
|
37
|
-
* to use) and proceeds through one or more waypoints.
|
|
38
|
-
*
|
|
39
|
-
* Waypoints are used during route calculation, are tracked throughout the lifecycle of a trip,
|
|
40
|
-
* and are used for recalculating when the user deviates from the expected route.
|
|
41
|
-
*
|
|
42
|
-
* Note that support for properties beyond basic geographic coordinates varies by routing engine.
|
|
4
|
+
* Details about congestion for an incident.
|
|
43
5
|
*/
|
|
44
|
-
export interface
|
|
45
|
-
coordinate: GeographicCoordinate;
|
|
46
|
-
kind: WaypointKind;
|
|
6
|
+
export interface Congestion {
|
|
47
7
|
/**
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
* Most users should prefer convenience functions like [`Waypoint::new_with_valhalla_properties`]
|
|
51
|
-
* (or, on platforms like iOS and Android with `UniFFI` bindings, [`crate::routing_adapters::valhalla::create_waypoint_with_valhalla_properties`]).
|
|
52
|
-
*
|
|
53
|
-
* # Format guidelines
|
|
8
|
+
* The level of congestion caused by the incident.
|
|
54
9
|
*
|
|
55
|
-
*
|
|
56
|
-
* However, to promote interoperability, all implementations in the Ferrostar codebase
|
|
57
|
-
* MUST use JSON.
|
|
10
|
+
* 0 = no congestion
|
|
58
11
|
*
|
|
59
|
-
*
|
|
60
|
-
* but because generics (i.e., becoming `Waypoint<T>`, where an example `T` is `ValhallaProperties`)
|
|
61
|
-
* would be way too painful, particularly for foreign code.
|
|
62
|
-
* Especially JavaScript.
|
|
12
|
+
* 100 = road closed
|
|
63
13
|
*
|
|
64
|
-
*
|
|
65
|
-
* implementations SHOULD document their level support for this,
|
|
66
|
-
* ideally with an exportable record type.
|
|
14
|
+
* Other values mean no congestion was calculated
|
|
67
15
|
*/
|
|
68
|
-
|
|
16
|
+
value: number;
|
|
69
17
|
}
|
|
70
18
|
|
|
71
19
|
/**
|
|
72
|
-
*
|
|
73
|
-
*
|
|
20
|
+
* The location of the user that is navigating.
|
|
21
|
+
*
|
|
22
|
+
* In addition to coordinates, this includes estimated accuracy and course information,
|
|
23
|
+
* which can influence navigation logic and UI.
|
|
24
|
+
*
|
|
25
|
+
* NOTE: Heading is absent on purpose.
|
|
26
|
+
* Heading updates are not related to a change in the user\'s location.
|
|
74
27
|
*/
|
|
75
|
-
export interface
|
|
76
|
-
|
|
77
|
-
* The full route geometry for this step.
|
|
78
|
-
*/
|
|
79
|
-
geometry: GeographicCoordinate[];
|
|
80
|
-
/**
|
|
81
|
-
* The distance, in meters, to travel along the route after the maneuver to reach the next step.
|
|
82
|
-
*/
|
|
83
|
-
distance: number;
|
|
84
|
-
/**
|
|
85
|
-
* The estimated duration, in seconds, that it will take to complete this step.
|
|
86
|
-
*/
|
|
87
|
-
duration: number;
|
|
88
|
-
/**
|
|
89
|
-
* The name of the road being traveled on (useful for certain UI styles).
|
|
90
|
-
*/
|
|
91
|
-
roadName: string | undefined;
|
|
92
|
-
/**
|
|
93
|
-
* A list of exits (name or number).
|
|
94
|
-
*/
|
|
95
|
-
exits: string[];
|
|
96
|
-
/**
|
|
97
|
-
* A description of the maneuver (ex: \"Turn wright onto main street\").
|
|
98
|
-
*
|
|
99
|
-
* Note for UI implementers: the context this appears in (or doesn\'t)
|
|
100
|
-
* depends somewhat on your use case and routing engine.
|
|
101
|
-
* For example, this field is useful as a written instruction in Valhalla.
|
|
102
|
-
*/
|
|
103
|
-
instruction: string;
|
|
104
|
-
/**
|
|
105
|
-
* A list of instructions for visual display (usually as banners) at specific points along the step.
|
|
106
|
-
*/
|
|
107
|
-
visualInstructions: VisualInstruction[];
|
|
108
|
-
/**
|
|
109
|
-
* A list of prompts to announce (via speech synthesis) at specific points along the step.
|
|
110
|
-
*/
|
|
111
|
-
spokenInstructions: SpokenInstruction[];
|
|
112
|
-
/**
|
|
113
|
-
* A list of json encoded strings representing annotations between each coordinate along the step.
|
|
114
|
-
*/
|
|
115
|
-
annotations: string[] | undefined;
|
|
28
|
+
export interface UserLocation {
|
|
29
|
+
coordinates: GeographicCoordinate;
|
|
116
30
|
/**
|
|
117
|
-
*
|
|
31
|
+
* The estimated accuracy of the coordinate (in meters)
|
|
118
32
|
*/
|
|
119
|
-
|
|
33
|
+
horizontalAccuracy: number;
|
|
34
|
+
courseOverGround: CourseOverGround | undefined;
|
|
35
|
+
timestamp: { secs_since_epoch: number; nanos_since_epoch: number };
|
|
36
|
+
speed: Speed | undefined;
|
|
120
37
|
}
|
|
121
38
|
|
|
122
39
|
/**
|
|
123
|
-
*
|
|
40
|
+
* The direction in which the user/device is observed to be traveling.
|
|
124
41
|
*/
|
|
125
|
-
export interface
|
|
42
|
+
export interface CourseOverGround {
|
|
126
43
|
/**
|
|
127
|
-
* The
|
|
44
|
+
* The direction in which the user\'s device is traveling, measured in clockwise degrees from
|
|
45
|
+
* true north (N = 0, E = 90, S = 180, W = 270).
|
|
128
46
|
*/
|
|
129
|
-
|
|
47
|
+
degrees: number;
|
|
130
48
|
/**
|
|
131
|
-
* The
|
|
49
|
+
* The accuracy of the course value, measured in degrees.
|
|
132
50
|
*/
|
|
133
|
-
|
|
51
|
+
accuracy: number | undefined;
|
|
134
52
|
}
|
|
135
53
|
|
|
136
54
|
/**
|
|
@@ -165,157 +83,154 @@ export interface SpokenInstruction {
|
|
|
165
83
|
}
|
|
166
84
|
|
|
167
85
|
/**
|
|
168
|
-
*
|
|
86
|
+
* An instruction for visual display (usually as banners) at a specific point along a [`RouteStep`].
|
|
169
87
|
*/
|
|
170
|
-
export interface
|
|
88
|
+
export interface VisualInstruction {
|
|
171
89
|
/**
|
|
172
|
-
* The
|
|
173
|
-
*
|
|
90
|
+
* The primary instruction content.
|
|
91
|
+
*
|
|
92
|
+
* This is usually given more visual weight.
|
|
174
93
|
*/
|
|
175
|
-
|
|
94
|
+
primaryContent: VisualInstructionContent;
|
|
176
95
|
/**
|
|
177
|
-
*
|
|
96
|
+
* Optional secondary instruction content.
|
|
178
97
|
*/
|
|
179
|
-
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
/**
|
|
183
|
-
* A geographic bounding box defined by its corners.
|
|
184
|
-
*/
|
|
185
|
-
export interface BoundingBox {
|
|
98
|
+
secondaryContent: VisualInstructionContent | undefined;
|
|
186
99
|
/**
|
|
187
|
-
*
|
|
100
|
+
* Optional sub-maneuver instruction content.
|
|
188
101
|
*/
|
|
189
|
-
|
|
102
|
+
subContent: VisualInstructionContent | undefined;
|
|
190
103
|
/**
|
|
191
|
-
*
|
|
104
|
+
* How far (in meters) from the upcoming maneuver the instruction should start being displayed
|
|
192
105
|
*/
|
|
193
|
-
|
|
106
|
+
triggerDistanceBeforeManeuver: number;
|
|
194
107
|
}
|
|
195
108
|
|
|
196
109
|
/**
|
|
197
|
-
* The
|
|
198
|
-
*
|
|
199
|
-
* In addition to coordinates, this includes estimated accuracy and course information,
|
|
200
|
-
* which can influence navigation logic and UI.
|
|
201
|
-
*
|
|
202
|
-
* NOTE: Heading is absent on purpose.
|
|
203
|
-
* Heading updates are not related to a change in the user\'s location.
|
|
110
|
+
* The content of a visual instruction.
|
|
204
111
|
*/
|
|
205
|
-
export interface
|
|
206
|
-
|
|
112
|
+
export interface LaneInfo {
|
|
113
|
+
active: boolean;
|
|
114
|
+
directions: string[];
|
|
115
|
+
activeDirection: string | undefined;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* The lane type blocked by the incident.
|
|
120
|
+
*/
|
|
121
|
+
export type BlockedLane = "left" | "left center" | "left turn lane" | "center" | "right" | "right center" | "right turn lane" | "hov";
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* The speed of the user from the location provider.
|
|
125
|
+
*/
|
|
126
|
+
export interface Speed {
|
|
207
127
|
/**
|
|
208
|
-
* The
|
|
128
|
+
* The user\'s speed in meters per second.
|
|
209
129
|
*/
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
130
|
+
value: number;
|
|
131
|
+
/**
|
|
132
|
+
* The accuracy of the speed value, measured in meters per second.
|
|
133
|
+
*/
|
|
134
|
+
accuracy: number | undefined;
|
|
214
135
|
}
|
|
215
136
|
|
|
216
137
|
/**
|
|
217
|
-
*
|
|
138
|
+
* An incident affecting the free flow of traffic,
|
|
139
|
+
* such as constructions, accidents, and congestion.
|
|
218
140
|
*/
|
|
219
|
-
export interface
|
|
141
|
+
export interface Incident {
|
|
220
142
|
/**
|
|
221
|
-
*
|
|
143
|
+
* A unique identifier for the incident.
|
|
222
144
|
*/
|
|
223
|
-
|
|
145
|
+
id: string;
|
|
224
146
|
/**
|
|
225
|
-
*
|
|
147
|
+
* The type of incident.
|
|
226
148
|
*/
|
|
227
|
-
|
|
149
|
+
incidentType: IncidentType;
|
|
228
150
|
/**
|
|
229
|
-
* A
|
|
151
|
+
* A short description of the incident.
|
|
230
152
|
*/
|
|
231
|
-
|
|
153
|
+
description: string | undefined;
|
|
232
154
|
/**
|
|
233
|
-
*
|
|
155
|
+
* A longer description of the incident.
|
|
156
|
+
*/
|
|
157
|
+
longDescription: string | undefined;
|
|
158
|
+
/**
|
|
159
|
+
* The time at which the incident was *last* created.
|
|
234
160
|
*
|
|
235
|
-
*
|
|
236
|
-
* (as if you had gone straight, apart from the detour)
|
|
237
|
-
* would be an exit angle of 180 degrees.
|
|
161
|
+
* NB: This can change throughout the life of the incident.
|
|
238
162
|
*/
|
|
239
|
-
|
|
163
|
+
creationTime: Date | null;
|
|
240
164
|
/**
|
|
241
|
-
*
|
|
165
|
+
* The time at which the incident started or is expected to start (ex: planned closure).
|
|
242
166
|
*/
|
|
243
|
-
|
|
167
|
+
startTime: Date | null;
|
|
244
168
|
/**
|
|
245
|
-
* The
|
|
169
|
+
* The time at which the incident ended or is expected to end.
|
|
246
170
|
*/
|
|
247
|
-
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
/**
|
|
251
|
-
* Describes characteristics of the waypoint for routing purposes.
|
|
252
|
-
*/
|
|
253
|
-
export type WaypointKind = "Break" | "Via";
|
|
254
|
-
|
|
255
|
-
/**
|
|
256
|
-
* The content of a visual instruction.
|
|
257
|
-
*/
|
|
258
|
-
export interface LaneInfo {
|
|
259
|
-
active: boolean;
|
|
260
|
-
directions: string[];
|
|
261
|
-
activeDirection: string | undefined;
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
/**
|
|
265
|
-
* Information describing the series of steps needed to travel between two or more points.
|
|
266
|
-
*
|
|
267
|
-
* NOTE: This type is unstable and is still under active development and should be
|
|
268
|
-
* considered unstable.
|
|
269
|
-
*/
|
|
270
|
-
export interface Route {
|
|
271
|
-
geometry: GeographicCoordinate[];
|
|
272
|
-
bbox: BoundingBox;
|
|
171
|
+
endTime: Date | null;
|
|
273
172
|
/**
|
|
274
|
-
* The
|
|
173
|
+
* The level of impact to traffic.
|
|
275
174
|
*/
|
|
276
|
-
|
|
175
|
+
impact: Impact | undefined;
|
|
277
176
|
/**
|
|
278
|
-
*
|
|
279
|
-
* Note that this is distinct from the *geometry* which includes all points visited.
|
|
280
|
-
* A waypoint represents a start/end point for a route leg.
|
|
177
|
+
* Lanes which are blocked by the incident.
|
|
281
178
|
*/
|
|
282
|
-
|
|
283
|
-
steps: RouteStep[];
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
/**
|
|
287
|
-
* Additional information to further specify a [`ManeuverType`].
|
|
288
|
-
*/
|
|
289
|
-
export type ManeuverModifier = "uturn" | "sharp right" | "right" | "slight right" | "straight" | "slight left" | "left" | "sharp left";
|
|
290
|
-
|
|
291
|
-
/**
|
|
292
|
-
* Details about congestion for an incident.
|
|
293
|
-
*/
|
|
294
|
-
export interface Congestion {
|
|
179
|
+
lanesBlocked: BlockedLane[];
|
|
295
180
|
/**
|
|
296
|
-
*
|
|
297
|
-
*
|
|
298
|
-
* 0 = no congestion
|
|
299
|
-
*
|
|
300
|
-
* 100 = road closed
|
|
301
|
-
*
|
|
302
|
-
* Other values mean no congestion was calculated
|
|
181
|
+
* Info about the amount of congestion on the road around the incident.
|
|
303
182
|
*/
|
|
304
|
-
|
|
183
|
+
congestion: Congestion | undefined;
|
|
184
|
+
/**
|
|
185
|
+
* Is the road completely closed?
|
|
186
|
+
*/
|
|
187
|
+
closed: boolean | undefined;
|
|
188
|
+
/**
|
|
189
|
+
* The index into the [`RouteStep`] geometry where the incident starts.
|
|
190
|
+
*/
|
|
191
|
+
geometryIndexStart: number;
|
|
192
|
+
/**
|
|
193
|
+
* The index into the [`RouteStep`] geometry where the incident ends.
|
|
194
|
+
*/
|
|
195
|
+
geometryIndexEnd: number | undefined;
|
|
196
|
+
/**
|
|
197
|
+
* Optional additional information about the type of incident (free-form text).
|
|
198
|
+
*/
|
|
199
|
+
subType: string | undefined;
|
|
200
|
+
/**
|
|
201
|
+
* Optional descriptions about the type of incident (free-form text).
|
|
202
|
+
*/
|
|
203
|
+
subTypeDescription: string | undefined;
|
|
204
|
+
/**
|
|
205
|
+
* The ISO 3166-1 alpha-2 code of the country in which the incident occurs.
|
|
206
|
+
*/
|
|
207
|
+
iso31661Alpha2: string | undefined;
|
|
208
|
+
/**
|
|
209
|
+
* The ISO 3166-1 alpha-3 code of the country in which the incident occurs.
|
|
210
|
+
*/
|
|
211
|
+
iso31661Alpha3: string | undefined;
|
|
212
|
+
/**
|
|
213
|
+
* A list of road names affected by the incident.
|
|
214
|
+
*/
|
|
215
|
+
affectedRoadNames: string[];
|
|
216
|
+
/**
|
|
217
|
+
* The bounding box over which the incident occurs.
|
|
218
|
+
*/
|
|
219
|
+
bbox: BoundingBox | undefined;
|
|
305
220
|
}
|
|
306
221
|
|
|
307
222
|
/**
|
|
308
|
-
*
|
|
223
|
+
* A geographic coordinate in WGS84.
|
|
309
224
|
*/
|
|
310
|
-
export interface
|
|
225
|
+
export interface GeographicCoordinate {
|
|
311
226
|
/**
|
|
312
|
-
* The
|
|
227
|
+
* The latitude (in degrees).
|
|
313
228
|
*/
|
|
314
|
-
|
|
229
|
+
lat: number;
|
|
315
230
|
/**
|
|
316
|
-
* The
|
|
231
|
+
* The Longitude (in degrees).
|
|
317
232
|
*/
|
|
318
|
-
|
|
233
|
+
lng: number;
|
|
319
234
|
}
|
|
320
235
|
|
|
321
236
|
/**
|
|
@@ -323,120 +238,234 @@ export interface Speed {
|
|
|
323
238
|
*/
|
|
324
239
|
export type IncidentType = "accident" | "congestion" | "construction" | "disabled_vehicle" | "lane_restriction" | "mass_transit" | "miscellaneous" | "other_news" | "planned_event" | "road_closure" | "road_hazard" | "weather";
|
|
325
240
|
|
|
241
|
+
/**
|
|
242
|
+
* Additional information to further specify a [`ManeuverType`].
|
|
243
|
+
*/
|
|
244
|
+
export type ManeuverModifier = "uturn" | "sharp right" | "right" | "slight right" | "straight" | "slight left" | "left" | "sharp left";
|
|
245
|
+
|
|
326
246
|
/**
|
|
327
247
|
* The impact of the incident that has occurred.
|
|
328
248
|
*/
|
|
329
249
|
export type Impact = "unknown" | "critical" | "major" | "minor" | "low";
|
|
330
250
|
|
|
331
251
|
/**
|
|
332
|
-
*
|
|
252
|
+
* A waypoint along a route.
|
|
253
|
+
*
|
|
254
|
+
* Within the context of Ferrostar, a route request consists of exactly one [`UserLocation`]
|
|
255
|
+
* and at least one [`Waypoint`]. The route starts from the user\'s location (which may
|
|
256
|
+
* contain other useful information like their current course for the [`crate::routing_adapters::RouteRequestGenerator`]
|
|
257
|
+
* to use) and proceeds through one or more waypoints.
|
|
258
|
+
*
|
|
259
|
+
* Waypoints are used during route calculation, are tracked throughout the lifecycle of a trip,
|
|
260
|
+
* and are used for recalculating when the user deviates from the expected route.
|
|
261
|
+
*
|
|
262
|
+
* Note that support for properties beyond basic geographic coordinates varies by routing engine.
|
|
333
263
|
*/
|
|
334
|
-
export interface
|
|
264
|
+
export interface Waypoint {
|
|
265
|
+
coordinate: GeographicCoordinate;
|
|
266
|
+
kind: WaypointKind;
|
|
335
267
|
/**
|
|
336
|
-
*
|
|
268
|
+
* Optional additional properties that will be passed on to the [`crate::routing_adapters::RouteRequestGenerator`].
|
|
337
269
|
*
|
|
338
|
-
*
|
|
270
|
+
* Most users should prefer convenience functions like [`Waypoint::new_with_valhalla_properties`]
|
|
271
|
+
* (or, on platforms like iOS and Android with `UniFFI` bindings, [`crate::routing_adapters::valhalla::create_waypoint_with_valhalla_properties`]).
|
|
272
|
+
*
|
|
273
|
+
* # Format guidelines
|
|
274
|
+
*
|
|
275
|
+
* This MAY be any format agreed upon by both the request generator and response parser.
|
|
276
|
+
* However, to promote interoperability, all implementations in the Ferrostar codebase
|
|
277
|
+
* MUST use JSON.
|
|
278
|
+
*
|
|
279
|
+
* We selected JSON is selected not because it is good,
|
|
280
|
+
* but because generics (i.e., becoming `Waypoint<T>`, where an example `T` is `ValhallaProperties`)
|
|
281
|
+
* would be way too painful, particularly for foreign code.
|
|
282
|
+
* Especially JavaScript.
|
|
283
|
+
*
|
|
284
|
+
* In any case, [`crate::routing_adapters::RouteRequestGenerator`] and [`crate::routing_adapters::RouteResponseParser`]
|
|
285
|
+
* implementations SHOULD document their level support for this,
|
|
286
|
+
* ideally with an exportable record type.
|
|
339
287
|
*/
|
|
340
|
-
|
|
288
|
+
properties: number[] | undefined;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
/**
|
|
292
|
+
* The content of a visual instruction.
|
|
293
|
+
*/
|
|
294
|
+
export interface VisualInstructionContent {
|
|
341
295
|
/**
|
|
342
|
-
*
|
|
296
|
+
* The text to display.
|
|
343
297
|
*/
|
|
344
|
-
|
|
298
|
+
text: string;
|
|
345
299
|
/**
|
|
346
|
-
*
|
|
300
|
+
* A standardized maneuver type (if any).
|
|
347
301
|
*/
|
|
348
|
-
|
|
302
|
+
maneuverType: ManeuverType | undefined;
|
|
349
303
|
/**
|
|
350
|
-
*
|
|
304
|
+
* A standardized maneuver modifier (if any).
|
|
351
305
|
*/
|
|
352
|
-
|
|
353
|
-
}
|
|
354
|
-
|
|
355
|
-
/**
|
|
356
|
-
* An incident affecting the free flow of traffic,
|
|
357
|
-
* such as constructions, accidents, and congestion.
|
|
358
|
-
*/
|
|
359
|
-
export interface Incident {
|
|
306
|
+
maneuverModifier: ManeuverModifier | undefined;
|
|
360
307
|
/**
|
|
361
|
-
*
|
|
308
|
+
* If applicable, the number of degrees you need to go around the roundabout before exiting.
|
|
309
|
+
*
|
|
310
|
+
* For example, entering and exiting the roundabout in the same direction of travel
|
|
311
|
+
* (as if you had gone straight, apart from the detour)
|
|
312
|
+
* would be an exit angle of 180 degrees.
|
|
362
313
|
*/
|
|
363
|
-
|
|
314
|
+
roundaboutExitDegrees: number | undefined;
|
|
364
315
|
/**
|
|
365
|
-
*
|
|
316
|
+
* Detailed information about the lanes. This is typically only present in sub-maneuver instructions.
|
|
366
317
|
*/
|
|
367
|
-
|
|
318
|
+
laneInfo: LaneInfo[] | undefined;
|
|
368
319
|
/**
|
|
369
|
-
*
|
|
320
|
+
* The exit number (or similar identifier like \"8B\").
|
|
370
321
|
*/
|
|
371
|
-
|
|
322
|
+
exitNumbers: string[];
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
/**
|
|
326
|
+
* Describes characteristics of the waypoint for routing purposes.
|
|
327
|
+
*/
|
|
328
|
+
export type WaypointKind = "Break" | "Via";
|
|
329
|
+
|
|
330
|
+
/**
|
|
331
|
+
* A maneuver (such as a turn or merge) followed by travel of a certain distance until reaching
|
|
332
|
+
* the next step.
|
|
333
|
+
*/
|
|
334
|
+
export interface RouteStep {
|
|
372
335
|
/**
|
|
373
|
-
*
|
|
336
|
+
* The full route geometry for this step.
|
|
374
337
|
*/
|
|
375
|
-
|
|
338
|
+
geometry: GeographicCoordinate[];
|
|
376
339
|
/**
|
|
377
|
-
* The
|
|
378
|
-
*
|
|
379
|
-
* NB: This can change throughout the life of the incident.
|
|
340
|
+
* The distance, in meters, to travel along the route after the maneuver to reach the next step.
|
|
380
341
|
*/
|
|
381
|
-
|
|
342
|
+
distance: number;
|
|
382
343
|
/**
|
|
383
|
-
* The
|
|
344
|
+
* The estimated duration, in seconds, that it will take to complete this step.
|
|
384
345
|
*/
|
|
385
|
-
|
|
346
|
+
duration: number;
|
|
386
347
|
/**
|
|
387
|
-
* The
|
|
348
|
+
* The name of the road being traveled on (useful for certain UI styles).
|
|
388
349
|
*/
|
|
389
|
-
|
|
350
|
+
roadName: string | undefined;
|
|
390
351
|
/**
|
|
391
|
-
*
|
|
352
|
+
* A list of exits (name or number).
|
|
392
353
|
*/
|
|
393
|
-
|
|
354
|
+
exits: string[];
|
|
394
355
|
/**
|
|
395
|
-
*
|
|
356
|
+
* A description of the maneuver (ex: \"Turn wright onto main street\").
|
|
357
|
+
*
|
|
358
|
+
* Note for UI implementers: the context this appears in (or doesn\'t)
|
|
359
|
+
* depends somewhat on your use case and routing engine.
|
|
360
|
+
* For example, this field is useful as a written instruction in Valhalla.
|
|
396
361
|
*/
|
|
397
|
-
|
|
362
|
+
instruction: string;
|
|
398
363
|
/**
|
|
399
|
-
*
|
|
364
|
+
* A list of instructions for visual display (usually as banners) at specific points along the step.
|
|
400
365
|
*/
|
|
401
|
-
|
|
366
|
+
visualInstructions: VisualInstruction[];
|
|
402
367
|
/**
|
|
403
|
-
*
|
|
368
|
+
* A list of prompts to announce (via speech synthesis) at specific points along the step.
|
|
404
369
|
*/
|
|
405
|
-
|
|
370
|
+
spokenInstructions: SpokenInstruction[];
|
|
406
371
|
/**
|
|
407
|
-
*
|
|
372
|
+
* A list of json encoded strings representing annotations between each coordinate along the step.
|
|
408
373
|
*/
|
|
409
|
-
|
|
374
|
+
annotations: string[] | undefined;
|
|
410
375
|
/**
|
|
411
|
-
*
|
|
376
|
+
* A list of incidents that occur along the step.
|
|
412
377
|
*/
|
|
413
|
-
|
|
378
|
+
incidents: Incident[];
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
/**
|
|
382
|
+
* The broad class of maneuver to perform.
|
|
383
|
+
*
|
|
384
|
+
* This is usually combined with [`ManeuverModifier`] in [`VisualInstructionContent`].
|
|
385
|
+
*/
|
|
386
|
+
export type ManeuverType = "turn" | "new name" | "depart" | "arrive" | "merge" | "on ramp" | "off ramp" | "fork" | "end of road" | "continue" | "roundabout" | "rotary" | "roundabout turn" | "notification" | "exit roundabout" | "exit rotary";
|
|
387
|
+
|
|
388
|
+
/**
|
|
389
|
+
* Information describing the series of steps needed to travel between two or more points.
|
|
390
|
+
*
|
|
391
|
+
* NOTE: This type is unstable and is still under active development and should be
|
|
392
|
+
* considered unstable.
|
|
393
|
+
*/
|
|
394
|
+
export interface Route {
|
|
395
|
+
geometry: GeographicCoordinate[];
|
|
396
|
+
bbox: BoundingBox;
|
|
414
397
|
/**
|
|
415
|
-
*
|
|
398
|
+
* The total route distance, in meters.
|
|
416
399
|
*/
|
|
417
|
-
|
|
400
|
+
distance: number;
|
|
418
401
|
/**
|
|
419
|
-
*
|
|
402
|
+
* The ordered list of waypoints to visit, including the starting point.
|
|
403
|
+
* Note that this is distinct from the *geometry* which includes all points visited.
|
|
404
|
+
* A waypoint represents a start/end point for a route leg.
|
|
420
405
|
*/
|
|
421
|
-
|
|
406
|
+
waypoints: Waypoint[];
|
|
407
|
+
steps: RouteStep[];
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
/**
|
|
411
|
+
* A geographic bounding box defined by its corners.
|
|
412
|
+
*/
|
|
413
|
+
export interface BoundingBox {
|
|
422
414
|
/**
|
|
423
|
-
* The
|
|
415
|
+
* The southwest corner of the bounding box.
|
|
424
416
|
*/
|
|
425
|
-
|
|
417
|
+
sw: GeographicCoordinate;
|
|
426
418
|
/**
|
|
427
|
-
* The
|
|
419
|
+
* The northeast corner of the bounding box.
|
|
428
420
|
*/
|
|
429
|
-
|
|
421
|
+
ne: GeographicCoordinate;
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
/**
|
|
425
|
+
* The current state of the simulation.
|
|
426
|
+
*/
|
|
427
|
+
export interface LocationSimulationState {
|
|
428
|
+
current_location: UserLocation;
|
|
429
|
+
remaining_locations: GeographicCoordinate[];
|
|
430
|
+
bias: LocationBias;
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
export type SimulationError = { PolylineError: { error: string } } | "NotEnoughPoints";
|
|
434
|
+
|
|
435
|
+
/**
|
|
436
|
+
* Controls how simulated locations deviate from the actual route line.
|
|
437
|
+
* This simulates real-world GPS behavior where readings often have systematic bias.
|
|
438
|
+
*/
|
|
439
|
+
export type LocationBias = { Left: number } | { Right: number } | { Random: number } | "None";
|
|
440
|
+
|
|
441
|
+
/**
|
|
442
|
+
* Configurations for built-in route providers.
|
|
443
|
+
*/
|
|
444
|
+
export type WellKnownRouteProvider = { Valhalla: { endpointUrl: string; profile: string; optionsJson?: string | undefined } } | { GraphHopper: { endpointUrl: string; profile: string; locale: string; voiceUnits: GraphHopperVoiceUnits; optionsJson?: string | undefined } };
|
|
445
|
+
|
|
446
|
+
/**
|
|
447
|
+
* An event that occurs during navigation.
|
|
448
|
+
*
|
|
449
|
+
* This is used for the optional session recording / telemetry.
|
|
450
|
+
*/
|
|
451
|
+
export interface NavigationRecordingEvent {
|
|
430
452
|
/**
|
|
431
|
-
*
|
|
453
|
+
* The timestamp of the event in milliseconds since Jan 1, 1970 UTC.
|
|
432
454
|
*/
|
|
433
|
-
|
|
455
|
+
timestamp: number;
|
|
434
456
|
/**
|
|
435
|
-
*
|
|
457
|
+
* Data associated with the event.
|
|
436
458
|
*/
|
|
437
|
-
|
|
459
|
+
event_data: NavigationRecordingEventData;
|
|
438
460
|
}
|
|
439
461
|
|
|
462
|
+
/**
|
|
463
|
+
* The event type.
|
|
464
|
+
*
|
|
465
|
+
* For full replayability, we record things like rerouting, and not just location updates.
|
|
466
|
+
*/
|
|
467
|
+
export type NavigationRecordingEventData = { StateUpdate: { trip_state: TripState; step_advance_condition: SerializableStepAdvanceCondition } } | { RouteUpdate: { route: Route } };
|
|
468
|
+
|
|
440
469
|
/**
|
|
441
470
|
* Waypoint properties parsed from an OSRM-compatible server response.
|
|
442
471
|
*
|
|
@@ -458,66 +487,134 @@ export interface OsrmWaypointProperties {
|
|
|
458
487
|
}
|
|
459
488
|
|
|
460
489
|
/**
|
|
461
|
-
*
|
|
490
|
+
* Status information that describes whether the user is proceeding according to the route or not.
|
|
462
491
|
*
|
|
463
|
-
*
|
|
492
|
+
* Note that the name is intentionally a bit generic to allow for expansion of other states.
|
|
493
|
+
* For example, we could conceivably add a \"wrong way\" status in the future.
|
|
464
494
|
*/
|
|
465
|
-
export type
|
|
495
|
+
export type RouteDeviation = "NoDeviation" | { OffRoute: { deviationFromRouteLine: number } };
|
|
466
496
|
|
|
467
497
|
/**
|
|
468
|
-
*
|
|
498
|
+
* Determines if the user has deviated from the expected route.
|
|
469
499
|
*/
|
|
470
|
-
export
|
|
500
|
+
export type RouteDeviationTracking = "None" | { StaticThreshold: { minimumHorizontalAccuracy: number; maxAcceptableDeviation: number } };
|
|
501
|
+
|
|
502
|
+
export type SerializableStepAdvanceCondition = "Manual" | { DistanceToEndOfStep: { distance: number; minimumHorizontalAccuracy: number } } | { DistanceFromStep: { distance: number; minimumHorizontalAccuracy: number; calculateWhileOffRoute: boolean } } | { DistanceEntryExit: { distanceToEndOfStep: number; distanceAfterEndStep: number; minimumHorizontalAccuracy: number; hasReachedEndOfCurrentStep: boolean } } | { DistanceEntryAndSnappedExit: { distanceToEndOfStep: number; distanceAfterEndStep: number; minimumHorizontalAccuracy: number; hasReachedEndOfCurrentStep: boolean } } | { OrAdvanceConditions: { conditions: SerializableStepAdvanceCondition[] } } | { AndAdvanceConditions: { conditions: SerializableStepAdvanceCondition[] } };
|
|
503
|
+
|
|
504
|
+
export type GraphHopperVoiceUnits = "metric" | "imperial";
|
|
505
|
+
|
|
506
|
+
/**
|
|
507
|
+
* The state of a navigation session.
|
|
508
|
+
*
|
|
509
|
+
* This is produced by [`NavigationController`](super::NavigationController) methods
|
|
510
|
+
* including [`get_initial_state`](super::NavigationController::get_initial_state)
|
|
511
|
+
* and [`update_user_location`](super::NavigationController::update_user_location).
|
|
512
|
+
*/
|
|
513
|
+
export type TripState = { Idle: { user_location: UserLocation | undefined } } | { Navigating: { currentStepGeometryIndex: number | undefined; userLocation: UserLocation; snappedUserLocation: UserLocation; remainingSteps: RouteStep[]; remainingWaypoints: Waypoint[]; progress: TripProgress; summary: TripSummary; deviation: RouteDeviation; visualInstruction: VisualInstruction | undefined; spokenInstruction: SpokenInstruction | undefined; annotationJson: string | undefined } } | { Complete: { user_location: UserLocation; summary: TripSummary } };
|
|
514
|
+
|
|
515
|
+
/**
|
|
516
|
+
* High-level state describing progress through a route.
|
|
517
|
+
*/
|
|
518
|
+
export interface TripProgress {
|
|
471
519
|
/**
|
|
472
|
-
*
|
|
520
|
+
* The distance to the next maneuver, in meters.
|
|
473
521
|
*/
|
|
474
|
-
|
|
522
|
+
distanceToNextManeuver: number;
|
|
475
523
|
/**
|
|
476
|
-
*
|
|
524
|
+
* The total distance remaining in the trip, in meters.
|
|
525
|
+
*
|
|
526
|
+
* This is the sum of the distance remaining in the current step and the distance remaining in all subsequent steps.
|
|
477
527
|
*/
|
|
478
|
-
|
|
528
|
+
distanceRemaining: number;
|
|
479
529
|
/**
|
|
480
|
-
*
|
|
530
|
+
* The total duration remaining in the trip, in seconds.
|
|
481
531
|
*/
|
|
482
|
-
|
|
532
|
+
durationRemaining: number;
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
/**
|
|
536
|
+
* Information pertaining to the user\'s full navigation trip. This includes
|
|
537
|
+
* simple stats like total duration and distance.
|
|
538
|
+
*/
|
|
539
|
+
export interface TripSummary {
|
|
483
540
|
/**
|
|
484
|
-
*
|
|
541
|
+
* The total raw distance traveled in the trip, in meters.
|
|
485
542
|
*/
|
|
486
|
-
|
|
543
|
+
distanceTraveled: number;
|
|
544
|
+
/**
|
|
545
|
+
* The total snapped distance traveled in the trip, in meters.
|
|
546
|
+
*/
|
|
547
|
+
snappedDistanceTraveled: number;
|
|
548
|
+
/**
|
|
549
|
+
* When the trip was started.
|
|
550
|
+
*/
|
|
551
|
+
startedAt: Date;
|
|
552
|
+
/**
|
|
553
|
+
* When the trip was completed or canceled.
|
|
554
|
+
*/
|
|
555
|
+
endedAt: Date | null;
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
/**
|
|
559
|
+
* Controls when a waypoint should be marked as complete.
|
|
560
|
+
*
|
|
561
|
+
* While a route may consist of thousands of points, waypoints are special.
|
|
562
|
+
* A simple trip will have only one waypoint: the final destination.
|
|
563
|
+
* A more complex trip may have several intermediate stops.
|
|
564
|
+
* Just as the navigation state keeps track of which steps remain in the route,
|
|
565
|
+
* it also tracks which waypoints are still remaining.
|
|
566
|
+
*
|
|
567
|
+
* Tracking waypoints enables Ferrostar to reroute users when they stray off the route line.
|
|
568
|
+
* The waypoint advance mode specifies how the framework decides
|
|
569
|
+
* that a waypoint has been visited (and is removed from the list).
|
|
570
|
+
*
|
|
571
|
+
* NOTE: Advancing to the next *step* and advancing to the next *waypoint*
|
|
572
|
+
* are separate processes.
|
|
573
|
+
* This will not normally cause any issues, but keep in mind that
|
|
574
|
+
* manually advancing to the next step does not *necessarily* imply
|
|
575
|
+
* that the waypoint will be marked as complete!
|
|
576
|
+
*/
|
|
577
|
+
export type WaypointAdvanceMode = { WaypointWithinRange: number } | { WaypointAlongAdvancingStep: number };
|
|
578
|
+
|
|
579
|
+
export interface SerializableNavigationControllerConfig {
|
|
487
580
|
/**
|
|
488
|
-
*
|
|
581
|
+
* Configures when navigation advances to the next waypoint in the route.
|
|
489
582
|
*/
|
|
490
|
-
|
|
583
|
+
waypointAdvance: WaypointAdvanceMode;
|
|
491
584
|
/**
|
|
492
|
-
*
|
|
585
|
+
* Configures when navigation advances to the next step in the route.
|
|
493
586
|
*/
|
|
494
|
-
|
|
587
|
+
stepAdvanceCondition: SerializableStepAdvanceCondition;
|
|
495
588
|
/**
|
|
496
|
-
*
|
|
589
|
+
* A special advance condition used for the final 2 route steps (last and arrival).
|
|
590
|
+
*
|
|
591
|
+
* This exists because several of our step advance conditions require entry and
|
|
592
|
+
* exit from a step\'s geometry. The end of the route/arrival doesn\'t always accommodate
|
|
593
|
+
* the expected location updates for the core step advance condition.
|
|
497
594
|
*/
|
|
498
|
-
|
|
595
|
+
arrivalStepAdvanceCondition: SerializableStepAdvanceCondition;
|
|
499
596
|
/**
|
|
500
|
-
*
|
|
597
|
+
* Configures when the user is deemed to be off course.
|
|
598
|
+
*
|
|
599
|
+
* NOTE: This is distinct from the action that is taken.
|
|
600
|
+
* It is only the determination that the user has deviated from the expected route.
|
|
501
601
|
*/
|
|
502
|
-
|
|
602
|
+
routeDeviationTracking: RouteDeviationTracking;
|
|
503
603
|
/**
|
|
504
|
-
*
|
|
505
|
-
* It will set `search_cutoff` to a default value of 300 meters if no cutoff value is passed.
|
|
506
|
-
* Additionally, if a `search_cutoff` is passed, it will be clamped to 1000 meters.
|
|
604
|
+
* Configures how the heading component of the snapped location is reported in [`TripState`].
|
|
507
605
|
*/
|
|
508
|
-
|
|
606
|
+
snappedLocationCourseFiltering: CourseFiltering;
|
|
509
607
|
}
|
|
510
608
|
|
|
511
609
|
/**
|
|
512
|
-
*
|
|
513
|
-
*
|
|
514
|
-
* Examples:
|
|
515
|
-
* - Germany drives on the right side of the road. A value of `same` will only allow leaving
|
|
516
|
-
* or arriving at a location such that it is on your right.
|
|
517
|
-
* - Australia drives on the left side of the road. Passing a value of `same` will only allow
|
|
518
|
-
* leaving or arriving at a location such that it is on your left.
|
|
610
|
+
* Controls filtering/post-processing of user course by the [`NavigationController`].
|
|
519
611
|
*/
|
|
520
|
-
export type
|
|
612
|
+
export type CourseFiltering = "SnapToRoute" | "Raw";
|
|
613
|
+
|
|
614
|
+
export interface SerializableNavState {
|
|
615
|
+
tripState: TripState;
|
|
616
|
+
stepAdvanceCondition: SerializableStepAdvanceCondition;
|
|
617
|
+
}
|
|
521
618
|
|
|
522
619
|
/**
|
|
523
620
|
* Waypoint properties supported by Valhalla servers.
|
|
@@ -617,186 +714,69 @@ export interface ValhallaWaypointProperties {
|
|
|
617
714
|
search_filter: ValhallaLocationSearchFilter | undefined;
|
|
618
715
|
}
|
|
619
716
|
|
|
620
|
-
export type SerializableStepAdvanceCondition = "Manual" | { DistanceToEndOfStep: { distance: number; minimumHorizontalAccuracy: number } } | { DistanceFromStep: { distance: number; minimumHorizontalAccuracy: number; calculateWhileOffRoute: boolean } } | { DistanceEntryExit: { distanceToEndOfStep: number; distanceAfterEndStep: number; minimumHorizontalAccuracy: number; hasReachedEndOfCurrentStep: boolean } } | { DistanceEntryAndSnappedExit: { distanceToEndOfStep: number; distanceAfterEndStep: number; minimumHorizontalAccuracy: number; hasReachedEndOfCurrentStep: boolean } } | { OrAdvanceConditions: { conditions: SerializableStepAdvanceCondition[] } } | { AndAdvanceConditions: { conditions: SerializableStepAdvanceCondition[] } };
|
|
621
|
-
|
|
622
717
|
/**
|
|
623
|
-
*
|
|
624
|
-
* simple stats like total duration and distance.
|
|
718
|
+
* A set of optional filters to exclude candidate edges based on their attributes.
|
|
625
719
|
*/
|
|
626
|
-
export interface
|
|
627
|
-
/**
|
|
628
|
-
* The total raw distance traveled in the trip, in meters.
|
|
629
|
-
*/
|
|
630
|
-
distanceTraveled: number;
|
|
631
|
-
/**
|
|
632
|
-
* The total snapped distance traveled in the trip, in meters.
|
|
633
|
-
*/
|
|
634
|
-
snappedDistanceTraveled: number;
|
|
635
|
-
/**
|
|
636
|
-
* When the trip was started.
|
|
637
|
-
*/
|
|
638
|
-
startedAt: Date;
|
|
720
|
+
export interface ValhallaLocationSearchFilter {
|
|
639
721
|
/**
|
|
640
|
-
*
|
|
722
|
+
* Whether to exclude roads marked as tunnels.
|
|
641
723
|
*/
|
|
642
|
-
|
|
643
|
-
}
|
|
644
|
-
|
|
645
|
-
/**
|
|
646
|
-
* Controls when a waypoint should be marked as complete.
|
|
647
|
-
*
|
|
648
|
-
* While a route may consist of thousands of points, waypoints are special.
|
|
649
|
-
* A simple trip will have only one waypoint: the final destination.
|
|
650
|
-
* A more complex trip may have several intermediate stops.
|
|
651
|
-
* Just as the navigation state keeps track of which steps remain in the route,
|
|
652
|
-
* it also tracks which waypoints are still remaining.
|
|
653
|
-
*
|
|
654
|
-
* Tracking waypoints enables Ferrostar to reroute users when they stray off the route line.
|
|
655
|
-
* The waypoint advance mode specifies how the framework decides
|
|
656
|
-
* that a waypoint has been visited (and is removed from the list).
|
|
657
|
-
*
|
|
658
|
-
* NOTE: Advancing to the next *step* and advancing to the next *waypoint*
|
|
659
|
-
* are separate processes.
|
|
660
|
-
* This will not normally cause any issues, but keep in mind that
|
|
661
|
-
* manually advancing to the next step does not *necessarily* imply
|
|
662
|
-
* that the waypoint will be marked as complete!
|
|
663
|
-
*/
|
|
664
|
-
export type WaypointAdvanceMode = { WaypointWithinRange: number } | { WaypointAlongAdvancingStep: number };
|
|
665
|
-
|
|
666
|
-
/**
|
|
667
|
-
* Controls filtering/post-processing of user course by the [`NavigationController`].
|
|
668
|
-
*/
|
|
669
|
-
export type CourseFiltering = "SnapToRoute" | "Raw";
|
|
670
|
-
|
|
671
|
-
export interface SerializableNavState {
|
|
672
|
-
tripState: TripState;
|
|
673
|
-
stepAdvanceCondition: SerializableStepAdvanceCondition;
|
|
674
|
-
}
|
|
675
|
-
|
|
676
|
-
/**
|
|
677
|
-
* High-level state describing progress through a route.
|
|
678
|
-
*/
|
|
679
|
-
export interface TripProgress {
|
|
724
|
+
exclude_tunnel?: boolean;
|
|
680
725
|
/**
|
|
681
|
-
*
|
|
726
|
+
* Whether to exclude roads marked as bridges.
|
|
682
727
|
*/
|
|
683
|
-
|
|
728
|
+
exclude_bridge?: boolean;
|
|
684
729
|
/**
|
|
685
|
-
*
|
|
686
|
-
*
|
|
687
|
-
* This is the sum of the distance remaining in the current step and the distance remaining in all subsequent steps.
|
|
730
|
+
* Whether to exclude roads with tolls.
|
|
688
731
|
*/
|
|
689
|
-
|
|
732
|
+
exclude_tolls?: boolean;
|
|
690
733
|
/**
|
|
691
|
-
*
|
|
734
|
+
* Whether to exclude ferries.
|
|
692
735
|
*/
|
|
693
|
-
|
|
694
|
-
}
|
|
695
|
-
|
|
696
|
-
export interface SerializableNavigationControllerConfig {
|
|
736
|
+
exclude_ferry?: boolean;
|
|
697
737
|
/**
|
|
698
|
-
*
|
|
738
|
+
* Whether to exclude roads marked as ramps.
|
|
699
739
|
*/
|
|
700
|
-
|
|
740
|
+
exclude_ramp?: boolean;
|
|
701
741
|
/**
|
|
702
|
-
*
|
|
742
|
+
* Whether to exclude roads marked as closed due to a live traffic closure.
|
|
703
743
|
*/
|
|
704
|
-
|
|
744
|
+
exclude_closures?: boolean;
|
|
705
745
|
/**
|
|
706
|
-
*
|
|
707
|
-
*
|
|
708
|
-
* This exists because several of our step advance conditions require entry and
|
|
709
|
-
* exit from a step\'s geometry. The end of the route/arrival doesn\'t always accommodate
|
|
710
|
-
* the expected location updates for the core step advance condition.
|
|
746
|
+
* The lowest road class allowed.
|
|
711
747
|
*/
|
|
712
|
-
|
|
748
|
+
min_road_class?: ValhallaRoadClass;
|
|
713
749
|
/**
|
|
714
|
-
*
|
|
715
|
-
*
|
|
716
|
-
* NOTE: This is distinct from the action that is taken.
|
|
717
|
-
* It is only the determination that the user has deviated from the expected route.
|
|
750
|
+
* The highest road class allowed.
|
|
718
751
|
*/
|
|
719
|
-
|
|
752
|
+
max_road_class?: ValhallaRoadClass;
|
|
720
753
|
/**
|
|
721
|
-
*
|
|
754
|
+
* If specified, will only consider edges that are on or traverse the passed floor level.
|
|
755
|
+
* It will set `search_cutoff` to a default value of 300 meters if no cutoff value is passed.
|
|
756
|
+
* Additionally, if a `search_cutoff` is passed, it will be clamped to 1000 meters.
|
|
722
757
|
*/
|
|
723
|
-
|
|
758
|
+
level?: number;
|
|
724
759
|
}
|
|
725
760
|
|
|
726
761
|
/**
|
|
727
|
-
*
|
|
728
|
-
*
|
|
729
|
-
* This is produced by [`NavigationController`](super::NavigationController) methods
|
|
730
|
-
* including [`get_initial_state`](super::NavigationController::get_initial_state)
|
|
731
|
-
* and [`update_user_location`](super::NavigationController::update_user_location).
|
|
732
|
-
*/
|
|
733
|
-
export type TripState = { Idle: { user_location: UserLocation | undefined } } | { Navigating: { currentStepGeometryIndex: number | undefined; userLocation: UserLocation; snappedUserLocation: UserLocation; remainingSteps: RouteStep[]; remainingWaypoints: Waypoint[]; progress: TripProgress; summary: TripSummary; deviation: RouteDeviation; visualInstruction: VisualInstruction | undefined; spokenInstruction: SpokenInstruction | undefined; annotationJson: string | undefined } } | { Complete: { user_location: UserLocation; summary: TripSummary } };
|
|
734
|
-
|
|
735
|
-
/**
|
|
736
|
-
* The event type.
|
|
737
|
-
*
|
|
738
|
-
* For full replayability, we record things like rerouting, and not just location updates.
|
|
739
|
-
*/
|
|
740
|
-
export type NavigationRecordingEventData = { StateUpdate: { trip_state: TripState; step_advance_condition: SerializableStepAdvanceCondition } } | { RouteUpdate: { route: Route } };
|
|
741
|
-
|
|
742
|
-
/**
|
|
743
|
-
* An event that occurs during navigation.
|
|
762
|
+
* Specifies a preferred side for departing from / arriving at a location.
|
|
744
763
|
*
|
|
745
|
-
*
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
*/
|
|
751
|
-
timestamp: number;
|
|
752
|
-
/**
|
|
753
|
-
* Data associated with the event.
|
|
754
|
-
*/
|
|
755
|
-
event_data: NavigationRecordingEventData;
|
|
756
|
-
}
|
|
757
|
-
|
|
758
|
-
/**
|
|
759
|
-
* Configurations for built-in route providers.
|
|
760
|
-
*/
|
|
761
|
-
export type WellKnownRouteProvider = { Valhalla: { endpointUrl: string; profile: string; optionsJson?: string | undefined } } | { GraphHopper: { endpointUrl: string; profile: string; locale: string; voiceUnits: GraphHopperVoiceUnits; optionsJson?: string | undefined } };
|
|
762
|
-
|
|
763
|
-
export type SimulationError = { PolylineError: { error: string } } | "NotEnoughPoints";
|
|
764
|
-
|
|
765
|
-
/**
|
|
766
|
-
* Controls how simulated locations deviate from the actual route line.
|
|
767
|
-
* This simulates real-world GPS behavior where readings often have systematic bias.
|
|
768
|
-
*/
|
|
769
|
-
export type LocationBias = { Left: number } | { Right: number } | { Random: number } | "None";
|
|
770
|
-
|
|
771
|
-
/**
|
|
772
|
-
* The current state of the simulation.
|
|
764
|
+
* Examples:
|
|
765
|
+
* - Germany drives on the right side of the road. A value of `same` will only allow leaving
|
|
766
|
+
* or arriving at a location such that it is on your right.
|
|
767
|
+
* - Australia drives on the left side of the road. Passing a value of `same` will only allow
|
|
768
|
+
* leaving or arriving at a location such that it is on your left.
|
|
773
769
|
*/
|
|
774
|
-
export
|
|
775
|
-
current_location: UserLocation;
|
|
776
|
-
remaining_locations: GeographicCoordinate[];
|
|
777
|
-
bias: LocationBias;
|
|
778
|
-
}
|
|
770
|
+
export type ValhallaWaypointPreferredSide = "same" | "opposite" | "either";
|
|
779
771
|
|
|
780
772
|
/**
|
|
781
|
-
*
|
|
773
|
+
* A road class in the Valhalla taxonomy.
|
|
782
774
|
*
|
|
783
|
-
*
|
|
784
|
-
* For example, we could conceivably add a \"wrong way\" status in the future.
|
|
785
|
-
*/
|
|
786
|
-
export type RouteDeviation = "NoDeviation" | { OffRoute: { deviationFromRouteLine: number } };
|
|
787
|
-
|
|
788
|
-
/**
|
|
789
|
-
* Determines if the user has deviated from the expected route.
|
|
775
|
+
* These are ordered from highest (fastest travel speed) to lowest.
|
|
790
776
|
*/
|
|
791
|
-
export type
|
|
777
|
+
export type ValhallaRoadClass = "motorway" | "trunk" | "primary" | "secondary" | "tertiary" | "unclassified" | "residential" | "service_other";
|
|
792
778
|
|
|
793
|
-
export type GraphHopperVoiceUnits = "metric" | "imperial";
|
|
794
779
|
|
|
795
|
-
/**
|
|
796
|
-
* JavaScript wrapper for `NavigationController`.
|
|
797
|
-
* This wrapper is required because `NavigationController` cannot be directly converted to a JavaScript object
|
|
798
|
-
* and requires serialization/deserialization of its methods' inputs and outputs.
|
|
799
|
-
*/
|
|
800
780
|
export class NavigationController {
|
|
801
781
|
free(): void;
|
|
802
782
|
[Symbol.dispose](): void;
|
|
@@ -805,12 +785,7 @@ export class NavigationController {
|
|
|
805
785
|
updateUserLocation(location: any, state: any): any;
|
|
806
786
|
constructor(route: any, config: any, should_record: any);
|
|
807
787
|
}
|
|
808
|
-
|
|
809
|
-
* A WebAssembly-compatible wrapper for `NavigationReplay` that exposes its functionality as a JavaScript object.
|
|
810
|
-
*
|
|
811
|
-
* This wrapper is required because `NavigationReplay` cannot be directly converted to a JavaScript object
|
|
812
|
-
* and requires serialization/deserialization of its methods' inputs and outputs.
|
|
813
|
-
*/
|
|
788
|
+
|
|
814
789
|
export class NavigationReplay {
|
|
815
790
|
free(): void;
|
|
816
791
|
[Symbol.dispose](): void;
|
|
@@ -821,10 +796,7 @@ export class NavigationReplay {
|
|
|
821
796
|
getInitialTimestamp(): any;
|
|
822
797
|
constructor(json: any);
|
|
823
798
|
}
|
|
824
|
-
|
|
825
|
-
* JavaScript wrapper for [`NavigationSession`] (simple version).
|
|
826
|
-
* This wrapper provides basic navigation functionality without observers.
|
|
827
|
-
*/
|
|
799
|
+
|
|
828
800
|
export class NavigationSession {
|
|
829
801
|
free(): void;
|
|
830
802
|
[Symbol.dispose](): void;
|
|
@@ -833,10 +805,7 @@ export class NavigationSession {
|
|
|
833
805
|
updateUserLocation(location: any, state: any): any;
|
|
834
806
|
constructor(route: any, config: any);
|
|
835
807
|
}
|
|
836
|
-
|
|
837
|
-
* JavaScript wrapper for [`NavigationSession`] with recording capabilities.
|
|
838
|
-
* This version includes a NavigationRecorder observer and provides direct access to recording functionality.
|
|
839
|
-
*/
|
|
808
|
+
|
|
840
809
|
export class NavigationSessionRecording {
|
|
841
810
|
free(): void;
|
|
842
811
|
[Symbol.dispose](): void;
|
|
@@ -847,9 +816,7 @@ export class NavigationSessionRecording {
|
|
|
847
816
|
updateUserLocation(location: any, state: any): any;
|
|
848
817
|
constructor(route: any, config: any);
|
|
849
818
|
}
|
|
850
|
-
|
|
851
|
-
* JavaScript wrapper for `RouteAdapter`.
|
|
852
|
-
*/
|
|
819
|
+
|
|
853
820
|
export class RouteAdapter {
|
|
854
821
|
free(): void;
|
|
855
822
|
[Symbol.dispose](): void;
|
|
@@ -861,3 +828,23 @@ export class RouteAdapter {
|
|
|
861
828
|
*/
|
|
862
829
|
constructor(well_known_route_provider: WellKnownRouteProvider);
|
|
863
830
|
}
|
|
831
|
+
|
|
832
|
+
/**
|
|
833
|
+
* JavaScript wrapper for `advance_location_simulation`.
|
|
834
|
+
*/
|
|
835
|
+
export function advanceLocationSimulation(state: any): any;
|
|
836
|
+
|
|
837
|
+
/**
|
|
838
|
+
* JavaScript wrapper for `location_simulation_from_coordinates`.
|
|
839
|
+
*/
|
|
840
|
+
export function locationSimulationFromCoordinates(coordinates: any, resample_distance: number | null | undefined, bias: LocationBias): any;
|
|
841
|
+
|
|
842
|
+
/**
|
|
843
|
+
* JavaScript wrapper for `location_simulation_from_polyline`.
|
|
844
|
+
*/
|
|
845
|
+
export function locationSimulationFromPolyline(polyline: string, precision: number, resample_distance: number | null | undefined, bias: LocationBias): any;
|
|
846
|
+
|
|
847
|
+
/**
|
|
848
|
+
* JavaScript wrapper for `location_simulation_from_route`.
|
|
849
|
+
*/
|
|
850
|
+
export function locationSimulationFromRoute(route: any, resample_distance: number | null | undefined, bias: LocationBias): any;
|