Documentation
Reference
2.1.55 (current version)
collection
interactivityModel
Interfaces

multiRouter.masstransit.RouteModel

Note. The constructor of the multiRouter.masstransit.RouteModel class is hidden, as this class is not intended for autonomous initialization.

Extends IEventEmitter.

Data model of an individual route of public transport. A multi-stop route can consist of several individual routes.

Fields | Events | Methods

Creates the data model for an individual route of public transport.

Fields

NameTypeDescription
eventsIEventManager

Event manager.

Inherited from IEventEmitter.

multiRoutemultiRouter.MultiRouteModel

Reference to the parent model of a multi-stop route.

propertiesdata.Manager

The route data. The following fields are available:

  • index: Integer - The ordinal number of the route in a multi-stop route.
  • type: String - Route type identifier, which takes the value "masstransit" for public transport routes.
  • distance: Object - An object with the "text" and "value" fields that specifies the length of the route in meters.
  • duration: Object - An object with the "text" and "value" fields that specifies the travel time of the route in seconds.
  • boundedBy: Number[][] - Coordinates of the upper and lower corners of the rectangle that bounds the route.

Events

NameDescription
update

Updating the model with new data. Instance of the Event class. Names of fields that are available via the Event#get method:

  • pathsChange: Boolean - Flag for whether the set of paths is changed.

Methods

NameReturnsDescription
destroy()

Destroys a model.

getPaths()

multiRouter.masstransit.PathModel[]

Returns array of route paths.

getType()

String

Returns ID of the route type. For public transport routes, the string "masstransit" is returned.

update(routeJson)

Updates the state of the model.

Fields details

multiRoute

Reference to the parent model of a multi-stop route.

properties

{data.Manager} properties

The route data. The following fields are available:

  • index: Integer - The ordinal number of the route in a multi-stop route.
  • type: String - Route type identifier, which takes the value "masstransit" for public transport routes.
  • distance: Object - An object with the "text" and "value" fields that specifies the length of the route in meters.
  • duration: Object - An object with the "text" and "value" fields that specifies the travel time of the route in seconds.
  • boundedBy: Number[][] - Coordinates of the upper and lower corners of the rectangle that bounds the route.

Events details

update

Updating the model with new data. Instance of the Event class. Names of fields that are available via the Event#get method:

  • pathsChange: Boolean - Flag for whether the set of paths is changed.

Methods details

destroy

{} destroy()

Destroys a model.

getPaths

Returns array of route paths.

getType

{String} getType()

Returns ID of the route type. For public transport routes, the string "masstransit" is returned.

update

{} update(routeJson)

Updates the state of the model.

Parameters:

ParameterDefault valueDescription
routeJson*
[no-highlight[

* Mandatory parameter/option.

]no-highlight]

Type: Object

JSON data.

* Mandatory parameter/option.