Ignore:
Timestamp:
Nov 23, 2014, 1:12:25 AM (10 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/flowvisviewer.tcl

    r4759 r4766  
    4343    itk_option define -plotbackground plotBackground Background ""
    4444    itk_option define -plotoutline plotOutline PlotOutline ""
    45 
    46     private variable _volcomponents   ; # Array of components found
    47     private variable _componentsList   ; # Array of components found
    48     private method BuildVolumeComponents {}
    49     private method GetDatasetsWithComponent { cname }
    5045
    5146    constructor { hostlist args } {
     
    7772    public method updateTransferFunctions {}
    7873
    79     protected method Connect {}
    80     protected method CurrentVolumeIds {{what -all}}
    81     protected method Disconnect {}
    82     protected method Resize {}
    83     protected method ResizeLegend {}
    84     protected method AdjustSetting {what {value ""}}
    85     protected method InitSettings { args }
    86     protected method Pan {option x y}
    87     protected method Rebuild {}
    88     protected method ReceiveData { args }
    89     protected method ReceiveImage { args }
    90     protected method ReceiveLegend { tf vmin vmax size }
    91     protected method Rotate {option x y}
    92     protected method SendTransferFuncs {}
    93     protected method Slice {option args}
    94     protected method SlicerTip {axis}
    95     protected method Zoom {option}
    96 
    9774    # soon to be removed.
    98     protected method Flow {option args}
    99     protected method Play {}
    100     protected method Pause {}
    101 
     75    private method Flow {option args}
     76    private method Play {}
     77    private method Pause {}
    10278
    10379    # The following methods are only used by this class.
    104 
     80    private method AdjustSetting {what {value ""}}
    10581    private method AddIsoMarker { x y }
    10682    private method BuildCameraTab {}
    10783    private method BuildCutplanesTab {}
    10884    private method BuildViewTab {}
     85    private method BuildVolumeComponents {}
    10986    private method BuildVolumeTab {}
    11087    private method ComputeTransferFunc { tf }
     88    private method Connect {}
     89    private method CurrentVolumeIds {{what -all}}
     90    private method Disconnect {}
    11191    private method EventuallyResize { w h }
    11292    private method EventuallyGoto { nSteps }
    11393    private method EventuallyResizeLegend { }
    11494    private method FlowCmd { dataobj comp nbytes extents }
     95    private method GetDatasetsWithComponent { cname }
     96    private method GetFlowInfo { widget }
    11597    private method GetMovie { widget width height }
    11698    private method GetPngImage { widget width height }
     99    private method InitSettings { args }
    117100    private method NameTransferFunc { dataobj comp }
     101    private method Pan {option x y}
    118102    private method PanCamera {}
    119103    private method ParseLevelsOption { tf levels }
    120104    private method ParseMarkersOption { tf markers }
     105    private method QuaternionToView { q } {
     106        foreach { _view(-qw) _view(-qx) _view(-qy) _view(-qz) } $q break
     107    }
     108    private method Rebuild {}
     109    private method ReceiveData { args }
     110    private method ReceiveImage { args }
     111    private method ReceiveLegend { tf vmin vmax size }
     112    private method Resize {}
     113    private method ResizeLegend {}
     114    private method Rotate {option x y}
     115    private method SendTransferFuncs {}
     116    private method SetOrientation { side }
     117    private method Slice {option args}
     118    private method SlicerTip {axis}
     119    private method ViewToQuaternion {} {
     120        return [list $_view(-qw) $_view(-qx) $_view(-qy) $_view(-qz)]
     121    }
    121122    private method WaitIcon { option widget }
     123    private method Zoom {option}
     124    private method arrows { tag name }
     125    private method box { tag name }
     126    private method millisecs2str { value }
     127    private method particles { tag name }
    122128    private method str2millisecs { value }
    123     private method millisecs2str { value }
    124     private method GetFlowInfo { widget }
    125     private method particles { tag name }
    126     private method box { tag name }
    127129    private method streams { tag name }
    128     private method arrows { tag name }
    129     private method SetOrientation { side }
    130130
    131131    private variable _arcball ""
     
    149149    private variable _activeTf ""  ;# The currently active transfer function.
    150150    private variable _first ""     ;# This is the topmost volume.
     151    private variable _volcomponents   ; # Array of components found
     152    private variable _componentsList   ; # Array of components found
    151153    private variable _nextToken 0
    152154    private variable _icon 0
     
    218220    # Initialize the view to some default parameters.
    219221    array set _view {
    220         qw      0.853553
    221         qx      -0.353553
    222         qy      0.353553
    223         qz      0.146447
    224         zoom    1.0
    225         xpan    0
    226         ypan    0
     222        -qw      0.853553
     223        -qx      -0.353553
     224        -qy      0.353553
     225        -qz      0.146447
     226        -xpan    0
     227        -ypan    0
     228        -zoom    1.0
    227229    }
    228230    set _arcball [blt::arcball create 100 100]
    229     set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)]
    230     $_arcball quaternion $q
     231    $_arcball quaternion [ViewToQuaternion]
    231232
    232233    set _limits(v) [list 0.0 1.0]
     
    234235
    235236    array set _settings [subst {
    236         $this-qw                $_view(qw)
    237         $this-qx                $_view(qx)
    238         $this-qy                $_view(qy)
    239         $this-qz                $_view(qz)
    240         $this-zoom              $_view(zoom)   
    241         $this-xpan              $_view(xpan)
    242         $this-ypan              $_view(ypan)
     237        $this-qw                $_view(-qw)
     238        $this-qx                $_view(-qx)
     239        $this-qy                $_view(-qy)
     240        $this-qz                $_view(-qz)
     241        $this-zoom              $_view(-zoom)   
     242        $this-xpan              $_view(-xpan)
     243        $this-ypan              $_view(-ypan)
    243244        $this-arrows            0
    244245        $this-currenttime       0
     
    11911192
    11921193    }
    1193     set _settings($this-qw)    $_view(qw)
    1194     set _settings($this-qx)    $_view(qx)
    1195     set _settings($this-qy)    $_view(qy)
    1196     set _settings($this-qz)    $_view(qz)
    1197     set _settings($this-xpan)  $_view(xpan)
    1198     set _settings($this-ypan)  $_view(ypan)
    1199     set _settings($this-zoom)  $_view(zoom)
    1200 
    1201     set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)]
     1194    set _settings($this-qw)    $_view(-qw)
     1195    set _settings($this-qx)    $_view(-qx)
     1196    set _settings($this-qy)    $_view(-qy)
     1197    set _settings($this-qz)    $_view(-qz)
     1198    set _settings($this-xpan)  $_view(-xpan)
     1199    set _settings($this-ypan)  $_view(-ypan)
     1200    set _settings($this-zoom)  $_view(-zoom)
     1201
     1202    set q [ViewToQuaternion]
    12021203    $_arcball quaternion $q
    12031204    SendCmd "camera orient $q"
    12041205    SendCmd "camera reset"
    12051206    PanCamera
    1206     SendCmd "camera zoom $_view(zoom)"
     1207    SendCmd "camera zoom $_view(-zoom)"
    12071208
    12081209    foreach dataobj [get] {
     
    12841285    switch -- $option {
    12851286        "in" {
    1286             set _view(zoom) [expr {$_view(zoom)*1.25}]
    1287             set _settings($this-zoom) $_view(zoom)
    1288             SendCmd "camera zoom $_view(zoom)"
     1287            set _view(-zoom) [expr {$_view(-zoom)*1.25}]
     1288            set _settings($this-zoom) $_view(-zoom)
     1289            SendCmd "camera zoom $_view(-zoom)"
    12891290        }
    12901291        "out" {
    1291             set _view(zoom) [expr {$_view(zoom)*0.8}]
    1292             set _settings($this-zoom) $_view(zoom)
    1293             SendCmd "camera zoom $_view(zoom)"
     1292            set _view(-zoom) [expr {$_view(-zoom)*0.8}]
     1293            set _settings($this-zoom) $_view(-zoom)
     1294            SendCmd "camera zoom $_view(-zoom)"
    12941295        }
    12951296        "reset" {
    12961297            array set _view {
    1297                 qw      0.853553
    1298                 qx      -0.353553
    1299                 qy      0.353553
    1300                 qz      0.146447
    1301                 zoom    1.0
    1302                 xpan   0
    1303                 ypan   0
     1298                -qw      0.853553
     1299                -qx      -0.353553
     1300                -qy      0.353553
     1301                -qz      0.146447
     1302                -zoom    1.0
     1303                -xpan    0
     1304                -ypan    0
    13041305            }
    13051306            if { $_first != "" } {
     
    13091310                }
    13101311            }
    1311             set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)]
     1312            set q [ViewToQuaternion]
    13121313            $_arcball quaternion $q
    13131314            SendCmd "camera orient $q"
    13141315            SendCmd "camera reset"
    1315             set _settings($this-qw)    $_view(qw)
    1316             set _settings($this-qx)    $_view(qx)
    1317             set _settings($this-qy)    $_view(qy)
    1318             set _settings($this-qz)    $_view(qz)
    1319             set _settings($this-xpan)  $_view(xpan)
    1320             set _settings($this-ypan)  $_view(ypan)
    1321             set _settings($this-zoom)  $_view(zoom)
     1316            set _settings($this-qw)    $_view(-qw)
     1317            set _settings($this-qx)    $_view(-qx)
     1318            set _settings($this-qy)    $_view(-qy)
     1319            set _settings($this-qz)    $_view(-qz)
     1320            set _settings($this-xpan)  $_view(-xpan)
     1321            set _settings($this-ypan)  $_view(-ypan)
     1322            set _settings($this-zoom)  $_view(-zoom)
    13221323        }
    13231324    }
     
    13251326
    13261327itcl::body Rappture::FlowvisViewer::PanCamera {} {
    1327     set x $_view(xpan)
    1328     set y $_view(ypan)
     1328    set x $_view(-xpan)
     1329    set y $_view(-ypan)
    13291330    SendCmd "camera pan $x $y"
    13301331}
     
    13641365
    13651366                set q [$_arcball rotate $x $y $_click(x) $_click(y)]
    1366                 foreach { _view(qw) _view(qx) _view(qy) _view(qz) } $q break
    1367                 set _settings($this-qw) $_view(qw)
    1368                 set _settings($this-qx) $_view(qx)
    1369                 set _settings($this-qy) $_view(qy)
    1370                 set _settings($this-qz) $_view(qz)
     1367                QuaternionToView $q
     1368                set _settings($this-qw) $_view(-qw)
     1369                set _settings($this-qx) $_view(-qx)
     1370                set _settings($this-qy) $_view(-qy)
     1371                set _settings($this-qz) $_view(-qz)
    13711372                SendCmd "camera orient $q"
    13721373
     
    14011402        set x [expr $x / double($w)]
    14021403        set y [expr $y / double($h)]
    1403         set _view(xpan) [expr $_view(xpan) + $x]
    1404         set _view(ypan) [expr $_view(ypan) + $y]
     1404        set _view(-xpan) [expr $_view(-xpan) + $x]
     1405        set _view(-ypan) [expr $_view(-ypan) + $y]
    14051406        PanCamera
    1406         set _settings($this-xpan) $_view(xpan)
    1407         set _settings($this-ypan) $_view(ypan)
     1407        set _settings($this-xpan) $_view(-xpan)
     1408        set _settings($this-ypan) $_view(-ypan)
    14081409        return
    14091410    }
     
    14181419        set _click(x) $x
    14191420        set _click(y) $y
    1420         set _view(xpan) [expr $_view(xpan) - $dx]
    1421         set _view(ypan) [expr $_view(ypan) - $dy]
     1421        set _view(-xpan) [expr $_view(-xpan) - $dx]
     1422        set _view(-ypan) [expr $_view(-ypan) - $dy]
    14221423        PanCamera
    1423         set _settings($this-xpan) $_view(xpan)
    1424         set _settings($this-ypan) $_view(ypan)
     1424        set _settings($this-xpan) $_view(-xpan)
     1425        set _settings($this-ypan) $_view(-ypan)
    14251426    }
    14261427    if { $option == "release" } {
     
    23092310            -textvariable [itcl::scope _settings($this-$tag)]
    23102311        bind $inner.${tag} <Return> \
    2311             [itcl::code $this camera set ${tag}]
     2312            [itcl::code $this camera set -${tag}]
    23122313        bind $inner.${tag} <KP_Enter> \
    2313             [itcl::code $this camera set ${tag}]
     2314            [itcl::code $this camera set -${tag}]
    23142315        blt::table $inner \
    23152316            $row,0 $inner.${tag}label -anchor e -pady 2 \
     
    25132514        }
    25142515        "set" {
    2515             set who [lindex $args 0]
    2516             set x $_settings($this-$who)
     2516            set what [lindex $args 0]
     2517            set x $_settings(${this}${what})
    25172518            set code [catch { string is double $x } result]
    25182519            if { $code != 0 || !$result } {
    2519                 set _settings($this-$who) $_view($who)
     2520                set _settings(${this}${what}) $_view($what)
    25202521                return
    25212522            }
    2522             switch -- $who {
    2523                 "xpan" - "ypan" {
    2524                     set _view($who) $_settings($this-$who)
     2523            switch -- $what {
     2524                "-xpan" - "-ypan" {
     2525                    set _view($what) $_settings(${this}${what})
    25252526                    PanCamera
    25262527                }
    2527                 "qx" - "qy" - "qz" - "qw" {
    2528                     set _view($who) $_settings($this-$who)
    2529                     set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)]
     2528                "-qx" - "-qy" - "-qz" - "-qw" {
     2529                    set _view($what) $_settings(${this}${what})
     2530                    set q [ViewToQuaternion]
    25302531                    $_arcball quaternion $q
    25312532                    SendCmd "camera orient $q"
    25322533                }
    2533                 "zoom" {
    2534                     set _view($who) $_settings($this-$who)
    2535                     SendCmd "camera zoom $_view(zoom)"
     2534                "-zoom" {
     2535                    set _view($what) $_settings(${this}${what})
     2536                    SendCmd "camera zoom $_view($what)"
    25362537                }
    25372538            }
     
    29112912        bottom "0.707107 0.707107 0 0"
    29122913    }
    2913     foreach name { qw qx qy qz } value $positions($side) {
     2914    foreach name { -qw -qx -qy -qz } value $positions($side) {
    29142915        set _view($name) $value
    29152916    }
    2916     set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)]
     2917    set q [ViewToQuaternion]
    29172918    $_arcball quaternion $q
    29182919    SendCmd "camera orient $q"
    29192920    SendCmd "camera reset"
    2920     set _view(xpan) 0.0
    2921     set _view(ypan) 0.0
    2922     set _view(zoom) 1.0
    2923     set _settings($this-xpan) $_view(xpan)
    2924     set _settings($this-ypan) $_view(ypan)
    2925     set _settings($this-zoom) $_view(zoom)
     2921    set _view(-xpan) 0.0
     2922    set _view(-ypan) 0.0
     2923    set _view(-zoom) 1.0
     2924    set _settings($this-xpan) $_view(-xpan)
     2925    set _settings($this-ypan) $_view(-ypan)
     2926    set _settings($this-zoom) $_view(-zoom)
    29262927}
    29272928
Note: See TracChangeset for help on using the changeset viewer.