- Timestamp:
- Mar 31, 2008, 10:22:40 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gui/scripts/nanovisviewer.tcl
r972 r975 99 99 # The following methods are only used by this class. 100 100 private method _DefineTransferFunction { ivol } 101 private method _AddIsoMarker { ivolx y }101 private method _AddIsoMarker { x y } 102 102 private method _InitIsoMarkers { ivol } 103 103 private method _HideIsoMarkers { ivol } … … 126 126 private variable _styles 127 127 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. 129 132 } 130 133 … … 817 820 # ---------------------------------------------------------------------- 818 821 itcl::body Rappture::NanovisViewer::_send_transfunc {} { 819 if { ![_DefineTransferFunction $_ currentVolId] } {822 if { ![_DefineTransferFunction $_activeVol] } { 820 823 return 821 824 } 822 825 _fixLegend 823 $_dispatcher event -idle !legend824 826 } 825 827 … … 831 833 # specified <size> will follow. 832 834 # ---------------------------------------------------------------------- 835 set counter 0 833 836 itcl::body Rappture::NanovisViewer::_ReceiveImage {option size} { 834 837 if { [isconnected] } { 838 global counter 839 incr counter 835 840 set bytes [ReceiveBytes $size] 836 841 $_image(plot) configure -data $bytes … … 864 869 -fill $itk_option(-plotforeground) -tags vmax 865 870 $c lower transfunc 866 867 [itcl::code $this _AddIsoMarker $ivol%x %y]871 $c bind transfunc <ButtonRelease-1> \ 872 [itcl::code $this _AddIsoMarker %x %y] 868 873 } 869 874 $c itemconfigure vmin -text $_limits($ivol-min) … … 917 922 return 918 923 } 924 } 925 if { [array size _receiveids] == 0 } { 919 926 _fixLegend 920 927 } … … 1294 1301 } 1295 1302 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 } 1312 1310 } 1313 1311 1314 1312 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 } 1332 1321 } 1333 1322 "outline" { … … 1368 1357 set w [expr {[winfo width $itk_component(legend)]-20}] 1369 1358 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 1380 1360 if {$w > 0 && $h > 0 && "" != $ivol} { 1381 1361 _send "legend $ivol $w $h" … … 1528 1508 } 1529 1509 } 1510 set _activeVol $ivol 1530 1511 if { ![info exists _isomarkers($ivol)] } { 1531 1512 return … … 1620 1601 return 1621 1602 } 1622 set _ currentVolId$ivol1603 set _activeVol $ivol 1623 1604 $_dispatcher event -idle !send_transfunc 1624 1605 } 1625 1606 1626 itcl::body Rappture::NanovisViewer::_AddIsoMarker { ivol x y } { 1607 itcl::body Rappture::NanovisViewer::_AddIsoMarker { x y } { 1608 if { $_activeVol == "" } { 1609 error "active volume isn't set" 1610 } 1611 set ivol $_activeVol 1627 1612 set c $itk_component(legend) 1628 1613 set m [IsoMarker \#auto $c $this $ivol]
Note: See TracChangeset
for help on using the changeset viewer.