-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDynamic.tcl
132 lines (106 loc) · 3 KB
/
Dynamic.tcl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
option add *Interval.activeForeground #d0d0d0
option add *Interval.sliderForeground #b0b0b0
option add *Interval.activeForeground #d0d0d0
option add *Interval.sliderForeground #b0b0b0
########################################################################
# Dynamic Map Handlers
proc ShowDynamicPanel {win} {
if {! [winfo ismapped $win.bottomframe]} {
pack append $win $win.bottomframe {bottom frame center fill expand}
set x [winfo rootx $win]
set y [winfo rooty $win]
set width [winfo width $win]
set height 670
wm geometry $win ${width}x${height}
}
}
proc HideDynamicPanel {win} {
if {[winfo ismapped $win.bottomframe]} {
pack unpack $win.bottomframe
set x [winfo rootx $win]
set y [winfo rooty $win]
set width [winfo width $win]
set height 332
wm geometry $win ${width}x${height}
}
}
proc InitDynamic {} {
global MapWindows
sim ResetDynamic
for {set i 0} {$i < 8} {incr i} {
foreach win $MapWindows {
[WindowLink $win.interval]$i reset
}
}
}
proc SetDynamicData {win index min max} {
set MinIndex [expr "$index * 2"]
set MaxIndex [expr "$MinIndex + 1"]
sim DynamicData $MinIndex $min
sim DynamicData $MaxIndex $max
set int [WindowLink $win.interval]$index
set from [lindex [$int config -from] 4]
set to [lindex [$int config -to] 4]
set min [lindex [$int config -min] 4]
set max [lindex [$int config -max] 4]
set range [expr "${to}-${from}"]
set offset 80
set scale 100
set low [expr "(($min-$from)*$scale/$range) + $offset"]
set high [expr "(($max-$from)*$scale/$range) + $offset"]
set sound 29
set title Slider$index
set vol 70
set chan fancy
UIDoSound "\"sound replay $title -channel $chan -volume $vol ; sound replay $sound -channel $chan -volume $vol -speed $low ; sound play $sound -channel $chan -volume $vol -speed $high\""
global MapWindows
foreach win $MapWindows {
[WindowLink $win.interval]$index set $min $max
}
}
global MapTitles
set MapTitles {
{Micropolis Map}
{Residential Zone Map}
{Commercial Zone Map}
{Industrial Zone Map}
{Power Grid Map}
{Transportation Map}
{Population Density Map}
{Rate of Growth Map}
{Traffic Map}
{Pollution Map}
{Crime Map}
{Land Value Map}
{Fire Station Map}
{Police Station Map}
{Dynamic Query Map}
}
proc UISetMapState {w state} {
global MapTitles
set win [winfo toplevel $w]
set m [WindowLink $win.view]
set title [lindex $MapTitles $state]
wm title $win "$title"
wm iconname $win "$title"
global [set var MapState.$win]
set $var $state
case $state { \
{6 8 9 10 11 12 13} {
[WindowLink $win.legend] config -bitmap "@Images/LegendMaxMin.xpm"
HideDynamicPanel $win
} \
{7} {
[WindowLink $win.legend] config -bitmap "@Images/LegendPlusMinus.xpm"
HideDynamicPanel $win
} \
{0 1 2 3 4 5 14} {
[WindowLink $win.legend] config -bitmap "@Images/LegendNone.xpm"
if {$state == 14} {
ShowDynamicPanel $win
} else {
HideDynamicPanel $win
}
}
}
}