Class: EditTrailRoutingLayer

alk.layer.EditTrailRoutingLayer

An instance of this class is a alk.layer.SingleRoutingLayer with an edit trail that can move backward (prev), record (push), and next.

new alk.layer.EditTrailRoutingLayer(opt_options)

This constructor cretes a layer for the using the Single Routing Layer with an edit trail.

If no 'source' is provided in the options, then a new alk.source.EditTrailRoute source is created with a new alk.service.RouteService service created with the provided 'routeServiceOptions' in the options.

Option Type Description
source alkx.RouteServiceOptions | undefined

This option contains the alk.source.Route for the layer. alk.service.RouteService to create the route.

routeServiceOptions alkx.RouteServiceOptions | undefined

This option contains the options that are given to the underlying alk.service.RouteService to create the route.

frameRoute boolean | undefined

This option specifies when the to the underlying alk.service.RouteService completes successfully, the map will zoom and center to fit the extent of its features.

renderOrder ol.RenderOrderFunction | null | undefined

This option is an OpenLayer Vector Layer Option.

Render Order. Function to be used when sorting features before rendering. By default features are drawn in the order that they are created. Use null to avoid the sort, but get an undefined draw order. Required.

The default order of creation is, route lines, then stops in order from origin to destination.

minResolution number | undefined

This option is an OpenLayer Vector Layer Option.

The minimum resolution (inclusive) at which this layer will be visible.

maxResolution number | undefined

This option is an OpenLayer Vector Layer Option.

The maximum resolution (exclusive) below which this layer will be visible.

opacity number | undefined

This option is an OpenLayer Vector Layer Option.

Opacity (0, 1). Default is 1.

declutter boolean | undefined

This option is an OpenLayer Vector Layer Option.

Declutter images and text. Decluttering is applied to all image and text styles, and the priority is defined by the z-index of the style. Lower z-index means higher priority. Default is false.

renderBuffer number | undefined

This option is an OpenLayer Vector Layer Option.

The buffer around the viewport extent used by the renderer when getting features from the vector source for the rendering or hit-detection. Recommended value: the size of the largest symbol, line width, or label. Default is 100 pixels.

map ol.PluggableMap | undefined

This option is an OpenLayer Vector Layer Option.

Sets the layer as overlay on a map. The map will not manage this layer in its layers collection, and the layer will be rendered on top. This is useful for temporary layers. The standard way to add a layer to a map and have it managed by the map is to use ol.Map#addLayer.

style alk.style.RoutingLayerStyle | alk.style.StrokeQueue | Array.<ol.style.Stroke> | ol.style.Style | Array.<ol.style.Style> | ol.StyleFunction | undefined

This option specifies the style or style function to be used in drawing the stops and route. The default is to use a alk.style.StopsRouteStyle object that labels stops according to their stop type and draws the route lines in between.

If the style is a alk.style.RoutingLayerStyle it is used directly. All others result in creating a alk.style.StopsRouteStyle with the given style. If the style is a alk.style.StrokeQueue it creates a StopsRouteStyle with this StrokeQueue. This approach allows you to direct which colors are drawn for routes on different routing layers.

If the style is a single stroke, it sets up a StrokeQueue containing that stroke. If it is an array of Strokes, it sets up a StrokeQueue containing those strokes.

If it is anything else, the style is passed to the ol.layer.Vector for default styling.

updateWhileAnimating boolean | undefined

This option is an OpenLayer Vector Layer Option.

When set to true, feature batches will be recreated during animations. This means that no vectors will be shown clipped, but the setting will have a performance impact for large amounts of vector data. When set to false, batches will be recreated when no animation is active. Default is false.

updateWhileInteracting boolean | undefined

This option is an OpenLayer Vector Layer Option.

When set to true, feature batches will be recreated during interactions. See also updateWhileAnimating.

visible boolean | undefined

This option is an OpenLayer Vector Layer Option.

Visibility. Default is true (visible).

zIndex number | undefined

This option is an OpenLayer Vector Layer Option.

The z-index for layer rendering. At rendering time, the layers will be ordered, first by Z-index and then by position. The default Z-index is 0.

Fires:
change:route
Fires the 'change:route' event when done processing the response.
Example
var map = new ol.Map({
  layers: [ new alk.layer.BaseMapLayer() ]
  });
var routingLayer = new alk.layer.EditTrailRoutingLayer();
map.addLayer(routingLayer);
var routeOptions1 = {
   stops: [
     [-76.11735, 43.03343],
     [-75.1747547, 39.9673709],
     [-74.721516, 40.074719],
     [-74.6027002, 40.3611409]
   ],
   hubRouting: false,
   stopTypes: {0: alk.val.StopType.Origin,
               1: alk.val.StopType.WayPoint,
               2: alk.val.StopType.ViaPoint,
               3: alk.val.StopType.Destination }
 };
routingLayer.pushRoute(routeOptions1);

Extends

Methods

This method directly calls the alk.source.SingleRoute#getRoute method.

getRoutingLayerStyle(){alk.style.RoutingLayerStyle|undefined} inherited

This function returns the RoutingLayerStyle that was either assigned or created for this RoutingLayer.

nextRoute()

This method calls directly to the associated source's alk.source.EditTrailRoute#nextRoute method.

prevRoute()

This method calls directly to the associated source's alk.source.EditTrailRoute#prevRoute method.

pushRoute(opt_options, success, failure)

This method calls directly to the associated source's alk.source.EditTrailRoute#pushRoute method.

Name Type Description
options Object
success function
failure function
Fires:
change:route
Fires the 'change:route' event when done processing the response.

resetEditTrail()

This method calls directly to the associated source's alk.source.EditTrailRoute#resetEditTrail method.

setRoute(opt_options, success, failure) inherited

This method calls directly to the associated source's alk.source.SingleRoute#setRoute method.

Name Type Description
options Object
success function
failure function

setStyle(optStyle) inherited

This function sets the Style for this layer.

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