Class: StopsRouteStyle

alk.style.StopsRouteStyle

An instance of this class provides a ol.style.StyleFunction for the alk.layer.MultiRoutingLayer that draws route lines of a designated stroke style and stops along the route using a start circle, indexed circle for interim stops, and a destination circle if applicable.

new alk.style.StopsRouteStyle(opt_options)

This constructor creates a Style Function that styles the MutiRoutingLayer.

All Features pertaining the RoutingLayer will have the 'routeId' property set. Paths: These are features with 'LineString' and 'MultiLineString' geometries. Stops: These features will have the following properties set: 'stop' : (Array.) contains the original coordinates of the stop. 'stopIndex' : (number) contains a [0,n) index in the presented stops. 'logicalStopIndex: (number) contains a[0,n] index in the presented stops that do not include a stopType of alk.val.StopType.ViaPoint. 'stopType' : (alk.val.StopType|undefined). 'hubRouting' : (boolean|undefined);

Features tagged with 'stop' may also be tagged with 'stopType' of ol.val.StopType according to the policy set forth in the RoutingLayer. For instance, a Route with 'hubRouting' set will not have a 'stop' feature with a 'stopType' of alk.val.StopType.Destination.

The default behavior is to style the route Origin with a green circle, and the route Destination with a red circle. All interim stops will be styled with the stroke style for the its route, and they will contain letters, or ordinal numbers depending on whether hubRouting is true, or not, respectively.

Name Type Description
options Object

Subclasses

Extends

Members

layer{ol.layer.Vector}

Methods

clearStrokeForRouteId(routeId) inherited

This function clears the assigned, if any, stroke style for the given routeId identifier.

Name Type Description
routeId string

defaultDestinationImage(){ol.style.Image}

This function returns the default style for a stop feature with the feature's 'stopType' property of alk.val.StopType.Destination.

For this implementation, the defaultOriginImage is used for all stopTypes of alk.val.StopType.Destination regardless of the route's stroke color.

defaultOriginImage(){ol.style.Image}

This function returns the default image for a stop feature with the feature's 'stopType' property of alk.val.StopType.Origin.

For this implementation, the defaultOriginImage is used for all stopTypes of alk.val.StopType.Origin regardless of the route's stroke color.

defaultViaPointImage(){ol.style.Image}

This function returns the default image for a stop feature with the feature's 'stopType' property of alk.val.StopType.ViaPoint.

For this implementation, the defaultOriginImage is used for all stopTypes of alk.val.StopType.Origin regardless of the route's stroke color.

defaultWayPointImage(){ol.style.Image}

This function returns the default image for a stop feature with the feature's 'stopType' property of alk.val.StopType.WayPoint.

For this implementation, the defaultOriginImage is NOT used. The alk.style.StopsRouteStyle#getWayPointImage returns a different image according to the route's stroke color.

getDestinationImage(stroke){ol.style.Image}

This function returns the image to use in styling a stop feature with the feature's 'stopType' property of alk.val.StopType.Destination.

This implementation ignores the stroke style and returns the alk.style.StopsRouteStyle#defaultDestinationImage.

Name Type Description
stroke ol.style.Stroke

The route's stroke style.

getDestinationStyleFunction(feature, resolution){ol.style.Style|null}

This style function returns a style for a stop with the feature's 'stopType' property of alk.val.StopType.Destination.

This implementation returns a style containing the image returned by alk.style.StopsRouteStyle#getDestinationImage.

Name Type Description
feature ol.Feature

The stop feature

resolution number

getOriginImage(stroke){ol.style.Image}

This function returns the image to use in styling a stop feature with the feature's 'stopType' property of alk.val.StopType.Origin.

This implementation ignores the stroke style and returns the default origin image.

Name Type Description
stroke ol.style.Stroke

The route's stroke style.

getOriginStyleFunction(feature, resolution){ol.style.Style|null}

