new alk.layer.RoutingLayer(opt_options)
This constructor creates the base layer for a Routing Layer to retrieve routing information from ALK Routing server and displaying the route in a map according to a style.
If no 'source' is provided in the options, then a new alk.source.SingleRoute
source
is created with a new alk.service.RouteService
service created with
the provided 'routeServiceOptions' in the options.
All visual representation is handled by the 'style' option.
As a default, the alk.style.StopsRouteStyle
is used, which
draws stops as cardinally numbered circles, save for the first and last stop, which are drawn with
non-numbered circles, green and red, respectively. The numbered circles retain the color of the
route line.
If the 'hubRouting' option is 'true', then the first stop is considered the 'hub' and the last stop is represented as a numbered circle in the ordered chain of stops.
Should you need a specific styling, please see alk.style.RoutingLayerStyle
as a base object to implement from, and other classes such as alk.style.LineRouteStyle
, etc.
The alk.style.StopsRouteStyle
has some options governing width of the line. If you need
specific styling, look to the '*RouteStyle' objects in alk.style
.
A Stop is represented as a ol.Feature
with a ol.geom.Point
geometry.
The segment between Stops is represented by a ol.Feature
with a ol.geom.LineString
geometry. The segments are tagged with a 'segmentIndex' property with the ordinal index, i.e. first
is zero.
All stops are ol.Feature
tagged with the 'stop' attribute, which contains
the original coordinates given to the alk.layer.RoutingLayer#setRoute
function. All stops
are tagged with a "stopIndex" attribute indicating the ordinal index in the given stop list, i.e.
start stop is '0'. Stops are also tagged with a 'stopType' attribute, designating alk.val.StopType.Origin
for the first (start) stop, alk.val.StopType.Destination
for the last stop.
If the 'hubRouting' option is true, all features, including lines are tagged with the 'hubRouting' attribute,
and the last stop does not carry the 'Destination' type, unless overridden by the 'stopTypes' option
in the call. All stops are tagged with a 'logicalStopIndex' attribute
which labels the stop in its ordinal position in the stops list, while ignoring stops with the 'stopType'
of alk.val.StopType.ViaPoint
.
Option | Type | Description |
---|---|---|
source |
alkx.RouteServiceOptions | undefined |
This option contains the |
routeServiceOptions |
alkx.RouteServiceOptions | undefined |
This option contains the options that are given to the underlying
|
frameRoute |
boolean | undefined |
This option specifies when the to the underlying |
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 |
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 |
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 If the style is a 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 |
visible |
boolean | undefined |
This option is an OpenLayer Vector Layer Option. Visibility. Default is |
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. |
Subclasses
Extends
- ol.layer.Vector
Methods
-
getRoutingLayerStyle(){alk.style.RoutingLayerStyle|undefined}
-
This function returns the RoutingLayerStyle that was either assigned or created for this RoutingLayer.
-
setStyle(optStyle)
-
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