Changeset 4579
- Timestamp:
- Jul 31, 2014 12:36:41 PM (9 years ago)
- Location:
- branches/1.3/gui/scripts
- Files:
-
- 1 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/1.3/gui/scripts/nanovisviewer.tcl
r4568 r4579 121 121 private method Rotate {option x y} 122 122 private method SendTransferFunctions {} 123 private method SetObjectStyle { dataobj cname } 123 124 private method SetOrientation { side } 124 125 private method Slice {option args} … … 150 151 private variable _settings 151 152 private variable _alphamap 153 private variable _widget 152 154 153 155 private variable _first "" ; # This is the topmost volume. … … 222 224 -axesvisible 1 223 225 -background black 224 -colormap default226 -colormap "default" 225 227 -cutplanesvisible 0 226 228 -gridvisible 0 … … 229 231 -light 40 230 232 -light2side 1 231 -opacity 50232 233 -outlinevisible 0 233 234 -qw 0.853553 … … 237 238 -thickness 350 238 239 -volume 1 240 -volumeopacity 0.5 239 241 -volumevisible 1 240 242 -xcutplaneposition 50 … … 247 249 -zcutplanevisible 1 248 250 -zoom 1.0 251 } 252 array set _widget { 253 -volumeopacity 0.5 249 254 } 250 255 itk_component add 3dview { … … 555 560 itcl::body Rappture::NanovisViewer::scale {args} { 556 561 array set styles { 557 -color BCGYR558 -levels 6559 -markers ""562 -color BCGYR 563 -levels 6 564 -markers "" 560 565 } 561 566 array unset _limits … … 892 897 DoResize 893 898 } 899 894 900 foreach dataobj [get] { 895 901 foreach cname [$dataobj components] { … … 927 933 set _serverDatasets($tag) 0 928 934 } 929 NameTransferFunction $dataobj $cname 930 } 931 } 935 SetObjectStyle $dataobj $cname 936 } 937 } 938 939 # Outline seems to need to be reset every update. 940 InitSettings -outlinevisible -cutplanesvisible -current 941 932 942 set _first [lindex [get] 0] 933 943 if { $_reset } { … … 956 966 } 957 967 958 InitSettings -light2side -light - opacity \968 InitSettings -light2side -light -volumeopacity \ 959 969 -isosurfaceshading -gridvisible -axesvisible \ 960 -current961 970 962 971 if {"" != $_first} { … … 971 980 } 972 981 } 973 # Outline seems to need to be reset every update. 974 InitSettings -outlinevisible -cutplanesvisible 982 975 983 # nothing to send -- activate the proper ivol 976 984 SendCmd "volume state 0" … … 1262 1270 } 1263 1271 "-light" { 1264 # Other parts of the code use the light setting to1265 # tell if the component settings have been initialized1266 if { ![info exists _settings($_current${what})] } {1267 InitComponentSettings $_current1268 }1269 1272 set _settings($_current${what}) $_settings($what) 1270 1273 set val $_settings($what) … … 1287 1290 } 1288 1291 } 1289 "-opacity" {1290 set _settings($_current${what}) $_settings($what)1291 set val [expr $_settings($what) * 0.01]1292 foreach tag [GetDatasetsWithComponent $_current] {1293 SendCmd "volume shading opacity $val $tag"1294 }1295 }1296 1292 "-outlinevisible" { 1297 1293 SendCmd "volume outline state $_settings($what)" … … 1314 1310 } 1315 1311 set _settings(-volumevisible) $bool 1312 } 1313 "-volumeopacity" { 1314 set _settings($what) [expr $_widget($what) * 0.01] 1315 set _settings($_current${what}) $_settings($what) 1316 foreach tag [GetDatasetsWithComponent $_current] { 1317 SendCmd "volume shading opacity $_settings($what) $tag" 1318 } 1316 1319 } 1317 1320 "-volumevisible" { … … 1703 1706 label $inner.fog -text "Clear" -font $fg 1704 1707 ::scale $inner.transp -from 0 -to 100 -orient horizontal \ 1705 -variable [itcl::scope _ settings(-opacity)] \1708 -variable [itcl::scope _widget(-volumeopacity)] \ 1706 1709 -width 10 \ 1707 -showvalue off -command [itcl::code $this AdjustSetting - opacity]1710 -showvalue off -command [itcl::code $this AdjustSetting -volumeopacity] 1708 1711 label $inner.plastic -text "Opaque" -font $fg 1709 1712 … … 2090 2093 # InitComponentSettings -- 2091 2094 # 2092 # Initializes the volume settings for a specific component. This 2093 # should match what's used as global settings above. This 2094 # is called the first time we try to switch to a given component 2095 # in SwitchComponent below. 2095 # Initializes the volume settings for a specific component. This should 2096 # match what's used as global settings above. This is called the first 2097 # time we try to switch to a given component in SwitchComponent below. 2096 2098 # 2097 2099 itcl::body Rappture::NanovisViewer::InitComponentSettings { cname } { 2098 # Expanding component name for key. 2099 array set _settings [subst { 2100 $cname-colormap default 2101 $cname-light 40 2102 $cname-light2side 1 2103 $cname-opacity 50 2104 $cname-thickness 350 2105 $cname-volumevisible 1 2106 }] 2100 foreach {key value} { 2101 -colormap "default" 2102 -light 40 2103 -light2side 1 2104 -thickness 350 2105 -volumeopacity 0.5 2106 -volumevisible 1 2107 } { 2108 if { ![info exists _settings($cname${key})] } { 2109 # Don't override existing component settings 2110 set _settings($cname{key}) $value 2111 } 2112 } 2107 2113 } 2108 2114 … … 2110 2116 # SwitchComponent -- 2111 2117 # 2112 # This is called when the current component is changed by the2113 # dropdown menu in the volume tab. It synchronizes the global2114 # volume settingswith the settings of the new current component.2118 # This is called when the current component is changed by the dropdown 2119 # menu in the volume tab. It synchronizes the global volume settings 2120 # with the settings of the new current component. 2115 2121 # 2116 2122 itcl::body Rappture::NanovisViewer::SwitchComponent { cname } { … … 2122 2128 set _settings(-light) $_settings($cname-light) 2123 2129 set _settings(-light2side) $_settings($cname-light2side) 2124 set _settings(- opacity) $_settings($cname-opacity)2130 set _settings(-volumeopacity) $_settings($cname-volumeopacity) 2125 2131 set _settings(-thickness) $_settings($cname-thickness) 2126 2132 set _settings(-volumevisible) $_settings($cname-volumevisible) 2127 2133 $itk_component(colormap) value $_settings($cname-colormap) 2134 2135 set _widget(-volumeopacity) [expr $_settings(-volumeopacity) * 100.0] 2136 2128 2137 set _current $cname; # Reset the current component 2129 2138 } … … 2132 2141 # BuildVolumeComponents -- 2133 2142 # 2134 # This is called from the "scale" method which is called when a2135 # new dataset is added or deleted. It repopulates the dropdown2136 # menu of volume component names. It sets the current component2137 # to the first component in the list (of components found).2138 # Finally, if there is only one component, don't displaythe2139 # label or the combobox in thevolume settings tab.2143 # This is called from the "scale" method which is called when a new 2144 # dataset is added or deleted. It repopulates the dropdown menu of 2145 # volume component names. It sets the current component to the first 2146 # component in the list (of components found). Finally, if there is 2147 # only one component, don't display the label or the combobox in the 2148 # volume settings tab. 2140 2149 # 2141 2150 itcl::body Rappture::NanovisViewer::BuildVolumeComponents {} { … … 2163 2172 # GetDatasetsWithComponents -- 2164 2173 # 2165 # Returns a list of all the datasets (known by the combination of2166 # their data object and component name) that match the given2167 # component name. For example, this is used where we want to change2168 # the settings ofvolumes that have the current component.2174 # Returns a list of all the datasets (known by the combination of their 2175 # data object and component name) that match the given component name. 2176 # For example, this is used where we want to change the settings of 2177 # volumes that have the current component. 2169 2178 # 2170 2179 itcl::body Rappture::NanovisViewer::GetDatasetsWithComponent { cname } { … … 2185 2194 # HideAllMarkers -- 2186 2195 # 2187 # Hide all the markers in all the transfer functions. Can't simply2188 # delete and recreate markers from the <style> since the user may2189 # havecreate, deleted, or moved markers.2196 # Hide all the markers in all the transfer functions. Can't simply 2197 # delete and recreate markers from the <style> since the user may have 2198 # create, deleted, or moved markers. 2190 2199 # 2191 2200 itcl::body Rappture::NanovisViewer::HideAllMarkers {} { … … 2454 2463 2455 2464 2465 itcl::body Rappture::NanovisViewer::SetObjectStyle { dataobj cname } { 2466 array set styles { 2467 -opacity 0.6 2468 } 2469 array set styles [lindex [$dataobj components -style $cname] 0] 2470 set _settings($cname-volumeopacity) $styles(-opacity) 2471 NameTransferFunction $dataobj $cname 2472 } 2473 2474 2475 2476 -
branches/1.3/gui/scripts/resultselector.tcl
r4215 r4579 1295 1295 foreach col [lrange [$_resultset diff names] 1 end] { 1296 1296 set quantity $_cntlInfo($this-$col-label) 1297 set val [lindex [$_resultset get $col $xmlobj] 0] 1297 1298 # Don't know why this was being treated as a list. 1299 #set val [lindex [$_resultset get $col $xmlobj] 0] 1300 1301 set val [$_resultset get $col $xmlobj] 1298 1302 append desc "$quantity = $val\n" 1299 1303 }
Note: See TracChangeset
for help on using the changeset viewer.