Ignore:
Timestamp:
Jun 21, 2014, 5:58:05 PM (10 years ago)
Author:
ldelgass
Message:

Merge from trunk

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/1.3/gui/scripts/drawing.tcl

    r3879 r4412  
    1212package require Itcl
    1313package require BLT
    14 
    15 set count 0
    1614
    1715namespace eval Rappture {
     
    4745    public method hints {{keyword ""}}
    4846    public method components { args }
    49     private method PdbToVtk { cname contents }
    5047}
    5148
     
    109106                set pdbdata [$_xmlobj get $path.$elem.pdb]
    110107                if { $pdbdata != "" } {
    111                     if 0 {
    112                         global count
    113                         set f [open /tmp/file$count.pdb "w"]
    114                         incr count
    115                         puts $f $pdbdata
    116                         close $f
    117                     }
    118108                    set contents [Rappture::PdbToVtk $pdbdata]
    119                     if 0 {
    120                         set f [open /tmp/convertedpdb.vtk "w"]
    121                         puts $f $contents
    122                         close $f
    123                     }
    124109                } else {
    125110                    set contents [$_xmlobj get $path.$elem.vtk]
     
    356341}
    357342
    358 itcl::body Rappture::Drawing::PdbToVtk { cname contents } {
    359     package require vtk
    360 
    361     set reader $this-datasetreader
    362     vtkPDBReader $reader
    363 
    364     # Write the contents to a file just in case it's binary.
    365     set tmpfile $cname[pid].pdb
    366     set f [open "$tmpfile" "w"]
    367     fconfigure $f -translation binary -encoding binary
    368     puts $f $contents
    369     close $f
    370     $reader SetFileName $tmpfile
    371     $reader Update
    372     file delete $tmpfile
    373 
    374     set tmpfile $cname[pid].vtk
    375     set writer $this-datasetwriter
    376     vtkDataSetWriter $writer
    377     $writer SetInputConnection [$reader GetOutputPort]
    378     $writer SetFileName $tmpfile
    379     $writer Write
    380     rename $reader ""
    381     rename $writer ""
    382 
    383     set f [open "$tmpfile" "r"]
    384     fconfigure $f -translation binary -encoding binary
    385     set vtkdata [read $f]
    386     close $f
    387     file delete $tmpfile
    388     return $vtkdata
    389 }
Note: See TracChangeset for help on using the changeset viewer.