UNPKG

@stadiamaps/ferrostar-webcomponents

Version:

Ferrostar is a modern SDK for building turn-by-turn navigation applications.

100 lines 3.44 kB
import { LitElement, PropertyValues } from 'lit'; import { default as maplibregl, GeolocateControl } from 'maplibre-gl'; import { Route, TripState } from '@stadiamaps/ferrostar'; import { StateProvider as StateProvider } from './types'; /** * A MapLibre-based map component. */ export declare class FerrostarMap extends LitElement { /** * The MapLibre map instance. * * You have to explicitly set this value when initializing * the web component to provide your own map instance. * */ map: maplibregl.Map; stateProvider: StateProvider | null; /** * Styles to load which will apply inside the component */ customStyles?: object; tripState: TripState | null; route: Route | null; /** * Determines whether the navigation user interface is displayed. */ showNavigationUI: boolean; /** * Should the user marker be shown on the map. * This is optional and defaults to false. */ showUserMarker: boolean; /** * Automatically geolocates the user on map load. * * Defaults to true. * Has no effect if `addGeolocateControl` is false. */ geolocateOnLoad: boolean; /** * Optionally adds a geolocate control to the map. * * Defaults to true. * Set this to false if you want to disable the geolocation control or bring your own. */ addGeolocateControl: boolean; /** * A callback function that is invoked when navigation is stopped. * Optional: This function can be provided by the StateProvider. */ onStopNavigation?: () => void; /** * The geolocate control instance. */ geolocateControl: GeolocateControl | null; private userLocationMarker; static styles: import('lit').CSSResult[]; constructor(); firstUpdated(): void; updated(changedProperties: PropertyValues<this>): void; linkWith(stateProvider: StateProvider, showUserMarker?: boolean): void; /** * Renders the current tripState on the map. */ private renderTripState; /** * Renders a route on the map. * If a route already exists, it clears the previous route before rendering a new one. * This method adds two layers to the map: the primary route layer and a border layer. */ private renderRoute; /** * Renders or updates the user's location marker on the map. If a marker already exists, its position is updated. * Otherwise, a new marker is created and added to the map. */ private renderUserLocationMarker; /** * Updates the camera position and orientation on the map based on the navState. * Adjusts the center of the map to the user's current location and sets the bearing * based on the user's course over ground, if available. */ private updateCamera; /** * Clears the route layers and source from the map if they exist. */ private clearRoute; /** * Removes the user's location marker from the map if it exists and clears the reference. */ private clearUserLocationMarker; /** * Stops the navigation process, and clears the navigation state. * * This includes resetting the simulation flag, * and invoking the optional onStopNavigation callback if provided. */ stopNavigation(): void; render(): import('lit-html').TemplateResult<1>; } //# sourceMappingURL=ferrostar-map.d.ts.map