@stadiamaps/ferrostar 0.35.0 → 0.36.0
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 +397 -15
- package/ferrostar_bg.js +17 -15
- package/ferrostar_bg.wasm +0 -0
- package/package.json +1 -1
package/ferrostar.d.ts
CHANGED
|
@@ -16,164 +16,546 @@ export function locationSimulationFromPolyline(polyline: string, precision: numb
|
|
|
16
16
|
* JavaScript wrapper for `advance_location_simulation`.
|
|
17
17
|
*/
|
|
18
18
|
export function advanceLocationSimulation(state: any): any;
|
|
19
|
+
/**
|
|
20
|
+
* An instruction for visual display (usually as banners) at a specific point along a [`RouteStep`].
|
|
21
|
+
*/
|
|
19
22
|
export interface VisualInstruction {
|
|
23
|
+
/**
|
|
24
|
+
* The primary instruction content.
|
|
25
|
+
*
|
|
26
|
+
* This is usually given more visual weight.
|
|
27
|
+
*/
|
|
20
28
|
primaryContent: VisualInstructionContent;
|
|
29
|
+
/**
|
|
30
|
+
* Optional secondary instruction content.
|
|
31
|
+
*/
|
|
21
32
|
secondaryContent: VisualInstructionContent | undefined;
|
|
33
|
+
/**
|
|
34
|
+
* Optional sub-maneuver instruction content.
|
|
35
|
+
*/
|
|
22
36
|
subContent: VisualInstructionContent | undefined;
|
|
37
|
+
/**
|
|
38
|
+
* How far (in meters) from the upcoming maneuver the instruction should start being displayed
|
|
39
|
+
*/
|
|
23
40
|
triggerDistanceBeforeManeuver: number;
|
|
24
41
|
}
|
|
25
42
|
|
|
43
|
+
/**
|
|
44
|
+
* The content of a visual instruction.
|
|
45
|
+
*/
|
|
26
46
|
export interface VisualInstructionContent {
|
|
47
|
+
/**
|
|
48
|
+
* The text to display.
|
|
49
|
+
*/
|
|
27
50
|
text: string;
|
|
51
|
+
/**
|
|
52
|
+
* A standardized maneuver type (if any).
|
|
53
|
+
*/
|
|
28
54
|
maneuverType: ManeuverType | undefined;
|
|
55
|
+
/**
|
|
56
|
+
* A standardized maneuver modifier (if any).
|
|
57
|
+
*/
|
|
29
58
|
maneuverModifier: ManeuverModifier | undefined;
|
|
59
|
+
/**
|
|
60
|
+
* If applicable, the number of degrees you need to go around the roundabout before exiting.
|
|
61
|
+
*
|
|
62
|
+
* For example, entering and exiting the roundabout in the same direction of travel
|
|
63
|
+
* (as if you had gone straight, apart from the detour)
|
|
64
|
+
* would be an exit angle of 180 degrees.
|
|
65
|
+
*/
|
|
30
66
|
roundaboutExitDegrees: number | undefined;
|
|
67
|
+
/**
|
|
68
|
+
* Detailed information about the lanes. This is typically only present in sub-maneuver instructions.
|
|
69
|
+
*/
|
|
31
70
|
laneInfo: LaneInfo[] | undefined;
|
|
71
|
+
/**
|
|
72
|
+
* The exit number (or similar identifier like \"8B\").
|
|
73
|
+
*/
|
|
32
74
|
exitNumbers: string[];
|
|
33
75
|
}
|
|
34
76
|
|
|
77
|
+
/**
|
|
78
|
+
* The content of a visual instruction.
|
|
79
|
+
*/
|
|
35
80
|
export interface LaneInfo {
|
|
36
81
|
active: boolean;
|
|
37
82
|
directions: string[];
|
|
38
83
|
activeDirection: string | undefined;
|
|
39
84
|
}
|
|
40
85
|
|
|
86
|
+
/**
|
|
87
|
+
* An incident affecting the free flow of traffic,
|
|
88
|
+
* such as constructions, accidents, and congestion.
|
|
89
|
+
*/
|
|
41
90
|
export interface Incident {
|
|
91
|
+
/**
|
|
92
|
+
* A unique identifier for the incident.
|
|
93
|
+
*/
|
|
42
94
|
id: string;
|
|
95
|
+
/**
|
|
96
|
+
* The type of incident.
|
|
97
|
+
*/
|
|
43
98
|
incidentType: IncidentType;
|
|
99
|
+
/**
|
|
100
|
+
* A short description of the incident.
|
|
101
|
+
*/
|
|
44
102
|
description: string | undefined;
|
|
103
|
+
/**
|
|
104
|
+
* A longer description of the incident.
|
|
105
|
+
*/
|
|
45
106
|
longDescription: string | undefined;
|
|
107
|
+
/**
|
|
108
|
+
* The time at which the incident was *last* created.
|
|
109
|
+
*
|
|
110
|
+
* NB: This can change throughout the life of the incident.
|
|
111
|
+
*/
|
|
46
112
|
creationTime: Date | null;
|
|
113
|
+
/**
|
|
114
|
+
* The time at which the incident started or is expected to start (ex: planned closure).
|
|
115
|
+
*/
|
|
47
116
|
startTime: Date | null;
|
|
117
|
+
/**
|
|
118
|
+
* The time at which the incident ended or is expected to end.
|
|
119
|
+
*/
|
|
48
120
|
endTime: Date | null;
|
|
121
|
+
/**
|
|
122
|
+
* The level of impact to traffic.
|
|
123
|
+
*/
|
|
49
124
|
impact: Impact | undefined;
|
|
125
|
+
/**
|
|
126
|
+
* Lanes which are blocked by the incident.
|
|
127
|
+
*/
|
|
50
128
|
lanesBlocked: BlockedLane[];
|
|
129
|
+
/**
|
|
130
|
+
* Info about the amount of congestion on the road around the incident.
|
|
131
|
+
*/
|
|
51
132
|
congestion: Congestion | undefined;
|
|
133
|
+
/**
|
|
134
|
+
* Is the road completely closed?
|
|
135
|
+
*/
|
|
52
136
|
closed: boolean | undefined;
|
|
137
|
+
/**
|
|
138
|
+
* The index into the [`RouteStep`] geometry where the incident starts.
|
|
139
|
+
*/
|
|
53
140
|
geometryIndexStart: number;
|
|
141
|
+
/**
|
|
142
|
+
* The index into the [`RouteStep`] geometry where the incident ends.
|
|
143
|
+
*/
|
|
54
144
|
geometryIndexEnd: number | undefined;
|
|
145
|
+
/**
|
|
146
|
+
* Optional additional information about the type of incident (free-form text).
|
|
147
|
+
*/
|
|
55
148
|
subType: string | undefined;
|
|
149
|
+
/**
|
|
150
|
+
* Optional descriptions about the type of incident (free-form text).
|
|
151
|
+
*/
|
|
56
152
|
subTypeDescription: string | undefined;
|
|
153
|
+
/**
|
|
154
|
+
* The ISO 3166-1 alpha-2 code of the country in which the incident occurs.
|
|
155
|
+
*/
|
|
57
156
|
iso31661Alpha2: string | undefined;
|
|
157
|
+
/**
|
|
158
|
+
* The ISO 3166-1 alpha-3 code of the country in which the incident occurs.
|
|
159
|
+
*/
|
|
58
160
|
iso31661Alpha3: string | undefined;
|
|
161
|
+
/**
|
|
162
|
+
* A list of road names affected by the incident.
|
|
163
|
+
*/
|
|
59
164
|
affectedRoadNames: string[];
|
|
165
|
+
/**
|
|
166
|
+
* The bounding box over which the incident occurs.
|
|
167
|
+
*/
|
|
60
168
|
bbox: BoundingBox | undefined;
|
|
61
169
|
}
|
|
62
170
|
|
|
171
|
+
/**
|
|
172
|
+
* Details about congestion for an incident.
|
|
173
|
+
*/
|
|
63
174
|
export interface Congestion {
|
|
175
|
+
/**
|
|
176
|
+
* The level of congestion caused by the incident.
|
|
177
|
+
*
|
|
178
|
+
* 0 = no congestion
|
|
179
|
+
*
|
|
180
|
+
* 100 = road closed
|
|
181
|
+
*
|
|
182
|
+
* Other values mean no congestion was calculated
|
|
183
|
+
*/
|
|
64
184
|
value: number;
|
|
65
185
|
}
|
|
66
186
|
|
|
187
|
+
/**
|
|
188
|
+
* The lane type blocked by the incident.
|
|
189
|
+
*/
|
|
67
190
|
export type BlockedLane = "left" | "left center" | "left turn lane" | "center" | "right" | "right center" | "right turn lane" | "hov";
|
|
68
191
|
|
|
192
|
+
/**
|
|
193
|
+
* The impact of the incident that has occurred.
|
|
194
|
+
*/
|
|
69
195
|
export type Impact = "unknown" | "critical" | "major" | "minor" | "low";
|
|
70
196
|
|
|
197
|
+
/**
|
|
198
|
+
* The type of incident that has occurred.
|
|
199
|
+
*/
|
|
71
200
|
export type IncidentType = "accident" | "congestion" | "construction" | "disabled_vehicle" | "lane_restriction" | "mass_transit" | "miscellaneous" | "other_news" | "planned_event" | "road_closure" | "road_hazard" | "weather";
|
|
72
201
|
|
|
202
|
+
/**
|
|
203
|
+
* Additional information to further specify a [`ManeuverType`].
|
|
204
|
+
*/
|
|
73
205
|
export type ManeuverModifier = "uturn" | "sharp right" | "right" | "slight right" | "straight" | "slight left" | "left" | "sharp left";
|
|
74
206
|
|
|
207
|
+
/**
|
|
208
|
+
* The broad class of maneuver to perform.
|
|
209
|
+
*
|
|
210
|
+
* This is usually combined with [`ManeuverModifier`] in [`VisualInstructionContent`].
|
|
211
|
+
*/
|
|
75
212
|
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";
|
|
76
213
|
|
|
214
|
+
/**
|
|
215
|
+
* An instruction that can be synthesized using a TTS engine to announce an upcoming maneuver.
|
|
216
|
+
*
|
|
217
|
+
* Note that these do not have any locale information attached.
|
|
218
|
+
*/
|
|
77
219
|
export interface SpokenInstruction {
|
|
220
|
+
/**
|
|
221
|
+
* Plain-text instruction which can be synthesized with a TTS engine.
|
|
222
|
+
*/
|
|
78
223
|
text: string;
|
|
224
|
+
/**
|
|
225
|
+
* Speech Synthesis Markup Language, which should be preferred by clients capable of understanding it.
|
|
226
|
+
*/
|
|
79
227
|
ssml: string | undefined;
|
|
228
|
+
/**
|
|
229
|
+
* How far (in meters) from the upcoming maneuver the instruction should start being displayed
|
|
230
|
+
*/
|
|
80
231
|
triggerDistanceBeforeManeuver: number;
|
|
232
|
+
/**
|
|
233
|
+
* A unique identifier for this instruction.
|
|
234
|
+
*
|
|
235
|
+
* This is provided so that platform-layer integrations can easily disambiguate between distinct utterances,
|
|
236
|
+
* which may have the same textual content.
|
|
237
|
+
* UUIDs conveniently fill this purpose.
|
|
238
|
+
*
|
|
239
|
+
* NOTE: While it is possible to deterministically create UUIDs, we do not do so at this time.
|
|
240
|
+
* This should be theoretically possible though if someone cares to write up a proposal and a PR.
|
|
241
|
+
*/
|
|
81
242
|
utteranceId: string;
|
|
82
243
|
}
|
|
83
244
|
|
|
245
|
+
/**
|
|
246
|
+
* A maneuver (such as a turn or merge) followed by travel of a certain distance until reaching
|
|
247
|
+
* the next step.
|
|
248
|
+
*/
|
|
84
249
|
export interface RouteStep {
|
|
250
|
+
/**
|
|
251
|
+
* The full route geometry for this step.
|
|
252
|
+
*/
|
|
85
253
|
geometry: GeographicCoordinate[];
|
|
254
|
+
/**
|
|
255
|
+
* The distance, in meters, to travel along the route after the maneuver to reach the next step.
|
|
256
|
+
*/
|
|
86
257
|
distance: number;
|
|
258
|
+
/**
|
|
259
|
+
* The estimated duration, in seconds, that it will take to complete this step.
|
|
260
|
+
*/
|
|
87
261
|
duration: number;
|
|
262
|
+
/**
|
|
263
|
+
* The name of the road being traveled on (useful for certain UI styles).
|
|
264
|
+
*/
|
|
88
265
|
roadName: string | undefined;
|
|
266
|
+
/**
|
|
267
|
+
* A list of exits (name or number).
|
|
268
|
+
*/
|
|
89
269
|
exits: string[];
|
|
270
|
+
/**
|
|
271
|
+
* A description of the maneuver (ex: \"Turn wright onto main street\").
|
|
272
|
+
*
|
|
273
|
+
* Note for UI implementers: the context this appears in (or doesn\'t)
|
|
274
|
+
* depends somewhat on your use case and routing engine.
|
|
275
|
+
* For example, this field is useful as a written instruction in Valhalla.
|
|
276
|
+
*/
|
|
90
277
|
instruction: string;
|
|
278
|
+
/**
|
|
279
|
+
* A list of instructions for visual display (usually as banners) at specific points along the step.
|
|
280
|
+
*/
|
|
91
281
|
visualInstructions: VisualInstruction[];
|
|
282
|
+
/**
|
|
283
|
+
* A list of prompts to announce (via speech synthesis) at specific points along the step.
|
|
284
|
+
*/
|
|
92
285
|
spokenInstructions: SpokenInstruction[];
|
|
286
|
+
/**
|
|
287
|
+
* A list of json encoded strings representing annotations between each coordinate along the step.
|
|
288
|
+
*/
|
|
93
289
|
annotations: string[] | undefined;
|
|
290
|
+
/**
|
|
291
|
+
* A list of incidents that occur along the step.
|
|
292
|
+
*/
|
|
94
293
|
incidents: Incident[];
|
|
95
294
|
}
|
|
96
295
|
|
|
296
|
+
/**
|
|
297
|
+
* Information describing the series of steps needed to travel between two or more points.
|
|
298
|
+
*
|
|
299
|
+
* NOTE: This type is unstable and is still under active development and should be
|
|
300
|
+
* considered unstable.
|
|
301
|
+
*/
|
|
97
302
|
export interface Route {
|
|
98
303
|
geometry: GeographicCoordinate[];
|
|
99
304
|
bbox: BoundingBox;
|
|
305
|
+
/**
|
|
306
|
+
* The total route distance, in meters.
|
|
307
|
+
*/
|
|
100
308
|
distance: number;
|
|
309
|
+
/**
|
|
310
|
+
* The ordered list of waypoints to visit, including the starting point.
|
|
311
|
+
* Note that this is distinct from the *geometry* which includes all points visited.
|
|
312
|
+
* A waypoint represents a start/end point for a route leg.
|
|
313
|
+
*/
|
|
101
314
|
waypoints: Waypoint[];
|
|
102
315
|
steps: RouteStep[];
|
|
103
316
|
}
|
|
104
317
|
|
|
318
|
+
/**
|
|
319
|
+
* The location of the user that is navigating.
|
|
320
|
+
*
|
|
321
|
+
* In addition to coordinates, this includes estimated accuracy and course information,
|
|
322
|
+
* which can influence navigation logic and UI.
|
|
323
|
+
*
|
|
324
|
+
* NOTE: Heading is absent on purpose.
|
|
325
|
+
* Heading updates are not related to a change in the user\'s location.
|
|
326
|
+
*/
|
|
105
327
|
export interface UserLocation {
|
|
106
328
|
coordinates: GeographicCoordinate;
|
|
329
|
+
/**
|
|
330
|
+
* The estimated accuracy of the coordinate (in meters)
|
|
331
|
+
*/
|
|
107
332
|
horizontalAccuracy: number;
|
|
108
333
|
courseOverGround: CourseOverGround | undefined;
|
|
109
334
|
timestamp: { secs_since_epoch: number; nanos_since_epoch: number };
|
|
110
335
|
speed: Speed | undefined;
|
|
111
336
|
}
|
|
112
337
|
|
|
338
|
+
/**
|
|
339
|
+
* The speed of the user from the location provider.
|
|
340
|
+
*/
|
|
113
341
|
export interface Speed {
|
|
342
|
+
/**
|
|
343
|
+
* The user\'s speed in meters per second.
|
|
344
|
+
*/
|
|
114
345
|
value: number;
|
|
346
|
+
/**
|
|
347
|
+
* The accuracy of the speed value, measured in meters per second.
|
|
348
|
+
*/
|
|
115
349
|
accuracy: number | undefined;
|
|
116
350
|
}
|
|
117
351
|
|
|
352
|
+
/**
|
|
353
|
+
* The direction in which the user/device is observed to be traveling.
|
|
354
|
+
*/
|
|
118
355
|
export interface CourseOverGround {
|
|
356
|
+
/**
|
|
357
|
+
* The direction in which the user\'s device is traveling, measured in clockwise degrees from
|
|
358
|
+
* true north (N = 0, E = 90, S = 180, W = 270).
|
|
359
|
+
*/
|
|
119
360
|
degrees: number;
|
|
361
|
+
/**
|
|
362
|
+
* The accuracy of the course value, measured in degrees.
|
|
363
|
+
*/
|
|
120
364
|
accuracy: number | undefined;
|
|
121
365
|
}
|
|
122
366
|
|
|
367
|
+
/**
|
|
368
|
+
* A geographic bounding box defined by its corners.
|
|
369
|
+
*/
|
|
123
370
|
export interface BoundingBox {
|
|
371
|
+
/**
|
|
372
|
+
* The southwest corner of the bounding box.
|
|
373
|
+
*/
|
|
124
374
|
sw: GeographicCoordinate;
|
|
375
|
+
/**
|
|
376
|
+
* The northeast corner of the bounding box.
|
|
377
|
+
*/
|
|
125
378
|
ne: GeographicCoordinate;
|
|
126
379
|
}
|
|
127
380
|
|
|
381
|
+
/**
|
|
382
|
+
* Describes characteristics of the waypoint for the routing backend.
|
|
383
|
+
*/
|
|
128
384
|
export type WaypointKind = "Break" | "Via";
|
|
129
385
|
|
|
386
|
+
/**
|
|
387
|
+
* A waypoint along a route.
|
|
388
|
+
*
|
|
389
|
+
* Within the context of Ferrostar, a route request consists of exactly one [`UserLocation`]
|
|
390
|
+
* and at least one [`Waypoint`]. The route starts from the user\'s location (which may
|
|
391
|
+
* contain other useful information like their current course for the [`crate::routing_adapters::RouteRequestGenerator`]
|
|
392
|
+
* to use) and proceeds through one or more waypoints.
|
|
393
|
+
*
|
|
394
|
+
* Waypoints are used during route calculation, are tracked throughout the lifecycle of a trip,
|
|
395
|
+
* and are used for recalculating when the user deviates from the expected route.
|
|
396
|
+
*
|
|
397
|
+
* Note that support for properties beyond basic geographic coordinates varies by routing engine.
|
|
398
|
+
*/
|
|
130
399
|
export interface Waypoint {
|
|
131
400
|
coordinate: GeographicCoordinate;
|
|
132
401
|
kind: WaypointKind;
|
|
133
402
|
}
|
|
134
403
|
|
|
404
|
+
/**
|
|
405
|
+
* A geographic coordinate in WGS84.
|
|
406
|
+
*/
|
|
135
407
|
export interface GeographicCoordinate {
|
|
408
|
+
/**
|
|
409
|
+
* The latitude (in degrees).
|
|
410
|
+
*/
|
|
136
411
|
lat: number;
|
|
412
|
+
/**
|
|
413
|
+
* The Longitude (in degrees).
|
|
414
|
+
*/
|
|
137
415
|
lng: number;
|
|
138
416
|
}
|
|
139
417
|
|
|
140
|
-
export type RouteDeviation = "NoDeviation" | { OffRoute: { deviationFromRouteLine: number } };
|
|
141
|
-
|
|
142
|
-
export type RouteDeviationTracking = "None" | { StaticThreshold: { minimumHorizontalAccuracy: number; maxAcceptableDeviation: number } };
|
|
143
|
-
|
|
144
|
-
export type SimulationError = { PolylineError: { error: string } } | "NotEnoughPoints";
|
|
145
|
-
|
|
146
|
-
export type LocationBias = { Left: number } | { Right: number } | { Random: number } | "None";
|
|
147
|
-
|
|
148
|
-
export interface LocationSimulationState {
|
|
149
|
-
current_location: UserLocation;
|
|
150
|
-
remaining_locations: GeographicCoordinate[];
|
|
151
|
-
bias: LocationBias;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
418
|
export interface NavigationControllerConfig {
|
|
419
|
+
/**
|
|
420
|
+
* Configures when navigation advances to next waypoint in the route.
|
|
421
|
+
*/
|
|
155
422
|
waypointAdvance: WaypointAdvanceMode;
|
|
423
|
+
/**
|
|
424
|
+
* Configures when navigation advances to the next step in the route.
|
|
425
|
+
*/
|
|
156
426
|
stepAdvance: StepAdvanceMode;
|
|
427
|
+
/**
|
|
428
|
+
* Configures when the user is deemed to be off course.
|
|
429
|
+
*
|
|
430
|
+
* NOTE: This is distinct from the action that is taken.
|
|
431
|
+
* It is only the determination that the user has deviated from the expected route.
|
|
432
|
+
*/
|
|
157
433
|
routeDeviationTracking: RouteDeviationTracking;
|
|
434
|
+
/**
|
|
435
|
+
* Configures how the heading component of the snapped location is reported in [`TripState`].
|
|
436
|
+
*/
|
|
158
437
|
snappedLocationCourseFiltering: CourseFiltering;
|
|
159
438
|
}
|
|
160
439
|
|
|
440
|
+
/**
|
|
441
|
+
* Controls when a waypoint should be marked as complete.
|
|
442
|
+
*
|
|
443
|
+
* While a route may consist of thousands of points, waypoints are special.
|
|
444
|
+
* A simple trip will have only one waypoint: the final destination.
|
|
445
|
+
* A more complex trip may have several intermediate stops.
|
|
446
|
+
* Just as the navigation state keeps track of which steps remain in the route,
|
|
447
|
+
* it also tracks which waypoints are still remaining.
|
|
448
|
+
*
|
|
449
|
+
* Tracking waypoints enables Ferrostar to reroute users when they stray off the route line.
|
|
450
|
+
* The waypoint advance mode specifies how the framework decides
|
|
451
|
+
* that a waypoint has been visited (and is removed from the list).
|
|
452
|
+
*
|
|
453
|
+
* NOTE: Advancing to the next *step* and advancing to the next *waypoint*
|
|
454
|
+
* are separate processes.
|
|
455
|
+
* This will not normally cause any issues, but keep in mind that
|
|
456
|
+
* manually advancing to the next step does not *necessarily* imply
|
|
457
|
+
* that the waypoint will be marked as complete!
|
|
458
|
+
*/
|
|
161
459
|
export type WaypointAdvanceMode = { WaypointWithinRange: number };
|
|
162
460
|
|
|
461
|
+
/**
|
|
462
|
+
* Special conditions which alter the normal step advance logic,
|
|
463
|
+
*/
|
|
163
464
|
export type SpecialAdvanceConditions = { AdvanceAtDistanceFromEnd: number } | { MinimumDistanceFromCurrentStepLine: number };
|
|
164
465
|
|
|
466
|
+
/**
|
|
467
|
+
* The step advance mode describes when the current maneuver has been successfully completed,
|
|
468
|
+
* and we should advance to the next step.
|
|
469
|
+
*/
|
|
165
470
|
export type StepAdvanceMode = "Manual" | { DistanceToEndOfStep: { distance: number; minimumHorizontalAccuracy: number } } | { RelativeLineStringDistance: { minimumHorizontalAccuracy: number; specialAdvanceConditions: SpecialAdvanceConditions | undefined } };
|
|
166
471
|
|
|
472
|
+
/**
|
|
473
|
+
* Controls filtering/post-processing of user course by the [`NavigationController`].
|
|
474
|
+
*/
|
|
167
475
|
export type CourseFiltering = "SnapToRoute" | "Raw";
|
|
168
476
|
|
|
169
|
-
|
|
477
|
+
/**
|
|
478
|
+
* The state of a navigation session.
|
|
479
|
+
*
|
|
480
|
+
* This is produced by [`NavigationController`](super::NavigationController) methods
|
|
481
|
+
* including [`get_initial_state`](super::NavigationController::get_initial_state)
|
|
482
|
+
* and [`update_user_location`](super::NavigationController::update_user_location).
|
|
483
|
+
*/
|
|
484
|
+
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 } };
|
|
170
485
|
|
|
486
|
+
/**
|
|
487
|
+
* Information pertaining to the user\'s full navigation trip. This includes
|
|
488
|
+
* simple stats like total duration and distance.
|
|
489
|
+
*/
|
|
490
|
+
export interface TripSummary {
|
|
491
|
+
/**
|
|
492
|
+
* The total raw distance traveled in the trip, in meters.
|
|
493
|
+
*/
|
|
494
|
+
distanceTraveled: number;
|
|
495
|
+
/**
|
|
496
|
+
* The total snapped distance traveled in the trip, in meters.
|
|
497
|
+
*/
|
|
498
|
+
snappedDistanceTraveled: number;
|
|
499
|
+
/**
|
|
500
|
+
* When the trip was started.
|
|
501
|
+
*/
|
|
502
|
+
startedAt: Date;
|
|
503
|
+
/**
|
|
504
|
+
* When the trip was completed or canceled.
|
|
505
|
+
*/
|
|
506
|
+
endedAt: Date | null;
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
/**
|
|
510
|
+
* High-level state describing progress through a route.
|
|
511
|
+
*/
|
|
171
512
|
export interface TripProgress {
|
|
513
|
+
/**
|
|
514
|
+
* The distance to the next maneuver, in meters.
|
|
515
|
+
*/
|
|
172
516
|
distanceToNextManeuver: number;
|
|
517
|
+
/**
|
|
518
|
+
* The total distance remaining in the trip, in meters.
|
|
519
|
+
*
|
|
520
|
+
* This is the sum of the distance remaining in the current step and the distance remaining in all subsequent steps.
|
|
521
|
+
*/
|
|
173
522
|
distanceRemaining: number;
|
|
523
|
+
/**
|
|
524
|
+
* The total duration remaining in the trip, in seconds.
|
|
525
|
+
*/
|
|
174
526
|
durationRemaining: number;
|
|
175
527
|
}
|
|
176
528
|
|
|
529
|
+
/**
|
|
530
|
+
* Status information that describes whether the user is proceeding according to the route or not.
|
|
531
|
+
*
|
|
532
|
+
* Note that the name is intentionally a bit generic to allow for expansion of other states.
|
|
533
|
+
* For example, we could conceivably add a \"wrong way\" status in the future.
|
|
534
|
+
*/
|
|
535
|
+
export type RouteDeviation = "NoDeviation" | { OffRoute: { deviationFromRouteLine: number } };
|
|
536
|
+
|
|
537
|
+
/**
|
|
538
|
+
* Determines if the user has deviated from the expected route.
|
|
539
|
+
*/
|
|
540
|
+
export type RouteDeviationTracking = "None" | { StaticThreshold: { minimumHorizontalAccuracy: number; maxAcceptableDeviation: number } };
|
|
541
|
+
|
|
542
|
+
export type SimulationError = { PolylineError: { error: string } } | "NotEnoughPoints";
|
|
543
|
+
|
|
544
|
+
/**
|
|
545
|
+
* Controls how simulated locations deviate from the actual route line.
|
|
546
|
+
* This simulates real-world GPS behavior where readings often have systematic bias.
|
|
547
|
+
*/
|
|
548
|
+
export type LocationBias = { Left: number } | { Right: number } | { Random: number } | "None";
|
|
549
|
+
|
|
550
|
+
/**
|
|
551
|
+
* The current state of the simulation.
|
|
552
|
+
*/
|
|
553
|
+
export interface LocationSimulationState {
|
|
554
|
+
current_location: UserLocation;
|
|
555
|
+
remaining_locations: GeographicCoordinate[];
|
|
556
|
+
bias: LocationBias;
|
|
557
|
+
}
|
|
558
|
+
|
|
177
559
|
/**
|
|
178
560
|
* JavaScript wrapper for `NavigationController`.
|
|
179
561
|
*/
|
package/ferrostar_bg.js
CHANGED
|
@@ -185,6 +185,13 @@ function takeFromExternrefTable0(idx) {
|
|
|
185
185
|
wasm.__externref_table_dealloc(idx);
|
|
186
186
|
return value;
|
|
187
187
|
}
|
|
188
|
+
|
|
189
|
+
function passArray8ToWasm0(arg, malloc) {
|
|
190
|
+
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
191
|
+
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
192
|
+
WASM_VECTOR_LEN = arg.length;
|
|
193
|
+
return ptr;
|
|
194
|
+
}
|
|
188
195
|
/**
|
|
189
196
|
* JavaScript wrapper for `location_simulation_from_coordinates`.
|
|
190
197
|
* @param {any} coordinates
|
|
@@ -243,13 +250,6 @@ export function advanceLocationSimulation(state) {
|
|
|
243
250
|
return ret;
|
|
244
251
|
}
|
|
245
252
|
|
|
246
|
-
function passArray8ToWasm0(arg, malloc) {
|
|
247
|
-
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
248
|
-
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
249
|
-
WASM_VECTOR_LEN = arg.length;
|
|
250
|
-
return ptr;
|
|
251
|
-
}
|
|
252
|
-
|
|
253
253
|
const NavigationControllerFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
254
254
|
? { register: () => {}, unregister: () => {} }
|
|
255
255
|
: new FinalizationRegistry(ptr => wasm.__wbg_navigationcontroller_free(ptr >>> 0, 1));
|
|
@@ -394,14 +394,6 @@ export function __wbg_String_8f0eb39a4a4c2f66(arg0, arg1) {
|
|
|
394
394
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
395
395
|
};
|
|
396
396
|
|
|
397
|
-
export function __wbg_String_eecc4a11987127d6(arg0, arg1) {
|
|
398
|
-
const ret = String(arg1);
|
|
399
|
-
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
400
|
-
const len1 = WASM_VECTOR_LEN;
|
|
401
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
402
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
403
|
-
};
|
|
404
|
-
|
|
405
397
|
export function __wbg_buffer_609cc3eee51ed158(arg0) {
|
|
406
398
|
const ret = arg0.buffer;
|
|
407
399
|
return ret;
|
|
@@ -440,6 +432,11 @@ export function __wbg_getRandomValues_bcb4912f16000dc4() { return handleError(fu
|
|
|
440
432
|
arg0.getRandomValues(arg1);
|
|
441
433
|
}, arguments) };
|
|
442
434
|
|
|
435
|
+
export function __wbg_getTime_46267b1c24877e30(arg0) {
|
|
436
|
+
const ret = arg0.getTime();
|
|
437
|
+
return ret;
|
|
438
|
+
};
|
|
439
|
+
|
|
443
440
|
export function __wbg_get_67b2ba62fc30de12() { return handleError(function (arg0, arg1) {
|
|
444
441
|
const ret = Reflect.get(arg0, arg1);
|
|
445
442
|
return ret;
|
|
@@ -507,6 +504,11 @@ export function __wbg_msCrypto_0a36e2ec3a343d26(arg0) {
|
|
|
507
504
|
return ret;
|
|
508
505
|
};
|
|
509
506
|
|
|
507
|
+
export function __wbg_new0_f788a2397c7ca929() {
|
|
508
|
+
const ret = new Date();
|
|
509
|
+
return ret;
|
|
510
|
+
};
|
|
511
|
+
|
|
510
512
|
export function __wbg_new_405e22f390576ce2() {
|
|
511
513
|
const ret = new Object();
|
|
512
514
|
return ret;
|
package/ferrostar_bg.wasm
CHANGED
|
Binary file
|