This function returns the ol.style.Style stop feature with the feature's 'stopType' property set to alk.val.StopType.Origin.

Name Type Description
feature ol.Feature

The stop feature

resolution number

getStopStyle(feature, resolution){ol.style.Style|null}

This function returns an ol.style.Style that styles a stop feature. The feature will be a Point geometry and will have its 'routeId', 'stop', 'stopIndex', and 'stopType', and 'logicalStopIndex' properties set.

This implementation calls out getOriginStyleFunction, getWayPointStyleFunction, getViaPointStyleFunction, and getDestinationStyleFunction, for each of the stop features.

Name Type Description
feature ol.Feature

The stop feature.

resolution number

The display resolution.

Returns:
If this returns null, no stop will be drawn.

getStrokeQueue(){alk.style.StrokeQueue|undefined} inherited

This function returns the stroke Queue.

getStrokeStyle(feature, resolution){ol.style.Stroke} inherited

This function returns the stroke style for the route.

Name Type Description
feature ol.Feature
resolution number

getUpdateStrokeStyle(feature, resolution){ol.style.Stroke} inherited

This function returns the Update Stroke Style, which is the same for all features and resolutions.

Name Type Description
feature ol.Feature

This argument is ignored.

resolution number

This argument is ignored.

getViaPointImage(stroke){ol.style.Image}

This function returns the image to use in styling a stop feature with the feature's 'stopType' property of alk.val.StopType.ViaPoint.

This implementation ignores the stroke style and returns the value from alk.style.StopsRouteStyle#defaultViaPointImage.

Name Type Description
stroke ol.style.Stroke

The route's stroke style.

getViaPointStyleFunction(feature, resolution){ol.style.Style|null}

This style function returns a style for a stop feature with the feature's 'stopType' property of alk.val.StopType.ViaPoint.

This implementation returns a style containing the image returned by alk.style.StopsRouteStyle#getViaPointImage.

Name Type Description
feature ol.Feature

The stop feature

resolution number

getWayPointImage(stroke){ol.style.Image}

This function returns the image to use in styling a stop feature with the feature's 'stopType' property of alk.val.StopType.WayPoint.

This implementation returns a ol.style.Circle styled with a white fill, and a color border of the route's stroke color. The width of the stroke is 3 pixels, and the radius of the circle is 9 pixels. The stroke color is 1.0 opacity equivalent to the route's stroke color, which should be at 0.5 opacity.

Name Type Description
stroke ol.style.Stroke

The route's stroke style.

getWayPointStyleFunction(feature, resolution){ol.style.Style|null}

This style function returns a style for a stop feature with the feature's 'stopType' property of alk.val.StopType.WayPoint.

This implementation returns the image returned by alk.style.StopsRouteStyle#getWayPointImage, superimposed with a index corresponding to the feature's 'logicalStopIndex' property. The index is a letter or number based on whether the feature's 'hubRouting' property is set to true, or not, respectively.

Name Type Description
feature ol.Feature

The stop feature

resolution number

setStrokeQueue(strokeQueue) inherited

This function sets the stroke style for this QueuedLineRouteStyle.

Name Type Description
strokeQueue alk.style.StrokeQueue

setStrokeStyle(strokeStyle) inherited

This function sets the stroke style for this LineRouteStyle.

Name Type Description
strokeStyle ol.style.Stroke

setUpdateStrokeStyle(stroke) inherited

This function sets the update stroke style.

Name Type Description
stroke ol.style.Stroke

setUpdating(value) inherited

This method is called when the 'updating' property of alk.layer.RoutingLayer is changed. This call gives the style the ability to style things differently when being updated.

Name Type Description
value boolean

styleFunction(feature, resolution){Array.<ol.style.Style>}

This function styles the RoutingLayer.

This particular implementation calls out to getStrokeStyle for color and width of the route. It calls out to getStopStyle to get styling for Stops.

Name Type Description
feature ol.Feature
resolution number