diff --git a/AspectedRouting/IO/itinero2/LuaPrinter2.MainFunction.cs b/AspectedRouting/IO/itinero2/LuaPrinter2.MainFunction.cs index 5d39c58..639ebe6 100644 --- a/AspectedRouting/IO/itinero2/LuaPrinter2.MainFunction.cs +++ b/AspectedRouting/IO/itinero2/LuaPrinter2.MainFunction.cs @@ -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 { "--[[ Function called by itinero2 on every turn restriction relation"," ]]", "function turn_cost_factor(attributes, result)", diff --git a/AspectedRouting/IO/lua/calculate_turn_cost_factor.lua b/AspectedRouting/IO/lua/calculate_turn_cost_factor.lua index db0f7c5..480585e 100644 --- a/AspectedRouting/IO/lua/calculate_turn_cost_factor.lua +++ b/AspectedRouting/IO/lua/calculate_turn_cost_factor.lua @@ -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)