Changeset 1491 for trunk


Ignore:
Timestamp:
Jun 8, 2009 8:29:19 AM (15 years ago)
Author:
gah
Message:

update for flowvisviewer: speed controls, arrows, volume checkbutton

Location:
trunk/gui/scripts
Files:
1 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/gui/scripts/Makefile.in

    r1471 r1491  
    5050                $(srcdir)/flowdial.tcl \
    5151                $(srcdir)/flowhints.tcl \
     52                $(srcdir)/flowspeed.tcl \
    5253                $(srcdir)/flowvisviewer.tcl \
    5354                $(srcdir)/gauge.tcl \
  • trunk/gui/scripts/field.tcl

    r1463 r1491  
    639639            if {[$_xmlobj element $path] != ""} {
    640640                set element [$_xmlobj element -as type $path]
    641                 puts stderr "element is $element"
    642641                if { $element == "unirect2d" } {
    643642                    set _comp2dims($cname) "2D"
  • trunk/gui/scripts/flowhints.tcl

    r1449 r1491  
    5959        "position"      "0.0%"
    6060        "streams"       "on"
     61        "arrows"        "off"
    6162        "volume"        "on"
    6263    }
     
    7273            "volume"      { GetBoolean $f $child _hints(volume) }
    7374            "streams"     { GetBoolean $f $child _hints(streams) }
     75            "arrows"      { GetBoolean $f $child _hints(arrows) }
    7476            "axis"        { GetAxis $f  $child _hints(axis) }
    7577            "position"    { GetPosition $f $child _hints(position) }
  • trunk/gui/scripts/flowvisviewer.tcl

    r1479 r1491  
    5858    public method camera {option args}
    5959    public method delete {args}
     60    public method disconnect {}
    6061    public method download {option args}
    6162    public method flow {option}
     
    6970    public method rmdupmarker { m x }
    7071    public method scale {args}
     72    public method sendto { cmd }
    7173    public method updatetransferfuncs {}
    7274
     
    7476    protected method CurrentVolumeIds {{what -all}}
    7577    protected method Disconnect {}
    76     protected method DoResize {}
     78    protected method Resize {}
    7779    protected method ResizeLegend {}
    7880    protected method FixSettings {what {value ""}}
     
    121123    private method box { tag name }
    122124    private method streams { tag name }
     125    private method arrows { tag name }
    123126
    124127    private variable _outbuf       ;# buffer for outgoing commands
     
    189192    # Resize event.
    190193    $_dispatcher register !resize
    191     $_dispatcher dispatch $this !resize "[itcl::code $this DoResize]; list"
     194    $_dispatcher dispatch $this !resize "[itcl::code $this Resize]; list"
    192195
    193196    $_dispatcher register !play
     
    225228
    226229    array set _settings [subst {
     230        $this-arrows            0
    227231        $this-currenttime       0
     232        $this-duration          1:00
    228233        $this-loop              0
    229234        $this-pan-x             $_view(pan-x)
     
    232237        $this-play              0
    233238        $this-psi               $_view(psi)
     239        $this-speed             500
    234240        $this-step              0
    235         $this-speed             500
    236         $this-duration          1:00
     241        $this-streams           0
    237242        $this-theta             $_view(theta)
    238243        $this-volume            1
     
    299304    BuildCutplanesTab
    300305    BuildCameraTab
    301 
    302306
    303307    bind $itk_component(3dview) <Configure> \
     
    409413        entry $itk_component(flowcontrols).duration \
    410414            -textvariable [itcl::scope _settings($this-duration)] \
    411             -bg white -width 6
     415            -bg white -width 6 -font "arial 9"
    412416    } {
    413417        usual
     
    440444    # Speed
    441445    itk_component add speed {
    442         Rappture::Spinint $itk_component(flowcontrols).speed \
    443             -min 1 -max 10 -width 2
     446        Rappture::Flowspeed $itk_component(flowcontrols).speed \
     447            -min 1 -max 10 -width 3 -font "arial 9"
    444448    } {
    445449        usual
     
    837841itcl::body Rappture::FlowvisViewer::isconnected {} {
    838842    return [VisViewer::IsConnected]
     843}
     844
     845#
     846# disconnect --
     847#
     848itcl::body Rappture::FlowvisViewer::disconnect {} {
     849    Disconnect
     850}
     851
     852#
     853# sendto --
     854#
     855itcl::body Rappture::FlowvisViewer::sendto { bytes } {
     856    SendBytes "$bytes\n"
    839857}
    840858
     
    10121030    if { $info(-type) == "image" } {
    10131031        $_image(plot) configure -data $bytes
     1032        #puts stderr "image received [image width $_image(plot)] by [image height $_image(plot)]"
    10141033    } elseif { $info(type) == "print" } {
    10151034        set tag $this-print-$info(-token)
     
    10381057        return
    10391058    }
    1040     puts stderr "receive legend $tag $vmin $vmax $size"
     1059    #puts stderr "receive legend $tag $vmin $vmax $size"
    10411060    set bytes [ReceiveBytes $size]
    10421061    $_image(legend) configure -data $bytes
     
    15701589    switch -- $what {
    15711590        light {
    1572             if {[isconnected]} {
     1591            if { $_first != "" } {
    15731592                set comp [lindex [$_first components] 0]
    15741593                set tag $_first-$comp
     
    15791598        }
    15801599        transp {
    1581             if {[isconnected]} {
     1600            if { $_first != "" } {
    15821601                set comp [lindex [$_first components] 0]
    15831602                set tag $_first-$comp
     
    15871606        }
    15881607        opacity {
    1589             if {[isconnected] && $_activeTf != "" } {
     1608            if { $_first != "" && && $_activeTf != "" } {
    15901609                set opacity [expr { 0.01 * double($_settings($this-opacity)) }]
    15911610                set tf $_activeTf
     
    15961615
    15971616        thickness {
    1598             if {[isconnected] && $_activeTf != "" } {
     1617            if { $_first != "" && && $_activeTf != "" } {
    15991618                set val $_settings($this-thickness)
    16001619                # Scale values between 0.00001 and 0.01000
     
    16061625        }
    16071626        "outline" {
    1608             if {[isconnected]} {
     1627            if { $_first != "" } {
    16091628                set comp [lindex [$_first components] 0]
    16101629                set tag $_first-$comp
     
    16131632        }
    16141633        "isosurface" {
    1615             if {[isconnected]} {
    1616                 SendCmd "volume shading isosurface $_settings($this-isosurface)"
    1617             }
     1634            if { [isconnected] } {
     1635                SendCmd "volume shading isosurface $_settings($this-isosurface)"
     1636            }
    16181637        }
    16191638        "grid" {
     
    16381657        }
    16391658        "volume" {
    1640             if { [isconnected] } {
     1659            if { $_first != "" } {
    16411660                set comp [lindex [$_first components] 0]
    16421661                set tag $_first-$comp
     
    16731692# ----------------------------------------------------------------------
    16741693itcl::body Rappture::FlowvisViewer::ResizeLegend {} {
    1675     puts stderr "ResizeLegend"
    16761694    set _resizeLegendPending 0
    16771695    set lineht [font metrics $itk_option(-font) -linespace]
    16781696    set w [expr {$_width-20}]
    16791697    set h [expr {[winfo height $itk_component(legend)]-20-$lineht}]
     1698    #puts stderr "ResizeLegend $w $h"
    16801699
    16811700    if { $_first == "" } {
     
    21432162    #set bfg [option get $itk_component(hull) boldFont Font]
    21442163
     2164    checkbutton $inner.vol -text "Show volume" -font $fg \
     2165        -text "Volume" \
     2166        -variable [itcl::scope _settings($this-volume)] \
     2167        -command [itcl::code $this FixSettings volume] \
     2168        -font "Arial 9"
     2169
     2170    label $inner.shading -text "Shading:" -font $fg
     2171
    21452172    label $inner.dim -text "Dim" -font $fg
    21462173    ::scale $inner.light -from 0 -to 100 -orient horizontal \
     
    21722199
    21732200    blt::table $inner \
     2201        0,0 $inner.vol -columnspan 4 -anchor w -pady 2 \
     2202        1,0 $inner.shading -columnspan 4 -anchor w -pady {10 2} \
     2203        2,0 $inner.dim -anchor e -pady 2 \
     2204        2,1 $inner.light -columnspan 2 -pady 2 -fill x \
     2205        2,3 $inner.bright -anchor w -pady 2 \
     2206        3,0 $inner.fog -anchor e -pady 2 \
     2207        3,1 $inner.transp -columnspan 2 -pady 2 -fill x \
     2208        3,3 $inner.plastic -anchor w -pady 2 \
     2209        4,0 $inner.clear -anchor e -pady 2 \
     2210        4,1 $inner.opacity -columnspan 2 -pady 2 -fill x\
     2211        4,3 $inner.opaque -anchor w -pady 2 \
     2212        5,0 $inner.thin -anchor e -pady 2 \
     2213        5,1 $inner.thickness -columnspan 2 -pady 2 -fill x\
     2214        5,3 $inner.thick -anchor w -pady 2
     2215
     2216    if 0 {
    21742217        0,0 $inner.dim  -anchor e -pady 2 \
    21752218        0,1 $inner.light -columnspan 2 -pady 2 \
     
    21842227        3,1 $inner.thickness -columnspan 2 -pady 2 \
    21852228        3,3 $inner.thick -anchor w -pady 2
    2186 
     2229    }
    21872230    blt::table configure $inner c0 c1 c3 r* -resize none
    21882231    blt::table configure $inner r6 -resize expand
     
    23362379        -font "Arial 9"
    23372380    Rappture::Tooltip::for $inner.showstreams $hints(description)
     2381
     2382    checkbutton $inner.showarrows -text "Arrows" \
     2383        -variable [itcl::scope _settings($this-arrows)] \
     2384        -command  [itcl::code $this arrows $key $hints(name)]  \
     2385        -font "Arial 9"
     2386
    23382387    label $inner.particles -text "Particles"    -font "Arial 9 bold"
    23392388    label $inner.boxes -text "Boxes"    -font "Arial 9 bold"
    23402389
    23412390    blt::table $inner \
    2342         1,0 $inner.showstreams  -anchor w
    2343     blt::table configure $inner c0 -resize none
    2344     blt::table configure $inner c1 -resize expand
    2345 
    2346     set row 2
     2391        1,0 $inner.showstreams  -anchor w \
     2392        2,0 $inner.showarrows  -anchor w
     2393    blt::table configure $inner c0 c1 -resize none
     2394    blt::table configure $inner c2 -resize expand
     2395
     2396    set row 3
    23472397    set particles [$flowobj particles]
    23482398    if { [llength $particles] > 0 } {
     
    24142464}
    24152465
     2466itcl::body Rappture::FlowvisViewer::arrows { tag name } {
     2467    set bool $_settings($this-arrows)
     2468    SendCmd "$tag configure -arrows no"
     2469}
     2470
    24162471# ----------------------------------------------------------------------
    24172472# USAGE: Slice move x|y|z <newval>
     
    24582513
    24592514
    2460 itcl::body Rappture::FlowvisViewer::DoResize {} {
     2515itcl::body Rappture::FlowvisViewer::Resize {} {
     2516    #puts stderr "Resize $_width $_height"
    24612517    SendCmd "screen $_width $_height"
    24622518    set _resizePending 0
     
    24732529
    24742530itcl::body Rappture::FlowvisViewer::EventuallyResizeLegend {} {
     2531    #puts stderr "in EventuallyResizeLegend"
    24752532    if { !$_resizeLegendPending } {
    2476         puts stderr "in EventuallyResizeLegend"
    24772533        $_dispatcher event -after 100 !legend
    24782534        set _resizeLegendPending 1
     
    25382594    append cmd "flow add $tag -position $info(position) -axis $info(axis) "
    25392595    append cmd "-volume $info(volume) -outline $info(outline) "
    2540     append cmd "-slice $info(streams)\n"
     2596    append cmd "-slice $info(streams) -arrows $info(arrows)\n"
    25412597    foreach part [$flowobj particles] {
    25422598        array unset info
     
    27952851    set min [expr floor($value / 60000.0)]
    27962852    set sec [expr ($value - ($min*60000.0)) / 1000.0]
    2797     puts stderr "min=$min sec=$sec"
     2853    #puts stderr "min=$min sec=$sec"
    27982854    return [format %02d:%02d [expr round($min)] [expr round($sec)]]
    27992855}
  • trunk/gui/scripts/pushbutton.tcl

    r1442 r1491  
     1
    12# ----------------------------------------------------------------------
    23#  COMPONENT: PushButton - widget for entering a choice of strings
     
    2728    public method toggle {}
    2829
     30    protected method _fixValue {args}
     31
    2932    private variable _state 0
    3033    public variable command "";         # Command to be invoked
    31     public variable variable "";        # Variable to be set.
     34    private variable _variable "";      # Variable to be set.
    3235    public variable onimage "";         # Image displayed when selected
    3336    public variable offimage "";        # Image displayed when deselected.
     
    7477}
    7578
     79# ----------------------------------------------------------------------
     80# USAGE: _fixValue ?<name1> <name2> <op>?
     81#
     82# Invoked automatically whenever the -variable associated with this
     83# widget is modified.  Copies the value to the current settings for
     84# the widget.
     85# ----------------------------------------------------------------------
     86itcl::body Rappture::PushButton::_fixValue {args} {
     87    if {"" == $itk_option(-variable)} {
     88        return
     89    }
     90    upvar #0 $itk_option(-variable) var
     91    if { $var == $onvalue } {
     92        set _state 1
     93        $itk_component(button) configure -relief sunken \
     94            -image $onimage -bg white
     95    } elseif { $var == $offvalue } {
     96        set _state 0
     97        $itk_component(button) configure -relief raise \
     98            -image $offimage -bg grey85
     99    }
     100}
     101
     102
    76103itcl::body Rappture::PushButton::select {} {
    77     set _state 1
    78     $itk_component(button) configure -relief sunken \
    79         -image $onimage -bg white
    80     upvar #0 $variable state
     104    upvar #0 $_variable state
    81105    set state $onvalue
    82106}
    83107
    84108itcl::body Rappture::PushButton::deselect {} {
    85     set _state 0
    86     $itk_component(button) configure -relief raise \
    87         -image $offimage -bg grey85
    88     upvar #0 $variable state
     109    upvar #0 $_variable state
    89110    set state $offvalue
    90111}
     112
     113
     114# ----------------------------------------------------------------------
     115# CONFIGURE: -variable
     116# ----------------------------------------------------------------------
     117itcl::configbody Rappture::PushButton::variable {
     118    if {"" != $_variable} {
     119        upvar #0 $_variable var
     120        trace remove variable var write [itcl::code $this _fixValue]
     121    }
     122    set _variable $itk_option(-variable)
     123
     124    if {"" != $_variable} {
     125        upvar #0 $_variable var
     126        trace add variable var write [itcl::code $this _fixValue]
     127
     128        # sync to the current value of this variable
     129        if {[info exists var]} {
     130            _fixValue
     131        }
     132    }
     133}
  • trunk/gui/scripts/spinint.tcl

    r1448 r1491  
     1
    12# ----------------------------------------------------------------------
    23#  COMPONENT: spinint - spinner for integer values
Note: See TracChangeset for help on using the changeset viewer.