From: Ian Jackson Date: Sun, 2 Jan 2011 13:30:59 +0000 (+0000) Subject: gui: change contents of ld_see to be list of poslocs rather than sum of their positio... X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ijackson/git?a=commitdiff_plain;h=b1d44ec067874e0ac49a72b2768e26b85bacab16;p=trains.git gui: change contents of ld_see to be list of poslocs rather than sum of their positions; no functional change but would make more sophisticated positioning algorithms a bit easier --- diff --git a/hostside/gui b/hostside/gui index 7944457..2c4c7c2 100755 --- a/hostside/gui +++ b/hostside/gui @@ -263,12 +263,11 @@ proc layout-subseg-end {seg feat posn x y} { return } upvar #0 ld_sse/${cpage}($seg/$feat$posn) sse - if {![info exists sse]} { set sse {0 0 0} } - manyset $sse n sx sy - incr n - set sx [expr {$sx + $x}] - set sy [expr {$sy + $y}] - set sse [list $n $sx $sy] + if {![info exists sse]} { set sse {{} {}} } + manyset $sse lx ly + lappend lx $x + lappend ly $y + set sse [list $lx $ly] if {[string length $posn]} { layout-subseg-end $seg $feat {} $x $y } } @@ -278,7 +277,9 @@ proc subseg-end-get-centroid {cpage seg feat posn} { puts "skipping binding of unknown $seg/$feat$posn" return -code return } - manyset $sse n sx sy + manyset $sse lx ly + set sx 0; set sy 0; set n [llength $lx] + foreach x $lx y $ly { addexpr sx {$x}; addexpr sy {$y} } return [list [expr {$sx * 1.0 / $n}] [expr {$sy * 1.0 / $n}]] }