Changeset 5377 for trunk/gui


Ignore:
Timestamp:
May 1, 2015 10:57:35 AM (9 years ago)
Author:
ldelgass
Message:

More refactoring to sync flowvis and nanovis viewers

File:
1 edited

Legend:

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

    r5376 r5377  
    226226        -ambient                60
    227227        -arrows                 0
    228         -axes                   0
     228        -axesvisible            0
    229229        -colormap               BCGYR
    230230        -currenttime            0
    231         -cutplanesVisible       0
     231        -cutplanesvisible       0
    232232        -diffuse                40
    233233        -duration               1:00
    234         -grid                   0
    235         -isosurface             0
    236         -legend                 1
     234        -gridvisible            0
     235        -isosurfaceshading      0
     236        -legendvisible          1
    237237        -lic                    1
    238238        -light2side             1
    239239        -loop                   0
    240240        -opacity                50
    241         -outline                1
     241        -outlinevisible         1
    242242        -particles              1
    243243        -play                   0
     
    246246        -qy                     $_view(-qy)
    247247        -qz                     $_view(-qz)
    248         -specularLevel          30
    249         -specularExponent       90
     248        -specularexponent       90
     249        -specularlevel          30
    250250        -speed                  500
    251251        -step                   0
     
    253253        -thickness              350
    254254        -volume                 1
    255         -xcutplane              1
    256         -xcutposition           0
     255        -xcutplaneposition      50
     256        -xcutplanevisible       1
    257257        -xpan                   $_view(-xpan)
    258         -ycutplane              1
    259         -ycutposition           0
     258        -ycutplaneposition      50
     259        -ycutplanevisible       1
    260260        -ypan                   $_view(-ypan)
    261         -zcutplane              1
    262         -zcutposition           0
     261        -zcutplaneposition      50
     262        -zcutplanevisible       1
    263263        -zoom                   $_view(-zoom)
    264264    }]
     
    327327            -onimage [Rappture::icon cutbutton] \
    328328            -offimage [Rappture::icon cutbutton] \
    329             -variable [itcl::scope _settings(-cutplanesVisible)] \
    330             -command [itcl::code $this AdjustSetting -cutplanesVisible]
     329            -variable [itcl::scope _settings(-cutplanesvisible)] \
     330            -command [itcl::code $this AdjustSetting -cutplanesvisible]
    331331    }
    332332    Rappture::Tooltip::for $itk_component(cutplane) \
     
    365365        1,0 $itk_component(legend) -fill x
    366366    blt::table configure $itk_component(plotarea) r1 -resize none
     367
    367368    # Create flow controls...
    368 
    369369    itk_component add flowcontrols {
    370370        frame $itk_interior.flowcontrols
     
    10921092        return
    10931093    }
     1094
    10941095    # Arguments from server are name value pairs. Stuff them in an array.
    10951096    array set info $args
     
    11981199
    11991200    # Reset the camera and other view parameters
    1200     InitSettings -light2side \
    1201         -ambient -diffuse -specularLevel -specularExponent \
    1202         -opacity -isosurface -grid -axes -volume -outline \
    1203         -cutplanesVisible -xcutplane -ycutplane -zcutplane
     1201    InitSettings -axesvisible -gridvisible \
     1202        -opacity -light2side -isosurfaceshading \
     1203        -ambient -diffuse -specularlevel -specularexponent \
     1204        -volume -outlinevisible -cutplanesvisible \
     1205        -xcutplanevisible -ycutplanevisible -zcutplanevisible \
     1206        -xcutplaneposition -ycutplaneposition -zcutplaneposition
    12041207
    12051208    # nothing to send -- activate the proper volume
     
    14841487            }
    14851488        }
    1486         "-axes" {
     1489        "-axesvisible" {
    14871490            SendCmd "axis visible $_settings($what)"
    14881491        }
     
    14911494            set _settings($what) $color
    14921495            #ResetColormap $color
     1496        }
     1497        "-cutplanesvisible" {
     1498            set bool $_settings($what)
     1499            set datasets [CurrentDatasets -cutplanes]
     1500            set tag [lindex $datasets 0]
     1501            SendCmd "cutplane visible $bool $tag"
    14931502        }
    14941503        "-diffuse" {
     
    15011510            }
    15021511        }
    1503         "-specularLevel" {
     1512        "-gridvisible" {
     1513            SendCmd "grid visible $_settings($what)"
     1514        }
     1515        "-isosurfaceshading" {
     1516            if { $_first != "" } {
     1517                set comp [lindex [$_first components] 0]
     1518                set tag $_first-$comp
     1519                set val $_settings($what)
     1520                SendCmd "volume shading isosurface $val $tag"
     1521                #SendCmd "$tag configure -isosurface $val"
     1522            }
     1523        }
     1524        "-legendvisible" {
     1525            if { $_settings($what) } {
     1526                blt::table $itk_component(plotarea) \
     1527                    0,0 $itk_component(3dview) -fill both \
     1528                    1,0 $itk_component(legend) -fill x
     1529                blt::table configure $itk_component(plotarea) r1 -resize none
     1530            } else {
     1531                blt::table forget $itk_component(legend)
     1532            }
     1533        }
     1534        "-light2side" {
     1535            if { $_first != "" } {
     1536                set comp [lindex [$_first components] 0]
     1537                set tag $_first-$comp
     1538                set val $_settings($what)
     1539                SendCmd "$tag configure -light2side $val"
     1540            }
     1541        }
     1542        "-opacity" {
     1543            if { $_first != "" } {
     1544                set comp [lindex [$_first components] 0]
     1545                set tag $_first-$comp
     1546                set opacity [expr { 0.01 * double($_settings($what)) }]
     1547                SendCmd "$tag configure -opacity $opacity"
     1548            }
     1549        }
     1550        "-outlinevisible" {
     1551            if { $_first != "" } {
     1552                set comp [lindex [$_first components] 0]
     1553                set tag $_first-$comp
     1554                SendCmd "$tag configure -outline $_settings($what)"
     1555            }
     1556        }
     1557        "-specularlevel" {
    15041558            if { $_first != "" } {
    15051559                set comp [lindex [$_first components] 0]
     
    15101564            }
    15111565        }
    1512         "-specularExponent" {
     1566        "-specularexponent" {
    15131567            if { $_first != "" } {
    15141568                set comp [lindex [$_first components] 0]
     
    15161570                set val $_settings($what)
    15171571                SendCmd "$tag configure -specularExp $val"
    1518             }
    1519         }
    1520         "-light2side" {
    1521             if { $_first != "" } {
    1522                 set comp [lindex [$_first components] 0]
    1523                 set tag $_first-$comp
    1524                 set val $_settings($what)
    1525                 SendCmd "$tag configure -light2side $val"
    1526             }
    1527         }
    1528         "-opacity" {
    1529             if { $_first != "" } {
    1530                 set comp [lindex [$_first components] 0]
    1531                 set tag $_first-$comp
    1532                 set opacity [expr { 0.01 * double($_settings($what)) }]
    1533                 SendCmd "$tag configure -opacity $opacity"
    15341572            }
    15351573        }
     
    15441582            }
    15451583        }
    1546         "-outline" {
    1547             if { $_first != "" } {
    1548                 set comp [lindex [$_first components] 0]
    1549                 set tag $_first-$comp
    1550                 SendCmd "$tag configure -outline $_settings($what)"
    1551             }
    1552         }
    1553         "-isosurface" {
    1554             SendCmd "volume shading isosurface $_settings($what)"
    1555         }
    1556         "-grid" {
    1557             SendCmd "grid visible $_settings($what)"
    1558         }
    1559         "-legend" {
    1560             if { $_settings($what) } {
    1561                 blt::table $itk_component(plotarea) \
    1562                     0,0 $itk_component(3dview) -fill both \
    1563                     1,0 $itk_component(legend) -fill x
    1564                 blt::table configure $itk_component(plotarea) r1 -resize none
    1565             } else {
    1566                 blt::table forget $itk_component(legend)
    1567             }
    1568         }
    15691584        "-volume" {
    15701585            if { $_first != "" } {
     
    15741589            }
    15751590        }
    1576         "-cutplanesVisible" {
    1577             set bool $_settings($what)
     1591        "-xcutplaneposition" - "-ycutplaneposition" - "-zcutplaneposition" {
     1592            set axis [string range $what 1 1]
     1593            set pos [expr $_settings($what) * 0.01]
     1594            # We only set cutplanes on the first dataset.
    15781595            set datasets [CurrentDatasets -cutplanes]
    15791596            set tag [lindex $datasets 0]
    1580             SendCmd "cutplane visible $bool $tag"
    1581         }
    1582         "-xcutplane" - "-ycutplane" - "-zcutplane" {
     1597            SendCmd "cutplane position $pos $axis $tag"
     1598        }
     1599        "-xcutplanevisible" - "-ycutplanevisible" - "-zcutplanevisible" {
    15831600            set axis [string range $what 1 1]
    15841601            set bool $_settings($what)
    1585             if { [isconnected] } {
    1586                 set vols [CurrentDatasets -cutplanes]
    1587                 SendCmd "cutplane state $bool $axis $vols"
    1588             }
     1602            # We only set cutplanes on the first dataset.
     1603            set datasets [CurrentDatasets -cutplanes]
     1604            set tag [lindex $datasets 0]
     1605            SendCmd "cutplane state $bool $axis $tag"
    15891606            if { $bool } {
    15901607                $itk_component(${axis}CutScale) configure -state normal \
     
    19661983    checkbutton $inner.axes \
    19671984        -text "Axes" \
    1968         -variable [itcl::scope _settings(-axes)] \
    1969         -command [itcl::code $this AdjustSetting -axes] \
     1985        -variable [itcl::scope _settings(-axesvisible)] \
     1986        -command [itcl::code $this AdjustSetting -axesvisible] \
    19701987        -font "Arial 9"
    19711988
    19721989    checkbutton $inner.grid \
    19731990        -text "Grid" \
    1974         -variable [itcl::scope _settings(-grid)] \
    1975         -command [itcl::code $this AdjustSetting -grid] \
     1991        -variable [itcl::scope _settings(-gridvisible)] \
     1992        -command [itcl::code $this AdjustSetting -gridvisible] \
    19761993        -font "Arial 9"
    19771994
    19781995    checkbutton $inner.outline \
    19791996        -text "Outline" \
    1980         -variable [itcl::scope _settings(-outline)] \
    1981         -command [itcl::code $this AdjustSetting -outline] \
     1997        -variable [itcl::scope _settings(-outlinevisible)] \
     1998        -command [itcl::code $this AdjustSetting -outlinevisible] \
    19821999        -font "Arial 9"
    19832000
    19842001    checkbutton $inner.legend \
    19852002        -text "Legend" \
    1986         -variable [itcl::scope _settings(-legend)] \
    1987         -command [itcl::code $this AdjustSetting -legend] \
     2003        -variable [itcl::scope _settings(-legendvisible)] \
     2004        -command [itcl::code $this AdjustSetting -legendvisible] \
    19882005        -font "Arial 9"
    19892006
     
    20412058
    20422059    checkbutton $inner.isosurface -text "Isosurface shading" -font $fg \
    2043         -variable [itcl::scope _settings(-isosurface)] \
    2044         -command [itcl::code $this AdjustSetting -isosurface]
     2060        -variable [itcl::scope _settings(-isosurfaceshading)] \
     2061        -command [itcl::code $this AdjustSetting -isosurfaceshading]
    20452062
    20462063    checkbutton $inner.light2side -text "Two-sided lighting" -font $fg \
     
    20622079    label $inner.specularLevel_l -text "Specular" -font $fg
    20632080    ::scale $inner.specularLevel -from 0 -to 100 -orient horizontal \
    2064         -variable [itcl::scope _settings(-specularLevel)] \
     2081        -variable [itcl::scope _settings(-specularlevel)] \
    20652082        -width 10 \
    2066         -showvalue off -command [itcl::code $this AdjustSetting -specularLevel]
     2083        -showvalue off -command [itcl::code $this AdjustSetting -specularlevel]
    20672084
    20682085    label $inner.specularExponent_l -text "Shininess" -font $fg
    20692086    ::scale $inner.specularExponent -from 10 -to 128 -orient horizontal \
    2070         -variable [itcl::scope _settings(-specularExponent)] \
     2087        -variable [itcl::scope _settings(-specularexponent)] \
    20712088        -width 10 \
    2072         -showvalue off -command [itcl::code $this AdjustSetting -specularExponent]
     2089        -showvalue off -command [itcl::code $this AdjustSetting -specularexponent]
    20732090
    20742091    # Opacity
     
    21312148    checkbutton $inner.visible \
    21322149        -text "Show Cutplanes" \
    2133         -variable [itcl::scope _settings(-cutplanesVisible)] \
    2134         -command [itcl::code $this AdjustSetting -cutplanesVisible] \
     2150        -variable [itcl::scope _settings(-cutplanesvisible)] \
     2151        -command [itcl::code $this AdjustSetting -cutplanesvisible] \
    21352152        -font "Arial 9"
    21362153
     
    21402157            -onimage [Rappture::icon x-cutplane] \
    21412158            -offimage [Rappture::icon x-cutplane] \
    2142             -command [itcl::code $this AdjustSetting -xcutplane] \
    2143             -variable [itcl::scope _settings(-xcutplane)]
     2159            -command [itcl::code $this AdjustSetting -xcutplanevisible] \
     2160            -variable [itcl::scope _settings(-xcutplanevisible)]
    21442161    }
    21452162    Rappture::Tooltip::for $itk_component(xCutButton) \
     
    21522169            -borderwidth 1 -highlightthickness 0 \
    21532170            -command [itcl::code $this Slice move x] \
    2154             -variable [itcl::scope _settings(-xcutposition)]
     2171            -variable [itcl::scope _settings(-xcutplaneposition)]
    21552172    } {
    21562173        usual
     
    21682185            -onimage [Rappture::icon y-cutplane] \
    21692186            -offimage [Rappture::icon y-cutplane] \
    2170             -command [itcl::code $this AdjustSetting -ycutplane] \
    2171             -variable [itcl::scope _settings(-ycutplane)]
     2187            -command [itcl::code $this AdjustSetting -ycutplanevisible] \
     2188            -variable [itcl::scope _settings(-ycutplanevisible)]
    21722189    }
    21732190    Rappture::Tooltip::for $itk_component(yCutButton) \
     
    21802197            -borderwidth 1 -highlightthickness 0 \
    21812198            -command [itcl::code $this Slice move y] \
    2182             -variable [itcl::scope _settings(-ycutposition)]
     2199            -variable [itcl::scope _settings(-ycutplaneposition)]
    21832200    } {
    21842201        usual
     
    21962213            -onimage [Rappture::icon z-cutplane] \
    21972214            -offimage [Rappture::icon z-cutplane] \
    2198             -command [itcl::code $this AdjustSetting -zcutplane] \
    2199             -variable [itcl::scope _settings(-zcutplane)]
     2215            -command [itcl::code $this AdjustSetting -zcutplanevisible] \
     2216            -variable [itcl::scope _settings(-zcutplanevisible)]
    22002217    }
    22012218    Rappture::Tooltip::for $itk_component(zCutButton) \
     
    22082225            -borderwidth 1 -highlightthickness 0 \
    22092226            -command [itcl::code $this Slice move z] \
    2210             -variable [itcl::scope _settings(-zcutposition)]
     2227            -variable [itcl::scope _settings(-zcutplaneposition)]
    22112228    } {
    22122229        usual
     
    25062523    array set info [$flowobj hints]
    25072524    set _settings(-volume) $info(volume)
    2508     set _settings(-outline) $info(outline)
     2525    set _settings(-outlinevisible) $info(outline)
    25092526    set _settings(-arrows) $info(arrows)
    25102527    set _settings(-duration) $info(duration)
Note: See TracChangeset for help on using the changeset viewer.