- Timestamp:
- Sep 22, 2013, 1:49:00 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gui/scripts/flowvisviewer.tcl
r3946 r3947 90 90 protected method ReceiveLegend { tf vmin vmax size } 91 91 protected method Rotate {option x y} 92 protected method SendDataObjs {}93 92 protected method SendTransferFuncs {} 94 93 protected method Slice {option args} … … 136 135 private variable _serverObjs ;# maps dataobj-component to volume ID 137 136 # in the server 138 private variable _sendobjs "" ;# list of data objs to send to server139 137 private variable _recvObjs ;# list of data objs to send to server 140 138 private variable _obj2style ;# maps dataobj-component to transfunc … … 182 180 $_dispatcher register !legend 183 181 $_dispatcher dispatch $this !legend "[itcl::code $this ResizeLegend]; list" 184 185 # Send dataobjs event186 $_dispatcher register !send_dataobjs187 $_dispatcher dispatch $this !send_dataobjs \188 "[itcl::code $this SendDataObjs]; list"189 182 190 183 # Send transferfunctions event … … 584 577 # ---------------------------------------------------------------------- 585 578 itcl::body Rappture::FlowvisViewer::destructor {} { 586 set _sendobjs "" ;# stop any send in progress587 579 $_dispatcher cancel !rebuild 588 $_dispatcher cancel !send_dataobjs589 580 $_dispatcher cancel !send_transfunc 590 581 image delete $_image(plot) … … 955 946 # disconnected -- no more data sitting on server 956 947 array unset _serverObjs 957 set _sendobjs ""958 }959 960 # ----------------------------------------------------------------------961 # USAGE: SendDataObjs962 #963 # Used internally to send a series of volume objects off to the964 # server. Sends each object, a little at a time, with updates in965 # between so the interface doesn't lock up.966 # ----------------------------------------------------------------------967 itcl::body Rappture::FlowvisViewer::SendDataObjs {} {968 blt::busy hold $itk_component(hull)969 foreach dataobj $_sendobjs {970 foreach comp [$dataobj components] {971 # Send the data as one huge base64-encoded mess -- yuck!972 set data [$dataobj blob $comp]973 set nbytes [string length $data]974 set extents [$dataobj extents $comp]975 976 # I have a field. Is a vector field or a volume field?977 if { $extents == 1 } {978 set cmd "volume data follows $nbytes $dataobj-$comp\n"979 } else {980 set cmd [FlowCmd $dataobj $comp $nbytes $extents]981 if { $cmd == "" } {982 puts stderr "no command"983 continue984 }985 }986 f { ![SendBytes $cmd] } {987 puts stderr "can't send"988 return989 }990 if { ![SendBytes $data] } {991 puts stderr "can't send"992 return993 }994 NameTransferFunc $dataobj $comp995 set _recvObjs($dataobj-$comp) 1996 }997 }998 set _sendobjs ""999 blt::busy release $itk_component(hull)1000 1001 # Turn on buffering of commands to the server. We don't want to1002 # be preempted by a server disconnect/reconnect (which automatically1003 # generates a new call to Rebuild).1004 StartBufferingCommands1005 1006 # activate the proper volume1007 set _first [lindex [get] 0]1008 if { "" != $_first } {1009 set axis [$_first hints updir]1010 if {"" != $axis} {1011 SendCmd "up $axis"1012 }1013 1014 if 0 {1015 set location [$_first hints camera]1016 if { $location != "" } {1017 array set _view $location1018 }1019 set _settings($this-qw) $_view(qw)1020 set _settings($this-qx) $_view(qx)1021 set _settings($this-qy) $_view(qy)1022 set _settings($this-qz) $_view(qz)1023 set _settings($this-xpan) $_view(xpan)1024 set _settings($this-ypan) $_view(ypan)1025 set _settings($this-zoom) $_view(zoom)1026 set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)]1027 $_arcball quaternion $q1028 SendCmd "camera orient $q"1029 SendCmd "camera reset"1030 PanCamera1031 SendCmd "camera zoom $_view(zoom)"1032 }1033 # The active transfer function is by default the first component of1034 # the first data object. This assumes that the data is always1035 # successfully transferred.1036 set comp [lindex [$_first components] 0]1037 set _activeTf [lindex $_obj2style($_first-$comp) 0]1038 }1039 1040 SendCmd "flow reset"1041 StopBufferingCommands1042 948 } 1043 949 … … 1248 1154 foreach comp [$dataobj components] { 1249 1155 set tag $dataobj-$comp 1250 # Send the data as one huge base64-encoded mess -- yuck! 1251 set data [$dataobj blob $comp] 1156 set isvtk 0 1157 # FIXME: Would like to use the type method of the dataobj 1158 # but the returned value isn't well defined now 1159 if {[catch { 1160 # Send the data as one huge base64-encoded mess -- yuck! 1161 set data [$dataobj blob $comp] 1162 }]} { 1163 set data [$dataobj vtkdata $comp] 1164 set isvtk 1 1165 } 1252 1166 set nbytes [string length $data] 1253 1167 if { $_reportClientInfo } { … … 1264 1178 set extents [$dataobj extents $comp] 1265 1179 # I have a field. Is a vector field or a volume field? 1266 if { $extents == 1 } {1180 if { !$isvtk && $extents == 1 } { 1267 1181 set cmd "volume data follows $nbytes $tag\n" 1268 1182 } else {
Note: See TracChangeset
for help on using the changeset viewer.