- Timestamp:
- Jul 17, 2014, 7:12:39 PM (10 years ago)
- Location:
- branches/1.3
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/1.3
-
branches/1.3/gui/scripts/flowvisviewer.tcl
r4494 r4547 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 … … 672 676 # ---------------------------------------------------------------------- 673 677 itcl::body Rappture::FlowvisViewer::delete {args} { 674 678 flow stop 675 679 if {[llength $args] == 0} { 676 680 set args $_dlist … … 722 726 # ---------------------------------------------------------------------- 723 727 itcl::body Rappture::FlowvisViewer::scale {args} { 724 foreach val {xmin xmax ymin ymax vmin vmax} { 725 set _limits($val) "" 726 } 727 foreach obj $args { 728 foreach axis {x y v} { 729 730 foreach { min max } [$obj limits $axis] break 731 728 array set style { 729 -color BCGYR 730 -levels 6 731 -opacity 1.0 732 -markers "" 733 } 734 array unset _limits 735 array unset _volcomponents 736 foreach dataobj $args { 737 if { ![$dataobj isvalid] } { 738 continue; # Object doesn't contain valid data. 739 } 740 foreach cname [$dataobj components] { 741 if { ![info exists _volcomponents($cname)] } { 742 lappend _componentsList $cname 743 array set style [lindex [$dataobj components -style $cname] 0] 744 set cmap [ColorsToColormap $style(-color)] 745 set _cname2defaultcolormap($cname) $cmap 746 set _settings($cname-colormap) $style(-color) 747 } 748 lappend _volcomponents($cname) $dataobj-$cname 749 array unset limits 750 array set limits [$dataobj valueLimits $cname] 751 set _limits($cname) $limits(v) 752 } 753 foreach axis {x y z v} { 754 foreach { min max } [$dataobj limits $axis] break 732 755 if {"" != $min && "" != $max} { 733 if {"" == $_limits(${axis}min)} { 734 set _limits(${axis}min) $min 735 set _limits(${axis}max) $max 756 if { ![info exists _limits($axis)] } { 757 set _limits($axis) [list $min $max] 736 758 } else { 737 if {$min < $_limits(${axis}min)} { 738 set _limits(${axis}min) $min 759 foreach {amin amax} $_limits($axis) break 760 if {$min < $amin} { 761 set amin $min 739 762 } 740 if {$max > $ _limits(${axis}max)} {741 set _limits(${axis}max)$max763 if {$max > $amax} { 764 set amax $max 742 765 } 766 set _limits($axis) [list $amin $amax] 743 767 } 744 768 } 745 769 } 746 770 } 771 #BuildVolumeComponents 747 772 } 748 773 … … 1112 1137 # Display the markers used by the active transfer function. 1113 1138 set tf $_obj2style($tag) 1114 array set limits [limits $tf]1115 $c itemconfigure vmin -text [format %.2g $ limits(vmin)]1139 foreach {vmin vmax} [limits $tf] break 1140 $c itemconfigure vmin -text [format %.2g $vmin] 1116 1141 $c coords vmin $lx $ly 1117 1142 1118 $c itemconfigure vmax -text [format %.2g $ limits(vmax)]1143 $c itemconfigure vmax -text [format %.2g $vmax] 1119 1144 $c coords vmax [expr {$w-$lx}] $ly 1120 1145 … … 1156 1181 set dataobj [lindex $parts 0] 1157 1182 set _serverObjs($tag) 0 1158 set _limits($tag-min) $values(min); # Minimum value of the volume. 1159 set _limits($tag-max) $values(max); # Maximum value of the volume. 1183 set _limits($tag) [list $values(min) $values(max)] 1160 1184 unset _recvObjs($tag) 1161 1185 if { [array size _recvObjs] == 0 } { … … 1389 1413 1390 1414 itcl::body Rappture::FlowvisViewer::PanCamera {} { 1391 #set x [expr ($_view(xpan)) / $_limits(xrange)]1392 #set y [expr ($_view(ypan)) / $_limits(yrange)]1393 1415 set x $_view(xpan) 1394 1416 set y $_view(ypan) … … 1773 1795 # now. 1774 1796 # 1775 itcl::body Rappture::FlowvisViewer::NameTransferFunc { dataobj c omp} {1797 itcl::body Rappture::FlowvisViewer::NameTransferFunc { dataobj cname } { 1776 1798 array set style { 1777 1799 -color BCGYR … … 1781 1803 -transp 50 1782 1804 } 1783 array set style [lindex [$dataobj components -style $c omp] 0]1805 array set style [lindex [$dataobj components -style $cname] 0] 1784 1806 set _settings($this-light) $style(-light) 1785 1807 set _settings($this-transp) $style(-transp) 1786 1808 set _settings($this-opacity) [expr $style(-opacity) * 100] 1787 set tf "$style(-color):$style(-levels):$style(-opacity)" 1788 set _obj2style($dataobj-$comp) $tf 1789 lappend _style2objs($tf) $dataobj $comp 1790 return $tf 1809 set _obj2style($dataobj-$cname) $cname 1810 lappend _style2objs($cname) $dataobj $cname 1811 return $cname 1791 1812 } 1792 1813 … … 2064 2085 } 2065 2086 2066 itcl::body Rappture::FlowvisViewer::limits { tf } { 2067 set _limits(vmin) 0.0 2068 set _limits(vmax) 1.0 2069 if { ![info exists _style2objs($tf)] } { 2070 puts stderr "no style2objs for $tf tf=($tf)" 2087 itcl::body Rappture::FlowvisViewer::limits { cname } { 2088 set _limits(v) [list 0.0 1.0] 2089 if { ![info exists _style2objs($cname)] } { 2090 puts stderr "no style2objs for $cname cname=($cname)" 2071 2091 return [array get _limits] 2072 2092 } 2073 2093 set min ""; set max "" 2074 foreach {dataobj comp} $_style2objs($tf) { 2075 set tag $dataobj-$comp 2094 foreach tag [GetDatasetsWithComponent $cname] { 2076 2095 if { ![info exists _serverObjs($tag)] } { 2077 2096 puts stderr "$tag not in serverObjs?" 2078 2097 continue 2079 2098 } 2080 if { ![info exists _limits($tag -min)] } {2099 if { ![info exists _limits($tag)] } { 2081 2100 puts stderr "$tag no min?" 2082 2101 continue 2083 2102 } 2084 if { $min == "" || $min > $_limits($tag-min) } { 2085 set min $_limits($tag-min) 2086 } 2087 if { $max == "" || $max < $_limits($tag-max) } { 2088 set max $_limits($tag-max) 2089 } 2090 } 2091 if { $min != "" } { 2092 set _limits(vmin) $min 2093 } 2094 if { $max != "" } { 2095 set _limits(vmax) $max 2096 } 2097 return [array get _limits] 2103 foreach {vmin vmax} $_limits($tag) break 2104 if { $min == "" || $min > $vmin } { 2105 set min $vmin 2106 } 2107 if { $max == "" || $max < $vmax } { 2108 set max $vmax 2109 } 2110 } 2111 if { $min != "" && $max != "" } { 2112 set _limits(v) [list $min $max] 2113 set _limits($cname) [list $min $max] 2114 } 2115 return $_limits($cname) 2098 2116 } 2099 2117 … … 2558 2576 itcl::body Rappture::FlowvisViewer::SlicerTip {axis} { 2559 2577 set val [$itk_component(${axis}CutScale) get] 2560 # set val [expr {0.01*($val-50)2561 # *($_limits(${axis}max)-$_limits(${axis}min))2562 # + 0.5*($_limits(${axis}max)+$_limits(${axis}min))}]2563 2578 return "Move the [string toupper $axis] cut plane.\nCurrently: $axis = $val%" 2564 2579 } … … 3014 3029 set _settings($this-zoom) $_view(zoom) 3015 3030 } 3031 3032 # Reset global settings from dataset's settings. 3033 itcl::body Rappture::FlowvisViewer::BuildVolumeComponents {} { 3034 $itk_component(volcomponents) choices delete 0 end 3035 foreach name $_componentsList { 3036 $itk_component(volcomponents) choices insert end $name $name 3037 } 3038 set _current [lindex $_componentsList 0] 3039 $itk_component(volcomponents) value $_current 3040 } 3041 3042 # Reset global settings from dataset's settings. 3043 itcl::body Rappture::FlowvisViewer::GetDatasetsWithComponent { cname } { 3044 if { ![info exists _volcomponents($cname)] } { 3045 return "" 3046 } 3047 set list "" 3048 foreach tag $_volcomponents($cname) { 3049 if { ![info exists _serverObjs($tag)] } { 3050 continue 3051 } 3052 lappend list $tag 3053 } 3054 return $list 3055 }
Note: See TracChangeset
for help on using the changeset viewer.