Changeset 5278


Ignore:
Timestamp:
Apr 18, 2015, 4:13:45 AM (5 years ago)
Author:
ldelgass
Message:

merge r5276 from trunk

Location:
branches/1.4
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/1.4

    • Property svn:mergeinfo changed
      /trunkmerged: 5276
  • branches/1.4/gui/scripts/flowvisviewer.tcl

    r5275 r5278  
    66# It connects to the Flowvis server running on a rendering farm, transmits
    77# data, and displays the results.
    8 #
    98# ======================================================================
    109#  AUTHOR:  Michael McLennan, Purdue University
     
    7069    public method scale {args}
    7170    public method updateTransferFunctions {}
    72 
    73     # soon to be removed.
    74     private method Flow {option args}
    75     private method Play {}
    76     private method Pause {}
    7771
    7872    # The following methods are only used by this class.
     
    445439        "Set duration of flow (format is min:sec)"
    446440
    447 
    448441    itk_component add durationlabel {
    449442        label $itk_component(flowcontrols).durationl \
     
    12251218    }
    12261219
    1227 
    12281220    # sync the state of slicers
    12291221    set vols [CurrentVolumeIds -cutplanes]
     
    14251417        $itk_component(3dview) configure -cursor ""
    14261418    }
    1427 }
    1428 
    1429 
    1430 # ----------------------------------------------------------------------
    1431 # USAGE: Flow movie record|stop|play ?on|off|toggle?
    1432 #
    1433 # Called when the user clicks on the record, stop or play buttons
    1434 # for flow visualization.
    1435 # ----------------------------------------------------------------------
    1436 itcl::body Rappture::FlowvisViewer::Flow {option args} {
    1437     switch -- $option {
    1438         movie {
    1439             if {[llength $args] < 1 || [llength $args] > 2} {
    1440                 error "wrong # args: should be \"Flow movie record|stop|play ?on|off|toggle?\""
    1441             }
    1442             set action [lindex $args 0]
    1443             set op [lindex $args 1]
    1444             if {$op == ""} { set op "on" }
    1445 
    1446             set current [State $action]
    1447             if {$op == "toggle"} {
    1448                 if {$current == "on"} {
    1449                     set op "off"
    1450                 } else {
    1451                     set op "on"
    1452                 }
    1453             }
    1454             set cmds ""
    1455             switch -- $action {
    1456                 record {
    1457                     if { [$itk_component(rewind) cget -relief] != "sunken" } {
    1458                         $itk_component(rewind) configure -relief sunken
    1459                         $itk_component(stop) configure -relief raised
    1460                         $itk_component(play) configure -relief raised
    1461                         set inner $itk_component(settingsFrame)
    1462                         set frames [$inner.framecnt value]
    1463                         set _settings(nsteps) $frames
    1464                         set cmds "flow capture $frames"
    1465                         SendCmd $cmds
    1466                     }
    1467                 }
    1468                 stop {
    1469                     if { [$itk_component(stop) cget -relief] != "sunken" } {
    1470                         $itk_component(rewind) configure -relief raised
    1471                         $itk_component(stop) configure -relief sunken
    1472                         $itk_component(play) configure -relief raised
    1473                         _pause
    1474                         set cmds "flow reset"
    1475                         SendCmd $cmds
    1476                     }
    1477                 }
    1478                 play {
    1479                     if { [$itk_component(play) cget -relief] != "sunken" } {
    1480                         $itk_component(rewind) configure -relief raised
    1481                         $itk_component(stop) configure -relief raised
    1482                         $itk_component(play) configure \
    1483                             -image [Rappture::icon flow-pause] \
    1484                             -relief sunken
    1485                         bind $itk_component(play) <ButtonPress> \
    1486                             [itcl::code $this _pause]
    1487                         flow next
    1488                     }
    1489                 }
    1490                 default {
    1491                     error "bad option \"$option\": should be one of record|stop|play"
    1492                 }
    1493 
    1494             }
    1495         }
    1496         default {
    1497             error "bad option \"$option\": should be movie"
    1498         }
    1499     }
    1500 }
    1501 
    1502 # ----------------------------------------------------------------------
    1503 # USAGE: Play
    1504 #
    1505 # ----------------------------------------------------------------------
    1506 itcl::body Rappture::FlowvisViewer::Play {} {
    1507     SendCmd "flow next"
    1508     set delay [expr {int(ceil(pow($_settings(speed)/10.0+2,2.0)*15))}]
    1509     $_dispatcher event -after $delay !play
    1510 }
    1511 
    1512 # ----------------------------------------------------------------------
    1513 # USAGE: Pause
    1514 #
    1515 # Invoked when the user hits the "pause" button to stop playing the
    1516 # current sequence of frames as a movie.
    1517 # ----------------------------------------------------------------------
    1518 itcl::body Rappture::FlowvisViewer::Pause {} {
    1519     $_dispatcher cancel !play
    1520 
    1521     # Toggle the button to "play" mode
    1522     $itk_component(play) configure \
    1523         -image [Rappture::icon flow-start] \
    1524         -relief raised
    1525     bind $itk_component(play) <ButtonPress> \
    1526         [itcl::code $this Flow movie play toggle]
    15271419}
    15281420
     
    26022494}
    26032495
    2604 
    26052496#
    26062497# flow --
     
    27462637}
    27472638
    2748 itcl::body Rappture::FlowvisViewer::GetPngImage  { widget width height } {
     2639itcl::body Rappture::FlowvisViewer::GetPngImage { widget width height } {
    27492640    set token "print[incr _nextToken]"
    27502641    set var ::Rappture::FlowvisViewer::_hardcopy($this-$token)
Note: See TracChangeset for help on using the changeset viewer.