Documentation
Reference
2.1.50 (current version)
collection
interactivityModel
Interfaces

multiRouter.Editor

Extends ICustomizable, IEventEmitter.

Multi-stop route editor.

Constructor | Fields | Events | Methods

Constructor

multiRouter.Editor(multiRoute[, state[, options]])

Creates a multi-stop route editor.

Parameters:

ParameterDefault valueDescription
multiRoute *
[no-highlight[

* Mandatory parameter/option.

]no-highlight]

Type: multiRouter.MultiRoute

The multi-stop route being edited.

state

Type: Object

Object which describes the initial state of the editor. For a list of available fields, see multiRouter.Editor.state.

options

Type: Object

Options.

options.drawCursor

Type: Object

Name of cursor to use in the mode for adding new waypoints.

options.drawOver true

Type: Object

Allows to put points on top of map objects in the mode for adding new waypoints.

options.midPointsType "way"

Type: String

Specifies type of the points added while dragging the marker which appears when hovering the mouse cursor over the active route. Accepts one of the following string values:

  • "way" - Add waypoints.
  • "via" - Add throughpoints.
See also the description of the addMidPoints field for the state manager multiRouter.Editor.state.

* Mandatory parameter/option.

Fields

NameTypeDescription
eventsIEventManager

Event manager.

Inherited from IEventEmitter.

optionsIOptionManager

Options manager.

Inherited from ICustomizable.

statedata.Manager

The state manager of the multi-stop route editor.

Available fields:

  • addWayPoints: Boolean - Allows adding new waypoints by clicking on the map. Default value: false.
  • dragWayPoints: Boolean - Allows dragging existing waypoints. Default value: true.
  • removeWayPoints: Boolean - Allows deleting waypoints by double-clicking on them. Default value: false.
  • dragViaPoints: Boolean - Allows dragging existing throughpoints. Default value: true.
  • removeViaPoints: Boolean - Allows deleting throughpoints by double-clicking on them. Default value: true.
  • addMidPoints: Boolean - Allows adding intermediate throughpoints or waypoints by dragging the placemark which appears when you hover the mouse over the active route. The type of point to add is set by the option midPointsType. Default value: true.

Events

NameDescription
beforemidpointadd

Event preceding the "midpointadd" event. Instance of the Event class. Names of fields that are available via the Event.get method:

  • coords: Number[] - Coordinates for adding a midpoint.
  • pointType: String - Type ID for the midpoint being added.
  • insertIndex: Integer - The insertion index of the midpoint in the set of reference points for the multi-stop route.
Names of methods that are accessible via Event.callMethod:
  • setPointType - The method that allows you to set the type of the added point. Takes a string identifier of the type as the argument (see the description of the midPointsType option).
  • setInsertIndex - The method that allows you to adjust the insertion index of a midpoint before it is applied. Takes the new index as the argument.
If you call the Event.preventDefault method of this event, the next midpoint to add, as well as the "midpointadd" event, will be canceled.

beforemidpointdrag

The event preceding the "midpointdrag" event. Instance of the Event class. Names of fields that are available via the Event.get method:

  • pixelOffset: Number[] - Pixel shift along the axes at the given step.
Names of methods that are accessible via Event.callMethod:
  • setPixelOffset - This method is for correcting the value of the pixel offset that will actually be applied. It takes an argument with the new pixel offset in the form of an array of two numbers.
If the Event.preventDefault method is called for this event, the subsequent "midpointdrag" event will be canceled.

beforemidpointpinshow

The event preceding the "midpointpinshow" event. Instance of the Event class. Names of fields that are available via the Event.get method:

  • pin: Placemark - Reference to the placemark object.
  • globalPixels: Number[] - Global pixel coordinates of the placemark.
  • segment: multiRouter.driving.Segment - Reference to the segment of the route where the placemark should appear.
If the Event.preventDefault method is called for this event, a subsequent "midpointpinshow" event will be canceled and the placemark will be hidden.

beforeviapointdrag

The event preceding the "viapointdrag" event. Instance of the Event class. Names of fields that are available via the Event.get method:

  • pixelOffset: Number[] - Pixel shift along the axes at the given step.
  • viaPoint: multiRouter.ViaPoint - A reference to the throughpoint object being dragged.
Names of methods that are accessible via Event.callMethod:
  • setPixelOffset - This method is for correcting the value of the pixel offset that will actually be applied. It takes an argument with the new pixel offset in the form of an array of two numbers.
If the Event.preventDefault method is called for this event, a subsequent "viapointdrag" event will be canceled.

beforeviapointdragstart

