Class OsrmRouteProvider extends BaseRouteProvider

This class implements the BaseRouteProvider for Osrm. It's not possible to instanciate this class because the class is not exported from the module. Only one instance is created and added to the list of Providers of TravelNotes

Source : file routeProviders/OsrmRouteProvider.js at line 41

Constructor

new OsrmRouteProvider ( )

The constructor

Source : file routeProviders/OsrmRouteProvider.js at line 222

Public getters and setters

readonly get icon : String

The icon used in the ProviderToolbarUI. Overload of the base class icon property

Source : file routeProviders/OsrmRouteProvider.js at line 244

readonly get name : String

The provider name. Overload of the base class name property

Source : file routeProviders/OsrmRouteProvider.js at line 274

readonly get providerKeyNeeded : Boolean

A boolean indicating when a provider key is needed for the provider. Overload of the base class providerKeyNeeded property

Source : file routeProviders/OsrmRouteProvider.js at line 299

readonly get title : String

The title to display in the ProviderToolbarUI button. Overload of the base class title property

Source : file routeProviders/OsrmRouteProvider.js at line 282

readonly get transitModes : Array of String

The possible transit modes for the provider. Overload of the base class transitModes property Must be a subarray of [ 'bike', 'pedestrian', 'car', 'train', 'line', 'circle' ]

Source : file routeProviders/OsrmRouteProvider.js at line 291

get userLanguage : String

The user language. Overload of the base class userLanguage property. It's needed to overload the setter AND the getter otherwise the getter returns undefined

Source : file routeProviders/OsrmRouteProvider.js at line 307

set userLanguage

Source : file routeProviders/OsrmRouteProvider.js at line 308

Public methods

getPromiseRoute ( route )

Call the provider, using the waypoints defined in the route and, on success, complete the route with the data from the provider

Source : file routeProviders/OsrmRouteProvider.js at line 233

Parameters

Name Type Description
route Route

The route to witch the data will be added

Returns

A Promise. On success, the Route is completed with the data given by the provider.
Type : Promise

Private properties

#route : Route

A reference to the edited route

Source : file routeProviders/OsrmRouteProvider.js at line 48

Private getters and setters

readonly static get #ROUND_VALUE : Number

The round value used by PolylineEncoder

Source : file routeProviders/OsrmRouteProvider.js at line 55

Private methods

#getRoute ( onOk, onError )

Implementation of the base class #getRoute ( )

Source : file routeProviders/OsrmRouteProvider.js at line 203

Parameters

Name Type Description
onOk Function

The Promise Success handler

onError Function

The Promise Error handler

#getUrl ( )

Gives the url to call

Source : file routeProviders/OsrmRouteProvider.js at line 163

Returns

A string with the url, wayPoints, transitMode, user language and Api key
Type : String

#parseResponse ( response, onOk, onError )

Parse the response from the provider and add the received itinerary to the route itinerary

Source : file routeProviders/OsrmRouteProvider.js at line 64

Parameters

Name Type Description
response JsonObject

The itinerary received from the provider

onOk Function

A function to call when the response is parsed correctly

onError Function

A function to call when an error occurs