new Dijskra(options)
Parameters:
Name | Type | Description | |||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
any |
Properties
|
Fires:
- event:calculating
- event:start
- event:finish
- event:pause
Methods
-
direction(feature)
-
Get the edge direction
- 0 : the road is blocked
- 1 : direct way
- -1 : revers way
- 2 : both way
Parameters:
Name Type Description feature
ol/Feature Returns:
0: blocked, 1: direct way, -1: revers way, 2:both way
- Type
- Number
-
getBestWay()
-
Get the current 'best way'. This may be used to animate while calculating.
Returns:
- Type
- Array.<ol/Feature>
-
getEdges(coord)
-
Get all features at a coordinate
Parameters:
Name Type Description coord
ol/coordinate Returns:
- Type
- Array.<ol/Feature>
-
getLength(geom)
-
Calculate the length of an edge
Parameters:
Name Type Description geom
ol/Feature | ol/geom/LineString Returns:
- Type
- number
-
getNode(coord)
-
Get a node at a coordinate
Parameters:
Name Type Description coord
ol/coordinate Returns:
the node
- Type
- ol/Feature
-
getNodeSource()
-
Get the nodes source concerned in the calculation
Returns:
- Type
- ol/source/Vector
-
path(start, end)
-
Calculate a path beetween 2 points
Parameters:
Name Type Description start
ol/coordinate end
ol/coordinate Returns:
false if don't start (still running) or start and end nodes
- Type
- boolean | Array.<ol/coordinate>
-
pause()
-
Pause
-
resume()
-
Restart after pause
-
weight(feature)
-
Get the weighting of the edge, for example a speed factor The function returns a value beetween ]0,1]
- 1 = no weighting
- 0.5 = goes twice more faster on this road
If no feature is provided you must return the lower weighting you're using
Parameters:
Name Type Description feature
ol/Feature Returns:
a number beetween 0-1
- Type
- number