Changeset 3940 for trunk/gui/scripts/flowvisviewer.tcl
- Timestamp:
- Sep 20, 2013, 1:30:29 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gui/scripts/flowvisviewer.tcl
r3915 r3940 44 44 itk_option define -plotoutline plotOutline PlotOutline "" 45 45 46 private variable _volcomponents ; # Array of components found 47 private variable _componentsList ; # Array of components found 48 private method BuildVolumeComponents {} 49 private method GetDatasetsWithComponent { cname } 50 46 51 constructor { hostlist args } { 47 52 Rappture::VisViewer::constructor $hostlist … … 63 68 public method get {args} 64 69 public method isconnected {} 65 public method limits { tf}70 public method limits { cname } 66 71 public method overmarker { m x } 67 72 public method parameters {title args} { … … 232 237 $_arcball quaternion $q 233 238 234 set _limits(vmin) 0.0 235 set _limits(vmax) 1.0 239 set _limits(v) [list 0.0 1.0] 236 240 set _reset 1 237 241 … … 692 696 # ---------------------------------------------------------------------- 693 697 itcl::body Rappture::FlowvisViewer::delete {args} { 694 698 flow stop 695 699 if {[llength $args] == 0} { 696 700 set args $_dlist … … 742 746 # ---------------------------------------------------------------------- 743 747 itcl::body Rappture::FlowvisViewer::scale {args} { 744 foreach val {xmin xmax ymin ymax vmin vmax} { 745 set _limits($val) "" 746 } 747 foreach obj $args { 748 foreach axis {x y v} { 749 750 foreach { min max } [$obj limits $axis] break 751 748 array set style { 749 -color BCGYR 750 -levels 6 751 -opacity 1.0 752 -markers "" 753 } 754 array unset _limits 755 array unset _volcomponents 756 foreach dataobj $args { 757 if { ![$dataobj isvalid] } { 758 continue; # Object doesn't contain valid data. 759 } 760 foreach cname [$dataobj components] { 761 if { ![info exists _volcomponents($cname)] } { 762 lappend _componentsList $cname 763 array set style [lindex [$dataobj components -style $cname] 0] 764 set cmap [ColorsToColormap $style(-color)] 765 set _cname2defaultcolormap($cname) $cmap 766 set _settings($cname-colormap) $style(-color) 767 } 768 lappend _volcomponents($cname) $dataobj-$cname 769 array unset limits 770 array set limits [$dataobj valueLimits $cname] 771 set _limits($cname) $limits(v) 772 } 773 foreach axis {x y z v} { 774 foreach { min max } [$dataobj limits $axis] break 752 775 if {"" != $min && "" != $max} { 753 if {"" == $_limits(${axis}min)} { 754 set _limits(${axis}min) $min 755 set _limits(${axis}max) $max 776 if { ![info exists _limits($axis)] } { 777 set _limits($axis) [list $min $max] 756 778 } else { 757 if {$min < $_limits(${axis}min)} { 758 set _limits(${axis}min) $min 779 foreach {amin amax} $_limits($axis) break 780 if {$min < $amin} { 781 set amin $min 759 782 } 760 if {$max > $ _limits(${axis}max)} {761 set _limits(${axis}max)$max783 if {$max > $amax} { 784 set amax $max 762 785 } 786 set _limits($axis) [list $amin $amax] 763 787 } 764 788 } 765 789 } 766 790 } 791 #BuildVolumeComponents 767 792 } 768 793 … … 1132 1157 # Display the markers used by the active transfer function. 1133 1158 set tf $_obj2style($tag) 1134 array set limits [limits $tf]1135 $c itemconfigure vmin -text [format %.2g $ limits(vmin)]1159 foreach {vmin vmax} [limits $tf] break 1160 $c itemconfigure vmin -text [format %.2g $vmin] 1136 1161 $c coords vmin $lx $ly 1137 1162 1138 $c itemconfigure vmax -text [format %.2g $ limits(vmax)]1163 $c itemconfigure vmax -text [format %.2g $vmax] 1139 1164 $c coords vmax [expr {$w-$lx}] $ly 1140 1165 … … 1176 1201 set dataobj [lindex $parts 0] 1177 1202 set _serverObjs($tag) 0 1178 set _limits($tag-min) $values(min); # Minimum value of the volume. 1179 set _limits($tag-max) $values(max); # Maximum value of the volume. 1203 set _limits($tag) [list $values(min) $values(max)] 1180 1204 unset _recvObjs($tag) 1181 1205 if { [array size _recvObjs] == 0 } { … … 1413 1437 1414 1438 itcl::body Rappture::FlowvisViewer::PanCamera {} { 1415 #set x [expr ($_view(xpan)) / $_limits(xrange)]1416 #set y [expr ($_view(ypan)) / $_limits(yrange)]1417 1439 set x $_view(xpan) 1418 1440 set y $_view(ypan) … … 1827 1849 # now. 1828 1850 # 1829 itcl::body Rappture::FlowvisViewer::NameTransferFunc { dataobj c omp} {1851 itcl::body Rappture::FlowvisViewer::NameTransferFunc { dataobj cname } { 1830 1852 array set style { 1831 1853 -color BCGYR … … 1835 1857 -transp 50 1836 1858 } 1837 array set style [lindex [$dataobj components -style $c omp] 0]1859 array set style [lindex [$dataobj components -style $cname] 0] 1838 1860 set _settings($this-light) $style(-light) 1839 1861 set _settings($this-transp) $style(-transp) 1840 1862 set _settings($this-opacity) [expr $style(-opacity) * 100] 1841 set tf "$style(-color):$style(-levels):$style(-opacity)" 1842 set _obj2style($dataobj-$comp) $tf 1843 lappend _style2objs($tf) $dataobj $comp 1844 return $tf 1863 set _obj2style($dataobj-$cname) $cname 1864 lappend _style2objs($cname) $dataobj $cname 1865 return $cname 1845 1866 } 1846 1867 … … 2118 2139 } 2119 2140 2120 itcl::body Rappture::FlowvisViewer::limits { tf } { 2121 set _limits(vmin) 0.0 2122 set _limits(vmax) 1.0 2123 if { ![info exists _style2objs($tf)] } { 2124 puts stderr "no style2objs for $tf tf=($tf)" 2141 itcl::body Rappture::FlowvisViewer::limits { cname } { 2142 set _limits(v) [list 0.0 1.0] 2143 if { ![info exists _style2objs($cname)] } { 2144 puts stderr "no style2objs for $cname cname=($cname)" 2125 2145 return [array get _limits] 2126 2146 } 2127 2147 set min ""; set max "" 2128 foreach {dataobj comp} $_style2objs($tf) { 2129 set tag $dataobj-$comp 2148 foreach tag [GetDatasetsWithComponent $cname] { 2130 2149 if { ![info exists _serverObjs($tag)] } { 2131 2150 puts stderr "$tag not in serverObjs?" 2132 2151 continue 2133 2152 } 2134 if { ![info exists _limits($tag -min)] } {2153 if { ![info exists _limits($tag)] } { 2135 2154 puts stderr "$tag no min?" 2136 2155 continue 2137 2156 } 2138 if { $min == "" || $min > $_limits($tag-min) } { 2139 set min $_limits($tag-min) 2140 } 2141 if { $max == "" || $max < $_limits($tag-max) } { 2142 set max $_limits($tag-max) 2143 } 2144 } 2145 if { $min != "" } { 2146 set _limits(vmin) $min 2147 } 2148 if { $max != "" } { 2149 set _limits(vmax) $max 2150 } 2151 return [array get _limits] 2157 foreach {vmin vmax} $_limits($tag) break 2158 if { $min == "" || $min > $vmin } { 2159 set min $vmin 2160 } 2161 if { $max == "" || $max < $vmax } { 2162 set max $vmax 2163 } 2164 } 2165 if { $min != "" && $max != "" } { 2166 set _limits(v) [list $min $max] 2167 set _limits($cname) [list $min $max] 2168 } 2169 return $_limits($cname) 2152 2170 } 2153 2171 … … 2638 2656 itcl::body Rappture::FlowvisViewer::SlicerTip {axis} { 2639 2657 set val [$itk_component(${axis}CutScale) get] 2640 # set val [expr {0.01*($val-50)2641 # *($_limits(${axis}max)-$_limits(${axis}min))2642 # + 0.5*($_limits(${axis}max)+$_limits(${axis}min))}]2643 2658 return "Move the [string toupper $axis] cut plane.\nCurrently: $axis = $val%" 2644 2659 } … … 3094 3109 set _settings($this-zoom) $_view(zoom) 3095 3110 } 3111 3112 # Reset global settings from dataset's settings. 3113 itcl::body Rappture::FlowvisViewer::BuildVolumeComponents {} { 3114 $itk_component(volcomponents) choices delete 0 end 3115 foreach name $_componentsList { 3116 $itk_component(volcomponents) choices insert end $name $name 3117 } 3118 set _current [lindex $_componentsList 0] 3119 $itk_component(volcomponents) value $_current 3120 } 3121 3122 # Reset global settings from dataset's settings. 3123 itcl::body Rappture::FlowvisViewer::GetDatasetsWithComponent { cname } { 3124 if { ![info exists _volcomponents($cname)] } { 3125 return "" 3126 } 3127 set list "" 3128 foreach tag $_volcomponents($cname) { 3129 if { ![info exists _serverObjs($tag)] } { 3130 continue 3131 } 3132 lappend list $tag 3133 } 3134 return $list 3135 }
Note: See TracChangeset
for help on using the changeset viewer.