Ignore:
Timestamp:
Sep 4, 2011, 2:33:59 PM (13 years ago)
Author:
ldelgass
Message:

Add a menu item to send a VTK file as the streamlines drawing type for testing

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gui/apps/vtkviewer-test

    r2465 r2470  
    7878    } {
    7979        set _data [lindex $args 0]
     80        set _type [lindex $args 1]
    8081    }
    8182
     
    9697    }
    9798    public method type {args} {
    98         return ""
     99        return $_type
    99100    }
    100101
    101102    private variable _data ""
     103    private variable _type ""
    102104}
    103105
     
    118120            close $fid
    119121          }] == 0} {
    120         set obj [visData #auto $info]
     122        set obj [visData #auto $info ""]
     123        $widgets(vtkviewer) add $obj
     124    }
     125}
     126
     127# ----------------------------------------------------------------------
     128# USAGE: send_streamlines_file
     129#
     130# Prompts the user for a text file, and then sends the text within
     131# that file along to the rendering widget.
     132# ----------------------------------------------------------------------
     133proc send_streamlines_file {} {
     134    global widgets
     135
     136    set file [tk_getOpenFile -title "Open VTK File as Streamlines"]
     137    if {"" != $file && [catch {
     138            set fid [open $file r]
     139            fconfigure $fid -translation binary
     140            set info [read $fid]
     141            close $fid
     142          }] == 0} {
     143        set obj [visData #auto $info "streamlines"]
    121144        $widgets(vtkviewer) add $obj
    122145    }
     
    319342menu .mbar.file
    320343.mbar.file add command -label "Send VTK File..." -underline 0 -command send_file
     344.mbar.file add command -label "Send VTK File as Streamlines..." -underline 0 -command send_streamlines_file
    321345.mbar.file add command -label "Load script..." -underline 0 -command load_script
    322346.mbar.file add command -label "Reset" -underline 0 -command reset
Note: See TracChangeset for help on using the changeset viewer.