Changeset 4689


Ignore:
Timestamp:
Nov 10, 2014, 12:44:00 PM (5 years ago)
Author:
ldelgass
Message:

Axis fixes, removed currently unused clip-plane code

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gui/scripts/vtkmeshviewer.tcl

    r4669 r4689  
    9494    private method SetOrientation { side }
    9595    private method SetPolydataOpacity {}
    96     private method Slice {option args}
    9796
    9897    private variable _arcball ""
     
    187186        -axesvisible            1
    188187        -axislabels             1
     188        -axisminorticks         1
    189189        -outline                0
    190190        -polydataedges          0
     
    193193        -polydatavisible        1
    194194        -polydatawireframe      0
    195         -xcutaway               0
    196         -xdirection             -1
    197195        -xgrid                  0
    198         -xposition              0
    199         -ycutaway               0
    200         -ydirection             -1
    201196        -ygrid                  0
    202         -yposition              0
    203         -zcutaway               0
    204         -zdirection             -1
    205197        -zgrid                  0
    206         -zposition              0
    207198    }
    208199    array set _widget {
     
    285276    BuildPolydataTab
    286277    BuildAxisTab
    287     #BuildCutawayTab
    288278    BuildCameraTab
    289279
     
    835825        $_arcball resize $w $h
    836826        DoResize
    837         InitSettings -xgrid -ygrid -zgrid -axismode -axesvisible -axislabels
     827        InitSettings -xgrid -ygrid -zgrid -axismode \
     828            -axesvisible -axislabels -axisminorticks
    838829        StopBufferingCommands
    839830        SendCmd "imgflush"
     
    903894            -polydatavisible -polydatawireframe
    904895 
    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"
    908897
    909898        set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)]
     
    11951184            SendCmd "axis labels all $bool"
    11961185        }
     1186        "-axisminorticks" {
     1187            set bool $_settings($what)
     1188            SendCmd "axis minticks all $bool"
     1189        }
    11971190        "-xgrid" {
    11981191            set bool $_settings($what)
     
    12111204            set mode [$itk_component(axismode) translate $mode]
    12121205            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 white
    1222                 SendCmd "renderer clipplane $axis $pos $dir"
    1223             } else {
    1224                 $itk_component(${axis}CutScale) configure -state disabled \
    1225                     -troughcolor grey82
    1226                 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"
    12371206        }
    12381207        default {
     
    13861355    set inner [$itk_component(main) insert end \
    13871356        -title "Axis Settings" \
    1388         -icon [Rappture::icon axis1]]
     1357        -icon [Rappture::icon axis2]]
    13891358    $inner configure -borderwidth 4
    13901359
    13911360    checkbutton $inner.visible \
    1392         -text "Show Axes" \
     1361        -text "Axes" \
    13931362        -variable [itcl::scope _settings(-axesvisible)] \
    13941363        -command [itcl::code $this AdjustSetting -axesvisible] \
     
    13961365
    13971366    checkbutton $inner.labels \
    1398         -text "Show Axis Labels" \
     1367        -text "Axis Labels" \
    13991368        -variable [itcl::scope _settings(-axislabels)] \
    14001369        -command [itcl::code $this AdjustSetting -axislabels] \
    14011370        -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" \
    14051374        -variable [itcl::scope _settings(-xgrid)] \
    14061375        -command [itcl::code $this AdjustSetting -xgrid] \
    14071376        -font "Arial 9"
    1408     checkbutton $inner.gridy \
    1409         -text "Show Y Grid" \
     1377    checkbutton $inner.ygrid \
     1378        -text "Y" \
    14101379        -variable [itcl::scope _settings(-ygrid)] \
    14111380        -command [itcl::code $this AdjustSetting -ygrid] \
    14121381        -font "Arial 9"
    1413     checkbutton $inner.gridz \
    1414         -text "Show Z Grid" \
     1382    checkbutton $inner.zgrid \
     1383        -text "Z" \
    14151384        -variable [itcl::scope _settings(-zgrid)] \
    14161385        -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] \
    14171391        -font "Arial 9"
    14181392
     
    14311405
    14321406    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
    14401416
    14411417    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
    14431420}
    14441421
     
    14891466    blt::table configure $inner c2 -resize expand
    14901467    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 4
    1502 
    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         usual
    1522         ignore -borderwidth -highlightthickness
    1523     }
    1524     # Set the default cutaway value before disabling the scale.
    1525     $itk_component(xCutScale) set 100
    1526     $itk_component(xCutScale) configure -state disabled
    1527     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) -1
    1540     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         usual
    1562         ignore -borderwidth -highlightthickness
    1563     }
    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 100
    1568     $itk_component(yCutScale) configure -state disabled
    1569 
    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) -1
    1582 
    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         usual
    1602         ignore -borderwidth -highlightthickness
    1603     }
    1604     $itk_component(zCutScale) set 100
    1605     $itk_component(zCutScale) configure -state disabled
    1606     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) -1
    1619     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 none
    1631     blt::table configure $inner r1 c3 -resize expand
    16321468}
    16331469
     
    17921628}
    17931629
    1794 # ----------------------------------------------------------------------
    1795 # USAGE: Slice move x|y|z <newval>
    1796 #
    1797 # Called automatically when the user drags the slider to move the
    1798 # cut plane that slices 3D data.  Gets the current value from the
    1799 # slider and moves the cut plane to the appropriate point in the
    1800 # 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 
    18241630itcl::body Rappture::VtkMeshViewer::SetOrientation { side } {
    18251631    array set positions {
     
    18421648    set _view(zoom) 1.0
    18431649}
    1844 
Note: See TracChangeset for help on using the changeset viewer.