Changeset 2504 for trunk/gui/scripts/field.tcl
- Timestamp:
- Sep 9, 2011, 1:37:32 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gui/scripts/field.tcl
r2144 r2504 1 1 2 # ---------------------------------------------------------------------- 2 3 # COMPONENT: field - extracts data from an XML description of a field … … 28 29 public method controls {option args} 29 30 public method hints {{key ""}} 31 public method style { cname } 30 32 public method isunirect2d {} 31 33 public method isunirect3d {} 32 34 public method extents {{what -overall}} 33 35 public method flowhints { cname } 36 public method type {} 37 34 38 protected method _build {} 35 39 protected method _getValue {expr} … … 45 49 private variable _comp2xy ;# maps component name => x,y vectors 46 50 private variable _comp2vtk ;# maps component name => vtkFloatArray 51 private variable _comp2vtkstreamlines ;# maps component name => vtkFloatArray 47 52 private variable _comp2dx ;# maps component name => OpenDX data 48 53 private variable _comp2unirect2d ;# maps component name => unirect2d obj … … 51 56 private variable _comp2cntls ;# maps component name => x,y control points 52 57 private variable _comp2extents 58 private variable _type "" 53 59 private variable _comp2flowhints 54 60 private common _counter 0 ;# counter for unique vector names … … 183 189 return [lindex $_comp2xy($what) 0] ;# return xv 184 190 } 191 if { [info exists _comp2vtkstreamlines($what)] } { 192 error "mesh: not implemented for streamlines" 193 return [$mobj mesh] 194 } 185 195 if { [info exists _comp2vtk($what)] } { 186 196 set mobj [lindex $_comp2vtk($what) 0] … … 215 225 return [lindex $_comp2xy($what) 1] ;# return yv 216 226 } 227 if { [info exists _comp2vtkstreamlines($what)] } { 228 # FIXME: Need to process the vtk file data to pull out the field's 229 # values. 230 error "vtkstreamlines: values not implements" 231 return [lindex $_comp2vtkstreamlines($what) 1] 232 } 217 233 if { [info exists _comp2vtk($what)] } { 218 234 return [lindex $_comp2vtk($what) 1] ;# return vtkFloatArray … … 244 260 if { [info exists _comp2vtk($what)] } { 245 261 return "" 262 } 263 if { [info exists _comp2vtkstreamlines($what)] } { 264 # Return the contents of the vtk file. 265 return $_comp2vtkstreamlines($what) 246 266 } 247 267 if {[info exists _comp2dx($what)]} { … … 547 567 catch {unset _comp2dims} 548 568 catch {unset _comp2style} 569 array unset _comp2vtkstreamlines 549 570 array unset _comp2unirect2d 550 571 array unset _comp2unirect3d 551 572 array unset _comp2extents 573 array unset _dataobj2type 552 574 # 553 575 # Scan through the components of the field and create … … 564 586 set type "points-on-mesh" 565 587 } elseif {[$_field element $cname.vtk] != ""} { 566 set type "vtk" 588 if { [$_field get "about.viewer"] == "streamlines" } { 589 set type "vtkstreamlines" 590 } else { 591 set type "vtk" 592 } 567 593 } elseif {[$_field element $cname.opendx] != ""} { 568 594 set type "opendx" … … 579 605 } 580 606 set _comp2extents($cname) $extents 581 607 set _type $type 582 608 if {$type == "1D"} { 583 609 # … … 739 765 set _comp2style($cname) [$_field get $cname.style] 740 766 incr _counter 767 } elseif {$type == "vtkstreamlines"} { 768 set _comp2dims($cname) "3D" 769 set _comp2vtkstreamlines($cname) [$_field get $cname.vtk] 770 set _comp2style($cname) [$_field get $cname.style] 771 incr _counter 741 772 } elseif {$type == "dx"} { 742 773 # … … 848 879 849 880 # 881 # style -- 882 # 883 # Returns the style associated with a component of the field. 884 # 885 itcl::body Rappture::Field::style { cname } { 886 if { [info exists _comp2style($cname)] } { 887 return $_comp2style($cname) 888 } 889 return "" 890 } 891 892 # 893 # type -- 894 # 895 # Returns the style associated with a component of the field. 896 # 897 itcl::body Rappture::Field::type {} { 898 return $_type 899 } 900 901 # 850 902 # extents -- 851 903 #
Note: See TracChangeset
for help on using the changeset viewer.