Changeset 3400 for trunk/gui/scripts
- Timestamp:
- Feb 28, 2013, 3:28:53 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gui/scripts/vtkstreamlinesviewer.tcl
r3394 r3400 614 614 # Remove it from the dataobj list. 615 615 set _dlist [lreplace $_dlist $pos $pos] 616 SendCmd "dataset visible 0"617 616 array unset _obj2ovride $dataobj-* 618 617 array unset _settings $dataobj-* … … 1029 1028 DoResize 1030 1029 InitSettings axisXGrid axisYGrid axisZGrid axis-mode \ 1031 axesVisible axisLabelsVisible \ 1032 } 1033 #SendCmd "imgflush" 1030 axesVisible axisLabelsVisible 1031 # This "imgflush" is to force an image returned before vtkvis starts 1032 # reading a (big) dataset. This will display an empty plot with axes 1033 # at the correct image size. 1034 SendCmd "imgflush" 1035 } 1034 1036 1035 1037 set _limits(zmin) "" 1036 1038 set _limits(zmax) "" 1037 1039 set _first "" 1040 SendCmd "dataset visible 0" 1038 1041 foreach dataobj [get -objects] { 1039 1042 if { [info exists _obj2ovride($dataobj-raise)] && $_first == "" } { … … 1065 1068 if { [info exists _obj2ovride($dataobj-raise)] } { 1066 1069 SendCmd "dataset visible 1 $tag" 1067 } else {1068 SendCmd "dataset visible 0 $tag"1069 1070 } 1070 1071 } … … 1118 1119 } 1119 1120 1120 InitSettings streamlinesVisible streamlines-palette volumeVisible1121 1122 1121 if { $_reset } { 1123 1122 InitSettings streamlinesSeedsVisible streamlinesOpacity \ 1124 streamlinesNumSeeds streamlinesLighting \ 1125 streamlines-palette streamlines-field \ 1126 volumeEdges volumeLighting volumeOpacity volumeWireframe \ 1123 streamlinesVisible streamlinesPalette \ 1124 streamlinesLighting \ 1125 streamlinesPalette streamlinesField \ 1126 volumeVisible volumeEdges volumeLighting volumeOpacity \ 1127 volumeWireframe \ 1127 1128 cutplaneVisible \ 1128 1129 cutplaneXPosition cutplaneYPosition cutplaneZPosition \ 1129 1130 cutplaneXVisible cutplaneYVisible cutplaneZVisible 1130 # 1131 1132 # FIXME: Don't know exactly why this "imgflush" is needed. 1133 # But this makes the "camera reset" below to work correctly 1134 SendCmd "imgflush" 1135 1131 1136 # Reset the camera and other view parameters 1132 #1133 1137 set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)] 1134 1138 $_arcball quaternion $q … … 1390 1394 set val $_settings(volumeOpacity) 1391 1395 set sval [expr { 0.01 * double($val) }] 1392 foreach dataset [CurrentDatasets -visible] { 1393 SendCmd "polydata opacity $sval $dataset" 1394 } 1396 SendCmd "polydata opacity $sval" 1395 1397 } 1396 1398 "volumeWireframe" { 1397 1399 set bool $_settings(volumeWireframe) 1398 foreach dataset [CurrentDatasets -visible] { 1399 SendCmd "polydata wireframe $bool $dataset" 1400 } 1400 SendCmd "polydata wireframe $bool" 1401 1401 } 1402 1402 "volumeVisible" { 1403 1403 set bool $_settings(volumeVisible) 1404 foreach dataset [CurrentDatasets -visible] { 1405 SendCmd "polydata visible $bool $dataset" 1406 } 1404 SendCmd "polydata visible $bool" 1407 1405 if { $bool } { 1408 1406 Rappture::Tooltip::for $itk_component(volume) \ … … 1415 1413 "volumeLighting" { 1416 1414 set bool $_settings(volumeLighting) 1417 foreach dataset [CurrentDatasets -visible] { 1418 SendCmd "polydata lighting $bool $dataset" 1419 } 1415 SendCmd "polydata lighting $bool" 1420 1416 } 1421 1417 "volumeEdges" { 1422 1418 set bool $_settings(volumeEdges) 1423 foreach dataset [CurrentDatasets -visible] { 1424 SendCmd "polydata edges $bool $dataset" 1425 } 1419 SendCmd "polydata edges $bool" 1426 1420 } 1427 1421 "axesVisible" { … … 1446 1440 "cutplaneEdges" { 1447 1441 set bool $_settings($what) 1448 foreach dataset [CurrentDatasets -visible] { 1449 SendCmd "cutplane edges $bool $dataset" 1450 } 1442 SendCmd "cutplane edges $bool" 1451 1443 } 1452 1444 "cutplaneVisible" { 1453 1445 set bool $_settings($what) 1454 foreach dataset [CurrentDatasets -visible] { 1455 SendCmd "cutplane visible $bool $dataset" 1456 } 1446 SendCmd "cutplane visible $bool" 1457 1447 } 1458 1448 "cutplaneWireframe" { 1459 1449 set bool $_settings($what) 1460 foreach dataset [CurrentDatasets -visible] { 1461 SendCmd "cutplane wireframe $bool $dataset" 1462 } 1450 SendCmd "cutplane wireframe $bool" 1463 1451 } 1464 1452 "cutplaneLighting" { 1465 1453 set bool $_settings($what) 1466 foreach dataset [CurrentDatasets -visible] { 1467 SendCmd "cutplane lighting $bool $dataset" 1468 } 1454 SendCmd "cutplane lighting $bool" 1469 1455 } 1470 1456 "cutplaneOpacity" { 1471 1457 set val $_settings($what) 1472 1458 set sval [expr { 0.01 * double($val) }] 1473 foreach dataset [CurrentDatasets -visible] { 1474 SendCmd "cutplane opacity $sval $dataset" 1475 } 1459 SendCmd "cutplane opacity $sval" 1476 1460 } 1477 1461 "cutplaneXVisible" - "cutplaneYVisible" - "cutplaneZVisible" { … … 1485 1469 -troughcolor grey82 1486 1470 } 1487 foreach dataset [CurrentDatasets -visible] { 1488 SendCmd "cutplane axis $axis $bool $dataset" 1489 } 1471 SendCmd "cutplane axis $axis $bool" 1490 1472 } 1491 1473 "cutplaneXPosition" - "cutplaneYPosition" - "cutplaneZPosition" { 1492 1474 set axis [string tolower [string range $what 8 8]] 1493 1475 set pos [expr $_settings($what) * 0.01] 1494 foreach dataset [CurrentDatasets -visible] { 1495 SendCmd "cutplane slice ${axis} ${pos} $dataset" 1496 } 1476 SendCmd "cutplane slice ${axis} ${pos}" 1497 1477 set _cutplanePending 0 1498 1478 } 1499 1479 "streamlinesSeedsVisible" { 1500 1480 set bool $_settings($what) 1501 foreach dataset [CurrentDatasets -visible] { 1502 SendCmd "streamlines seed visible $bool $dataset" 1503 } 1481 SendCmd "streamlines seed visible $bool" 1504 1482 } 1505 1483 "streamlinesNumSeeds" { … … 1509 1487 "streamlinesVisible" { 1510 1488 set bool $_settings($what) 1511 foreach dataset [CurrentDatasets -visible] { 1512 SendCmd "streamlines visible $bool $dataset" 1513 } 1489 SendCmd "streamlines visible $bool" 1514 1490 if { $bool } { 1515 1491 Rappture::Tooltip::for $itk_component(streamlines) \ … … 1523 1499 set mode [$itk_component(streammode) value] 1524 1500 set _settings(streamlinesMode) $mode 1525 foreach dataset [CurrentDatasets -visible] { 1526 switch -- $mode { 1527 "lines" { 1528 SendCmd "streamlines lines $dataset" 1529 } 1530 "ribbons" { 1531 SendCmd "streamlines ribbons 3 0 $dataset" 1532 } 1533 "tubes" { 1534 SendCmd "streamlines tubes 5 3 $dataset" 1535 } 1536 } 1537 } 1538 } 1539 "streamlines-palette" { 1501 switch -- $mode { 1502 "lines" { 1503 SendCmd "streamlines lines" 1504 } 1505 "ribbons" { 1506 SendCmd "streamlines ribbons 3 0" 1507 } 1508 "tubes" { 1509 SendCmd "streamlines tubes 5 3" 1510 } 1511 } 1512 } 1513 "streamlinesPalette" { 1540 1514 set palette [$itk_component(palette) value] 1541 set _settings(streamlines -palette) $palette1515 set _settings(streamlinesPalette) $palette 1542 1516 foreach dataset [CurrentDatasets -visible $_first] { 1543 1517 foreach {dataobj comp} [split $dataset -] break … … 1549 1523 set val $_settings(streamlinesOpacity) 1550 1524 set sval [expr { 0.01 * double($val) }] 1551 foreach dataset [CurrentDatasets -visible $_first] { 1552 SendCmd "streamlines opacity $sval $dataset" 1553 } 1525 SendCmd "streamlines opacity $sval" 1554 1526 } 1555 1527 "streamlinesScale" { 1556 1528 set val $_settings(streamlinesScale) 1557 1529 set sval [expr { 0.01 * double($val) }] 1558 foreach dataset [CurrentDatasets -visible $_first] { 1559 SendCmd "streamlines scale $sval $sval $sval $dataset" 1560 } 1530 SendCmd "streamlines scale $sval $sval $sval" 1561 1531 } 1562 1532 "streamlinesLighting" { 1563 1533 set bool $_settings(streamlinesLighting) 1564 foreach dataset [CurrentDatasets -visible $_first] { 1565 SendCmd "streamlines lighting $bool $dataset" 1566 } 1567 } 1568 "streamlines-field" { 1534 SendCmd "streamlines lighting $bool" 1535 } 1536 "streamlinesField" { 1569 1537 set new [$itk_component(field) value] 1570 1538 set value [$itk_component(field) translate $new] 1571 set _settings(streamlines -field) $value1539 set _settings(streamlinesField) $value 1572 1540 if { [info exists _scalarFields($new)] } { 1573 1541 set name $_scalarFields($new) … … 1582 1550 return 1583 1551 } 1584 foreach dataset [CurrentDatasets -visible] { 1585 SendCmd "streamlines colormode $_colorMode ${name} $dataset" 1586 SendCmd "cutplane colormode $_colorMode ${name} $dataset" 1587 } 1552 SendCmd "streamlines colormode $_colorMode ${name}" 1553 SendCmd "cutplane colormode $_colorMode ${name}" 1588 1554 set _legendPending 1 1589 1555 } … … 1907 1873 } 1908 1874 bind $inner.field <<Value>> \ 1909 [itcl::code $this AdjustSetting streamlines -field]1875 [itcl::code $this AdjustSetting streamlinesField] 1910 1876 1911 1877 label $inner.palette_l -text "Palette" -font "Arial 9" … … 1933 1899 $itk_component(palette) value "BCGYR" 1934 1900 bind $inner.palette <<Value>> \ 1935 [itcl::code $this AdjustSetting streamlines -palette]1901 [itcl::code $this AdjustSetting streamlinesPalette] 1936 1902 1937 1903 blt::table $inner \ … … 2353 2319 } 2354 2320 SendCmd "cutplane add $tag" 2355 SendCmd "cutplane edges 0 $tag"2356 SendCmd "cutplane wireframe 0 $tag"2357 SendCmd "cutplane lighting 1 $tag"2358 SendCmd "cutplane linewidth 1 $tag"2359 #SendCmd "cutplane linecolor 1 1 1 $tag"2360 #SendCmd "cutplane visible $tag"2361 foreach axis { x y z } {2362 SendCmd "cutplane slice $axis 0.5 $tag"2363 SendCmd "cutplane axis $axis 0 $tag"2364 }2365 2366 2321 SendCmd "polydata add $tag" 2367 SendCmd "polydata edges $settings(-edges) $tag"2368 2322 set _settings(volumeEdges) $settings(-edges) 2369 SendCmd "polydata color [Color2RGB $settings(-color)] $tag"2370 SendCmd "polydata lighting $settings(-lighting) $tag"2371 2323 set _settings(volumeLighting) $settings(-lighting) 2372 SendCmd "polydata linecolor [Color2RGB $settings(-edgecolor)] $tag"2373 SendCmd "polydata linewidth $settings(-linewidth) $tag"2374 SendCmd "polydata opacity $settings(-opacity) $tag"2375 2324 set _settings(volumeOpacity) $settings(-opacity) 2376 SendCmd "polydata wireframe $settings(-wireframe) $tag"2377 2325 set _settings(volumeWireframe) $settings(-wireframe) 2378 2326 set _settings(volumeOpacity) [expr $settings(-opacity) * 100.0] … … 2615 2563 invoke { 2616 2564 $itk_component(field) value $_currentField 2617 AdjustSetting streamlines -field2565 AdjustSetting streamlinesField 2618 2566 } 2619 2567 default {
Note: See TracChangeset
for help on using the changeset viewer.