[35743] | 1 | puts "tclsh verify-rw.tcl startzoom endzoom --> comparing railway widths, output to verify-rw.txt"
|
---|
| 2 |
|
---|
| 3 | set za [ lindex $argv 0 ]
|
---|
| 4 | set ze [ lindex $argv 1 ]
|
---|
| 5 |
|
---|
| 6 | source verify.tcl
|
---|
| 7 | set fs "%6s"
|
---|
| 8 |
|
---|
| 9 | set allways [ list rail narrow preserved light tram subway funicular monorail yard con pla dis aba ]
|
---|
| 10 |
|
---|
| 11 | set ersatzs [ array names ersatz ]
|
---|
| 12 |
|
---|
| 13 | for { set z $za } { $z <= $ze } { incr z } {
|
---|
| 14 | foreach ww $widths($z) {
|
---|
| 15 | set www [ split $ww "-" ]
|
---|
| 16 | if { [ lindex $www 0 ] == "railway" } {
|
---|
| 17 | set w $width($z,$ww)
|
---|
| 18 | if { [ string trim $w ] == "" } continue
|
---|
| 19 | set way [ lindex $www 1 ]
|
---|
| 20 |
|
---|
| 21 | if { $way == "bridge" && [ lindex $www 2 ] == "casing" } { set bcax [ format $fs $w ]; continue }
|
---|
| 22 | if { $way == "bridge" && [ lindex $www 2 ] == "core" } { set bcox [ format $fs $w ]; continue }
|
---|
| 23 |
|
---|
| 24 | if {[lsearch $allways $way] < 0} {puts "$way missing"}
|
---|
| 25 |
|
---|
| 26 | set j 2
|
---|
| 27 | set k $j
|
---|
| 28 | if { [ lindex $www $k ] == "1" || [ lindex $www $k ] == "2" } { incr k }
|
---|
| 29 |
|
---|
| 30 | if { [ lindex $www $j ] == "casing" } {
|
---|
| 31 | set cas($z,$way) [ format $fs $w ]
|
---|
| 32 | } elseif { [ lindex $www $k ] == "core" } {
|
---|
| 33 | if { [ lindex $www $j ] != "2" } {
|
---|
| 34 | set cor($z,$way) [ format $fs $w ]
|
---|
| 35 | } else {
|
---|
| 36 | set co2($z,$way) [ format $fs $w ]
|
---|
| 37 | }
|
---|
| 38 | }
|
---|
| 39 | }
|
---|
| 40 | }
|
---|
| 41 | }
|
---|
| 42 |
|
---|
| 43 | for { set z $za } { $z <= $ze } { incr z } {
|
---|
| 44 | foreach way $allways {
|
---|
| 45 | if { [ lsearch $ersatzs $way ] >= 0 } { set e 1 } { set e 0 }
|
---|
| 46 |
|
---|
| 47 | set bca($z,$way) $bcax
|
---|
| 48 | set bco($z,$way) $bcox
|
---|
| 49 |
|
---|
| 50 | if { $z < 16 } {
|
---|
| 51 | set bca($z,$way) [ format $fs "" ]
|
---|
| 52 | set bco($z,$way) [ format $fs "" ]
|
---|
| 53 | }
|
---|
| 54 | if { [ string trim $bca($z,$way) ] != "" } {
|
---|
| 55 | set bdi($z,$way) [ format $fs [ expr "$bca($z,$way) - $bco($z,$way)" ] ]
|
---|
| 56 | } else {
|
---|
| 57 | set bdi($z,$way) [ format $fs "" ]
|
---|
| 58 | }
|
---|
| 59 | if { ![ info exists cas($z,$way) ] } {
|
---|
| 60 | if { $e } {
|
---|
| 61 | set cas($z,$way) $cas($z,$ersatz($way))
|
---|
| 62 | } else {
|
---|
| 63 | set cas($z,$way) [ format $fs "" ]
|
---|
| 64 | }
|
---|
| 65 | }
|
---|
| 66 | if { ![ info exists cor($z,$way) ] } {
|
---|
| 67 | if { $e } {
|
---|
| 68 | set cor($z,$way) $cor($z,$ersatz($way))
|
---|
| 69 | } else {
|
---|
| 70 | set cor($z,$way) [ format $fs "" ]
|
---|
| 71 | }
|
---|
| 72 | }
|
---|
| 73 | if { ![ info exists co2($z,$way) ] } {
|
---|
| 74 | if { $e } {
|
---|
| 75 | set co2($z,$way) $co2($z,$ersatz($way))
|
---|
| 76 | } else {
|
---|
| 77 | set co2($z,$way) [ format $fs "" ]
|
---|
| 78 | }
|
---|
| 79 | }
|
---|
| 80 |
|
---|
| 81 | if { [ string trim $cas($z,$way) ] != "" && [ string trim $cor($z,$way) ] != "" } {
|
---|
| 82 | set dif($z,$way) [ format $fs [ expr "$cas($z,$way) - $cor($z,$way)" ] ]
|
---|
| 83 | } else {
|
---|
| 84 | set dif($z,$way) [ format $fs "" ]
|
---|
| 85 | }
|
---|
| 86 | if { [ string trim $co2($z,$way) ] != "" && [ string trim $cas($z,$way) ] != "" } {
|
---|
| 87 | set bd2($z,$way) [ format $fs [ expr "$co2($z,$way) - $cas($z,$way)" ] ]
|
---|
| 88 | } else {
|
---|
| 89 | set bd2($z,$way) [ format $fs "" ]
|
---|
| 90 | }
|
---|
| 91 | }
|
---|
| 92 | }
|
---|
| 93 |
|
---|
| 94 | set fo [ open verify-rw.txt w ]
|
---|
| 95 |
|
---|
| 96 | puts $fo " : bcas bcore bdiff cas core diff core2 diff2 way"
|
---|
| 97 |
|
---|
| 98 | foreach way $allways {
|
---|
| 99 | for { set z $za } { $z <= $ze } { incr z } {
|
---|
| 100 | set x "$z,$way"
|
---|
| 101 | puts $fo "$z:$bca($x)$bco($x)$bdi($x) $cas($x)$cor($x)$dif($x) $co2($x)$bd2($x) $way"
|
---|
| 102 | }
|
---|
| 103 | puts $fo ""
|
---|
| 104 | }
|
---|
| 105 | close $fo
|
---|