Changeset 4798 for branches/uq/gui/scripts/vtkmeshviewer.tcl
- Timestamp:
- Nov 26, 2014, 7:28:23 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/uq/gui/scripts/vtkmeshviewer.tcl
r4797 r4798 57 57 public method get {args} 58 58 public method isconnected {} 59 public method limits { dataobj}59 public method limits { colormap } 60 60 public method parameters {title args} { 61 61 # do nothing … … 81 81 private method BuildAxisTab {} 82 82 private method BuildCameraTab {} 83 private method BuildCutawayTab {} 83 84 private method BuildDownloadPopup { widget command } 84 85 private method BuildPolydataTab {} … … 93 94 private method SetOrientation { side } 94 95 private method SetPolydataOpacity {} 96 private method Slice {option args} 95 97 96 98 private variable _arcball "" … … 100 102 private variable _datasets; # contains all the dataobj-component 101 103 # datasets in the server 104 private variable _colormaps; # contains all the colormaps 105 # in the server. 102 106 private variable _dataset2style; # maps dataobj-component to transfunc 103 107 private variable _style2datasets; # maps tf back to list of … … 183 187 -axesvisible 1 184 188 -axislabels 1 185 -axisminorticks 1186 189 -outline 0 187 190 -polydataedges 0 … … 190 193 -polydatavisible 1 191 194 -polydatawireframe 0 195 -xcutaway 0 196 -xdirection -1 192 197 -xgrid 0 198 -xposition 0 199 -ycutaway 0 200 -ydirection -1 193 201 -ygrid 0 202 -yposition 0 203 -zcutaway 0 204 -zdirection -1 194 205 -zgrid 0 206 -zposition 0 195 207 } 196 208 array set _widget { … … 273 285 BuildPolydataTab 274 286 BuildAxisTab 287 #BuildCutawayTab 275 288 BuildCameraTab 276 289 … … 710 723 711 724 # disconnected -- no more data sitting on server 712 array unset _datasets 713 array unset _data 725 array unset _datasets 726 array unset _data 727 array unset _colormaps 714 728 global readyForNextFrame 715 729 set readyForNextFrame 1 … … 821 835 $_arcball resize $w $h 822 836 DoResize 823 InitSettings -xgrid -ygrid -zgrid -axismode \ 824 -axesvisible -axislabels -axisminorticks 837 InitSettings -xgrid -ygrid -zgrid -axismode -axesvisible -axislabels 825 838 StopBufferingCommands 826 839 SendCmd "imgflush" … … 890 903 -polydatavisible -polydatawireframe 891 904 892 #SendCmd "axis lformat all %g" 905 SendCmd "axis lformat all %g" 906 # Too many major ticks, so turn off minor ticks 907 SendCmd "axis minticks all 0" 893 908 894 909 set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)] … … 1201 1216 set mode [$itk_component(axismode) translate $mode] 1202 1217 SendCmd "axis flymode $mode" 1218 } 1219 "-xcutaway" - "-ycutaway" - "-zcutaway" { 1220 set axis [string range $what 1 1] 1221 set bool $_settings($what) 1222 if { $bool } { 1223 set pos [expr $_settings(-${axis}position) * 0.01] 1224 set dir $_settings(-${axis}direction) 1225 $itk_component(${axis}CutScale) configure -state normal \ 1226 -troughcolor white 1227 SendCmd "renderer clipplane $axis $pos $dir" 1228 } else { 1229 $itk_component(${axis}CutScale) configure -state disabled \ 1230 -troughcolor grey82 1231 SendCmd "renderer clipplane $axis 1 -1" 1232 } 1233 } 1234 "-xposition" - "-yposition" - "-zposition" { 1235 set axis [string range $what 1 1] 1236 set pos [expr $_settings($what) * 0.01] 1237 SendCmd "renderer clipplane ${axis} $pos -1" 1238 } 1239 "-xdirection" - "-ydirection" - "-zdirection" { 1240 set axis [string range $what 1 1] 1241 puts stderr "direction not implemented" 1203 1242 } 1204 1243 default { … … 1352 1391 set inner [$itk_component(main) insert end \ 1353 1392 -title "Axis Settings" \ 1354 -icon [Rappture::icon axis 2]]1393 -icon [Rappture::icon axis1]] 1355 1394 $inner configure -borderwidth 4 1356 1395 1357 1396 checkbutton $inner.visible \ 1358 -text " Axes" \1397 -text "Show Axes" \ 1359 1398 -variable [itcl::scope _settings(-axesvisible)] \ 1360 1399 -command [itcl::code $this AdjustSetting -axesvisible] \ … … 1362 1401 1363 1402 checkbutton $inner.labels \ 1364 -text " Axis Labels" \1403 -text "Show Axis Labels" \ 1365 1404 -variable [itcl::scope _settings(-axislabels)] \ 1366 1405 -command [itcl::code $this AdjustSetting -axislabels] \ 1367 1406 -font "Arial 9" 1368 label $inner.grid_l -text "Grid" -font "Arial 9" 1369 checkbutton $inner. xgrid\1370 -text " X" \1407 1408 checkbutton $inner.gridx \ 1409 -text "Show X Grid" \ 1371 1410 -variable [itcl::scope _settings(-xgrid)] \ 1372 1411 -command [itcl::code $this AdjustSetting -xgrid] \ 1373 1412 -font "Arial 9" 1374 checkbutton $inner. ygrid\1375 -text " Y" \1413 checkbutton $inner.gridy \ 1414 -text "Show Y Grid" \ 1376 1415 -variable [itcl::scope _settings(-ygrid)] \ 1377 1416 -command [itcl::code $this AdjustSetting -ygrid] \ 1378 1417 -font "Arial 9" 1379 checkbutton $inner. zgrid\1380 -text " Z" \1418 checkbutton $inner.gridz \ 1419 -text "Show Z Grid" \ 1381 1420 -variable [itcl::scope _settings(-zgrid)] \ 1382 1421 -command [itcl::code $this AdjustSetting -zgrid] \ 1383 -font "Arial 9"1384 checkbutton $inner.minorticks \1385 -text "Minor Ticks" \1386 -variable [itcl::scope _settings(-axisminorticks)] \1387 -command [itcl::code $this AdjustSetting -axisminorticks] \1388 1422 -font "Arial 9" 1389 1423 … … 1402 1436 1403 1437 blt::table $inner \ 1404 0,0 $inner.visible -anchor w -cspan 4 \ 1405 1,0 $inner.labels -anchor w -cspan 4 \ 1406 2,0 $inner.minorticks -anchor w -cspan 4 \ 1407 4,0 $inner.grid_l -anchor w \ 1408 4,1 $inner.xgrid -anchor w \ 1409 4,2 $inner.ygrid -anchor w \ 1410 4,3 $inner.zgrid -anchor w \ 1411 5,0 $inner.mode_l -anchor w -padx { 2 0 } \ 1412 5,1 $inner.mode -fill x -cspan 3 1438 0,0 $inner.visible -anchor w -cspan 2 \ 1439 1,0 $inner.labels -anchor w -cspan 2 \ 1440 2,0 $inner.gridx -anchor w -cspan 2 \ 1441 3,0 $inner.gridy -anchor w -cspan 2 \ 1442 4,0 $inner.gridz -anchor w -cspan 2 \ 1443 5,0 $inner.mode_l -anchor w -cspan 2 -padx { 2 0 } \ 1444 6,0 $inner.mode -fill x -cspan 2 1413 1445 1414 1446 blt::table configure $inner r* c* -resize none 1415 blt::table configure $inner r7 c6 -resize expand 1416 blt::table configure $inner r3 -height 0.125i 1447 blt::table configure $inner r7 c1 -resize expand 1417 1448 } 1418 1449 … … 1463 1494 blt::table configure $inner c2 -resize expand 1464 1495 blt::table configure $inner r$row -resize expand 1496 } 1497 1498 itcl::body Rappture::VtkMeshViewer::BuildCutawayTab {} { 1499 1500 set fg [option get $itk_component(hull) font Font] 1501 1502 set inner [$itk_component(main) insert end \ 1503 -title "Cutaway Along Axis" \ 1504 -icon [Rappture::icon cutbutton]] 1505 1506 $inner configure -borderwidth 4 1507 1508 # X-value slicer... 1509 itk_component add xCutButton { 1510 Rappture::PushButton $inner.xbutton \ 1511 -onimage [Rappture::icon x-cutplane] \ 1512 -offimage [Rappture::icon x-cutplane] \ 1513 -command [itcl::code $this AdjustSetting -xcutaway] \ 1514 -variable [itcl::scope _settings(-xcutaway)] 1515 } 1516 Rappture::Tooltip::for $itk_component(xCutButton) \ 1517 "Toggle the X-axis cutaway on/off" 1518 1519 itk_component add xCutScale { 1520 ::scale $inner.xval -from 100 -to 0 \ 1521 -width 10 -orient vertical -showvalue yes \ 1522 -borderwidth 1 -highlightthickness 0 \ 1523 -command [itcl::code $this Slice move x] \ 1524 -variable [itcl::scope _settings(-xposition)] 1525 } { 1526 usual 1527 ignore -borderwidth -highlightthickness 1528 } 1529 # Set the default cutaway value before disabling the scale. 1530 $itk_component(xCutScale) set 100 1531 $itk_component(xCutScale) configure -state disabled 1532 Rappture::Tooltip::for $itk_component(xCutScale) \ 1533 "@[itcl::code $this Slice tooltip x]" 1534 1535 itk_component add xDirButton { 1536 Rappture::PushButton $inner.xdir \ 1537 -onimage [Rappture::icon arrow-down] \ 1538 -onvalue -1 \ 1539 -offimage [Rappture::icon arrow-up] \ 1540 -offvalue 1 \ 1541 -command [itcl::code $this AdjustSetting -xdirection] \ 1542 -variable [itcl::scope _settings(-xdirection)] 1543 } 1544 set _settings(-xdirection) -1 1545 Rappture::Tooltip::for $itk_component(xDirButton) \ 1546 "Toggle the direction of the X-axis cutaway" 1547 1548 # Y-value slicer... 1549 itk_component add yCutButton { 1550 Rappture::PushButton $inner.ybutton \ 1551 -onimage [Rappture::icon y-cutplane] \ 1552 -offimage [Rappture::icon y-cutplane] \ 1553 -command [itcl::code $this AdjustSetting -ycutaway] \ 1554 -variable [itcl::scope _settings(-ycutaway)] 1555 } 1556 Rappture::Tooltip::for $itk_component(yCutButton) \ 1557 "Toggle the Y-axis cutaway on/off" 1558 1559 itk_component add yCutScale { 1560 ::scale $inner.yval -from 100 -to 0 \ 1561 -width 10 -orient vertical -showvalue yes \ 1562 -borderwidth 1 -highlightthickness 0 \ 1563 -command [itcl::code $this Slice move y] \ 1564 -variable [itcl::scope _settings(-yposition)] 1565 } { 1566 usual 1567 ignore -borderwidth -highlightthickness 1568 } 1569 Rappture::Tooltip::for $itk_component(yCutScale) \ 1570 "@[itcl::code $this Slice tooltip y]" 1571 # Set the default cutaway value before disabling the scale. 1572 $itk_component(yCutScale) set 100 1573 $itk_component(yCutScale) configure -state disabled 1574 1575 itk_component add yDirButton { 1576 Rappture::PushButton $inner.ydir \ 1577 -onimage [Rappture::icon arrow-down] \ 1578 -onvalue -1 \ 1579 -offimage [Rappture::icon arrow-up] \ 1580 -offvalue 1 \ 1581 -command [itcl::code $this AdjustSetting -ydirection] \ 1582 -variable [itcl::scope _settings(-ydirection)] 1583 } 1584 Rappture::Tooltip::for $itk_component(yDirButton) \ 1585 "Toggle the direction of the Y-axis cutaway" 1586 set _settings(-ydirection) -1 1587 1588 # Z-value slicer... 1589 itk_component add zCutButton { 1590 Rappture::PushButton $inner.zbutton \ 1591 -onimage [Rappture::icon z-cutplane] \ 1592 -offimage [Rappture::icon z-cutplane] \ 1593 -command [itcl::code $this AdjustSetting -zcutaway] \ 1594 -variable [itcl::scope _settings(-zcutaway)] 1595 } 1596 Rappture::Tooltip::for $itk_component(zCutButton) \ 1597 "Toggle the Z-axis cutaway on/off" 1598 1599 itk_component add zCutScale { 1600 ::scale $inner.zval -from 100 -to 0 \ 1601 -width 10 -orient vertical -showvalue yes \ 1602 -borderwidth 1 -highlightthickness 0 \ 1603 -command [itcl::code $this Slice move z] \ 1604 -variable [itcl::scope _settings(-zposition)] 1605 } { 1606 usual 1607 ignore -borderwidth -highlightthickness 1608 } 1609 $itk_component(zCutScale) set 100 1610 $itk_component(zCutScale) configure -state disabled 1611 Rappture::Tooltip::for $itk_component(zCutScale) \ 1612 "@[itcl::code $this Slice tooltip z]" 1613 1614 itk_component add zDirButton { 1615 Rappture::PushButton $inner.zdir \ 1616 -onimage [Rappture::icon arrow-down] \ 1617 -onvalue -1 \ 1618 -offimage [Rappture::icon arrow-up] \ 1619 -offvalue 1 \ 1620 -command [itcl::code $this AdjustSetting -zdirection] \ 1621 -variable [itcl::scope _settings(-zdirection)] 1622 } 1623 set _settings(-zdirection) -1 1624 Rappture::Tooltip::for $itk_component(zDirButton) \ 1625 "Toggle the direction of the Z-axis cutaway" 1626 1627 blt::table $inner \ 1628 0,0 $itk_component(xCutButton) -anchor e -padx 2 -pady 2 \ 1629 1,0 $itk_component(xCutScale) -fill y \ 1630 0,1 $itk_component(yCutButton) -anchor e -padx 2 -pady 2 \ 1631 1,1 $itk_component(yCutScale) -fill y \ 1632 0,2 $itk_component(zCutButton) -anchor e -padx 2 -pady 2 \ 1633 1,2 $itk_component(zCutScale) -fill y \ 1634 1635 blt::table configure $inner r* c* -resize none 1636 blt::table configure $inner r1 c3 -resize expand 1465 1637 } 1466 1638 … … 1625 1797 } 1626 1798 1799 # ---------------------------------------------------------------------- 1800 # USAGE: Slice move x|y|z <newval> 1801 # 1802 # Called automatically when the user drags the slider to move the 1803 # cut plane that slices 3D data. Gets the current value from the 1804 # slider and moves the cut plane to the appropriate point in the 1805 # data set. 1806 # ---------------------------------------------------------------------- 1807 itcl::body Rappture::VtkMeshViewer::Slice {option args} { 1808 switch -- $option { 1809 "move" { 1810 set axis [lindex $args 0] 1811 set newval [lindex $args 1] 1812 if {[llength $args] != 2} { 1813 error "wrong # args: should be \"Slice move x|y|z newval\"" 1814 } 1815 set newpos [expr {0.01*$newval}] 1816 SendCmd "renderer clipplane $axis $newpos -1" 1817 } 1818 "tooltip" { 1819 set axis [lindex $args 0] 1820 set val [$itk_component(${axis}CutScale) get] 1821 return "Move the [string toupper $axis] cut plane.\nCurrently: $axis = $val%" 1822 } 1823 default { 1824 error "bad option \"$option\": should be axis, move, or tooltip" 1825 } 1826 } 1827 } 1828 1627 1829 itcl::body Rappture::VtkMeshViewer::SetOrientation { side } { 1628 1830 array set positions { … … 1645 1847 set _view(zoom) 1.0 1646 1848 } 1849
Note: See TracChangeset
for help on using the changeset viewer.