Changeset 975 for trunk


Ignore:
Timestamp:
Mar 31, 2008, 10:22:40 AM (16 years ago)
Author:
gah
Message:
 
File:
1 edited

Legend:

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

    r972 r975  
    9999    # The following methods are only used by this class.
    100100    private method _DefineTransferFunction { ivol }
    101     private method _AddIsoMarker { ivol x y }
     101    private method _AddIsoMarker { x y }
    102102    private method _InitIsoMarkers { ivol }
    103103    private method _HideIsoMarkers { ivol }
     
    126126    private variable _styles
    127127    private common   _settings
    128     private variable _currentVolId ""
     128    private variable _activeVol "" ;# The currently active volume.  This
     129                                    # indicates which isomarkers and transfer
     130                                    # function to use when changing markers,
     131                                    # opacity, or thickness.
    129132}
    130133
     
    817820# ----------------------------------------------------------------------
    818821itcl::body Rappture::NanovisViewer::_send_transfunc {} {
    819     if { ![_DefineTransferFunction $_currentVolId] } {
     822    if { ![_DefineTransferFunction $_activeVol] } {
    820823        return
    821824    }
    822825    _fixLegend
    823     $_dispatcher event -idle !legend
    824826}
    825827
     
    831833# specified <size> will follow.
    832834# ----------------------------------------------------------------------
     835set counter 0
    833836itcl::body Rappture::NanovisViewer::_ReceiveImage {option size} {
    834837    if { [isconnected] } {
     838        global counter
     839        incr counter
    835840        set bytes [ReceiveBytes $size]
    836841        $_image(plot) configure -data $bytes
     
    864869                 -fill $itk_option(-plotforeground) -tags vmax
    865870            $c lower transfunc
    866             $c bind transfunc <ButtonRelease-1> \
    867                 [itcl::code $this _AddIsoMarker $ivol %x %y]
     871            $c bind transfunc <ButtonRelease-1> \
     872                [itcl::code $this _AddIsoMarker %x %y]
    868873        }
    869874        $c itemconfigure vmin -text $_limits($ivol-min)
     
    917922            return
    918923        }
     924    }
     925    if { [array size _receiveids] == 0 } {
    919926        _fixLegend
    920927    }
     
    12941301        }
    12951302        opacity {
    1296             if {[isconnected]} {
    1297                 set dataobj [lindex [get] 0]
    1298                 if {$dataobj != 0} {
    1299                     set val [$inner.scales.opacity get]
    1300                     set sval [expr { 0.01 * double($val) }]
    1301                     # FIXME: This will change when we can select the current
    1302                     #        volume.
    1303                     set comp [lindex [$dataobj components] 0]
    1304                     set tag $dataobj-$comp
    1305                     if { [info exists _obj2id($tag)] } {
    1306                         set ivol $_obj2id($tag)
    1307                         set _settings($this-$ivol-opacity) $sval
    1308                         UpdateTransferFunction $ivol
    1309                     }
    1310                 }
    1311             }
     1303            if {[isconnected] && $_activeVol != "" } {
     1304                set val [$inner.scales.opacity get]
     1305                set sval [expr { 0.01 * double($val) }]
     1306                set ivol $_activeVol
     1307                set _settings($this-$ivol-opacity) $sval
     1308                UpdateTransferFunction $ivol
     1309            }
    13121310        }
    13131311
    13141312        thickness {
    1315             if {[isconnected]} {
    1316                 set dataobj [lindex [get] 0]
    1317                 if {$dataobj != 0} {
    1318                     set val [$inner.scales.thickness get]
    1319                     # Scale values between 0.00001 and 0.01000
    1320                     set sval [expr {0.0001*double($val)}]
    1321                     # FIXME: This will change when we can select the current
    1322                     #        volume.
    1323                     set comp [lindex [$dataobj components] 0]
    1324                     set tag $dataobj-$comp
    1325                     if { [info exists _obj2id($tag)] } {
    1326                         set ivol $_obj2id($tag)
    1327                         set _settings($this-$ivol-thickness) $sval
    1328                         UpdateTransferFunction $ivol
    1329                     }
    1330                 }
    1331             }
     1313            if {[isconnected] && $_activeVol != "" } {
     1314                set val [$inner.scales.thickness get]
     1315                # Scale values between 0.00001 and 0.01000
     1316                set sval [expr {0.0001*double($val)}]
     1317                set ivol $_activeVol
     1318                set _settings($this-$ivol-thickness) $sval
     1319                UpdateTransferFunction $ivol
     1320            }
    13321321        }
    13331322        "outline" {
     
    13681357    set w [expr {[winfo width $itk_component(legend)]-20}]
    13691358    set h [expr {[winfo height $itk_component(legend)]-20-$lineht}]
    1370     set ivol ""
    1371     if { $ivol == "" } {
    1372         set dataobj [lindex [get] 0]
    1373         if {"" != $dataobj} {
    1374             set comp [lindex [$dataobj components] 0]
    1375             if {[info exists _obj2id($dataobj-$comp)]} {
    1376                 set ivol $_obj2id($dataobj-$comp)
    1377             }
    1378         }
    1379     }
     1359    set ivol $_activeVol
    13801360    if {$w > 0 && $h > 0 && "" != $ivol} {
    13811361        _send "legend $ivol $w $h"
     
    15281508        }
    15291509    }
     1510    set _activeVol $ivol
    15301511    if { ![info exists _isomarkers($ivol)] } {
    15311512        return
     
    16201601        return
    16211602    }
    1622     set _currentVolId $ivol
     1603    set _activeVol $ivol
    16231604    $_dispatcher event -idle !send_transfunc
    16241605}
    16251606
    1626 itcl::body Rappture::NanovisViewer::_AddIsoMarker { ivol x y } {
     1607itcl::body Rappture::NanovisViewer::_AddIsoMarker { x y } {
     1608    if { $_activeVol == "" } {
     1609        error "active volume isn't set"
     1610    }
     1611    set ivol $_activeVol
    16271612    set c $itk_component(legend)
    16281613    set m [IsoMarker \#auto $c $this $ivol]
Note: See TracChangeset for help on using the changeset viewer.