Changeset 4579 for branches/1.3


Ignore:
Timestamp:
Jul 31, 2014, 3:36:41 PM (5 years ago)
Author:
gah
Message:

don't treat value from resultset as a list, add new layers image.

Location:
branches/1.3/gui/scripts
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • branches/1.3/gui/scripts/nanovisviewer.tcl

    r4568 r4579  
    121121    private method Rotate {option x y}
    122122    private method SendTransferFunctions {}
     123    private method SetObjectStyle { dataobj cname }
    123124    private method SetOrientation { side }
    124125    private method Slice {option args}
     
    150151    private variable _settings
    151152    private variable _alphamap
     153    private variable _widget
    152154
    153155    private variable _first "" ;        # This is the topmost volume.
     
    222224        -axesvisible            1
    223225        -background             black
    224         -colormap               default
     226        -colormap               "default"
    225227        -cutplanesvisible       0
    226228        -gridvisible            0
     
    229231        -light                  40
    230232        -light2side             1
    231         -opacity                50
    232233        -outlinevisible         0
    233234        -qw                     0.853553
     
    237238        -thickness              350
    238239        -volume                 1
     240        -volumeopacity          0.5
    239241        -volumevisible          1
    240242        -xcutplaneposition      50
     
    247249        -zcutplanevisible       1
    248250        -zoom                   1.0
     251    }
     252    array set _widget {
     253        -volumeopacity          0.5
    249254    }
    250255    itk_component add 3dview {
     
    555560itcl::body Rappture::NanovisViewer::scale {args} {
    556561    array set styles {
    557         -color BCGYR
    558         -levels 6
    559         -markers ""
     562        -color    BCGYR
     563        -levels   6
     564        -markers  ""
    560565    }
    561566    array unset _limits
     
    892897        DoResize
    893898    }
     899
    894900    foreach dataobj [get] {
    895901        foreach cname [$dataobj components] {
     
    927933                set _serverDatasets($tag) 0
    928934            }
    929             NameTransferFunction $dataobj $cname
    930         }
    931     }
     935            SetObjectStyle $dataobj $cname
     936        }
     937    }
     938
     939    # Outline seems to need to be reset every update.
     940    InitSettings -outlinevisible -cutplanesvisible -current
     941
    932942    set _first [lindex [get] 0]
    933943    if { $_reset } {
     
    956966        }
    957967
    958         InitSettings -light2side -light -opacity \
     968        InitSettings -light2side -light -volumeopacity \
    959969            -isosurfaceshading -gridvisible -axesvisible \
    960             -current
    961970
    962971        if {"" != $_first} {
     
    971980        }
    972981    }
    973     # Outline seems to need to be reset every update.
    974     InitSettings -outlinevisible -cutplanesvisible
     982
    975983    # nothing to send -- activate the proper ivol
    976984    SendCmd "volume state 0"
     
    12621270        }
    12631271        "-light" {
    1264             # Other parts of the code use the light setting to
    1265             # tell if the component settings have been initialized
    1266             if { ![info exists _settings($_current${what})] } {
    1267                 InitComponentSettings $_current
    1268             }
    12691272            set _settings($_current${what}) $_settings($what)
    12701273            set val $_settings($what)
     
    12871290            }
    12881291        }
    1289         "-opacity" {
    1290             set _settings($_current${what}) $_settings($what)
    1291             set val [expr $_settings($what) * 0.01]
    1292             foreach tag [GetDatasetsWithComponent $_current] {
    1293                 SendCmd "volume shading opacity $val $tag"
    1294             }
    1295         }
    12961292        "-outlinevisible" {
    12971293            SendCmd "volume outline state $_settings($what)"
     
    13141310            }
    13151311            set _settings(-volumevisible) $bool
     1312        }
     1313        "-volumeopacity" {
     1314            set _settings($what) [expr $_widget($what) * 0.01]
     1315            set _settings($_current${what}) $_settings($what)
     1316            foreach tag [GetDatasetsWithComponent $_current] {
     1317                SendCmd "volume shading opacity $_settings($what) $tag"
     1318            }
    13161319        }
    13171320        "-volumevisible" {
     
    17031706    label $inner.fog -text "Clear" -font $fg
    17041707    ::scale $inner.transp -from 0 -to 100 -orient horizontal \
    1705         -variable [itcl::scope _settings(-opacity)] \
     1708        -variable [itcl::scope _widget(-volumeopacity)] \
    17061709        -width 10 \
    1707         -showvalue off -command [itcl::code $this AdjustSetting -opacity]
     1710        -showvalue off -command [itcl::code $this AdjustSetting -volumeopacity]
    17081711    label $inner.plastic -text "Opaque" -font $fg
    17091712
     
    20902093# InitComponentSettings --
    20912094#
    2092 #       Initializes the volume settings for a specific component. This
    2093 #       should match what's used as global settings above. This
    2094 #       is called the first time we try to switch to a given component
    2095 #       in SwitchComponent below.
     2095#    Initializes the volume settings for a specific component. This should
     2096#    match what's used as global settings above. This is called the first
     2097#    time we try to switch to a given component in SwitchComponent below.
    20962098#
    20972099itcl::body Rappture::NanovisViewer::InitComponentSettings { cname } {
    2098     # Expanding component name for key.
    2099     array set _settings [subst {
    2100         $cname-colormap          default
    2101         $cname-light             40
    2102         $cname-light2side        1
    2103         $cname-opacity           50
    2104         $cname-thickness         350
    2105         $cname-volumevisible     1
    2106     }]
     2100    foreach {key value} {
     2101        -colormap          "default"
     2102        -light             40
     2103        -light2side        1
     2104        -thickness         350
     2105        -volumeopacity     0.5
     2106        -volumevisible     1
     2107    } {
     2108        if { ![info exists _settings($cname${key})] } {
     2109            # Don't override existing component settings
     2110            set _settings($cname{key}) $value
     2111        }
     2112    }
    21072113}
    21082114
     
    21102116# SwitchComponent --
    21112117#
    2112 #       This is called when the current component is changed by the
    2113 #       dropdown menu in the volume tab.  It synchronizes the global
    2114 #       volume settings with the settings of the new current component.
     2118#    This is called when the current component is changed by the dropdown
     2119#    menu in the volume tab.  It synchronizes the global volume settings
     2120#    with the settings of the new current component.
    21152121#
    21162122itcl::body Rappture::NanovisViewer::SwitchComponent { cname } {
     
    21222128    set _settings(-light)            $_settings($cname-light)
    21232129    set _settings(-light2side)       $_settings($cname-light2side)
    2124     set _settings(-opacity)          $_settings($cname-opacity)
     2130    set _settings(-volumeopacity)    $_settings($cname-volumeopacity)
    21252131    set _settings(-thickness)        $_settings($cname-thickness)
    21262132    set _settings(-volumevisible)    $_settings($cname-volumevisible)
    21272133    $itk_component(colormap) value   $_settings($cname-colormap)
     2134
     2135    set _widget(-volumeopacity) [expr $_settings(-volumeopacity) * 100.0]
     2136
    21282137    set _current $cname;                # Reset the current component
    21292138}
     
    21322141# BuildVolumeComponents --
    21332142#
    2134 #       This is called from the "scale" method which is called when a
    2135 #       new dataset is added or deleted.  It repopulates the dropdown
    2136 #       menu of volume component names.  It sets the current component
    2137 #       to the first component in the list (of components found).
    2138 #       Finally, if there is only one component, don't display the
    2139 #       label or the combobox in the volume settings tab.
     2143#    This is called from the "scale" method which is called when a new
     2144#    dataset is added or deleted.  It repopulates the dropdown menu of
     2145#    volume component names.  It sets the current component to the first
     2146#    component in the list (of components found).  Finally, if there is
     2147#    only one component, don't display the label or the combobox in the
     2148#    volume settings tab.
    21402149#
    21412150itcl::body Rappture::NanovisViewer::BuildVolumeComponents {} {
     
    21632172# GetDatasetsWithComponents --
    21642173#
    2165 #       Returns a list of all the datasets (known by the combination of
    2166 #       their data object and component name) that match the given
    2167 #       component name.  For example, this is used where we want to change
    2168 #       the settings of volumes that have the current component.
     2174#     Returns a list of all the datasets (known by the combination of their
     2175#     data object and component name) that match the given component name.
     2176#     For example, this is used where we want to change the settings of
     2177#     volumes that have the current component.
    21692178#
    21702179itcl::body Rappture::NanovisViewer::GetDatasetsWithComponent { cname } {
     
    21852194# HideAllMarkers --
    21862195#
    2187 #       Hide all the markers in all the transfer functions.  Can't simply
    2188 #       delete and recreate markers from the <style> since the user may
    2189 #       have create, deleted, or moved markers.
     2196#   Hide all the markers in all the transfer functions.  Can't simply
     2197#   delete and recreate markers from the <style> since the user may have
     2198#   create, deleted, or moved markers.
    21902199#
    21912200itcl::body Rappture::NanovisViewer::HideAllMarkers {} {
     
    24542463
    24552464
     2465itcl::body Rappture::NanovisViewer::SetObjectStyle { dataobj cname } {
     2466    array set styles {
     2467        -opacity  0.6
     2468    }
     2469    array set styles [lindex [$dataobj components -style $cname] 0]
     2470    set _settings($cname-volumeopacity) $styles(-opacity)
     2471    NameTransferFunction $dataobj $cname
     2472}
     2473
     2474
     2475
     2476
  • branches/1.3/gui/scripts/resultselector.tcl

    r4215 r4579  
    12951295            foreach col [lrange [$_resultset diff names] 1 end] {
    12961296                set quantity $_cntlInfo($this-$col-label)
    1297                 set val [lindex [$_resultset get $col $xmlobj] 0]
     1297
     1298                # Don't know why this was being treated as a list.
     1299                #set val [lindex [$_resultset get $col $xmlobj] 0]
     1300
     1301                set val [$_resultset get $col $xmlobj]
    12981302                append desc "$quantity = $val\n"
    12991303            }
Note: See TracChangeset for help on using the changeset viewer.