The event preceding the "viapointdragstart" event. Instance of the Event class. Names of fields that are available via the Event.get method:

  • domEvent: DomEvent - The source DOM event, if there is one.
  • viaPoint: multiRouter.ViaPoint - A reference to the throughpoint object being dragged.
If the Event.preventDefault method is called for this event, any subsequent dragging, as well as the "viapointdragstart" event, will be canceled.

beforeviapointremove

The event preceding the "viapointremove" event. Instance of the Event class. Names of fields that are available via the Event.get method:

If the Event.preventDefault method is called for this event, deletion of a throughpoint, as well as a subsequent "viapointremove" event, will be canceled.

beforewaypointadd

Event preceding the "waypointadd" event. Instance of the Event class. Names of fields that are available via the Event.get method:

  • coords: Number[] - Coordinates of the added waypoint.
Names of methods that are accessible via Event.callMethod:
  • setCoords - Method that allows you to adjust the coordinates of the waypoint being added. It takes an argument with the new pixel shift in the form of an array of two numbers.
If the Event.preventDefault method is called for this event, addition of a waypoint, as well as a subsequent "waypointadd" event, will be canceled.

beforewaypointdrag

The event preceding the "waypointdrag" event. Instance of the Event class. Names of fields that are available via the Event.get method:

  • pixelOffset: Number[] - Pixel shift along the axes at the given step.
  • wayPoint: multiRouter.WayPoint - A reference to the waypoint object being dragged.
Names of methods that are accessible via Event.callMethod:
  • setPixelOffset - This method is for correcting the value of the pixel offset that will actually be applied. It takes an argument with the new pixel offset in the form of an array of two numbers.
If the Event.preventDefault method is called for this event, a subsequent "waypointdrag" event will be canceled.

beforewaypointdragstart

The event preceding the "waypointdragstart" event. Instance of the Event class. Names of fields that are available via the Event.get method:

  • domEvent: DomEvent - The source DOM event, if there is one.
  • wayPoint: multiRouter.WayPoint - A reference to the waypoint object being dragged.
If the Event.preventDefault method is called for this event, any subsequent dragging, as well as the "waypointdragstart" event, will be canceled.

beforewaypointremove

The event preceding the "waypointremove" event. Instance of the Event class. Names of fields that are available via the Event.get method:

If the Event.preventDefault method is called for this event, removal of the waypoint, as well as a subsequent "waypointremove" event, will be canceled.

midpointadd

Adding a midpoint (intermediate point) to the route. The point type is determined by the value of the midPointsType option. Instance of the Event class. Names of fields that are available via the Event.get method:

  • coords: Number[] - Coordinates for adding a midpoint.
  • pointType: String - Type ID for the midpoint being added.
  • insertIndex: Integer - The insertion index of the midpoint in the set of reference points for the multi-stop route.

midpointdrag

Dragging the added midpoint. Instance of the Event class. Names of fields that are available via the Event.get method:

  • pixelOffset: Number[] - Pixel shift along the axes at the given step.

midpointdragend

End of dragging the added midpoint. Instance of the Event class.

midpointpinshow

Displaying the draggable placemark when you hover over the active route. Instance of the Event class. Names of fields that are available via the Event.get method:

  • pin: Placemark - Reference to the placemark object.
  • globalPixels: Number[] - Global pixel coordinates of the placemark.
  • segment: multiRouter.driving.Segment - Reference to the segment of the route where the placemark appeared.

optionschange

Change to the object options.

Inherited from ICustomizable.

viapointdrag

Throughpoint dragging. Instance of the Event class. Names of fields that are available via the Event.get method:

  • pixelOffset: Number[] - Pixel shift along the axes at the given step.
  • viaPoint: multiRouter.ViaPoint - A reference to the throughpoint object being dragged.

viapointdragend

End of throughpoint dragging. Instance of the Event class. Names of fields that are available via the Event.get method:

viapointdragstart

Start of throughpoint dragging. Instance of the Event class. Names of fields that are available via the Event.get method:

  • domEvent: DomEvent - The source DOM event, if there is one.
  • viaPoint: multiRouter.ViaPoint - A reference to the throughpoint object being dragged.

viapointremove

Deleting a throughpoint. Instance of the Event class. Names of fields that are available via the Event.get method:

waypointadd

Adding a waypoint. Instance of the Event class. Names of fields that are available via the Event.get method:

  • coords: Number[] - Coordinates of the added waypoint.

waypointdrag

Waypoint dragging. Instance of the Event class. Names of fields that are available via the Event.get method:

  • pixelOffset: Number[] - Pixel shift along the axes at the given step.
  • wayPoint: multiRouter.WayPoint - A reference to the waypoint object being dragged.

