Ignore:
Timestamp:
Nov 23, 2014 1:12:25 AM (9 years ago)
Author:
ldelgass
Message:

merge r4765 from trunk

Location:
branches/1.3
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/1.3

    • Property svn:mergeinfo changed
      /trunkmerged: 4765
  • branches/1.3/gui/scripts/vtkglyphviewer.tcl

    r4762 r4766  
    6262    public method scale {args}
    6363
    64     protected method Connect {}
    65     protected method CurrentDatasets {args}
    66     protected method Disconnect {}
    67     protected method DoResize {}
    68     protected method DoRotate {}
    69     protected method AdjustSetting {what {value ""}}
    70     protected method InitSettings { args  }
    71     protected method Pan {option x y}
    72     protected method Pick {x y}
    73     protected method Rebuild {}
    74     protected method ReceiveDataset { args }
    75     protected method ReceiveImage { args }
    76     protected method ReceiveLegend { colormap title vmin vmax size }
    77     protected method Rotate {option x y}
    78     protected method Zoom {option}
    79 
    8064    # The following methods are only used by this class.
     65    private method AdjustSetting {what {value ""}}
    8166    private method BuildAxisTab {}
    8267    private method BuildCameraTab {}
     
    8772    private method DrawLegend {}
    8873    private method Combo { option }
     74    private method Connect {}
     75    private method CurrentDatasets {args}
     76    private method Disconnect {}
     77    private method DoResize {}
     78    private method DoRotate {}
    8979    private method EnterLegend { x y }
    9080    private method EventuallyResize { w h }
     
    9484    private method GetImage { args }
    9585    private method GetVtkData { args }
     86    private method InitSettings { args  }
    9687    private method IsValidObject { dataobj }
    9788    private method LeaveLegend {}
    9889    private method MotionLegend { x y }
     90    private method Pan {option x y}
    9991    private method PanCamera {}
     92    private method Pick {x y}
     93    private method QuaternionToView { q } {
     94        foreach { _view(-qw) _view(-qx) _view(-qy) _view(-qz) } $q break
     95    }
     96    private method Rebuild {}
     97    private method ReceiveDataset { args }
     98    private method ReceiveImage { args }
     99    private method ReceiveLegend { colormap title vmin vmax size }
    100100    private method RequestLegend {}
     101    private method Rotate {option x y}
    101102    private method SetLegendTip { x y }
    102103    private method SetObjectStyle { dataobj comp }
     
    104105    private method SetCurrentColormap { color }
    105106    private method SetOrientation { side }
     107    private method ViewToQuaternion {} {
     108        return [list $_view(-qw) $_view(-qx) $_view(-qy) $_view(-qz)]
     109    }
     110    private method Zoom {option}
    106111
    107112    private variable _arcball ""
     
    202207    # Initialize the view to some default parameters.
    203208    array set _view {
    204         qw              0.853553
    205         qx              -0.353553
    206         qy              0.353553
    207         qz              0.146447
    208         zoom            1.0
    209         xpan            0
    210         ypan            0
    211         ortho           0
     209        -ortho           0
     210        -qw              0.853553
     211        -qx              -0.353553
     212        -qy              0.353553
     213        -qz              0.146447
     214        -xpan            0
     215        -ypan            0
     216        -zoom            1.0
    212217    }
    213218    set _arcball [blt::arcball create 100 100]
    214     set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)]
    215     $_arcball quaternion $q
     219    $_arcball quaternion [ViewToQuaternion]
    216220
    217221    array set _settings [subst {
     
    466470
    467471itcl::body Rappture::VtkGlyphViewer::DoRotate {} {
    468     set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)]
    469     SendCmd "camera orient $q"
     472    SendCmd "camera orient [ViewToQuaternion]"
    470473    set _rotatePending 0
    471474}
     
    491494
    492495itcl::body Rappture::VtkGlyphViewer::EventuallyRotate { q } {
    493     foreach { _view(qw) _view(qx) _view(qy) _view(qz) } $q break
     496    QuaternionToView $q
    494497    if { !$_rotatePending } {
    495498        set _rotatePending 1
     
    836839    array unset _data
    837840    array unset _colormaps
    838     array unset _seeds
    839841    array unset _dataset2style
    840842    array unset _obj2datasets
     
    947949        # Reset the camera and other view parameters
    948950        #
    949         set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)]
    950         $_arcball quaternion $q
    951         if {$_view(ortho)} {
     951        $_arcball quaternion [ViewToQuaternion]
     952        if {$_view(-ortho)} {
    952953            SendCmd "camera mode ortho"
    953954        } else {
     
    11301131    switch -- $option {
    11311132        "in" {
    1132             set _view(zoom) [expr {$_view(zoom)*1.25}]
    1133             SendCmd "camera zoom $_view(zoom)"
     1133            set _view(-zoom) [expr {$_view(-zoom)*1.25}]
     1134            SendCmd "camera zoom $_view(-zoom)"
    11341135        }
    11351136        "out" {
    1136             set _view(zoom) [expr {$_view(zoom)*0.8}]
    1137             SendCmd "camera zoom $_view(zoom)"
     1137            set _view(-zoom) [expr {$_view(-zoom)*0.8}]
     1138            SendCmd "camera zoom $_view(-zoom)"
    11381139        }
    11391140        "reset" {
    11401141            array set _view {
    1141                 qw     0.853553
    1142                 qx     -0.353553
    1143                 qy     0.353553
    1144                 qz     0.146447
    1145                 zoom   1.0
    1146                 xpan   0
    1147                 ypan   0
     1142                -qw      0.853553
     1143                -qx      -0.353553
     1144                -qy      0.353553
     1145                -qz      0.146447
     1146                -xpan    0
     1147                -ypan    0
     1148                -zoom    1.0
    11481149            }
    11491150            if { $_first != "" } {
     
    11531154                }
    11541155            }
    1155             set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)]
    1156             $_arcball quaternion $q
     1156            $_arcball quaternion [ViewToQuaternion]
    11571157            DoRotate
    11581158            SendCmd "camera reset"
     
    11621162
    11631163itcl::body Rappture::VtkGlyphViewer::PanCamera {} {
    1164     set x $_view(xpan)
    1165     set y $_view(ypan)
     1164    set x $_view(-xpan)
     1165    set y $_view(-ypan)
    11661166    SendCmd "camera pan $x $y"
    11671167}
     
    12211221itcl::body Rappture::VtkGlyphViewer::Pick {x y} {
    12221222    foreach tag [CurrentDatasets -visible] {
    1223         SendCmdNoSplash "dataset getscalar pixel $x $y $tag"
     1223        SendCmd "dataset getscalar pixel $x $y $tag"
    12241224    }
    12251225}
     
    12401240            set x [expr $x / double($w)]
    12411241            set y [expr $y / double($h)]
    1242             set _view(xpan) [expr $_view(xpan) + $x]
    1243             set _view(ypan) [expr $_view(ypan) + $y]
     1242            set _view(-xpan) [expr $_view(-xpan) + $x]
     1243            set _view(-ypan) [expr $_view(-ypan) + $y]
    12441244            PanCamera
    12451245            return
     
    12631263            set _click(x) $x
    12641264            set _click(y) $y
    1265             set _view(xpan) [expr $_view(xpan) - $dx]
    1266             set _view(ypan) [expr $_view(ypan) - $dy]
     1265            set _view(-xpan) [expr $_view(-xpan) - $dx]
     1266            set _view(-ypan) [expr $_view(-ypan) - $dy]
    12671267            PanCamera
    12681268        }
     
    18561856        label $inner.${tag}label -text $tag -font "Arial 9"
    18571857        entry $inner.${tag} -font "Arial 9"  -bg white \
    1858             -textvariable [itcl::scope _view($tag)]
     1858            -textvariable [itcl::scope _view(-$tag)]
    18591859        bind $inner.${tag} <Return> \
    1860             [itcl::code $this camera set ${tag}]
     1860            [itcl::code $this camera set -${tag}]
    18611861        bind $inner.${tag} <KP_Enter> \
    1862             [itcl::code $this camera set ${tag}]
     1862            [itcl::code $this camera set -${tag}]
    18631863        blt::table $inner \
    18641864            $row,0 $inner.${tag}label -anchor e -pady 2 \
     
    18691869    checkbutton $inner.ortho \
    18701870        -text "Orthographic Projection" \
    1871         -variable [itcl::scope _view(ortho)] \
    1872         -command [itcl::code $this camera set ortho] \
     1871        -variable [itcl::scope _view(-ortho)] \
     1872        -command [itcl::code $this camera set -ortho] \
    18731873        -font "Arial 9"
    18741874    blt::table $inner \
     
    20462046        }
    20472047        "set" {
    2048             set who [lindex $args 0]
    2049             set x $_view($who)
     2048            set what [lindex $args 0]
     2049            set x $_view($what)
    20502050            set code [catch { string is double $x } result]
    20512051            if { $code != 0 || !$result } {
    20522052                return
    20532053            }
    2054             switch -- $who {
    2055                 "ortho" {
    2056                     if {$_view(ortho)} {
     2054            switch -- $what {
     2055                "-ortho" {
     2056                    if {$_view($what)} {
    20572057                        SendCmd "camera mode ortho"
    20582058                    } else {
     
    20602060                    }
    20612061                }
    2062                 "xpan" - "ypan" {
     2062                "-xpan" - "-ypan" {
    20632063                    PanCamera
    20642064                }
    2065                 "qx" - "qy" - "qz" - "qw" {
    2066                     set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)]
     2065                "-qx" - "-qy" - "-qz" - "-qw" {
     2066                    set q [ViewToQuaternion]
    20672067                    $_arcball quaternion $q
    20682068                    EventuallyRotate $q
    20692069                }
    2070                 "zoom" {
    2071                     SendCmd "camera zoom $_view(zoom)"
     2070                "-zoom" {
     2071                    SendCmd "camera zoom $_view($what)"
    20722072                }
    20732073             }
     
    25512551        bottom "0.707107 0.707107 0 0"
    25522552    }
    2553     foreach name { qw qx qy qz } value $positions($side) {
     2553    foreach name { -qw -qx -qy -qz } value $positions($side) {
    25542554        set _view($name) $value
    2555     } 
    2556     set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)]
     2555    }
     2556    set q [ViewToQuaternion]
    25572557    $_arcball quaternion $q
    25582558    SendCmd "camera orient $q"
    25592559    SendCmd "camera reset"
    2560     set _view(xpan) 0
    2561     set _view(ypan) 0
    2562     set _view(zoom) 1.0
    2563 }
     2560    set _view(-xpan) 0
     2561    set _view(-ypan) 0
     2562    set _view(-zoom) 1.0
     2563}
Note: See TracChangeset for help on using the changeset viewer.