- Timestamp:
- Oct 6, 2011, 9:23:54 AM (13 years ago)
- Location:
- trunk/gui/scripts
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gui/scripts/field.tcl
r2592 r2600 508 508 scale about.scale 509 509 seeds about.seeds 510 scalars about.scalars 511 vectors about.vectors 512 field about.default 510 513 units units 511 514 updir updir -
trunk/gui/scripts/vtkstreamlinesviewer.tcl
r2598 r2600 69 69 protected method Disconnect {} 70 70 protected method DoResize {} 71 protected method DoReseed {} 71 72 protected method DoRotate {} 72 73 protected method AdjustSetting {what {value ""}} 73 protected method FixSettings { args }74 protected method InitSettings { args } 74 75 protected method Pan {option x y} 75 76 protected method Pick {x y} … … 94 95 private method EnterLegend { x y } 95 96 private method EventuallyResize { w h } 97 private method EventuallyReseed { numPoints } 96 98 private method EventuallyRotate { q } 97 99 private method EventuallySetCutplane { axis args } … … 127 129 private variable _view ; # view params for 3D view 128 130 private variable _settings 129 private variable _volume130 private variable _axis131 private variable _cutplane132 private variable _streamlines133 131 private variable _style; # Array of current component styles. 134 132 private variable _initialStyle; # Array of initial component styles. … … 147 145 private variable _height 0 148 146 private variable _resizePending 0 147 private variable _reseedPending 0 149 148 private variable _rotatePending 0 150 149 private variable _cutplanePending 0 151 150 private variable _outline 152 private variable _fields 151 private variable _vectorFields 152 private variable _scalarFields 153 private variable _currentField 154 private variable _numSeeds 200 153 155 private variable _colorMode "vmag";# Mode of colormap (vmag or scalar) 154 156 } … … 171 173 $_dispatcher dispatch $this !resize "[itcl::code $this DoResize]; list" 172 174 175 # Reseed event 176 $_dispatcher register !reseed 177 $_dispatcher dispatch $this !reseed "[itcl::code $this DoReseed]; list" 178 173 179 # Rotate event 174 180 $_dispatcher register !rotate … … 178 184 $_dispatcher register !xcutplane 179 185 $_dispatcher dispatch $this !xcutplane \ 180 "[itcl::code $this AdjustSetting xcutplane-position]; list"186 "[itcl::code $this AdjustSetting cutplane-xposition]; list" 181 187 182 188 # Y-Cutplane event 183 189 $_dispatcher register !ycutplane 184 190 $_dispatcher dispatch $this !ycutplane \ 185 "[itcl::code $this AdjustSetting ycutplane-position]; list"191 "[itcl::code $this AdjustSetting cutplane-yposition]; list" 186 192 187 193 # Z-Cutplane event 188 194 $_dispatcher register !zcutplane 189 195 $_dispatcher dispatch $this !zcutplane \ 190 "[itcl::code $this AdjustSetting zcutplane-position]; list"196 "[itcl::code $this AdjustSetting cutplane-zposition]; list" 191 197 192 198 # … … 223 229 set _limits(zmax) 1.0 224 230 225 array set _axis [subst {226 xgrid 0227 ygrid 0228 zgrid 0229 xcutplane 0230 ycutplane 0231 zcutplane 0232 xposition 0233 yposition 0234 zposition 0235 visible 1236 labels 1237 }]238 array set _cutplane [subst {239 edges 0240 xvisible 0241 yvisible 0242 zvisible 0243 xposition 0244 yposition 0245 zposition 0246 visible 1247 wireframe 0248 opacity 100249 }]250 array set _volume [subst {251 edges 0252 lighting 1253 opacity 40254 visible 1255 wireframe 0256 }]257 array set _streamlines [subst {258 seeds 0259 visible 1260 opacity 100261 seeddensity 200262 lighting 1263 scale 1264 }]265 231 array set _settings [subst { 266 legend 1 232 axis-xgrid 0 233 axis-ygrid 0 234 axis-zgrid 0 235 axis-xcutplane 0 236 axis-ycutplane 0 237 axis-zcutplane 0 238 axis-xposition 0 239 axis-yposition 0 240 axis-zposition 0 241 axis-visible 1 242 axis-labels 1 243 cutplane-edges 0 244 cutplane-xvisible 0 245 cutplane-yvisible 0 246 cutplane-zvisible 0 247 cutplane-xposition 50 248 cutplane-yposition 50 249 cutplane-zposition 50 250 cutplane-visible 1 251 cutplane-wireframe 0 252 cutplane-opacity 100 253 volume-edges 0 254 volume-lighting 1 255 volume-opacity 40 256 volume-visible 1 257 volume-wireframe 0 258 streamlines-seeds 0 259 streamlines-visible 1 260 streamlines-opacity 100 261 streamlines-numpoints 200 262 streamlines-lighting 1 263 streamlines-scale 1 264 legend-visible 1 267 265 }] 268 266 … … 335 333 -onimage [Rappture::icon volume-on] \ 336 334 -offimage [Rappture::icon volume-off] \ 337 -variable [itcl::scope _ volume(visible)] \335 -variable [itcl::scope _settings(volume-visible)] \ 338 336 -command [itcl::code $this AdjustSetting volume-visible] 339 337 } … … 347 345 -onimage [Rappture::icon streamlines-on] \ 348 346 -offimage [Rappture::icon streamlines-off] \ 349 -variable [itcl::scope _s treamlines(visible)] \347 -variable [itcl::scope _settings(streamlines-visible)] \ 350 348 -command [itcl::code $this AdjustSetting streamlines-visible] \ 351 349 } … … 358 356 BuildVolumeTab 359 357 BuildStreamsTab 358 BuildCutplaneTab 360 359 BuildAxisTab 361 BuildCutplaneTab362 360 BuildCameraTab 363 361 } errs] != 0 } { … … 455 453 $_dispatcher cancel !rebuild 456 454 $_dispatcher cancel !resize 455 $_dispatcher cancel !reseed 457 456 $_dispatcher cancel !rotate 458 457 $_dispatcher cancel !xcutplane … … 471 470 set _height 500 472 471 } 473 #puts stderr "DoResize screen size $_width $_height"474 472 set _start [clock clicks -milliseconds] 475 #puts stderr "screen size request width=$_width height=$_height"476 473 SendCmd "screen size $_width $_height" 477 474 RequestLegend … … 491 488 } 492 489 490 itcl::body Rappture::VtkStreamlinesViewer::DoReseed {} { 491 foreach dataset [CurrentDatasets -visible] { 492 foreach {dataobj comp} [split $dataset -] break 493 # This command works for either random or fmesh seeds 494 SendCmd "streamlines seed numpts $_numSeeds $dataset" 495 } 496 set _reseedPending 0 497 } 498 493 499 itcl::body Rappture::VtkStreamlinesViewer::EventuallyResize { w h } { 494 #puts stderr "EventuallyResize $w $h"495 500 set _width $w 496 501 set _height $h … … 498 503 if { !$_resizePending } { 499 504 set _resizePending 1 500 $_dispatcher event -after 200 !resize 505 $_dispatcher event -after 400 !resize 506 } 507 } 508 509 itcl::body Rappture::VtkStreamlinesViewer::EventuallyReseed { numPoints } { 510 set _numSeeds $numPoints 511 if { !$_reseedPending } { 512 set _reseedPending 1 513 $_dispatcher event -after 600 !reseed 501 514 } 502 515 } … … 505 518 506 519 itcl::body Rappture::VtkStreamlinesViewer::EventuallyRotate { q } { 507 #puts stderr "EventuallyRotate $w $h"508 520 foreach { _view(qw) _view(qx) _view(qy) _view(qz) } $q break 509 521 if { !$_rotatePending } { … … 589 601 } 590 602 array unset _obj2ovride $dataobj-* 603 array unset _settings $dataobj-* 591 604 # Append to the end of the dataobj list. 592 605 lappend _dlist $dataobj … … 638 651 } 639 652 if { ![info exists _obj2ovride($dataobj-raise)] } { 640 # No setting indicates that the object isn't invisible.653 # No setting indicates that the object isn't visible. 641 654 continue 642 655 } … … 774 787 # ---------------------------------------------------------------------- 775 788 itcl::body Rappture::VtkStreamlinesViewer::Connect {} { 776 #puts stderr "Enter Connect: [info level -1]"777 789 set _hosts [GetServerList "vtkvis"] 778 790 if { "" == $_hosts } { … … 781 793 set result [VisViewer::Connect $_hosts] 782 794 if { $result } { 783 #puts stderr "Connected to $_hostname sid=$_sid"784 795 set w [winfo width $itk_component(view)] 785 796 set h [winfo height $itk_component(view)] … … 960 971 PanCamera 961 972 set _first "" 962 FixSettings axis-xgrid axis-ygrid axis-zgrid axis-mode \973 InitSettings axis-xgrid axis-ygrid axis-zgrid axis-mode \ 963 974 axis-visible axis-labels 964 975 … … 1008 1019 } 1009 1020 } 1010 FixSettings streamlines-seeds streamlines-visible streamlines-opacity \ 1021 InitSettings streamlines-seeds streamlines-visible streamlines-opacity \ 1022 streamlines-numpoints streamlines-lighting streamlines-palette \ 1023 streamlines-field \ 1011 1024 volume-edges volume-lighting volume-opacity volume-visible \ 1012 volume-wireframe streamlines-palette 1013 1014 set _first [lindex [get -objects] 0] 1025 volume-wireframe \ 1026 cutplane-xvisible cutplane-yvisible cutplane-zvisible \ 1027 cutplane-xposition cutplane-yposition cutplane-zposition 1028 1015 1029 if { $_reset || $_first == "" } { 1016 1030 Zoom reset … … 1233 1247 1234 1248 # ---------------------------------------------------------------------- 1235 # USAGE: FixSettings <what> ?<value>?1249 # USAGE: InitSettings <what> ?<value>? 1236 1250 # 1237 1251 # Used internally to update rendering settings whenever parameters … … 1239 1253 # to the back end. 1240 1254 # ---------------------------------------------------------------------- 1241 itcl::body Rappture::VtkStreamlinesViewer::FixSettings { args } { 1242 foreach setting $args { 1243 AdjustSetting $setting 1255 itcl::body Rappture::VtkStreamlinesViewer::InitSettings { args } { 1256 foreach spec $args { 1257 if { [info exists _settings($_first-$spec)] } { 1258 # Reset global setting with dataobj specific setting 1259 set _settings($spec) $_settings($_first-$spec) 1260 } 1261 AdjustSetting $spec 1244 1262 } 1245 1263 } … … 1258 1276 switch -- $what { 1259 1277 "volume-opacity" { 1260 set val $_ volume(opacity)1278 set val $_settings(volume-opacity) 1261 1279 set sval [expr { 0.01 * double($val) }] 1262 foreach dataset [CurrentDatasets -visible $_first] {1280 foreach dataset [CurrentDatasets -visible] { 1263 1281 SendCmd "polydata opacity $sval $dataset" 1264 1282 } 1265 1283 } 1266 1284 "volume-wireframe" { 1267 set bool $_ volume(wireframe)1268 foreach dataset [CurrentDatasets -visible $_first] {1285 set bool $_settings(volume-wireframe) 1286 foreach dataset [CurrentDatasets -visible] { 1269 1287 SendCmd "polydata wireframe $bool $dataset" 1270 1288 } 1271 1289 } 1272 1290 "volume-visible" { 1273 set bool $_ volume(visible)1274 foreach dataset [CurrentDatasets -visible $_first] {1291 set bool $_settings(volume-visible) 1292 foreach dataset [CurrentDatasets -visible] { 1275 1293 SendCmd "polydata visible $bool $dataset" 1276 1294 } … … 1284 1302 } 1285 1303 "volume-lighting" { 1286 set bool $_ volume(lighting)1287 foreach dataset [CurrentDatasets -visible $_first] {1304 set bool $_settings(volume-lighting) 1305 foreach dataset [CurrentDatasets -visible] { 1288 1306 SendCmd "polydata lighting $bool $dataset" 1289 1307 } 1290 1308 } 1291 1309 "volume-edges" { 1292 set bool $_ volume(edges)1293 foreach dataset [CurrentDatasets -visible $_first] {1310 set bool $_settings(volume-edges) 1311 foreach dataset [CurrentDatasets -visible] { 1294 1312 SendCmd "polydata edges $bool $dataset" 1295 1313 } 1296 1314 } 1297 1315 "axis-visible" { 1298 set bool $_ axis(visible)1316 set bool $_settings(axis-visible) 1299 1317 SendCmd "axis visible all $bool" 1300 1318 } 1301 1319 "axis-labels" { 1302 set bool $_ axis(labels)1320 set bool $_settings(axis-labels) 1303 1321 SendCmd "axis labels all $bool" 1304 1322 } 1305 "axis-xgrid" { 1306 set bool $_axis(xgrid) 1307 SendCmd "axis grid x $bool" 1308 } 1309 "axis-ygrid" { 1310 set bool $_axis(ygrid) 1311 SendCmd "axis grid y $bool" 1312 } 1313 "axis-zgrid" { 1314 set bool $_axis(zgrid) 1315 SendCmd "axis grid z $bool" 1323 "axis-xgrid" - "axis-ygrid" - "axis-zgrid" { 1324 set axis [string range $what 5 5] 1325 set bool $_settings($what) 1326 SendCmd "axis grid $axis $bool" 1316 1327 } 1317 1328 "axis-mode" { 1318 1329 set mode [$itk_component(axismode) value] 1319 1330 set mode [$itk_component(axismode) translate $mode] 1331 set _settings($what) $mode 1320 1332 SendCmd "axis flymode $mode" 1321 1333 } 1322 1334 "cutplane-edges" { 1323 set bool $_ cutplane(edges)1324 foreach dataset [CurrentDatasets -visible $_first] {1335 set bool $_settings($what) 1336 foreach dataset [CurrentDatasets -visible] { 1325 1337 SendCmd "cutplane edges $bool $dataset" 1326 1338 } 1327 1339 } 1328 1340 "cutplane-visible" { 1329 set bool $_ cutplane(visible)1330 foreach dataset [CurrentDatasets -visible $_first] {1341 set bool $_settings($what) 1342 foreach dataset [CurrentDatasets -visible] { 1331 1343 SendCmd "cutplane visible $bool $dataset" 1332 1344 } 1333 1345 } 1334 1346 "cutplane-wireframe" { 1335 set bool $_ cutplane(wireframe)1336 foreach dataset [CurrentDatasets -visible $_first] {1347 set bool $_settings($what) 1348 foreach dataset [CurrentDatasets -visible] { 1337 1349 SendCmd "cutplane wireframe $bool $dataset" 1338 1350 } 1339 1351 } 1340 1352 "cutplane-lighting" { 1341 set bool $_ cutplane(lighting)1342 foreach dataset [CurrentDatasets -visible $_first] {1353 set bool $_settings($what) 1354 foreach dataset [CurrentDatasets -visible] { 1343 1355 SendCmd "cutplane lighting $bool $dataset" 1344 1356 } 1345 1357 } 1346 1358 "cutplane-opacity" { 1347 set val $_ cutplane(opacity)1359 set val $_settings($what) 1348 1360 set sval [expr { 0.01 * double($val) }] 1349 foreach dataset [CurrentDatasets -visible $_first] {1361 foreach dataset [CurrentDatasets -visible] { 1350 1362 SendCmd "cutplane opacity $sval $dataset" 1351 1363 } 1352 1364 } 1353 " xcutplane-visible" - "ycutplane-visible" - "zcutplane-visible" {1354 set axis [string range $what 0 0]1355 set bool $_ cutplane(${axis}visible)1365 "cutplane-xvisible" - "cutplane-yvisible" - "cutplane-zvisible" { 1366 set axis [string range $what 9 9] 1367 set bool $_settings($what) 1356 1368 if { $bool } { 1357 1369 $itk_component(${axis}CutScale) configure -state normal \ … … 1364 1376 SendCmd "cutplane colormode $_colorMode" 1365 1377 } 1366 " xcutplane-position" - "ycutplane-position" - "zcutplane-position" {1367 set axis [string range $what 0 0]1368 set pos [expr $_ cutplane(${axis}position) * 0.01]1378 "cutplane-xposition" - "cutplane-yposition" - "cutplane-zposition" { 1379 set axis [string range $what 9 9] 1380 set pos [expr $_settings($what) * 0.01] 1369 1381 SendCmd "cutplane slice ${axis} ${pos}" 1370 1382 set _cutplanePending 0 1371 1383 } 1372 1384 "streamlines-seeds" { 1373 set bool $_s treamlines(seeds)1374 foreach dataset [CurrentDatasets -visible $_first] {1385 set bool $_settings($what) 1386 foreach dataset [CurrentDatasets -visible] { 1375 1387 SendCmd "streamlines seed visible $bool $dataset" 1376 1388 } 1377 1389 } 1378 "streamlines-seeddensity" { 1379 set density $_streamlines(seeddensity) 1380 foreach dataset [CurrentDatasets -visible $_first] { 1381 foreach {dataobj comp} [split $dataset -] break 1382 # This command works for either random or fmesh seeds 1383 SendCmd "streamlines seed numpts $density $dataset" 1384 } 1390 "streamlines-numpoints" { 1391 set density $_settings($what) 1392 EventuallyReseed $density 1385 1393 } 1386 1394 "streamlines-visible" { 1387 set bool $_s treamlines(visible)1388 foreach dataset [CurrentDatasets -visible $_first] {1395 set bool $_settings($what) 1396 foreach dataset [CurrentDatasets -visible] { 1389 1397 SendCmd "streamlines visible $bool $dataset" 1390 1398 } … … 1399 1407 "streamlines-mode" { 1400 1408 set mode [$itk_component(streammode) value] 1401 foreach dataset [CurrentDatasets -visible $_first] { 1409 set _settings(streamlines-mode) $mode 1410 foreach dataset [CurrentDatasets -visible] { 1402 1411 switch -- $mode { 1403 1412 "lines" { … … 1415 1424 "streamlines-palette" { 1416 1425 set palette [$itk_component(palette) value] 1426 set _settings(streamlines-palette) $palette 1417 1427 foreach dataset [CurrentDatasets -visible $_first] { 1418 1428 foreach {dataobj comp} [split $dataset -] break … … 1422 1432 } 1423 1433 "streamlines-opacity" { 1424 set val $_s treamlines(opacity)1434 set val $_settings(streamlines-opacity) 1425 1435 set sval [expr { 0.01 * double($val) }] 1426 1436 foreach dataset [CurrentDatasets -visible $_first] { … … 1429 1439 } 1430 1440 "streamlines-scale" { 1431 set val $_s treamlines(scale)1441 set val $_settings(streamlines-scale) 1432 1442 set sval [expr { 0.01 * double($val) }] 1433 1443 foreach dataset [CurrentDatasets -visible $_first] { … … 1436 1446 } 1437 1447 "streamlines-lighting" { 1438 set bool $_s treamlines(lighting)1448 set bool $_settings(streamlines-lighting) 1439 1449 foreach dataset [CurrentDatasets -visible $_first] { 1440 SendCmd "streamlines lighting $bool $dataset"1450 SendCmd "streamlines lighting $bool" 1441 1451 } 1442 1452 } 1443 1453 "streamlines-field" { 1444 1454 set field [$itk_component(field) value] 1445 set _colorMode scalar 1446 set fieldType scalar 1447 if { $field == "U" } { 1455 set value [$itk_component(axismode) translate $field] 1456 set _settings(streamlines-field) $value 1457 if { [info exists _scalarFields($field)] } { 1458 set name $_scalarFields($field) 1459 set colorMode scalar 1460 set fieldType scalar 1461 } elseif { [info exists _vectorFields($field)] } { 1462 set name $_vectorFields($field) 1448 1463 set _colorMode vmag 1449 1464 set fieldType vector 1450 } 1451 foreach dataset [CurrentDatasets -visible $_first] { 1452 SendCmd "dataset ${fieldType} ${field} $dataset" 1465 } else { 1466 error "unknown field \"$field\"" 1467 } 1468 foreach dataset [CurrentDatasets -visible] { 1469 SendCmd "dataset ${fieldType} ${name} $dataset" 1453 1470 SendCmd "streamlines colormode $_colorMode $dataset" 1454 1471 SendCmd "cutplane colormode $_colorMode $dataset" … … 1470 1487 # 1471 1488 itcl::body Rappture::VtkStreamlinesViewer::RequestLegend {} { 1472 #puts stderr "RequestLegend _first=$_first"1473 #puts stderr "RequestLegend width=$_width height=$_height"1474 1489 set font "Arial 8" 1475 1490 set lineht [font metrics $font -linespace] … … 1481 1496 } 1482 1497 # Set the legend on the first streamlines dataset. 1483 foreach dataset [CurrentDatasets -visible ] {1498 foreach dataset [CurrentDatasets -visible $_first] { 1484 1499 foreach {dataobj comp} [split $dataset -] break 1485 1500 if { [info exists _dataset2style($dataset)] } { 1486 puts stderr "legend $_dataset2style($dataset) $_colorMode {} $w $h 0"1487 1501 SendCmd "legend $_dataset2style($dataset) $_colorMode {} $w $h 0" 1488 1502 break; … … 1536 1550 if { ![info exists _dataset2style($tag)] || 1537 1551 $_dataset2style($tag) != $name } { 1538 puts stderr "streamlines colormap $name $tag"1539 puts stderr "cutplane colormap $name $tag"1540 1552 SendCmd "streamlines colormap $name $tag" 1541 1553 SendCmd "cutplane colormap $name $tag" … … 1760 1772 set cmap "0.0 0.0 0.0 0.0 1.0 1.0 1.0 1.0" 1761 1773 } 1762 if { ![info exists _ volume(opacity)] } {1763 set _ volume(opacity) $style(-opacity)1764 } 1765 set max $_ volume(opacity)1774 if { ![info exists _settings(volume-opacity)] } { 1775 set _settings(volume-opacity) $style(-opacity) 1776 } 1777 set max $_settings(volume-opacity) 1766 1778 1767 1779 set wmap "0.0 1.0 1.0 1.0" … … 1791 1803 1792 1804 itcl::body Rappture::VtkStreamlinesViewer::limits { dataobj } { 1805 array set _scalarFields [$dataobj hints scalars] 1806 array set _vectorFields [$dataobj hints vectors] 1807 set _currentField [$dataobj hints default] 1808 foreach name [array names _vectorFields] { 1809 set value $_vectorFields($name) 1810 $itk_component(field) choices insert end "$name" "$value" 1811 } 1812 foreach name [array names _scalarFields] { 1813 set value $_scalarFields($name) 1814 $itk_component(field) choices insert end "$name" "$value" 1815 } 1816 $itk_component(field) value $_currentField 1817 return 1793 1818 array unset _limits $dataobj-* 1794 1819 foreach comp [$dataobj components] { … … 1872 1897 checkbutton $inner.volume \ 1873 1898 -text "Show Volume" \ 1874 -variable [itcl::scope _ volume(visible)] \1899 -variable [itcl::scope _settings(volume-visible)] \ 1875 1900 -command [itcl::code $this AdjustSetting volume-visible] \ 1876 1901 -font "Arial 9" … … 1878 1903 checkbutton $inner.wireframe \ 1879 1904 -text "Show Wireframe" \ 1880 -variable [itcl::scope _ volume(wireframe)] \1905 -variable [itcl::scope _settings(volume-wireframe)] \ 1881 1906 -command [itcl::code $this AdjustSetting volume-wireframe] \ 1882 1907 -font "Arial 9" … … 1884 1909 checkbutton $inner.lighting \ 1885 1910 -text "Enable Lighting" \ 1886 -variable [itcl::scope _ volume(lighting)] \1911 -variable [itcl::scope _settings(volume-lighting)] \ 1887 1912 -command [itcl::code $this AdjustSetting volume-lighting] \ 1888 1913 -font "Arial 9" … … 1890 1915 checkbutton $inner.edges \ 1891 1916 -text "Show Edges" \ 1892 -variable [itcl::scope _ volume(edges)] \1917 -variable [itcl::scope _settings(volume-edges)] \ 1893 1918 -command [itcl::code $this AdjustSetting volume-edges] \ 1894 1919 -font "Arial 9" … … 1896 1921 label $inner.opacity_l -text "Opacity" -font "Arial 9" 1897 1922 ::scale $inner.opacity -from 0 -to 100 -orient horizontal \ 1898 -variable [itcl::scope _ volume(opacity)] \1923 -variable [itcl::scope _settings(volume-opacity)] \ 1899 1924 -width 10 \ 1900 1925 -showvalue off \ … … 1926 1951 checkbutton $inner.streamlines \ 1927 1952 -text "Show Streamlines" \ 1928 -variable [itcl::scope _s treamlines(visible)] \1953 -variable [itcl::scope _settings(streamlines-visible)] \ 1929 1954 -command [itcl::code $this AdjustSetting streamlines-visible] \ 1930 1955 -font "Arial 9" … … 1932 1957 checkbutton $inner.lighting \ 1933 1958 -text "Enable Lighting" \ 1934 -variable [itcl::scope _s treamlines(lighting)] \1959 -variable [itcl::scope _settings(streamlines-lighting)] \ 1935 1960 -command [itcl::code $this AdjustSetting streamlines-lighting] \ 1936 1961 -font "Arial 9" … … 1938 1963 checkbutton $inner.seeds \ 1939 1964 -text "Show Seeds" \ 1940 -variable [itcl::scope _s treamlines(seeds)] \1965 -variable [itcl::scope _settings(streamlines-seeds)] \ 1941 1966 -command [itcl::code $this AdjustSetting streamlines-seeds] \ 1942 1967 -font "Arial 9" … … 1955 1980 label $inner.opacity_l -text "Opacity" -font "Arial 9" 1956 1981 ::scale $inner.opacity -from 0 -to 100 -orient horizontal \ 1957 -variable [itcl::scope _s treamlines(opacity)] \1982 -variable [itcl::scope _settings(streamlines-opacity)] \ 1958 1983 -width 10 \ 1959 1984 -showvalue off \ … … 1962 1987 label $inner.density_l -text "Number of Seeds" -font "Arial 9" 1963 1988 ::scale $inner.density -from 1 -to 1000 -orient horizontal \ 1964 -variable [itcl::scope _s treamlines(seeddensity)] \1989 -variable [itcl::scope _settings(streamlines-numpoints)] \ 1965 1990 -width 10 \ 1966 1991 -showvalue on \ 1967 -command [itcl::code $this AdjustSetting streamlines- seeddensity]1992 -command [itcl::code $this AdjustSetting streamlines-numpoints] 1968 1993 1969 1994 label $inner.scale_l -text "Scale" -font "Arial 9" 1970 1995 ::scale $inner.scale -from 1 -to 100 -orient horizontal \ 1971 -variable [itcl::scope _s treamlines(scale)] \1996 -variable [itcl::scope _settings(streamlines-scale)] \ 1972 1997 -width 10 \ 1973 1998 -showvalue off \ … … 2039 2064 checkbutton $inner.visible \ 2040 2065 -text "Show Axes" \ 2041 -variable [itcl::scope _ axis(visible)] \2066 -variable [itcl::scope _settings(axis-visible)] \ 2042 2067 -command [itcl::code $this AdjustSetting axis-visible] \ 2043 2068 -font "Arial 9" … … 2045 2070 checkbutton $inner.labels \ 2046 2071 -text "Show Axis Labels" \ 2047 -variable [itcl::scope _ axis(labels)] \2072 -variable [itcl::scope _settings(axis-labels)] \ 2048 2073 -command [itcl::code $this AdjustSetting axis-labels] \ 2049 2074 -font "Arial 9" … … 2051 2076 checkbutton $inner.gridx \ 2052 2077 -text "Show X Grid" \ 2053 -variable [itcl::scope _ axis(xgrid)] \2078 -variable [itcl::scope _settings(axis-xgrid)] \ 2054 2079 -command [itcl::code $this AdjustSetting axis-xgrid] \ 2055 2080 -font "Arial 9" 2056 2081 checkbutton $inner.gridy \ 2057 2082 -text "Show Y Grid" \ 2058 -variable [itcl::scope _ axis(ygrid)] \2083 -variable [itcl::scope _settings(axis-ygrid)] \ 2059 2084 -command [itcl::code $this AdjustSetting axis-ygrid] \ 2060 2085 -font "Arial 9" 2061 2086 checkbutton $inner.gridz \ 2062 2087 -text "Show Z Grid" \ 2063 -variable [itcl::scope _ axis(zgrid)] \2088 -variable [itcl::scope _settings(axis-zgrid)] \ 2064 2089 -command [itcl::code $this AdjustSetting axis-zgrid] \ 2065 2090 -font "Arial 9" … … 2139 2164 checkbutton $inner.visible \ 2140 2165 -text "Show Cutplanes" \ 2141 -variable [itcl::scope _ cutplane(visible)] \2166 -variable [itcl::scope _settings(cutplane-visible)] \ 2142 2167 -command [itcl::code $this AdjustSetting cutplane-visible] \ 2143 2168 -font "Arial 9" … … 2145 2170 checkbutton $inner.wireframe \ 2146 2171 -text "Show Wireframe" \ 2147 -variable [itcl::scope _ cutplane(wireframe)] \2172 -variable [itcl::scope _settings(cutplane-wireframe)] \ 2148 2173 -command [itcl::code $this AdjustSetting cutplane-wireframe] \ 2149 2174 -font "Arial 9" … … 2151 2176 checkbutton $inner.lighting \ 2152 2177 -text "Enable Lighting" \ 2153 -variable [itcl::scope _ cutplane(lighting)] \2178 -variable [itcl::scope _settings(cutplane-lighting)] \ 2154 2179 -command [itcl::code $this AdjustSetting cutplane-lighting] \ 2155 2180 -font "Arial 9" … … 2157 2182 checkbutton $inner.edges \ 2158 2183 -text "Show Edges" \ 2159 -variable [itcl::scope _ cutplane(edges)] \2184 -variable [itcl::scope _settings(cutplane-edges)] \ 2160 2185 -command [itcl::code $this AdjustSetting cutplane-edges] \ 2161 2186 -font "Arial 9" … … 2163 2188 label $inner.opacity_l -text "Opacity" -font "Arial 9" 2164 2189 ::scale $inner.opacity -from 0 -to 100 -orient horizontal \ 2165 -variable [itcl::scope _ cutplane(opacity)] \2190 -variable [itcl::scope _settings(cutplane-opacity)] \ 2166 2191 -width 10 \ 2167 2192 -showvalue off \ 2168 2193 -command [itcl::code $this AdjustSetting cutplane-opacity] 2169 $inner.opacity set $_ cutplane(opacity)2194 $inner.opacity set $_settings(cutplane-opacity) 2170 2195 2171 2196 # X-value slicer... … … 2174 2199 -onimage [Rappture::icon x-cutplane] \ 2175 2200 -offimage [Rappture::icon x-cutplane] \ 2176 -command [itcl::code $this AdjustSetting xcutplane-visible] \2177 -variable [itcl::scope _ cutplane(xvisible)]2201 -command [itcl::code $this AdjustSetting cutplane-xvisible] \ 2202 -variable [itcl::scope _settings(cutplane-xvisible)] 2178 2203 } 2179 2204 Rappture::Tooltip::for $itk_component(xCutButton) \ … … 2185 2210 -borderwidth 1 -highlightthickness 0 \ 2186 2211 -command [itcl::code $this EventuallySetCutplane x] \ 2187 -variable [itcl::scope _ cutplane(xposition)]2212 -variable [itcl::scope _settings(cutplane-xposition)] 2188 2213 } { 2189 2214 usual … … 2191 2216 } 2192 2217 # Set the default cutplane value before disabling the scale. 2193 $itk_component(xCutScale) set 1002218 $itk_component(xCutScale) set 50 2194 2219 $itk_component(xCutScale) configure -state disabled 2195 2220 Rappture::Tooltip::for $itk_component(xCutScale) \ … … 2201 2226 -onimage [Rappture::icon y-cutplane] \ 2202 2227 -offimage [Rappture::icon y-cutplane] \ 2203 -command [itcl::code $this AdjustSetting ycutplane-visible] \2204 -variable [itcl::scope _ cutplane(yvisible)]2228 -command [itcl::code $this AdjustSetting cutplane-yvisible] \ 2229 -variable [itcl::scope _settings(cutplane-yvisible)] 2205 2230 } 2206 2231 Rappture::Tooltip::for $itk_component(yCutButton) \ … … 2212 2237 -borderwidth 1 -highlightthickness 0 \ 2213 2238 -command [itcl::code $this EventuallySetCutplane y] \ 2214 -variable [itcl::scope _ cutplane(yposition)]2239 -variable [itcl::scope _settings(cutplane-yposition)] 2215 2240 } { 2216 2241 usual … … 2220 2245 "@[itcl::code $this Slice tooltip y]" 2221 2246 # Set the default cutplane value before disabling the scale. 2222 $itk_component(yCutScale) set 1002247 $itk_component(yCutScale) set 50 2223 2248 $itk_component(yCutScale) configure -state disabled 2224 2249 … … 2228 2253 -onimage [Rappture::icon z-cutplane] \ 2229 2254 -offimage [Rappture::icon z-cutplane] \ 2230 -command [itcl::code $this AdjustSetting zcutplane-visible] \2231 -variable [itcl::scope _ cutplane(zvisible)]2255 -command [itcl::code $this AdjustSetting cutplane-zvisible] \ 2256 -variable [itcl::scope _settings(cutplane-zvisible)] 2232 2257 } 2233 2258 Rappture::Tooltip::for $itk_component(zCutButton) \ … … 2239 2264 -borderwidth 1 -highlightthickness 0 \ 2240 2265 -command [itcl::code $this EventuallySetCutplane z] \ 2241 -variable [itcl::scope _ cutplane(zposition)]2266 -variable [itcl::scope _settings(cutplane-zposition)] 2242 2267 } { 2243 2268 usual 2244 2269 ignore -borderwidth -highlightthickness 2245 2270 } 2246 $itk_component(zCutScale) set 1002271 $itk_component(zCutScale) set 50 2247 2272 $itk_component(zCutScale) configure -state disabled 2248 2273 #$itk_component(zCutScale) configure -state disabled … … 2396 2421 set tag $dataobj-$comp 2397 2422 set style [$dataobj style $comp] 2398 #puts stderr "style $dataobj-$comp \"$style\""2399 if { $dataobj != $_first } {2400 set settings(-wireframe) 12401 }2402 2423 array set settings { 2403 2424 -color \#808080 … … 2412 2433 -visible 1 2413 2434 } 2435 if { $dataobj != $_first } { 2436 set settings(-opacity) 1 2437 } 2414 2438 array set settings $style 2415 2439 SendCmd "streamlines add $tag" … … 2429 2453 SendCmd "cutplane linewidth 1 $tag" 2430 2454 #SendCmd "cutplane linecolor 1 1 1 $tag" 2431 #puts stderr "cutplane axis $axis $bool"2432 2455 #SendCmd "cutplane visible $tag" 2433 2456 foreach axis { x y z } { … … 2438 2461 SendCmd "polydata add $tag" 2439 2462 SendCmd "polydata edges $settings(-edges) $tag" 2440 set _ volume(edges) $settings(-edges)2463 set _settings(volume-edges) $settings(-edges) 2441 2464 SendCmd "polydata color [Color2RGB $settings(-color)] $tag" 2442 2465 SendCmd "polydata lighting $settings(-lighting) $tag" 2443 set _ volume(lighting) $settings(-lighting)2466 set _settings(volume-lighting) $settings(-lighting) 2444 2467 SendCmd "polydata linecolor [Color2RGB $settings(-edgecolor)] $tag" 2445 2468 SendCmd "polydata linewidth $settings(-linewidth) $tag" 2446 2469 SendCmd "polydata opacity $settings(-opacity) $tag" 2447 set _ volume(opacity) $settings(-opacity)2470 set _settings(volume-opacity) $settings(-opacity) 2448 2471 SendCmd "polydata wireframe $settings(-wireframe) $tag" 2449 set _ volume(wireframe) $settings(-wireframe)2450 set _ volume(opacity) [expr $settings(-opacity) * 100.0]2472 set _settings(volume-wireframe) $settings(-wireframe) 2473 set _settings(volume-opacity) [expr $settings(-opacity) * 100.0] 2451 2474 SetColormap $dataobj $comp 2452 2475 } … … 2496 2519 2497 2520 regsub {\(mag\)} $title "" title 2498 if { $_settings(legend ) } {2521 if { $_settings(legend-visible) } { 2499 2522 set x [expr $w - 2] 2500 2523 if { [$c find withtag "legend"] == "" } { … … 2593 2616 # Compute the value of the point 2594 2617 set t [expr 1.0 - (double($imgY) / double($imgHeight-1))] 2595 #puts stderr "t=$t x=$x y=$y imgY=$imgY"2596 2618 set value [expr $t * ($_limits(vmax) - $_limits(vmin)) + $_limits(vmin)] 2597 2619 set tipx [expr $x + 15] 2598 2620 set tipy [expr $y - 5] 2599 #puts stderr "tipx=$tipx tipy=$tipy x=$x y=$y"2600 2621 Rappture::Tooltip::text $c "$_title $value" 2601 2622 Rappture::Tooltip::tooltip show $c +$tipx,+$tipy … … 2615 2636 "move" { 2616 2637 set axis [lindex $args 0] 2617 set oldval $_ axis(${axis}position)2638 set oldval $_settings(axis-${axis}position) 2618 2639 set newval [lindex $args 1] 2619 2640 if {[llength $args] != 2} { … … 2633 2654 } 2634 2655 } 2656 2657 proc name { mesg } { 2658 SendBytes $mesg 2659 } 2660 2661 2662
Note: See TracChangeset
for help on using the changeset viewer.