Changeset 3517 for trunk/gui


Ignore:
Timestamp:
Mar 17, 2013, 9:46:35 AM (12 years ago)
Author:
gah
Message:

add controls for orthogonal viewpoints

Location:
trunk/gui/scripts
Files:
8 added
6 edited

Legend:

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

    r3498 r3517  
    118118    private method volume { tag name }
    119119    private method GetVolumeInfo { w }
    120     private method SetOrientation {}
     120    private method SetOrientation { side }
    121121
    122122    private variable _arcball ""
     
    200200        qz      0.146447
    201201        zoom    1.0
    202         pan-x   0
    203         pan-y   0
     202        xpan   0
     203        ypan   0
    204204    }
    205205    set _arcball [blt::arcball create 100 100]
     
    217217        $this-qz                $_view(qz)
    218218        $this-zoom              $_view(zoom)   
    219         $this-pan-x             $_view(pan-x)
    220         $this-pan-y             $_view(pan-y)
     219        $this-xpan             $_view(xpan)
     220        $this-ypan             $_view(ypan)
    221221        $this-volume            1
    222222        $this-xcutplane         0
     
    924924        set _settings($this-qy)    $_view(qy)
    925925        set _settings($this-qz)    $_view(qz)
    926         set _settings($this-pan-x) $_view(pan-x)
    927         set _settings($this-pan-y) $_view(pan-y)
     926        set _settings($this-xpan) $_view(xpan)
     927        set _settings($this-ypan) $_view(ypan)
    928928        set _settings($this-zoom)  $_view(zoom)
    929929
     
    10291029                qz      0.146447
    10301030                zoom    1.0
    1031                 pan-x   0
    1032                 pan-y   0
     1031                xpan   0
     1032                ypan   0
    10331033            }
    10341034            if { $_first != "" } {
     
    10461046            set _settings($this-qy)    $_view(qy)
    10471047            set _settings($this-qz)    $_view(qz)
    1048             set _settings($this-pan-x) $_view(pan-x)
    1049             set _settings($this-pan-y) $_view(pan-y)
     1048            set _settings($this-xpan) $_view(xpan)
     1049            set _settings($this-ypan) $_view(ypan)
    10501050            set _settings($this-zoom)  $_view(zoom)
    10511051            $itk_component(orientation) value "default"
     
    10551055
    10561056itcl::body Rappture::NanovisViewer::PanCamera {} {
    1057     #set x [expr ($_view(pan-x)) / $_limits(xrange)]
    1058     #set y [expr ($_view(pan-y)) / $_limits(yrange)]
    1059     set x $_view(pan-x)
    1060     set y $_view(pan-y)
     1057    #set x [expr ($_view(xpan)) / $_limits(xrange)]
     1058    #set y [expr ($_view(ypan)) / $_limits(yrange)]
     1059    set x $_view(xpan)
     1060    set y $_view(ypan)
    10611061    SendCmd "camera pan $x $y"
    10621062}
     
    11341134        set x [expr $x / double($w)]
    11351135        set y [expr $y / double($h)]
    1136         set _view(pan-x) [expr $_view(pan-x) + $x]
    1137         set _view(pan-y) [expr $_view(pan-y) + $y]
     1136        set _view(xpan) [expr $_view(xpan) + $x]
     1137        set _view(ypan) [expr $_view(ypan) + $y]
    11381138        PanCamera
    1139         set _settings($this-pan-x) $_view(pan-x)
    1140         set _settings($this-pan-y) $_view(pan-y)
     1139        set _settings($this-xpan) $_view(xpan)
     1140        set _settings($this-ypan) $_view(ypan)
    11411141        return
    11421142    }
     
    11511151        set _click(x) $x
    11521152        set _click(y) $y
    1153         set _view(pan-x) [expr $_view(pan-x) - $dx]
    1154         set _view(pan-y) [expr $_view(pan-y) - $dy]
     1153        set _view(xpan) [expr $_view(xpan) - $dx]
     1154        set _view(ypan) [expr $_view(ypan) - $dy]
    11551155        PanCamera
    1156         set _settings($this-pan-x) $_view(pan-x)
    1157         set _settings($this-pan-y) $_view(pan-y)
     1156        set _settings($this-xpan) $_view(xpan)
     1157        set _settings($this-ypan) $_view(ypan)
    11581158    }
    11591159    if { $option == "release" } {
     
    19101910    $inner configure -borderwidth 4
    19111911
    1912     set row 0
    1913     label $inner.orientation_l -text "View" -font "Arial 9"
    1914     itk_component add orientation {
    1915         Rappture::Combobox $inner.orientation -width 10 -editable no
    1916     }
    1917     $inner.orientation choices insert end \
    1918         "1 0 0 0" "front" \
    1919         "0 0 1 0" "back" \
    1920         "0.707107 -0.707107 0 0" "top" \
    1921         "0.707107 0.707107 0 0" "bottom" \
    1922         "0.707107 0 -0.707107 0" "left" \
    1923         "0.707107 0 0.707107 0" "right" \
    1924         "0.853553 -0.353553 0.353553 0.146447" "default"
    1925     $itk_component(orientation) value "default"
    1926     bind $inner.orientation <<Value>> [itcl::code $this SetOrientation]
    1927     if 1 {
     1912    label $inner.view_l -text "view" -font "Arial 9"
     1913    set f [frame $inner.view]
     1914    foreach side { front back left right top bottom } {
     1915        button $f.$side  -image [Rappture::icon view$side] \
     1916            -command [itcl::code $this SetOrientation $side]
     1917        Rappture::Tooltip::for $f.$side "Change the view to $side"
     1918        pack $f.$side -side left
     1919    }
     1920
    19281921    blt::table $inner \
    1929             $row,0 $inner.orientation_l -anchor e -pady 2 \
    1930             $row,1 $inner.orientation -anchor w -pady 2 -fill x
    1931     blt::table configure $inner r$row -resize none
    1932     incr row
    1933     }
    1934 
    1935     set labels { qw qx qy qz pan-x pan-y zoom }
     1922            0,0 $inner.view_l -anchor e -pady 2 \
     1923            0,1 $inner.view -anchor w -pady 2
     1924
     1925    set row 1
     1926    set labels { qw qx qy qz xpan ypan zoom }
    19361927    foreach tag $labels {
    19371928        label $inner.${tag}label -text $tag -font "Arial 9"
     
    19491940    }
    19501941
    1951     blt::table configure $inner c0 c1 -resize none
     1942    blt::table configure $inner c* r* -resize none
    19521943    blt::table configure $inner c2 -resize expand
    19531944    blt::table configure $inner r$row -resize expand
     
    20362027            }
    20372028            switch -- $who {
    2038                 "pan-x" - "pan-y" {
     2029                "xpan" - "ypan" {
    20392030                    set _view($who) $_settings($this-$who)
    20402031                    PanCamera
     
    21142105}
    21152106
    2116 itcl::body Rappture::NanovisViewer::SetOrientation {} {
    2117     set quat [$itk_component(orientation) value]
    2118     set quat [$itk_component(orientation) translate $quat]
    2119     foreach name { qw qx qy qz } comp $quat {
    2120         set _view($name) $comp
    2121         set _settings($this-$name) $comp
     2107itcl::body Rappture::NanovisViewer::SetOrientation { side } {
     2108    array set positions {
     2109        front "1 0 0 0"
     2110        back  "0 0 1 0"
     2111        left  "0.707107 0 -0.707107 0"
     2112        right "0.707107 0 0.707107 0"
     2113        top   "0.707107 -0.707107 0 0"
     2114        bottom "0.707107 0.707107 0 0"
     2115    }
     2116    foreach name { qw qx qy qz } value $positions($side) {
     2117        set _view($name) $value
    21222118    }
    21232119    set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)]
    21242120    $_arcball quaternion $q
    21252121    SendCmd "camera orient $q"
    2126     SendCmd "camera reset"
    2127     set $_view(pan-x) 0.0
    2128     set $_view(pan-y) 0.0
    2129     set $_view(zoom) 1.0
    2130     set _settings($this-pan-x) $_view(pan-x)
    2131     set _settings($this-pan-y) $_view(pan-y)
    2132     set _settings($this-zoom)  $_view(zoom)
    2133 }
     2122}
     2123
  • trunk/gui/scripts/visviewer.tcl

    r3514 r3517  
    857857        $inner.scrl.text delete 0.0 end
    858858       
     859        $inner.scrl.text configure -state normal
    859860        $inner.scrl.text insert end "The following error was reported by the render server:\n\n" bold
    860861        $inner.scrl.text insert end $bytes code
     862        $inner.scrl.text configure -state disabled
    861863        update
    862864        $popup activate $itk_component(hull) below
  • trunk/gui/scripts/vtkheightmapviewer.tcl

    r3514 r3517  
    106106    private method GetHeightmapScale {}
    107107    private method ResetAxes {}
     108    private method SetOrientation { side }
    108109
    109110    private variable _arcball ""
     
    17661767    set inner [$itk_component(main) insert end \
    17671768        -title "Contour/Surface Settings" \
    1768         -icon [Rappture::icon contour]]
     1769        -icon [Rappture::icon contour2]]
    17691770    $inner configure -borderwidth 4
    17701771
     
    19581959    set inner [$itk_component(main) insert end \
    19591960        -title "Axis Settings" \
    1960         -icon [Rappture::icon axis1]]
     1961        -icon [Rappture::icon axis2]]
    19611962    $inner configure -borderwidth 4
    19621963
     
    20302031    $inner configure -borderwidth 4
    20312032
     2033    label $inner.view_l -text "view" -font "Arial 9"
     2034    set f [frame $inner.view]
     2035    foreach side { front back left right top bottom } {
     2036        button $f.$side  -image [Rappture::icon view$side] \
     2037            -command [itcl::code $this SetOrientation $side]
     2038        Rappture::Tooltip::for $f.$side "Change the view to $side"
     2039        pack $f.$side -side left
     2040    }
     2041
     2042    blt::table $inner \
     2043            0,0 $inner.view_l -anchor e -pady 2 \
     2044            0,1 $inner.view -anchor w -pady 2
     2045
    20322046    set labels { qx qy qz qw xpan ypan zoom }
    2033     set row 0
     2047    set row 1
    20342048    foreach tag $labels {
    20352049        label $inner.${tag}label -text $tag -font "Arial 9"
     
    20562070    incr row
    20572071
    2058     blt::table configure $inner c0 c1 -resize none
     2072    blt::table configure $inner c* r* -resize none
    20592073    blt::table configure $inner c2 -resize expand
    20602074    blt::table configure $inner r$row -resize expand
     
    25132527}
    25142528
    2515 
    2516 
    2517 
     2529itcl::body Rappture::VtkHeightmapViewer::SetOrientation { side } {
     2530    array set positions {
     2531        front "1 0 0 0"
     2532        back  "0 0 1 0"
     2533        left  "0.707107 0 -0.707107 0"
     2534        right "0.707107 0 0.707107 0"
     2535        top   "0.707107 -0.707107 0 0"
     2536        bottom "0.707107 0.707107 0 0"
     2537    }
     2538    foreach name { qw qx qy qz } value $positions($side) {
     2539        set _view($name) $value
     2540    }
     2541    set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)]
     2542    $_arcball quaternion $q
     2543    SendCmd "camera orient $q"
     2544}
     2545
     2546
     2547
     2548
  • trunk/gui/scripts/vtkisosurfaceviewer.tcl

    r3515 r3517  
    105105    private method Slice {option args}
    106106    private method SetCurrentColormap { color }
     107    private method SetOrientation { side }
    107108
    108109    private variable _arcball ""
     
    232233        cutplaneEdges           0
    233234        cutplaneLighting        1
     235        cutplanePreinterp       0
    234236        cutplaneOpacity         100
    235237        cutplaneVisible         0
     
    10521054            isosurfaceWireframe isosurfaceOutline \
    10531055            cutplaneXPosition cutplaneYPosition cutplaneZPosition \
    1054             cutplaneXVisible cutplaneYVisible cutplaneZVisible
     1056            cutplaneXVisible cutplaneYVisible cutplaneZVisible \
     1057            cutplanePreinterp
    10551058
    10561059        Zoom reset
     
    13721375            SendCmd "cutplane opacity $sval"
    13731376        }
     1377        "cutplanePreinterp" {
     1378            set bool $_settings($what)
     1379            SendCmd "cutplane preinterp $bool"
     1380        }
    13741381        "cutplaneXVisible" - "cutplaneYVisible" - "cutplaneZVisible" {
    13751382            set axis [string tolower [string range $what 8 8]]
     
    17391746    set inner [$itk_component(main) insert end \
    17401747        -title "Axis Settings" \
    1741         -icon [Rappture::icon axis1]]
     1748        -icon [Rappture::icon axis2]]
    17421749    $inner configure -borderwidth 4
    17431750
     
    18031810    $inner configure -borderwidth 4
    18041811
     1812    label $inner.view_l -text "view" -font "Arial 9"
     1813    set f [frame $inner.view]
     1814    foreach side { front back left right top bottom } {
     1815        button $f.$side  -image [Rappture::icon view$side] \
     1816            -command [itcl::code $this SetOrientation $side]
     1817        Rappture::Tooltip::for $f.$side "Change the view to $side"
     1818        pack $f.$side -side left
     1819    }
     1820
     1821    blt::table $inner \
     1822            0,0 $inner.view_l -anchor e -pady 2 \
     1823            0,1 $inner.view -anchor w -pady 2
     1824
    18051825    set labels { qx qy qz qw xpan ypan zoom }
    1806     set row 0
     1826    set row 1
    18071827    foreach tag $labels {
    18081828        label $inner.${tag}label -text $tag -font "Arial 9"
     
    18271847    incr row
    18281848
    1829     blt::table configure $inner c0 c1 -resize none
     1849    blt::table configure $inner c* r* -resize none
    18301850    blt::table configure $inner c2 -resize expand
    18311851    blt::table configure $inner r$row -resize expand
     
    18641884        -variable [itcl::scope _settings(cutplaneEdges)] \
    18651885        -command [itcl::code $this AdjustSetting cutplaneEdges] \
     1886        -font "Arial 9"
     1887
     1888    checkbutton $inner.preinterp \
     1889        -text "Interpolate" \
     1890        -variable [itcl::scope _settings(cutplanePreinterp)] \
     1891        -command [itcl::code $this AdjustSetting cutplanePreinterp] \
    18661892        -font "Arial 9"
    18671893
     
    19671993        2,0 $inner.wireframe            -anchor w -pady 2 -cspan 3 \
    19681994        3,0 $inner.edges                -anchor w -pady 2 -cspan 3 \
    1969         4,0 $inner.opacity_l            -anchor w -pady 2 -cspan 1 \
    1970         4,1 $inner.opacity              -fill x   -pady 2 -cspan 3 \
     1995        4,0 $inner.preinterp            -anchor w -pady 2 -cspan 3 \
     1996        5,0 $inner.opacity_l            -anchor w -pady 2 -cspan 1 \
     1997        5,1 $inner.opacity              -fill x   -pady 2 -cspan 3 \
    19711998        6,0 $inner.xbutton              -anchor w -padx 2 -pady 2 \
    19721999        7,0 $inner.ybutton              -anchor w -padx 2 -pady 2 \
     
    19792006    blt::table configure $inner r* c* -resize none
    19802007    blt::table configure $inner r9 c4 -resize expand
    1981     blt::table configure $inner r5 -height 0.12i
    19822008}
    19832009
     
    25092535}
    25102536
    2511 
    2512 
     2537itcl::body Rappture::VtkIsosurfaceViewer::SetOrientation { side } {
     2538    array set positions {
     2539        front "1 0 0 0"
     2540        back  "0 0 1 0"
     2541        left  "0.707107 0 -0.707107 0"
     2542        right "0.707107 0 0.707107 0"
     2543        top   "0.707107 -0.707107 0 0"
     2544        bottom "0.707107 0.707107 0 0"
     2545    }
     2546    foreach name { qw qx qy qz } value $positions($side) {
     2547        set _view($name) $value
     2548    }
     2549    set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)]
     2550    $_arcball quaternion $q
     2551    SendCmd "camera orient $q"
     2552}
  • trunk/gui/scripts/vtkstreamlinesviewer.tcl

    r3482 r3517  
    107107    private method SetObjectStyle { dataobj comp }
    108108    private method Slice {option args}
     109    private method SetOrientation { side }
    109110
    110111    private variable _arcball ""
     
    18681869    $inner configure -borderwidth 4
    18691870
     1871    label $inner.view_l -text "view" -font "Arial 9"
     1872    set f [frame $inner.view]
     1873    foreach side { front back left right top bottom } {
     1874        button $f.$side  -image [Rappture::icon view$side] \
     1875            -command [itcl::code $this SetOrientation $side]
     1876        Rappture::Tooltip::for $f.$side "Change the view to $side"
     1877        pack $f.$side -side left
     1878    }
     1879
     1880    blt::table $inner \
     1881            0,0 $inner.view_l -anchor e -pady 2 \
     1882            0,1 $inner.view -anchor w -pady 2
     1883
    18701884    set labels { qx qy qz qw xpan ypan zoom }
    1871     set row 0
     1885    set row 1
    18721886    foreach tag $labels {
    18731887        label $inner.${tag}label -text $tag -font "Arial 9"
     
    18921906    incr row
    18931907
    1894     blt::table configure $inner c0 c1 -resize none
     1908    blt::table configure $inner c* r* -resize none
    18951909    blt::table configure $inner c2 -resize expand
    18961910    blt::table configure $inner r$row -resize expand
     
    24482462}
    24492463
     2464itcl::body Rappture::VtkStreamlinesViewer::SetOrientation { side } {
     2465    array set positions {
     2466        front "1 0 0 0"
     2467        back  "0 0 1 0"
     2468        left  "0.707107 0 -0.707107 0"
     2469        right "0.707107 0 0.707107 0"
     2470        top   "0.707107 -0.707107 0 0"
     2471        bottom "0.707107 0.707107 0 0"
     2472    }
     2473    foreach name { qw qx qy qz } value $positions($side) {
     2474        set _view($name) $value
     2475    }
     2476    set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)]
     2477    $_arcball quaternion $q
     2478    SendCmd "camera orient $q"
     2479}
     2480
  • trunk/gui/scripts/vtkviewer.tcl

    r3454 r3517  
    18091809    $inner configure -borderwidth 4
    18101810
     1811    label $inner.view_l -text "view" -font "Arial 9"
     1812    set f [frame $inner.view]
     1813    foreach side { front back left right top bottom } {
     1814        button $f.$side  -image [Rappture::icon view$side] \
     1815            -command [itcl::code $this SetOrientation $side]
     1816        Rappture::Tooltip::for $f.$side "Change the view to $side"
     1817        pack $f.$side -side left
     1818    }
     1819
     1820    blt::table $inner \
     1821            0,0 $inner.view_l -anchor e -pady 2 \
     1822            0,1 $inner.view -anchor w -pady 2
     1823
    18111824    set labels { qx qy qz qw xpan ypan zoom }
    1812     set row 0
     1825    set row 1
    18131826    foreach tag $labels {
    18141827        label $inner.${tag}label -text $tag -font "Arial 9"
     
    18331846    incr row
    18341847
    1835     blt::table configure $inner c0 c1 -resize none
     1848    blt::table configure $inner c* r* -resize none
    18361849    blt::table configure $inner c2 -resize expand
    18371850    blt::table configure $inner r$row -resize expand
     
    24722485}
    24732486
     2487itcl::body Rappture::VtkViewer::SetOrientation { side } {
     2488    array set positions {
     2489        front "1 0 0 0"
     2490        back  "0 0 1 0"
     2491        left  "0.707107 0 -0.707107 0"
     2492        right "0.707107 0 0.707107 0"
     2493        top   "0.707107 -0.707107 0 0"
     2494        bottom "0.707107 0.707107 0 0"
     2495    }
     2496    foreach name { qw qx qy qz } value $positions($side) {
     2497        set _view($name) $value
     2498    }
     2499    set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)]
     2500    $_arcball quaternion $q
     2501    SendCmd "camera orient $q"
     2502}
     2503
Note: See TracChangeset for help on using the changeset viewer.