Changeset 3984 for trunk/gui/scripts/vtkvolumeviewer.tcl
- Timestamp:
- Oct 3, 2013, 10:26:53 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gui/scripts/vtkvolumeviewer.tcl
r3975 r3984 94 94 protected method Disconnect {} 95 95 protected method DoResize {} 96 protected method DoReseed {}97 96 protected method DoRotate {} 98 97 protected method AdjustSetting {what {value ""}} … … 165 164 private variable _height 0 166 165 private variable _resizePending 0 167 private variable _reseedPending 0168 166 private variable _rotatePending 0 169 167 private variable _cutplanePending 0 … … 197 195 $_dispatcher dispatch $this !resize "[itcl::code $this DoResize]; list" 198 196 199 # Reseed event200 $_dispatcher register !reseed201 $_dispatcher dispatch $this !reseed "[itcl::code $this DoReseed]; list"202 203 197 # Rotate event 204 198 $_dispatcher register !rotate … … 212 206 $_dispatcher register !xcutplane 213 207 $_dispatcher dispatch $this !xcutplane \ 214 "[itcl::code $this AdjustSetting cutplane -xposition]; list"208 "[itcl::code $this AdjustSetting cutplanePositionX]; list" 215 209 216 210 # Y-Cutplane event 217 211 $_dispatcher register !ycutplane 218 212 $_dispatcher dispatch $this !ycutplane \ 219 "[itcl::code $this AdjustSetting cutplane -yposition]; list"213 "[itcl::code $this AdjustSetting cutplanePositionY]; list" 220 214 221 215 # Z-Cutplane event 222 216 $_dispatcher register !zcutplane 223 217 $_dispatcher dispatch $this !zcutplane \ 224 "[itcl::code $this AdjustSetting cutplane -zposition]; list"218 "[itcl::code $this AdjustSetting cutplanePositionZ]; list" 225 219 226 220 # … … 247 241 248 242 array set _settings { 249 axis-xgrid 0250 axis-ygrid 0251 axis-zgrid 0252 243 axesVisible 1 244 axisGridX 0 245 axisGridY 0 246 axisGridZ 0 253 247 axisLabels 1 254 248 cutplaneEdges 0 255 cutplane-xvisible 1 256 cutplane-yvisible 1 257 cutplane-zvisible 1 258 cutplane-xposition 50 259 cutplane-yposition 50 260 cutplane-zposition 50 249 cutplaneLighting 1 250 cutplaneOpacity 100 261 251 cutplaneVisible 0 262 cutplaneLighting 1 252 cutplaneVisibleX 1 253 cutplaneVisibleY 1 254 cutplaneVisibleZ 1 263 255 cutplaneWireframe 0 264 cutplane-opacity 100 265 volume-blendmode composite 256 cutplaneXPosition 50 257 cutplaneYPosition 50 258 cutplaneZPosition 50 259 legendVisible 1 260 volumeAmbient 40 261 volumeBlendMode composite 262 volumeDiffuse 60 266 263 volumeLighting 1 267 volumeAmbient 40 268 volumeDiffuse 60 269 volumeThickness 350 270 volume-specularLevel 30 271 volume-specularExponent 90 272 volume-opacity 50 273 volume-quality 50 264 volumeOpacity 50 265 volumeQuality 50 266 volumeSpecularExponent 90 267 volumeSpecularLevel 30 268 volumeThickness 350 274 269 volumeVisible 1 275 legendVisible 1276 270 } 277 271 … … 851 845 EventuallyResize $w $h 852 846 } 847 $_dispatcher event -idle !rebuild 853 848 return $result 854 849 } … … 868 863 itcl::body Rappture::VtkVolumeViewer::disconnect {} { 869 864 Disconnect 870 set _reset 1871 865 } 872 866 … … 882 876 $_dispatcher cancel !rebuild 883 877 $_dispatcher cancel !resize 884 $_dispatcher cancel !reseed885 878 $_dispatcher cancel !rotate 886 879 $_dispatcher cancel !xcutplane … … 896 889 array unset _dataset2style 897 890 array unset _obj2datasets 891 892 array unset _cname2style 893 array unset _parsedFunction 894 array unset _cname2transferFunction 895 896 set _resizePending 0 897 set _rotatePending 0 898 set _cutplanePending 0 899 set _legendPending 0 900 set _reset 1 898 901 } 899 902 … … 1016 1019 } 1017 1020 DoRotate 1018 InitSettings axis -xgrid axis-ygrid axis-zgridaxisFlyMode \1021 InitSettings axisGridX axisGridY axisGridZ axisFlyMode \ 1019 1022 axesVisible axisLabels 1020 1023 PanCamera … … 1108 1111 1109 1112 InitSettings volumeColormap \ 1110 volumeAmbient volumeDiffuse volume -specularLevel volume-specularExponent \1111 volume -opacity volume-quality volumeVisible \1113 volumeAmbient volumeDiffuse volumeSpecularLevel volumeSpecularExponent \ 1114 volumeOpacity volumeQuality volumeVisible \ 1112 1115 cutplaneVisible \ 1113 cutplane -xposition cutplane-yposition cutplane-zposition\1114 cutplane -xvisible cutplane-yvisible cutplane-zvisible1116 cutplanePositionX cutplanePositionY cutplanePositionZ \ 1117 cutplaneVisibleX cutplaneVisibleY cutplaneVisibleZ 1115 1118 1116 1119 if { $_reset } { 1117 1120 InitSettings volumeLighting 1118 Zoom reset 1121 SendCmd "camera reset" 1122 SendCmd "camera zoom $_view(zoom)" 1119 1123 set _reset 0 1120 1124 } … … 1356 1360 itcl::body Rappture::VtkVolumeViewer::AdjustSetting {what {value ""}} { 1357 1361 if { ![isconnected] } { 1362 if { $_reset } { 1363 # Just reconnect if we've been reset. 1364 Connect 1365 } 1358 1366 return 1359 1367 } … … 1372 1380 } 1373 1381 } 1374 "volume -blendmode" {1382 "volumeBlendMode" { 1375 1383 set val [$itk_component(blendmode) value] 1376 1384 set mode [$itk_component(blendmode) translate $val] 1377 set _settings(volume -blendmode) $mode1385 set _settings(volumeBlendMode) $mode 1378 1386 foreach dataset [CurrentDatasets -visible] { 1379 1387 SendCmd "volume blendmode $mode $dataset" … … 1394 1402 } 1395 1403 } 1396 "volume -specularLevel" - "volume-specularExponent" {1397 set val $_settings(volume -specularLevel)1404 "volumeSpecularLevel" - "volumeSpecularExponent" { 1405 set val $_settings(volumeSpecularLevel) 1398 1406 set specularLevel [expr {0.01*$val}] 1399 set specularExponent $_settings(volume -specularExponent)1407 set specularExponent $_settings(volumeSpecularExponent) 1400 1408 foreach dataset [CurrentDatasets -visible] { 1401 1409 SendCmd "volume shading specular $specularLevel $specularExponent $dataset" … … 1408 1416 } 1409 1417 } 1410 "volume -opacity" {1411 set val $_settings(volume -opacity)1418 "volumeOpacity" { 1419 set val $_settings(volumeOpacity) 1412 1420 set val [expr {0.01*$val}] 1413 1421 foreach dataset [CurrentDatasets -visible] { … … 1415 1423 } 1416 1424 } 1417 "volume -quality" {1418 set val $_settings(volume -quality)1425 "volumeQuality" { 1426 set val $_settings(volumeQuality) 1419 1427 set val [expr {0.01*$val}] 1420 1428 foreach dataset [CurrentDatasets -visible] { … … 1430 1438 SendCmd "axis labels all $bool" 1431 1439 } 1432 "axis -xgrid" - "axis-ygrid" - "axis-zgrid" {1433 set axis [string range $what 5 5]1440 "axisGridX" - "axisGridY" - "axisGridZ" { 1441 set axis [string tolower [string range $what end end]] 1434 1442 set bool $_settings($what) 1435 1443 SendCmd "axis grid $axis $bool" … … 1465 1473 } 1466 1474 } 1467 "cutplane -opacity" {1475 "cutplaneOpacity" { 1468 1476 set val $_settings($what) 1469 1477 set sval [expr { 0.01 * double($val) }] … … 1472 1480 } 1473 1481 } 1474 "cutplane -xvisible" - "cutplane-yvisible" - "cutplane-zvisible" {1475 set axis [string range $what 9 9]1482 "cutplaneVisibleX" - "cutplaneVisibleY" - "cutplaneVisibleZ" { 1483 set axis [string tolower [string range $what end end]] 1476 1484 set bool $_settings($what) 1477 1485 if { $bool } { … … 1486 1494 } 1487 1495 } 1488 "cutplane -xposition" - "cutplane-yposition" - "cutplane-zposition" {1489 set axis [string range $what 9 9]1496 "cutplanePositionX" - "cutplanePositionY" - "cutplanePositionZ" { 1497 set axis [string tolower [string range $what end end]] 1490 1498 set pos [expr $_settings($what) * 0.01] 1491 1499 foreach dataset [CurrentDatasets -visible] { … … 1623 1631 set cmap "0.0 0.0 0.0 0.0 1.0 1.0 1.0 1.0" 1624 1632 } 1625 if { ![info exists _settings(volume -opacity)] } {1626 set _settings(volume -opacity) $style(-opacity)1627 } 1628 set max $_settings(volume -opacity)1633 if { ![info exists _settings(volumeOpacity)] } { 1634 set _settings(volumeOpacity) $style(-opacity) 1635 } 1636 set max $_settings(volumeOpacity) 1629 1637 1630 1638 set opaqueWmap "0.0 1.0 1.0 1.0" … … 1706 1714 label $inner.specularLevel_l -text "Specular" -font $font 1707 1715 ::scale $inner.specularLevel -from 0 -to 100 -orient horizontal \ 1708 -variable [itcl::scope _settings(volume -specularLevel)] \1709 -showvalue off -command [itcl::code $this AdjustSetting volume -specularLevel] \1716 -variable [itcl::scope _settings(volumeSpecularLevel)] \ 1717 -showvalue off -command [itcl::code $this AdjustSetting volumeSpecularLevel] \ 1710 1718 -troughcolor grey92 1711 1719 1712 1720 label $inner.specularExponent_l -text "Shininess" -font $font 1713 1721 ::scale $inner.specularExponent -from 10 -to 128 -orient horizontal \ 1714 -variable [itcl::scope _settings(volume -specularExponent)] \1715 -showvalue off -command [itcl::code $this AdjustSetting volume -specularExponent] \1722 -variable [itcl::scope _settings(volumeSpecularExponent)] \ 1723 -showvalue off -command [itcl::code $this AdjustSetting volumeSpecularExponent] \ 1716 1724 -troughcolor grey92 1717 1725 1718 1726 label $inner.opacity_l -text "Opacity" -font $font 1719 1727 ::scale $inner.opacity -from 0 -to 100 -orient horizontal \ 1720 -variable [itcl::scope _settings(volume -opacity)] \1721 -showvalue off -command [itcl::code $this AdjustSetting volume -opacity] \1728 -variable [itcl::scope _settings(volumeOpacity)] \ 1729 -showvalue off -command [itcl::code $this AdjustSetting volumeOpacity] \ 1722 1730 -troughcolor grey92 1723 1731 1724 1732 label $inner.quality_l -text "Quality" -font $font 1725 1733 ::scale $inner.quality -from 0 -to 100 -orient horizontal \ 1726 -variable [itcl::scope _settings(volume -quality)] \1727 -showvalue off -command [itcl::code $this AdjustSetting volume -quality] \1734 -variable [itcl::scope _settings(volumeQuality)] \ 1735 -showvalue off -command [itcl::code $this AdjustSetting volumeQuality] \ 1728 1736 -troughcolor grey92 1729 1737 … … 1784 1792 $itk_component(blendmode) value "composite" 1785 1793 bind $inner.blendmode <<Value>> \ 1786 [itcl::code $this AdjustSetting volume -blendmode]1794 [itcl::code $this AdjustSetting volumeBlendMode] 1787 1795 1788 1796 blt::table $inner \ … … 1845 1853 checkbutton $inner.gridx \ 1846 1854 -text "Show X Grid" \ 1847 -variable [itcl::scope _settings(axis -xgrid)] \1848 -command [itcl::code $this AdjustSetting axis -xgrid] \1855 -variable [itcl::scope _settings(axisGridX)] \ 1856 -command [itcl::code $this AdjustSetting axisGridX] \ 1849 1857 -font "Arial 9" 1850 1858 checkbutton $inner.gridy \ 1851 1859 -text "Show Y Grid" \ 1852 -variable [itcl::scope _settings(axis -ygrid)] \1853 -command [itcl::code $this AdjustSetting axis -ygrid] \1860 -variable [itcl::scope _settings(axisGridY)] \ 1861 -command [itcl::code $this AdjustSetting axisGridY] \ 1854 1862 -font "Arial 9" 1855 1863 checkbutton $inner.gridz \ 1856 1864 -text "Show Z Grid" \ 1857 -variable [itcl::scope _settings(axis -zgrid)] \1858 -command [itcl::code $this AdjustSetting axis -zgrid] \1865 -variable [itcl::scope _settings(axisGridZ)] \ 1866 -command [itcl::code $this AdjustSetting axisGridZ] \ 1859 1867 -font "Arial 9" 1860 1868 … … 1970 1978 label $inner.opacity_l -text "Opacity" -font "Arial 9" 1971 1979 ::scale $inner.opacity -from 0 -to 100 -orient horizontal \ 1972 -variable [itcl::scope _settings(cutplane -opacity)] \1980 -variable [itcl::scope _settings(cutplaneOpacity)] \ 1973 1981 -width 10 \ 1974 1982 -showvalue off \ 1975 -command [itcl::code $this AdjustSetting cutplane -opacity]1976 $inner.opacity set $_settings(cutplane -opacity)1983 -command [itcl::code $this AdjustSetting cutplaneOpacity] 1984 $inner.opacity set $_settings(cutplaneOpacity) 1977 1985 1978 1986 # X-value slicer... … … 1981 1989 -onimage [Rappture::icon x-cutplane] \ 1982 1990 -offimage [Rappture::icon x-cutplane] \ 1983 -command [itcl::code $this AdjustSetting cutplane -xvisible] \1984 -variable [itcl::scope _settings(cutplane -xvisible)]1991 -command [itcl::code $this AdjustSetting cutplaneVisibleX] \ 1992 -variable [itcl::scope _settings(cutplaneVisibleX)] 1985 1993 } 1986 1994 Rappture::Tooltip::for $itk_component(xCutButton) \ … … 1993 2001 -borderwidth 1 -highlightthickness 0 \ 1994 2002 -command [itcl::code $this EventuallySetCutplane x] \ 1995 -variable [itcl::scope _settings(cutplane -xposition)]2003 -variable [itcl::scope _settings(cutplanePositionX)] 1996 2004 } { 1997 2005 usual … … 2009 2017 -onimage [Rappture::icon y-cutplane] \ 2010 2018 -offimage [Rappture::icon y-cutplane] \ 2011 -command [itcl::code $this AdjustSetting cutplane -yvisible] \2012 -variable [itcl::scope _settings(cutplane -yvisible)]2019 -command [itcl::code $this AdjustSetting cutplaneVisibleY] \ 2020 -variable [itcl::scope _settings(cutplaneVisibleY)] 2013 2021 } 2014 2022 Rappture::Tooltip::for $itk_component(yCutButton) \ … … 2021 2029 -borderwidth 1 -highlightthickness 0 \ 2022 2030 -command [itcl::code $this EventuallySetCutplane y] \ 2023 -variable [itcl::scope _settings(cutplane -yposition)]2031 -variable [itcl::scope _settings(cutplanePositionY)] 2024 2032 } { 2025 2033 usual … … 2037 2045 -onimage [Rappture::icon z-cutplane] \ 2038 2046 -offimage [Rappture::icon z-cutplane] \ 2039 -command [itcl::code $this AdjustSetting cutplane -zvisible] \2040 -variable [itcl::scope _settings(cutplane -zvisible)]2047 -command [itcl::code $this AdjustSetting cutplaneVisibleZ] \ 2048 -variable [itcl::scope _settings(cutplaneVisibleZ)] 2041 2049 } 2042 2050 Rappture::Tooltip::for $itk_component(zCutButton) \ … … 2049 2057 -borderwidth 1 -highlightthickness 0 \ 2050 2058 -command [itcl::code $this EventuallySetCutplane z] \ 2051 -variable [itcl::scope _settings(cutplane -zposition)]2059 -variable [itcl::scope _settings(cutplanePositionZ)] 2052 2060 } { 2053 2061 usual … … 2224 2232 itcl::body Rappture::VtkVolumeViewer::ReceiveLegend { colormap title vmin vmax size } { 2225 2233 set _legendPending 0 2226 if { [ IsConnected] } {2234 if { [isconnected] } { 2227 2235 set bytes [ReceiveBytes $size] 2228 2236 if { ![info exists _image(legend)] } { … … 2643 2651 set _cname2transferFunction($cname) [list $cmap $wmap] 2644 2652 SendCmd [list colormap add $cname $cmap $wmap] 2653 SendCmd [list cutplane colormap $cname] 2645 2654 EventuallyRequestLegend 2646 2655 }
Note: See TracChangeset
for help on using the changeset viewer.