Changeset 3396 for trunk/gui/scripts


Ignore:
Timestamp:
Feb 28, 2013, 1:55:20 PM (12 years ago)
Author:
ldelgass
Message:

Bring flowvisviewer more in line with nanovisviewer fixes

Location:
trunk/gui/scripts
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/gui/scripts/flowvisviewer.tcl

    r3394 r3396  
    7878    protected method Resize {}
    7979    protected method ResizeLegend {}
    80     protected method FixSettings {what {value ""}}
     80    protected method AdjustSetting {what {value ""}}
     81    protected method InitSettings { args }
    8182    protected method Pan {option x y}
    8283    protected method Rebuild {}
     
    141142    private variable _obj2flow;         # Maps dataobj-component to a flow.
    142143
     144    private variable _reset 1;          # Connection to server has been reset
    143145    private variable _click        ;# info used for rotate operations
    144146    private variable _limits       ;# autoscale min/max for all axes
     
    243245    set _limits(vmin) 0.0
    244246    set _limits(vmax) 1.0
     247    set _reset 1
    245248
    246249    array set _settings [subst {
     
    320323            -onimage [Rappture::icon volume-on] \
    321324            -offimage [Rappture::icon volume-off] \
    322             -command [itcl::code $this FixSettings volume] \
     325            -command [itcl::code $this AdjustSetting volume] \
    323326            -variable [itcl::scope _settings($this-volume)]
    324327    }
     
    859862        return 0
    860863    }
     864    set _reset 1
    861865    set result [VisViewer::Connect $_hosts]
    862866    if { $result } {
     
    12241228            SendCmd "clientinfo [list $info]"
    12251229        }
    1226         set w [winfo width $itk_component(3dview)]
    1227         set h [winfo height $itk_component(3dview)]
    1228         $_arcball resize $w $h
    1229         EventuallyResize $w $h
     1230        set _width [winfo width $itk_component(3dview)]
     1231        set _height [winfo height $itk_component(3dview)]
     1232        Resize
    12301233    }
    12311234    foreach dataobj [get] {
     
    12671270
    12681271    # Reset the camera and other view parameters
    1269     FixSettings isosurface
    1270     FixSettings grid
    1271     FixSettings axes
    1272     FixSettings volume
    1273     FixSettings outline
    1274     FixSettings light
    1275     FixSettings transp
     1272    InitSettings isosurface grid axes volume outline light2side light transp
    12761273   
    12771274    # nothing to send -- activate the proper volume
    12781275    if {"" != $_first} {
    1279         FixSettings light
    1280         FixSettings transp
     1276        AdjustSetting light
     1277        AdjustSetting transp
    12811278        set axis [$_first hints updir]
    12821279        if {"" != $axis} {
     
    13491346    blt::busy release $itk_component(hull)
    13501347    set _buffering 0;                   # Turn off buffering.
    1351     set _outbuf "";                     # Clear the buffer.             
     1348    set _outbuf "";                     # Clear the buffer.
     1349    set _reset 0
    13521350}
    13531351
     
    16841682
    16851683# ----------------------------------------------------------------------
    1686 # USAGE: FixSettings <what> ?<value>?
     1684# USAGE: InitSettings <what> ?<value>?
    16871685#
    16881686# Used internally to update rendering settings whenever parameters
     
    16901688# to the back end.
    16911689# ----------------------------------------------------------------------
    1692 itcl::body Rappture::FlowvisViewer::FixSettings {what {value ""}} {
     1690itcl::body Rappture::FlowvisViewer::InitSettings { args } {
     1691    foreach arg $args {
     1692        AdjustSetting $arg
     1693    }
     1694}
     1695
     1696# ----------------------------------------------------------------------
     1697# USAGE: AdjustSetting <what> ?<value>?
     1698#
     1699# Used internally to update rendering settings whenever parameters
     1700# change in the popup settings panel.  Sends the new settings off
     1701# to the back end.
     1702# ----------------------------------------------------------------------
     1703itcl::body Rappture::FlowvisViewer::AdjustSetting {what {value ""}} {
    16931704    switch -- $what {
     1705        colormap {
     1706            set color [$itk_component(colormap) value]
     1707            set _settings(colormap) $color
     1708            #ResetColormap $color
     1709        }
    16941710        light {
    16951711            if { $_first != "" } {
     
    17031719            }
    17041720        }
     1721        light2side {
     1722            if { $_first != "" } {
     1723                set comp [lindex [$_first components] 0]
     1724                set tag $_first-$comp
     1725                set val $_settings($this-light2side)
     1726                #SendCmd "$tag configure -light2side $val"
     1727            }
     1728        }
    17051729        transp {
    17061730            if { $_first != "" } {
     
    18371861itcl::body Rappture::FlowvisViewer::NameTransferFunc { dataobj comp } {
    18381862    array set style {
    1839         -color rainbow
     1863        -color BCGYR
    18401864        -levels 6
    18411865        -opacity 1.0
     
    18641888itcl::body Rappture::FlowvisViewer::ComputeTransferFunc { tf } {
    18651889    array set style {
    1866         -color rainbow
     1890        -color BCGYR
    18671891        -levels 6
    18681892        -opacity 1.0
     
    18931917    if { ![info exists _isomarkers($tf)] } {
    18941918        # Have to defer creation of isomarkers until we have data limits
    1895         if { [info exists style(-markers)] } {
     1919        if { [info exists style(-markers)] &&
     1920             [llength $style(-markers)] > 0  } {
    18961921            ParseMarkersOption $tf $style(-markers)
    18971922        } else {
     
    18991924        }
    19001925    }
    1901     if {$style(-color) == "rainbow"} {
    1902         set style(-color) "white:yellow:green:cyan:blue:magenta"
    1903     }
    19041926    if { [info exists style(-nonuniformcolors)] } {
    19051927        foreach { value color } $style(-nonuniformcolors) {
     
    19071929        }
    19081930    } else {
    1909         set clist [split $style(-color) :]
    1910         set cmap "0.0 [Color2RGB white] "
    1911         for {set i 0} {$i < [llength $clist]} {incr i} {
    1912             set x [expr {double($i+1)/([llength $clist]+1)}]
    1913             set color [lindex $clist $i]
    1914             append cmap "$x [Color2RGB $color] "
    1915         }
    1916         append cmap "1.0 [Color2RGB $color]"
     1931        set cmap [ColorsToColormap $style(-color)]
    19171932    }
    19181933    set tag $this-$tf
     
    19201935        set _settings($tag-opacity) $style(-opacity)
    19211936    }
    1922     set max $_settings($tag-opacity)
     1937    set max 1.0 ;#$_settings($tag-opacity)
    19231938   
    19241939    set isovalues {}
     
    19301945
    19311946    if { ![info exists _settings($tag-thickness)]} {
    1932         set _settings($tag-thickness) 0.05
     1947        set _settings($tag-thickness) 0.005
    19331948    }
    19341949    set delta $_settings($tag-thickness)
     
    19741989        lappend wmap 1.0 0.0
    19751990    }
    1976     SendCmd "transfunc define $tf { $cmap } { $wmap }\n"
    1977     return [SendCmd "$dataobj-$comp configure -transferfunction $tf\n"]
     1991    SendCmd "transfunc define $tf { $cmap } { $wmap }"
     1992    return [SendCmd "$dataobj-$comp configure -transferfunction $tf"]
    19781993}
    19791994
     
    21942209        -text "Isosurface shading" \
    21952210        -variable [itcl::scope _settings($this-isosurface)] \
    2196         -command [itcl::code $this FixSettings isosurface] \
     2211        -command [itcl::code $this AdjustSetting isosurface] \
    21972212        -font "Arial 9"
    21982213
     
    22002215        -text "Axes" \
    22012216        -variable [itcl::scope _settings($this-axes)] \
    2202         -command [itcl::code $this FixSettings axes] \
     2217        -command [itcl::code $this AdjustSetting axes] \
    22032218        -font "Arial 9"
    22042219
     
    22062221        -text "Grid" \
    22072222        -variable [itcl::scope _settings($this-grid)] \
    2208         -command [itcl::code $this FixSettings grid] \
     2223        -command [itcl::code $this AdjustSetting grid] \
    22092224        -font "Arial 9"
    22102225
     
    22122227        -text "Outline" \
    22132228        -variable [itcl::scope _settings($this-outline)] \
    2214         -command [itcl::code $this FixSettings outline] \
     2229        -command [itcl::code $this AdjustSetting outline] \
    22152230        -font "Arial 9"
    22162231
     
    22182233        -text "Legend" \
    22192234        -variable [itcl::scope _settings($this-legend)] \
    2220         -command [itcl::code $this FixSettings legend] \
     2235        -command [itcl::code $this AdjustSetting legend] \
    22212236        -font "Arial 9"
    22222237
     
    22242239        -text "Volume" \
    22252240        -variable [itcl::scope _settings($this-volume)] \
    2226         -command [itcl::code $this FixSettings volume] \
     2241        -command [itcl::code $this AdjustSetting volume] \
    22272242        -font "Arial 9"
    22282243
     
    22302245        -text "Particles" \
    22312246        -variable [itcl::scope _settings($this-particles)] \
    2232         -command [itcl::code $this FixSettings particles] \
     2247        -command [itcl::code $this AdjustSetting particles] \
    22332248        -font "Arial 9"
    22342249
     
    22362251        -text "Lic" \
    22372252        -variable [itcl::scope _settings($this-lic)] \
    2238         -command [itcl::code $this FixSettings lic] \
     2253        -command [itcl::code $this AdjustSetting lic] \
    22392254        -font "Arial 9"
    22402255
     
    22562271itcl::body Rappture::FlowvisViewer::BuildVolumeTab {} {
    22572272    foreach { key value } {
     2273        light2side      0
    22582274        light           40
    22592275        transp          50
     
    22752291        -text "Volume" \
    22762292        -variable [itcl::scope _settings($this-volume)] \
    2277         -command [itcl::code $this FixSettings volume] \
     2293        -command [itcl::code $this AdjustSetting volume] \
    22782294        -font "Arial 9"
    22792295
    22802296    label $inner.shading -text "Shading:" -font $fg
     2297
     2298    checkbutton $inner.light2side -text "Two-sided lighting" -font $fg \
     2299        -variable [itcl::scope _settings($this-light2side)] \
     2300        -command [itcl::code $this AdjustSetting light2side]
    22812301
    22822302    label $inner.dim -text "Glow" -font $fg
     
    22842304        -variable [itcl::scope _settings($this-light)] \
    22852305        -width 10 \
    2286         -showvalue off -command [itcl::code $this FixSettings light]
     2306        -showvalue off -command [itcl::code $this AdjustSetting light]
    22872307    label $inner.bright -text "Surface" -font $fg
    22882308
     
    22912311        -variable [itcl::scope _settings($this-transp)] \
    22922312        -width 10 \
    2293         -showvalue off -command [itcl::code $this FixSettings transp]
     2313        -showvalue off -command [itcl::code $this AdjustSetting transp]
    22942314    label $inner.plastic -text "Opaque" -font $fg
    22952315
     
    22982318        -variable [itcl::scope _settings($this-opacity)] \
    22992319        -width 10 \
    2300         -showvalue off -command [itcl::code $this FixSettings opacity]
     2320        -showvalue off -command [itcl::code $this AdjustSetting opacity]
    23012321    label $inner.opaque -text "Opaque" -font $fg
    23022322
     
    23052325        -variable [itcl::scope _settings($this-thickness)] \
    23062326        -width 10 \
    2307         -showvalue off -command [itcl::code $this FixSettings thickness]
     2327        -showvalue off -command [itcl::code $this AdjustSetting thickness]
    23082328    label $inner.thick -text "Thick" -font $fg
    23092329
     2330    label $inner.colormap_l -text "Colormap" -font "Arial 9"
     2331    itk_component add colormap {
     2332        Rappture::Combobox $inner.colormap -width 10 -editable no
     2333    }
     2334
     2335    $inner.colormap choices insert end \
     2336        "BCGYR"              "BCGYR"            \
     2337        "BGYOR"              "BGYOR"            \
     2338        "blue"               "blue"             \
     2339        "blue-to-brown"      "blue-to-brown"    \
     2340        "blue-to-orange"     "blue-to-orange"   \
     2341        "blue-to-grey"       "blue-to-grey"     \
     2342        "green-to-magenta"   "green-to-magenta" \
     2343        "greyscale"          "greyscale"        \
     2344        "nanohub"            "nanohub"          \
     2345        "rainbow"            "rainbow"          \
     2346        "spectral"           "spectral"         \
     2347        "ROYGB"              "ROYGB"            \
     2348        "RYGCB"              "RYGCB"            \
     2349        "brown-to-blue"      "brown-to-blue"    \
     2350        "grey-to-blue"       "grey-to-blue"     \
     2351        "orange-to-blue"     "orange-to-blue"   \
     2352        "none"               "none"
     2353
     2354    $itk_component(colormap) value "BCGYR"
     2355    bind $inner.colormap <<Value>> \
     2356        [itcl::code $this AdjustSetting colormap]
     2357
    23102358    blt::table $inner \
    2311         0,0 $inner.vol -columnspan 4 -anchor w -pady 2 \
     2359        0,0 $inner.vol -cspan 4 -anchor w -pady 2 \
    23122360        1,0 $inner.shading -columnspan 4 -anchor w -pady {10 2} \
    2313         2,0 $inner.dim -anchor e -pady 2 \
    2314         2,1 $inner.light -columnspan 2 -pady 2 -fill x \
    2315         2,3 $inner.bright -anchor w -pady 2 \
    2316         3,0 $inner.fog -anchor e -pady 2 \
    2317         3,1 $inner.transp -columnspan 2 -pady 2 -fill x \
    2318         3,3 $inner.plastic -anchor w -pady 2 \
    2319         4,0 $inner.thin -anchor e -pady 2 \
    2320         4,1 $inner.thickness -columnspan 2 -pady 2 -fill x\
    2321         4,3 $inner.thick -anchor w -pady 2
    2322 
    2323     if 0 {
    2324         0,0 $inner.dim  -anchor e -pady 2 \
    2325         0,1 $inner.light -columnspan 2 -pady 2 \
    2326         0,3 $inner.bright -anchor w -pady 2 \
    2327         1,0 $inner.fog -anchor e -pady 2 \
    2328         1,1 $inner.transp -columnspan 2 -pady 2 \
    2329         1,3 $inner.plastic -anchor w -pady 2 \
    2330         2,0 $inner.clear -anchor e -pady 2 \
    2331         2,1 $inner.opacity -columnspan 2 -pady 2 \
    2332         2,3 $inner.opaque -anchor w -pady 2 \
    2333         3,0 $inner.thin -anchor e -pady 2 \
    2334         3,1 $inner.thickness -columnspan 2 -pady 2 \
    2335         3,3 $inner.thick -anchor w -pady 2
    2336     }
     2361        2,0 $inner.light2side -columnspan 4 -anchor w -pady 2 \
     2362        3,0 $inner.dim -anchor e -pady 2 \
     2363        3,1 $inner.light -columnspan 2 -pady 2 -fill x \
     2364        3,3 $inner.bright -anchor w -pady 2 \
     2365        4,0 $inner.fog -anchor e -pady 2 \
     2366        4,1 $inner.transp -columnspan 2 -pady 2 -fill x \
     2367        4,3 $inner.plastic -anchor w -pady 2 \
     2368        5,0 $inner.thin -anchor e -pady 2 \
     2369        5,1 $inner.thickness -columnspan 2 -pady 2 -fill x\
     2370        5,3 $inner.thick -anchor w -pady 2
     2371
    23372372    blt::table configure $inner c0 c1 c3 r* -resize none
    2338     blt::table configure $inner r5 -resize expand
     2373    blt::table configure $inner r6 -resize expand
    23392374}
    23402375
     
    23502385            -onimage [Rappture::icon x-cutplane] \
    23512386            -offimage [Rappture::icon x-cutplane] \
    2352             -command [itcl::code $this FixSettings xcutplane] \
     2387            -command [itcl::code $this AdjustSetting xcutplane] \
    23532388            -variable [itcl::scope _settings($this-xcutplane)]
    23542389    }
     
    23772412            -onimage [Rappture::icon y-cutplane] \
    23782413            -offimage [Rappture::icon y-cutplane] \
    2379             -command [itcl::code $this FixSettings ycutplane] \
     2414            -command [itcl::code $this AdjustSetting ycutplane] \
    23802415            -variable [itcl::scope _settings($this-ycutplane)]
    23812416    }
     
    24042439            -onimage [Rappture::icon z-cutplane] \
    24052440            -offimage [Rappture::icon z-cutplane] \
    2406             -command [itcl::code $this FixSettings zcutplane] \
     2441            -command [itcl::code $this AdjustSetting zcutplane] \
    24072442            -variable [itcl::scope _settings($this-zcutplane)]
    24082443    }
     
    26232658}
    26242659
    2625 
    26262660itcl::body Rappture::FlowvisViewer::Resize {} {
     2661    $_arcball resize $_width $_height
    26272662    SendCmd "screen $_width $_height"
    26282663    set _resizePending 0
  • trunk/gui/scripts/nanovisviewer.tcl

    r3395 r3396  
    18801880        5,3 $inner.thick -anchor w -pady 2
    18811881
    1882 #        4,0 $inner.clear -anchor e -pady 2 \
    1883 #        4,1 $inner.opacity -columnspan 2 -pady 2 -fill x\
    1884 #        4,3 $inner.opaque -anchor w -pady 2 \
    1885 
    1886 
    18871882    blt::table configure $inner c0 c1 c3 r* -resize none
    18881883    blt::table configure $inner r6 -resize expand
     
    20792074
    20802075itcl::body Rappture::NanovisViewer::DoResize {} {
     2076    $_arcball resize $_width $height
    20812077    SendCmd "screen $_width $_height"
    20822078    set _resizePending 0
Note: See TracChangeset for help on using the changeset viewer.