- Timestamp:
- May 18, 2009 11:45:37 AM (15 years ago)
- Location:
- trunk/gui/scripts
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gui/scripts/flowhints.tcl
r1442 r1448 34 34 35 35 private method ConvertUnits { value } 36 private method GetAxis { path varName }37 private method GetPosition { path varName }38 private method GetCorner { path varName }39 private method GetBoolean { path varName }40 41 private variable _boxes ; # List of boxes for the flow.42 private variable _particles ; # List of particle injection planes.36 private method GetAxis { obj path varName } 37 private method GetPosition { obj path varName } 38 private method GetCorner { obj path varName } 39 private method GetBoolean { obj path varName } 40 41 private variable _boxes ""; # List of boxes for the flow. 42 private variable _particles ""; # List of particle injection planes. 43 43 private variable _hints; # Array of settings for the flow. 44 private variable _flowobj 45 private variable _units 44 private variable _units "" 46 45 } 47 46 … … 62 61 } 63 62 set _units $units 64 set _flowobj[$field element -as object $cname.flow]63 set f [$field element -as object $cname.flow] 65 64 set _hints(name) [$field element -as id $cname.flow] 66 foreach child [$ _flowobjchildren] {67 set value [$ _flowobjget $child]65 foreach child [$f children] { 66 set value [$f get $child] 68 67 switch -glob -- $child { 69 "outline" { GetBoolean $child _hints(outline) } 70 "volume" { GetBoolean $child _hints(volume) } 71 "streams" { GetBoolean $child _hints(streams) } 72 "axis" { GetAxis $child _hints(axis) } 73 "position" { GetPosition $child _hints(position) } 68 "label" { set _hints(label) [$f get $child] } 69 "outline" { GetBoolean $f $child _hints(outline) } 70 "volume" { GetBoolean $f $child _hints(volume) } 71 "streams" { GetBoolean $f $child _hints(streams) } 72 "axis" { GetAxis $f $child _hints(axis) } 73 "position" { GetPosition $f $child _hints(position) } 74 74 "particles*" { 75 75 array unset data … … 79 79 "position" "0.0%" 80 80 "color" "blue" 81 } 82 set data(name) [$_flowobj element -as id $child] 83 set data(color) [$_flowobj get $child.color] 84 GetAxis $child.axis data(axis) 85 GetPosition $child.position data(position) 81 "label" "" 82 } 83 set p [$f element -as object $child] 84 set data(name) [$f element -as id $child] 85 foreach child [$p children] { 86 set value [$p get $child] 87 switch -exact -- $child { 88 "label" { set data(label) $value } 89 "color" { set data(color) $value } 90 "hide" { GetBoolean $p hide data(hide) } 91 "axis" { GetAxis $p axis data(axis) } 92 "position" { GetPosition $p position data(position)} 93 } 94 } 95 if { $data(label) == "" } { 96 set data(label) $data(name) 97 } 98 itcl::delete object $p 86 99 lappend _particles [array get data] 87 100 } … … 89 102 array unset data 90 103 array set data { 91 "axis" "x"92 104 "hide" "no" 93 105 "color" "green" 94 } 95 set boxobj [$_flowobj element -as object $child] 106 "label" "" 107 } 108 set b [$f element -as object $child] 109 set name [$f element -as id $child] 96 110 set count 0 97 set data(name) [$_flowobj element -as id $child] 98 set data(color) [$_flowobj get $child.color] 99 foreach corner [$boxobj children -type corner] { 100 incr count 101 GetCorner $child.$corner data(corner$count) 102 } 103 itcl::delete object $boxobj 111 set data(name) $name 112 set data(color) [$f get $child.color] 113 foreach child [$b children] { 114 set value [$b get $child] 115 switch -glob -- $child { 116 "label" { set data(label) $value } 117 "color" { set data(color) $value } 118 "hide" { GetBoolean $b hide data(hide) } 119 "corner*" { 120 incr count 121 GetCorner $b $child data(corner$count) 122 } 123 } 124 } 125 if { $data(label) == "" } { 126 set data(label) $data(name) 127 } 128 itcl::delete object $b 104 129 lappend _boxes [array get data] 105 130 } 106 131 } 107 132 } 108 itcl::delete object $ _flowobj133 itcl::delete object $f 109 134 } 110 135 … … 113 138 set n [scan $value "%g%s" number suffix] 114 139 if { $n == 2 } { 115 puts stderr "number=$number suffix=$suffix"116 140 if { $suffix == "%" } { 117 141 return $value 118 142 } else { 119 puts stderr "$cmd $number -context $suffix -to $_units -units off"120 143 return [$cmd $number -context $suffix -to $_units -units off] 121 144 } … … 124 147 return $number 125 148 } 126 puts stderr "$cmd $number -context $_units -to $_units -units off"127 149 return [$cmd $number -context $_units -to $_units -units off] 128 150 } … … 130 152 } 131 153 132 itcl::body Rappture::FlowHints::GetPosition { path varName } {133 set value [$ _flowobj get $path]154 itcl::body Rappture::FlowHints::GetPosition { obj path varName } { 155 set value [$obj get $path] 134 156 set pos [ConvertUnits $value] 135 157 if { $pos == "" } { … … 140 162 } 141 163 142 itcl::body Rappture::FlowHints::GetAxis { path varName } {143 set value [$ _flowobj get $path]164 itcl::body Rappture::FlowHints::GetAxis { obj path varName } { 165 set value [$obj get $path] 144 166 set value [string tolower $value] 145 167 switch -- $value { … … 153 175 } 154 176 155 itcl::body Rappture::FlowHints::GetCorner { path varName } {156 set value [$ _flowobj get $path]177 itcl::body Rappture::FlowHints::GetCorner { obj path varName } { 178 set value [$obj get $path] 157 179 set coords "" 158 180 if { [llength $value] != 3 } { … … 172 194 } 173 195 174 itcl::body Rappture::FlowHints::GetBoolean { path varName } {175 set value [$ _flowobj get $path]196 itcl::body Rappture::FlowHints::GetBoolean { obj path varName } { 197 set value [$obj get $path] 176 198 if { [string is boolean $value] } { 177 199 upvar $varName bool -
trunk/gui/scripts/flowvisviewer.tcl
r1444 r1448 19 19 package require Img 20 20 21 option add *FlowvisViewer.width 4i widgetDefault21 option add *FlowvisViewer.width 5i widgetDefault 22 22 option add *FlowvisViewer*cursor crosshair widgetDefault 23 23 option add *FlowvisViewer.height 4i widgetDefault … … 75 75 protected method Disconnect {} 76 76 protected method DoResize {} 77 protected method FixLegend {}77 protected method ResizeLegend {} 78 78 protected method FixSettings {what {value ""}} 79 79 protected method Pan {option x y} … … 128 128 private variable _id2obj ;# maps dataobj => volume ID in server 129 129 private variable _sendobjs "" ;# list of data objs to send to server 130 private variable _rec eiveIds;# list of data objs to send to server130 private variable _recvObjs ;# list of data objs to send to server 131 131 private variable _obj2style ;# maps dataobj-component to transfunc 132 132 private variable _style2objs ;# maps tf back to list of … … 152 152 private variable _width 0 153 153 private variable _height 0 154 private variable _resizePending 0 155 private variable _resizeLegendPending 0 154 156 } 155 157 … … 166 168 # Draw legend event 167 169 $_dispatcher register !legend 168 $_dispatcher dispatch $this !legend "[itcl::code $this FixLegend]; list"170 $_dispatcher dispatch $this !legend "[itcl::code $this ResizeLegend]; list" 169 171 170 172 # Send dataobjs event … … 189 191 $_dispatcher dispatch $this !play "[itcl::code $this flow next]; list" 190 192 191 set _flow(frame) 0192 193 set _flow(state) 0 193 194 … … 226 227 $this-psi $_view(psi) 227 228 $this-speed 500 229 $this-step 0 230 $this-nsteps 100 228 231 $this-theta $_view(theta) 229 232 $this-volume 1 … … 291 294 BuildCameraTab 292 295 296 297 bind $itk_component(3dview) <Configure> \ 298 [itcl::code $this EventuallyResize %w %h] 299 293 300 # Legend 294 295 301 set _image(legend) [image create photo] 296 302 itk_component add legend { … … 315 321 # Create flow controls... 316 322 317 itk_component add flowcontrol {318 frame $itk_interior.flowcontrol 323 itk_component add flowcontrols { 324 frame $itk_interior.flowcontrols 319 325 } { 320 326 usual … … 324 330 blt::table $itk_interior \ 325 331 0,0 $itk_component(main) -fill both \ 326 1,0 $itk_component(flowcontrol ) -fill x332 1,0 $itk_component(flowcontrols) -fill x 327 333 blt::table configure $itk_interior r1 -resize none 328 334 329 # flow record button...335 # Rewind 330 336 itk_component add rewind { 331 button $itk_component(flowcontrol ).reset \337 button $itk_component(flowcontrols).reset \ 332 338 -borderwidth 1 -padx 1 -pady 1 \ 333 339 -image [Rappture::icon flow-rewind] \ … … 336 342 usual 337 343 ignore -borderwidth 338 rename -highlightbackground -controlbackground controlBackground Background 344 rename -highlightbackground -controlbackground controlBackground \ 345 Background 339 346 } 340 347 Rappture::Tooltip::for $itk_component(rewind) \ 341 348 "Rewind flow" 342 349 343 # flow stop button...350 # Stop 344 351 itk_component add stop { 345 button $itk_component(flowcontrol ).stop \352 button $itk_component(flowcontrols).stop \ 346 353 -borderwidth 1 -padx 1 -pady 1 \ 347 354 -image [Rappture::icon flow-stop] \ … … 350 357 usual 351 358 ignore -borderwidth 352 rename -highlightbackground -controlbackground controlBackground Background 359 rename -highlightbackground -controlbackground controlBackground \ 360 Background 353 361 } 354 362 Rappture::Tooltip::for $itk_component(stop) \ 355 363 "Stop flow" 356 364 357 # 358 # flow play/pause button... 359 # 365 # Play 360 366 itk_component add play { 361 Rappture::PushButton $itk_component(flowcontrol ).play \367 Rappture::PushButton $itk_component(flowcontrols).play \ 362 368 -onimage [Rappture::icon flow-pause] \ 363 369 -offimage [Rappture::icon flow-play] \ … … 369 375 "Play/Pause flow" 370 376 377 # Loop 371 378 itk_component add loop { 372 Rappture::PushButton $itk_component(flowcontrol ).loop \379 Rappture::PushButton $itk_component(flowcontrols).loop \ 373 380 -onimage [Rappture::icon loop] \ 374 381 -offimage [Rappture::icon loop] \ … … 378 385 "Play continuously" 379 386 380 # how do we know when to make something an itk component? 381 382 itk_component add numframes { 383 Rappture::Spinint $itk_component(flowcontrol).numframes \ 384 -min 0 -max 10000 387 # Frame 388 itk_component add frame { 389 ::scale $itk_component(flowcontrols).frame -from 1 -to 100 \ 390 -showvalue 0 -orient horizontal -width 14 \ 391 -state disabled \ 392 -variable [itcl::scope _settings($this-step)] \ 393 -highlightthickness 0 394 } { 395 usual 396 ignore -highlightthickness 397 rename -background -controlbackground controlBackground Background 398 } 399 $itk_component(frame) set 1 400 401 # Number of steps 402 itk_component add nsteps { 403 Rappture::Spinint $itk_component(flowcontrols).nsteps \ 404 -min 0 -max 10000 -width 4 385 405 } { 386 406 usual … … 388 408 rename -background -controlbackground controlBackground Background 389 409 } 390 $itk_component(n umframes) value 100391 392 itk_component add n umframeslabel {393 label $itk_component(flowcontrol ).framel -text "# Steps:" -font $fg \410 $itk_component(nsteps) value 100 411 412 itk_component add nstepslabel { 413 label $itk_component(flowcontrols).framel -text "# Steps:" -font $fg \ 394 414 -highlightthickness 0 395 415 } { … … 400 420 401 421 itk_component add speedlabel { 402 label $itk_component(flowcontrol ).speedl -text "Speed:" -font $fg \422 label $itk_component(flowcontrols).speedl -text "Speed:" -font $fg \ 403 423 -highlightthickness 0 404 424 } { … … 408 428 } 409 429 430 # Speed 410 431 itk_component add speed { 411 ::scale $itk_component(flowcontrol).speed -from 500 -to 50 \ 412 -showvalue 0 -orient horizontal -width 14 -length 150 \ 413 -variable [itcl::scope _settings(speed)] \ 414 -highlightthickness 0 432 Rappture::Spinint $itk_component(flowcontrols).speed \ 433 -min 1 -max 10 -width 2 415 434 } { 416 usual 435 usual 417 436 ignore -highlightthickness 418 437 rename -background -controlbackground controlBackground Background 419 438 } 420 $itk_component(speed) set 500 421 422 blt::table $itk_component(flowcontrol) \ 439 $itk_component(speed) value 1 440 bind $itk_component(speed) <<Value>> [itcl::code $this flow speed] 441 442 443 blt::table $itk_component(flowcontrols) \ 423 444 0,0 $itk_component(rewind) -padx {3 0} \ 424 445 0,1 $itk_component(stop) -padx {2 0} \ 425 446 0,2 $itk_component(play) -padx {2 0} \ 426 447 0,3 $itk_component(loop) -padx {2 0} \ 448 0,4 $itk_component(frame) -fill x -padx {2 0 } \ 427 449 0,5 $itk_component(speedlabel) -padx {2 0} \ 428 0,6 $itk_component(speed) -fill x \ 429 0,7 $itk_component(numframeslabel) -padx {2 0} \ 430 0,8 $itk_component(numframes) -fill x -padx { 0 3} 431 blt::table configure $itk_component(flowcontrol) c* -resize none 432 blt::table configure $itk_component(flowcontrol) c4 c6 -resize both 433 blt::table configure $itk_component(flowcontrol) r0 -pady 1 450 0,6 $itk_component(speed) -padx {2 0} \ 451 0,7 $itk_component(nstepslabel) -padx {2 0} \ 452 0,8 $itk_component(nsteps) -padx { 2 3} 453 454 blt::table configure $itk_component(flowcontrols) c* -resize none 455 blt::table configure $itk_component(flowcontrols) c4 -resize both 456 blt::table configure $itk_component(flowcontrols) r0 -pady 1 434 457 # Bindings for rotation via mouse 435 458 bind $itk_component(3dview) <ButtonPress-1> \ … … 439 462 bind $itk_component(3dview) <ButtonRelease-1> \ 440 463 [itcl::code $this Rotate release %x %y] 464 441 465 bind $itk_component(3dview) <Configure> \ 442 466 [itcl::code $this EventuallyResize %w %h] … … 609 633 # ---------------------------------------------------------------------- 610 634 itcl::body Rappture::FlowvisViewer::delete {args} { 635 flow stop 611 636 if {[llength $args] == 0} { 612 637 set args $_dlist … … 880 905 881 906 NameTransferFunc $dataobj $comp 882 set _rec eiveIds($ivol) 1907 set _recvObjs($dataobj-$comp) 1 883 908 } 884 909 } … … 898 923 SendCmd "up $axis" 899 924 } 925 926 if 0 { 927 set location [$_first hints camera] 928 if { $location != "" } { 929 array set _view $location 930 } 931 set _settings($this-theta) $_view(theta) 932 set _settings($this-phi) $_view(phi) 933 set _settings($this-psi) $_view(psi) 934 set _settings($this-pan-x) $_view(pan-x) 935 set _settings($this-pan-y) $_view(pan-y) 936 set _settings($this-zoom) $_view(zoom) 937 set xyz [Euler2XYZ $_view(theta) $_view(phi) $_view(psi)] 938 SendCmd "camera angle $xyz" 939 PanCamera 940 SendCmd "camera zoom $_view(zoom)" 941 } 900 942 # The active transfer function is by default the first component of 901 943 # the first data object. This assumes that the data is always … … 943 985 itcl::body Rappture::FlowvisViewer::SendTransferFuncs {} { 944 986 if { $_activeTf == "" } { 987 puts stderr "no active tf" 945 988 return 946 989 } 947 990 set tf $_activeTf 948 991 if { $_first == "" } { 992 puts stderr "no first" 949 993 return 950 994 } … … 968 1012 } 969 1013 } 970 FixLegend1014 ResizeLegend 971 1015 } 972 1016 … … 979 1023 # ---------------------------------------------------------------------- 980 1024 itcl::body Rappture::FlowvisViewer::ReceiveImage { args } { 981 if {![isconnected]} {982 return983 }984 1025 array set info { 985 1026 -token "???" … … 991 1032 ReceiveEcho <<line "<read $info(-bytes) bytes" 992 1033 if { $info(-type) == "image" } { 993 ReceiveEcho "for [image width $_image(plot)]x[image height $_image(plot)] image>"994 1034 $_image(plot) configure -data $bytes 995 1035 } elseif { $info(type) == "print" } { … … 1066 1106 # doesn't parse 3D data formats, we rely on the server (flowvis) to 1067 1107 # tell us what the limits are. Once we've received the limits to all 1068 # the data we've sent (tracked by _rec eiveIds) we can then determine1108 # the data we've sent (tracked by _recvObjs) we can then determine 1069 1109 # what the transfer functions are for these # volumes. 1070 1110 # … … 1103 1143 set _limits(vmax) $info(vmax); # Overall maximum value. 1104 1144 1105 unset _rec eiveIds($ivol)1106 if { [array size _rec eiveIds] == 0 } {1145 unset _recvObjs($tag) 1146 if { [array size _recvObjs] == 0 } { 1107 1147 updatetransferfuncs 1108 1148 } … … 1117 1157 # 1118 1158 itcl::body Rappture::FlowvisViewer::Rebuild {} { 1119 puts stderr "in Rebuild"1159 #puts stderr "in Rebuild" 1120 1160 # Hide all the isomarkers. Can't remove them. Have to remember the 1121 1161 # settings since the user may have created/deleted/moved markers. … … 1129 1169 # in the midst of sending data? then bail out 1130 1170 if {[llength $_sendobjs] > 0} { 1171 $_dispatcher event -idle !rebuild 1131 1172 return 1132 1173 } … … 1136 1177 # generates a new call to Rebuild). 1137 1178 set _buffering 1 1179 1180 set w [winfo width $itk_component(3dview)] 1181 set h [winfo height $itk_component(3dview)] 1182 EventuallyResize $w $h 1138 1183 1139 1184 # Find any new data that needs to be sent to the server. Queue this up on … … 1148 1193 } 1149 1194 } 1150 set w [winfo width $itk_component(3dview)]1151 set h [winfo height $itk_component(3dview)]1152 EventuallyResize $w $h1153 1195 1154 1196 # 1155 1197 # Reset the camera and other view parameters 1156 1198 # 1157 set xyz [Euler2XYZ $_view(theta) $_view(phi) $_view(psi)] 1158 SendCmd "camera angle $xyz" 1159 PanCamera 1160 SendCmd "camera zoom $_view(zoom)" 1161 1199 FixSettings light 1200 FixSettings transp 1201 FixSettings isosurface 1202 FixSettings grid 1203 FixSettings axes 1204 FixSettings outline 1205 # nothing to send -- activate the proper ivol 1206 set _first [lindex [get] 0] 1207 if {"" != $_first} { 1208 set axis [$_first hints updir] 1209 if {"" != $axis} { 1210 SendCmd "up $axis" 1211 } 1212 set location [$_first hints camera] 1213 if { $location != "" } { 1214 array set _view $location 1215 } 1216 } 1162 1217 set _settings($this-theta) $_view(theta) 1163 1218 set _settings($this-phi) $_view(phi) … … 1167 1222 set _settings($this-zoom) $_view(zoom) 1168 1223 1169 FixSettings light 1170 FixSettings transp 1171 FixSettings isosurface 1172 FixSettings grid 1173 FixSettings axes 1174 FixSettings outline 1224 set xyz [Euler2XYZ $_view(theta) $_view(phi) $_view(psi)] 1225 SendCmd "camera angle $xyz" 1226 PanCamera 1227 SendCmd "camera zoom $_view(zoom)" 1175 1228 1176 1229 if {[llength $_sendobjs] > 0} { 1177 1230 # send off new data objects 1178 1231 $_dispatcher event -idle !send_dataobjs 1232 puts stderr "more sendobjs " 1179 1233 return 1180 1234 } … … 1187 1241 SendCmd "up $axis" 1188 1242 } 1243 set location [$_first hints camera] 1244 if { $location != "" } { 1245 array set _view $location 1246 } 1189 1247 if { 0 && $_settings($this-volume) } { 1190 1248 SendCmd "volume state 0" … … 1224 1282 set _buffering 0; # Turn off buffering. 1225 1283 set _outbuf ""; # Clear the buffer. 1226 puts stderr "exit Rebuild"1284 #puts stderr "exit Rebuild" 1227 1285 } 1228 1286 … … 1468 1526 set inner $itk_component(settingsFrame) 1469 1527 set frames [$inner.framecnt value] 1470 set _settings(n umframes) $frames1528 set _settings(nsteps) $frames 1471 1529 set cmds "flow capture $frames" 1472 1530 SendCmd $cmds … … 1637 1695 1638 1696 # ---------------------------------------------------------------------- 1639 # USAGE: FixLegend1697 # USAGE: ResizeLegend 1640 1698 # 1641 1699 # Used internally to update the legend area whenever it changes size … … 1643 1701 # for the current field. 1644 1702 # ---------------------------------------------------------------------- 1645 itcl::body Rappture::FlowvisViewer::FixLegend {} { 1703 itcl::body Rappture::FlowvisViewer::ResizeLegend {} { 1704 set _resizeLegendPending 0 1646 1705 set lineht [font metrics $itk_option(-font) -linespace] 1647 1706 set w [expr {$_width-20}] … … 1681 1740 set tf "$style(-color):$style(-levels):$style(-opacity)" 1682 1741 lappend _obj2style($dataobj-$comp) $tf 1683 puts stderr "creating tf=$tf $dataobj-$comp"1684 parray _obj2style1685 1742 lappend _style2objs($tf) $dataobj $comp 1686 1743 return $tf … … 2311 2368 set _settings($this-particles-$name) $info(hide) 2312 2369 } 2313 checkbutton $inner.part$row -text $ name\2370 checkbutton $inner.part$row -text $info(label) \ 2314 2371 -variable [itcl::scope _settings($this-particles-$name)] \ 2315 2372 -onvalue 0 -offvalue 1 \ … … 2334 2391 set _settings($this-box-$name) $info(hide) 2335 2392 } 2336 checkbutton $inner.box$row -text $info( name) \2393 checkbutton $inner.box$row -text $info(label) \ 2337 2394 -variable [itcl::scope _settings($this-box-$name)] \ 2338 2395 -onvalue 0 -offvalue 1 \ … … 2353 2410 itcl::body Rappture::FlowvisViewer::particles { tag name } { 2354 2411 set bool $_settings($this-particles-$name) 2355 SendCmd "$tag particles configure $name-hide $bool"2412 SendCmd "$tag particles configure {$name} -hide $bool" 2356 2413 } 2357 2414 2358 2415 itcl::body Rappture::FlowvisViewer::box { tag name } { 2359 2416 set bool $_settings($this-box-$name) 2360 SendCmd "$tag box configure $name-hide $bool"2417 SendCmd "$tag box configure {$name} -hide $bool" 2361 2418 } 2362 2419 … … 2412 2469 itcl::body Rappture::FlowvisViewer::DoResize {} { 2413 2470 SendCmd "screen $_width $_height" 2471 set _resizePending 0 2414 2472 } 2415 2473 2416 2474 itcl::body Rappture::FlowvisViewer::EventuallyResize { w h } { 2417 if { $_width != $w || $_height != $h } {2418 set _width $w 2419 set _height $h 2475 set _width $w 2476 set _height $h 2477 if { !$_resizePending } { 2420 2478 $_dispatcher event -idle !resize 2479 set _resizePending 1 2421 2480 } 2422 2481 } 2423 2482 2424 2483 itcl::body Rappture::FlowvisViewer::EventuallyResizeLegend {} { 2425 $_dispatcher event -idle !legend 2484 if { !$_resizeLegendPending } { 2485 $_dispatcher event -idle !legend 2486 set _resizeLegendPending 1 2487 } 2426 2488 } 2427 2489 … … 2483 2545 append cmd "-axis $info(axis) -color {$color}\n" 2484 2546 } 2485 puts stderr "boxes=[$flowobj boxes]"2486 2547 foreach box [$flowobj boxes] { 2487 2548 array unset info … … 2515 2576 # $this flow next 2516 2577 # 2517 itcl::body Rappture::FlowvisViewer::flow {option} { 2578 itcl::body Rappture::FlowvisViewer::flow { args } { 2579 set option [lindex $args 0] 2518 2580 switch -- $option { 2581 "speed" { 2582 set speed [$itk_component(speed) value] 2583 set _settings($this-speed) [expr int(round(500.0/$speed))] 2584 } 2585 "nsteps" { 2586 set n [$itk_component(nsteps) value] 2587 $itk_component(frame) configure -max $n 2588 set settings($this-nsteps) $n 2589 } 2519 2590 "off" { 2520 2591 set _flow(state) 0 … … 2542 2613 flow on 2543 2614 # If we're at the end of the flow, reset the flow. 2544 set count [$itk_component(numframes) value]2545 if { $ _flow(frame) >= $count} {2546 set _ flow(frame) 12615 set n $_settings($this-step) 2616 if { $n >= $_settings($this-nsteps) } { 2617 set _settings($this-step) 1 2547 2618 SendCmd "flow reset" 2548 2619 } … … 2558 2629 } 2559 2630 "reset" { 2560 set _ flow(frame) 02631 set _settings($this-step) 0 2561 2632 SendCmd "flow reset" 2562 2633 if { !$_flow(state) } { … … 2565 2636 } 2566 2637 "next" { 2567 set count [$itk_component(numframes) value] 2568 incr _flow(frame) 2569 if { $_flow(frame) >= $count } { 2638 set w $itk_component(3dview) 2639 while { $w != "" } { 2640 if { ![winfo ismapped $w] } { 2641 flow stop 2642 puts stderr "$w isn't mapped" 2643 return 2644 } 2645 set w [winfo parent $w] 2646 if { [winfo toplevel $w] == $w } { 2647 break 2648 } 2649 } 2650 set n [incr _settings($this-step)] 2651 if { $n >= $_settings($this-nsteps) } { 2570 2652 if { !$_settings($this-loop) } { 2571 2653 flow off … … 2576 2658 SendCmd "flow next" 2577 2659 } 2578 set delay [expr {int(ceil(pow($_settings(speed)/10.0+2,2.0)*15))}] 2579 set delay2 [expr round(log($_settings(speed)+0.00001)*100.0)] 2580 $_dispatcher event -after $_settings(speed) !play 2660 $_dispatcher event -after $_settings($this-speed) !play 2581 2661 } 2582 2662 default { … … 2638 2718 focus $inner.cancel 2639 2719 2640 SendCmd "flow video $width $height $_settings( numframes) 2.0 1000"2720 SendCmd "flow video $width $height $_settings($this-nsteps) 2.0 1000" 2641 2721 2642 2722 $popup activate $widget below -
trunk/gui/scripts/heightmapviewer.tcl
r1437 r1448 296 296 set params(-color) black 297 297 } 298 set location [$dataobj hints camera]299 if { $location != "" } {300 array set _view $location301 }302 298 set pos [lsearch -exact $dataobj $_dlist] 303 299 if {$pos < 0} { … … 583 579 if {"" != $axis} { 584 580 SendCmd "up $axis" 581 } 582 set location [$first hints camera] 583 if { $location != "" } { 584 array set _view $location 585 585 } 586 586 } -
trunk/gui/scripts/nanovisviewer.tcl
r1444 r1448 132 132 private variable _width 0 133 133 private variable _height 0 134 private variable _resizePending 0 135 private variable _resizeLegendPending 0 134 136 } 135 137 … … 347 349 $_dispatcher cancel !send_dataobjs 348 350 $_dispatcher cancel !send_transfunc 351 $_dispatcher cancel !resize 349 352 image delete $_image(plot) 350 353 image delete $_image(legend) … … 380 383 set params(-color) black 381 384 } 382 383 385 set pos [lsearch -exact $dataobj $_dlist] 384 386 if {$pos < 0} { … … 674 676 SendCmd "up $axis" 675 677 } 678 set location [$_first hints camera] 679 if { $location != "" } { 680 array set _view $location 681 } 676 682 # The active transfer function is by default the first component of 677 683 # the first data object. This assumes that the data is always … … 762 768 # ---------------------------------------------------------------------- 763 769 itcl::body Rappture::NanovisViewer::ReceiveImage { args } { 764 if { ![isconnected] } {765 return766 }767 770 array set info { 768 771 -token "???" … … 906 909 } 907 910 } 908 909 911 # in the midst of sending data? then bail out 910 912 if {[llength $_sendobjs] > 0} { … … 916 918 # generates a new call to Rebuild). 917 919 set _buffering 1 920 921 set w [winfo width $itk_component(3dview)] 922 set h [winfo height $itk_component(3dview)] 923 EventuallyResize $w $h 924 925 # 926 # Reset the camera and other view parameters 927 # 928 set xyz [Euler2XYZ $_view(theta) $_view(phi) $_view(psi)] 929 SendCmd "camera angle $xyz" 930 PanCamera 931 SendCmd "camera zoom $_view(zoom)" 918 932 919 933 # Find any new data that needs to be sent to the server. Queue this up on … … 929 943 } 930 944 } 931 set w [winfo width $itk_component(3dview)] 932 set h [winfo height $itk_component(3dview)] 933 EventuallyResize $w $h 934 935 # 936 # Reset the camera and other view parameters 937 # 938 set xyz [Euler2XYZ $_view(theta) $_view(phi) $_view(psi)] 939 SendCmd "camera angle $xyz" 940 PanCamera 941 SendCmd "camera zoom $_view(zoom)" 945 if {[llength $_sendobjs] > 0} { 946 # send off new data objects 947 $_dispatcher event -idle !send_dataobjs 948 return 949 } 942 950 943 951 set _settings($this-theta) $_view(theta) … … 955 963 FixSettings outline 956 964 957 if {[llength $_sendobjs] > 0} {958 # send off new data objects959 $_dispatcher event -idle !send_dataobjs960 return961 }962 963 965 # nothing to send -- activate the proper ivol 964 966 set _first [lindex [get] 0] … … 968 970 SendCmd "up $axis" 969 971 } 970 foreach key [array names _obj2id *-*] {971 set state [string match $_first-* $key]972 SendCmd "volume state $state$_obj2id($key)"972 SendCmd "volume state 0" 973 foreach key [array names _obj2id $_first-*] { 974 SendCmd "volume state 1 $_obj2id($key)" 973 975 } 974 976 # … … 1320 1322 # ---------------------------------------------------------------------- 1321 1323 itcl::body Rappture::NanovisViewer::FixLegend {} { 1324 set _resizeLegendPending 0 1322 1325 set lineht [font metrics $itk_option(-font) -linespace] 1323 1326 set w [expr {$_width-20}] … … 1981 1984 itcl::body Rappture::NanovisViewer::DoResize {} { 1982 1985 SendCmd "screen $_width $_height" 1986 set _resizePending 0 1983 1987 } 1984 1988 1985 1989 itcl::body Rappture::NanovisViewer::EventuallyResize { w h } { 1986 if { $_width != $w || $_height != $h } {1987 set _width $w 1988 set _height $h 1990 set _width $w 1991 set _height $h 1992 if { !$_resizePending } { 1989 1993 $_dispatcher event -idle !resize 1994 set _resizePending 1 1990 1995 } 1991 1996 } 1992 1997 1993 1998 itcl::body Rappture::NanovisViewer::EventuallyResizeLegend {} { 1994 $_dispatcher event -idle !legend 1999 if { !$_resizeLegendPending } { 2000 $_dispatcher event -idle !legend 2001 set _resizeLegendPending 1 2002 } 1995 2003 } 1996 2004 -
trunk/gui/scripts/spinint.tcl
r1342 r1448 42 42 public method value {args} 43 43 public method bump {{delta up}} 44 45 44 protected method _validate {char} 46 45 } -
trunk/gui/scripts/visviewer.tcl
r1439 r1448 314 314 $_dispatcher event -idle !rebuild 315 315 Rappture::Tooltip::cue hide 316 return 0; # Fail even though we've reconnected.317 316 } else { 318 317 Rappture::Tooltip::cue @$x,$y "Can't connect to visualization server. This may be a network problem. Wait a few moments and try resetting the view." 319 318 return 0 320 319 } 320 return 1 321 321 } 322 322 … … 409 409 flush $_sid 410 410 } 411 if 0 { 411 412 if { ![CheckConnection] } { 412 return 0 413 puts stderr "connection is now down" 414 return 0 415 } 413 416 } 414 417 return $_done($this)
Note: See TracChangeset
for help on using the changeset viewer.