Changeset 5733
- Timestamp:
- Jun 22, 2015, 5:18:42 PM (9 years ago)
- Location:
- branches/1.4
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/1.4
- Property svn:mergeinfo changed
/trunk merged: 3722,5727
- Property svn:mergeinfo changed
-
branches/1.4/gui/scripts/vtkvolumeviewer.tcl
r5732 r5733 3 3 # COMPONENT: vtkvolumeviewer - Vtk volume viewer 4 4 # 5 # It connects to the Vtk server running on a rendering farm, 5 # This widget performs volume rendering on 3D scalar/vector datasets. 6 # It connects to the Vtkvis server running on a rendering farm, 6 7 # transmits data, and displays the results. 7 8 # ====================================================================== 8 9 # AUTHOR: Michael McLennan, Purdue University 9 # Copyright (c) 2004-201 4HUBzero Foundation, LLC10 # Copyright (c) 2004-2015 HUBzero Foundation, LLC 10 11 # 11 12 # See the file "license.terms" for information on usage and … … 62 63 public method scale {args} 63 64 64 private method GetDatasetsWithComponent { cname }65 66 private variable _volcomponents ; # Array of components found67 private variable _componentsList ; # List of component names68 69 65 # The following methods are only used by this class. 70 66 private method AdjustSetting {what {value ""}} … … 72 68 private method BuildCameraTab {} 73 69 private method BuildColormap { name colors } 74 private method BuildCutplane Tab {}70 private method BuildCutplanesTab {} 75 71 private method BuildDownloadPopup { widget command } 76 72 private method BuildViewTab {} … … 89 85 private method EventuallyRotate { q } 90 86 private method EventuallySetCutplane { axis args } 87 private method GetDatasetsWithComponent { cname } 91 88 private method GetImage { args } 92 89 private method GetVtkData { args } … … 109 106 private method SetColormap { dataobj comp } 110 107 private method SetLegendTip { x y } 111 private method SetObjectStyle { dataobj c omp}108 private method SetObjectStyle { dataobj cname } 112 109 private method SetOrientation { side } 113 110 private method Slice {option args} … … 126 123 private variable _dataset2style; # maps dataobj-component to transfunc 127 124 128 private variable _click; # info used for rotate operations 129 private variable _limits; # autoscale min/max for all axes 130 private variable _view; # view params for 3D view 125 private variable _reset 1; # Connection to server has been reset. 126 private variable _click; # Info used for rotate operations. 127 private variable _limits; # Autoscale min/max for all axes 128 private variable _view; # View params for 3D view 131 129 private variable _settings 132 130 private variable _style; # Array of current component styles. 133 131 private variable _initialStyle; # Array of initial component styles. 134 private variable _reset 1; # Connection to server has been reset. 135 136 private variable _first ""; # This is the topmost dataset. 132 137 133 private variable _start 0 138 134 private variable _title "" 139 140 private variable _width 0141 private variable _height 0142 private variable _resizePending 0143 private variable _rotatePending 0144 private variable _cutplanePending 0145 private variable _legendPending 0146 135 private variable _fields 147 136 private variable _curFldName "" … … 151 140 private variable _allowMultiComponent 0 152 141 142 private variable _first ""; # This is the topmost dataset. 143 private variable _volcomponents; # Maps component name to list of 144 # dataobj-component tags 145 private variable _componentsList; # List of components found 146 147 private variable _width 0 148 private variable _height 0 149 private variable _resizePending 0 150 private variable _legendPending 0 151 private variable _rotatePending 0 152 private variable _cutplanePending 0 153 153 154 private common _downloadPopup; # download options from popup 154 155 private common _hardcopy … … 166 167 set _serverType "vtkvis" 167 168 169 #DebugOn 168 170 EnableWaitDialog 900 169 171 … … 176 178 $_dispatcher dispatch $this !resize "[itcl::code $this DoResize]; list" 177 179 180 # Legend event 181 $_dispatcher register !legend 182 $_dispatcher dispatch $this !legend "[itcl::code $this RequestLegend]; list" 183 178 184 # Rotate event 179 185 $_dispatcher register !rotate 180 186 $_dispatcher dispatch $this !rotate "[itcl::code $this DoRotate]; list" 181 182 # Legend event183 $_dispatcher register !legend184 $_dispatcher dispatch $this !legend "[itcl::code $this RequestLegend]; list"185 187 186 188 # X-Cutplane event … … 203 205 # 204 206 $_parser alias image [itcl::code $this ReceiveImage] 207 $_parser alias legend [itcl::code $this ReceiveLegend] 205 208 $_parser alias dataset [itcl::code $this ReceiveDataset] 206 $_parser alias legend [itcl::code $this ReceiveLegend]207 209 208 210 # Initialize the view to some default parameters. 209 211 array set _view { 210 -ortho 211 -qw 212 -qx 213 -qy 214 -qz 215 -xpan 216 -ypan 217 -zoom 212 -ortho 0 213 -qw 0.853553 214 -qx -0.353553 215 -qy 0.353553 216 -qz 0.146447 217 -xpan 0 218 -ypan 0 219 -zoom 1.0 218 220 } 219 221 set _arcball [blt::arcball create 100 100] … … 294 296 } 295 297 pack $itk_component(reset) -side top -padx 2 -pady 2 296 Rappture::Tooltip::for $itk_component(reset) "Reset the view to the default zoom level" 298 Rappture::Tooltip::for $itk_component(reset) \ 299 "Reset the view to the default zoom level" 297 300 298 301 itk_component add zoomin { … … 346 349 BuildViewTab 347 350 BuildVolumeTab 348 BuildCutplane Tab351 BuildCutplanesTab 349 352 BuildAxisTab 350 353 BuildCameraTab … … 501 504 # ---------------------------------------------------------------------- 502 505 itcl::body Rappture::VtkVolumeViewer::add {dataobj {settings ""}} { 506 DebugTrace "Enter" 503 507 if { ![IsValidObject $dataobj] } { 508 DebugTrace "Invalid" 504 509 return; # Ignore invalid objects. 505 510 } … … 542 547 # ---------------------------------------------------------------------- 543 548 itcl::body Rappture::VtkVolumeViewer::delete {args} { 549 DebugTrace "Enter" 544 550 if { [llength $args] == 0} { 545 551 set args $_dlist … … 645 651 # ---------------------------------------------------------------------- 646 652 itcl::body Rappture::VtkVolumeViewer::scale {args} { 653 DebugTrace "Enter" 647 654 array unset _limits 648 655 array unset _volcomponents … … 828 835 itcl::body Rappture::VtkVolumeViewer::disconnect {} { 829 836 Disconnect 837 set _reset 1 830 838 } 831 839 … … 981 989 StartBufferingCommands 982 990 } 991 983 992 set _first "" 984 985 993 # No volumes are active (i.e. in the working set of displayed volumes). 986 994 # A volume is always invisible if it's not in the working set. A … … 992 1000 set _first $dataobj 993 1001 } 994 foreach c omp[$dataobj components] {995 set tag $dataobj-$c omp1002 foreach cname [$dataobj components] { 1003 set tag $dataobj-$cname 996 1004 if { ![info exists _datasets($tag)] } { 997 set bytes [$dataobj vtkdata $c omp]1005 set bytes [$dataobj vtkdata $cname] 998 1006 if 0 { 999 1007 set f [open /tmp/vtkvolume.vtk "w"] … … 1018 1026 SendData $bytes 1019 1027 set _datasets($tag) 1 1020 SetObjectStyle $dataobj $c omp1028 SetObjectStyle $dataobj $cname 1021 1029 } 1022 1030 if { [info exists _obj2ovride($dataobj-raise)] } { … … 1591 1599 # BuildColormap -- 1592 1600 # 1601 # Alpha map is in the format: normalized_value opacity midpoint sharpness 1602 # 1593 1603 itcl::body Rappture::VtkVolumeViewer::BuildColormap { name styles } { 1594 1604 array set style $styles … … 1597 1607 set cmap "0.0 0.0 0.0 0.0 1.0 1.0 1.0 1.0" 1598 1608 } 1599 set max 1.0 1600 1609 1610 set amap "0.0 0.0 0.5 0.0 1.0 1.0 0.5 0.0" 1601 1611 set opaqueAmap "0.0 1.0 1.0 1.0" 1602 #set amap "0.0 0.0 0.1 0.0 0.2 0.8 0.98 0.8 0.99 0.0 1.0 0.0" 1603 # Approximate cubic opacity curve 1604 set amap "0.0 0.0 0.1 0.001 0.2 0.008 0.3 0.027 0.4 0.064 0.5 0.125 0.6 0.216 0.7 0.343 0.8 0.512 0.9 0.729 1.0 1.0" 1605 SendCmd "colormap add $name { $cmap } { $amap }" 1606 SendCmd "colormap add $name-opaque { $cmap } { $opaqueAmap }" 1612 SendCmd [list colormap define $name $cmap -spline $amap] 1613 SendCmd [list colormap define $name-opaque $cmap $opaqueAmap] 1607 1614 } 1608 1615 … … 1888 1895 } 1889 1896 1890 itcl::body Rappture::VtkVolumeViewer::BuildCutplane Tab {} {1897 itcl::body Rappture::VtkVolumeViewer::BuildCutplanesTab {} { 1891 1898 set font [option get $itk_component(hull) font Font] 1892 1899
Note: See TracChangeset
for help on using the changeset viewer.