Changeset 1442


Ignore:
Timestamp:
May 14, 2009, 10:28:24 PM (15 years ago)
Author:
gah
Message:

new flowvisviewer and pushbutton widgets

Location:
trunk/gui/scripts
Files:
2 added
3 edited

Legend:

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

    r1375 r1442  
    4848                $(srcdir)/field3dresult.tcl \
    4949                $(srcdir)/filexfer.tcl \
     50                $(srcdir)/flowhints.tcl \
    5051                $(srcdir)/flowvisviewer.tcl \
    5152                $(srcdir)/gauge.tcl \
     
    7980                $(srcdir)/postern.tcl \
    8081                $(srcdir)/progress.tcl \
     82                $(srcdir)/pushbutton.tcl \
    8183                $(srcdir)/radiodial.tcl \
    8284                $(srcdir)/resources.tcl \
  • trunk/gui/scripts/analyzer.tcl

    r1348 r1442  
    377377        }
    378378        set args ""
    379     }
     379    } 
    380380
    381381    # simulation is needed -- go to simulation page
  • trunk/gui/scripts/flowvisviewer.tcl

    r1391 r1442  
    1 
    21
    32# ----------------------------------------------------------------------
     
    2423option add *FlowvisViewer.height 4i widgetDefault
    2524option add *FlowvisViewer.foreground black widgetDefault
     25option add *FlowvisViewer.controlBackground gray widgetDefault
     26option add *FlowvisViewer.controlDarkBackground #999999 widgetDefault
    2627option add *FlowvisViewer.plotBackground black widgetDefault
    2728option add *FlowvisViewer.plotForeground white widgetDefault
    28 #FIXME: why is plot outline gray? not white?
    2929option add *FlowvisViewer.plotOutline gray widgetDefault
    3030option add *FlowvisViewer.font \
     
    5656    }
    5757    public method add {dataobj {settings ""}}
     58    public method camera {option args}
     59    public method delete {args}
     60    public method download {option args}
     61    public method flow {option}
    5862    public method get {args}
    59     public method delete {args}
     63    public method isconnected {}
     64    public method limits { tf }
     65    public method overmarker { m x }
     66    public method parameters {title args} {
     67        # do nothing
     68    }
     69    public method rmdupmarker { m x }
    6070    public method scale {args}
    61     public method download {option args}
    62     public method parameters {title args} {
    63         # do nothing
    64     }
    65     public method isconnected {}
    66 
    67     public method limits { tf }
    6871    public method updatetransferfuncs {}
    69     public method rmdupmarker { m x }
    70     public method overmarker { m x }
    71 
    72     public method camera {option args}
    7372
    7473    protected method Connect {}
     74    protected method CurrentVolumeIds {{what -all}}
    7575    protected method Disconnect {}
    76 
     76    protected method DoResize {}
     77    protected method FixLegend {}
     78    protected method FixSettings {what {value ""}}
     79    protected method Pan {option x y}
     80    protected method Rebuild {}
     81    protected method ReceiveData { args }
     82    protected method ReceiveImage { args }
     83    protected method ReceiveLegend { tf vmin vmax size }
     84    protected method Rotate {option x y}
    7785    protected method SendCmd {string}
    78     protected method _send {string}
    7986    protected method SendDataObjs {}
    8087    protected method SendTransferFuncs {}
    81 
    82     protected method ReceiveImage { args }
    83     protected method ReceiveLegend { ivol vmin vmax size }
    84     protected method ReceiveData { args }
    85 
    86     protected method Rebuild {}
    87     protected method CurrentVolumeIds {{what -all}}
    88     protected method Zoom {option}
    89     protected method Pan {option x y}
    90     protected method Rotate {option x y}
    9188    protected method Slice {option args}
    9289    protected method SlicerTip {axis}
    93 
     90    protected method Zoom {option}
     91
     92    # soon to be removed.
    9493    protected method Flow {option args}
    9594    protected method Play {}
    9695    protected method Pause {}
    97     public method flow {option}
    98 
    99     protected method State {comp}
    100     protected method DoResize {}
    101     protected method FixSettings {what {value ""}}
    102     protected method FixLegend {}
    103     private method EventuallyResize { w h }
    104     private method EventuallyResizeLegend { }
     96
    10597
    10698    # The following methods are only used by this class.
    107     private method NameTransferFunc { ivol }
    108     private method ComputeTransferFunc { tf }
     99
    109100    private method AddIsoMarker { x y }
    110     private method ParseMarkersOption { tf ivol markers }
    111     private method ParseLevelsOption { tf ivol levels }
     101    private method BuildCameraTab {}
    112102    private method BuildCutplanesTab {}
    113103    private method BuildViewTab {}
    114104    private method BuildVolumeTab {}
    115     private method BuildCameraTab {}
     105    private method ComputeTransferFunc { tf }
     106    private method EventuallyResize { w h }
     107    private method EventuallyResizeLegend { }
     108    private method FlowCmd { dataobj comp nbytes extents }
     109    private method GetMovie { widget width height }
     110    private method NameTransferFunc { dataobj comp }
    116111    private method PanCamera {}
    117     private method GetMovie { widget width height }
     112    private method ParseLevelsOption { tf levels }
     113    private method ParseMarkersOption { tf markers }
    118114    private method WaitIcon { option widget }
    119115
    120     private variable outbuf_       ;# buffer for outgoing commands
    121 
    122     private variable dlist_ ""     ;# list of data objects
    123     private variable all_data_objs_
    124     private variable id2style_     ;# maps id => style settings
    125     private variable obj2ovride_   ;# maps dataobj => style override
    126     private variable obj2id_       ;# maps dataobj => volume ID in server
    127     private variable id2obj_       ;# maps dataobj => volume ID in server
    128     private variable sendobjs_ ""  ;# list of data objs to send to server
    129     private variable receiveIds_   ;# list of data objs to send to server
    130     private variable obj2styles_   ;# maps id => style settings
    131     private variable style2ids_    ;# maps id => style settings
    132 
    133     private variable click_        ;# info used for Rotate operations
    134     private variable limits_       ;# autoscale min/max for all axes
    135     private variable view_         ;# view params for 3D view
    136     private variable isomarkers_    ;# array of isosurface level values 0..1
    137     private common   settings_
    138     private variable activeTf_ ""  ;# The currently active transfer function.
    139     private variable flow_
     116    private method GetFlowInfo { widget }
     117    private method particles { tag name }
     118    private method box { tag name }
     119    private method streams { tag name }
     120
     121    private variable _outbuf       ;# buffer for outgoing commands
     122
     123    private variable _dlist ""     ;# list of data objects
     124    private variable _allDataObjs
     125    private variable _obj2ovride   ;# maps dataobj => style override
     126    private variable _obj2id       ;# maps dataobj-component to volume ID
     127                                    # in the server
     128    private variable _id2obj       ;# maps dataobj => volume ID in server
     129    private variable _sendobjs ""  ;# list of data objs to send to server
     130    private variable _receiveIds   ;# list of data objs to send to server
     131    private variable _obj2style    ;# maps dataobj-component to transfunc
     132    private variable _style2objs   ;# maps tf back to list of
     133                                    # dataobj-components using the tf.
     134    private variable _obj2flow;         # Maps dataobj-component to a flow.
     135
     136    private variable _click        ;# info used for rotate operations
     137    private variable _limits       ;# autoscale min/max for all axes
     138    private variable _view         ;# view params for 3D view
     139    private variable _isomarkers    ;# array of isosurface level values 0..1
     140    private common   _settings
     141    private variable _activeTf ""  ;# The currently active transfer function.
     142    private variable _first ""     ;# This is the topmost volume.
     143    private variable _buffering 0
     144    private variable _flow
    140145    # This
    141146    # indicates which isomarkers and transfer
    142147    # function to use when changing markers,
    143148    # opacity, or thickness.
    144     common downloadPopup_          ;# download options from popup
    145 
    146     private common hardcopy_
     149    common _downloadPopup          ;# download options from popup
     150
     151    private common _hardcopy
     152    private variable _width 0
     153    private variable _height 0
    147154}
    148155
     
    160167    $_dispatcher register !legend
    161168    $_dispatcher dispatch $this !legend "[itcl::code $this FixLegend]; list"
     169
    162170    # Send dataobjs event
    163171    $_dispatcher register !send_dataobjs
    164172    $_dispatcher dispatch $this !send_dataobjs \
    165173        "[itcl::code $this SendDataObjs]; list"
    166     # Send transfer functions event
     174
     175    # Send transferfunctions event
    167176    $_dispatcher register !send_transfunc
    168177    $_dispatcher dispatch $this !send_transfunc \
    169178        "[itcl::code $this SendTransferFuncs]; list"
    170     # Rebuild event
     179
     180    # Rebuild event.
    171181    $_dispatcher register !rebuild
    172182    $_dispatcher dispatch $this !rebuild "[itcl::code $this Rebuild]; list"
    173183
    174     # Draw resize event
     184    # Resize event.
    175185    $_dispatcher register !resize
    176186    $_dispatcher dispatch $this !resize "[itcl::code $this DoResize]; list"
     
    179189    $_dispatcher dispatch $this !play "[itcl::code $this flow next]; list"
    180190   
    181     set outbuf_ ""
    182     set flow_(state) "stopped"
    183     array set downloadPopup_ {
     191    set _flow(frame) 0
     192    set _flow(state) 0
     193
     194    set _outbuf ""
     195
     196    array set _downloadPopup {
    184197        format draft
    185     }
    186     array set play_ {
    187198    }
    188199    #
     
    194205
    195206    # Initialize the view to some default parameters.
    196     array set view_ {
     207    array set _view {
    197208        theta   45
    198209        phi     45
     
    202213        pan-y   0
    203214    }
    204     set obj2id_(count) 0
    205     set id2obj_(count) 0
    206     set limits_(vmin) 0.0
    207     set limits_(vmax) 1.0
    208     set settings_($this-theta) $view_(theta)
    209     set settings_($this-phi)   $view_(phi)
    210     set settings_($this-psi)   $view_(psi)
    211     set settings_($this-pan-x) $view_(pan-x)
    212     set settings_($this-pan-y) $view_(pan-y)
    213     set settings_($this-zoom)  $view_(zoom)
    214     set settings_($this-speed) 10
     215    set _obj2id(count) 0
     216    set _id2obj(count) 0
     217    set _limits(vmin) 0.0
     218    set _limits(vmax) 1.0
     219
     220    array set _settings [subst {
     221        $this-loop              0
     222        $this-pan-x             $_view(pan-x)
     223        $this-pan-y             $_view(pan-y)
     224        $this-phi               $_view(phi)
     225        $this-play              0
     226        $this-psi               $_view(psi)
     227        $this-speed             500
     228        $this-theta             $_view(theta)
     229        $this-volume            1
     230        $this-xcutplane         0
     231        $this-xcutposition      0
     232        $this-ycutplane         0
     233        $this-ycutposition      0
     234        $this-zcutplane         0
     235        $this-zcutposition      0
     236        $this-zoom              $_view(zoom)
     237    }]
    215238
    216239    set f [$itk_component(main) component controls]
     
    251274    Rappture::Tooltip::for $itk_component(zoomout) "Zoom out"
    252275
    253     #
    254     # Volume toggle...
    255     #
    256276    itk_component add volume {
    257         label $f.volume -borderwidth 1 -relief sunken -padx 1 -pady 1 \
    258             -text "Volume" \
    259             -image [Rappture::icon playback-record]
    260     }
    261     bind $itk_component(volume) <ButtonPress> \
    262         [itcl::code $this Slice volume toggle]
     277        Rappture::PushButton $f.volume \
     278            -onimage [Rappture::icon volume-on] \
     279            -offimage [Rappture::icon volume-off] \
     280            -command [itcl::code $this FixSettings volume] \
     281            -variable [itcl::scope _settings($this-volume)]
     282    }
     283    $itk_component(volume) select
    263284    Rappture::Tooltip::for $itk_component(volume) \
    264285        "Toggle the volume cloud on/off"
     
    281302    }
    282303    bind $itk_component(legend) <Configure> \
    283         [list $_dispatcher event -idle !legend]
     304        [itcl::code $this EventuallyResizeLegend]
    284305
    285306    # Hack around the Tk panewindow.  The problem is that the requested
    286307    # size of the 3d view isn't set until an image is retrieved from
    287308    # the server.  So the panewindow uses the tiny size.
    288     set w [expr [winfo reqwidth $itk_component(hull)] - 80]
     309    set w 10000
     310    pack forget $itk_component(3dview)
    289311    blt::table $itk_component(plotarea) \
    290312        0,0 $itk_component(3dview) -fill both -reqwidth $w \
    291         1,0 $itk_component(legend) -fill both
    292        
     313        1,0 $itk_component(legend) -fill x
     314    blt::table configure $itk_component(plotarea) r1 -resize none   
    293315    # Create flow controls...
    294316
    295     itk_component add flowctrl {
    296         frame $itk_interior.flowctrl
     317    itk_component add flowcontrol {
     318        frame $itk_interior.flowcontrol
    297319    } {
    298320        usual
    299321        rename -background -controlbackground controlBackground Background
    300322    }
    301     pack $itk_component(flowctrl) -side top -padx 4 -pady 0 -fill x
     323    pack forget $itk_component(main)
     324    blt::table $itk_interior \
     325        0,0 $itk_component(main) -fill both  \
     326        1,0 $itk_component(flowcontrol) -fill x
     327    blt::table configure $itk_interior r1 -resize none
    302328
    303329    # flow record button...
    304330    itk_component add rewind {
    305         button $itk_component(flowctrl).reset \
     331        button $itk_component(flowcontrol).reset \
    306332            -borderwidth 1 -padx 1 -pady 1 \
    307333            -image [Rappture::icon flow-rewind] \
    308             -command [itcl::code $this flow rewind]
     334            -command [itcl::code $this flow reset]
    309335    } {
    310336        usual
     
    313339    }
    314340    Rappture::Tooltip::for $itk_component(rewind) \
    315         "Rewind the flow sequence to the beginning"
    316     pack $itk_component(rewind) -padx 1 -side left
     341        "Rewind flow"
    317342
    318343    # flow stop button...
    319344    itk_component add stop {
    320         button $itk_component(flowctrl).stop \
     345        button $itk_component(flowcontrol).stop \
    321346            -borderwidth 1 -padx 1 -pady 1 \
    322347            -image [Rappture::icon flow-stop] \
     
    328353    }
    329354    Rappture::Tooltip::for $itk_component(stop) \
    330         "Stop flow visualization"
    331     pack $itk_component(stop) -padx 1 -side left
     355        "Stop flow"
    332356
    333357    #
     
    335359    #
    336360    itk_component add play {
    337         button $itk_component(flowctrl).play \
    338             -borderwidth 1 -padx 1 -pady 1 \
    339             -image [Rappture::icon flow-play] \
    340             -command [itcl::code $this flow toggle]
     361        Rappture::PushButton $itk_component(flowcontrol).play \
     362            -onimage [Rappture::icon flow-pause] \
     363            -offimage [Rappture::icon flow-play] \
     364            -variable [itcl::scope _settings($this-play)] \
     365            -command [itcl::code $this flow toggle]
     366    }
     367    set fg [option get $itk_component(hull) font Font]
     368    Rappture::Tooltip::for $itk_component(play) \
     369        "Play/Pause flow"
     370
     371    itk_component add loop {
     372        Rappture::PushButton $itk_component(flowcontrol).loop \
     373            -onimage [Rappture::icon loop] \
     374            -offimage [Rappture::icon loop] \
     375            -variable [itcl::scope _settings($this-loop)]
     376    }
     377    Rappture::Tooltip::for $itk_component(loop) \
     378        "Play continuously"
     379
     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
    341385    } {
    342386        usual
    343         ignore -borderwidth
    344         rename -highlightbackground -controlbackground controlBackground Background
    345     }
    346     set fg [option get $itk_component(hull) font Font]
    347 
    348     Rappture::Tooltip::for $itk_component(play) \
    349         "Play/Pause flow visualization"
    350     pack $itk_component(play) -padx 1 -side left
    351 
    352     # how do we know when to make something an itk component?
    353 
    354     ::scale $itk_component(flowctrl).value -from 100 -to 1 \
    355         -showvalue 0 -orient horizontal -width 12 -length 150 \
    356         -variable [itcl::scope settings_(speed)]
    357     pack $itk_component(flowctrl).value -side right
    358 
    359     itk_component add speedlabel {
    360         label $itk_component(flowctrl).speedl -text "Flow Rate:" -font $fg
     387        ignore -highlightthickness
     388        rename -background -controlbackground controlBackground Background
     389    }
     390    $itk_component(numframes) value 100
     391
     392    itk_component add numframeslabel {
     393        label $itk_component(flowcontrol).framel -text "# Steps:" -font $fg \
     394            -highlightthickness 0
    361395    } {
    362396        usual
     397        ignore -highlightthickness
    363398        rename -background -controlbackground controlBackground Background
    364399    }
    365     pack $itk_component(speedlabel)  -side right
    366 
    367     Rappture::Spinint $itk_component(flowctrl).framecnt
    368     $itk_component(flowctrl).framecnt value 100
    369     pack $itk_component(flowctrl).framecnt  -side right
    370     label $itk_component(flowctrl).framecntlabel -text "# Frames" -font $fg
    371     pack $itk_component(flowctrl).framecntlabel  -side right
    372 
    373 
     400
     401    itk_component add speedlabel {
     402        label $itk_component(flowcontrol).speedl -text "Speed:" -font $fg \
     403            -highlightthickness 0
     404    } {
     405        usual
     406        ignore -highlightthickness
     407        rename -background -controlbackground controlBackground Background
     408    }
     409
     410    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
     415    } {
     416        usual
     417        ignore -highlightthickness
     418        rename -background -controlbackground controlBackground Background
     419    }
     420    $itk_component(speed) set 500
     421
     422    blt::table $itk_component(flowcontrol) \
     423        0,0 $itk_component(rewind) -padx {3 0} \
     424        0,1 $itk_component(stop) -padx {2 0} \
     425        0,2 $itk_component(play) -padx {2 0} \
     426        0,3 $itk_component(loop) -padx {2 0} \
     427        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
    374434    # Bindings for rotation via mouse
    375435    bind $itk_component(3dview) <ButtonPress-1> \
     
    380440        [itcl::code $this Rotate release %x %y]
    381441    bind $itk_component(3dview) <Configure> \
    382         [itcl::code $this SendCmd "screen %w %h"]
     442        [itcl::code $this EventuallyResize %w %h]
    383443
    384444    # Bindings for panning via mouse
     
    433493# ----------------------------------------------------------------------
    434494itcl::body Rappture::FlowvisViewer::destructor {} {
    435     set sendobjs_ ""  ;# stop any send in progress
     495    set _sendobjs ""  ;# stop any send in progress
    436496    $_dispatcher cancel !rebuild
    437497    $_dispatcher cancel !send_dataobjs
     
    440500    image delete $_image(legend)
    441501    image delete $_image(download)
    442     array unset settings_ $this-*
     502    array unset _settings $this-*
    443503}
    444504
     
    470530        set params(-color) black
    471531    }
    472 
    473     set pos [lsearch -exact $dataobj $dlist_]
     532    foreach comp [$dataobj components] {
     533        set flowobj [$dataobj flowhints $comp]
     534        if { $flowobj == "" } {
     535            puts stderr "no flowhints $dataobj-$comp"
     536            continue
     537        }
     538        set _obj2flow($dataobj-$comp) $flowobj
     539    }
     540    set pos [lsearch -exact $dataobj $_dlist]
    474541    if {$pos < 0} {
    475         lappend dlist_ $dataobj
    476         set all_data_objs_($dataobj) 1
    477         set obj2ovride_($dataobj-color) $params(-color)
    478         set obj2ovride_($dataobj-width) $params(-width)
    479         set obj2ovride_($dataobj-raise) $params(-raise)
     542        lappend _dlist $dataobj
     543        set _allDataObjs($dataobj) 1
     544        set _obj2ovride($dataobj-color) $params(-color)
     545        set _obj2ovride($dataobj-width) $params(-width)
     546        set _obj2ovride($dataobj-raise) $params(-raise)
    480547        $_dispatcher event -idle !rebuild
    481548    }
     
    499566      -objects {
    500567        # put the dataobj list in order according to -raise options
    501         set dlist $dlist_
     568        set dlist $_dlist
    502569        foreach obj $dlist {
    503             if {[info exists obj2ovride_($obj-raise)] && $obj2ovride_($obj-raise)} {
     570            if {[info exists _obj2ovride($obj-raise)] && $_obj2ovride($obj-raise)} {
    504571                set i [lsearch -exact $dlist $obj]
    505572                if {$i >= 0} {
     
    543610itcl::body Rappture::FlowvisViewer::delete {args} {
    544611    if {[llength $args] == 0} {
    545         set args $dlist_
    546     }
     612        set args $_dlist
     613    }
     614
    547615    # Delete all specified dataobjs
    548616    set changed 0
    549617    foreach dataobj $args {
    550         set pos [lsearch -exact $dlist_ $dataobj]
     618        set pos [lsearch -exact $_dlist $dataobj]
    551619        if { $pos >= 0 } {
    552             set dlist_ [lreplace $dlist_ $pos $pos]
    553             foreach key [array names obj2ovride_ $dataobj-*] {
    554                 unset obj2ovride_($key)
    555             }
     620            foreach comp [$dataobj components] {
     621                if { [info exists obj2id($dataobj-$comp)] } {
     622                    set ivol $_obj2id($dataobj-$comp)
     623                    array unset _limits $ivol-*
     624                }
     625            }
     626            set _dlist [lreplace $_dlist $pos $pos]
     627            array unset _obj2ovride $dataobj-*
     628            array unset _obj2flow $dataobj-*
     629            array unset _obj2id $dataobj-*
     630            array unset _obj2style $dataobj-*
    556631            set changed 1
    557632        }
     
    559634    # If anything changed, then rebuild the plot
    560635    if {$changed} {
     636        # Repair the reverse lookup
     637        foreach tf [array names _style2objs] {
     638            set list {}
     639            foreach {dataobj comp} $_style2objs($tf) break
     640            if { [info exists _obj2id($dataobj-$comp)] } {
     641                lappend list $dataobj $comp
     642            }
     643            if { $list == "" } {
     644                array unset _style2objs $tf
     645            } else {
     646                set _style2objs($tf) $list
     647            }
     648        }
    561649        $_dispatcher event -idle !rebuild
    562650    }
     
    574662itcl::body Rappture::FlowvisViewer::scale {args} {
    575663    foreach val {xmin xmax ymin ymax zmin zmax vmin vmax} {
    576         set limits_($val) ""
     664        set _limits($val) ""
    577665    }
    578666    foreach obj $args {
     
    582670
    583671            if {"" != $min && "" != $max} {
    584                 if {"" == $limits_(${axis}min)} {
    585                     set limits_(${axis}min) $min
    586                     set limits_(${axis}max) $max
     672                if {"" == $_limits(${axis}min)} {
     673                    set _limits(${axis}min) $min
     674                    set _limits(${axis}max) $max
    587675                } else {
    588                     if {$min < $limits_(${axis}min)} {
    589                         set limits_(${axis}min) $min
     676                    if {$min < $_limits(${axis}min)} {
     677                        set _limits(${axis}min) $min
    590678                    }
    591                     if {$max > $limits_(${axis}max)} {
    592                         set limits_(${axis}max) $max
     679                    if {$max > $_limits(${axis}max)} {
     680                        set _limits(${axis}max) $max
    593681                    }
    594682                }
     
    611699    switch $option {
    612700        coming {
    613             if {[catch {blt::winop snap $itk_component(plotarea) \
    614                             $_image(download)}]} {
     701            if {[catch {
     702                blt::winop snap $itk_component(plotarea) $_image(download)
     703            }]} {
    615704                $_image(download) configure -width 1 -height 1
    616705                $_image(download) put #000000
     
    644733                    -value $res
    645734                pack $inner.high -anchor w
    646 
     735                button $inner.go -text [Rappture::filexfer::label download] \
     736                    -command [lindex $args 0]
     737                pack $inner.go -pady 4
     738                $inner.draft select
    647739            } else {
    648740                set inner [$popup component inner]
     
    699791        set w [winfo width $itk_component(3dview)]
    700792        set h [winfo height $itk_component(3dview)]
    701         SendCmd "screen $w $h"
     793        EventuallyResize $w $h
    702794    }
    703795    return $result
     
    723815
    724816    # disconnected -- no more data sitting on server
    725     set outbuf_ ""
    726     catch {unset obj2id_}
    727     array unset id2obj_
    728     set obj2id_(count) 0
    729     set id2obj_(count) 0
    730     set sendobjs_ ""
    731 }
    732 
    733 itcl::body Rappture::FlowvisViewer::_send {string} {
    734     SendCmd $string
    735 }
     817    set _outbuf ""
     818    catch {unset _obj2id}
     819    array unset _id2obj
     820    set _obj2id(count) 0
     821    set _id2obj(count) 0
     822    set _sendobjs ""
     823}
     824
    736825#
    737826# SendCmd
     
    742831#
    743832itcl::body Rappture::FlowvisViewer::SendCmd { string } {
    744     if {[llength $sendobjs_] > 0} {
    745         append outbuf_ $string "\n"
     833    if { $_buffering } {
     834        append _outbuf $string "\n"
    746835    } else {
    747         foreach line [split $string \n] {
    748             SendEcho >>line $line
    749         }
    750         SendBytes $string
     836        foreach line [split $string \n] {
     837            SendEcho >>line $line
     838        }
     839        SendBytes "$string\n"
    751840    }
    752841}
     
    760849# ----------------------------------------------------------------------
    761850itcl::body Rappture::FlowvisViewer::SendDataObjs {} {
     851    puts stderr "in SendDataObjs"
     852
    762853    blt::busy hold $itk_component(hull); update idletasks
    763     foreach dataobj $sendobjs_ {
     854    foreach dataobj $_sendobjs {
    764855        foreach comp [$dataobj components] {
    765856            # Send the data as one huge base64-encoded mess -- yuck!
     
    767858            set nbytes [string length $data]
    768859            set extents [$dataobj extents $comp]
    769 
    770860            # I have a field. Is a vector field or a volume field?
    771861            if { $extents == 1 } {
    772                 set cmd "volume data follows $nbytes"
     862                set cmd "volume data follows $nbytes $dataobj-$comp\n"
    773863            } else {
    774                 set cmd "flow data follows $nbytes $extents"
     864                set cmd [FlowCmd $dataobj $comp $nbytes $extents]
     865                if { $cmd == "" } {
     866                    puts stderr "no command"
     867                    continue
     868                }
    775869            }
    776870            if { ![SendBytes $cmd] } {
     871                    puts stderr "can't send"
    777872                return
    778873            }
    779874            if { ![SendBytes $data] } {
     875                    puts stderr "can't send"
    780876                return
    781877            }
    782             set ivol $obj2id_(count)
    783             incr obj2id_(count)
    784 
    785             set id2obj_($ivol) [list $dataobj $comp]
    786             set obj2id_($dataobj-$comp) $ivol
    787             NameTransferFunc $ivol
    788             set receiveIds_($ivol) 1
    789         }
    790     }
    791     set sendobjs_ ""
     878            set ivol $_obj2id(count)
     879            incr _obj2id(count)
     880
     881            NameTransferFunc $dataobj $comp
     882            set _receiveIds($ivol) 1
     883        }
     884    }
     885    set _sendobjs ""
    792886    blt::busy release $itk_component(hull)
    793887
     888    # Turn on buffering of commands to the server.  We don't want to
     889    # be preempted by a server disconnect/reconnect (which automatically
     890    # generates a new call to Rebuild).   
     891    set _buffering 1
     892
    794893    # activate the proper volume
    795     set first [lindex [get] 0]
    796     if { "" != $first } {
    797         set axis [$first hints updir]
     894    set _first [lindex [get] 0]
     895    if { "" != $_first } {
     896        set axis [$_first hints updir]
    798897        if {"" != $axis} {
    799898            SendCmd "up $axis"
     
    802901        # the first data object.  This assumes that the data is always
    803902        # successfully transferred.
    804         set comp [lindex [$first components] 0]
    805         set activeTf_ $id2style_($obj2id_($first-$comp))
    806     }
    807     foreach key [array names obj2id_ *-*] {
    808         set state [string match $first-* $key]
    809         set ivol $obj2id_($key)
    810         SendCmd "volume state $state $ivol"
    811     }
    812 
     903        set comp [lindex [$_first components] 0]
     904        set _activeTf [lindex $_obj2style($_first-$comp) 0]
     905    }
     906
     907    if 0 {
     908    SendCmd "volume state 0"
     909    set vols {}
     910    foreach key [array names _obj2id $_first-*] {
     911        lappend vols $_obj2id($key)
     912    }
     913    if { $vols != ""  && $_settings($this-volume) } {
     914        SendCmd "volume state 1 $vols"
     915    }
    813916    # sync the state of slicers
    814917    set vols [CurrentVolumeIds -cutplanes]
    815918    foreach axis {x y z} {
    816         SendCmd "cutplane state [State ${axis}CutButton] $axis $vols"
    817         set pos [expr {0.01*[$itk_component(${axis}CutScale) get]}]
    818         SendCmd "cutplane position $pos $axis $vols"
    819     }
    820     SendCmd "volume data state [State volume] $vols"
    821 
    822     if 0 {
     919        SendCmd "cutplane state $_settings($this-${axis}cutplane) $axis $vols"
     920        set pos [expr {0.01*$_settings($this-${axis}cutposition)}]
     921        SendCmd "cutplane position $pos $axis $vols"
     922    }
     923
    823924    # Add this when we fix grid for volumes
    824925    SendCmd "volume axis label x \"\""
     
    829930    SendCmd "grid axisname z Z eV"
    830931    }
    831     # if there are any commands in the buffer, send them now that we're done
    832     SendBytes $outbuf_
    833     set outbuf_ ""
     932
     933    # Actually write the commands to the server socket.  If it fails, we don't
     934    # care.  We're finished here.
     935    SendBytes $_outbuf;                 
     936    set _buffering 0;                   # Turn off buffering.
     937    set _outbuf "";                     # Clear the buffer.             
    834938}
    835939
     
    838942# ----------------------------------------------------------------------
    839943itcl::body Rappture::FlowvisViewer::SendTransferFuncs {} {
    840     if { $activeTf_ == "" } {
    841         return
    842     }
    843     set tf $activeTf_
    844     set first [lindex [get] 0]
     944    if { $_activeTf == "" } {
     945        return
     946    }
     947    set tf $_activeTf
     948    if { $_first == "" } {
     949        return
     950    }
    845951
    846952    # Insure that the global opacity and thickness settings (in the slider
    847953    # settings widgets) are used for the active transfer-function.  Update the
    848     # values in the settings_ varible.
    849     set inner $itk_component(settingsFrame)
    850     set value [$inner.opacity get]
     954    # values in the _settings varible.
     955    set value $_settings($this-opacity)
    851956    set opacity [expr { double($value) * 0.01 }]
    852     set settings_($this-$tf-opacity) $opacity
    853     set value [$inner.thickness get]
     957    set _settings($this-$tf-opacity) $opacity
     958    set value $_settings($this-thickness)
    854959    # Scale values between 0.00001 and 0.01000
    855960    set thickness [expr {double($value) * 0.0001}]
    856     set settings_($this-$tf-thickness) $thickness
    857 
    858     if { ![info exists $obj2styles_($first)] } {
    859         foreach tf $obj2styles_($first) {
    860             ComputeTransferFunc $tf
    861         }
    862         FixLegend
    863     }
    864 }
    865 
    866 # ----------------------------------------------------------------------
    867 # USAGE: ReceiveImage -bytes <size>
     961    set _settings($this-$tf-thickness) $thickness
     962
     963    foreach key [array names _obj2style $_first-*] {
     964        if { [info exists _obj2style($key)] } {
     965            foreach tf $_obj2style($key) {
     966                ComputeTransferFunc $tf
     967            }
     968        }
     969    }
     970    FixLegend
     971}
     972
     973# ----------------------------------------------------------------------
     974# USAGE: ReceiveImage -bytes $size -type $type -token $token
    868975#
    869976# Invoked automatically whenever the "image" command comes in from
     
    871978# specified <size> will follow.
    872979# ----------------------------------------------------------------------
    873 set counter 0
    874980itcl::body Rappture::FlowvisViewer::ReceiveImage { args } {
    875981    if {![isconnected]} {
     
    877983    }
    878984    array set info {
     985        -token "???"
     986        -bytes 0
    879987        -type image
    880988    }
     
    885993        ReceiveEcho "for [image width $_image(plot)]x[image height $_image(plot)] image>"       
    886994        $_image(plot) configure -data $bytes
     995    } elseif { $info(type) == "print" } {
     996        set tag $this-print-$info(-token)
     997        set _hardcopy($tag) $bytes
    887998    } elseif { $info(type) == "movie" } {
    888999        set tag $this-movie-$info(-token)
    889         set hardcopy_($tag) $bytes
     1000        set _hardcopy($tag) $bytes
    8901001    }
    8911002}
     
    9151026    set w [winfo width $c]
    9161027    set h [winfo height $c]
    917     #foreach { dataobj comp } $id2obj_($ivol) break
     1028    #foreach { dataobj comp } $_id2obj($ivol) break
    9181029    set lx 10
    9191030    set ly [expr {$h - 1}]
     
    9301041    }
    9311042    # Display the markers used by the active transfer function.
    932     #set tf $activeTf_
     1043    #set tf $_activeTf
    9331044
    9341045    array set limits [limits $tf]
     
    9391050    $c coords vmax [expr {$w-$lx}] $ly
    9401051
    941     if { [info exists isomarkers_($tf)] } {
    942         foreach m $isomarkers_($tf) {
    943             $m visible on
     1052    if { [info exists _isomarkers($tf)] } {
     1053        foreach m $_isomarkers($tf) {
     1054            $m visible yes
    9441055        }
    9451056    }
     
    9511062#       The procedure is the response from the render server to each "data
    9521063#       follows" command.  The server sends back a "data" command invoked our
    953 #       the # slave interpreter.  The purpose is to collect the min/max of the
    954 #       volume sent # to the render server.  Since the client (flowvisviewer)
    955 #       doesn't parse 3D # data formats, we rely on the server (flowvis) to
    956 #       tell us what the limits # are.  Once we've received the limits to all
    957 #       the data we've sent (tracked by # receiveIds_) we can then determine
     1064#       the slave interpreter.  The purpose is to collect the min/max of the
     1065#       volume sent to the render server.  Since the client (flowvisviewer)
     1066#       doesn't parse 3D data formats, we rely on the server (flowvis) to
     1067#       tell us what the limits are.  Once we've received the limits to all
     1068#       the data we've sent (tracked by _receiveIds) we can then determine
    9581069#       what the transfer functions are for these # volumes.
    9591070#
     
    9741085
    9751086    set ivol $info(id);         # Id of volume created by server.
    976 
    977     set limits_($ivol-min) $info(min);  # Minimum value of the volume.
    978     set limits_($ivol-max) $info(max);  # Maximum value of the volume.
    979     set limits_(vmin)      $info(vmin); # Overall minimum value.
    980     set limits_(vmax)      $info(vmax); # Overall maximum value.
    981 
    982     unset receiveIds_($ivol)
    983     if { [array size receiveIds_] == 0 } {
     1087    set tag $info(tag)
     1088    set parts [split $tag -]
     1089
     1090    #
     1091    # Volumes don't exist until we're told about them.
     1092    #
     1093    set _id2obj($ivol) $parts
     1094    set dataobj [lindex $parts 0]
     1095    set _obj2id($tag) $ivol
     1096    # It's a lie. There's no volume yet.
     1097    if { $_settings($this-volume) && $dataobj == $_first } {
     1098        SendCmd "volume state 1"
     1099    }
     1100    set _limits($ivol-min) $info(min);  # Minimum value of the volume.
     1101    set _limits($ivol-max) $info(max);  # Maximum value of the volume.
     1102    set _limits(vmin)      $info(vmin); # Overall minimum value.
     1103    set _limits(vmax)      $info(vmax); # Overall maximum value.
     1104
     1105    unset _receiveIds($ivol)
     1106    if { [array size _receiveIds] == 0 } {
    9841107        updatetransferfuncs
    9851108    }
     
    9941117#
    9951118itcl::body Rappture::FlowvisViewer::Rebuild {} {
    996 
     1119    puts stderr "in Rebuild"
    9971120    # Hide all the isomarkers. Can't remove them. Have to remember the
    9981121    # settings since the user may have created/deleted/moved markers.
    9991122
    1000     foreach tf [array names isomarkers_] {
    1001         foreach m $isomarkers_($tf) {
    1002             $m visible off
     1123    foreach tf [array names _isomarkers] {
     1124        foreach m $_isomarkers($tf) {
     1125            $m visible no
    10031126        }
    10041127    }
    10051128
    10061129    # in the midst of sending data? then bail out
    1007     if {[llength $sendobjs_] > 0} {
     1130    if {[llength $_sendobjs] > 0} {
    10081131        return
    10091132    }
    10101133
     1134    # Turn on buffering of commands to the server.  We don't want to
     1135    # be preempted by a server disconnect/reconnect (which automatically
     1136    # generates a new call to Rebuild).   
     1137    set _buffering 1
     1138
    10111139    # Find any new data that needs to be sent to the server.  Queue this up on
    1012     # the sendobjs_ list, and send it out a little at a time.  Do this first,
     1140    # the _sendobjs list, and send it out a little at a time.  Do this first,
    10131141    # before we rebuild the rest.
    10141142    foreach dataobj [get] {
    10151143        set comp [lindex [$dataobj components] 0]
    1016         if {![info exists obj2id_($dataobj-$comp)]} {
    1017             set i [lsearch -exact $sendobjs_ $dataobj]
    1018             if {$i < 0} {
    1019                 lappend sendobjs_ $dataobj
     1144        if {![info exists _obj2id($dataobj-$comp)]} {
     1145            if { [lsearch -exact $_sendobjs $dataobj] < 0 } {
     1146                lappend _sendobjs $dataobj
    10201147            }
    10211148        }
     
    10231150    set w [winfo width $itk_component(3dview)]
    10241151    set h [winfo height $itk_component(3dview)]
    1025     SendCmd "screen $w $h"
     1152    EventuallyResize $w $h
    10261153
    10271154    #
    10281155    # Reset the camera and other view parameters
    10291156    #
    1030     set xyz [Euler2XYZ $view_(theta) $view_(phi) $view_(psi)]
     1157    set xyz [Euler2XYZ $_view(theta) $_view(phi) $_view(psi)]
    10311158    SendCmd "camera angle $xyz"
    10321159    PanCamera
    1033     SendCmd "camera zoom $view_(zoom)"
    1034 
    1035     set settings_($this-theta) $view_(theta)
    1036     set settings_($this-phi)   $view_(phi)
    1037     set settings_($this-psi)   $view_(psi)
    1038     set settings_($this-pan-x) $view_(pan-x)
    1039     set settings_($this-pan-y) $view_(pan-y)
    1040     set settings_($this-zoom)  $view_(zoom)
     1160    SendCmd "camera zoom $_view(zoom)"
     1161
     1162    set _settings($this-theta) $_view(theta)
     1163    set _settings($this-phi)   $_view(phi)
     1164    set _settings($this-psi)   $_view(psi)
     1165    set _settings($this-pan-x) $_view(pan-x)
     1166    set _settings($this-pan-y) $_view(pan-y)
     1167    set _settings($this-zoom)  $_view(zoom)
    10411168
    10421169    FixSettings light
     
    10471174    FixSettings outline
    10481175
    1049     if {[llength $sendobjs_] > 0} {
     1176    if {[llength $_sendobjs] > 0} {
    10501177        # send off new data objects
    10511178        $_dispatcher event -idle !send_dataobjs
     
    10541181
    10551182    # nothing to send -- activate the proper ivol
    1056     set first [lindex [get] 0]
    1057     if {"" != $first} {
    1058         set axis [$first hints updir]
     1183    set _first [lindex [get] 0]
     1184    if {"" != $_first} {
     1185        set axis [$_first hints updir]
    10591186        if {"" != $axis} {
    10601187            SendCmd "up $axis"
    10611188        }
    1062         foreach key [array names obj2id_ *-*] {
    1063             set state [string match $first-* $key]
    1064             SendCmd "volume state $state $obj2id_($key)"
    1065         }
     1189        if { 0 && $_settings($this-volume) }  {
     1190            SendCmd "volume state 0"
     1191            foreach key [array names _obj2id $_first-*] {
     1192                lappend vols $_obj2id($key)
     1193            }
     1194            SendCmd "volume state 1 $vols"
     1195        }
    10661196        #
    1067         # The obj2id_ and id2style_ arrays may or may not have the right
     1197        # The _obj2id and _id2style arrays may or may not have the right
    10681198        # information.  It's possible for the server to know about volumes
    10691199        # that the client has assumed it's deleted.  We could add checks.
    10701200        # But this problem needs to be fixed not bandaided.
    1071         set comp [lindex [$first components] 0]
    1072         set ivol $obj2id_($first-$comp)
    1073 
    1074         foreach comp [$first components] {
    1075             foreach ivol $obj2id_($first-$comp) {
    1076             NameTransferFunc $ivol
    1077             }
     1201        set comp [lindex [$_first components] 0]
     1202        set ivol $_obj2id($_first-$comp)
     1203
     1204    }
     1205    foreach dataobj [get] {
     1206        foreach comp [$_first components] {
     1207            NameTransferFunc $dataobj $comp
    10781208        }
    10791209    }
     
    10821212    set vols [CurrentVolumeIds -cutplanes]
    10831213    foreach axis {x y z} {
    1084         SendCmd "cutplane state [State ${axis}CutButton] $axis $vols"
    1085         set pos [expr {0.01*[$itk_component(${axis}CutScale) get]}]
    1086         SendCmd "cutplane position $pos $axis $vols"
    1087     }
    1088     SendCmd "volume data state [State volume] $vols"
     1214        SendCmd "cutplane state $_settings($this-${axis}cutplane) $axis $vols"
     1215        set pos [expr {0.01*$_settings($this-${axis}cutposition)}]
     1216        SendCmd "cutplane position $pos $axis $vols"
     1217    }
     1218    SendCmd "volume data state $_settings($this-volume)"
    10891219    $_dispatcher event -idle !legend
     1220
     1221    # Actually write the commands to the server socket.  If it fails, we don't
     1222    # care.  We're finished here.
     1223    SendBytes $_outbuf;                 
     1224    set _buffering 0;                   # Turn off buffering.
     1225    set _outbuf "";                     # Clear the buffer.             
     1226    puts stderr "exit Rebuild"
    10901227}
    10911228
     
    10991236itcl::body Rappture::FlowvisViewer::CurrentVolumeIds {{what -all}} {
    11001237    set rlist ""
    1101 
    1102     set first [lindex [get] 0]
    1103     foreach key [array names obj2id_ *-*] {
    1104         if {[string match $first-* $key]} {
     1238    if { $_first == "" } {
     1239        return
     1240    }
     1241    foreach key [array names _obj2id *-*] {
     1242        if {[string match $_first-* $key]} {
    11051243            array set style {
    11061244                -cutplanes 1
     
    11101248
    11111249            if {$what != "-cutplanes" || $style(-cutplanes)} {
    1112                 lappend rlist $obj2id_($key)
     1250                lappend rlist $_obj2id($key)
    11131251            }
    11141252        }
     
    11281266    switch -- $option {
    11291267        "in" {
    1130             set view_(zoom) [expr {$view_(zoom)*1.25}]
    1131             set settings_($this-zoom) $view_(zoom)
     1268            set _view(zoom) [expr {$_view(zoom)*1.25}]
     1269            set _settings($this-zoom) $_view(zoom)
    11321270        }
    11331271        "out" {
    1134             set view_(zoom) [expr {$view_(zoom)*0.8}]
    1135             set settings_($this-zoom) $view_(zoom)
     1272            set _view(zoom) [expr {$_view(zoom)*0.8}]
     1273            set _settings($this-zoom) $_view(zoom)
    11361274        }
    11371275        "reset" {
    1138             array set view_ {
     1276            array set _view {
    11391277                theta   45
    11401278                phi     45
     
    11441282                pan-y   0
    11451283            }
    1146             set first [lindex [get] 0]
    1147             if { $first != "" } {
    1148                 set location [$first hints camera]
     1284            if { $_first != "" } {
     1285                set location [$_first hints camera]
    11491286                if { $location != "" } {
    1150                     array set view_ $location
     1287                    array set _view $location
    11511288                }
    11521289            }
    1153             set xyz [Euler2XYZ $view_(theta) $view_(phi) $view_(psi)]
     1290            set xyz [Euler2XYZ $_view(theta) $_view(phi) $_view(psi)]
    11541291            SendCmd "camera angle $xyz"
    11551292            PanCamera
    1156             set settings_($this-theta) $view_(theta)
    1157             set settings_($this-phi)   $view_(phi)
    1158             set settings_($this-psi)   $view_(psi)
    1159             set settings_($this-pan-x) $view_(pan-x)
    1160             set settings_($this-pan-y) $view_(pan-y)
    1161             set settings_($this-zoom)  $view_(zoom)
    1162         }
    1163     }
    1164     SendCmd "camera zoom $view_(zoom)"
     1293            set _settings($this-theta) $_view(theta)
     1294            set _settings($this-phi)   $_view(phi)
     1295            set _settings($this-psi)   $_view(psi)
     1296            set _settings($this-pan-x) $_view(pan-x)
     1297            set _settings($this-pan-y) $_view(pan-y)
     1298            set _settings($this-zoom)  $_view(zoom)
     1299        }
     1300    }
     1301    SendCmd "camera zoom $_view(zoom)"
    11651302}
    11661303
    11671304itcl::body Rappture::FlowvisViewer::PanCamera {} {
    1168     #set x [expr ($view_(pan-x)) / $limits_(xrange)]
    1169     #set y [expr ($view_(pan-y)) / $limits_(yrange)]
    1170     set x $view_(pan-x)
    1171     set y $view_(pan-y)
     1305    #set x [expr ($_view(pan-x)) / $_limits(xrange)]
     1306    #set y [expr ($_view(pan-y)) / $_limits(yrange)]
     1307    set x $_view(pan-x)
     1308    set y $_view(pan-y)
    11721309    SendCmd "camera pan $x $y"
    11731310}
     
    11851322        click {
    11861323            $itk_component(3dview) configure -cursor fleur
    1187             set click_(x) $x
    1188             set click_(y) $y
    1189             set click_(theta) $view_(theta)
    1190             set click_(phi) $view_(phi)
     1324            set _click(x) $x
     1325            set _click(y) $y
     1326            set _click(theta) $_view(theta)
     1327            set _click(phi) $_view(phi)
    11911328        }
    11921329        drag {
    1193             if {[array size click_] == 0} {
     1330            if {[array size _click] == 0} {
    11941331                Rotate click $x $y
    11951332            } else {
     
    12021339                if {[catch {
    12031340                    # this fails sometimes for no apparent reason
    1204                     set dx [expr {double($x-$click_(x))/$w}]
    1205                     set dy [expr {double($y-$click_(y))/$h}]
     1341                    set dx [expr {double($x-$_click(x))/$w}]
     1342                    set dy [expr {double($y-$_click(y))/$h}]
    12061343                }]} {
    12071344                    return
     
    12111348                # Rotate the camera in 3D
    12121349                #
    1213                 if {$view_(psi) > 90 || $view_(psi) < -90} {
     1350                if {$_view(psi) > 90 || $_view(psi) < -90} {
    12141351                    # when psi is flipped around, theta moves backwards
    12151352                    set dy [expr {-$dy}]
    12161353                }
    1217                 set theta [expr {$view_(theta) - $dy*180}]
     1354                set theta [expr {$_view(theta) - $dy*180}]
    12181355                while {$theta < 0} { set theta [expr {$theta+180}] }
    12191356                while {$theta > 180} { set theta [expr {$theta-180}] }
    12201357
    12211358                if {abs($theta) >= 30 && abs($theta) <= 160} {
    1222                     set phi [expr {$view_(phi) - $dx*360}]
     1359                    set phi [expr {$_view(phi) - $dx*360}]
    12231360                    while {$phi < 0} { set phi [expr {$phi+360}] }
    12241361                    while {$phi > 360} { set phi [expr {$phi-360}] }
    1225                     set psi $view_(psi)
     1362                    set psi $_view(psi)
    12261363                } else {
    1227                     set phi $view_(phi)
    1228                     set psi [expr {$view_(psi) - $dx*360}]
     1364                    set phi $_view(phi)
     1365                    set psi [expr {$_view(psi) - $dx*360}]
    12291366                    while {$psi < -180} { set psi [expr {$psi+360}] }
    12301367                    while {$psi > 180} { set psi [expr {$psi-360}] }
    12311368                }
    12321369
    1233                 set view_(theta)        $theta
    1234                 set view_(phi)          $phi
    1235                 set view_(psi)          $psi
     1370                set _view(theta)        $theta
     1371                set _view(phi)          $phi
     1372                set _view(psi)          $psi
    12361373                set xyz [Euler2XYZ $theta $phi $psi]
    1237                 set settings_($this-theta) $view_(theta)
    1238                 set settings_($this-phi)   $view_(phi)
    1239                 set settings_($this-psi)   $view_(psi)
     1374                set _settings($this-theta) $_view(theta)
     1375                set _settings($this-phi)   $_view(phi)
     1376                set _settings($this-psi)   $_view(psi)
    12401377                SendCmd "camera angle $xyz"
    1241                 set click_(x) $x
    1242                 set click_(y) $y
     1378                set _click(x) $x
     1379                set _click(y) $y
    12431380            }
    12441381        }
     
    12461383            Rotate drag $x $y
    12471384            $itk_component(3dview) configure -cursor ""
    1248             catch {unset click_}
     1385            catch {unset _click}
    12491386        }
    12501387        default {
     
    12691406        set x [expr $x / double($w)]
    12701407        set y [expr $y / double($h)]
    1271         set view_(pan-x) [expr $view_(pan-x) + $x]
    1272         set view_(pan-y) [expr $view_(pan-y) + $y]
     1408        set _view(pan-x) [expr $_view(pan-x) + $x]
     1409        set _view(pan-y) [expr $_view(pan-y) + $y]
    12731410        PanCamera
    1274         set settings_($this-pan-x) $view_(pan-x)
    1275         set settings_($this-pan-y) $view_(pan-y)
     1411        set _settings($this-pan-x) $_view(pan-x)
     1412        set _settings($this-pan-y) $_view(pan-y)
    12761413        return
    12771414    }
    12781415    if { $option == "click" } {
    1279         set click_(x) $x
    1280         set click_(y) $y
     1416        set _click(x) $x
     1417        set _click(y) $y
    12811418        $itk_component(3dview) configure -cursor hand1
    12821419    }
    12831420    if { $option == "drag" || $option == "release" } {
    1284         set dx [expr ($click_(x) - $x)/double($w)]
    1285         set dy [expr ($click_(y) - $y)/double($h)]
    1286         set click_(x) $x
    1287         set click_(y) $y
    1288         set view_(pan-x) [expr $view_(pan-x) - $dx]
    1289         set view_(pan-y) [expr $view_(pan-y) - $dy]
     1421        set dx [expr ($_click(x) - $x)/double($w)]
     1422        set dy [expr ($_click(y) - $y)/double($h)]
     1423        set _click(x) $x
     1424        set _click(y) $y
     1425        set _view(pan-x) [expr $_view(pan-x) - $dx]
     1426        set _view(pan-y) [expr $_view(pan-y) - $dy]
    12901427        PanCamera
    1291         set settings_($this-pan-x) $view_(pan-x)
    1292         set settings_($this-pan-y) $view_(pan-y)
     1428        set _settings($this-pan-x) $_view(pan-x)
     1429        set _settings($this-pan-y) $_view(pan-y)
    12931430    }
    12941431    if { $option == "release" } {
     
    12971434}
    12981435
    1299 # ----------------------------------------------------------------------
    1300 # USAGE: Slice axis x|y|z ?on|off|toggle?
    1301 # USAGE: Slice move x|y|z <newval>
    1302 # USAGE: Slice volume ?on|off|toggle?
    1303 #
    1304 # Called automatically when the user drags the slider to move the
    1305 # cut plane that slices 3D data.  Gets the current value from the
    1306 # slider and moves the cut plane to the appropriate point in the
    1307 # data set.
    1308 # ----------------------------------------------------------------------
    1309 itcl::body Rappture::FlowvisViewer::Slice {option args} {
    1310     switch -- $option {
    1311         axis {
    1312             if {[llength $args] < 1 || [llength $args] > 2} {
    1313                 error "wrong # args: should be \"Slice axis x|y|z ?on|off|toggle?\""
    1314             }
    1315             set axis [lindex $args 0]
    1316             set op [lindex $args 1]
    1317             if {$op == ""} {
    1318                 set op "on"
    1319             }
    1320             set current [State ${axis}CutButton]
    1321             if {$op == "toggle"} {
    1322                 if {$current == "on"} {
    1323                     set op "off"
    1324                 } else {
    1325                     set op "on"
    1326                 }
    1327             }
    1328             if {$op} {
    1329                 $itk_component(${axis}CutButton) configure \
    1330                     -relief sunken -image [Rappture::icon ${axis}-cutplane-on]
    1331                 SendCmd "cutplane state 1 $axis [CurrentVolumeIds -cutplanes]"
    1332                 $itk_component(${axis}CutScale) configure -state normal \
    1333                     -troughcolor grey65
    1334             } else {
    1335                 $itk_component(${axis}CutButton) configure \
    1336                     -relief raised -image [Rappture::icon ${axis}-cutplane-off]
    1337                 SendCmd "cutplane state 0 $axis [CurrentVolumeIds -cutplanes]"
    1338                 $itk_component(${axis}CutScale) configure -state disabled \
    1339                     -troughcolor grey82
    1340             }
    1341         }
    1342         move {
    1343             if {[llength $args] != 2} {
    1344                 error "wrong # args: should be \"Slice move x|y|z newval\""
    1345             }
    1346             set axis [lindex $args 0]
    1347             set newval [lindex $args 1]
    1348 
    1349             set newpos [expr {0.01*$newval}]
    1350 #            set newval [expr {0.01*($newval-50)
    1351 #                *($limits_(${axis}max)-$limits_(${axis}min))
    1352 #                  + 0.5*($limits_(${axis}max)+$limits_(${axis}min))}]
    1353 
    1354             # show the current value in the readout
    1355             #puts "readout: $axis = $newval"
    1356 
    1357             set ids [CurrentVolumeIds -cutplanes]
    1358             SendCmd "cutplane position $newpos $axis $ids"
    1359         }
    1360         volume {
    1361             if {[llength $args] > 1} {
    1362                 error "wrong # args: should be \"Slice volume ?on|off|toggle?\""
    1363             }
    1364             set op [lindex $args 0]
    1365             if {$op == ""} { set op "on" }
    1366 
    1367             set current $settings_($this-volume)
    1368             if {$op == "toggle"} {
    1369                 if {$current} {
    1370                     set op "off"
    1371                 } else {
    1372                     set op "on"
    1373                 }
    1374             }
    1375            
    1376             if {$op} {
    1377                 SendCmd "volume data state on [CurrentVolumeIds]"
    1378                 $itk_component(volume) configure -relief sunken
    1379                 set settings_($this-volume) 1
    1380             } else {
    1381                 SendCmd "volume data state off [CurrentVolumeIds]"
    1382                 $itk_component(volume) configure -relief raised
    1383                 set settings_($this-volume) 0
    1384             }
    1385         }
    1386         default {
    1387             error "bad option \"$option\": should be axis, move, or volume"
    1388         }
    1389     }
    1390 }
    1391 
    1392 # ----------------------------------------------------------------------
    1393 # USAGE: SlicerTip <axis>
    1394 #
    1395 # Used internally to generate a tooltip for the x/y/z slicer controls.
    1396 # Returns a message that includes the current slicer value.
    1397 # ----------------------------------------------------------------------
    1398 itcl::body Rappture::FlowvisViewer::SlicerTip {axis} {
    1399     set val [$itk_component(${axis}CutScale) get]
    1400 #    set val [expr {0.01*($val-50)
    1401 #        *($limits_(${axis}max)-$limits_(${axis}min))
    1402 #          + 0.5*($limits_(${axis}max)+$limits_(${axis}min))}]
    1403     return "Move the [string toupper $axis] cut plane.\nCurrently:  $axis = $val%"
    1404 }
    14051436
    14061437# ----------------------------------------------------------------------
     
    14371468                        set inner $itk_component(settingsFrame)
    14381469                        set frames [$inner.framecnt value]
    1439                         set settings_(numframes) $frames
     1470                        set _settings(numframes) $frames
    14401471                        set cmds "flow capture $frames"
    1441                         _send $cmds
     1472                        SendCmd $cmds
    14421473                    }
    14431474                }
     
    14491480                        _pause
    14501481                        set cmds "flow reset"
    1451                         _send $cmds
     1482                        SendCmd $cmds
    14521483                    }
    14531484                }
     
    14821513itcl::body Rappture::FlowvisViewer::Play {} {
    14831514    SendCmd "flow next"
    1484     set delay [expr {int(ceil(pow($settings_(speed)/10.0+2,2.0)*15))}]
     1515    set delay [expr {int(ceil(pow($_settings(speed)/10.0+2,2.0)*15))}]
    14851516    $_dispatcher event -after $delay !play
    14861517}
     
    15041535
    15051536# ----------------------------------------------------------------------
    1506 # USAGE: State <component>
    1507 #
    1508 # Used internally to determine the state of a toggle button.
    1509 # The <component> is the itk component name of the button.
    1510 # Returns on/off for the state of the button.
    1511 # ----------------------------------------------------------------------
    1512 itcl::body Rappture::FlowvisViewer::State {comp} {
    1513     if {[$itk_component(${comp}) cget -relief] == "sunken"} {
    1514         return "on"
    1515     }
    1516     return "off"
    1517 }
    1518 
    1519 # ----------------------------------------------------------------------
    15201537# USAGE: FixSettings <what> ?<value>?
    15211538#
     
    15281545        light {
    15291546            if {[isconnected]} {
    1530                 set val $settings_($this-light)
     1547                set val $_settings($this-light)
    15311548                set sval [expr {0.1*$val}]
    15321549                SendCmd "volume shading diffuse $sval"
     
    15371554        transp {
    15381555            if {[isconnected]} {
    1539                 set val $settings_($this-transp)
     1556                set val $_settings($this-transp)
    15401557                set sval [expr {0.2*$val+1}]
    15411558                SendCmd "volume shading opacity $sval"
     
    15431560        }
    15441561        opacity {
    1545             if {[isconnected] && $activeTf_ != "" } {
    1546                 set val $settings_($this-opacity)
     1562            if {[isconnected] && $_activeTf != "" } {
     1563                set val $_settings($this-opacity)
    15471564                set sval [expr { 0.01 * double($val) }]
    1548                 set tf $activeTf_
    1549                 set settings_($this-$tf-opacity) $sval
     1565                set tf $_activeTf
     1566                set _settings($this-$tf-opacity) $sval
    15501567                updatetransferfuncs
    15511568            }
     
    15531570
    15541571        thickness {
    1555             if {[isconnected] && $activeTf_ != "" } {
    1556                 set val $settings_($this-thickness)
     1572            if {[isconnected] && $_activeTf != "" } {
     1573                set val $_settings($this-thickness)
    15571574                # Scale values between 0.00001 and 0.01000
    15581575                set sval [expr {0.0001*double($val)}]
    1559                 set tf $activeTf_
    1560                 set settings_($this-$tf-thickness) $sval
     1576                set tf $_activeTf
     1577                set _settings($this-$tf-thickness) $sval
    15611578                updatetransferfuncs
    15621579            }
     
    15641581        "outline" {
    15651582            if {[isconnected]} {
    1566                 SendCmd "volume outline state $settings_($this-outline)"
     1583                SendCmd "volume outline state $_settings($this-outline)"
    15671584            }
    15681585        }
    15691586        "isosurface" {
    15701587            if {[isconnected]} {
    1571                 SendCmd "volume shading isosurface $settings_($this-isosurface)"
     1588                SendCmd "volume shading isosurface $_settings($this-isosurface)"
    15721589            }
    15731590        }
    15741591        "grid" {
    15751592            if { [isconnected] } {
    1576                 SendCmd "grid visible $settings_($this-grid)"
     1593                SendCmd "grid visible $_settings($this-grid)"
    15771594            }
    15781595        }
    15791596        "axes" {
    15801597            if { [isconnected] } {
    1581                 SendCmd "axis visible $settings_($this-axes)"
     1598                SendCmd "axis visible $_settings($this-axes)"
    15821599            }
    15831600        }
    15841601        "legend" {
    1585             if { $settings_($this-legend) } {
     1602            if { $_settings($this-legend) } {
    15861603                blt::table $itk_component(plotarea) \
    1587                     1,0 $itk_component(legend) -fill x
     1604                    0,0 $itk_component(3dview) -fill both \
     1605                    1,0 $itk_component(legend) -fill x
     1606                blt::table configure $itk_component(plotarea) r1 -resize none
    15881607            } else {
    15891608                blt::table forget $itk_component(legend)
     
    15911610        }
    15921611        "volume" {
    1593             Slice volume $settings_($this-volume)
    1594         }
    1595         "particles" {
     1612            if { [isconnected] } {
     1613                set vols [CurrentVolumeIds -cutplanes]
     1614                SendCmd "volume data state $_settings($this-volume) $vols"
     1615            }
     1616        }
     1617        "xcutplane" - "ycutplane" - "zcutplane" {
     1618            set axis [string range $what 0 1]
     1619            set bool $_settings($this-$what)
     1620            if { [isconnected] } {
     1621                set vols [CurrentVolumeIds -cutplanes]
     1622                SendCmd "cutplane state $bool $axis $vols"
     1623            }
     1624            if { $bool } {
     1625                $itk_component(${axis}CutScale) configure -state normal \
     1626                    -troughcolor white
     1627            } else {
     1628                $itk_component(${axis}CutScale) configure -state disabled \
     1629                    -troughcolor grey82
     1630            }
    15961631        }
    15971632        default {
     
    16101645itcl::body Rappture::FlowvisViewer::FixLegend {} {
    16111646    set lineht [font metrics $itk_option(-font) -linespace]
    1612     set w [expr {[winfo width $itk_component(legend)]-20}]
     1647    set w [expr {$_width-20}]
    16131648    set h [expr {[winfo height $itk_component(legend)]-20-$lineht}]
    1614     if {$w > 0 && $h > 0 && "" != $activeTf_} {
    1615         SendCmd "legend $activeTf_ $w $h"
     1649    if {$w > 0 && $h > 0 && "" != $_activeTf} {
     1650        SendCmd "legend $_activeTf $w $h"
    16161651    } else {
    16171652    # Can't do this as this will remove the items associated with the
     
    16371672#              now.
    16381673#
    1639 itcl::body Rappture::FlowvisViewer::NameTransferFunc { ivol } {
     1674itcl::body Rappture::FlowvisViewer::NameTransferFunc { dataobj comp } {
    16401675    array set style {
    16411676        -color rainbow
     
    16431678        -opacity 1.0
    16441679    }
    1645     foreach {dataobj comp} $id2obj_($ivol) break
    16461680    array set style [lindex [$dataobj components -style $comp] 0]
    16471681    set tf "$style(-color):$style(-levels):$style(-opacity)"
    1648 
    1649     set id2style_($ivol) $tf
    1650     lappend obj2styles_($dataobj) $tf
    1651     lappend style2ids_($tf) $ivol
     1682    lappend _obj2style($dataobj-$comp) $tf
     1683    puts stderr "creating tf=$tf $dataobj-$comp"
     1684    parray _obj2style
     1685    lappend _style2objs($tf) $dataobj $comp
     1686    return $tf
    16521687}
    16531688
     
    16681703    }
    16691704    set dataobj ""; set comp ""
    1670     foreach ivol $style2ids_($tf) {
    1671         if { [info exists id2obj_($ivol)] } {
    1672             foreach {dataobj comp} $id2obj_($ivol) break
    1673             break
    1674         }
    1675     }
     1705    foreach {dataobj comp} $_style2objs($tf) break
    16761706    if { $dataobj == "" } {
    16771707        return 0
     
    16931723    #        barn on this one.
    16941724
    1695     if { ![info exists isomarkers_($tf)] } {
     1725    if { ![info exists _isomarkers($tf)] } {
    16961726        # Have to defer creation of isomarkers until we have data limits
    16971727        if { [info exists style(-markers)] } {
    1698             ParseMarkersOption $tf $ivol $style(-markers)
     1728            ParseMarkersOption $tf $style(-markers)
    16991729        } else {
    1700             ParseLevelsOption $tf $ivol $style(-levels)
     1730            ParseLevelsOption $tf $style(-levels)
    17011731        }
    17021732    }
     
    17141744
    17151745    set tag $this-$tf
    1716     if { ![info exists settings_($tag-opacity)] } {
    1717         set settings_($tag-opacity) $style(-opacity)
    1718     }
    1719     set max $settings_($tag-opacity)
     1746    if { ![info exists _settings($tag-opacity)] } {
     1747        set _settings($tag-opacity) $style(-opacity)
     1748    }
     1749    set max $_settings($tag-opacity)
    17201750
    17211751    set isovalues {}
    1722     foreach m $isomarkers_($tf) {
     1752    foreach m $_isomarkers($tf) {
    17231753        lappend isovalues [$m relval]
    17241754    }
     
    17261756    set isovalues [lsort -real $isovalues]
    17271757
    1728     if { ![info exists settings_($tag-thickness)]} {
    1729         set settings_($tag-thickness) 0.05
    1730     }
    1731     set delta $settings_($tag-thickness)
     1758    if { ![info exists _settings($tag-thickness)]} {
     1759        set _settings($tag-thickness) 0.05
     1760    }
     1761    set delta $_settings($tag-thickness)
    17321762
    17331763    set first [lindex $isovalues 0]
     
    17721802    }
    17731803    SendBytes "transfunc define $tf { $cmap } { $wmap }\n"
    1774     return [SendBytes "volume shading transfunc $tf $style2ids_($tf)\n"]
     1804    return [SendBytes "$dataobj-$comp configure -transferfunction $tf\n"]
    17751805}
    17761806
     
    18201850# marker is a relative value from 0.0 to 1.0.
    18211851#
    1822 itcl::body Rappture::FlowvisViewer::ParseLevelsOption { tf ivol levels } {
     1852itcl::body Rappture::FlowvisViewer::ParseLevelsOption { tf levels } {
    18231853    set c $itk_component(legend)
    18241854    regsub -all "," $levels " " levels
     
    18261856        for {set i 1} { $i <= $levels } {incr i} {
    18271857            set x [expr {double($i)/($levels+1)}]
    1828             set m [IsoMarker \#auto $c $this $tf]
     1858            set m [Rappture::IsoMarker \#auto $c $this $tf]
    18291859            $m relval $x
    1830             lappend isomarkers_($tf) $m
     1860            lappend _isomarkers($tf) $m
    18311861        }
    18321862    } else {
    18331863        foreach x $levels {
    1834             set m [IsoMarker \#auto $c $this $tf]
     1864            set m [Rappture::IsoMarker \#auto $c $this $tf]
    18351865            $m relval $x
    1836             lappend isomarkers_($tf) $m
     1866            lappend _isomarkers($tf) $m
    18371867        }
    18381868    }
     
    18511881#       not be seen.
    18521882#
    1853 itcl::body Rappture::FlowvisViewer::ParseMarkersOption { tf ivol markers } {
     1883itcl::body Rappture::FlowvisViewer::ParseMarkersOption { tf markers } {
    18541884    set c $itk_component(legend)
    18551885    regsub -all "," $markers " " markers
     
    18591889            # ${n}% : Set relative value.
    18601890            set value [expr {$value * 0.01}]
    1861             set m [IsoMarker \#auto $c $this $tf]
     1891            set m [Rappture::IsoMarker \#auto $c $this $tf]
    18621892            $m relval $value
    1863             lappend isomarkers_($tf) $m
     1893            lappend _isomarkers($tf) $m
    18641894        } else {
    18651895            # ${n} : Set absolute value.
    1866             set m [IsoMarker \#auto $c $this $tf]
     1896            set m [Rappture::IsoMarker \#auto $c $this $tf]
    18671897            $m absval $value
    1868             lappend isomarkers_($tf) $m
     1898            lappend _isomarkers($tf) $m
    18691899        }
    18701900    }
     
    18791909
    18801910itcl::body Rappture::FlowvisViewer::AddIsoMarker { x y } {
    1881     if { $activeTf_ == "" } {
     1911    if { $_activeTf == "" } {
    18821912        error "active transfer function isn't set"
    18831913    }
    1884     set tf $activeTf_
     1914    set tf $_activeTf
    18851915    set c $itk_component(legend)
    1886     set m [IsoMarker \#auto $c $this $tf]
     1916    set m [Rappture::IsoMarker \#auto $c $this $tf]
    18871917    set w [winfo width $c]
    18881918    $m relval [expr {double($x-10)/($w-20)}]
    1889     lappend isomarkers_($tf) $m
     1919    lappend _isomarkers($tf) $m
    18901920    updatetransferfuncs
    18911921    return 1
     
    18951925    set tf [$marker transferfunc]
    18961926    set bool 0
    1897     if { [info exists isomarkers_($tf)] } {
     1927    if { [info exists _isomarkers($tf)] } {
    18981928        set list {}
    18991929        set marker [namespace tail $marker]
    1900         foreach m $isomarkers_($tf) {
     1930        foreach m $_isomarkers($tf) {
    19011931            set sx [$m screenpos]
    19021932            if { $m != $marker } {
     
    19111941            lappend list $m
    19121942        }
    1913         set isomarkers_($tf) $list
     1943        set _isomarkers($tf) $list
    19141944        updatetransferfuncs
    19151945    }
     
    19191949itcl::body Rappture::FlowvisViewer::overmarker { marker x } {
    19201950    set tf [$marker transferfunc]
    1921     if { [info exists isomarkers_($tf)] } {
     1951    if { [info exists _isomarkers($tf)] } {
    19221952        set marker [namespace tail $marker]
    1923         foreach m $isomarkers_($tf) {
     1953        foreach m $_isomarkers($tf) {
    19241954            set sx [$m screenpos]
    19251955            if { $m != $marker } {
     
    19331963
    19341964itcl::body Rappture::FlowvisViewer::limits { tf } {
    1935     set limits_(min) ""
    1936     set limits_(max) ""
    1937     foreach ivol $style2ids_($tf) {
    1938         if { ![info exists limits_($ivol-min)] } {
    1939             error "can't find $ivol limits"
    1940         }
    1941         if { $limits_(min) == "" || $limits_(min) > $limits_($ivol-min) } {
    1942             set limits_(min) $limits_($ivol-min)
    1943         }
    1944         if { $limits_(max) == "" || $limits_(max) < $limits_($ivol-max) } {
    1945             set limits_(max) $limits_($ivol-max)
    1946         }
    1947     }
    1948     return [array get limits_]
    1949 }
    1950 
    1951 
    1952 #
    1953 # flow --
    1954 #
    1955 # Called when the user clicks on the stop or play buttons
    1956 # for flow visualization.
    1957 #
    1958 #       $this flow start
    1959 #       $this flow stop
    1960 #       $this flow toggle
    1961 #       $this flow rewind
    1962 #       $this flow pause
    1963 #       $this flow next
    1964 #
    1965 itcl::body Rappture::FlowvisViewer::flow {option} {
    1966     switch -- $option {
    1967         "stop" {
    1968             if { $flow_(state) != "stopped" } {
    1969                 # Reset the play button to off
    1970                 $itk_component(play) configure -image [Rappture::icon flow-play]
    1971                 $_dispatcher cancel !play
    1972                 SendCmd "flow reset"
    1973                 set flow_(state) "stopped"
    1974             }
    1975         }
    1976         "pause" {
    1977             if { $flow_(state) == "playing" } {
    1978                 # Reset the play button to pause
    1979                 # Convert to the play button.
    1980                 $itk_component(play) configure -image [Rappture::icon flow-play]
    1981                 $_dispatcher cancel !play
    1982                 set flow_(state) "paused"
    1983             }
    1984         }
    1985         "start" {
    1986             if { $flow_(state) != "playing" } {
    1987                 # Starts the "flow next" requests to the server.
    1988                 # Convert to the pause button.
    1989                 $itk_component(play) configure \
    1990                     -image [Rappture::icon flow-pause]
    1991                 flow next
    1992                 set flow_(state) "playing"
    1993             }
    1994         }
    1995         "toggle" {
    1996             if { $flow_(state) == "playing" } {
    1997                 flow pause
    1998             } else {
    1999                 flow start
    2000             }
    2001         }
    2002         "rewind" {
    2003             if  { $flow_(state) != "stopped"  } {
    2004                 SendCmd "flow reset"
    2005             }
    2006         }
    2007         "next" {
    2008             # This operation should not be called by public routines.
    2009             SendCmd "flow next"
    2010             set delay [expr {int(ceil(pow($settings_(speed)/10.0+2,2.0)*15))}]
    2011             $_dispatcher event -after $delay !play
    2012         }
    2013         default {
    2014             error "bad option \"$option\": should be start, stop, toggle, or reset."
    2015         }
    2016     }
    2017 }
     1965    set _limits(min) 0.0
     1966    set _limits(max) 1.0
     1967    if { ![info exists _style2objs($tf)] } {
     1968        return [array get _limits]
     1969    }
     1970    set min ""; set max ""
     1971    foreach {dataobj comp} $_style2objs($tf) {
     1972        if { ![info exists _obj2id($dataobj-$comp)] } {
     1973            continue
     1974        }
     1975        set ivol $_obj2id($dataobj-$comp)
     1976        if { ![info exists _limits($ivol-min)] } {
     1977            continue
     1978        }
     1979        if { $min == "" || $min > $_limits($ivol-min) } {
     1980            set min $_limits($ivol-min)
     1981        }
     1982        if { $max == "" || $max < $_limits($ivol-max) } {
     1983            set max $_limits($ivol-max)
     1984        }
     1985    }
     1986    if { $min != "" } {
     1987        set _limits(min) $min
     1988    }
     1989    if { $max != "" } {
     1990        set _limits(max) $max
     1991    }
     1992    return [array get _limits]
     1993}
     1994
    20181995
    20191996
     
    20211998    foreach { key value } {
    20221999        grid            0
    2023         axes            1
     2000        axes            0
    20242001        outline         1
    20252002        volume          1
     
    20282005        lic             1
    20292006    } {
    2030         set settings_($this-$key) $value
     2007        set _settings($this-$key) $value
    20312008    }
    20322009
     
    20392016    $inner configure -borderwidth 4
    20402017
    2041     set ::Rappture::FlowvisViewer::settings_($this-isosurface) 0
     2018    set ::Rappture::FlowvisViewer::_settings($this-isosurface) 0
    20422019    checkbutton $inner.isosurface \
    20432020        -text "Isosurface shading" \
    2044         -variable [itcl::scope settings_($this-isosurface)] \
     2021        -variable [itcl::scope _settings($this-isosurface)] \
    20452022        -command [itcl::code $this FixSettings isosurface] \
    20462023        -font "Arial 9"
     
    20482025    checkbutton $inner.axes \
    20492026        -text "Axes" \
    2050         -variable [itcl::scope settings_($this-axes)] \
     2027        -variable [itcl::scope _settings($this-axes)] \
    20512028        -command [itcl::code $this FixSettings axes] \
    20522029        -font "Arial 9"
     
    20542031    checkbutton $inner.grid \
    20552032        -text "Grid" \
    2056         -variable [itcl::scope settings_($this-grid)] \
     2033        -variable [itcl::scope _settings($this-grid)] \
    20572034        -command [itcl::code $this FixSettings grid] \
    20582035        -font "Arial 9"
     
    20602037    checkbutton $inner.outline \
    20612038        -text "Outline" \
    2062         -variable [itcl::scope settings_($this-outline)] \
     2039        -variable [itcl::scope _settings($this-outline)] \
    20632040        -command [itcl::code $this FixSettings outline] \
    20642041        -font "Arial 9"
     
    20662043    checkbutton $inner.legend \
    20672044        -text "Legend" \
    2068         -variable [itcl::scope settings_($this-legend)] \
     2045        -variable [itcl::scope _settings($this-legend)] \
    20692046        -command [itcl::code $this FixSettings legend] \
    20702047        -font "Arial 9"
     
    20722049    checkbutton $inner.volume \
    20732050        -text "Volume" \
    2074         -variable [itcl::scope settings_($this-volume)] \
     2051        -variable [itcl::scope _settings($this-volume)] \
    20752052        -command [itcl::code $this FixSettings volume] \
    20762053        -font "Arial 9"
     
    20782055    checkbutton $inner.particles \
    20792056        -text "Particles" \
    2080         -variable [itcl::scope settings_($this-particles)] \
     2057        -variable [itcl::scope _settings($this-particles)] \
    20812058        -command [itcl::code $this FixSettings particles] \
    20822059        -font "Arial 9"
     
    20842061    checkbutton $inner.lic \
    20852062        -text "Lic" \
    2086         -variable [itcl::scope settings_($this-lic)] \
     2063        -variable [itcl::scope _settings($this-lic)] \
    20872064        -command [itcl::code $this FixSettings lic] \
    20882065        -font "Arial 9"
     2066
     2067    frame $inner.frame
    20892068
    20902069    blt::table $inner \
     
    20932072        2,0 $inner.outline  -columnspan 2 -anchor w \
    20942073        3,0 $inner.volume  -columnspan 2 -anchor w \
    2095         4,0 $inner.legend  -columnspan 2 -anchor w \
    2096         5,0 $inner.particles  -columnspan 2 -anchor w \
    2097         6,0 $inner.lic  -columnspan 1 -anchor w \
    2098 
    2099     for {set n 0} {$n <= 6} {incr n} {
    2100         blt::table configure $inner r$n -resize none
    2101     }
    2102     blt::table configure $inner r$n -resize expand
     2074        4,0 $inner.legend  -columnspan 2 -anchor w
     2075
     2076    bind $inner <Map> [itcl::code $this GetFlowInfo $inner]
     2077
     2078    blt::table configure $inner r* -resize none
     2079    blt::table configure $inner r5 -resize expand
    21032080}
    21042081
     
    21102087        thickness       350
    21112088    } {
    2112         set settings_($this-$key) $value
     2089        set _settings($this-$key) $value
    21132090    }
    21142091
    21152092    set inner [$itk_component(main) insert end \
    21162093        -title "Volume Settings" \
    2117         -icon [Rappture::icon playback-record]]
     2094        -icon [Rappture::icon volume-on]]
    21182095    $inner configure -borderwidth 4
    21192096
     
    21232100    label $inner.dim -text "Dim" -font $fg
    21242101    ::scale $inner.light -from 0 -to 100 -orient horizontal \
    2125         -variable [itcl::scope settings_($this-light)] \
     2102        -variable [itcl::scope _settings($this-light)] \
    21262103        -width 10 \
    21272104        -showvalue off -command [itcl::code $this FixSettings light]
     
    21302107    label $inner.fog -text "Fog" -font $fg
    21312108    ::scale $inner.transp -from 0 -to 100 -orient horizontal \
    2132         -variable [itcl::scope settings_($this-transp)] \
     2109        -variable [itcl::scope _settings($this-transp)] \
    21332110        -width 10 \
    21342111        -showvalue off -command [itcl::code $this FixSettings transp]
     
    21372114    label $inner.clear -text "Clear" -font $fg
    21382115    ::scale $inner.opacity -from 0 -to 100 -orient horizontal \
    2139         -variable [itcl::scope settings_($this-opacity)] \
     2116        -variable [itcl::scope _settings($this-opacity)] \
    21402117        -width 10 \
    21412118        -showvalue off -command [itcl::code $this FixSettings opacity]
     
    21442121    label $inner.thin -text "Thin" -font $fg
    21452122    ::scale $inner.thickness -from 0 -to 1000 -orient horizontal \
    2146         -variable [itcl::scope settings_($this-thickness)] \
     2123        -variable [itcl::scope _settings($this-thickness)] \
    21472124        -width 10 \
    21482125        -showvalue off -command [itcl::code $this FixSettings thickness]
     
    21632140        3,3 $inner.thick -anchor w -pady 2
    21642141
    2165     for {set n 0} {$n <= 3} {incr n} {
    2166         blt::table configure $inner r$n -resize none
    2167     }
    2168     blt::table configure $inner r$n -resize expand
     2142    blt::table configure $inner c0 c1 c3 r* -resize none
     2143    blt::table configure $inner r6 -resize expand
    21692144}
    21702145
     
    21772152    # X-value slicer...
    21782153    itk_component add xCutButton {
    2179         label $inner.xbutton \
    2180             -borderwidth 1 -relief raised -padx 1 -pady 1 \
    2181             -image [Rappture::icon x-cutplane-off] \
    2182             -highlightthickness 0
    2183     } {
    2184         usual
    2185         ignore -borderwidth -highlightthickness -font
    2186     }
    2187     bind $itk_component(xCutButton) <ButtonPress> \
    2188         [itcl::code $this Slice axis x toggle]
     2154        Rappture::PushButton $inner.xbutton \
     2155            -onimage [Rappture::icon x-cutplane-on] \
     2156            -offimage [Rappture::icon x-cutplane-off] \
     2157            -command [itcl::code $this FixSettings xcutplane] \
     2158            -variable [itcl::scope _settings($this-xcutplane)]
     2159    }
    21892160    Rappture::Tooltip::for $itk_component(xCutButton) \
    21902161        "Toggle the X cut plane on/off"
     
    21942165            -width 10 -orient vertical -showvalue off \
    21952166            -borderwidth 1 -highlightthickness 0 \
    2196             -command [itcl::code $this Slice move x]
     2167            -command [itcl::code $this Slice move x] \
     2168            -variable [itcl::scope _settings($this-xcutposition)]
    21972169    } {
    21982170        usual
     
    22072179    # Y-value slicer...
    22082180    itk_component add yCutButton {
    2209         label $inner.ybutton \
    2210             -borderwidth 1 -relief raised -padx 1 -pady 1 \
    2211             -image [Rappture::icon y-cutplane-off] \
    2212             -highlightthickness 0
    2213     } {
    2214         usual
    2215         ignore -borderwidth -highlightthickness -font
    2216     }
    2217     bind $itk_component(yCutButton) <ButtonPress> \
    2218         [itcl::code $this Slice axis y toggle]
     2181        Rappture::PushButton $inner.ybutton \
     2182            -onimage [Rappture::icon y-cutplane-on] \
     2183            -offimage [Rappture::icon y-cutplane-off] \
     2184            -command [itcl::code $this FixSettings ycutplane] \
     2185            -variable [itcl::scope _settings($this-ycutplane)]
     2186    }
    22192187    Rappture::Tooltip::for $itk_component(yCutButton) \
    22202188        "Toggle the Y cut plane on/off"
     
    22242192            -width 10 -orient vertical -showvalue off \
    22252193            -borderwidth 1 -highlightthickness 0 \
    2226             -command [itcl::code $this Slice move y]
     2194            -command [itcl::code $this Slice move y] \
     2195            -variable [itcl::scope _settings($this-ycutposition)]
    22272196    } {
    22282197        usual
     
    22372206    # Z-value slicer...
    22382207    itk_component add zCutButton {
    2239         label $inner.zbutton \
    2240             -borderwidth 1 -relief raised -padx 1 -pady 1 \
    2241             -image [Rappture::icon z-cutplane-off] \
    2242             -highlightthickness 0
    2243     } {
    2244         usual
    2245         ignore -borderwidth -highlightthickness -font
    2246     }
    2247     bind $itk_component(zCutButton) <ButtonPress> \
    2248         [itcl::code $this Slice axis z toggle]
     2208        Rappture::PushButton $inner.zbutton \
     2209            -onimage [Rappture::icon z-cutplane-on] \
     2210            -offimage [Rappture::icon z-cutplane-off] \
     2211            -command [itcl::code $this FixSettings zcutplane] \
     2212            -variable [itcl::scope _settings($this-zcutplane)]
     2213    }
    22492214    Rappture::Tooltip::for $itk_component(zCutButton) \
    22502215        "Toggle the Z cut plane on/off"
     
    22542219            -width 10 -orient vertical -showvalue off \
    22552220            -borderwidth 1 -highlightthickness 0 \
    2256             -command [itcl::code $this Slice move z]
     2221            -command [itcl::code $this Slice move z] \
     2222            -variable [itcl::scope _settings($this-zcutposition)]
    22572223    } {
    22582224        usual
     
    22902256        label $inner.${tag}label -text $tag -font "Arial 9"
    22912257        entry $inner.${tag} -font "Arial 9"  -bg white \
    2292             -textvariable [itcl::scope settings_($this-$tag)]
     2258            -textvariable [itcl::scope _settings($this-$tag)]
    22932259        bind $inner.${tag} <KeyPress-Return> \
    22942260            [itcl::code $this camera set ${tag}]
     
    23042270}
    23052271
     2272itcl::body Rappture::FlowvisViewer::GetFlowInfo { w } {
     2273    foreach key [array names _obj2flow] {
     2274        set flowobj $_obj2flow($key)
     2275        break
     2276    }
     2277    if { [winfo exists $w.frame] } {
     2278        destroy $w.frame
     2279    }
     2280    set inner [frame $w.frame]
     2281    blt::table $w \
     2282        5,0 $inner -fill both -columnspan 2 -anchor nw
     2283    array set hints [$flowobj hints]
     2284    checkbutton $inner.showstreams -text "Streams Plane" \
     2285        -variable [itcl::scope _settings($this-streams)] \
     2286        -command  [itcl::code $this streams $key $hints(name)]  \
     2287        -font "Arial 9"
     2288    label $inner.particles -text "Particles"    -font "Arial 9 bold"
     2289    label $inner.boxes -text "Boxes"    -font "Arial 9 bold"
     2290
     2291    blt::table $inner \
     2292        1,0 $inner.showstreams  -anchor w
     2293    blt::table configure $inner c0 -resize none
     2294    blt::table configure $inner c1 -resize expand
     2295
     2296    set row 2
     2297    set particles [$flowobj particles]
     2298    if { [llength $particles] > 0 } {
     2299        blt::table $inner $row,0 $inner.particles  -anchor w
     2300        incr row
     2301    }
     2302    foreach part $particles {
     2303        array unset info
     2304        array set info $part
     2305        set name $info(name)
     2306        if { ![info exists _settings($this-particles-$name)] } {
     2307            set _settings($this-particles-$name) $info(hide)
     2308        }
     2309        checkbutton $inner.part$row -text $name \
     2310            -variable [itcl::scope _settings($this-particles-$name)] \
     2311            -onvalue 0 -offvalue 1 \
     2312            -command [itcl::code $this particles $key $name] \
     2313            -font "Arial 9 italic"
     2314        blt::table $inner $row,0 $inner.part$row -anchor w
     2315        if { !$_settings($this-particles-$name) } {
     2316            $inner.part$row select
     2317        }
     2318        incr row
     2319    }
     2320    set boxes [$flowobj boxes]
     2321    if { [llength $boxes] > 0 } {
     2322        blt::table $inner $row,0 $inner.boxes  -anchor w
     2323        incr row
     2324    }
     2325    foreach box $boxes {
     2326        array unset info
     2327        array set info $box
     2328        set name $info(name)
     2329        if { ![info exists _settings($this-box-$name)] } {
     2330            set _settings($this-box-$name) $info(hide)
     2331        }
     2332        checkbutton $inner.box$row -text $info(name) \
     2333            -variable [itcl::scope _settings($this-box-$name)] \
     2334            -onvalue 0 -offvalue 1 \
     2335            -command [itcl::code $this box $key $name] \
     2336            -font "Arial 9 italic"
     2337        blt::table $inner $row,0 $inner.box$row -anchor w
     2338        if { !$_settings($this-box-$name) } {
     2339            $inner.box$row select
     2340        }
     2341        incr row
     2342    }
     2343    blt::table configure $inner r* -resize none
     2344    blt::table configure $inner r$row -resize expand
     2345    blt::table configure $inner c3 -resize expand
     2346    event generate [winfo parent [winfo parent $w]] <Configure>
     2347}
     2348
     2349itcl::body Rappture::FlowvisViewer::particles { tag name } {
     2350    set bool $_settings($this-particles-$name)
     2351    SendCmd "$tag particles configure $name -hide $bool"
     2352}
     2353
     2354itcl::body Rappture::FlowvisViewer::box { tag name } {
     2355    set bool $_settings($this-box-$name)
     2356    SendCmd "$tag box configure $name -hide $bool"
     2357}
     2358
     2359itcl::body Rappture::FlowvisViewer::streams { tag name } {
     2360    set bool $_settings($this-streams)
     2361    SendCmd "$tag configure -slice $bool"
     2362}
     2363
     2364# ----------------------------------------------------------------------
     2365# USAGE: Slice move x|y|z <newval>
     2366#
     2367# Called automatically when the user drags the slider to move the
     2368# cut plane that slices 3D data.  Gets the current value from the
     2369# slider and moves the cut plane to the appropriate point in the
     2370# data set.
     2371# ----------------------------------------------------------------------
     2372itcl::body Rappture::FlowvisViewer::Slice {option args} {
     2373    switch -- $option {
     2374        move {
     2375            if {[llength $args] != 2} {
     2376                error "wrong # args: should be \"Slice move x|y|z newval\""
     2377            }
     2378            set axis [lindex $args 0]
     2379            set newval [lindex $args 1]
     2380            set newpos [expr {0.01*$newval}]
     2381
     2382            # show the current value in the readout
     2383
     2384            set ids [CurrentVolumeIds -cutplanes]
     2385            SendCmd "cutplane position $newpos $axis $ids"
     2386        }
     2387        default {
     2388            error "bad option \"$option\": should be axis, move, or volume"
     2389        }
     2390    }
     2391}
     2392
     2393# ----------------------------------------------------------------------
     2394# USAGE: SlicerTip <axis>
     2395#
     2396# Used internally to generate a tooltip for the x/y/z slicer controls.
     2397# Returns a message that includes the current slicer value.
     2398# ----------------------------------------------------------------------
     2399itcl::body Rappture::FlowvisViewer::SlicerTip {axis} {
     2400    set val [$itk_component(${axis}CutScale) get]
     2401#    set val [expr {0.01*($val-50)
     2402#        *($_limits(${axis}max)-$_limits(${axis}min))
     2403#          + 0.5*($_limits(${axis}max)+$_limits(${axis}min))}]
     2404    return "Move the [string toupper $axis] cut plane.\nCurrently:  $axis = $val%"
     2405}
     2406
     2407
     2408itcl::body Rappture::FlowvisViewer::DoResize {} {
     2409    SendCmd "screen $_width $_height"
     2410}
     2411
     2412itcl::body Rappture::FlowvisViewer::EventuallyResize { w h } {
     2413    if { $_width != $w || $_height != $h } {
     2414        set _width $w
     2415        set _height $h
     2416        $_dispatcher event -idle !resize
     2417    }
     2418}
     2419
     2420itcl::body Rappture::FlowvisViewer::EventuallyResizeLegend {} {
     2421    $_dispatcher event -idle !legend
     2422}
     2423
    23062424#  camera --
    23072425itcl::body Rappture::FlowvisViewer::camera {option args} {
    23082426    switch -- $option {
    23092427        "show" {
    2310             puts [array get view_]
     2428            puts [array get _view]
    23112429        }
    23122430        "set" {
    23132431            set who [lindex $args 0]
    2314             set x $settings_($this-$who)
     2432            set x $_settings($this-$who)
    23152433            set code [catch { string is double $x } result]
    23162434            if { $code != 0 || !$result } {
    2317                 set settings_($this-$who) $view_($who)
     2435                set _settings($this-$who) $_view($who)
    23182436                return
    23192437            }
    23202438            switch -- $who {
    23212439                "pan-x" - "pan-y" {
    2322                     set view_($who) $settings_($this-$who)
     2440                    set _view($who) $_settings($this-$who)
    23232441                    PanCamera
    23242442                }
    23252443                "phi" - "theta" - "psi" {
    2326                     set view_($who) $settings_($this-$who)
    2327                     set xyz [Euler2XYZ $view_(theta) $view_(phi) $view_(psi)]
    2328                     _send "camera angle $xyz"
     2444                    set _view($who) $_settings($this-$who)
     2445                    set xyz [Euler2XYZ $_view(theta) $_view(phi) $_view(psi)]
     2446                    SendCmd "camera angle $xyz"
    23292447                }
    23302448                "zoom" {
    2331                     set view_($who) $settings_($this-$who)
    2332                     _send "camera zoom $view_(zoom)"
     2449                    set _view($who) $_settings($this-$who)
     2450                    SendCmd "camera zoom $_view(zoom)"
    23332451                }
    23342452            }
     2453        }
     2454    }
     2455}
     2456
     2457itcl::body Rappture::FlowvisViewer::FlowCmd { dataobj comp nbytes extents } {
     2458    set tag "$dataobj-$comp"
     2459    if { ![info exists _obj2flow($tag)] } {
     2460        puts stderr "no obj $tag"
     2461        return
     2462    }
     2463    set flowobj $_obj2flow($tag)
     2464    if { $flowobj == "" } {
     2465        puts stderr "no flowobj"
     2466        return ""
     2467    }
     2468    set cmd {}
     2469    append cmd "if {\[flow exists $tag\]} {flow delete $tag}\n"
     2470    array set info  [$flowobj hints]
     2471    append cmd "flow add $tag -position $info(position) -axis $info(axis) "
     2472    append cmd "-volume $info(volume) -outline $info(outline) "
     2473    append cmd "-slice $info(streams)\n"
     2474    foreach part [$flowobj particles] {
     2475        array unset info
     2476        array set info $part
     2477        set color [Color2RGB $info(color)]
     2478        append cmd "$tag particles add $info(name) -position $info(position) "
     2479        append cmd "-axis $info(axis) -color {$color}\n"
     2480    }
     2481    puts stderr "boxes=[$flowobj boxes]"
     2482    foreach box [$flowobj boxes] {
     2483        array unset info
     2484        set info(corner1) ""
     2485        set info(corner2) ""
     2486        array set info $box
     2487        if { $info(corner1) == "" || $info(corner2) == "" } {
     2488            continue
     2489        }
     2490        set color [Color2RGB $info(color)]
     2491        append cmd "$tag box add $info(name) -color {$color} "
     2492        append cmd "-hide $info(hide) "
     2493        append cmd "-corner1 {$info(corner1)} -corner2 {$info(corner2)}\n"
     2494    }   
     2495    append cmd "$tag data follows $nbytes $extents\n"
     2496    return $cmd
     2497}
     2498
     2499
     2500#
     2501# flow --
     2502#
     2503# Called when the user clicks on the stop or play buttons
     2504# for flow visualization.
     2505#
     2506#       $this flow play
     2507#       $this flow stop
     2508#       $this flow toggle
     2509#       $this flow reset
     2510#       $this flow pause
     2511#       $this flow next
     2512#
     2513itcl::body Rappture::FlowvisViewer::flow {option} {
     2514    switch -- $option {
     2515        "off" {
     2516            set _flow(state) 0
     2517            $_dispatcher cancel !play
     2518            $itk_component(play) deselect
     2519        }
     2520        "on" {
     2521            set _flow(state) 1
     2522            $itk_component(play) select
     2523        }
     2524        "stop" {
     2525            if { $_flow(state) } {
     2526                flow off
     2527                flow reset
     2528            }
     2529        }
     2530        "pause" {
     2531            if { $_flow(state) } {
     2532                flow off
     2533            }
     2534        }
     2535        "play" {
     2536            # If the flow is currently off, then restart it.
     2537            if { !$_flow(state) } {
     2538                flow on
     2539                # If we're at the end of the flow, reset the flow.
     2540                set count [$itk_component(numframes) value]
     2541                if { $_flow(frame) >= $count } {
     2542                    set _flow(frame) 1
     2543                    SendCmd "flow reset"
     2544                }
     2545                flow next
     2546            }
     2547        }
     2548        "toggle" {
     2549            if { $_settings($this-play) } {
     2550                flow play
     2551            } else {
     2552                flow pause
     2553            }
     2554        }
     2555        "reset" {
     2556            set _flow(frame) 0
     2557            SendCmd "flow reset"
     2558            if { !$_flow(state) } {
     2559                SendCmd "flow next"
     2560            }
     2561        }
     2562        "next" {
     2563            set count [$itk_component(numframes) value]
     2564            incr _flow(frame)
     2565            if { $_flow(frame) >= $count } {
     2566                if { !$_settings($this-loop) } {
     2567                    flow off
     2568                    return
     2569                }
     2570                flow reset
     2571            } else {
     2572                SendCmd "flow next"
     2573            }
     2574            set delay [expr {int(ceil(pow($_settings(speed)/10.0+2,2.0)*15))}]
     2575            set delay2 [expr round(log($_settings(speed)+0.00001)*100.0)]
     2576            $_dispatcher event -after $_settings(speed) !play
     2577        }
     2578        default {
     2579            error "bad option \"$option\": should be play, stop, toggle, or reset."
    23352580        }
    23362581    }
     
    23422587            $_dispatcher dispatch $this !waiticon \
    23432588                "[itcl::code $this WaitIcon "next" $widget] ; list"
    2344             set icon_ 0
    2345             $widget configure -image [Rappture::icon bigroller${icon_}]
     2589            set _icon 0
     2590            $widget configure -image [Rappture::icon bigroller${_icon}]
    23462591            $_dispatcher event -after 100 !waiticon
    23472592        }
    23482593        "next" {
    2349             incr icon_
    2350             if { $icon_ >= 8 } {
    2351                 set icon_ 0
     2594            incr _icon
     2595            if { $_icon >= 8 } {
     2596                set _icon 0
    23522597            }
    2353             $widget configure -image [Rappture::icon bigroller${icon_}]
     2598            $widget configure -image [Rappture::icon bigroller${_icon}]
    23542599            $_dispatcher event -after 100 !waiticon
    23552600        }
     
    23612606
    23622607itcl::body Rappture::FlowvisViewer::GetMovie { widget width height } {
    2363     set token "movie[incr nextToken_]"
    2364     set var ::Rappture::MolvisViewer::hardcopy_($this-$token)
     2608    set token "movie[incr _nextToken]"
     2609    set var ::Rappture::MolvisViewer::_hardcopy($this-$token)
    23652610    set $var ""
    23662611
     
    23892634    focus $inner.cancel
    23902635
    2391     SendCmd "flow video $width $height $settings_(numframes) 2.0 1000"
     2636    SendCmd "flow video $width $height $_settings(numframes) 2.0 1000"
    23922637   
    23932638    $popup activate $widget below
     
    24072652    update
    24082653
    2409     if { $hardcopy_($this-$token) != "" } {
    2410         return [list .png $hardcopy_($this-$token)]
     2654    if { $_hardcopy($this-$token) != "" } {
     2655        return [list .png $_hardcopy($this-$token)]
    24112656    }
    24122657    return ""
    24132658}
    24142659
    2415 itcl::body Rappture::FlowvisViewer::DoResize {} {
    2416     SendCmd "screen $width_ $height_"
    2417 }
    2418 
    2419 itcl::body Rappture::FlowvisViewer::EventuallyResize { w h } {
    2420     if { $width_ != $w || $height_ != $h } {
    2421         set width_ $w
    2422         set height_ $h
    2423         $_dispatcher event -idle !resize
    2424     }
    2425 }
    2426 
    2427 itcl::body Rappture::FlowvisViewer::EventuallyResizeLegend {} {
    2428     $_dispatcher event -idle !legend
    2429 }
Note: See TracChangeset for help on using the changeset viewer.