ALKMaps.Layer.Routing

Create a vector layer for drawing and managing route objects.

Inherits from

Summary
ALKMaps.Layer.RoutingCreate a vector layer for drawing and managing route objects.
Properties
dragControlProperty containing the ALKDragFeature control associated with this layer.
isDraggableProperty indicating whether or not the routes on the layer are draggable.
Constructor
ALKMaps.Layer.RoutingCreate a vector layer for drawing and managing route objects.
Functions
setMapThe layer has been added to the map.
addRouteDragHandle
getRouteLegPointsDraw route with stops on this layer.
addRouteAdds a route object and draws it on this layer.
removeRouteRemoves a route from the layer by id.
updateRouteUpdates a route object and draws it on the layer.
getRouteElementsGets the ALKMaps vector elements for the route stops and segments drawn on the layer.
getRouteOptionsGets all the parameters that are set when the route is added.
updateNodeStores feature Id.
getGeometryGets drag handle geometry.
getPreviousHandleGets drag handle after this one.
getNextHandleGets drag handle before this one.
getNodesGets nodes that are connected to the drag handle.
getDragHandleFromNodeGets drag handles from the node.
isStartHandleDetermines a drag handle is a route start point or not.
isEndHandleDetermines a drag handle is a route end point or not.
getHandleActionDetermins which drag hadle has been dragged.
setDraggableSets the layer’s ability to have routes be modified by dragging.
setRouteHandleVisibilitySets the visibility of all stop markers and the showHandles option of the route.
setRouteHandleSets the style of the route handles by type or index.
onRouteModifiedCallback method.

Properties

dragControl

Property containing the ALKDragFeature control associated with this layer.

isDraggable

Property indicating whether or not the routes on the layer are draggable.

Constructor

ALKMaps.Layer.Routing

Create a vector layer for drawing and managing route objects.

Parameters

options{Object} properties to set on this layer.

Returns

{ALKMaps.Layer.Routing} A new vector layer for drawing and managing route objects.

Functions

setMap

setMap: function()

The layer has been added to the map.

addRouteDragHandle

addRouteDragHandle: function(handleState,
legCoords,
isVisible,
extImg)
Add drag handlesroute begin, route end and waypoint handle.

getRouteLegPoints

getRouteLegPoints: function(args)

Draw route with stops on this layer.

addRoute

addRoute: function(args)

Adds a route object and draws it on this layer.

Parameters

args{Object} with {stops: Object, routeOptions: Object, reportOptions: Object, functionOptions: Object, externalImages: Object}
stops{array of OpenLayer.LatLon objects}
routeOptions{Object} ALK Map service supported options.  See supported route options bellow.
reportOptions{Object} has type and format two keys.  Type value can be mileage, directions, detailed or stateMileage.  Format value can be json, xml, or html.
externalImages{Object}
images{Array of Strings} Array of image locations that is the same size as the stops array.  (optional)
functionOptions{Object} has routeId (String), async (Boolean), style (ALKMaps.Feature.Vector.style) and callback function.  Route Id is used to uniquely identify a route.  Async: determines if server call is asynchronous or not.  Default is asynchronous. style: If this is provided, it will override class level style.  Only strokeOpacity, and strokeColor are allowed to change. callback function: called when results are returned from server.  Returned values can be report and updated stops.

removeRoute

removeRoute: function(routeId)

Removes a route from the layer by id.

Parameters

routeId:{String} the same id that is used to add the route to the layer.

updateRoute

updateRoute: function(args)

Updates a route object and draws it on the layer.  If stops, functional options, or report options are not included, it will use the parameters from the original route.

Parameters

args:{Object} with {stops: Object, routeOptions: Object, reportOptions: Object, functionOptions: Object}
stops{Object} array of OpenLayer.LatLon objects.
routeOptions{Object} ALK Map service supported options.  See supported route options bellow.
reportOptions{Object} has type and format two keys.  Type value can be mileage, directions, detailed or stateMileage.  Format value can be json, xml, or html.
functionOptions{Object} has routeId (String), async (Boolean), style (ALKMaps.Feature.Vector.style) and callback function.  Route Id is used to uniquely identify a route.  Async: determines if server call is asynchronous or not.  Default is asynchronous. style: If this is provided, it will override class level style.  Only strokeOpacity, and strokeColor are allowed to change. callback function: called when results are returned from server.  Returned values can be report and updated stops.

getRouteElements

getRouteElements: function(routeId)

Gets the ALKMaps vector elements for the route stops and segments drawn on the layer.

Parameters

