Changeset 2600 for trunk/gui


Ignore:
Timestamp:
Oct 6, 2011, 9:23:54 AM (13 years ago)
Author:
gah
Message:
 
Location:
trunk/gui/scripts
Files:
2 edited

Legend:

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

    r2592 r2600  
    508508        scale   about.scale
    509509        seeds   about.seeds
     510        scalars about.scalars
     511        vectors about.vectors
     512        field   about.default
    510513        units   units
    511514        updir   updir
  • trunk/gui/scripts/vtkstreamlinesviewer.tcl

    r2598 r2600  
    6969    protected method Disconnect {}
    7070    protected method DoResize {}
     71    protected method DoReseed {}
    7172    protected method DoRotate {}
    7273    protected method AdjustSetting {what {value ""}}
    73     protected method FixSettings { args  }
     74    protected method InitSettings { args  }
    7475    protected method Pan {option x y}
    7576    protected method Pick {x y}
     
    9495    private method EnterLegend { x y }
    9596    private method EventuallyResize { w h }
     97    private method EventuallyReseed { numPoints }
    9698    private method EventuallyRotate { q }
    9799    private method EventuallySetCutplane { axis args }
     
    127129    private variable _view         ;    # view params for 3D view
    128130    private variable _settings
    129     private variable _volume
    130     private variable _axis
    131     private variable _cutplane
    132     private variable _streamlines
    133131    private variable _style;            # Array of current component styles.
    134132    private variable _initialStyle;     # Array of initial component styles.
     
    147145    private variable _height 0
    148146    private variable _resizePending 0
     147    private variable _reseedPending 0
    149148    private variable _rotatePending 0
    150149    private variable _cutplanePending 0
    151150    private variable _outline
    152     private variable _fields
     151    private variable _vectorFields
     152    private variable _scalarFields
     153    private variable _currentField
     154    private variable _numSeeds 200
    153155    private variable _colorMode "vmag";#  Mode of colormap (vmag or scalar)
    154156}
     
    171173    $_dispatcher dispatch $this !resize "[itcl::code $this DoResize]; list"
    172174
     175    # Reseed event
     176    $_dispatcher register !reseed
     177    $_dispatcher dispatch $this !reseed "[itcl::code $this DoReseed]; list"
     178
    173179    # Rotate event
    174180    $_dispatcher register !rotate
     
    178184    $_dispatcher register !xcutplane
    179185    $_dispatcher dispatch $this !xcutplane \
    180         "[itcl::code $this AdjustSetting xcutplane-position]; list"
     186        "[itcl::code $this AdjustSetting cutplane-xposition]; list"
    181187
    182188    # Y-Cutplane event
    183189    $_dispatcher register !ycutplane
    184190    $_dispatcher dispatch $this !ycutplane \
    185         "[itcl::code $this AdjustSetting ycutplane-position]; list"
     191        "[itcl::code $this AdjustSetting cutplane-yposition]; list"
    186192
    187193    # Z-Cutplane event
    188194    $_dispatcher register !zcutplane
    189195    $_dispatcher dispatch $this !zcutplane \
    190         "[itcl::code $this AdjustSetting zcutplane-position]; list"
     196        "[itcl::code $this AdjustSetting cutplane-zposition]; list"
    191197
    192198    #
     
    223229    set _limits(zmax) 1.0
    224230
    225     array set _axis [subst {
    226         xgrid           0
    227         ygrid           0
    228         zgrid           0
    229         xcutplane       0
    230         ycutplane       0
    231         zcutplane       0
    232         xposition       0
    233         yposition       0
    234         zposition       0
    235         visible         1
    236         labels          1
    237     }]
    238     array set _cutplane [subst {
    239         edges           0
    240         xvisible        0
    241         yvisible        0
    242         zvisible        0
    243         xposition       0
    244         yposition       0
    245         zposition       0
    246         visible         1
    247         wireframe       0
    248         opacity         100
    249     }]
    250     array set _volume [subst {
    251         edges           0
    252         lighting        1
    253         opacity         40
    254         visible         1
    255         wireframe       0
    256     }]
    257     array set _streamlines [subst {
    258         seeds           0
    259         visible         1
    260         opacity         100
    261         seeddensity     200
    262         lighting        1
    263         scale           1
    264     }]
    265231    array set _settings [subst {
    266         legend          1
     232        axis-xgrid              0
     233        axis-ygrid              0
     234        axis-zgrid              0
     235        axis-xcutplane          0
     236        axis-ycutplane          0
     237        axis-zcutplane          0
     238        axis-xposition          0
     239        axis-yposition          0
     240        axis-zposition          0
     241        axis-visible            1
     242        axis-labels             1
     243        cutplane-edges          0
     244        cutplane-xvisible       0
     245        cutplane-yvisible       0
     246        cutplane-zvisible       0
     247        cutplane-xposition      50
     248        cutplane-yposition      50
     249        cutplane-zposition      50
     250        cutplane-visible        1
     251        cutplane-wireframe      0
     252        cutplane-opacity        100
     253        volume-edges            0
     254        volume-lighting         1
     255        volume-opacity          40
     256        volume-visible          1
     257        volume-wireframe        0
     258        streamlines-seeds       0
     259        streamlines-visible     1
     260        streamlines-opacity     100
     261        streamlines-numpoints   200
     262        streamlines-lighting    1
     263        streamlines-scale       1
     264        legend-visible          1
    267265    }]
    268266
     
    335333            -onimage [Rappture::icon volume-on] \
    336334            -offimage [Rappture::icon volume-off] \
    337             -variable [itcl::scope _volume(visible)] \
     335            -variable [itcl::scope _settings(volume-visible)] \
    338336            -command [itcl::code $this AdjustSetting volume-visible]
    339337    }
     
    347345            -onimage [Rappture::icon streamlines-on] \
    348346            -offimage [Rappture::icon streamlines-off] \
    349             -variable [itcl::scope _streamlines(visible)] \
     347            -variable [itcl::scope _settings(streamlines-visible)] \
    350348            -command [itcl::code $this AdjustSetting streamlines-visible] \
    351349    }
     
    358356        BuildVolumeTab
    359357        BuildStreamsTab
     358        BuildCutplaneTab
    360359        BuildAxisTab
    361         BuildCutplaneTab
    362360        BuildCameraTab
    363361    } errs] != 0 } {
     
    455453    $_dispatcher cancel !rebuild
    456454    $_dispatcher cancel !resize
     455    $_dispatcher cancel !reseed
    457456    $_dispatcher cancel !rotate
    458457    $_dispatcher cancel !xcutplane
     
    471470        set _height 500
    472471    }
    473     #puts stderr "DoResize screen size $_width $_height"
    474472    set _start [clock clicks -milliseconds]
    475     #puts stderr "screen size request width=$_width height=$_height"
    476473    SendCmd "screen size $_width $_height"
    477474    RequestLegend
     
    491488}
    492489
     490itcl::body Rappture::VtkStreamlinesViewer::DoReseed {} {
     491    foreach dataset [CurrentDatasets -visible] {
     492        foreach {dataobj comp} [split $dataset -] break
     493        # This command works for either random or fmesh seeds
     494        SendCmd "streamlines seed numpts $_numSeeds $dataset"
     495    }
     496    set _reseedPending 0
     497}
     498
    493499itcl::body Rappture::VtkStreamlinesViewer::EventuallyResize { w h } {
    494     #puts stderr "EventuallyResize $w $h"
    495500    set _width $w
    496501    set _height $h
     
    498503    if { !$_resizePending } {
    499504        set _resizePending 1
    500         $_dispatcher event -after 200 !resize
     505        $_dispatcher event -after 400 !resize
     506    }
     507}
     508
     509itcl::body Rappture::VtkStreamlinesViewer::EventuallyReseed { numPoints } {
     510    set _numSeeds $numPoints
     511    if { !$_reseedPending } {
     512        set _reseedPending 1
     513        $_dispatcher event -after 600 !reseed
    501514    }
    502515}
     
    505518
    506519itcl::body Rappture::VtkStreamlinesViewer::EventuallyRotate { q } {
    507     #puts stderr "EventuallyRotate $w $h"
    508520    foreach { _view(qw) _view(qx) _view(qy) _view(qz) } $q break
    509521    if { !$_rotatePending } {
     
    589601        }
    590602        array unset _obj2ovride $dataobj-*
     603        array unset _settings $dataobj-*
    591604        # Append to the end of the dataobj list.
    592605        lappend _dlist $dataobj
     
    638651                }
    639652                if { ![info exists _obj2ovride($dataobj-raise)] } {
    640                     # No setting indicates that the object isn't invisible.
     653                    # No setting indicates that the object isn't visible.
    641654                    continue
    642655                }
     
    774787# ----------------------------------------------------------------------
    775788itcl::body Rappture::VtkStreamlinesViewer::Connect {} {
    776     #puts stderr "Enter Connect: [info level -1]"
    777789    set _hosts [GetServerList "vtkvis"]
    778790    if { "" == $_hosts } {
     
    781793    set result [VisViewer::Connect $_hosts]
    782794    if { $result } {
    783         #puts stderr "Connected to $_hostname sid=$_sid"
    784795        set w [winfo width $itk_component(view)]
    785796        set h [winfo height $itk_component(view)]
     
    960971    PanCamera
    961972    set _first ""
    962     FixSettings axis-xgrid axis-ygrid axis-zgrid axis-mode \
     973    InitSettings axis-xgrid axis-ygrid axis-zgrid axis-mode \
    963974        axis-visible axis-labels
    964975
     
    10081019        }
    10091020    }
    1010     FixSettings streamlines-seeds streamlines-visible streamlines-opacity \
     1021    InitSettings streamlines-seeds streamlines-visible streamlines-opacity \
     1022        streamlines-numpoints streamlines-lighting streamlines-palette \
     1023        streamlines-field \
    10111024        volume-edges volume-lighting volume-opacity volume-visible \
    1012         volume-wireframe streamlines-palette
    1013 
    1014     set _first [lindex [get -objects] 0]
     1025        volume-wireframe \
     1026        cutplane-xvisible cutplane-yvisible cutplane-zvisible \
     1027        cutplane-xposition cutplane-yposition cutplane-zposition
     1028
    10151029    if { $_reset || $_first == "" } {
    10161030        Zoom reset
     
    12331247
    12341248# ----------------------------------------------------------------------
    1235 # USAGE: FixSettings <what> ?<value>?
     1249# USAGE: InitSettings <what> ?<value>?
    12361250#
    12371251# Used internally to update rendering settings whenever parameters
     
    12391253# to the back end.
    12401254# ----------------------------------------------------------------------
    1241 itcl::body Rappture::VtkStreamlinesViewer::FixSettings { args } {
    1242     foreach setting $args {
    1243         AdjustSetting $setting
     1255itcl::body Rappture::VtkStreamlinesViewer::InitSettings { args } {
     1256    foreach spec $args {
     1257        if { [info exists _settings($_first-$spec)] } {
     1258            # Reset global setting with dataobj specific setting
     1259            set _settings($spec) $_settings($_first-$spec)
     1260        }
     1261        AdjustSetting $spec
    12441262    }
    12451263}
     
    12581276    switch -- $what {
    12591277        "volume-opacity" {
    1260             set val $_volume(opacity)
     1278            set val $_settings(volume-opacity)
    12611279            set sval [expr { 0.01 * double($val) }]
    1262             foreach dataset [CurrentDatasets -visible $_first] {
     1280            foreach dataset [CurrentDatasets -visible] {
    12631281                SendCmd "polydata opacity $sval $dataset"
    12641282            }
    12651283        }
    12661284        "volume-wireframe" {
    1267             set bool $_volume(wireframe)
    1268             foreach dataset [CurrentDatasets -visible $_first] {
     1285            set bool $_settings(volume-wireframe)
     1286            foreach dataset [CurrentDatasets -visible] {
    12691287                SendCmd "polydata wireframe $bool $dataset"
    12701288            }
    12711289        }
    12721290        "volume-visible" {
    1273             set bool $_volume(visible)
    1274             foreach dataset [CurrentDatasets -visible $_first] {
     1291            set bool $_settings(volume-visible)
     1292            foreach dataset [CurrentDatasets -visible] {
    12751293                SendCmd "polydata visible $bool $dataset"
    12761294            }
     
    12841302        }
    12851303        "volume-lighting" {
    1286             set bool $_volume(lighting)
    1287             foreach dataset [CurrentDatasets -visible $_first] {
     1304            set bool $_settings(volume-lighting)
     1305            foreach dataset [CurrentDatasets -visible] {
    12881306                SendCmd "polydata lighting $bool $dataset"
    12891307            }
    12901308        }
    12911309        "volume-edges" {
    1292             set bool $_volume(edges)
    1293             foreach dataset [CurrentDatasets -visible $_first] {
     1310            set bool $_settings(volume-edges)
     1311            foreach dataset [CurrentDatasets -visible] {
    12941312                SendCmd "polydata edges $bool $dataset"
    12951313            }
    12961314        }
    12971315        "axis-visible" {
    1298             set bool $_axis(visible)
     1316            set bool $_settings(axis-visible)
    12991317            SendCmd "axis visible all $bool"
    13001318        }
    13011319        "axis-labels" {
    1302             set bool $_axis(labels)
     1320            set bool $_settings(axis-labels)
    13031321            SendCmd "axis labels all $bool"
    13041322        }
    1305         "axis-xgrid" {
    1306             set bool $_axis(xgrid)
    1307             SendCmd "axis grid x $bool"
    1308         }
    1309         "axis-ygrid" {
    1310             set bool $_axis(ygrid)
    1311             SendCmd "axis grid y $bool"
    1312         }
    1313         "axis-zgrid" {
    1314             set bool $_axis(zgrid)
    1315             SendCmd "axis grid z $bool"
     1323        "axis-xgrid" - "axis-ygrid" - "axis-zgrid" {
     1324            set axis [string range $what 5 5]
     1325            set bool $_settings($what)
     1326            SendCmd "axis grid $axis $bool"
    13161327        }
    13171328        "axis-mode" {
    13181329            set mode [$itk_component(axismode) value]
    13191330            set mode [$itk_component(axismode) translate $mode]
     1331            set _settings($what) $mode
    13201332            SendCmd "axis flymode $mode"
    13211333        }
    13221334        "cutplane-edges" {
    1323             set bool $_cutplane(edges)
    1324             foreach dataset [CurrentDatasets -visible $_first] {
     1335            set bool $_settings($what)
     1336            foreach dataset [CurrentDatasets -visible] {
    13251337                SendCmd "cutplane edges $bool $dataset"
    13261338            }
    13271339        }
    13281340        "cutplane-visible" {
    1329             set bool $_cutplane(visible)
    1330             foreach dataset [CurrentDatasets -visible $_first] {
     1341            set bool $_settings($what)
     1342            foreach dataset [CurrentDatasets -visible] {
    13311343                SendCmd "cutplane visible $bool $dataset"
    13321344            }
    13331345        }
    13341346        "cutplane-wireframe" {
    1335             set bool $_cutplane(wireframe)
    1336             foreach dataset [CurrentDatasets -visible $_first] {
     1347            set bool $_settings($what)
     1348            foreach dataset [CurrentDatasets -visible] {
    13371349                SendCmd "cutplane wireframe $bool $dataset"
    13381350            }
    13391351        }
    13401352        "cutplane-lighting" {
    1341             set bool $_cutplane(lighting)
    1342             foreach dataset [CurrentDatasets -visible $_first] {
     1353            set bool $_settings($what)
     1354            foreach dataset [CurrentDatasets -visible] {
    13431355                SendCmd "cutplane lighting $bool $dataset"
    13441356            }
    13451357        }
    13461358        "cutplane-opacity" {
    1347             set val $_cutplane(opacity)
     1359            set val $_settings($what)
    13481360            set sval [expr { 0.01 * double($val) }]
    1349             foreach dataset [CurrentDatasets -visible $_first] {
     1361            foreach dataset [CurrentDatasets -visible] {
    13501362                SendCmd "cutplane opacity $sval $dataset"
    13511363            }
    13521364        }
    1353         "xcutplane-visible" - "ycutplane-visible" - "zcutplane-visible" {
    1354             set axis [string range $what 0 0]
    1355             set bool $_cutplane(${axis}visible)
     1365        "cutplane-xvisible" - "cutplane-yvisible" - "cutplane-zvisible" {
     1366            set axis [string range $what 9 9]
     1367            set bool $_settings($what)
    13561368            if { $bool } {
    13571369                $itk_component(${axis}CutScale) configure -state normal \
     
    13641376            SendCmd "cutplane colormode $_colorMode"
    13651377        }
    1366         "xcutplane-position" - "ycutplane-position" - "zcutplane-position" {
    1367             set axis [string range $what 0 0]
    1368             set pos [expr $_cutplane(${axis}position) * 0.01]
     1378        "cutplane-xposition" - "cutplane-yposition" - "cutplane-zposition" {
     1379            set axis [string range $what 9 9]
     1380            set pos [expr $_settings($what) * 0.01]
    13691381            SendCmd "cutplane slice ${axis} ${pos}"
    13701382            set _cutplanePending 0
    13711383        }
    13721384        "streamlines-seeds" {
    1373             set bool $_streamlines(seeds)
    1374             foreach dataset [CurrentDatasets -visible $_first] {
     1385            set bool $_settings($what)
     1386            foreach dataset [CurrentDatasets -visible] {
    13751387                SendCmd "streamlines seed visible $bool $dataset"
    13761388            }
    13771389        }
    1378         "streamlines-seeddensity" {
    1379             set density $_streamlines(seeddensity)
    1380             foreach dataset [CurrentDatasets -visible $_first] {
    1381                 foreach {dataobj comp} [split $dataset -] break
    1382                 # This command works for either random or fmesh seeds
    1383                 SendCmd "streamlines seed numpts $density $dataset"
    1384             }
     1390        "streamlines-numpoints" {
     1391            set density $_settings($what)
     1392            EventuallyReseed $density
    13851393        }
    13861394        "streamlines-visible" {
    1387             set bool $_streamlines(visible)
    1388             foreach dataset [CurrentDatasets -visible $_first] {
     1395            set bool $_settings($what)
     1396            foreach dataset [CurrentDatasets -visible] {
    13891397                SendCmd "streamlines visible $bool $dataset"
    13901398            }
     
    13991407        "streamlines-mode" {
    14001408            set mode [$itk_component(streammode) value]
    1401             foreach dataset [CurrentDatasets -visible $_first] {
     1409            set _settings(streamlines-mode) $mode
     1410            foreach dataset [CurrentDatasets -visible] {
    14021411                switch -- $mode {
    14031412                    "lines" {
     
    14151424        "streamlines-palette" {
    14161425            set palette [$itk_component(palette) value]
     1426            set _settings(streamlines-palette) $palette
    14171427            foreach dataset [CurrentDatasets -visible $_first] {
    14181428                foreach {dataobj comp} [split $dataset -] break
     
    14221432        }
    14231433        "streamlines-opacity" {
    1424             set val $_streamlines(opacity)
     1434            set val $_settings(streamlines-opacity)
    14251435            set sval [expr { 0.01 * double($val) }]
    14261436            foreach dataset [CurrentDatasets -visible $_first] {
     
    14291439        }
    14301440        "streamlines-scale" {
    1431             set val $_streamlines(scale)
     1441            set val $_settings(streamlines-scale)
    14321442            set sval [expr { 0.01 * double($val) }]
    14331443            foreach dataset [CurrentDatasets -visible $_first] {
     
    14361446        }
    14371447        "streamlines-lighting" {
    1438             set bool $_streamlines(lighting)
     1448            set bool $_settings(streamlines-lighting)
    14391449            foreach dataset [CurrentDatasets -visible $_first] {
    1440                 SendCmd "streamlines lighting $bool $dataset"
     1450                SendCmd "streamlines lighting $bool"
    14411451            }
    14421452        }
    14431453        "streamlines-field" {
    14441454            set field [$itk_component(field) value]
    1445             set _colorMode scalar
    1446             set fieldType scalar
    1447             if { $field == "U" } {
     1455            set value [$itk_component(axismode) translate $field]
     1456            set _settings(streamlines-field) $value
     1457            if { [info exists _scalarFields($field)] } {
     1458                set name $_scalarFields($field)
     1459                set colorMode scalar
     1460                set fieldType scalar
     1461            } elseif { [info exists _vectorFields($field)] } {
     1462                set name $_vectorFields($field)
    14481463                set _colorMode vmag
    14491464                set fieldType vector
    1450             }
    1451             foreach dataset [CurrentDatasets -visible $_first] {
    1452                 SendCmd "dataset ${fieldType} ${field} $dataset"
     1465            } else {
     1466                error "unknown field \"$field\""
     1467            }
     1468            foreach dataset [CurrentDatasets -visible] {
     1469                SendCmd "dataset ${fieldType} ${name} $dataset"
    14531470                SendCmd "streamlines colormode $_colorMode $dataset"
    14541471                SendCmd "cutplane colormode $_colorMode $dataset"
     
    14701487#
    14711488itcl::body Rappture::VtkStreamlinesViewer::RequestLegend {} {
    1472     #puts stderr "RequestLegend _first=$_first"
    1473     #puts stderr "RequestLegend width=$_width height=$_height"
    14741489    set font "Arial 8"
    14751490    set lineht [font metrics $font -linespace]
     
    14811496    }
    14821497    # Set the legend on the first streamlines dataset.
    1483     foreach dataset [CurrentDatasets -visible] {
     1498    foreach dataset [CurrentDatasets -visible $_first] {
    14841499        foreach {dataobj comp} [split $dataset -] break
    14851500        if { [info exists _dataset2style($dataset)] } {
    1486             puts stderr "legend $_dataset2style($dataset) $_colorMode {} $w $h 0"
    14871501            SendCmd "legend $_dataset2style($dataset) $_colorMode {} $w $h 0"
    14881502            break;
     
    15361550    if { ![info exists _dataset2style($tag)] ||
    15371551         $_dataset2style($tag) != $name } {
    1538         puts stderr "streamlines colormap $name $tag"
    1539         puts stderr "cutplane colormap $name $tag"
    15401552        SendCmd "streamlines colormap $name $tag"
    15411553        SendCmd "cutplane colormap $name $tag"
     
    17601772        set cmap "0.0 0.0 0.0 0.0 1.0 1.0 1.0 1.0"
    17611773    }
    1762     if { ![info exists _volume(opacity)] } {
    1763         set _volume(opacity) $style(-opacity)
    1764     }
    1765     set max $_volume(opacity)
     1774    if { ![info exists _settings(volume-opacity)] } {
     1775        set _settings(volume-opacity) $style(-opacity)
     1776    }
     1777    set max $_settings(volume-opacity)
    17661778
    17671779    set wmap "0.0 1.0 1.0 1.0"
     
    17911803
    17921804itcl::body Rappture::VtkStreamlinesViewer::limits { dataobj } {
     1805    array set _scalarFields [$dataobj hints scalars]
     1806    array set _vectorFields [$dataobj hints vectors]
     1807    set _currentField [$dataobj hints default]
     1808    foreach name [array names _vectorFields] {
     1809        set value $_vectorFields($name)
     1810        $itk_component(field) choices insert end "$name" "$value"
     1811    }
     1812    foreach name [array names _scalarFields] {
     1813        set value $_scalarFields($name)
     1814        $itk_component(field) choices insert end "$name" "$value"
     1815    }
     1816    $itk_component(field) value $_currentField
     1817    return
    17931818    array unset _limits $dataobj-*
    17941819    foreach comp [$dataobj components] {
     
    18721897    checkbutton $inner.volume \
    18731898        -text "Show Volume" \
    1874         -variable [itcl::scope _volume(visible)] \
     1899        -variable [itcl::scope _settings(volume-visible)] \
    18751900        -command [itcl::code $this AdjustSetting volume-visible] \
    18761901        -font "Arial 9"
     
    18781903    checkbutton $inner.wireframe \
    18791904        -text "Show Wireframe" \
    1880         -variable [itcl::scope _volume(wireframe)] \
     1905        -variable [itcl::scope _settings(volume-wireframe)] \
    18811906        -command [itcl::code $this AdjustSetting volume-wireframe] \
    18821907        -font "Arial 9"
     
    18841909    checkbutton $inner.lighting \
    18851910        -text "Enable Lighting" \
    1886         -variable [itcl::scope _volume(lighting)] \
     1911        -variable [itcl::scope _settings(volume-lighting)] \
    18871912        -command [itcl::code $this AdjustSetting volume-lighting] \
    18881913        -font "Arial 9"
     
    18901915    checkbutton $inner.edges \
    18911916        -text "Show Edges" \
    1892         -variable [itcl::scope _volume(edges)] \
     1917        -variable [itcl::scope _settings(volume-edges)] \
    18931918        -command [itcl::code $this AdjustSetting volume-edges] \
    18941919        -font "Arial 9"
     
    18961921    label $inner.opacity_l -text "Opacity" -font "Arial 9"
    18971922    ::scale $inner.opacity -from 0 -to 100 -orient horizontal \
    1898         -variable [itcl::scope _volume(opacity)] \
     1923        -variable [itcl::scope _settings(volume-opacity)] \
    18991924        -width 10 \
    19001925        -showvalue off \
     
    19261951    checkbutton $inner.streamlines \
    19271952        -text "Show Streamlines" \
    1928         -variable [itcl::scope _streamlines(visible)] \
     1953        -variable [itcl::scope _settings(streamlines-visible)] \
    19291954        -command [itcl::code $this AdjustSetting streamlines-visible] \
    19301955        -font "Arial 9"
     
    19321957    checkbutton $inner.lighting \
    19331958        -text "Enable Lighting" \
    1934         -variable [itcl::scope _streamlines(lighting)] \
     1959        -variable [itcl::scope _settings(streamlines-lighting)] \
    19351960        -command [itcl::code $this AdjustSetting streamlines-lighting] \
    19361961        -font "Arial 9"
     
    19381963    checkbutton $inner.seeds \
    19391964        -text "Show Seeds" \
    1940         -variable [itcl::scope _streamlines(seeds)] \
     1965        -variable [itcl::scope _settings(streamlines-seeds)] \
    19411966        -command [itcl::code $this AdjustSetting streamlines-seeds] \
    19421967        -font "Arial 9"
     
    19551980    label $inner.opacity_l -text "Opacity" -font "Arial 9"
    19561981    ::scale $inner.opacity -from 0 -to 100 -orient horizontal \
    1957         -variable [itcl::scope _streamlines(opacity)] \
     1982        -variable [itcl::scope _settings(streamlines-opacity)] \
    19581983        -width 10 \
    19591984        -showvalue off \
     
    19621987    label $inner.density_l -text "Number of Seeds" -font "Arial 9"
    19631988    ::scale $inner.density -from 1 -to 1000 -orient horizontal \
    1964         -variable [itcl::scope _streamlines(seeddensity)] \
     1989        -variable [itcl::scope _settings(streamlines-numpoints)] \
    19651990        -width 10 \
    19661991        -showvalue on \
    1967         -command [itcl::code $this AdjustSetting streamlines-seeddensity]
     1992        -command [itcl::code $this AdjustSetting streamlines-numpoints]
    19681993
    19691994    label $inner.scale_l -text "Scale" -font "Arial 9"
    19701995    ::scale $inner.scale -from 1 -to 100 -orient horizontal \
    1971         -variable [itcl::scope _streamlines(scale)] \
     1996        -variable [itcl::scope _settings(streamlines-scale)] \
    19721997        -width 10 \
    19731998        -showvalue off \
     
    20392064    checkbutton $inner.visible \
    20402065        -text "Show Axes" \
    2041         -variable [itcl::scope _axis(visible)] \
     2066        -variable [itcl::scope _settings(axis-visible)] \
    20422067        -command [itcl::code $this AdjustSetting axis-visible] \
    20432068        -font "Arial 9"
     
    20452070    checkbutton $inner.labels \
    20462071        -text "Show Axis Labels" \
    2047         -variable [itcl::scope _axis(labels)] \
     2072        -variable [itcl::scope _settings(axis-labels)] \
    20482073        -command [itcl::code $this AdjustSetting axis-labels] \
    20492074        -font "Arial 9"
     
    20512076    checkbutton $inner.gridx \
    20522077        -text "Show X Grid" \
    2053         -variable [itcl::scope _axis(xgrid)] \
     2078        -variable [itcl::scope _settings(axis-xgrid)] \
    20542079        -command [itcl::code $this AdjustSetting axis-xgrid] \
    20552080        -font "Arial 9"
    20562081    checkbutton $inner.gridy \
    20572082        -text "Show Y Grid" \
    2058         -variable [itcl::scope _axis(ygrid)] \
     2083        -variable [itcl::scope _settings(axis-ygrid)] \
    20592084        -command [itcl::code $this AdjustSetting axis-ygrid] \
    20602085        -font "Arial 9"
    20612086    checkbutton $inner.gridz \
    20622087        -text "Show Z Grid" \
    2063         -variable [itcl::scope _axis(zgrid)] \
     2088        -variable [itcl::scope _settings(axis-zgrid)] \
    20642089        -command [itcl::code $this AdjustSetting axis-zgrid] \
    20652090        -font "Arial 9"
     
    21392164    checkbutton $inner.visible \
    21402165        -text "Show Cutplanes" \
    2141         -variable [itcl::scope _cutplane(visible)] \
     2166        -variable [itcl::scope _settings(cutplane-visible)] \
    21422167        -command [itcl::code $this AdjustSetting cutplane-visible] \
    21432168        -font "Arial 9"
     
    21452170    checkbutton $inner.wireframe \
    21462171        -text "Show Wireframe" \
    2147         -variable [itcl::scope _cutplane(wireframe)] \
     2172        -variable [itcl::scope _settings(cutplane-wireframe)] \
    21482173        -command [itcl::code $this AdjustSetting cutplane-wireframe] \
    21492174        -font "Arial 9"
     
    21512176    checkbutton $inner.lighting \
    21522177        -text "Enable Lighting" \
    2153         -variable [itcl::scope _cutplane(lighting)] \
     2178        -variable [itcl::scope _settings(cutplane-lighting)] \
    21542179        -command [itcl::code $this AdjustSetting cutplane-lighting] \
    21552180        -font "Arial 9"
     
    21572182    checkbutton $inner.edges \
    21582183        -text "Show Edges" \
    2159         -variable [itcl::scope _cutplane(edges)] \
     2184        -variable [itcl::scope _settings(cutplane-edges)] \
    21602185        -command [itcl::code $this AdjustSetting cutplane-edges] \
    21612186        -font "Arial 9"
     
    21632188    label $inner.opacity_l -text "Opacity" -font "Arial 9"
    21642189    ::scale $inner.opacity -from 0 -to 100 -orient horizontal \
    2165         -variable [itcl::scope _cutplane(opacity)] \
     2190        -variable [itcl::scope _settings(cutplane-opacity)] \
    21662191        -width 10 \
    21672192        -showvalue off \
    21682193        -command [itcl::code $this AdjustSetting cutplane-opacity]
    2169     $inner.opacity set $_cutplane(opacity)
     2194    $inner.opacity set $_settings(cutplane-opacity)
    21702195
    21712196    # X-value slicer...
     
    21742199            -onimage [Rappture::icon x-cutplane] \
    21752200            -offimage [Rappture::icon x-cutplane] \
    2176             -command [itcl::code $this AdjustSetting xcutplane-visible] \
    2177             -variable [itcl::scope _cutplane(xvisible)]
     2201            -command [itcl::code $this AdjustSetting cutplane-xvisible] \
     2202            -variable [itcl::scope _settings(cutplane-xvisible)]
    21782203    }
    21792204    Rappture::Tooltip::for $itk_component(xCutButton) \
     
    21852210            -borderwidth 1 -highlightthickness 0 \
    21862211            -command [itcl::code $this EventuallySetCutplane x] \
    2187             -variable [itcl::scope _cutplane(xposition)]
     2212            -variable [itcl::scope _settings(cutplane-xposition)]
    21882213    } {
    21892214        usual
     
    21912216    }
    21922217    # Set the default cutplane value before disabling the scale.
    2193     $itk_component(xCutScale) set 100
     2218    $itk_component(xCutScale) set 50
    21942219    $itk_component(xCutScale) configure -state disabled
    21952220    Rappture::Tooltip::for $itk_component(xCutScale) \
     
    22012226            -onimage [Rappture::icon y-cutplane] \
    22022227            -offimage [Rappture::icon y-cutplane] \
    2203             -command [itcl::code $this AdjustSetting ycutplane-visible] \
    2204             -variable [itcl::scope _cutplane(yvisible)]
     2228            -command [itcl::code $this AdjustSetting cutplane-yvisible] \
     2229            -variable [itcl::scope _settings(cutplane-yvisible)]
    22052230    }
    22062231    Rappture::Tooltip::for $itk_component(yCutButton) \
     
    22122237            -borderwidth 1 -highlightthickness 0 \
    22132238            -command [itcl::code $this EventuallySetCutplane y] \
    2214             -variable [itcl::scope _cutplane(yposition)]
     2239            -variable [itcl::scope _settings(cutplane-yposition)]
    22152240    } {
    22162241        usual
     
    22202245        "@[itcl::code $this Slice tooltip y]"
    22212246    # Set the default cutplane value before disabling the scale.
    2222     $itk_component(yCutScale) set 100
     2247    $itk_component(yCutScale) set 50
    22232248    $itk_component(yCutScale) configure -state disabled
    22242249
     
    22282253            -onimage [Rappture::icon z-cutplane] \
    22292254            -offimage [Rappture::icon z-cutplane] \
    2230             -command [itcl::code $this AdjustSetting zcutplane-visible] \
    2231             -variable [itcl::scope _cutplane(zvisible)]
     2255            -command [itcl::code $this AdjustSetting cutplane-zvisible] \
     2256            -variable [itcl::scope _settings(cutplane-zvisible)]
    22322257    }
    22332258    Rappture::Tooltip::for $itk_component(zCutButton) \
     
    22392264            -borderwidth 1 -highlightthickness 0 \
    22402265            -command [itcl::code $this EventuallySetCutplane z] \
    2241             -variable [itcl::scope _cutplane(zposition)]
     2266            -variable [itcl::scope _settings(cutplane-zposition)]
    22422267    } {
    22432268        usual
    22442269        ignore -borderwidth -highlightthickness
    22452270    }
    2246     $itk_component(zCutScale) set 100
     2271    $itk_component(zCutScale) set 50
    22472272    $itk_component(zCutScale) configure -state disabled
    22482273    #$itk_component(zCutScale) configure -state disabled
     
    23962421    set tag $dataobj-$comp
    23972422    set style [$dataobj style $comp]
    2398     #puts stderr "style $dataobj-$comp \"$style\""
    2399     if { $dataobj != $_first } {
    2400         set settings(-wireframe) 1
    2401     }
    24022423    array set settings {
    24032424        -color \#808080
     
    24122433        -visible 1
    24132434    }
     2435    if { $dataobj != $_first } {
     2436        set settings(-opacity) 1
     2437    }
    24142438    array set settings $style
    24152439    SendCmd "streamlines add $tag"
     
    24292453    SendCmd "cutplane linewidth 1 $tag"
    24302454    #SendCmd "cutplane linecolor 1 1 1 $tag"
    2431     #puts stderr "cutplane axis $axis $bool"
    24322455    #SendCmd "cutplane visible $tag"
    24332456    foreach axis { x y z } {
     
    24382461    SendCmd "polydata add $tag"
    24392462    SendCmd "polydata edges $settings(-edges) $tag"
    2440     set _volume(edges) $settings(-edges)
     2463    set _settings(volume-edges) $settings(-edges)
    24412464    SendCmd "polydata color [Color2RGB $settings(-color)] $tag"
    24422465    SendCmd "polydata lighting $settings(-lighting) $tag"
    2443     set _volume(lighting) $settings(-lighting)
     2466    set _settings(volume-lighting) $settings(-lighting)
    24442467    SendCmd "polydata linecolor [Color2RGB $settings(-edgecolor)] $tag"
    24452468    SendCmd "polydata linewidth $settings(-linewidth) $tag"
    24462469    SendCmd "polydata opacity $settings(-opacity) $tag"
    2447     set _volume(opacity) $settings(-opacity)
     2470    set _settings(volume-opacity) $settings(-opacity)
    24482471    SendCmd "polydata wireframe $settings(-wireframe) $tag"
    2449     set _volume(wireframe) $settings(-wireframe)
    2450     set _volume(opacity) [expr $settings(-opacity) * 100.0]
     2472    set _settings(volume-wireframe) $settings(-wireframe)
     2473    set _settings(volume-opacity) [expr $settings(-opacity) * 100.0]
    24512474    SetColormap $dataobj $comp
    24522475}
     
    24962519   
    24972520    regsub {\(mag\)} $title "" title
    2498     if { $_settings(legend) } {
     2521    if { $_settings(legend-visible) } {
    24992522        set x [expr $w - 2]
    25002523        if { [$c find withtag "legend"] == "" } {
     
    25932616    # Compute the value of the point
    25942617    set t [expr 1.0 - (double($imgY) / double($imgHeight-1))]
    2595     #puts stderr "t=$t x=$x y=$y imgY=$imgY"
    25962618    set value [expr $t * ($_limits(vmax) - $_limits(vmin)) + $_limits(vmin)]
    25972619    set tipx [expr $x + 15]
    25982620    set tipy [expr $y - 5]
    2599     #puts stderr "tipx=$tipx tipy=$tipy x=$x y=$y"
    26002621    Rappture::Tooltip::text $c "$_title $value"
    26012622    Rappture::Tooltip::tooltip show $c +$tipx,+$tipy   
     
    26152636        "move" {
    26162637            set axis [lindex $args 0]
    2617             set oldval $_axis(${axis}position)
     2638            set oldval $_settings(axis-${axis}position)
    26182639            set newval [lindex $args 1]
    26192640            if {[llength $args] != 2} {
     
    26332654    }
    26342655}
     2656
     2657proc name { mesg } {
     2658    SendBytes $mesg
     2659}
     2660
     2661
     2662 
Note: See TracChangeset for help on using the changeset viewer.