diff options
author | orwell96 <orwell@bleipb.de> | 2018-12-19 17:52:21 +0100 |
---|---|---|
committer | orwell96 <orwell@bleipb.de> | 2018-12-19 17:52:21 +0100 |
commit | 56d03692df3076a109b73ce78a869bc799d802c9 (patch) | |
tree | d1c8914ad6434298c1bb4f2f508b0ad0a98ab65a /main.lua | |
parent | 69245c49c59e2299bdafff5884e6fbf95f027f4b (diff) | |
download | advtrains_netmapper-56d03692df3076a109b73ce78a869bc799d802c9.tar.gz advtrains_netmapper-56d03692df3076a109b73ce78a869bc799d802c9.tar.bz2 advtrains_netmapper-56d03692df3076a109b73ce78a869bc799d802c9.zip |
Progress
Diffstat (limited to 'main.lua')
-rw-r--r-- | main.lua | 11 |
1 files changed, 9 insertions, 2 deletions
@@ -5,7 +5,7 @@ local maxc = 5000 -- embed an image called "world.png" -local wimg = false +local wimg = true -- image file resolution (not world resolution!) local wimresx = 3000 local wimresy = 3000 @@ -124,7 +124,7 @@ if wimg then end local function writec(text) - print(text) + --print("\n"..text) svgfile:write("<!-- " .. text .. " -->\n") end @@ -137,6 +137,7 @@ end -- Note that the node at "pos" is already deleted from the NDB at the time of recall, therefore "conn" is specified local bfs_rsp = {} +local ndb_nodes_handled = 0 -- Points of the current polyline. Inserted as xyz vectors, maybe we'll use the y value one day local current_polyline = {} @@ -173,12 +174,14 @@ local function gen_rsp_polyline(rsp) --writec("Saved pos: "..pts(adj_pos).." mainbranch cont "..conn_mainbranch.." nextconns "..atdump(next_conns)) current_polyline[#current_polyline+1] = adj_pos advtrains.ndb.clear(adj_pos) + ndb_nodes_handled = ndb_nodes_handled + 1 pos, connid, conns = adj_pos, conn_mainbranch, next_conns end end +plcnt = 0 local function polyline_write(pl) local str = {'<polyline style="fill:none;stroke:black;stroke-width:1" points="'} @@ -195,6 +198,7 @@ local function polyline_write(pl) table.insert(str, '" />\n') svgfile:write(table.concat(str)) + plcnt = plcnt + 1 end @@ -222,6 +226,8 @@ while stpos do gen_rsp_polyline(current_rsp) polyline_write(current_polyline) + + io.write("Progress ", ndb_nodes_handled, "+", ndb_nodes_notrack, "/", ndb_nodes_total, "=", math.floor(((ndb_nodes_handled+ndb_nodes_notrack)/ndb_nodes_total)*100), "%\r") end stpos, conns = advtrains.ndb.mapper_find_starting_point() end @@ -229,3 +235,4 @@ end svgfile:write("</svg>") svgfile:close() +print("\nWrote",plcnt,"polylines. Processed", ndb_nodes_handled, "track,",ndb_nodes_notrack, "non-track nodes out of", ndb_nodes_total) |