- Timestamp:
- May 17, 2015, 11:10:45 PM (9 years ago)
- Location:
- trunk/gui/scripts
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gui/scripts/field.tcl
r5536 r5539 76 76 public method components {args} 77 77 public method controls {option args} 78 public method extents {{cname -overall}}79 78 public method fieldinfo { fname } { 80 79 lappend out $_fld2Label($fname) … … 159 158 private variable _comp2style; # cname => style settings 160 159 private variable _comp2cntls; # cname => x,y control points (1D only) 161 private variable _comp2extents; # cname => extents (Only for unirect)162 160 private variable _comp2limits; # Array of limits per component 163 161 private variable _comp2flowhints … … 768 766 array unset _comp2unirect2d 769 767 array unset _comp2unirect3d 770 array unset _comp2extents771 768 array unset _dataobj2type 772 769 # … … 786 783 } elseif { [$_field element $cname.vtk] != ""} { 787 784 set type "vtk" 788 set viewer [$_field get "about.view"]789 if { $viewer != "" } {790 set _viewer $viewer791 }792 785 } elseif {[$_field element $cname.opendx] != ""} { 793 global env794 if { [info exists env(VTKVOLUME)] } {795 set _viewer "vtkvolume"796 }797 786 set type "opendx" 798 787 } elseif {[$_field element $cname.dx] != ""} { 799 global env800 if { [info exists env(VTKVOLUME)] } {801 set _viewer "vtkvolume"802 }803 788 set type "dx" 804 789 } elseif {[$_field element $cname.ucd] != ""} { … … 812 797 continue 813 798 } 814 # Save the extents of the component815 if { [$_field element $cname.extents] != "" } {816 set extents [$_field get $cname.extents]817 } else {818 set extents 1819 }820 set _comp2extents($cname) $extents821 799 set _type $type 822 800 823 801 GetTypeAndSize $cname 824 802 GetAssociation $cname 825 if { $_comp2size($cname) > 1 } { 826 set viewer [$_field get "about.view"] 827 if { $viewer == "" } { 803 804 if { [$_field element $cname.flow] != "" } { 805 set haveFlow 1 806 } else { 807 set haveFlow 0 808 } 809 set viewer [$_field get "about.view"] 810 if { $viewer != "" } { 811 set _viewer $viewer 812 } 813 if { $_viewer == "" } { 814 if { $_comp2size($cname) > 1 && ! $haveFlow } { 828 815 set _viewer "glyphs" 829 } 830 } 816 } elseif { $_comp2size($cname) > 1 && $haveFlow } { 817 set _viewer "flowvis" 818 } 819 } 820 831 821 if {$type == "1D"} { 832 822 # … … 896 886 # Extract gzipped, base64-encoded OpenDX data 897 887 # 898 set viewer [$_field get "about.view"]899 if { $viewer != "" } {900 set _viewer $viewer901 }902 888 if { $_viewer == "" } { 889 global env 890 if { [info exists env(VTKVOLUME)] } { 891 set _viewer "vtkvolume" 892 } 903 893 if {[$_field element $cname.flow] != ""} { 904 894 set _viewer "flowvis" … … 947 937 unset vtkdata 948 938 set _comp2style($cname) [$_field get $cname.style] 949 if { [$_field element $cname.flow] != ""} {939 if {$hasFlow} { 950 940 set _comp2flowhints($cname) \ 951 941 [Rappture::FlowHints ::\#auto $_field $cname $_units] … … 956 946 if { $contents == "" } { 957 947 continue; # Ignore this component 958 }959 set viewer [$_field get "about.view"]960 if { $viewer != "" } {961 set _viewer $viewer962 948 } 963 949 set vtkdata [DicomToVtk $cname $contents] … … 1137 1123 } 1138 1124 return 1; # Default to scalar. 1139 }1140 1141 #1142 # extents --1143 #1144 # Returns the extents of the named component1145 #1146 itcl::body Rappture::Field::extents {{cname -overall}} {1147 if {$cname == "-overall" } {1148 set max 01149 foreach cname [$_field children -type component] {1150 if { ![info exists _comp2extents($cname)] } {1151 continue1152 }1153 set value $_comp2extents($cname)1154 if { $max < $value } {1155 set max $value1156 }1157 }1158 return $max1159 }1160 if { $cname == "component0"} {1161 set cname [lindex [components -name] 0]1162 }1163 return $_comp2extents($cname)1164 1125 } 1165 1126 … … 1423 1384 return 0 1424 1385 } 1425 set viewer [$_field get "about.view"]1426 if { $viewer != "" } {1427 set _viewer $viewer1428 }1429 1386 set element [$_xmlobj element -as type $path] 1430 1387 set name $cname … … 1442 1399 if { $element == "unirect3d" } { 1443 1400 # Special case: unirect3d (deprecated) + flow. 1444 if { [$_field element $cname.extents] != "" } { 1445 set vectorsize [$_field get $cname.extents] 1446 } else { 1447 set vectorsize 1 1448 } 1401 set vectorsize [numComponents $cname] 1449 1402 set _type unirect3d 1450 1403 set _dim 3 … … 1475 1428 if { $element == "unirect2d" && [$_field element $cname.flow] != "" } { 1476 1429 # Special case: unirect2d (deprecated) + flow. 1477 if { [$_field element $cname.extents] != "" } { 1478 set vectorsize [$_field get $cname.extents] 1479 } else { 1480 set vectorsize 1 1481 } 1430 set vectorsize [numComponents $cname] 1482 1431 set _type unirect2d 1483 1432 set _dim 2 … … 1752 1701 } 1753 1702 set type [$_field get $cname.elemtype] 1703 # <extents> is a deprecated synonym for <elemsize> 1704 set extents [$_field get $cname.extents] 1754 1705 if { $type == "" } { 1755 set type "scalars" 1706 if { $extents != "" && $extents > 1 } { 1707 set type "vectors" 1708 } else { 1709 set type "scalars" 1710 } 1756 1711 } 1757 1712 if { ![info exists type2components($type)] } { … … 1760 1715 set size [$_field get $cname.elemsize] 1761 1716 if { $size == "" } { 1762 set size $type2components($type) 1717 if { $extents != "" } { 1718 set size $extents 1719 } else { 1720 set size $type2components($type) 1721 } 1763 1722 } 1764 1723 set _comp2type($cname) $type -
trunk/gui/scripts/flowvisviewer.tcl
r5527 r5539 109 109 private method ReceiveLegend { tf vmin vmax size } 110 110 private method Rotate {option x y} 111 private method SendFlowCmd { dataobj comp nbytes extents }111 private method SendFlowCmd { dataobj comp nbytes numComponents } 112 112 private method SendTransferFunctions {} 113 113 private method SetOrientation { side } … … 1152 1152 SendCmd "clientinfo [list $info]" 1153 1153 } 1154 set extents [$dataobj extents $cname]1154 set numComponents [$dataobj numComponents $cname] 1155 1155 # I have a field. Is a vector field or a volume field? 1156 if { !$isvtk && $ extents == 1 } {1156 if { !$isvtk && $numComponents == 1 } { 1157 1157 SendCmd "volume data follows $nbytes $tag" 1158 1158 } else { 1159 if {[SendFlowCmd $dataobj $cname $nbytes $ extents] < 0} {1159 if {[SendFlowCmd $dataobj $cname $nbytes $numComponents] < 0} { 1160 1160 continue 1161 1161 } … … 2513 2513 } 2514 2514 2515 itcl::body Rappture::FlowvisViewer::SendFlowCmd { dataobj comp nbytes extents } {2515 itcl::body Rappture::FlowvisViewer::SendFlowCmd { dataobj comp nbytes numComponents } { 2516 2516 set tag "$dataobj-$comp" 2517 2517 if { ![info exists _dataset2flow($tag)] } { 2518 2518 SendCmd "flow add $tag" 2519 SendCmd "$tag data follows $nbytes $ extents"2519 SendCmd "$tag data follows $nbytes $numComponents" 2520 2520 return 0 2521 2521 } … … 2572 2572 SendCmd $cmd 2573 2573 } 2574 SendCmd "$tag data follows $nbytes $ extents"2574 SendCmd "$tag data follows $nbytes $numComponents" 2575 2575 return 0 2576 2576 }
Note: See TracChangeset
for help on using the changeset viewer.