Changeset 4192


Ignore:
Timestamp:
Feb 25, 2014 11:07:30 AM (10 years ago)
Author:
gah
Message:

bug fix: handle -color in <style>

Location:
trunk/gui/scripts
Files:
2 edited

Legend:

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

    r4191 r4192  
    6767    public proc SetServerList { namelist } {
    6868        Rappture::VisViewer::SetServerList "nanovis" $namelist
    69     }
    70     public method ViewToQuaternion {} {
    71         return [list $_view(-qw) $_view(-qx) $_view(-qy) $_view(-qz)]
    7269    }
    7370    public method add {dataobj {settings ""}}
     
    131128    private method ToggleVolume { tag name }
    132129    private method RemoveMarker { x y }
     130    private method ViewToQuaternion {} {
     131        return [list $_view(-qw) $_view(-qx) $_view(-qy) $_view(-qz)]
     132    }
    133133
    134134    private variable _arcball ""
  • trunk/gui/scripts/vtkvolumeviewer.tcl

    r4188 r4192  
    8181    private method SwitchComponent { cname }
    8282    private method RemoveMarker { x y }
     83    private method ViewToQuaternion {} {
     84        return [list $_view(-qw) $_view(-qx) $_view(-qy) $_view(-qz)]
     85    }
     86    private method QuaternionToView { q } {
     87        foreach { _view(-qw) _view(-qx) _view(-qy) _view(-qz) } $q break
     88    }
    8389
    8490    private variable _current "";       # Currently selected component
     
    207213    $_dispatcher register !xcutplane
    208214    $_dispatcher dispatch $this !xcutplane \
    209         "[itcl::code $this AdjustSetting cutplanePositionX]; list"
     215        "[itcl::code $this AdjustSetting -xcutplaneposition]; list"
    210216
    211217    # Y-Cutplane event
    212218    $_dispatcher register !ycutplane
    213219    $_dispatcher dispatch $this !ycutplane \
    214         "[itcl::code $this AdjustSetting cutplanePositionY]; list"
     220        "[itcl::code $this AdjustSetting -ycutplaneposition]; list"
    215221
    216222    # Z-Cutplane event
    217223    $_dispatcher register !zcutplane
    218224    $_dispatcher dispatch $this !zcutplane \
    219         "[itcl::code $this AdjustSetting cutplanePositionZ]; list"
     225        "[itcl::code $this AdjustSetting -xcutplaneposition]; list"
    220226
    221227    #
     
    228234    # Initialize the view to some default parameters.
    229235    array set _view {
    230         qw              0.853553
    231         qx              -0.353553
    232         qy              0.353553
    233         qz              0.146447
    234         zoom            1.0
    235         xpan            0
    236         ypan            0
    237         ortho           0
     236        -qw              0.853553
     237        -qx              -0.353553
     238        -qy              0.353553
     239        -qz              0.146447
     240        -zoom            1.0
     241        -xpan            0
     242        -ypan            0
     243        -ortho           0
    238244    }
    239245    set _arcball [blt::arcball create 100 100]
    240     set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)]
    241     $_arcball quaternion $q
     246    $_arcball quaternion [ViewToQuaternion]
    242247
    243248    array set _settings {
    244         axesVisible             1
    245         axisGridX               0
    246         axisGridY               0
    247         axisGridZ               0
    248         axisLabels              1
    249         background              black
    250         cutplaneEdges           0
    251         cutplaneLighting        1
    252         cutplaneOpacity         100
    253         cutplanePositionX       50
    254         cutplanePositionY       50
    255         cutplanePositionZ       50
    256         cutplaneVisible         0
    257         cutplaneVisibleX        1
    258         cutplaneVisibleY        1
    259         cutplaneVisibleZ        1
    260         cutplaneWireframe       0
    261         legendVisible           1
    262         outline                 0
    263         volumeAmbient           40
    264         volumeBlendMode         composite
    265         volumeDiffuse           60
    266         volumeLighting          1
    267         volumeOpacity           50
    268         volumeQuality           80
    269         volumeSpecularExponent  90
    270         volumeSpecularLevel     30
    271         volumeThickness         350
    272         volumeVisible           1
     249        -background                     black
     250        -axesvisible                    1
     251        -axislabelsvisible              1
     252        -cutplaneedgesvisible           0
     253        -cutplanelighting               1
     254        -cutplaneopacity                100
     255        -cutplanesvisible               0
     256        -cutplanewireframe              0
     257        -legendvisible                  1
     258        -volumeambient                  40
     259        -volumeblendmode                composite
     260        -volumediffuse                  60
     261        -volumeedgesvisible             0
     262        -volumelighting                 1
     263        -volumeopacity                  50
     264        -volumeoutline                  0
     265        -volumeoutline                  0
     266        -volumequality                  80
     267        -volumespecularexponent         90
     268        -volumespecularlevel            30
     269        -volumethickness                350
     270        -volumevisible                  1
     271        -xcutplaneposition              50
     272        -xcutplanevisible               1
     273        -xgridvisible                   0
     274        -xgridvisible                   0
     275        -ycutplaneposition              50
     276        -ycutplanevisible               1
     277        -ygridvisible                   0
     278        -zcutplaneposition              50
     279        -zcutplanevisible               1
    273280    }
    274281
     
    349356            -onimage [Rappture::icon volume-on] \
    350357            -offimage [Rappture::icon volume-off] \
    351             -variable [itcl::scope _settings(volumeVisible)] \
    352             -command [itcl::code $this AdjustSetting volumeVisible]
     358            -variable [itcl::scope _settings(-volumevisible)] \
     359            -command [itcl::code $this AdjustSetting -volumevisible]
    353360    }
    354361    $itk_component(volume) select
     
    361368            -onimage [Rappture::icon cutbutton] \
    362369            -offimage [Rappture::icon cutbutton] \
    363             -variable [itcl::scope _settings(cutplaneVisible)] \
    364             -command [itcl::code $this AdjustSetting cutplaneVisible]
     370            -variable [itcl::scope _settings(-cutplanesvisible)] \
     371            -command [itcl::code $this AdjustSetting -cutplanesvisible]
    365372    }
    366373    Rappture::Tooltip::for $itk_component(cutplane) \
     
    491498
    492499itcl::body Rappture::VtkVolumeViewer::DoRotate {} {
    493     set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)]
    494     SendCmd "camera orient $q"
     500    SendCmd "camera orient [ViewToQuaternion]"
    495501    set _rotatePending 0
    496502}
     
    516522
    517523itcl::body Rappture::VtkVolumeViewer::EventuallyRotate { q } {
    518     foreach { _view(qw) _view(qx) _view(qy) _view(qz) } $q break
     524    QuaternionToView $q
    519525    if { !$_rotatePending } {
    520526        set _rotatePending 1
     
    684690# ----------------------------------------------------------------------
    685691itcl::body Rappture::VtkVolumeViewer::scale {args} {
    686     array set style {
    687         -color BCGYR
    688         -levels 6
    689         -opacity 1.0
    690         -markers ""
    691     }
    692692    array unset _limits
    693693    array unset _volcomponents
     
    10161016        # Reset the camera and other view parameters
    10171017        #
    1018         set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)]
    1019         $_arcball quaternion $q
    1020         if {$_view(ortho)} {
     1018        $_arcball quaternion [ViewToQuaternion]
     1019        if {$_view(-ortho)} {
    10211020            SendCmd "camera mode ortho"
    10221021        } else {
     
    10241023        }
    10251024        DoRotate
    1026         InitSettings outline background \
    1027             axisGridX axisGridY axisGridZ axisFlyMode \
    1028             axesVisible axisLabels
     1025        InitSettings -volumeoutline -background \
     1026            -xgridvisible -ygridvisible -zgridvisible -axisflymode \
     1027            -axesvisible -axislabelsvisible
    10291028        PanCamera
    10301029    }
     
    11221121    }
    11231122
    1124     InitSettings volumeColormap \
    1125         volumeAmbient volumeDiffuse volumeSpecularLevel volumeSpecularExponent \
    1126         volumeBlendMode volumeThickness \
    1127         volumeOpacity volumeQuality volumeVisible \
    1128         cutplaneVisible \
    1129         cutplanePositionX cutplanePositionY cutplanePositionZ \
    1130         cutplaneVisibleX cutplaneVisibleY cutplaneVisibleZ
     1123    InitSettings -color \
     1124        -volumeambient -volumediffuse -volumespecularlevel \
     1125        -volumespecularexponent -volumeblendmode -volumethickness \
     1126        -volumeopacity -volumequality -volumevisible \
     1127        -cutplanesvisible \
     1128        -xcutplaneposition -ycutplaneposition -zcutplaneposition \
     1129        -xcutplanevisible -ycutplanevisible -zcutplanevisible
    11311130
    11321131    if { $_reset } {
    1133         InitSettings volumeLighting
     1132        InitSettings -volumelighting
    11341133        SendCmd "camera reset"
    1135         SendCmd "camera zoom $_view(zoom)"
     1134        SendCmd "camera zoom $_view(-zoom)"
    11361135        RequestLegend
    11371136        set _reset 0
     
    12001199    switch -- $option {
    12011200        "in" {
    1202             set _view(zoom) [expr {$_view(zoom)*1.25}]
    1203             SendCmd "camera zoom $_view(zoom)"
     1201            set _view(-zoom) [expr {$_view(-zoom)*1.25}]
     1202            SendCmd "camera zoom $_view(-zoom)"
    12041203        }
    12051204        "out" {
    1206             set _view(zoom) [expr {$_view(zoom)*0.8}]
    1207             SendCmd "camera zoom $_view(zoom)"
     1205            set _view(-zoom) [expr {$_view(-zoom)*0.8}]
     1206            SendCmd "camera zoom $_view(-zoom)"
    12081207        }
    12091208        "reset" {
    12101209            array set _view {
    1211                 qw      0.853553
    1212                 qx      -0.353553
    1213                 qy      0.353553
    1214                 qz      0.146447
    1215                 zoom    1.0
    1216                 xpan   0
    1217                 ypan   0
     1210                -qw      0.853553
     1211                -qx      -0.353553
     1212                -qy      0.353553
     1213                -qz      0.146447
     1214                -zoom    1.0
     1215                -xpan   0
     1216                -ypan   0
    12181217            }
    12191218            if { $_first != "" } {
     
    12231222                }
    12241223            }
    1225             set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)]
    1226             $_arcball quaternion $q
     1224            $_arcball quaternion [ViewToQuaternion]
    12271225            DoRotate
    12281226            SendCmd "camera reset"
     
    12321230
    12331231itcl::body Rappture::VtkVolumeViewer::PanCamera {} {
    1234     set x $_view(xpan)
    1235     set y $_view(ypan)
     1232    set x $_view(-xpan)
     1233    set y $_view(-ypan)
    12361234    SendCmd "camera pan $x $y"
    12371235}
     
    13111309            set x [expr $x / double($w)]
    13121310            set y [expr $y / double($h)]
    1313             set _view(xpan) [expr $_view(xpan) + $x]
    1314             set _view(ypan) [expr $_view(ypan) + $y]
     1311            set _view(-xpan) [expr $_view(-xpan) + $x]
     1312            set _view(-ypan) [expr $_view(-ypan) + $y]
    13151313            PanCamera
    13161314            return
     
    13341332            set _click(x) $x
    13351333            set _click(y) $y
    1336             set _view(xpan) [expr $_view(xpan) - $dx]
    1337             set _view(ypan) [expr $_view(ypan) - $dy]
     1334            set _view(-xpan) [expr $_view(-xpan) - $dx]
     1335            set _view(-ypan) [expr $_view(-ypan) - $dy]
    13381336            PanCamera
    13391337        }
     
    13571355itcl::body Rappture::VtkVolumeViewer::InitSettings { args } {
    13581356    foreach spec $args {
    1359         if { [info exists _settings($_first-$spec)] } {
     1357        if { [info exists _settings($_first${spec})] } {
    13601358            # Reset global setting with dataobj specific setting
    1361             set _settings($spec) $_settings($_first-$spec)
     1359            set _settings($spec) $_settings($_first${spec})
    13621360        }
    13631361        AdjustSetting $spec
     
    13811379    }
    13821380    switch -- $what {
    1383         "background" {
     1381        "-background" {
    13841382            set bgcolor [$itk_component(background) value]
     1383            set _settings(${what}) $bgcolor
    13851384            array set fgcolors {
    13861385                "black" "white"
     
    13931392            DrawLegend
    13941393        }
    1395         "outline" {
    1396             set bool $_settings(outline)
     1394        "-volumeoutline" {
     1395            set bool $_settings(${what})
    13971396            SendCmd "outline visible 0"
    13981397            foreach tag [GetDatasetsWithComponent $_current] {
     
    14001399            }
    14011400        }
    1402         "legendVisible" {
    1403             set bool $_settings(legendVisible)
    1404             set _settings($_current-legendVisible) $bool
    1405         }
    1406         "volumeVisible" {
    1407             set bool $_settings(volumeVisible)
    1408             set _settings($_current-volumeVisible) $bool
     1401        "-legendvisible" {
     1402            set bool $_settings(${what})
     1403            set _settings($_current${what}) $bool
     1404            if { $bool } {
     1405                blt::table $itk_component(plotarea) \
     1406                    1,0 $itk_component(legend) -fill x
     1407            } else {
     1408                blt::table forget $itk_component(legend)
     1409            }
     1410        }
     1411        "-volumevisible" {
     1412            set bool $_settings(${what})
     1413            set _settings($_current${what}) $bool
    14091414            # Only the data objects in the array _obj2ovride(*-raise) are
    14101415            # in the working set and can be displayed on screen. The global
     
    14291434            }
    14301435        }
    1431         "volumeBlendMode" {
     1436        "-volumeblendmode" {
    14321437            set val [$itk_component(blendmode) value]
    14331438            set mode [$itk_component(blendmode) translate $val]
    1434             set _settings(volumeBlendMode) $mode
    1435             set _settings($_current-volumeBlendMode) $mode
     1439            set _settings(${what}) $mode
     1440            set _settings($_current${what}) $mode
    14361441            foreach tag [GetDatasetsWithComponent $_current] {
    14371442                SendCmd "volume blendmode $mode $tag"
    14381443            }
    14391444        }
    1440         "volumeAmbient" {
    1441             set val $_settings(volumeAmbient)
    1442             set _settings($_current-volumeAmbient) $val
     1445        "-volumeambient" {
     1446            set val $_settings(${what})
     1447            set _settings($_current${what}) $val
    14431448            set ambient [expr {0.01*$val}]
    14441449            foreach tag [GetDatasetsWithComponent $_current] {
     
    14461451            }
    14471452        }
    1448         "volumeDiffuse" {
    1449             set val $_settings(volumeDiffuse)
    1450             set _settings($_current-volumeDiffuse) $val
     1453        "-volumediffuse" {
     1454            set val $_settings(${what})
     1455            set _settings($_current${what}) $val
    14511456            set diffuse [expr {0.01*$val}]
    14521457            foreach tag [GetDatasetsWithComponent $_current] {
     
    14541459            }
    14551460        }
    1456         "volumeSpecularLevel" - "volumeSpecularExponent" {
    1457             set val $_settings(volumeSpecularLevel)
    1458             set _settings($_current-volumeSpecularLevel) $val
     1461        "-volumespecularlevel" - "-volumespecularexponent" {
     1462            set val $_settings(${what})
     1463            set _settings($_current${what}) $val
    14591464            set level [expr {0.01*$val}]
    1460             set exp $_settings(volumeSpecularExponent)
     1465            set exp $_settings(${what})
    14611466            foreach tag [GetDatasetsWithComponent $_current] {
    14621467                SendCmd "volume shading specular $level $exp $tag"
    14631468            }
    14641469        }
    1465         "volumeLighting" {
    1466             set bool $_settings(volumeLighting)
    1467             set _settings($_current-volumeLighting) $bool
     1470        "-volumelighting" {
     1471            set bool $_settings($what)
     1472            set _settings($_current{$what}) $bool
    14681473            foreach tag [GetDatasetsWithComponent $_current] {
    14691474                SendCmd "volume lighting $bool $tag"
    14701475            }
    14711476        }
    1472         "volumeOpacity" {
    1473             set val $_settings(volumeOpacity)
    1474             set _settings($_current-volumeOpacity) $val
     1477        "-volumeopacity" {
     1478            set val $_settings(${what})
     1479            set _settings($_current${what}) $val
    14751480            set val [expr {0.01*$val}]
    14761481            foreach tag [GetDatasetsWithComponent $_current] {
     
    14781483            }
    14791484        }
    1480         "volumeQuality" {
    1481             set val $_settings(volumeQuality)
    1482             set _settings($_current-volumeQuality) $val
     1485        "-volumequality" {
     1486            set val $_settings(${what})
     1487            set _settings($_current${what}) $val
    14831488            set val [expr {0.01*$val}]
    14841489            foreach tag [GetDatasetsWithComponent $_current] {
     
    14861491            }
    14871492        }
    1488         "axesVisible" {
    1489             set bool $_settings(axesVisible)
     1493        "-axesvisible" {
     1494            set bool $_settings(${what})
    14901495            SendCmd "axis visible all $bool"
    14911496        }
    1492         "axisLabels" {
    1493             set bool $_settings(axisLabels)
     1497        "-axislabelsvisible" {
     1498            set bool $_settings(${what})
    14941499            SendCmd "axis labels all $bool"
    14951500        }
    1496         "axisGridX" - "axisGridY" - "axisGridZ" {
    1497             set axis [string tolower [string range $what end end]]
    1498             set bool $_settings($what)
     1501        "-xgridvisible" - "-ygridvisible" - "-zgridvisible" {
     1502            set axis [string tolower [string range $what 1 1 ]]
     1503            set bool $_settings(${what})
    14991504            SendCmd "axis grid $axis $bool"
    15001505        }
    1501         "axisFlyMode" {
     1506        "-axisflymode" {
    15021507            set mode [$itk_component(axismode) value]
    15031508            set mode [$itk_component(axismode) translate $mode]
    1504             set _settings($what) $mode
     1509            set _settings(${what}) $mode
    15051510            SendCmd "axis flymode $mode"
    15061511        }
    1507         "cutplaneEdges" {
    1508             set bool $_settings($what)
     1512        "-cutplaneedgesvisible" {
     1513            set bool $_settings(${what})
    15091514            foreach dataset [CurrentDatasets -visible] {
    15101515                if {$_cutplaneCmd != "imgcutplane"} {
     
    15131518            }
    15141519        }
    1515         "cutplaneWireframe" {
    1516             set bool $_settings($what)
     1520        "-cutplanewireframe" {
     1521            set bool $_settings(${what})
    15171522            foreach dataset [CurrentDatasets -visible] {
    15181523                if {$_cutplaneCmd != "imgcutplane"} {
     
    15211526            }
    15221527        }
    1523         "cutplaneVisible" {
    1524             set bool $_settings($what)
     1528        "-cutplanesvisible" {
     1529            set bool $_settings(${what})
    15251530            foreach dataset [CurrentDatasets -visible] {
    15261531                SendCmd "$_cutplaneCmd visible $bool $dataset"
    15271532            }
    15281533        }
    1529         "cutplaneLighting" {
    1530             set bool $_settings($what)
     1534        "-cutplanelighting" {
     1535            set bool $_settings(${what})
    15311536            foreach dataset [CurrentDatasets -visible] {
    15321537                if {$_cutplaneCmd != "imgcutplane"} {
     
    15441549            }
    15451550        }
    1546         "cutplaneOpacity" {
    1547             set val $_settings($what)
     1551        "-cutplaneopacity" {
     1552            set val $_settings(${what})
    15481553            set sval [expr { 0.01 * double($val) }]
    15491554            foreach dataset [CurrentDatasets -visible] {
     
    15511556            }
    15521557        }
    1553         "cutplaneVisibleX" - "cutplaneVisibleY" - "cutplaneVisibleZ" {
    1554             set axis [string tolower [string range $what end end]]
    1555             set bool $_settings($what)
     1558        "-xcutplanevisible" - "-ycutplanevisible" - "-zcutplanevisible" {
     1559            set axis [string tolower [string range $what 1 1]]
     1560            set bool $_settings(${what})
    15561561            if { $bool } {
    15571562                $itk_component(${axis}CutScale) configure -state normal \
     
    15651570            }
    15661571        }
    1567         "cutplanePositionX" - "cutplanePositionY" - "cutplanePositionZ" {
    1568             set axis [string tolower [string range $what end end]]
    1569             set pos [expr $_settings($what) * 0.01]
     1572        "-xcutplaneposition" - "-ycutplaneposition" - "-zcutplaneposition" {
     1573            set axis [string tolower [string range $what 1 1]]
     1574            set pos [expr $_settings(${what}) * 0.01]
    15701575            foreach dataset [CurrentDatasets -visible] {
    15711576                SendCmd "$_cutplaneCmd slice ${axis} ${pos} $dataset"
     
    15731578            set _cutplanePending 0
    15741579        }
    1575         "volumeThickness" {
    1576             set _settings($_current-volumeThickness) $_settings(volumeThickness)
     1580        "-volumethickness" {
     1581            set _settings($_current${what}) $_settings(${what})
    15771582            updateTransferFunctions
    15781583        }
    1579         "volumeColormap" {
     1584        "-color" {
    15801585            set color [$itk_component(colormap) value]
    1581             set _settings(colormap) $color
    1582             set _settings($_current-colormap) $color
     1586            set _settings(${what}) $color
     1587            set _settings($_current${what}) $color
    15831588            ResetColormap $_current $color
    15841589        }
    1585         "field" {
     1590        "-field" {
    15861591            set label [$itk_component(field) value]
    15871592            set fname [$itk_component(field) translate $label]
    1588             set _settings(field) $fname
     1593            set _settings(${what}) $fname
    15891594            if { [info exists _fields($fname)] } {
    15901595                foreach { label units components } $_fields($fname) break
     
    16661671
    16671672itcl::body Rappture::VtkVolumeViewer::BuildViewTab {} {
    1668     foreach { key value } {
    1669         grid            0
    1670         axes            1
    1671         outline         0
    1672         volume          1
    1673         legend          1
    1674         particles       1
    1675         lic             1
    1676     } {
    1677         set _settings($this-$key) $value
    1678     }
    16791673
    16801674    set fg [option get $itk_component(hull) font Font]
     
    16881682    checkbutton $inner.axes \
    16891683        -text "Axes" \
    1690         -variable [itcl::scope _settings(axesVisible)] \
    1691         -command [itcl::code $this AdjustSetting axesVisible] \
     1684        -variable [itcl::scope _settings(-axesvisible)] \
     1685        -command [itcl::code $this AdjustSetting -axesvisible] \
    16921686        -font "Arial 9"
    16931687
    16941688    checkbutton $inner.outline \
    16951689        -text "Outline" \
    1696         -variable [itcl::scope _settings(outline)] \
    1697         -command [itcl::code $this AdjustSetting outline] \
     1690        -variable [itcl::scope _settings(-volumeoutline)] \
     1691        -command [itcl::code $this AdjustSetting -volumeoutline] \
    16981692        -font "Arial 9"
    16991693
    17001694    checkbutton $inner.legend \
    17011695        -text "Legend" \
    1702         -variable [itcl::scope _settings(legendVisible)] \
    1703         -command [itcl::code $this AdjustSetting legendVisible] \
     1696        -variable [itcl::scope _settings(-legendvisible)] \
     1697        -command [itcl::code $this AdjustSetting -legendvisible] \
    17041698        -font "Arial 9"
    17051699
    17061700    checkbutton $inner.volume \
    17071701        -text "Volume" \
    1708         -variable [itcl::scope _settings(volumeVisible)] \
    1709         -command [itcl::code $this AdjustSetting volumeVisible] \
     1702        -variable [itcl::scope _settings(-volumevisible)] \
     1703        -command [itcl::code $this AdjustSetting -volumevisible] \
    17101704        -font "Arial 9"
    17111705
     
    17191713        "grey"               "grey"             
    17201714
    1721     $itk_component(background) value $_settings(background)
    1722     bind $inner.background <<Value>> [itcl::code $this AdjustSetting background]
     1715    $itk_component(background) value $_settings(-background)
     1716    bind $inner.background <<Value>> \
     1717        [itcl::code $this AdjustSetting -background]
    17231718
    17241719    blt::table $inner \
     
    17491744    $itk_component(volcomponents) value "BCGYR"
    17501745    bind $inner.volcomponents <<Value>> \
    1751         [itcl::code $this AdjustSetting current]
     1746        [itcl::code $this AdjustSetting -current]
    17521747
    17531748    checkbutton $inner.visibility \
    17541749        -text "Visible" \
    17551750        -font $font \
    1756         -variable [itcl::scope _settings(volumeVisible)] \
    1757         -command [itcl::code $this AdjustSetting volumeVisible]
     1751        -variable [itcl::scope _settings(-volumevisible)] \
     1752        -command [itcl::code $this AdjustSetting -volumevisible]
    17581753
    17591754    label $inner.lighting_l \
     
    17641759        -text "Enable Lighting" \
    17651760        -font $font \
    1766         -variable [itcl::scope _settings(volumeLighting)] \
    1767         -command [itcl::code $this AdjustSetting volumeLighting]
     1761        -variable [itcl::scope _settings(-volumelighting)] \
     1762        -command [itcl::code $this AdjustSetting -volumelighting]
    17681763
    17691764    label $inner.ambient_l \
     
    17711766        -font $font
    17721767    ::scale $inner.ambient -from 0 -to 100 -orient horizontal \
    1773         -variable [itcl::scope _settings(volumeAmbient)] \
    1774         -showvalue off -command [itcl::code $this AdjustSetting volumeAmbient] \
     1768        -variable [itcl::scope _settings(-volumeambient)] \
     1769        -showvalue off \
     1770        -command [itcl::code $this AdjustSetting -volumeambient] \
    17751771        -troughcolor grey92
    17761772
    17771773    label $inner.diffuse_l -text "Diffuse" -font $font
    17781774    ::scale $inner.diffuse -from 0 -to 100 -orient horizontal \
    1779         -variable [itcl::scope _settings(volumeDiffuse)] \
    1780         -showvalue off -command [itcl::code $this AdjustSetting volumeDiffuse] \
     1775        -variable [itcl::scope _settings(-volumediffuse)] \
     1776        -showvalue off \
     1777        -command [itcl::code $this AdjustSetting -volumediffuse] \
    17811778        -troughcolor grey92
    17821779
    17831780    label $inner.specularLevel_l -text "Specular" -font $font
    17841781    ::scale $inner.specularLevel -from 0 -to 100 -orient horizontal \
    1785         -variable [itcl::scope _settings(volumeSpecularLevel)] \
    1786         -showvalue off -command [itcl::code $this AdjustSetting volumeSpecularLevel] \
     1782        -variable [itcl::scope _settings(-volumespecularlevel)] \
     1783        -showvalue off \
     1784        -command [itcl::code $this AdjustSetting -volumespecularlevel] \
    17871785        -troughcolor grey92
    17881786
    17891787    label $inner.specularExponent_l -text "Shininess" -font $font
    17901788    ::scale $inner.specularExponent -from 10 -to 128 -orient horizontal \
    1791         -variable [itcl::scope _settings(volumeSpecularExponent)] \
    1792         -showvalue off -command [itcl::code $this AdjustSetting volumeSpecularExponent] \
     1789        -variable [itcl::scope _settings(-volumespecularexponent)] \
     1790        -showvalue off \
     1791        -command [itcl::code $this AdjustSetting -volumespecularexponent] \
    17931792        -troughcolor grey92
    17941793
    17951794    label $inner.opacity_l -text "Opacity" -font $font
    17961795    ::scale $inner.opacity -from 0 -to 100 -orient horizontal \
    1797         -variable [itcl::scope _settings(volumeOpacity)] \
    1798         -showvalue off -command [itcl::code $this AdjustSetting volumeOpacity] \
     1796        -variable [itcl::scope _settings(-volumeopacity)] \
     1797        -showvalue off \
     1798        -command [itcl::code $this AdjustSetting -volumeopacity] \
    17991799        -troughcolor grey92
    18001800
    18011801    label $inner.quality_l -text "Quality" -font $font
    18021802    ::scale $inner.quality -from 0 -to 100 -orient horizontal \
    1803         -variable [itcl::scope _settings(volumeQuality)] \
    1804         -showvalue off -command [itcl::code $this AdjustSetting volumeQuality] \
     1803        -variable [itcl::scope _settings(-volumequality)] \
     1804        -showvalue off \
     1805        -command [itcl::code $this AdjustSetting -volumequality] \
    18051806        -troughcolor grey92
    18061807
     
    18101811    }
    18111812    bind $inner.field <<Value>> \
    1812         [itcl::code $this AdjustSetting field]
     1813        [itcl::code $this AdjustSetting -field]
    18131814
    18141815    label $inner.transferfunction_l \
     
    18171818    label $inner.thin -text "Thin" -font $font
    18181819    ::scale $inner.thickness -from 0 -to 1000 -orient horizontal \
    1819         -variable [itcl::scope _settings(volumeThickness)] \
    1820         -showvalue off -command [itcl::code $this AdjustSetting volumeThickness] \
     1820        -variable [itcl::scope _settings(-volumethickness)] \
     1821        -showvalue off \
     1822        -command [itcl::code $this AdjustSetting -volumethickness] \
    18211823        -troughcolor grey92
    18221824
    18231825    label $inner.thick -text "Thick" -font $font
    1824     $inner.thickness set $_settings(volumeThickness)
     1826    $inner.thickness set $_settings(-volumethickness)
    18251827
    18261828    label $inner.colormap_l -text "Colormap" -font $font
     
    18481850    $itk_component(colormap) value "BCGYR"
    18491851    bind $inner.colormap <<Value>> \
    1850         [itcl::code $this AdjustSetting volumeColormap]
     1852        [itcl::code $this AdjustSetting -color]
    18511853
    18521854    label $inner.blendmode_l -text "Blend Mode" -font $font
     
    18591861        "additive"           "Additive"
    18601862
    1861     $itk_component(blendmode) value "[$itk_component(blendmode) label $_settings(volumeBlendMode)]"
     1863    $itk_component(blendmode) value \
     1864        "[$itk_component(blendmode) label $_settings(-volumeblendmode)]"
    18621865    bind $inner.blendmode <<Value>> \
    1863         [itcl::code $this AdjustSetting volumeBlendMode]
     1866        [itcl::code $this AdjustSetting -volumeblendmode]
    18641867
    18651868    blt::table $inner \
     
    19101913    checkbutton $inner.visible \
    19111914        -text "Show Axes" \
    1912         -variable [itcl::scope _settings(axesVisible)] \
    1913         -command [itcl::code $this AdjustSetting axesVisible] \
     1915        -variable [itcl::scope _settings(-axesvisible)] \
     1916        -command [itcl::code $this AdjustSetting -axesvisible] \
    19141917        -font "Arial 9"
    19151918
    19161919    checkbutton $inner.labels \
    19171920        -text "Show Axis Labels" \
    1918         -variable [itcl::scope _settings(axisLabels)] \
    1919         -command [itcl::code $this AdjustSetting axisLabels] \
     1921        -variable [itcl::scope _settings(-axislabelsvisiboe)] \
     1922        -command [itcl::code $this AdjustSetting -axislabelsvisible] \
    19201923        -font "Arial 9"
    19211924
    19221925    checkbutton $inner.gridx \
    19231926        -text "Show X Grid" \
    1924         -variable [itcl::scope _settings(axisGridX)] \
    1925         -command [itcl::code $this AdjustSetting axisGridX] \
     1927        -variable [itcl::scope _settings(-xgridvisible)] \
     1928        -command [itcl::code $this AdjustSetting -xgridvisible] \
    19261929        -font "Arial 9"
    19271930    checkbutton $inner.gridy \
    19281931        -text "Show Y Grid" \
    1929         -variable [itcl::scope _settings(axisGridY)] \
    1930         -command [itcl::code $this AdjustSetting axisGridY] \
     1932        -variable [itcl::scope _settings(-ygridvisible)] \
     1933        -command [itcl::code $this AdjustSetting -ygridvisible] \
    19311934        -font "Arial 9"
    19321935    checkbutton $inner.gridz \
    19331936        -text "Show Z Grid" \
    1934         -variable [itcl::scope _settings(axisGridZ)] \
    1935         -command [itcl::code $this AdjustSetting axisGridZ] \
     1937        -variable [itcl::scope _settings(-zgridvisible)] \
     1938        -command [itcl::code $this AdjustSetting -zgridvisible] \
    19361939        -font "Arial 9"
    19371940
     
    19831986    set row 1
    19841987
    1985     set labels { qx qy qz qw xpan ypan zoom }
     1988    set labels { -qx -qy -qz -qw -xpan -ypan -zoom }
    19861989    foreach tag $labels {
    19871990        label $inner.${tag}label -text $tag -font "Arial 9"
     
    19982001    checkbutton $inner.ortho \
    19992002        -text "Orthographic Projection" \
    2000         -variable [itcl::scope _view(ortho)] \
     2003        -variable [itcl::scope _view(-ortho)] \
    20012004        -command [itcl::code $this camera set ortho] \
    20022005        -font "Arial 9"
     
    20232026    checkbutton $inner.visible \
    20242027        -text "Show Cutplanes" \
    2025         -variable [itcl::scope _settings(cutplaneVisible)] \
    2026         -command [itcl::code $this AdjustSetting cutplaneVisible] \
     2028        -variable [itcl::scope _settings(-cutplanesvisible)] \
     2029        -command [itcl::code $this AdjustSetting -cutplanesvisible] \
    20272030        -font "Arial 9"
    20282031
    20292032    checkbutton $inner.wireframe \
    20302033        -text "Show Wireframe" \
    2031         -variable [itcl::scope _settings(cutplaneWireframe)] \
    2032         -command [itcl::code $this AdjustSetting cutplaneWireframe] \
     2034        -variable [itcl::scope _settings(-cutplanewireframe)] \
     2035        -command [itcl::code $this AdjustSetting -cutplanewireframe] \
    20332036        -font "Arial 9"
    20342037
    20352038    checkbutton $inner.lighting \
    20362039        -text "Enable Lighting" \
    2037         -variable [itcl::scope _settings(cutplaneLighting)] \
    2038         -command [itcl::code $this AdjustSetting cutplaneLighting] \
     2040        -variable [itcl::scope _settings(-cutplanelighting)] \
     2041        -command [itcl::code $this AdjustSetting -cutplanelighting] \
    20392042        -font "Arial 9"
    20402043
    20412044    checkbutton $inner.edges \
    20422045        -text "Show Edges" \
    2043         -variable [itcl::scope _settings(cutplaneEdges)] \
    2044         -command [itcl::code $this AdjustSetting cutplaneEdges] \
     2046        -variable [itcl::scope _settings(-cutplaneedgesvisible)] \
     2047        -command [itcl::code $this AdjustSetting -cutplaneedgesvisible] \
    20452048        -font "Arial 9"
    20462049
    20472050    label $inner.opacity_l -text "Opacity" -font "Arial 9"
    20482051    ::scale $inner.opacity -from 0 -to 100 -orient horizontal \
    2049         -variable [itcl::scope _settings(cutplaneOpacity)] \
     2052        -variable [itcl::scope _settings(-cutplaneopacity)] \
    20502053        -width 10 \
    20512054        -showvalue off \
    2052         -command [itcl::code $this AdjustSetting cutplaneOpacity]
    2053     $inner.opacity set $_settings(cutplaneOpacity)
     2055        -command [itcl::code $this AdjustSetting -cutplaneopacity]
     2056    $inner.opacity set $_settings(-cutplaneopacity)
    20542057
    20552058    # X-value slicer...
     
    20582061            -onimage [Rappture::icon x-cutplane] \
    20592062            -offimage [Rappture::icon x-cutplane] \
    2060             -command [itcl::code $this AdjustSetting cutplaneVisibleX] \
    2061             -variable [itcl::scope _settings(cutplaneVisibleX)]
     2063            -command [itcl::code $this AdjustSetting -xcutplanevisible] \
     2064            -variable [itcl::scope _settings(-xcutplanevisible)]
    20622065    }
    20632066    Rappture::Tooltip::for $itk_component(xCutButton) \
     
    20702073            -borderwidth 1 -highlightthickness 0 \
    20712074            -command [itcl::code $this EventuallySetCutplane x] \
    2072             -variable [itcl::scope _settings(cutplanePositionX)]
     2075            -variable [itcl::scope _settings(-xcutplaneposition)]
    20732076    } {
    20742077        usual
     
    20862089            -onimage [Rappture::icon y-cutplane] \
    20872090            -offimage [Rappture::icon y-cutplane] \
    2088             -command [itcl::code $this AdjustSetting cutplaneVisibleY] \
    2089             -variable [itcl::scope _settings(cutplaneVisibleY)]
     2091            -command [itcl::code $this AdjustSetting -ycutplanevisible] \
     2092            -variable [itcl::scope _settings(-ycutplanevisible)]
    20902093    }
    20912094    Rappture::Tooltip::for $itk_component(yCutButton) \
     
    20982101            -borderwidth 1 -highlightthickness 0 \
    20992102            -command [itcl::code $this EventuallySetCutplane y] \
    2100             -variable [itcl::scope _settings(cutplanePositionY)]
     2103            -variable [itcl::scope _settings(-ycutplaneposition)]
    21012104    } {
    21022105        usual
     
    21142117            -onimage [Rappture::icon z-cutplane] \
    21152118            -offimage [Rappture::icon z-cutplane] \
    2116             -command [itcl::code $this AdjustSetting cutplaneVisibleZ] \
    2117             -variable [itcl::scope _settings(cutplaneVisibleZ)]
     2119            -command [itcl::code $this AdjustSetting -zcutplanevisible] \
     2120            -variable [itcl::scope _settings(-zcutplanevisible)]
    21182121    }
    21192122    Rappture::Tooltip::for $itk_component(zCutButton) \
     
    21262129            -borderwidth 1 -highlightthickness 0 \
    21272130            -command [itcl::code $this EventuallySetCutplane z] \
    2128             -variable [itcl::scope _settings(cutplanePositionZ)]
     2131            -variable [itcl::scope _settings(-zcutplaneposition)]
    21292132    } {
    21302133        usual
     
    21702173            }
    21712174            switch -- $who {
    2172                 "ortho" {
    2173                     if {$_view(ortho)} {
     2175                "-ortho" {
     2176                    if {$_view(-ortho)} {
    21742177                        SendCmd "camera mode ortho"
    21752178                    } else {
     
    21772180                    }
    21782181                }
    2179                 "xpan" - "ypan" {
     2182                "-xpan" - "-ypan" {
    21802183                    PanCamera
    21812184                }
    2182                 "qx" - "qy" - "qz" - "qw" {
    2183                     set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)]
     2185                "-qx" - "-qy" - "-qz" - "-qw" {
     2186                    set q [ViewToQuaternion]
    21842187                    $_arcball quaternion $q
    21852188                    EventuallyRotate $q
    21862189                }
    2187                 "zoom" {
    2188                     SendCmd "camera zoom $_view(zoom)"
     2190                "-zoom" {
     2191                    SendCmd "camera zoom $_view(-zoom)"
    21892192                }
    21902193            }
     
    22592262    # Parse style string.
    22602263    set tag $dataobj-$cname
    2261     set style [$dataobj style $cname]
    2262     array set settings {
    2263         -color \#808080
    2264         -edges 0
    2265         -edgecolor black
    2266         -linewidth 1.0
    2267         -opacity 0.4
    2268         -wireframe 0
    2269         -lighting 1
    2270         -visible 1
     2264    array set styles {
     2265        -color BCGYR
     2266        -volumeedgesvisible     0
     2267        -volumeedgecolor        black
     2268        -volumelinewidth        1.0
     2269        -volumewireframe        0
     2270        -volumelighting         1
     2271        -volumevisible          1
     2272        -volumeoutline          0
    22712273    }
    22722274    if { $dataobj != $_first } {
    2273         set settings(-opacity) 1
    2274     }
    2275     array set settings $style
     2275        set style(-opacity) 1
     2276    }
     2277    array set styles [$dataobj style $cname]
    22762278    SendCmd "volume add $tag"
     2279    set _settings($cname-volumewireframe)       $styles(-volumewireframe)
     2280    set _settings($cname-volumeedgesvisible)    $styles(-volumeedgesvisible)
     2281    set _settings($cname-volumeoutline)         $styles(-volumeoutline)
     2282    set _settings($cname-volumelighting)        $styles(-volumelighting)
     2283    set _settings($cname-volumevisible)         $styles(-volumevisible)
     2284
     2285    $itk_component(colormap) value $styles(-color)
     2286
    22772287    SendCmd "$_cutplaneCmd add $tag"
    22782288    SendCmd "$_cutplaneCmd visible 0 $tag"
    2279     SendCmd "volume lighting $settings(-lighting) $tag"
    2280     set _settings(volumeLighting) $settings(-lighting)
     2289    SendCmd "volume lighting $styles(-volumelighting) $tag"
    22812290    SetInitialTransferFunction $dataobj $cname
    22822291    SendCmd "volume colormap $cname $tag"
    22832292    SendCmd "$_cutplaneCmd colormap $cname-opaque $tag"
    22842293    SendCmd "outline add $tag"
    2285     SendCmd "outline visible 0 $tag"
     2294    SendCmd "outline visible $styles(-volumeoutline) $tag"
    22862295}
    22872296
     
    23872396        set title $fname
    23882397    }
    2389     if { $_settings(legendVisible) } {
     2398    if { $_settings(-legendvisible) } {
    23902399        set x [expr $w - 2]
    23912400        if { [$c find withtag "legend"] == "" } {
     
    26742683
    26752684    if { ![info exists _parsedFunction($cname)] || ![info exists _cname2transferFunction($cname)] } {
    2676         array set style {
     2685        array set styles {
    26772686            -color BCGYR
    26782687            -levels 6
     
    26802689            -markers ""
    26812690        }
    2682 
    26832691        # Accumulate the style from all the datasets using it.
    26842692        foreach tag [GetDatasetsWithComponent $cname] {
    26852693            foreach {dataobj cname} [split [lindex $tag 0] -] break
    2686             array set style [lindex [$dataobj components -style $cname] 0]
    2687         }
    2688         set cmap [ColorsToColormap $style(-color)]
     2694            set option [lindex [$dataobj components -style $cname] 0]
     2695            array set styles $option
     2696        }
     2697        set _settings($cname-color) $styles(-color)
     2698        set _settings($cname-volumeopacity) $styles(-opacity)
     2699        set cmap [ColorsToColormap $styles(-color)]
    26892700        set _cname2defaultcolormap($cname) $cmap
    2690         set _settings($cname-colormap) $style(-color)
    26912701        if { [info exists _transferFunctionEditors($cname)] } {
    26922702            eval $_transferFunctionEditors($cname) limits $_limits($cname)
    26932703        }
    2694         if { [info exists style(-markers)] &&
    2695              [llength $style(-markers)] > 0 } {
    2696             ParseMarkersOption $cname $style(-markers)
     2704        if { [info exists styles(-markers)] &&
     2705             [llength $styles(-markers)] > 0 } {
     2706            ParseMarkersOption $cname $styles(-markers)
    26972707        } else {
    2698             ParseLevelsOption $cname $style(-levels)
     2708            ParseLevelsOption $cname $styles(-levels)
    26992709        }
    27002710    } else {
     
    27672777        bottom "0.707107 0.707107 0 0"
    27682778    }
    2769     foreach name { qw qx qy qz } value $positions($side) {
     2779    foreach name { -qw -qx -qy -qz } value $positions($side) {
    27702780        set _view($name) $value
    27712781    }
    2772     set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)]
     2782    set q [ViewToQuaternion]
    27732783    $_arcball quaternion $q
    27742784    SendCmd "camera orient $q"
    27752785    SendCmd "camera reset"
    2776     set _view(xpan) 0
    2777     set _view(ypan) 0
    2778     set _view(zoom) 1.0
    2779     set _settings($this-xpan) $_view(xpan)
    2780     set _settings($this-ypan) $_view(ypan)
    2781     set _settings($this-zoom) $_view(zoom)
     2786    set _view(-xpan) 0
     2787    set _view(-ypan) 0
     2788    set _view(-zoom) 1.0
    27822789}
    27832790
     
    27922799itcl::body Rappture::VtkVolumeViewer::InitComponentSettings { cname } {
    27932800    array set _settings [subst {
    2794         $cname-colormap                 default
     2801        $cname-color                    default
    27952802        $cname-light2side               1
    2796         $cname-outline                  0
    2797         $cname-volumeAmbient            40
    2798         $cname-volumeBlendMode          composite
    2799         $cname-volumeDiffuse            60
    2800         $cname-volumeLighting           1
    2801         $cname-volumeOpacity            50
    2802         $cname-volumeQuality            80
    2803         $cname-volumeSpecularExponent   90
    2804         $cname-volumeSpecularLevel      30
    2805         $cname-volumeThickness          350
    2806         $cname-volumeVisible            1
     2803        $cname-volumeoutline            0
     2804        $cname-volumeambient            40
     2805        $cname-volumeblendmode          composite
     2806        $cname-volumediffuse            60
     2807        $cname-volumelighting           1
     2808        $cname-volumeopacity            50
     2809        $cname-volumequality            80
     2810        $cname-volumespecularexponent   90
     2811        $cname-volumespecularlevel      30
     2812        $cname-volumethickness          350
     2813        $cname-volumevisible            1
    28072814    }]
    28082815}
     
    28162823#
    28172824itcl::body Rappture::VtkVolumeViewer::SwitchComponent { cname } {
    2818     if { ![info exists _settings(${cname}-volumeAmbient)] } {
     2825    if { ![info exists _settings(${cname}-volumeambient)] } {
    28192826        InitComponentSettings $cname
    28202827    }
    28212828    # _settings variables change widgets, except for colormap
    28222829    foreach name {
    2823         light2side             
    2824         outline                 
    2825         volumeAmbient           
    2826         volumeBlendMode         
    2827         volumeDiffuse           
    2828         volumeLighting         
    2829         volumeOpacity           
    2830         volumeQuality           
    2831         volumeSpecularExponent 
    2832         volumeSpecularLevel     
    2833         volumeThickness         
    2834         volumeVisible           
     2830        -volumelight2side             
     2831        -volumeoutline                 
     2832        -volumeambient           
     2833        -volumeblendmode         
     2834        -volumediffuse           
     2835        -volumelighting         
     2836        -volumeopacity           
     2837        -volumequality           
     2838        -volumespecularexponent 
     2839        -volumespecularlevel     
     2840        -volumethickness         
     2841        -volumevisible           
    28352842    } {
    28362843        set _settings($name) $_settings(${cname}-${name})
    28372844    }
    2838     $itk_component(colormap) value        $_settings($cname-colormap)
     2845    $itk_component(colormap) value        $_settings($cname-color)
    28392846    set _current $cname;                # Reset the current component
    28402847}
     
    28442851        return [list 0.0 0.0 1.0 1.0]
    28452852    }
    2846     if { ![info exists _settings($cname-volumeAmbient)] } {
     2853    if { ![info exists _settings($cname-volumeambient)] } {
    28472854        InitComponentSettings $cname
    28482855    }
     
    28542861    # settings widgets) are used for the active transfer-function.  Update
    28552862    # the values in the _settings varible.
    2856     set opacity [expr { double($_settings($cname-volumeOpacity)) * 0.01 }]
     2863    set opacity [expr { double($_settings($cname-volumeopacity)) * 0.01 }]
    28572864
    28582865    # Scale values between 0.00001 and 0.01000
    2859     set delta [expr {double($_settings($cname-volumeThickness)) * 0.0001}]
     2866    set delta [expr {double($_settings($cname-volumethickness)) * 0.0001}]
    28602867    set first [lindex $isovalues 0]
    28612868    set last [lindex $isovalues end]
Note: See TracChangeset for help on using the changeset viewer.