Create a vector layer for drawing and managing route objects.
ALKMaps. | Create a vector layer for drawing and managing route objects. |
Properties | |
dragControl | Property containing the ALKDragFeature control associated with this layer. |
isDraggable | Property indicating whether or not the routes on the layer are draggable. |
dragQueueMaxSize | Property indicating undo, redo drag queue size for each route on the layer. |
originDefault | Property containing the location of an external image to be used as the default image for all origin handles. |
destinationDefault | Property containing the location of an external image to be used as the default image for all destination handles. |
waypointDefault | Property containing the location of an external image to be used as the default image for all waypoint handles. |
Constructor | |
ALKMaps. | Create a vector layer for drawing and managing route objects. |
Functions | |
setMap | The layer has been added to the map. |
addRouteDragHandle | |
getRouteLegPoints | Draw route with stops on this layer. |
addRoute | Adds a route object and draws it on this layer. |
removeRoute | Removes a route from the layer by id. |
updateRoute | Updates a route object and draws it on the layer. |
getRouteElements | Gets the ALKMaps vector elements for the route stops and segments drawn on the layer. |
getRouteOptions | Gets all the parameters that are set when the route is added. |
updateNode | Stores feature Id. |
getGeometry | Gets drag handle geometry. |
getPreviousHandle | Gets drag handle after this one. |
getNextHandle | Gets drag handle before this one. |
getNodes | Gets nodes that are connected to the drag handle. |
getDragHandleFromNode | Gets drag handles from the node. |
isStartHandle | Determines a drag handle is a route start point or not. |
isEndHandle | Determines a drag handle is a route end point or not. |
getHandleAction | Determines which drag handle has been dragged. |
setDraggable | Sets the layer’s ability to have routes be modified by dragging. |
setRouteHandleVisibility | Sets the visibility of all stop markers and the showHandles option of the route. |
setRouteHandle | Sets the style of the route handles by type or index. |
setRouteVisibility | Method for toggling the visibility of the lines and handles of a given route. |
onRouteModified | Callback method. |
onErrorRouteModification | Callback method. |
canUndo | Still has record in the queue for undo dragged route. |
canRedo | Still has record in the queue for redo dragged route. |
undoDrag | Undo route drag for a given route id. |
redoDrag | Redo route drag for a given route id. |
clearDragQueue | Clear undo/redo route drag queue for a given route id. |
redraw | Redraws the layer, and reconfigures the arrows of all existing routes with arrows. |
drawArrows | First removes any existing arrows on the specified route. |
createArrow | Creates a new arrow feature using the given Point geometry, style, rotation, and routeId. |
Create a vector layer for drawing and managing route objects.
name | {String} Unique layer name. |
options | {Object} Properties to set on this layer. |
isDraggable | {Boolean} Value true may enable route line dragging. |
originURL | {String} Custom URL for trip origin icon. |
waypointURL | {String} Custom URL for waypoints icon. |
destinationURL | {String} Custom URL for trip destination icon. |
dragQueueMaxSize | {Number} Optional. Property indicating undo, redo drag queue size for each route on the layer. When isDraggable is set to true, this property may be considered. |
{ALKMaps.Layer.Routing} A new vector layer for drawing and managing route objects.
getRouteLegPoints: function( args, isRail, removeExistingFeatures )
Draw route with stops on this layer. When undo/redo drag route happens, clear existing features for the route, without re-frame the route. Added isRail parameter in April, 2017. Added removeExistingFeatures parameter in June 25, 2019.
args | {Object} |
isRail | {Boolean} |
removeExistingFeatures | {Boolean} When set to true in case of undo/redo drag route, clear existing features for the route, without re-frame route. |
addRoute: function( args )
Adds a route object and draws it on this layer.
args | {Object} with {stops: Object, routeOptions: Object, reportOptions: Object, functionOptions: Object, externalImages: Object} |
stops | {Array(ALKMaps.LonLat)} |
routeOptions | {Object} ALK Map service supported options. See supported route options bellow. |
reportOptions | {Object} type: Type value can be Mileage, Directions, Detail, State, CalcMiles, LeastCost, Geotunnel. format: Format value can be json or html. dataVersion: data version value can be Current, PCM_EU, PCM_OC, PCM_SA, PCM_GT, PCM_AF, PCM_AS, PCM_ME, or PCM18 through PCM27 lang: The language. ENUS for English United States, ENGB for English Great Britain, DE for German, FR for French, ES for Spanish, IT for Italian |
externalImages | {Object} |
images | {Array(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. routeId: 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. User can supply strokeOpacity, strokeColor, strokeLinecap, strokeWidth, and strokeDashstyle. Stroke opacity value range is from 0 to 1. Stroke color takes hex code in string, like “#ee9900”. Valid value for line cap is “butt”, “round”, or “square”. Valid value for dash style is “dot”, “dash”, “dashdot”, “longdash”, “longdashdot” or “solid” and most SLD patterns will render correctly. If stroke width is supplied, default width in the context will be replaced. callback function: called when results are returned from server. Returned values can be report and updated stops. |
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.
args: | {Object} with {stops: Object, routeOptions: Object, reportOptions: Object, functionOptions: Object} |
stops | {Array(ALKMaps.LonLat)} |
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. |
getRouteOptions: function( routeIndex )
Gets all the parameters that are set when the route is added.
routeId: | {String} route id. |
args: | {stops, routeOptions, reportOptions, functionOptions} |
stops: {Array(ALKMaps.LonLat)}
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.
setRouteHandle: function( routeId, stop, handleOptions )
Sets the style of the route handles by type or index.
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. |
drawArrows: function ( arrowsObj )
First removes any existing arrows on the specified route. Then either draws new arrows along the route line at a given spacing interval or draws a single arrow at the end of the route.
arrowsObj | {Object} Object containing an array of arrow point features and the ID of the route that the arrows correspond to. |
createArrow: function( point, style, bearing, routeId )
Creates a new arrow feature using the given Point geometry, style, rotation, and routeId.
point | {ALKMaps.Geometry.Point} Arrow feature’s point geometry. |
style | {Object} Route’s style object. |
bearing | {Number} Rotation of arrow. |
routeId | {String} ID of the route that the arrow corresponds to. |
{ALKMaps.Feature.Vector} New arrow feature.
The layer has been added to the map.
setMap: function()
addRouteDragHandle: function( handleState, legCoords, isVisible, extImg )
Draw route with stops on this layer.
getRouteLegPoints: function( args, isRail, removeExistingFeatures )
Adds a route object and draws it on this layer.
addRoute: function( args )
Removes a route from the layer by id.
removeRoute: function( routeId )
Updates a route object and draws it on the layer.
updateRoute: function( args )
Gets the ALKMaps vector elements for the route stops and segments drawn on the layer.
getRouteElements: function( routeId )
Gets all the parameters that are set when the route is added.
getRouteOptions: function( routeIndex )
Stores feature Id.
updateNode: function( oldOne, newOne )
Gets drag handle geometry.
getGeometry: function( handle )
Gets drag handle after this one.
getPreviousHandle: function( hd )
Gets drag handle before this one.
getNextHandle: function( hd )
Gets nodes that are connected to the drag handle.
getNodes: function( hd )
Gets drag handles from the node.
getDragHandleFromNode: function( nd )
Determines a drag handle is a route start point or not.
isStartHandle: function( hd )
Determines a drag handle is a route end point or not.
isEndHandle: function( hd )
Determines which drag handle has been dragged.
getHandleAction: function( hd )
Sets the layer’s ability to have routes be modified by dragging.
setDraggable: function( isDraggable )
Sets the visibility of all stop markers and the showHandles option of the route.
setRouteHandleVisibility: function( routeId, showHandles )
Sets the style of the route handles by type or index.
setRouteHandle: function( routeId, stop, handleOptions )
Method for toggling the visibility of the lines and handles of a given route.
setRouteVisibility: function ( routeId, showRoute )
Callback method.
onRouteModified: function( obj )
Still has record in the queue for undo dragged route.
canUndo: function( routeId )
Still has record in the queue for redo dragged route.
canRedo: function( routeId )
Undo route drag for a given route id.
undoDrag: function ( routeId )
Redo route drag for a given route id.
redoDrag: function ( routeId )
Clear undo/redo route drag queue for a given route id.
clearDragQueue: function ( routeId )
Redraws the layer, and reconfigures the arrows of all existing routes with arrows.
redraw: function ()
First removes any existing arrows on the specified route.
drawArrows: function ( arrowsObj )
Creates a new arrow feature using the given Point geometry, style, rotation, and routeId.
createArrow: function( point, style, bearing, routeId )