Class: ViaPointRouteModify

alk.interaction.ViaPointRouteModify

An instance of this class provides a Route Modify object for the alk.layer.RoutingLayer.

new alk.interaction.ViaPointRouteModify(opt_options)

This constructor creates an Interaction object that provides a Route Modify object for the alk.layer.RoutingLayer that only creates and deletes ViaPoints.

The given stops, or stops labeled alk.val.StopType.WayPoint, alk.val.StopType.Origin or alk.val.StopType.Destination are protected in that they cannot be deleted or moved. Any points created on the route will be created as ViaPoints and they subsequently may be deleted.

Option Type Description
routingLayer alk.layer.RoutingLayer

This option specifies the alk.layer.RoutingLayer that the alk.interaction.RouteModify interaction will be manipulating.

condition ol.EventsConditionType | undefined

This option is an OpenLayers option passed on to the ol.interaction.Modify super class of this alk.interaction.RouteModify interaction.

A function that takes an ol.MapBrowserEvent and returns a boolean to indicate whether that even will be considered to add or move a vertex to the sketch. Default is ol.events.condition.primaryAction.

deleteCondition ol.EventsConditionType | undefined

This option is an OpenLayers option passed on to the ol.interaction.Modify super class of this alk.interaction.RouteModify interaction.

QA function that takes an ol.events.MapBrowserEvent and returns a boolean to indicate whether that event should be handled. By Default, ol.events.condition.singleClick with ol.events.condition.noModifierKeys results in a vertex deletion.

Specific to alk.interaction.RouteModify vertexes only apply to stops of the alk.layer.RoutingLayer.

pixelTolerance number | undefined

This option is an OpenLayers option passed on to the ol.interaction.Modify super class of this alk.interaction.RouteModify interaction.

Pixel tolerance for considering the pointer close enough to a segment or vertex for editing.

Specific to alk.interaction.RouteModify the default is 2 pixels. This prevents from collecting stops or via points in deletion when editing close to the route line.

style ol.style.Style | Array.<ol.style.Style> | ol.StyleFunction | undefined

This option is an OpenLayers option passed on to the ol.interaction.Modify super class of this alk.interaction.RouteModify interaction.

Style used for the features being modified. By default the default edit style is used (see ol.style.

wrapX boolean | undefined

This option is an OpenLayers option passed on to the ol.interaction.Modify super class of this alk.interaction.RouteModify interaction.

Wrap the world horizontally on the sketch overlay. Default is false.

Fires:
change:routingLayer
This event fires when the routing layer is updated.

Extends

Members

routingLayer{alk.layer.RoutingLayer}

routingLayerStyle{alk.style.RoutingLayerStyle}

This attribute contains the RoutingLayerStyle that was either assigned or created for this RoutingLayer.

Methods

getCreationStopType(){alk.val.StopType} inherited

This function returns the stop type of a stop that is added by this modifier.

getModifiableStopTypes(){Array.<alk.val.StopType>} inherited

This function returns an array of the stop types that may be modified. This particular implementation only allows alk.val.StopType.ViaPoint.

getModifiedSegments(){Array.<ol.Feature>} inherited

This function returns the segment features deemed to be modified since the modify event began.

getModifiedStops(){Array.<ol.Feature>} inherited

This function returns the stop features deemed to be modified since the modify event began.

handleEvent(mapBrowserEvent){boolean} inherited

This override handles an exception from the event handler usually on 'pointerup' where it seems it is a delayed event or race condition on removal of a feature, because the exception caught is it OID is not found. We log the exception and continue without incident. TODO: More research needed on why OID is not found or why feature went away, or why event happened at all.

Name Type Description
mapBrowserEvent ol.MapBrowserPointerEvent

processEvent(event){alkx.RouteServiceOptions|null} inherited

This method is invoked by the modify end handler to process the event. If it returns routeServiceOptions, it sends them to the associated alk.layer.RoutingLayer for a new Route, otherwise nothing is done. This method gives the ability to override this method in sub-classes.

Name Type Description
event ol.interaction.Modify.Event

processStyle(optStyle){ol.style.Style|Array.<ol.style.Style>|ol.StyleFunction} inherited

This function assigns or creates the RoutingLayerStyle from 'style' option. If we don't understand the value, we just let it go, figuring that the caller knows what they are doing.

Name Type Description
optStyle alk.style.RoutingLayerStyle | alk.style.StrokeQueue | Array.<ol.style.Stroke> | ol.style.Stroke | ol.style.Style | Array.<ol.style.Style> | ol.StyleFunction | string | undefined

setRoutingLayer(layer) inherited

This method sets the routing layer.

Name Type Description
layer alk.layer.RoutingLayer

The routing layer

Fires:
change:routingLayer
This event fires when the routing layer is updated.

shouldModify(coords, index, stopType){boolean} inherited

This function decides whether a stop will be modifiable by this Route Modify.

Name Type Description
coords Array.<number>
index number
stopType alk.val.StopType | undefined