waypointdragend

End of waypoint dragging. Instance of the Event class. Names of fields that are available via the Event.get method:

waypointdragstart

Start of waypoint dragging. Instance of the Event class. Names of fields that are available via the Event.get method:

  • domEvent: DomEvent - The source DOM event, if there is one.
  • wayPoint: multiRouter.WayPoint - A reference to the waypoint object being dragged.

waypointremove

Deleting a waypoint. Instance of the Event class. Names of fields that are available via the Event.get method:

Methods

NameReturnsDescription
destroy()

Destroys the multi-stop route editor.

getMultiRoute()

multiRouter.MultiRoute

Returns a reference to the multi-stop route being edited.

Fields details

state

{data.Manager} state

The state manager of the multi-stop route editor.

Available fields:

  • addWayPoints: Boolean - Allows adding new waypoints by clicking on the map. Default value: false.
  • dragWayPoints: Boolean - Allows dragging existing waypoints. Default value: true.
  • removeWayPoints: Boolean - Allows deleting waypoints by double-clicking on them. Default value: false.
  • dragViaPoints: Boolean - Allows dragging existing throughpoints. Default value: true.
  • removeViaPoints: Boolean - Allows deleting throughpoints by double-clicking on them. Default value: true.
  • addMidPoints: Boolean - Allows adding intermediate throughpoints or waypoints by dragging the placemark which appears when you hover the mouse over the active route. The type of point to add is set by the option midPointsType. Default value: true.

Events details

beforemidpointadd

Event preceding the "midpointadd" event. Instance of the Event class. Names of fields that are available via the Event.get method:

  • coords: Number[] - Coordinates for adding a midpoint.
  • pointType: String - Type ID for the midpoint being added.
  • insertIndex: Integer - The insertion index of the midpoint in the set of reference points for the multi-stop route.
Names of methods that are accessible via Event.callMethod:
  • setPointType - The method that allows you to set the type of the added point. Takes a string identifier of the type as the argument (see the description of the midPointsType option).
  • setInsertIndex - The method that allows you to adjust the insertion index of a midpoint before it is applied. Takes the new index as the argument.
If you call the Event.preventDefault method of this event, the next midpoint to add, as well as the "midpointadd" event, will be canceled.

beforemidpointdrag

The event preceding the "midpointdrag" event. Instance of the Event class. Names of fields that are available via the Event.get method:

  • pixelOffset: Number[] - Pixel shift along the axes at the given step.
Names of methods that are accessible via Event.callMethod:
  • setPixelOffset - This method is for correcting the value of the pixel offset that will actually be applied. It takes an argument with the new pixel offset in the form of an array of two numbers.
If the Event.preventDefault method is called for this event, the subsequent "midpointdrag" event will be canceled.

beforemidpointpinshow

The event preceding the "midpointpinshow" event. Instance of the Event class. Names of fields that are available via the Event.get method:

  • pin: Placemark - Reference to the placemark object.
  • globalPixels: Number[] - Global pixel coordinates of the placemark.
  • segment: multiRouter.driving.Segment - Reference to the segment of the route where the placemark should appear.
If the Event.preventDefault method is called for this event, a subsequent "midpointpinshow" event will be canceled and the placemark will be hidden.

beforeviapointdrag

The event preceding the "viapointdrag" event. Instance of the Event class. Names of fields that are available via the Event.get method:

  • pixelOffset: Number[] - Pixel shift along the axes at the given step.
  • viaPoint: multiRouter.ViaPoint - A reference to the throughpoint object being dragged.
Names of methods that are accessible via Event.callMethod:
  • setPixelOffset - This method is for correcting the value of the pixel offset that will actually be applied. It takes an argument with the new pixel offset in the form of an array of two numbers.
If the Event.preventDefault method is called for this event, a subsequent "viapointdrag" event will be canceled.

beforeviapointdragstart

The event preceding the "viapointdragstart" event. Instance of the Event class. Names of fields that are available via the Event.get method:

  • domEvent: DomEvent - The source DOM event, if there is one.
  • viaPoint: multiRouter.ViaPoint - A reference to the throughpoint object being dragged.
If the Event.preventDefault method is called for this event, any subsequent dragging, as well as the "viapointdragstart" event, will be canceled.

beforeviapointremove

The event preceding the "viapointremove" event. Instance of the Event class. Names of fields that are available via the Event.get method:

If the Event.preventDefault method is called for this event, deletion of a throughpoint, as well as a subsequent "viapointremove" event, will be canceled.

beforewaypointadd

