- Timestamp:
- Apr 18, 2015, 12:44:02 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gui/scripts/flowvisviewer.tcl
r5274 r5276 6 6 # It connects to the Flowvis server running on a rendering farm, transmits 7 7 # data, and displays the results. 8 #9 8 # ====================================================================== 10 9 # AUTHOR: Michael McLennan, Purdue University … … 70 69 public method scale {args} 71 70 public method updateTransferFunctions {} 72 73 # soon to be removed.74 private method Flow {option args}75 private method Play {}76 private method Pause {}77 71 78 72 # The following methods are only used by this class. … … 460 454 "Set duration of flow (format is min:sec)" 461 455 462 463 456 itk_component add durationlabel { 464 457 label $itk_component(flowcontrols).durationl \ … … 1247 1240 } 1248 1241 1249 1250 1242 # sync the state of slicers 1251 1243 set vols [CurrentVolumeIds -cutplanes] … … 1446 1438 $itk_component(3dview) configure -cursor "" 1447 1439 } 1448 }1449 1450 1451 # ----------------------------------------------------------------------1452 # USAGE: Flow movie record|stop|play ?on|off|toggle?1453 #1454 # Called when the user clicks on the record, stop or play buttons1455 # for flow visualization.1456 # ----------------------------------------------------------------------1457 itcl::body Rappture::FlowvisViewer::Flow {option args} {1458 switch -- $option {1459 movie {1460 if {[llength $args] < 1 || [llength $args] > 2} {1461 error "wrong # args: should be \"Flow movie record|stop|play ?on|off|toggle?\""1462 }1463 set action [lindex $args 0]1464 set op [lindex $args 1]1465 if {$op == ""} { set op "on" }1466 1467 set current [State $action]1468 if {$op == "toggle"} {1469 if {$current == "on"} {1470 set op "off"1471 } else {1472 set op "on"1473 }1474 }1475 set cmds ""1476 switch -- $action {1477 record {1478 if { [$itk_component(rewind) cget -relief] != "sunken" } {1479 $itk_component(rewind) configure -relief sunken1480 $itk_component(stop) configure -relief raised1481 $itk_component(play) configure -relief raised1482 set inner $itk_component(settingsFrame)1483 set frames [$inner.framecnt value]1484 set _settings(nsteps) $frames1485 set cmds "flow capture $frames"1486 SendCmd $cmds1487 }1488 }1489 stop {1490 if { [$itk_component(stop) cget -relief] != "sunken" } {1491 $itk_component(rewind) configure -relief raised1492 $itk_component(stop) configure -relief sunken1493 $itk_component(play) configure -relief raised1494 _pause1495 set cmds "flow reset"1496 SendCmd $cmds1497 }1498 }1499 play {1500 if { [$itk_component(play) cget -relief] != "sunken" } {1501 $itk_component(rewind) configure -relief raised1502 $itk_component(stop) configure -relief raised1503 $itk_component(play) configure \1504 -image [Rappture::icon flow-pause] \1505 -relief sunken1506 bind $itk_component(play) <ButtonPress> \1507 [itcl::code $this _pause]1508 flow next1509 }1510 }1511 default {1512 error "bad option \"$option\": should be one of record|stop|play"1513 }1514 1515 }1516 }1517 default {1518 error "bad option \"$option\": should be movie"1519 }1520 }1521 }1522 1523 # ----------------------------------------------------------------------1524 # USAGE: Play1525 #1526 # ----------------------------------------------------------------------1527 itcl::body Rappture::FlowvisViewer::Play {} {1528 SendCmd "flow next"1529 set delay [expr {int(ceil(pow($_settings(speed)/10.0+2,2.0)*15))}]1530 $_dispatcher event -after $delay !play1531 }1532 1533 # ----------------------------------------------------------------------1534 # USAGE: Pause1535 #1536 # Invoked when the user hits the "pause" button to stop playing the1537 # current sequence of frames as a movie.1538 # ----------------------------------------------------------------------1539 itcl::body Rappture::FlowvisViewer::Pause {} {1540 $_dispatcher cancel !play1541 1542 # Toggle the button to "play" mode1543 $itk_component(play) configure \1544 -image [Rappture::icon flow-start] \1545 -relief raised1546 bind $itk_component(play) <ButtonPress> \1547 [itcl::code $this Flow movie play toggle]1548 1440 } 1549 1441 … … 2677 2569 } 2678 2570 2679 2680 2571 # 2681 2572 # flow -- … … 2821 2712 } 2822 2713 2823 itcl::body Rappture::FlowvisViewer::GetPngImage 2714 itcl::body Rappture::FlowvisViewer::GetPngImage { widget width height } { 2824 2715 set token "print[incr _nextToken]" 2825 2716 set var ::Rappture::FlowvisViewer::_hardcopy($this-$token)
Note: See TracChangeset
for help on using the changeset viewer.