diff --git a/main.lua b/main.lua index 6699cf7..6f2abfa 100644 --- a/main.lua +++ b/main.lua @@ -100,7 +100,7 @@ if type(tbl) ~= "table" then error("not a table") end if tbl.version then - + advtrains.trains = tbl.trains advtrains.ndb.load_data(tbl.ndb) else @@ -302,7 +302,23 @@ while stpos do stpos, conns = advtrains.ndb.mapper_find_starting_point() end +-- draw trains +trains = 0 +for i,v in pairs(advtrains.trains) do + pos = v.last_pos + color = "green" + if v.velocity == 0 then + color = "orange" + end + svgfile:write("") + if v.line then + svgfile:write(" "..v.line.."") + end + trains = trains+1 +end + svgfile:write("") svgfile:close() print("\nWrote",plcnt,"polylines. Processed", ndb_nodes_handled, "track,",ndb_nodes_notrack, "non-track nodes out of", ndb_nodes_total) +print("Drew "..trains.." trains")