IRoutePanel

Extends IEventEmitter.

Interface for route panel.

Constructor | Fields | Events | Methods

Constructor

IRoutePanel()

Fields

Name

Type

Description

events

IEventManager

Event manager.

Inherited from IEventEmitter.

options

IOptionManager

Option manager. Names of options:

  • allowSwitch: Boolean = true - Whether button for switching way points should be shown.
  • reverseGeocoding: Boolean = true - Whether reverse geocoding should be enabled during routing.
  • adjustMapMargin: Boolean = false - Whether the panel registers its size in the map margins manager map.margin.Manager.
  • types: Object = { auto: true, masstransit: true, pedestrian: true, bicycle: true, taxi: false } - Specifies routing modes available for user to select in routing panel. When set, state.type is automatically adjusted, if current state.type becomes unavailable. Types are shown in panel only if two or more are available for user to select. Please note if you are using content security policy: in order to use type "taxi" you will need to update CSP rules to a latest version.

state

IDataManager

State manager. Names of states:

  • type: String - Routing type IMultiRouteParams.routingMode.
  • fromEnabled: Boolean - Enables the "from" field for users to enter the route origin.
  • from: String - Address or coordinates of departure.
  • toEnabled: Boolean - Enables the "to" field for users to enter the route destination.
  • to: String - Address or coordinates of arrival.

Events

Name

Description

disable

Route panel is unloaded.

enable

Route panel and it's dependencies are loaded and ready for user interactions.

Methods

Name

Returns

Description

enable()

Loads panel dependencies and enables it for usage.

geolocate(name)

vow.Promise

Use user's geolocation as coordinates for 'from' or 'to'.

getRoute()

multiRouter.MultiRoute

Alert

This method is deprecated. See IRoutePanel.getRouteAsync.

Returns built route.

getRouteAsync()

vow.Promise.<multiRouter.MultiRoute>

Returns vow.Promise, which will be resolved with built route. If an error occurs, the promise object is rejected.

isEnable()

Boolean

Returns whether panel is fully loaded.

switchPoints()

Switches points (and corresponding inputs).

Fields details

options

{IOptionManager} options

Option manager. Names of options:

  • allowSwitch: Boolean = true - Whether button for switching way points should be shown.
  • reverseGeocoding: Boolean = true - Whether reverse geocoding should be enabled during routing.
  • adjustMapMargin: Boolean = false - Whether the panel registers its size in the map margins manager map.margin.Manager.
  • types: Object = { auto: true, masstransit: true, pedestrian: true, bicycle: true, taxi: false } - Specifies routing modes available for user to select in routing panel. When set, state.type is automatically adjusted, if current state.type becomes unavailable. Types are shown in panel only if two or more are available for user to select. Please note if you are using content security policy: in order to use type "taxi" you will need to update CSP rules to a latest version.

state

{IDataManager} state

State manager. Names of states:

  • type: String - Routing type IMultiRouteParams.routingMode.
  • fromEnabled: Boolean - Enables the "from" field for users to enter the route origin.
  • from: String - Address or coordinates of departure.
  • toEnabled: Boolean - Enables the "to" field for users to enter the route destination.
  • to: String - Address or coordinates of arrival.

Events details

disable

Route panel is unloaded.

enable

Route panel and it's dependencies are loaded and ready for user interactions.

Methods details

enable

{} enable()

Loads panel dependencies and enables it for usage.

geolocate

{vow.Promise} geolocate(name)

Use user's geolocation as coordinates for 'from' or 'to'.

Returns Promise object. See geolocation.

Parameters:

Parameter

Default value

Description

name*

—

Type: String

Input to geolocate. Either 'from' or 'to'.

* Mandatory parameter/option.

getRoute

{multiRouter.MultiRoute} getRoute()

**This method is deprecated. **See IRoutePanel.getRouteAsync.

Returns built route.

getRouteAsync

{vow.Promise.<multiRouter.MultiRoute>} getRouteAsync()

Returns vow.Promise which:

isEnable

{Boolean} isEnable()

Returns whether panel is fully loaded.

switchPoints

{} switchPoints()

Switches points (and corresponding inputs).