routeId:{String} the same id that is used to add the route to the layer.

Returns

Point and line vectors.

getRouteOptions

getRouteOptions: function(routeIndex)

Gets all the parameters that are set when the route is added.

Parameters

routeId:{String} route id.

Returns

args:{stops, routeOptions, reportOptions, functionOptions}

stops: array of OpenLayer.LatLon objects.

routeOptions: ALK Map service supported options.  See supported route options bellow.

reportOptions: has type and format two keys.  Type value can be mileage, directions, detailed or stateMileage.  Format value can be json, xml, or html.

functionOptions: has routeId (String), async (Boolean), style (ALKMaps.Feature.Vector.style) and callback function.  Route Id is used to uniquely identify a route.  Async: determines if server call is asynchronous or not.  Default is asynchronous. style: If this is provided, it will override class level style. callback function: called when results are returned from server.  Returned values can be report and updated stops.

updateNode

updateNode: function(oldOne,
newOne)

Stores feature Id.

getGeometry

getGeometry: function(handle)

Gets drag handle geometry.

getPreviousHandle

getPreviousHandle: function(hd)

Gets drag handle after this one.

getNextHandle

getNextHandle: function(hd)

Gets drag handle before this one.

getNodes

getNodes: function(hd)

Gets nodes that are connected to the drag handle.

getDragHandleFromNode

getDragHandleFromNode: function(nd)

Gets drag handles from the node.

isStartHandle

isStartHandle: function(hd)

Determines a drag handle is a route start point or not.

isEndHandle

isEndHandle: function(hd)

Determines a drag handle is a route end point or not.

getHandleAction

getHandleAction: function(hd)

Determins which drag hadle has been dragged.

setDraggable

setDraggable: function(isDraggable)

Sets the layer’s ability to have routes be modified by dragging.

Parameters

isDraggable{boolean} Indicates whether the routes should be draggable.

setRouteHandleVisibility

setRouteHandleVisibility: function(routeId,
showHandles)

Sets the visibility of all stop markers and the showHandles option of the route.

Parameters

routeId{String} The routeID of the route.
showHandles{boolean} Indicates whether the stop markers are displayed.

setRouteHandle

setRouteHandle: function(routeId,
stop,
handleOptions)

Sets the style of the route handles by type or index.

Parameters

routeId{String} The routeID of the route.
stop{“O” | “W” | “D” | number} Indicates the type or index of the stop.
handleOptions{Object} Object containing style properties to be set.
  • externalGraphic - URL of the route handle image
  • graphicWidth - width of the image
  • graphicHeight - height of the image
  • graphicXOffset - X offset from the stop point
  • graphicYOffset - Y offset from the stop point

onRouteModified

onRouteModified: function(obj)

Callback method.  Called when results are retured after a route dragging is completed.  Returns report and updated stop lists.

setMap: function()
The layer has been added to the map.
addRouteDragHandle: function(handleState,
legCoords,
isVisible,
extImg)
getRouteLegPoints: function(args)
Draw route with stops on this layer.
addRoute: function(args)
Adds a route object and draws it on this layer.
removeRoute: function(routeId)
Removes a route from the layer by id.
updateRoute: function(args)
Updates a route object and draws it on the layer.
getRouteElements: function(routeId)
Gets the ALKMaps vector elements for the route stops and segments drawn on the layer.
getRouteOptions: function(routeIndex)
Gets all the parameters that are set when the route is added.
updateNode: function(oldOne,
newOne)
Stores feature Id.
getGeometry: function(handle)
Gets drag handle geometry.
getPreviousHandle: function(hd)
Gets drag handle after this one.
getNextHandle: function(hd)
Gets drag handle before this one.
getNodes: function(hd)
Gets nodes that are connected to the drag handle.
getDragHandleFromNode: function(nd)
Gets drag handles from the node.
isStartHandle: function(hd)
Determines a drag handle is a route start point or not.
isEndHandle: function(hd)
Determines a drag handle is a route end point or not.
getHandleAction: function(hd)
Determins which drag hadle has been dragged.
setDraggable: function(isDraggable)
Sets the layer’s ability to have routes be modified by dragging.
setRouteHandleVisibility: function(routeId,
showHandles)
Sets the visibility of all stop markers and the showHandles option of the route.
setRouteHandle: function(routeId,
stop,
handleOptions)
Sets the style of the route handles by type or index.
onRouteModified: function(obj)
Callback method.
Instances of ALKMaps.Layer.Vector are used to render vector data from a variety of sources.
Create a vector layer for drawing and managing route objects.
Close