Changeset 3948 for trunk/gui


Ignore:
Timestamp:
Sep 23, 2013 11:21:27 AM (11 years ago)
Author:
gah
Message:

don't display component dropdown if there's only one component.

Location:
trunk/gui/scripts
Files:
2 edited

Legend:

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

    r3940 r3948  
    926926                close $f
    927927            }
     928            # This is temporary.  I put a check for this in the DxToVtk
     929            # parser. 
     930            if { [string range $contents  0 3] == "<DX>" } {
     931                set contents [string range $contents 4 end]
     932            }
    928933            if { [catch { Rappture::DxToVtk $contents } vtkdata] == 0 } {
    929934                set vector [ReadVtkDataSet $cname $vtkdata]
     
    936941                close $f
    937942            }
    938             if { $_viewer != "nanovis" } {
     943            if { $_viewer != "nanovis" && $_viewer != "flowvis" } {
    939944                set _type "vtk"
    940945                set _comp2vtk($cname) $vtkdata
  • trunk/gui/scripts/nanovisviewer.tcl

    r3946 r3948  
    130130
    131131    private variable _dlist ""     ;# list of data objects
    132     private variable _allDataObjs
    133132    private variable _obj2ovride   ;# maps dataobj => style override
    134133    private variable _serverDatasets   ;# contains all the dataobj-component
     
    231230        $this-transp            50
    232231        $this-volume            1
     232        $this-volumeVisible     1
    233233        $this-xcutplane         1
    234234        $this-xcutposition      0
     
    240240        $this-zcutposition      0
    241241        $this-zoom              $_view(zoom)   
    242         $this-volumeVisible     1
    243242    }]
    244243
     
    448447    if {$pos < 0} {
    449448        lappend _dlist $dataobj
    450         set _allDataObjs($dataobj) 1
    451449        set _obj2ovride($dataobj-color) $params(-color)
    452450        set _obj2ovride($dataobj-width) $params(-width)
     
    806804    $c coords title [expr {$w/2}] $ly
    807805
    808 
    809806    # The colormap may have changed. Resync the slicers with the colormap.
    810807    set datasets [CurrentDatasets -cutplanes]
    811     SendCmd "volume data state $_settings($this-volume) $datasets"
    812808
    813809    # Adjust the cutplane for only the first component in the topmost volume
     
    13241320        }
    13251321        "volume" {
    1326             set datasets [CurrentDatasets -cutplanes]
    1327             SendCmd "volume data state $_settings($this-volume) $datasets"
     1322            # This is the global volume visibility control.  It controls the
     1323            # visibility of all the all volumes.  Whenever it's changed, you
     1324            # have to synchronize each of the local controls (see below) with
     1325            # this.
     1326            set datasets [CurrentDatasets]
     1327            set bool $_settings($this-volume)
     1328            SendCmd "volume data state $bool $datasets"
     1329            foreach cname $_componentsList {
     1330                set _settings($cname-volumeVisible) $bool
     1331            }
     1332            set _settings($this-volumeVisible) $bool
    13281333        }
    13291334        "volumeVisible" {
     1335            # This is the component specific control.  It changes the
     1336            # visibility of only the current component.
    13301337            set _settings($_current-volumeVisible) \
    13311338                $_settings($this-volumeVisible)
     
    16721679    #set bfont [option get $itk_component(hull) boldFont Font]
    16731680
    1674     label $inner.shading_l -text "Lighting" -font "Arial 9 bold"
     1681    label $inner.lighting_l \
     1682        -text "Lighting / Material Properties" \
     1683        -font "Arial 9 bold"
    16751684
    16761685    checkbutton $inner.light2side \
     
    16911700    ::scale $inner.ambient -from 0 -to 100 -orient horizontal \
    16921701        -variable [itcl::scope _settings($this-ambient)] \
    1693         -showvalue off -command [itcl::code $this AdjustSetting ambient]
     1702        -showvalue off -command [itcl::code $this AdjustSetting ambient] \
     1703        -troughcolor grey92
    16941704
    16951705    label $inner.diffuse_l -text "Diffuse" -font $font
    16961706    ::scale $inner.diffuse -from 0 -to 100 -orient horizontal \
    16971707        -variable [itcl::scope _settings($this-diffuse)] \
    1698         -showvalue off -command [itcl::code $this AdjustSetting diffuse]
     1708        -showvalue off -command [itcl::code $this AdjustSetting diffuse] \
     1709        -troughcolor grey92
    16991710
    17001711    label $inner.specularLevel_l -text "Specular" -font $font
    17011712    ::scale $inner.specularLevel -from 0 -to 100 -orient horizontal \
    17021713        -variable [itcl::scope _settings($this-specularLevel)] \
    1703         -showvalue off -command [itcl::code $this AdjustSetting specularLevel]
     1714        -showvalue off -command [itcl::code $this AdjustSetting specularLevel] \
     1715        -troughcolor grey92
    17041716
    17051717    label $inner.specularExponent_l -text "Shininess" -font $font
     
    17071719        -variable [itcl::scope _settings($this-specularExponent)] \
    17081720        -showvalue off \
    1709         -command [itcl::code $this AdjustSetting specularExponent]
     1721        -command [itcl::code $this AdjustSetting specularExponent] \
     1722        -troughcolor grey92
    17101723
    17111724    label $inner.transp_l -text "Opacity" -font $font
    17121725    ::scale $inner.transp -from 0 -to 100 -orient horizontal \
    17131726        -variable [itcl::scope _settings($this-transp)] \
    1714         -showvalue off -command [itcl::code $this AdjustSetting transp]
    1715 
    1716     label $inner.tf -text "Transfer Function" -font "Arial 9 bold"
     1727        -showvalue off -command [itcl::code $this AdjustSetting transp] \
     1728        -troughcolor grey92
     1729
     1730    label $inner.transferfunction_l \
     1731        -text "Transfer Function" -font "Arial 9 bold"
    17171732
    17181733    label $inner.thin -text "Thin" -font $font
    17191734    ::scale $inner.thickness -from 0 -to 1000 -orient horizontal \
    17201735        -variable [itcl::scope _settings($this-thickness)] \
    1721         -showvalue off -command [itcl::code $this AdjustSetting thickness]
     1736        -showvalue off -command [itcl::code $this AdjustSetting thickness] \
     1737        -troughcolor grey92
     1738
    17221739    label $inner.thick -text "Thick" -font $font
    17231740
     
    17611778
    17621779    blt::table $inner \
    1763         0,1 $inner.volcomponents_l -anchor e \
     1780        0,0 $inner.volcomponents_l -anchor e -cspan 2 \
    17641781        0,2 $inner.volcomponents             -cspan 3 -fill x \
    1765         1,0 $inner.shading_l -anchor w -cspan 5 \
     1782        1,1 $inner.lighting_l -anchor w -cspan 4 \
    17661783        2,1 $inner.ambient_l       -anchor e -pady 2 \
    17671784        2,2 $inner.ambient                   -cspan 3 -fill x \
     
    17741791        6,1 $inner.light2side -cspan 3 -anchor w \
    17751792        7,1 $inner.visibility -cspan 3 -anchor w \
    1776         8,0 $inner.tf -anchor w              -cspan 5 \
     1793        8,1 $inner.transferfunction_l -anchor w              -cspan 4 \
    17771794        9,1 $inner.transp_l -anchor e -pady 2 \
    17781795        9,2 $inner.transp                    -cspan 3 -fill x \
    17791796        10,1 $inner.colormap_l       -anchor e \
    1780         10,2 $inner.colormap                  -cspan 3 -fill x \
     1797        10,2 $inner.colormap                  -padx 2 -cspan 3 -fill x \
    17811798        11,1 $inner.thin             -anchor e \
    17821799        11,2 $inner.thickness                 -cspan 2 -fill x \
     
    21222139
    21232140
     2141#
     2142# InitComponentSettings --
     2143#
     2144#       Initializes the volume settings for a specific component. This
     2145#       should match what's used as global settings above. This
     2146#       is called the first time we try to switch to a given component
     2147#       in SwitchComponent below.
     2148#
    21242149itcl::body Rappture::NanovisViewer::InitComponentSettings { cname } {
    21252150    array set _settings [subst {
    2126         $cname-ambient           20
     2151        $cname-ambient           60
    21272152        $cname-colormap          default
    2128         $cname-diffuse           80
     2153        $cname-diffuse           40
    21292154        $cname-light2side        1
    21302155        $cname-opacity           100
     
    21382163}
    21392164
    2140 # Reset global settings from dataset's settings.
     2165#
     2166# SwitchComponent --
     2167#
     2168#       This is called when the current component is changed by the
     2169#       dropdown menu in the volume tab.  It synchronizes the global
     2170#       volume settings with the settings of the new current component.
     2171#
    21412172itcl::body Rappture::NanovisViewer::SwitchComponent { cname } {
    21422173    if { ![info exists _settings($cname-ambient)] } {
     
    21592190}
    21602191
    2161 # Reset global settings from dataset's settings.
     2192#
     2193# BuildVolumeComponents --
     2194#
     2195#       This is called from the "scale" method which is called when a
     2196#       new dataset is added or deleted.  It repopulates the dropdown
     2197#       menu of volume component names.  It sets the current component
     2198#       to the first component in the list (of components found).
     2199#       Finally, if there is only one component, don't display the
     2200#       label or the combobox in the volume settings tab.
     2201#
    21622202itcl::body Rappture::NanovisViewer::BuildVolumeComponents {} {
    21632203    $itk_component(volcomponents) choices delete 0 end
     
    21672207    set _current [lindex $_componentsList 0]
    21682208    $itk_component(volcomponents) value $_current
    2169 }
    2170 
    2171 # Reset global settings from dataset's settings.
     2209    set parent [winfo parent $itk_component(volcomponents)]
     2210    if { [llength $_componentsList] <= 1 } {
     2211        # Unpack the components label and dropdown if there's only one
     2212        # component.
     2213        blt::table forget $parent.volcomponents_l $parent.volcomponents
     2214    } else {
     2215        # Pack the components label and dropdown into the table there's
     2216        # more than one component to select.
     2217        blt::table $parent \
     2218            0,0 $parent.volcomponents_l -anchor e -cspan 2 \
     2219            0,2 $parent.volcomponents -cspan 3 -fill x
     2220    }
     2221}
     2222
     2223#
     2224# GetDatasetsWithComponents --
     2225#
     2226#       Returns a list of all the datasets (known by the combination of
     2227#       their data object and component name) that match the given
     2228#       component name.  For example, this is used where we want to change
     2229#       the settings of volumes that have the current component.
     2230#
    21722231itcl::body Rappture::NanovisViewer::GetDatasetsWithComponent { cname } {
    21732232    if { ![info exists _volcomponents($cname)] } {
     
    21872246# HideAllMarkers --
    21882247#
    2189 #       Hide all the markers.  Can't simply delete and recreate markers
    2190 #       from the <style> since the user may have create, deleted, or moved
    2191 #       markers.
     2248#       Hide all the markers in all the transfer functions.  Can't simply
     2249#       delete and recreate markers from the <style> since the user may
     2250#       have create, deleted, or moved markers.
    21922251#
    21932252itcl::body Rappture::NanovisViewer::HideAllMarkers {} {
Note: See TracChangeset for help on using the changeset viewer.