@stadiamaps/ferrostar
Version:
The core of modern turn-by-turn navigation.
200 lines (167 loc) • 6.99 kB
TypeScript
/* tslint:disable */
/* eslint-disable */
/**
* JavaScript wrapper for `location_simulation_from_coordinates`.
*/
export function locationSimulationFromCoordinates(coordinates: any, resample_distance: number | null | undefined, bias: LocationBias): any;
/**
* JavaScript wrapper for `location_simulation_from_route`.
*/
export function locationSimulationFromRoute(route: any, resample_distance: number | null | undefined, bias: LocationBias): any;
/**
* JavaScript wrapper for `location_simulation_from_polyline`.
*/
export function locationSimulationFromPolyline(polyline: string, precision: number, resample_distance: number | null | undefined, bias: LocationBias): any;
/**
* JavaScript wrapper for `advance_location_simulation`.
*/
export function advanceLocationSimulation(state: any): any;
export interface VisualInstruction {
primaryContent: VisualInstructionContent;
secondaryContent: VisualInstructionContent | undefined;
subContent: VisualInstructionContent | undefined;
triggerDistanceBeforeManeuver: number;
}
export interface VisualInstructionContent {
text: string;
maneuverType: ManeuverType | undefined;
maneuverModifier: ManeuverModifier | undefined;
roundaboutExitDegrees: number | undefined;
laneInfo: LaneInfo[] | undefined;
exitNumbers: string[];
}
export interface LaneInfo {
active: boolean;
directions: string[];
activeDirection: string | undefined;
}
export interface Incident {
id: string;
incidentType: IncidentType;
description: string | undefined;
longDescription: string | undefined;
creationTime: Date | null;
startTime: Date | null;
endTime: Date | null;
impact: Impact | undefined;
lanesBlocked: BlockedLane[];
congestion: Congestion | undefined;
closed: boolean | undefined;
geometryIndexStart: number;
geometryIndexEnd: number | undefined;
subType: string | undefined;
subTypeDescription: string | undefined;
iso31661Alpha2: string | undefined;
iso31661Alpha3: string | undefined;
affectedRoadNames: string[];
bbox: BoundingBox | undefined;
}
export interface Congestion {
value: number;
}
export type BlockedLane = "left" | "left center" | "left turn lane" | "center" | "right" | "right center" | "right turn lane" | "hov";
export type Impact = "unknown" | "critical" | "major" | "minor" | "low";
export type IncidentType = "accident" | "congestion" | "construction" | "disabled_vehicle" | "lane_restriction" | "mass_transit" | "miscellaneous" | "other_news" | "planned_event" | "road_closure" | "road_hazard" | "weather";
export type ManeuverModifier = "uturn" | "sharp right" | "right" | "slight right" | "straight" | "slight left" | "left" | "sharp left";
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";
export interface SpokenInstruction {
text: string;
ssml: string | undefined;
triggerDistanceBeforeManeuver: number;
utteranceId: string;
}
export interface RouteStep {
geometry: GeographicCoordinate[];
distance: number;
duration: number;
roadName: string | undefined;
exits: string[];
instruction: string;
visualInstructions: VisualInstruction[];
spokenInstructions: SpokenInstruction[];
annotations: string[] | undefined;
incidents: Incident[];
}
export interface Route {
geometry: GeographicCoordinate[];
bbox: BoundingBox;
distance: number;
waypoints: Waypoint[];
steps: RouteStep[];
}
export interface UserLocation {
coordinates: GeographicCoordinate;
horizontalAccuracy: number;
courseOverGround: CourseOverGround | undefined;
timestamp: { secs_since_epoch: number; nanos_since_epoch: number };
speed: Speed | undefined;
}
export interface Speed {
value: number;
accuracy: number | undefined;
}
export interface CourseOverGround {
degrees: number;
accuracy: number | undefined;
}
export interface BoundingBox {
sw: GeographicCoordinate;
ne: GeographicCoordinate;
}
export type WaypointKind = "Break" | "Via";
export interface Waypoint {
coordinate: GeographicCoordinate;
kind: WaypointKind;
}
export interface GeographicCoordinate {
lat: number;
lng: number;
}
export type RouteDeviation = "NoDeviation" | { OffRoute: { deviationFromRouteLine: number } };
export type RouteDeviationTracking = "None" | { StaticThreshold: { minimumHorizontalAccuracy: number; maxAcceptableDeviation: number } };
export type SimulationError = { PolylineError: { error: string } } | "NotEnoughPoints";
export type LocationBias = { Left: number } | { Right: number } | { Random: number } | "None";
export interface LocationSimulationState {
current_location: UserLocation;
remaining_locations: GeographicCoordinate[];
bias: LocationBias;
}
export interface NavigationControllerConfig {
waypointAdvance: WaypointAdvanceMode;
stepAdvance: StepAdvanceMode;
routeDeviationTracking: RouteDeviationTracking;
snappedLocationCourseFiltering: CourseFiltering;
}
export type WaypointAdvanceMode = { WaypointWithinRange: number };
export type SpecialAdvanceConditions = { AdvanceAtDistanceFromEnd: number } | { MinimumDistanceFromCurrentStepLine: number };
export type StepAdvanceMode = "Manual" | { DistanceToEndOfStep: { distance: number; minimumHorizontalAccuracy: number } } | { RelativeLineStringDistance: { minimumHorizontalAccuracy: number; specialAdvanceConditions: SpecialAdvanceConditions | undefined } };
export type CourseFiltering = "SnapToRoute" | "Raw";
export type TripState = "Idle" | { Navigating: { currentStepGeometryIndex: number | undefined; snappedUserLocation: UserLocation; remainingSteps: RouteStep[]; remainingWaypoints: Waypoint[]; progress: TripProgress; deviation: RouteDeviation; visualInstruction: VisualInstruction | undefined; spokenInstruction: SpokenInstruction | undefined; annotationJson: string | undefined } } | "Complete";
export interface TripProgress {
distanceToNextManeuver: number;
distanceRemaining: number;
durationRemaining: number;
}
/**
* JavaScript wrapper for `NavigationController`.
*/
export class NavigationController {
free(): void;
constructor(route: any, config: any);
getInitialState(location: any): any;
advance_to_next_step(state: any): any;
updateUserLocation(location: any, state: any): any;
}
/**
* JavaScript wrapper for `RouteAdapter`.
*/
export class RouteAdapter {
free(): void;
/**
* Creates a new RouteAdapter with a Valhalla HTTP request generator and an OSRM response parser.
* At the moment, this is the only supported combination.
*/
constructor(endpoint_url: string, profile: string, costing_options_json?: string | null);
generateRequest(user_location: any, waypoints: any): any;
parseResponse(response: Uint8Array): any;
}