Changeset 4548 for branches/1.3/gui/scripts
- Timestamp:
- Jul 17, 2014, 7:20:51 PM (10 years ago)
- Location:
- branches/1.3
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/1.3
-
branches/1.3/gui/scripts/flowvisviewer.tcl
r4547 r4548 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 … … 564 557 # ---------------------------------------------------------------------- 565 558 itcl::body Rappture::FlowvisViewer::destructor {} { 566 set _sendobjs "" ;# stop any send in progress567 559 $_dispatcher cancel !rebuild 568 $_dispatcher cancel !send_dataobjs569 560 $_dispatcher cancel !send_transfunc 570 561 image delete $_image(plot) … … 935 926 # disconnected -- no more data sitting on server 936 927 array unset _serverObjs 937 set _sendobjs ""938 }939 940 # ----------------------------------------------------------------------941 # USAGE: SendDataObjs942 #943 # Used internally to send a series of volume objects off to the944 # server. Sends each object, a little at a time, with updates in945 # between so the interface doesn't lock up.946 # ----------------------------------------------------------------------947 itcl::body Rappture::FlowvisViewer::SendDataObjs {} {948 blt::busy hold $itk_component(hull)949 foreach dataobj $_sendobjs {950 foreach comp [$dataobj components] {951 # Send the data as one huge base64-encoded mess -- yuck!952 set data [$dataobj blob $comp]953 set nbytes [string length $data]954 set extents [$dataobj extents $comp]955 956 # I have a field. Is a vector field or a volume field?957 if { $extents == 1 } {958 set cmd "volume data follows $nbytes $dataobj-$comp\n"959 } else {960 set cmd [FlowCmd $dataobj $comp $nbytes $extents]961 if { $cmd == "" } {962 puts stderr "no command"963 continue964 }965 }966 f { ![SendBytes $cmd] } {967 puts stderr "can't send"968 return969 }970 if { ![SendBytes $data] } {971 puts stderr "can't send"972 return973 }974 NameTransferFunc $dataobj $comp975 set _recvObjs($dataobj-$comp) 1976 }977 }978 set _sendobjs ""979 blt::busy release $itk_component(hull)980 981 # Turn on buffering of commands to the server. We don't want to982 # be preempted by a server disconnect/reconnect (which automatically983 # generates a new call to Rebuild).984 StartBufferingCommands985 986 # activate the proper volume987 set _first [lindex [get] 0]988 if { "" != $_first } {989 set axis [$_first hints updir]990 if {"" != $axis} {991 SendCmd "up $axis"992 }993 994 if 0 {995 set location [$_first hints camera]996 if { $location != "" } {997 array set _view $location998 }999 set _settings($this-qw) $_view(qw)1000 set _settings($this-qx) $_view(qx)1001 set _settings($this-qy) $_view(qy)1002 set _settings($this-qz) $_view(qz)1003 set _settings($this-xpan) $_view(xpan)1004 set _settings($this-ypan) $_view(ypan)1005 set _settings($this-zoom) $_view(zoom)1006 set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)]1007 $_arcball quaternion $q1008 SendCmd "camera orient $q"1009 SendCmd "camera reset"1010 PanCamera1011 SendCmd "camera zoom $_view(zoom)"1012 }1013 # The active transfer function is by default the first component of1014 # the first data object. This assumes that the data is always1015 # successfully transferred.1016 set comp [lindex [$_first components] 0]1017 set _activeTf [lindex $_obj2style($_first-$comp) 0]1018 }1019 1020 SendCmd "flow reset"1021 StopBufferingCommands1022 928 } 1023 929 … … 1228 1134 foreach comp [$dataobj components] { 1229 1135 set tag $dataobj-$comp 1230 # Send the data as one huge base64-encoded mess -- yuck! 1231 set data [$dataobj blob $comp] 1136 set isvtk 0 1137 # FIXME: Would like to use the type method of the dataobj 1138 # but the returned value isn't well defined now 1139 if {[catch { 1140 # Send the data as one huge base64-encoded mess -- yuck! 1141 set data [$dataobj blob $comp] 1142 }]} { 1143 set data [$dataobj vtkdata $comp] 1144 set isvtk 1 1145 } 1232 1146 set nbytes [string length $data] 1233 1147 if { $_reportClientInfo } { … … 1244 1158 set extents [$dataobj extents $comp] 1245 1159 # I have a field. Is a vector field or a volume field? 1246 if { $extents == 1 } {1160 if { !$isvtk && $extents == 1 } { 1247 1161 set cmd "volume data follows $nbytes $tag\n" 1248 1162 } else {
Note: See TracChangeset
for help on using the changeset viewer.