Add documentation

This commit is contained in:
Pieter Vander Vennet 2022-10-10 12:18:53 +02:00
parent aab98b68fe
commit 3b717b0dbb
2 changed files with 23 additions and 1 deletions

View file

@ -82,6 +82,22 @@ namespace AspectedRouting.IO.itinero2
_skeleton.AddDep("str_split");
_skeleton.AddDep("calculate_turn_cost_factor");
/**
* Calculates the turn cost factor for relation attributes or obstacles.
Keep in mind that there are no true relations in the routerDB anymore, instead the attributes are copied onto a turn cost object.
This turn cost object has a set of sequence of edges and is applied onto the vertex.0
Obstacles such as bollards are converted into a turn cost as well.
calculate_turn_cost_factor will be called for this bollard too to calculate the weight.
If result.factor = -1 if passing is not possible - this is more or less equal to an infinite cost
If result.factor = 0 if no weight/passing is possible
If result.factor is positive, that is the cost.
There is no forward or backward, so this should always be the same for the same attributes
*/
var code = new List<string> {
"--[[ Function called by itinero2 on every turn restriction relation"," ]]",
"function turn_cost_factor(attributes, result)",

View file

@ -1,5 +1,11 @@
--[[
Calculates the turn cost factor for relation attributes, returns '0' if the turn is allowed and '-1' if the turn is forbidden.
Returns '0' if the turn is allowed and '-1' if the turn is forbidden.
Only used by itinero 2.0.
The itinero 2.0 profile outputs a `turn_cost_factor` which immediately calls this one (see LuaPrinter2.MainFunction).
Dependencies: str_split, containedIn
]]
function calculate_turn_cost_factor(attributes, vehicle_types)