Changeset 1280 for trunk/gui/apps/nanovis-test
- Timestamp:
- Mar 2, 2009, 3:22:39 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gui/apps/nanovis-test
r1014 r1280 64 64 65 65 # ---------------------------------------------------------------------- 66 # Fake data object for sending DX data...67 # ---------------------------------------------------------------------- 68 itcl::class DxData {66 # Fake data object for sending DX or flow data... 67 # ---------------------------------------------------------------------- 68 itcl::class visData { 69 69 constructor {args} { 70 70 set _data [Rappture::encoding::encode -as zb64 [lindex $args 0]] … … 103 103 close $fid 104 104 }] == 0} { 105 set obj [ DxData #auto $info]105 set obj [visData #auto $info] 106 106 $widgets(nanovis) add $obj 107 } 108 } 109 110 # ---------------------------------------------------------------------- 111 # USAGE: send_flow_file 112 # 113 # Prompts the user for a text file, and then sends the text within 114 # that file along to the rendering widget. 115 # ---------------------------------------------------------------------- 116 proc send_flow_file {} { 117 global widgets 118 119 set file [tk_getOpenFile -title "Open Command File"] 120 if {"" != $file && [catch { 121 set fid [open $file r] 122 fconfigure $fid -translation binary 123 set info [read $fid] 124 close $fid 125 }] == 0} { 126 set _data [Rappture::encoding::encode -as zb64 $info ] 127 set _data "flow data follows [string length $_data]\n$_data" 128 $widgets(command) insert 0 $_data 129 send_command 130 } 131 } 132 133 # ---------------------------------------------------------------------- 134 # USAGE: load_script 135 # 136 # Prompts the user for a text file, and then sends the text within 137 # that file along to the rendering widget. 138 # ---------------------------------------------------------------------- 139 proc load_script {} { 140 global widgets 141 142 set file [tk_getOpenFile -title "Open Command File"] 143 if {"" != $file && [catch { 144 set fid [open $file r] 145 fconfigure $fid -translation binary 146 set info [read $fid] 147 close $fid 148 }] == 0} { 149 150 $widgets(command) insert 0 $info 151 send_command 107 152 } 108 153 } … … 120 165 121 166 set cmd [$widgets(command) get] 122 123 # Karl 167 124 168 if {[string length $cmd] > 0} { 125 169 set last_command $cmd 126 170 } else { 127 171 set cmd $last_command 128 172 } 129 173 namespace eval Rappture::NanovisViewer [list $widgets(nanovis) _send $cmd] 130 174 $widgets(command) delete 0 end 131 }132 133 # ----------------------------------------------------------------------134 # USAGE: karl_send_command <cmd>135 #136 # Used internally in this script (not from command prompt)137 # ----------------------------------------------------------------------138 proc karl_send_command {cmd} {139 global widgets140 141 namespace eval Rappture::NanovisViewer [list $widgets(nanovis) _send $cmd]142 # $widgets(command) delete 0 end143 175 } 144 176 … … 192 224 193 225 # ---------------------------------------------------------------------- 194 # USAGE: karl_activate_flow 195 # 196 # ---------------------------------------------------------------------- 197 proc karl_activate_flow {} { 198 199 global img_storage_dir 200 puts "Preparing images..." 201 202 # sequence of commands to initilize flow visualization go here 203 karl_send_command {test} 204 karl_send_command {flow vectorid 0} 205 karl_send_command {flow particle visible on} 206 207 set renderserver render05 208 set img_storage_dir [exec ssh $renderserver mktemp -d /tmp/animation.XXXXXX] 209 karl_send_command "flow capture 117 $img_storage_dir" 210 } 211 212 # ---------------------------------------------------------------------- 213 # USAGE: karl_flow_movie 214 # 215 # ---------------------------------------------------------------------- 216 proc karl_flow_movie {} { 217 218 global img_storage_dir 219 set renderserver render05 220 221 222 if {0} { 223 # create animated gif: 224 puts "creating animated gif..." 225 exec ssh $renderserver convert -delay 20 -loop 0 $img_storage_dir/image*.bmp $img_storage_dir/animated_flow.gif 226 } else { 227 # create mpeg movie: 228 puts "creating mpeg movie in $img_storage_dir" 229 230 exec ssh $renderserver "cd $img_storage_dir && mogrify -format jpg *.bmp && ffmpeg -i image%03d.jpg flow_movie.mpg 2>/dev/null && rm *.jpg" 231 } 232 233 # Now present the .mpg or .gif file to the user to download 234 ## ?? 235 236 return 237 238 # Finally, delete the temporary animation directory we have created 239 exec ssh $renderserver rmdir $img_storage_dir 226 # USAGE: activate_flow 227 # 228 # ---------------------------------------------------------------------- 229 proc activate_flow {} { 230 global widgets 231 # global img_storage_dir 232 # "flow capture 117 $img_storage_dir" 233 234 set info {flow vectorid 0 235 flow particle visible on 236 flow lic on 237 flow capture 100} 238 239 $widgets(command) insert 0 $info 240 send_command 241 240 242 } 241 243 … … 324 326 menu .mbar 325 327 menu .mbar.file 326 .mbar.file add command -label "Send file..." -underline 0 -command send_file 328 .mbar.file add command -label "Send Volume File..." -underline 0 -command send_file 329 .mbar.file add command -label "Send Flow File..." -underline 0 -command send_flow_file 330 .mbar.file add command -label "Load script..." -underline 0 -command load_script 327 331 .mbar.file add command -label "Reset" -underline 0 -command reset 328 332 .mbar.file add separator … … 336 340 337 341 menu .mbar.flow 338 .mbar.flow add command -label "Activate Flow" -command {karl_activate_flow} 339 .mbar.flow add command -label "Capture Flow Movie" -command {karl_flow_movie} 342 .mbar.flow add command -label "Activate Flow" -command {activate_flow} 340 343 .mbar add cascade -label "Flow" -underline 0 -menu .mbar.flow 341 344
Note: See TracChangeset
for help on using the changeset viewer.