multiRouter.driving.SegmentModel

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

Extends IEventEmitter.

Data model for a segment on the path of a driving route. A segment of a driving route is a part of the path from one manoeuver to another.

Fields | Events | Methods

Creates the data model for a segment on the path of a driving route.

Fields

Name Type Description
events IEventManager

Event manager.

Inherited from IEventEmitter.

geometry geometry.base.LineString

Geometry of a segment.

path multiRouter.driving.PathModel

Reference to the parent model of the path.

properties data.Manager
Segment data. The following fields are available:
  • index: Integer - The ordinal number of the segment in the array of segments of the corresponding route path.
  • type: String - Segment type identifier, which takes the value "driving" for automobile segments.
  • street: String - Text description of the street that the segment goes along.
  • action: Object - An object with the "text" and "value" fields that describes the final maneuver of the segment.
  • distance: Object - An object with the "text" and "value" fields that specifies the length of the segment in meters.
  • duration: Object - An object with the "text" and "value" fields that specifies the travel time of the segment in seconds.
  • durationInTraffic: Object - An object with the "text" and "value" fields that specifies the travel time of the segment (in seconds) considering traffic.
  • text: String - Text description of the segment.
  • viaPoints: Integer[] - Indexes of throughpoints lying on the segment.
  • lodIndex: Integer - The ordinal number of the first throughpoint of the segment in the full set of coordinates of the corresponding route path.

Events

Name Description
update

Updating the model with new data. Instance of the Event class.

Methods

Name Returns Description
destroy()

Destroys a model.

getType()

String

Returns ID of the segment type. For segments of automobile routes, it returns the string "driving".

getViaPoints()

multiRouter.ViaPointModel[]

Returns an array of throughpoints on the segment.

update(segmentJson)

Updates the state of the model.

Fields details

geometry

Geometry of a segment.

path

Reference to the parent model of the path.

properties

{data.Manager} properties
Segment data. The following fields are available:
  • index: Integer - The ordinal number of the segment in the array of segments of the corresponding route path.
  • type: String - Segment type identifier, which takes the value "driving" for automobile segments.
  • street: String - Text description of the street that the segment goes along.
  • action: Object - An object with the "text" and "value" fields that describes the final maneuver of the segment.
  • distance: Object - An object with the "text" and "value" fields that specifies the length of the segment in meters.
  • duration: Object - An object with the "text" and "value" fields that specifies the travel time of the segment in seconds.
  • durationInTraffic: Object - An object with the "text" and "value" fields that specifies the travel time of the segment (in seconds) considering traffic.
  • text: String - Text description of the segment.
  • viaPoints: Integer[] - Indexes of throughpoints lying on the segment.
  • lodIndex: Integer - The ordinal number of the first throughpoint of the segment in the full set of coordinates of the corresponding route path.

Events details

update

Updating the model with new data. Instance of the Event class.

Methods details

destroy

{} destroy()

Destroys a model.

getType

{String} getType()

Returns ID of the segment type. For segments of automobile routes, it returns the string "driving".

getViaPoints

{multiRouter.ViaPointModel[]} getViaPoints()

Returns an array of throughpoints on the segment.

update

{} update(segmentJson)

Updates the state of the model.

Parameters:

Parameter Default value Description
segmentJson *

Type: Object

JSON data.

* Mandatory parameter/option.