Event preceding the "waypointadd" event. Instance of the Event class. Names of fields that are available via the Event.get method:

  • coords: Number[] - Coordinates of the added waypoint.
Names of methods that are accessible via Event.callMethod:
  • setCoords - Method that allows you to adjust the coordinates of the waypoint being added. It takes an argument with the new pixel shift in the form of an array of two numbers.
If the Event.preventDefault method is called for this event, addition of a waypoint, as well as a subsequent "waypointadd" event, will be canceled.

beforewaypointdrag

The event preceding the "waypointdrag" event. Instance of the Event class. Names of fields that are available via the Event.get method:

  • pixelOffset: Number[] - Pixel shift along the axes at the given step.
  • wayPoint: multiRouter.WayPoint - A reference to the waypoint object being dragged.
Names of methods that are accessible via Event.callMethod:
  • setPixelOffset - This method is for correcting the value of the pixel offset that will actually be applied. It takes an argument with the new pixel offset in the form of an array of two numbers.
If the Event.preventDefault method is called for this event, a subsequent "waypointdrag" event will be canceled.

beforewaypointdragstart

The event preceding the "waypointdragstart" event. Instance of the Event class. Names of fields that are available via the Event.get method:

  • domEvent: DomEvent - The source DOM event, if there is one.
  • wayPoint: multiRouter.WayPoint - A reference to the waypoint object being dragged.
If the Event.preventDefault method is called for this event, any subsequent dragging, as well as the "waypointdragstart" event, will be canceled.

beforewaypointremove

The event preceding the "waypointremove" event. Instance of the Event class. Names of fields that are available via the Event.get method:

If the Event.preventDefault method is called for this event, removal of the waypoint, as well as a subsequent "waypointremove" event, will be canceled.

midpointadd

Adding a midpoint (intermediate point) to the route. The point type is determined by the value of the midPointsType option. Instance of the Event class. Names of fields that are available via the Event.get method:

  • coords: Number[] - Coordinates for adding a midpoint.
  • pointType: String - Type ID for the midpoint being added.
  • insertIndex: Integer - The insertion index of the midpoint in the set of reference points for the multi-stop route.

midpointdrag

Dragging the added midpoint. Instance of the Event class. Names of fields that are available via the Event.get method:

  • pixelOffset: Number[] - Pixel shift along the axes at the given step.

midpointdragend

End of dragging the added midpoint. Instance of the Event class.

midpointpinshow

Displaying the draggable placemark when you hover over the active route. Instance of the Event class. Names of fields that are available via the Event.get method:

  • pin: Placemark - Reference to the placemark object.
  • globalPixels: Number[] - Global pixel coordinates of the placemark.
  • segment: multiRouter.driving.Segment - Reference to the segment of the route where the placemark appeared.

viapointdrag

Throughpoint dragging. Instance of the Event class. Names of fields that are available via the Event.get method:

  • pixelOffset: Number[] - Pixel shift along the axes at the given step.
  • viaPoint: multiRouter.ViaPoint - A reference to the throughpoint object being dragged.

viapointdragend

End of throughpoint dragging. Instance of the Event class. Names of fields that are available via the Event.get method:

viapointdragstart

Start of throughpoint dragging. Instance of the Event class. Names of fields that are available via the Event.get method:

  • domEvent: DomEvent - The source DOM event, if there is one.
  • viaPoint: multiRouter.ViaPoint - A reference to the throughpoint object being dragged.

viapointremove

Deleting a throughpoint. Instance of the Event class. Names of fields that are available via the Event.get method:

waypointadd

Adding a waypoint. Instance of the Event class. Names of fields that are available via the Event.get method:

  • coords: Number[] - Coordinates of the added waypoint.

waypointdrag

Waypoint dragging. Instance of the Event class. Names of fields that are available via the Event.get method:

  • pixelOffset: Number[] - Pixel shift along the axes at the given step.
  • wayPoint: multiRouter.WayPoint - A reference to the waypoint object being dragged.

waypointdragend

End of waypoint dragging. Instance of the Event class. Names of fields that are available via the Event.get method:

waypointdragstart

Start of waypoint dragging. Instance of the Event class. Names of fields that are available via the Event.get method:

  • domEvent: DomEvent - The source DOM event, if there is one.
  • wayPoint: multiRouter.WayPoint - A reference to the waypoint object being dragged.

waypointremove

Deleting a waypoint. Instance of the Event class. Names of fields that are available via the Event.get method:

Methods details

destroy

{} destroy()

Destroys the multi-stop route editor.

getMultiRoute

{multiRouter.MultiRoute} getMultiRoute()

Returns a reference to the multi-stop route being edited.