Changeset 1280


Ignore:
Timestamp:
Mar 2, 2009, 3:22:39 PM (16 years ago)
Author:
dkearney
Message:

adding encodedata tool so i dont have to remember howto mimencode with or without a header from the command line. update nanovis-test adding a a "load script" menu option so i can write my nanovis commands in a file and just send all of the commands in the file to the nv server. also i can just send a vector file to nv server using the "Send flow file" menu option.

Location:
trunk
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/configure.in

    r1270 r1280  
    495495    gui/apps/Makefile
    496496    gui/apps/about
     497    gui/apps/encodedata
    497498    gui/apps/rappture
    498499    gui/apps/rappture-csh.env
  • trunk/gui/apps/Makefile.in

    r1206 r1280  
    2121
    2222SCRIPTS = \
     23                encodedata \
    2324                $(srcdir)/driver \
    2425                $(srcdir)/grabdata \
     
    4950
    5051distclean: clean
    51         $(RM) rappture.env rappture simsim xmldiff
     52        $(RM) encodedata rappture.env rappture rerun simsim xmldiff
    5253        $(RM) Makefile *~
    5354
  • trunk/gui/apps/nanovis-test

    r1014 r1280  
    6464
    6565# ----------------------------------------------------------------------
    66 # Fake data object for sending DX data...
    67 # ----------------------------------------------------------------------
    68 itcl::class DxData {
     66# Fake data object for sending DX or flow data...
     67# ----------------------------------------------------------------------
     68itcl::class visData {
    6969    constructor {args} {
    7070        set _data [Rappture::encoding::encode -as zb64 [lindex $args 0]]
     
    103103            close $fid
    104104          }] == 0} {
    105         set obj [DxData #auto $info]
     105        set obj [visData #auto $info]
    106106        $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# ----------------------------------------------------------------------
     116proc 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# ----------------------------------------------------------------------
     139proc 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
    107152    }
    108153}
     
    120165
    121166    set cmd [$widgets(command) get]
    122    
    123     # Karl
     167
    124168    if {[string length $cmd] > 0} {
    125         set last_command $cmd
     169        set last_command $cmd
    126170    } else {
    127         set cmd $last_command
     171        set cmd $last_command
    128172    }
    129173    namespace eval Rappture::NanovisViewer [list $widgets(nanovis) _send $cmd]
    130174    $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 widgets
    140 
    141     namespace eval Rappture::NanovisViewer [list $widgets(nanovis) _send $cmd]
    142 #    $widgets(command) delete 0 end
    143175}
    144176
     
    192224
    193225# ----------------------------------------------------------------------
    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# ----------------------------------------------------------------------
     229proc 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
    240242}
    241243
     
    324326menu .mbar
    325327menu .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
    327331.mbar.file add command -label "Reset" -underline 0 -command reset
    328332.mbar.file add separator
     
    336340
    337341menu .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}
    340343.mbar add cascade -label "Flow" -underline 0 -menu .mbar.flow
    341344
Note: See TracChangeset for help on using the changeset viewer.