Class OpenRouteServiceRouteProvider extends BaseRouteProvider

This class implements the BaseRouteProvider for OpenRouteService. 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/OpenRouteServiceRouteProvider.js at line 40

Constructor

new OpenRouteServiceRouteProvider ( )

The constructor

Source : file routeProviders/OpenRouteServiceRouteProvider.js at line 248

Public getters and setters

readonly get icon : String

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

Source : file routeProviders/OpenRouteServiceRouteProvider.js at line 271

readonly get name : String

The provider name. Overload of the base class name property

Source : file routeProviders/OpenRouteServiceRouteProvider.js at line 291

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/OpenRouteServiceRouteProvider.js at line 316

set providerKey

The provider key. Overload of the base class providerKey property

Source : file routeProviders/OpenRouteServiceRouteProvider.js at line 323

readonly get title : String

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

Source : file routeProviders/OpenRouteServiceRouteProvider.js at line 299

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/OpenRouteServiceRouteProvider.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/OpenRouteServiceRouteProvider.js at line 260

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

#providerKey : String

The provider key. Will be set by TravelNotes

Source : file routeProviders/OpenRouteServiceRouteProvider.js at line 47

#route : Route

A reference to the edited route

Source : file routeProviders/OpenRouteServiceRouteProvider.js at line 54

Private getters and setters

readonly static get #ICON_LIST : Array of String

Enum for icons

Source : file routeProviders/OpenRouteServiceRouteProvider.js at line 68

readonly static get #ROUND_VALUE : Number

The round value used by PolylineEncoder

Source : file routeProviders/OpenRouteServiceRouteProvider.js at line 61

Private methods

#getBody ( )

Gives the options and wayPoints for the request body

Source : file routeProviders/OpenRouteServiceRouteProvider.js at line 202

Returns

A string with the wayPoint coordinates, elevation param and language in JSON format
Type : String

#getRequestHeaders ( )

Gives the request headers

Source : file routeProviders/OpenRouteServiceRouteProvider.js at line 187

Returns

An array with the needed request headers
Type : Array of Object

#getRoute ( onOk, onError )

Overload of the base class #getRoute ( ) method

Source : file routeProviders/OpenRouteServiceRouteProvider.js at line 224

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/OpenRouteServiceRouteProvider.js at line 164

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/OpenRouteServiceRouteProvider.js at line 94

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