- Timestamp:
- Nov 10, 2014, 9:44:00 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gui/scripts/vtkmeshviewer.tcl
r4669 r4689 94 94 private method SetOrientation { side } 95 95 private method SetPolydataOpacity {} 96 private method Slice {option args}97 96 98 97 private variable _arcball "" … … 187 186 -axesvisible 1 188 187 -axislabels 1 188 -axisminorticks 1 189 189 -outline 0 190 190 -polydataedges 0 … … 193 193 -polydatavisible 1 194 194 -polydatawireframe 0 195 -xcutaway 0196 -xdirection -1197 195 -xgrid 0 198 -xposition 0199 -ycutaway 0200 -ydirection -1201 196 -ygrid 0 202 -yposition 0203 -zcutaway 0204 -zdirection -1205 197 -zgrid 0 206 -zposition 0207 198 } 208 199 array set _widget { … … 285 276 BuildPolydataTab 286 277 BuildAxisTab 287 #BuildCutawayTab288 278 BuildCameraTab 289 279 … … 835 825 $_arcball resize $w $h 836 826 DoResize 837 InitSettings -xgrid -ygrid -zgrid -axismode -axesvisible -axislabels 827 InitSettings -xgrid -ygrid -zgrid -axismode \ 828 -axesvisible -axislabels -axisminorticks 838 829 StopBufferingCommands 839 830 SendCmd "imgflush" … … 903 894 -polydatavisible -polydatawireframe 904 895 905 SendCmd "axis lformat all %g" 906 # Too many major ticks, so turn off minor ticks 907 SendCmd "axis minticks all 0" 896 #SendCmd "axis lformat all %g" 908 897 909 898 set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)] … … 1195 1184 SendCmd "axis labels all $bool" 1196 1185 } 1186 "-axisminorticks" { 1187 set bool $_settings($what) 1188 SendCmd "axis minticks all $bool" 1189 } 1197 1190 "-xgrid" { 1198 1191 set bool $_settings($what) … … 1211 1204 set mode [$itk_component(axismode) translate $mode] 1212 1205 SendCmd "axis flymode $mode" 1213 }1214 "-xcutaway" - "-ycutaway" - "-zcutaway" {1215 set axis [string range $what 1 1]1216 set bool $_settings($what)1217 if { $bool } {1218 set pos [expr $_settings(-${axis}position) * 0.01]1219 set dir $_settings(-${axis}direction)1220 $itk_component(${axis}CutScale) configure -state normal \1221 -troughcolor white1222 SendCmd "renderer clipplane $axis $pos $dir"1223 } else {1224 $itk_component(${axis}CutScale) configure -state disabled \1225 -troughcolor grey821226 SendCmd "renderer clipplane $axis 1 -1"1227 }1228 }1229 "-xposition" - "-yposition" - "-zposition" {1230 set axis [string range $what 1 1]1231 set pos [expr $_settings($what) * 0.01]1232 SendCmd "renderer clipplane ${axis} $pos -1"1233 }1234 "-xdirection" - "-ydirection" - "-zdirection" {1235 set axis [string range $what 1 1]1236 puts stderr "direction not implemented"1237 1206 } 1238 1207 default { … … 1386 1355 set inner [$itk_component(main) insert end \ 1387 1356 -title "Axis Settings" \ 1388 -icon [Rappture::icon axis 1]]1357 -icon [Rappture::icon axis2]] 1389 1358 $inner configure -borderwidth 4 1390 1359 1391 1360 checkbutton $inner.visible \ 1392 -text " ShowAxes" \1361 -text "Axes" \ 1393 1362 -variable [itcl::scope _settings(-axesvisible)] \ 1394 1363 -command [itcl::code $this AdjustSetting -axesvisible] \ … … 1396 1365 1397 1366 checkbutton $inner.labels \ 1398 -text " ShowAxis Labels" \1367 -text "Axis Labels" \ 1399 1368 -variable [itcl::scope _settings(-axislabels)] \ 1400 1369 -command [itcl::code $this AdjustSetting -axislabels] \ 1401 1370 -font "Arial 9" 1402 1403 checkbutton $inner. gridx\1404 -text " Show X Grid" \1371 label $inner.grid_l -text "Grid" -font "Arial 9" 1372 checkbutton $inner.xgrid \ 1373 -text "X" \ 1405 1374 -variable [itcl::scope _settings(-xgrid)] \ 1406 1375 -command [itcl::code $this AdjustSetting -xgrid] \ 1407 1376 -font "Arial 9" 1408 checkbutton $inner. gridy\1409 -text " Show Y Grid" \1377 checkbutton $inner.ygrid \ 1378 -text "Y" \ 1410 1379 -variable [itcl::scope _settings(-ygrid)] \ 1411 1380 -command [itcl::code $this AdjustSetting -ygrid] \ 1412 1381 -font "Arial 9" 1413 checkbutton $inner. gridz\1414 -text " Show Z Grid" \1382 checkbutton $inner.zgrid \ 1383 -text "Z" \ 1415 1384 -variable [itcl::scope _settings(-zgrid)] \ 1416 1385 -command [itcl::code $this AdjustSetting -zgrid] \ 1386 -font "Arial 9" 1387 checkbutton $inner.minorticks \ 1388 -text "Minor Ticks" \ 1389 -variable [itcl::scope _settings(-axisminorticks)] \ 1390 -command [itcl::code $this AdjustSetting -axisminorticks] \ 1417 1391 -font "Arial 9" 1418 1392 … … 1431 1405 1432 1406 blt::table $inner \ 1433 0,0 $inner.visible -anchor w -cspan 2 \ 1434 1,0 $inner.labels -anchor w -cspan 2 \ 1435 2,0 $inner.gridx -anchor w -cspan 2 \ 1436 3,0 $inner.gridy -anchor w -cspan 2 \ 1437 4,0 $inner.gridz -anchor w -cspan 2 \ 1438 5,0 $inner.mode_l -anchor w -cspan 2 -padx { 2 0 } \ 1439 6,0 $inner.mode -fill x -cspan 2 1407 0,0 $inner.visible -anchor w -cspan 4 \ 1408 1,0 $inner.labels -anchor w -cspan 4 \ 1409 2,0 $inner.minorticks -anchor w -cspan 4 \ 1410 4,0 $inner.grid_l -anchor w \ 1411 4,1 $inner.xgrid -anchor w \ 1412 4,2 $inner.ygrid -anchor w \ 1413 4,3 $inner.zgrid -anchor w \ 1414 5,0 $inner.mode_l -anchor w -padx { 2 0 } \ 1415 5,1 $inner.mode -fill x -cspan 3 1440 1416 1441 1417 blt::table configure $inner r* c* -resize none 1442 blt::table configure $inner r7 c1 -resize expand 1418 blt::table configure $inner r7 c6 -resize expand 1419 blt::table configure $inner r3 -height 0.125i 1443 1420 } 1444 1421 … … 1489 1466 blt::table configure $inner c2 -resize expand 1490 1467 blt::table configure $inner r$row -resize expand 1491 }1492 1493 itcl::body Rappture::VtkMeshViewer::BuildCutawayTab {} {1494 1495 set fg [option get $itk_component(hull) font Font]1496 1497 set inner [$itk_component(main) insert end \1498 -title "Cutaway Along Axis" \1499 -icon [Rappture::icon cutbutton]]1500 1501 $inner configure -borderwidth 41502 1503 # X-value slicer...1504 itk_component add xCutButton {1505 Rappture::PushButton $inner.xbutton \1506 -onimage [Rappture::icon x-cutplane] \1507 -offimage [Rappture::icon x-cutplane] \1508 -command [itcl::code $this AdjustSetting -xcutaway] \1509 -variable [itcl::scope _settings(-xcutaway)]1510 }1511 Rappture::Tooltip::for $itk_component(xCutButton) \1512 "Toggle the X-axis cutaway on/off"1513 1514 itk_component add xCutScale {1515 ::scale $inner.xval -from 100 -to 0 \1516 -width 10 -orient vertical -showvalue yes \1517 -borderwidth 1 -highlightthickness 0 \1518 -command [itcl::code $this Slice move x] \1519 -variable [itcl::scope _settings(-xposition)]1520 } {1521 usual1522 ignore -borderwidth -highlightthickness1523 }1524 # Set the default cutaway value before disabling the scale.1525 $itk_component(xCutScale) set 1001526 $itk_component(xCutScale) configure -state disabled1527 Rappture::Tooltip::for $itk_component(xCutScale) \1528 "@[itcl::code $this Slice tooltip x]"1529 1530 itk_component add xDirButton {1531 Rappture::PushButton $inner.xdir \1532 -onimage [Rappture::icon arrow-down] \1533 -onvalue -1 \1534 -offimage [Rappture::icon arrow-up] \1535 -offvalue 1 \1536 -command [itcl::code $this AdjustSetting -xdirection] \1537 -variable [itcl::scope _settings(-xdirection)]1538 }1539 set _settings(-xdirection) -11540 Rappture::Tooltip::for $itk_component(xDirButton) \1541 "Toggle the direction of the X-axis cutaway"1542 1543 # Y-value slicer...1544 itk_component add yCutButton {1545 Rappture::PushButton $inner.ybutton \1546 -onimage [Rappture::icon y-cutplane] \1547 -offimage [Rappture::icon y-cutplane] \1548 -command [itcl::code $this AdjustSetting -ycutaway] \1549 -variable [itcl::scope _settings(-ycutaway)]1550 }1551 Rappture::Tooltip::for $itk_component(yCutButton) \1552 "Toggle the Y-axis cutaway on/off"1553 1554 itk_component add yCutScale {1555 ::scale $inner.yval -from 100 -to 0 \1556 -width 10 -orient vertical -showvalue yes \1557 -borderwidth 1 -highlightthickness 0 \1558 -command [itcl::code $this Slice move y] \1559 -variable [itcl::scope _settings(-yposition)]1560 } {1561 usual1562 ignore -borderwidth -highlightthickness1563 }1564 Rappture::Tooltip::for $itk_component(yCutScale) \1565 "@[itcl::code $this Slice tooltip y]"1566 # Set the default cutaway value before disabling the scale.1567 $itk_component(yCutScale) set 1001568 $itk_component(yCutScale) configure -state disabled1569 1570 itk_component add yDirButton {1571 Rappture::PushButton $inner.ydir \1572 -onimage [Rappture::icon arrow-down] \1573 -onvalue -1 \1574 -offimage [Rappture::icon arrow-up] \1575 -offvalue 1 \1576 -command [itcl::code $this AdjustSetting -ydirection] \1577 -variable [itcl::scope _settings(-ydirection)]1578 }1579 Rappture::Tooltip::for $itk_component(yDirButton) \1580 "Toggle the direction of the Y-axis cutaway"1581 set _settings(-ydirection) -11582 1583 # Z-value slicer...1584 itk_component add zCutButton {1585 Rappture::PushButton $inner.zbutton \1586 -onimage [Rappture::icon z-cutplane] \1587 -offimage [Rappture::icon z-cutplane] \1588 -command [itcl::code $this AdjustSetting -zcutaway] \1589 -variable [itcl::scope _settings(-zcutaway)]1590 }1591 Rappture::Tooltip::for $itk_component(zCutButton) \1592 "Toggle the Z-axis cutaway on/off"1593 1594 itk_component add zCutScale {1595 ::scale $inner.zval -from 100 -to 0 \1596 -width 10 -orient vertical -showvalue yes \1597 -borderwidth 1 -highlightthickness 0 \1598 -command [itcl::code $this Slice move z] \1599 -variable [itcl::scope _settings(-zposition)]1600 } {1601 usual1602 ignore -borderwidth -highlightthickness1603 }1604 $itk_component(zCutScale) set 1001605 $itk_component(zCutScale) configure -state disabled1606 Rappture::Tooltip::for $itk_component(zCutScale) \1607 "@[itcl::code $this Slice tooltip z]"1608 1609 itk_component add zDirButton {1610 Rappture::PushButton $inner.zdir \1611 -onimage [Rappture::icon arrow-down] \1612 -onvalue -1 \1613 -offimage [Rappture::icon arrow-up] \1614 -offvalue 1 \1615 -command [itcl::code $this AdjustSetting -zdirection] \1616 -variable [itcl::scope _settings(-zdirection)]1617 }1618 set _settings(-zdirection) -11619 Rappture::Tooltip::for $itk_component(zDirButton) \1620 "Toggle the direction of the Z-axis cutaway"1621 1622 blt::table $inner \1623 0,0 $itk_component(xCutButton) -anchor e -padx 2 -pady 2 \1624 1,0 $itk_component(xCutScale) -fill y \1625 0,1 $itk_component(yCutButton) -anchor e -padx 2 -pady 2 \1626 1,1 $itk_component(yCutScale) -fill y \1627 0,2 $itk_component(zCutButton) -anchor e -padx 2 -pady 2 \1628 1,2 $itk_component(zCutScale) -fill y \1629 1630 blt::table configure $inner r* c* -resize none1631 blt::table configure $inner r1 c3 -resize expand1632 1468 } 1633 1469 … … 1792 1628 } 1793 1629 1794 # ----------------------------------------------------------------------1795 # USAGE: Slice move x|y|z <newval>1796 #1797 # Called automatically when the user drags the slider to move the1798 # cut plane that slices 3D data. Gets the current value from the1799 # slider and moves the cut plane to the appropriate point in the1800 # data set.1801 # ----------------------------------------------------------------------1802 itcl::body Rappture::VtkMeshViewer::Slice {option args} {1803 switch -- $option {1804 "move" {1805 set axis [lindex $args 0]1806 set newval [lindex $args 1]1807 if {[llength $args] != 2} {1808 error "wrong # args: should be \"Slice move x|y|z newval\""1809 }1810 set newpos [expr {0.01*$newval}]1811 SendCmd "renderer clipplane $axis $newpos -1"1812 }1813 "tooltip" {1814 set axis [lindex $args 0]1815 set val [$itk_component(${axis}CutScale) get]1816 return "Move the [string toupper $axis] cut plane.\nCurrently: $axis = $val%"1817 }1818 default {1819 error "bad option \"$option\": should be axis, move, or tooltip"1820 }1821 }1822 }1823 1824 1630 itcl::body Rappture::VtkMeshViewer::SetOrientation { side } { 1825 1631 array set positions { … … 1842 1648 set _view(zoom) 1.0 1843 1649 } 1844
Note: See TracChangeset
for help on using the changeset viewer.