2016-04-27 07:24:25 -04:00
|
|
|
local Destination = {}
|
|
|
|
|
2016-10-18 23:09:19 -04:00
|
|
|
function Destination.get_destination(way, is_forward)
|
2016-04-27 07:24:25 -04:00
|
|
|
local destination = way:get_value_by_key("destination")
|
2016-10-18 23:09:19 -04:00
|
|
|
local destination_forward = way:get_value_by_key("destination:forward")
|
|
|
|
local destination_backward = way:get_value_by_key("destination:backward")
|
2016-04-27 07:24:25 -04:00
|
|
|
local destination_ref = way:get_value_by_key("destination:ref")
|
2016-10-18 23:09:19 -04:00
|
|
|
local destination_ref_forward = way:get_value_by_key("destination:ref:forward")
|
|
|
|
local destination_ref_backward = way:get_value_by_key("destination:ref:backward")
|
2016-04-27 07:24:25 -04:00
|
|
|
|
|
|
|
-- Assemble destination as: "A59: Düsseldorf, Köln"
|
|
|
|
-- destination:ref ^ ^ destination
|
2016-10-18 23:09:19 -04:00
|
|
|
|
2016-04-27 07:24:25 -04:00
|
|
|
local rv = ""
|
|
|
|
|
2016-10-18 23:09:19 -04:00
|
|
|
if destination_ref then
|
|
|
|
if is_forward == true and destination_ref == "" then
|
|
|
|
if destination_ref_forward then
|
|
|
|
destination_ref = destination_ref_forward
|
|
|
|
end
|
|
|
|
elseif is_forward == false then
|
|
|
|
if destination_ref_backward then
|
|
|
|
destination_ref = destination_ref_backward
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2016-04-27 07:47:42 -04:00
|
|
|
rv = rv .. string.gsub(destination_ref, ";", ", ")
|
2016-04-27 07:24:25 -04:00
|
|
|
end
|
|
|
|
|
2016-10-18 23:09:19 -04:00
|
|
|
if destination then
|
|
|
|
if is_forward == true and destination == "" then
|
|
|
|
if destination_forward then
|
|
|
|
destination = destination_forward
|
|
|
|
end
|
|
|
|
elseif is_forward == false then
|
|
|
|
if destination_backward then
|
|
|
|
destination = destination_backward
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
if destination ~= "" then
|
2016-04-27 07:24:25 -04:00
|
|
|
if rv ~= "" then
|
|
|
|
rv = rv .. ": "
|
|
|
|
end
|
|
|
|
|
|
|
|
rv = rv .. string.gsub(destination, ";", ", ")
|
2016-10-18 23:09:19 -04:00
|
|
|
end
|
2016-04-27 07:24:25 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
return rv
|
|
|
|
end
|
|
|
|
|
2016-10-18 23:09:19 -04:00
|
|
|
return Destination
|