Changeset 1248 for trunk/gui


Ignore:
Timestamp:
Dec 1, 2008 12:17:26 PM (15 years ago)
Author:
gah
Message:

Fix for interrupted nanovis session

File:
1 edited

Legend:

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

    r1247 r1248  
    119119    private variable isomarkers_    ;# array of isosurface level values 0..1
    120120    private common   settings_
    121     private variable activeId_ ""   ;# The currently active volume.  This
     121    private variable activeTf_ ""  ;# The currently active transfer function. 
     122                                    # This
    122123                                    # indicates which isomarkers and transfer
    123124                                    # function to use when changing markers,
     
    827828            _send "up $axis"
    828829        }
    829         # The active volume is by default the first component of the first
    830         # data object.  This assumes that the data is always successfully
    831         # transferred.
     830        # The active transfer function is by default the first component of
     831        # the first data object.  This assumes that the data is always
     832        # successfully transferred.
    832833        set comp [lindex [$first components] 0]
    833         set activeId_ $_obj2id($first-$comp)
     834        set activeTf_ $_id2style($_obj2id($first-$comp))
    834835    }
    835836    foreach key [array names _obj2id *-*] {
     
    868869# ----------------------------------------------------------------------
    869870itcl::body Rappture::NanovisViewer::_SendTransferFunctions {} {
     871    if { $activeTf_ == "" } {
     872        return
     873    }
     874    set tf $activeTf_
    870875    set first [lindex [get] 0]
    871876
    872877    # Insure that the global opacity and thickness settings (in the slider
    873     # settings widgets) are used for the transfer-function used by the active
    874     # volume.  Update the values in the settings_ varible.
     878    # settings widgets) are used for the active transfer-function.  Update the
     879    # values in the settings_ varible.
    875880    set inner [$itk_component(controls).panel component inner]
    876     set tf $_id2style($activeId_)
    877881    set value [$inner.scales.opacity get]
    878882    set opacity [expr { double($value) * 0.01 }]
     
    916920#       the slave interpreter.  The purpose is to collect data of the image
    917921#       representing the legend in the canvas.  In addition, the isomarkers
    918 #       of the active volume are displayed.
     922#       of the active transfer function are displayed.
    919923#
    920924#       I don't know is this is the right place to display the isomarkers.
     
    947951            [itcl::code $this _AddIsoMarker %x %y]
    948952    }
    949     # Display the markers used by the active volume.
    950     set tf $_id2style($activeId_)
     953    # Display the markers used by the active transfer function.
     954    set tf $activeTf_
    951955
    952956    array set limits [GetLimits $tf]
     
    11011105        set ivol $_obj2id($first-$comp)
    11021106       
    1103         set tf _id2style($ivol)
    1104    
    11051107        foreach comp [$first components] {
    11061108            foreach ivol $_obj2id($first-$comp) {
     
    14341436        }
    14351437        opacity {
    1436             if {[isconnected] && $activeId_ != "" } {
     1438            if {[isconnected] && $activeTf_ != "" } {
    14371439                set val [$inner.scales.opacity get]
    14381440                set sval [expr { 0.01 * double($val) }]
    1439                 set tf $_id2style($activeId_)
     1441                set tf $activeTf_
    14401442                set settings_($this-$tf-opacity) $sval
    14411443                UpdateTransferFunctions
     
    14441446
    14451447        thickness {
    1446             if {[isconnected] && $activeId_ != "" } {
     1448            if {[isconnected] && $activeTf_ != "" } {
    14471449                set val [$inner.scales.thickness get]
    14481450                # Scale values between 0.00001 and 0.01000
    14491451                set sval [expr {0.0001*double($val)}]
    1450                 set tf $_id2style($activeId_)
     1452                set tf $activeTf_
    14511453                set settings_($this-$tf-thickness) $sval
    14521454                UpdateTransferFunctions
     
    14901492    set w [expr {[winfo width $itk_component(legend)]-20}]
    14911493    set h [expr {[winfo height $itk_component(legend)]-20-$lineht}]
    1492     set ivol $activeId_
    1493     if {$w > 0 && $h > 0 && "" != $ivol} {
    1494         _send "legend $ivol $w $h"
     1494    if {$w > 0 && $h > 0 && "" != $activeTf_} {
     1495        _send "legend $activeTf_ $w $h"
    14951496    } else {
    14961497        # Can't do this as this will remove the items associated with the
     
    17651766
    17661767itcl::body Rappture::NanovisViewer::_AddIsoMarker { x y } {
    1767     if { $activeId_ == "" } {
    1768         error "active volume isn't set"
    1769     }
    1770     set tf $_id2style($activeId_)
     1768    if { $activeTf_ == "" } {
     1769        error "active transfer function isn't set"
     1770    }
     1771    set tf $activeTf_
    17711772    set c $itk_component(legend)
    17721773    set m [IsoMarker \#auto $c $this $tf]
Note: See TracChangeset for help on using the changeset viewer.