- Timestamp:
- Apr 26, 2013, 5:25:25 AM (11 years ago)
- Location:
- trunk/gui/scripts
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gui/scripts/drawing.tcl
r3330 r3637 18 18 19 19 itcl::class Rappture::Drawing { 20 constructor {xmlobj path} {21 # defined below22 }23 destructor {24 # defined below25 }26 public method limits {axis}27 public method label { elem }28 public method type { elem }29 public method style { elem }30 public method shape { elem }31 public method values { elem }32 public method data { elem }33 public method hints {{keyword ""}}34 public method components { args }35 36 20 private variable _drawing 37 21 private variable _xmlobj … … 45 29 private variable _units 46 30 private variable _limits 47 } 31 32 constructor {xmlobj path} { 33 # defined below 34 } 35 destructor { 36 # defined below 37 } 38 public method limits {axis} 39 public method label { elem } 40 public method type { elem } 41 public method style { elem } 42 public method shape { elem } 43 public method values { elem } 44 public method data { elem } 45 public method hints {{keyword ""}} 46 public method components { args } 47 private method PdbToVtk { cname contents } 48 } 49 48 50 49 51 # ---------------------------------------------------------------------- … … 97 99 } 98 100 molecule* { 99 set _data($elem) [$_xmlobj get $path.$elem.vtk] 101 set pdbdata [$_xmlobj get $path.$elem.pdb] 102 if { $pdbdata != "" } { 103 set contents [PdbToVTk $elem $pdbdata] 104 } else { 105 set contents [$_xmlobj get $path.$elem.vtk] 106 } 100 107 set _data($elem) [string trim $_data($elem)] 101 108 set _styles($elem) [$_xmlobj get $path.$elem.about.style] … … 330 337 } 331 338 339 340 itcl::body Rappture::Drawing::PdbToVtk { cname contents } { 341 package require vtk 342 343 set reader $this-datasetreader 344 vtkPDBReader $reader 345 346 # Write the contents to a file just in case it's binary. 347 set tmpfile $cname[pid].pdb 348 set f [open "$tmpfile" "w"] 349 fconfigure $f -translation binary -encoding binary 350 puts $f $contents 351 close $f 352 $reader SetFileName $tmpfile 353 $reader Update 354 file delete $tmpfile 355 356 set output [$reader GetOutput] 357 set pointData [$output GetPointData] 358 set _scalars {} 359 for { set i 0 } { $i < [$pointData GetNumberOfArrays] } { incr i } { 360 set name [$pointData GetArrayName $i] 361 lappend _scalars $name $name "???" 362 } 363 set tmpfile $cname[pid].vtk 364 set writer $this-datasetwriter 365 vtkDataSetWriter $writer 366 $writer SetInputConnection [$reader GetOutputPort] 367 $writer SetFileName $tmpfile 368 $writer Write 369 rename $reader "" 370 rename $writer "" 371 372 set f [open "$tmpfile" "r"] 373 fconfigure $f -translation binary -encoding binary 374 set vtkdata [read $f] 375 close $f 376 file delete $tmpfile 377 return $vtkdata 378 } -
trunk/gui/scripts/molvisviewer.tcl
r3592 r3637 765 765 set _cacheid $cacheid 766 766 } 767 #debug "reading $size bytes from proxy\n"768 767 set data [ReceiveBytes $size] 769 768 #debug "success: reading $size bytes from proxy\n" … … 964 963 # Save the PDB data in case the user wants to later save it. 965 964 set _pdbdata $data1 966 set n Bytes [string length $data1]965 set numBytes [string length $data1] 967 966 968 967 # We know we're buffered here, so append the "loadpdb" command 969 968 # with the data payload immediately afterwards. 970 ServerCmd "loadpdb -defer follows $model $state $n Bytes"969 ServerCmd "loadpdb -defer follows $model $state $numBytes" 971 970 append _outbuf $data1 972 971 set _dataobjs($model-$state) 1 … … 977 976 # Save the PDB data in case the user wants to later save it. 978 977 set _pdbdata $data2 979 set n Bytes [string length $data2]978 set numBytes [string length $data2] 980 979 981 980 # We know we're buffered here, so append the "loadpdb" command 982 981 # with the data payload immediately afterwards. 983 ServerCmd "loadpdb -defer follows $model $state $n Bytes"982 ServerCmd "loadpdb -defer follows $model $state $numBytes" 984 983 append _outbuf $data2 985 984 set _dataobjs($model-$state) 1 … … 1026 1025 # Save the PDB data in case the user wants to later save it. 1027 1026 set _pdbdata $data3 1028 set n Bytes [string length $data3]1027 set numBytes [string length $data3] 1029 1028 1030 1029 # We know we're buffered here, so append the "loadpdb" 1031 1030 # command with the data payload immediately afterwards. 1032 ServerCmd "loadpdb -defer follows $model $state $n Bytes"1031 ServerCmd "loadpdb -defer follows $model $state $numBytes" 1033 1032 append _outbuf $data3 1034 1033 }
Note: See TracChangeset
for help on using the changeset viewer.