Changeset 3396 for trunk/gui/scripts
- Timestamp:
- Feb 28, 2013, 1:55:20 PM (12 years ago)
- Location:
- trunk/gui/scripts
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gui/scripts/flowvisviewer.tcl
r3394 r3396 78 78 protected method Resize {} 79 79 protected method ResizeLegend {} 80 protected method FixSettings {what {value ""}} 80 protected method AdjustSetting {what {value ""}} 81 protected method InitSettings { args } 81 82 protected method Pan {option x y} 82 83 protected method Rebuild {} … … 141 142 private variable _obj2flow; # Maps dataobj-component to a flow. 142 143 144 private variable _reset 1; # Connection to server has been reset 143 145 private variable _click ;# info used for rotate operations 144 146 private variable _limits ;# autoscale min/max for all axes … … 243 245 set _limits(vmin) 0.0 244 246 set _limits(vmax) 1.0 247 set _reset 1 245 248 246 249 array set _settings [subst { … … 320 323 -onimage [Rappture::icon volume-on] \ 321 324 -offimage [Rappture::icon volume-off] \ 322 -command [itcl::code $this FixSettingsvolume] \325 -command [itcl::code $this AdjustSetting volume] \ 323 326 -variable [itcl::scope _settings($this-volume)] 324 327 } … … 859 862 return 0 860 863 } 864 set _reset 1 861 865 set result [VisViewer::Connect $_hosts] 862 866 if { $result } { … … 1224 1228 SendCmd "clientinfo [list $info]" 1225 1229 } 1226 set w [winfo width $itk_component(3dview)] 1227 set h [winfo height $itk_component(3dview)] 1228 $_arcball resize $w $h 1229 EventuallyResize $w $h 1230 set _width [winfo width $itk_component(3dview)] 1231 set _height [winfo height $itk_component(3dview)] 1232 Resize 1230 1233 } 1231 1234 foreach dataobj [get] { … … 1267 1270 1268 1271 # Reset the camera and other view parameters 1269 FixSettings isosurface 1270 FixSettings grid 1271 FixSettings axes 1272 FixSettings volume 1273 FixSettings outline 1274 FixSettings light 1275 FixSettings transp 1272 InitSettings isosurface grid axes volume outline light2side light transp 1276 1273 1277 1274 # nothing to send -- activate the proper volume 1278 1275 if {"" != $_first} { 1279 FixSettingslight1280 FixSettingstransp1276 AdjustSetting light 1277 AdjustSetting transp 1281 1278 set axis [$_first hints updir] 1282 1279 if {"" != $axis} { … … 1349 1346 blt::busy release $itk_component(hull) 1350 1347 set _buffering 0; # Turn off buffering. 1351 set _outbuf ""; # Clear the buffer. 1348 set _outbuf ""; # Clear the buffer. 1349 set _reset 0 1352 1350 } 1353 1351 … … 1684 1682 1685 1683 # ---------------------------------------------------------------------- 1686 # USAGE: FixSettings <what> ?<value>?1684 # USAGE: InitSettings <what> ?<value>? 1687 1685 # 1688 1686 # Used internally to update rendering settings whenever parameters … … 1690 1688 # to the back end. 1691 1689 # ---------------------------------------------------------------------- 1692 itcl::body Rappture::FlowvisViewer::FixSettings {what {value ""}} { 1690 itcl::body Rappture::FlowvisViewer::InitSettings { args } { 1691 foreach arg $args { 1692 AdjustSetting $arg 1693 } 1694 } 1695 1696 # ---------------------------------------------------------------------- 1697 # USAGE: AdjustSetting <what> ?<value>? 1698 # 1699 # Used internally to update rendering settings whenever parameters 1700 # change in the popup settings panel. Sends the new settings off 1701 # to the back end. 1702 # ---------------------------------------------------------------------- 1703 itcl::body Rappture::FlowvisViewer::AdjustSetting {what {value ""}} { 1693 1704 switch -- $what { 1705 colormap { 1706 set color [$itk_component(colormap) value] 1707 set _settings(colormap) $color 1708 #ResetColormap $color 1709 } 1694 1710 light { 1695 1711 if { $_first != "" } { … … 1703 1719 } 1704 1720 } 1721 light2side { 1722 if { $_first != "" } { 1723 set comp [lindex [$_first components] 0] 1724 set tag $_first-$comp 1725 set val $_settings($this-light2side) 1726 #SendCmd "$tag configure -light2side $val" 1727 } 1728 } 1705 1729 transp { 1706 1730 if { $_first != "" } { … … 1837 1861 itcl::body Rappture::FlowvisViewer::NameTransferFunc { dataobj comp } { 1838 1862 array set style { 1839 -color rainbow1863 -color BCGYR 1840 1864 -levels 6 1841 1865 -opacity 1.0 … … 1864 1888 itcl::body Rappture::FlowvisViewer::ComputeTransferFunc { tf } { 1865 1889 array set style { 1866 -color rainbow1890 -color BCGYR 1867 1891 -levels 6 1868 1892 -opacity 1.0 … … 1893 1917 if { ![info exists _isomarkers($tf)] } { 1894 1918 # Have to defer creation of isomarkers until we have data limits 1895 if { [info exists style(-markers)] } { 1919 if { [info exists style(-markers)] && 1920 [llength $style(-markers)] > 0 } { 1896 1921 ParseMarkersOption $tf $style(-markers) 1897 1922 } else { … … 1899 1924 } 1900 1925 } 1901 if {$style(-color) == "rainbow"} {1902 set style(-color) "white:yellow:green:cyan:blue:magenta"1903 }1904 1926 if { [info exists style(-nonuniformcolors)] } { 1905 1927 foreach { value color } $style(-nonuniformcolors) { … … 1907 1929 } 1908 1930 } else { 1909 set clist [split $style(-color) :] 1910 set cmap "0.0 [Color2RGB white] " 1911 for {set i 0} {$i < [llength $clist]} {incr i} { 1912 set x [expr {double($i+1)/([llength $clist]+1)}] 1913 set color [lindex $clist $i] 1914 append cmap "$x [Color2RGB $color] " 1915 } 1916 append cmap "1.0 [Color2RGB $color]" 1931 set cmap [ColorsToColormap $style(-color)] 1917 1932 } 1918 1933 set tag $this-$tf … … 1920 1935 set _settings($tag-opacity) $style(-opacity) 1921 1936 } 1922 set max $_settings($tag-opacity)1937 set max 1.0 ;#$_settings($tag-opacity) 1923 1938 1924 1939 set isovalues {} … … 1930 1945 1931 1946 if { ![info exists _settings($tag-thickness)]} { 1932 set _settings($tag-thickness) 0.0 51947 set _settings($tag-thickness) 0.005 1933 1948 } 1934 1949 set delta $_settings($tag-thickness) … … 1974 1989 lappend wmap 1.0 0.0 1975 1990 } 1976 SendCmd "transfunc define $tf { $cmap } { $wmap } \n"1977 return [SendCmd "$dataobj-$comp configure -transferfunction $tf \n"]1991 SendCmd "transfunc define $tf { $cmap } { $wmap }" 1992 return [SendCmd "$dataobj-$comp configure -transferfunction $tf"] 1978 1993 } 1979 1994 … … 2194 2209 -text "Isosurface shading" \ 2195 2210 -variable [itcl::scope _settings($this-isosurface)] \ 2196 -command [itcl::code $this FixSettingsisosurface] \2211 -command [itcl::code $this AdjustSetting isosurface] \ 2197 2212 -font "Arial 9" 2198 2213 … … 2200 2215 -text "Axes" \ 2201 2216 -variable [itcl::scope _settings($this-axes)] \ 2202 -command [itcl::code $this FixSettingsaxes] \2217 -command [itcl::code $this AdjustSetting axes] \ 2203 2218 -font "Arial 9" 2204 2219 … … 2206 2221 -text "Grid" \ 2207 2222 -variable [itcl::scope _settings($this-grid)] \ 2208 -command [itcl::code $this FixSettingsgrid] \2223 -command [itcl::code $this AdjustSetting grid] \ 2209 2224 -font "Arial 9" 2210 2225 … … 2212 2227 -text "Outline" \ 2213 2228 -variable [itcl::scope _settings($this-outline)] \ 2214 -command [itcl::code $this FixSettingsoutline] \2229 -command [itcl::code $this AdjustSetting outline] \ 2215 2230 -font "Arial 9" 2216 2231 … … 2218 2233 -text "Legend" \ 2219 2234 -variable [itcl::scope _settings($this-legend)] \ 2220 -command [itcl::code $this FixSettingslegend] \2235 -command [itcl::code $this AdjustSetting legend] \ 2221 2236 -font "Arial 9" 2222 2237 … … 2224 2239 -text "Volume" \ 2225 2240 -variable [itcl::scope _settings($this-volume)] \ 2226 -command [itcl::code $this FixSettingsvolume] \2241 -command [itcl::code $this AdjustSetting volume] \ 2227 2242 -font "Arial 9" 2228 2243 … … 2230 2245 -text "Particles" \ 2231 2246 -variable [itcl::scope _settings($this-particles)] \ 2232 -command [itcl::code $this FixSettingsparticles] \2247 -command [itcl::code $this AdjustSetting particles] \ 2233 2248 -font "Arial 9" 2234 2249 … … 2236 2251 -text "Lic" \ 2237 2252 -variable [itcl::scope _settings($this-lic)] \ 2238 -command [itcl::code $this FixSettingslic] \2253 -command [itcl::code $this AdjustSetting lic] \ 2239 2254 -font "Arial 9" 2240 2255 … … 2256 2271 itcl::body Rappture::FlowvisViewer::BuildVolumeTab {} { 2257 2272 foreach { key value } { 2273 light2side 0 2258 2274 light 40 2259 2275 transp 50 … … 2275 2291 -text "Volume" \ 2276 2292 -variable [itcl::scope _settings($this-volume)] \ 2277 -command [itcl::code $this FixSettingsvolume] \2293 -command [itcl::code $this AdjustSetting volume] \ 2278 2294 -font "Arial 9" 2279 2295 2280 2296 label $inner.shading -text "Shading:" -font $fg 2297 2298 checkbutton $inner.light2side -text "Two-sided lighting" -font $fg \ 2299 -variable [itcl::scope _settings($this-light2side)] \ 2300 -command [itcl::code $this AdjustSetting light2side] 2281 2301 2282 2302 label $inner.dim -text "Glow" -font $fg … … 2284 2304 -variable [itcl::scope _settings($this-light)] \ 2285 2305 -width 10 \ 2286 -showvalue off -command [itcl::code $this FixSettingslight]2306 -showvalue off -command [itcl::code $this AdjustSetting light] 2287 2307 label $inner.bright -text "Surface" -font $fg 2288 2308 … … 2291 2311 -variable [itcl::scope _settings($this-transp)] \ 2292 2312 -width 10 \ 2293 -showvalue off -command [itcl::code $this FixSettingstransp]2313 -showvalue off -command [itcl::code $this AdjustSetting transp] 2294 2314 label $inner.plastic -text "Opaque" -font $fg 2295 2315 … … 2298 2318 -variable [itcl::scope _settings($this-opacity)] \ 2299 2319 -width 10 \ 2300 -showvalue off -command [itcl::code $this FixSettingsopacity]2320 -showvalue off -command [itcl::code $this AdjustSetting opacity] 2301 2321 label $inner.opaque -text "Opaque" -font $fg 2302 2322 … … 2305 2325 -variable [itcl::scope _settings($this-thickness)] \ 2306 2326 -width 10 \ 2307 -showvalue off -command [itcl::code $this FixSettingsthickness]2327 -showvalue off -command [itcl::code $this AdjustSetting thickness] 2308 2328 label $inner.thick -text "Thick" -font $fg 2309 2329 2330 label $inner.colormap_l -text "Colormap" -font "Arial 9" 2331 itk_component add colormap { 2332 Rappture::Combobox $inner.colormap -width 10 -editable no 2333 } 2334 2335 $inner.colormap choices insert end \ 2336 "BCGYR" "BCGYR" \ 2337 "BGYOR" "BGYOR" \ 2338 "blue" "blue" \ 2339 "blue-to-brown" "blue-to-brown" \ 2340 "blue-to-orange" "blue-to-orange" \ 2341 "blue-to-grey" "blue-to-grey" \ 2342 "green-to-magenta" "green-to-magenta" \ 2343 "greyscale" "greyscale" \ 2344 "nanohub" "nanohub" \ 2345 "rainbow" "rainbow" \ 2346 "spectral" "spectral" \ 2347 "ROYGB" "ROYGB" \ 2348 "RYGCB" "RYGCB" \ 2349 "brown-to-blue" "brown-to-blue" \ 2350 "grey-to-blue" "grey-to-blue" \ 2351 "orange-to-blue" "orange-to-blue" \ 2352 "none" "none" 2353 2354 $itk_component(colormap) value "BCGYR" 2355 bind $inner.colormap <<Value>> \ 2356 [itcl::code $this AdjustSetting colormap] 2357 2310 2358 blt::table $inner \ 2311 0,0 $inner.vol -c olumnspan 4 -anchor w -pady 2 \2359 0,0 $inner.vol -cspan 4 -anchor w -pady 2 \ 2312 2360 1,0 $inner.shading -columnspan 4 -anchor w -pady {10 2} \ 2313 2,0 $inner.dim -anchor e -pady 2 \ 2314 2,1 $inner.light -columnspan 2 -pady 2 -fill x \ 2315 2,3 $inner.bright -anchor w -pady 2 \ 2316 3,0 $inner.fog -anchor e -pady 2 \ 2317 3,1 $inner.transp -columnspan 2 -pady 2 -fill x \ 2318 3,3 $inner.plastic -anchor w -pady 2 \ 2319 4,0 $inner.thin -anchor e -pady 2 \ 2320 4,1 $inner.thickness -columnspan 2 -pady 2 -fill x\ 2321 4,3 $inner.thick -anchor w -pady 2 2322 2323 if 0 { 2324 0,0 $inner.dim -anchor e -pady 2 \ 2325 0,1 $inner.light -columnspan 2 -pady 2 \ 2326 0,3 $inner.bright -anchor w -pady 2 \ 2327 1,0 $inner.fog -anchor e -pady 2 \ 2328 1,1 $inner.transp -columnspan 2 -pady 2 \ 2329 1,3 $inner.plastic -anchor w -pady 2 \ 2330 2,0 $inner.clear -anchor e -pady 2 \ 2331 2,1 $inner.opacity -columnspan 2 -pady 2 \ 2332 2,3 $inner.opaque -anchor w -pady 2 \ 2333 3,0 $inner.thin -anchor e -pady 2 \ 2334 3,1 $inner.thickness -columnspan 2 -pady 2 \ 2335 3,3 $inner.thick -anchor w -pady 2 2336 } 2361 2,0 $inner.light2side -columnspan 4 -anchor w -pady 2 \ 2362 3,0 $inner.dim -anchor e -pady 2 \ 2363 3,1 $inner.light -columnspan 2 -pady 2 -fill x \ 2364 3,3 $inner.bright -anchor w -pady 2 \ 2365 4,0 $inner.fog -anchor e -pady 2 \ 2366 4,1 $inner.transp -columnspan 2 -pady 2 -fill x \ 2367 4,3 $inner.plastic -anchor w -pady 2 \ 2368 5,0 $inner.thin -anchor e -pady 2 \ 2369 5,1 $inner.thickness -columnspan 2 -pady 2 -fill x\ 2370 5,3 $inner.thick -anchor w -pady 2 2371 2337 2372 blt::table configure $inner c0 c1 c3 r* -resize none 2338 blt::table configure $inner r 5-resize expand2373 blt::table configure $inner r6 -resize expand 2339 2374 } 2340 2375 … … 2350 2385 -onimage [Rappture::icon x-cutplane] \ 2351 2386 -offimage [Rappture::icon x-cutplane] \ 2352 -command [itcl::code $this FixSettingsxcutplane] \2387 -command [itcl::code $this AdjustSetting xcutplane] \ 2353 2388 -variable [itcl::scope _settings($this-xcutplane)] 2354 2389 } … … 2377 2412 -onimage [Rappture::icon y-cutplane] \ 2378 2413 -offimage [Rappture::icon y-cutplane] \ 2379 -command [itcl::code $this FixSettingsycutplane] \2414 -command [itcl::code $this AdjustSetting ycutplane] \ 2380 2415 -variable [itcl::scope _settings($this-ycutplane)] 2381 2416 } … … 2404 2439 -onimage [Rappture::icon z-cutplane] \ 2405 2440 -offimage [Rappture::icon z-cutplane] \ 2406 -command [itcl::code $this FixSettingszcutplane] \2441 -command [itcl::code $this AdjustSetting zcutplane] \ 2407 2442 -variable [itcl::scope _settings($this-zcutplane)] 2408 2443 } … … 2623 2658 } 2624 2659 2625 2626 2660 itcl::body Rappture::FlowvisViewer::Resize {} { 2661 $_arcball resize $_width $_height 2627 2662 SendCmd "screen $_width $_height" 2628 2663 set _resizePending 0 -
trunk/gui/scripts/nanovisviewer.tcl
r3395 r3396 1880 1880 5,3 $inner.thick -anchor w -pady 2 1881 1881 1882 # 4,0 $inner.clear -anchor e -pady 2 \1883 # 4,1 $inner.opacity -columnspan 2 -pady 2 -fill x\1884 # 4,3 $inner.opaque -anchor w -pady 2 \1885 1886 1887 1882 blt::table configure $inner c0 c1 c3 r* -resize none 1888 1883 blt::table configure $inner r6 -resize expand … … 2079 2074 2080 2075 itcl::body Rappture::NanovisViewer::DoResize {} { 2076 $_arcball resize $_width $height 2081 2077 SendCmd "screen $_width $_height" 2082 2078 set _resizePending 0
Note: See TracChangeset
for help on using the changeset viewer.