Changeset 3492 for trunk/gui/scripts


Ignore:
Timestamp:
Mar 13, 2013, 9:57:03 AM (12 years ago)
Author:
ldelgass
Message:

Fix camera reset for nanovis. Includes refactoring of vector/matrix classes
in nanovis to consolidate into vrmath library. Also add preliminary canonical
view control to clients for testing.

Location:
trunk/gui/scripts
Files:
2 edited

Legend:

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

    r3485 r3492  
    123123    private method streams { tag name }
    124124    private method arrows { tag name }
     125    private method SetOrientation {}
    125126
    126127    private variable _arcball ""
     
    318319    pack $itk_component(volume) -padx 2 -pady 2
    319320
    320     BuildViewTab
    321     BuildVolumeTab
    322     BuildCutplanesTab
    323     BuildCameraTab
     321    if { [catch {
     322        BuildViewTab
     323        BuildVolumeTab
     324        BuildCutplanesTab
     325        BuildCameraTab
     326    } errs] != 0 } {
     327        global errorInfo
     328        puts stderr "errs=$errs errorInfo=$errorInfo"
     329    }
    324330
    325331    bind $itk_component(3dview) <Configure> \
     
    959965        $_arcball quaternion $q
    960966        SendCmd "camera orient $q"
    961         #SendCmd "camera reset"
     967        SendCmd "camera reset"
    962968        PanCamera
    963969        SendCmd "camera zoom $_view(zoom)"
     
    12571263    $_arcball quaternion $q
    12581264    SendCmd "camera orient $q"
    1259     #SendCmd "camera reset"
     1265    SendCmd "camera reset"
    12601266    PanCamera
    12611267    SendCmd "camera zoom $_view(zoom)"
     
    13671373            $_arcball quaternion $q
    13681374            SendCmd "camera orient $q"
    1369             #SendCmd "camera reset"
    1370             SendCmd "camera zoom $_view(zoom)"
     1375            SendCmd "camera reset"
    13711376            set _settings($this-qw)    $_view(qw)
    13721377            set _settings($this-qx)    $_view(qx)
     
    13761381            set _settings($this-pan-y) $_view(pan-y)
    13771382            set _settings($this-zoom)  $_view(zoom)
     1383            $itk_component(orientation) value "default"
    13781384        }
    13791385    }
     
    23872393    $inner configure -borderwidth 4
    23882394
     2395    set row 0
     2396    label $inner.orientation_l -text "View" -font "Arial 9"
     2397    itk_component add orientation {
     2398        Rappture::Combobox $inner.orientation -width 10 -editable no
     2399    }
     2400    $inner.orientation choices insert end \
     2401        "1 0 0 0" "front" \
     2402        "0 0 1 0" "back" \
     2403        "0.707107 -0.707107 0 0" "top" \
     2404        "0.707107 0.707107 0 0" "bottom" \
     2405        "0.707107 0 -0.707107 0" "left" \
     2406        "0.707107 0 0.707107 0" "right" \
     2407        "0.853553 -0.353553 0.353553 0.146447" "default"
     2408    $itk_component(orientation) value "default"
     2409    bind $inner.orientation <<Value>> [itcl::code $this SetOrientation]
     2410    if 1 {
     2411    blt::table $inner \
     2412            $row,0 $inner.orientation_l -anchor e -pady 2 \
     2413            $row,1 $inner.orientation -anchor w -pady 2 -fill x
     2414    blt::table configure $inner r$row -resize none
     2415    incr row
     2416    }
     2417
    23892418    set labels { qw qx qy qz pan-x pan-y zoom }
    2390     set row 0
    23912419    foreach tag $labels {
    23922420        label $inner.${tag}label -text $tag -font "Arial 9"
     
    26112639                }
    26122640                "qx" - "qy" - "qz" - "qw" {
     2641                    set _view($who) $_settings($this-$who)
    26132642                    set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)]
    26142643                    $_arcball quaternion $q
     
    29863015}
    29873016
     3017itcl::body Rappture::FlowvisViewer::SetOrientation {} {
     3018    set quat [$itk_component(orientation) value]
     3019    set quat [$itk_component(orientation) translate $quat]
     3020    foreach name { qw qx qy qz } comp $quat {
     3021        set _view($name) $comp
     3022        set _settings($this-$name) $comp
     3023    }
     3024    set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)]
     3025    $_arcball quaternion $q
     3026    SendCmd "camera orient $q"
     3027    SendCmd "camera reset"
     3028    set $_view(pan-x) 0.0
     3029    set $_view(pan-y) 0.0
     3030    set $_view(zoom) 1.0
     3031    set _settings($this-pan-x) $_view(pan-x)
     3032    set _settings($this-pan-y) $_view(pan-y)
     3033    set _settings($this-zoom)  $_view(zoom)
     3034}
  • trunk/gui/scripts/nanovisviewer.tcl

    r3485 r3492  
    286286    pack $itk_component(volume) -padx 2 -pady 2
    287287
    288     BuildViewTab
    289     BuildVolumeTab
    290     BuildCutplanesTab
    291     BuildCameraTab
     288    if { [catch {
     289        BuildViewTab
     290        BuildVolumeTab
     291        BuildCutplanesTab
     292        BuildCameraTab
     293    } errs] != 0 } {
     294        global errorInfo
     295        puts stderr "errs=$errs errorInfo=$errorInfo"
     296    }
    292297
    293298    # Legend
     
    913918        $_arcball quaternion $q
    914919        SendCmd "camera orient $q"
    915         #SendCmd "camera reset"
     920        SendCmd "camera reset"
    916921        PanCamera
    917922        SendCmd "camera zoom $_view(zoom)"
     
    10231028            $_arcball quaternion $q
    10241029            SendCmd "camera orient $q"
    1025             #SendCmd "camera reset"
    1026             SendCmd "camera zoom $_view(zoom)"
     1030            SendCmd "camera reset"
    10271031            set _settings($this-qw)    $_view(qw)
    10281032            set _settings($this-qx)    $_view(qx)
     
    10321036            set _settings($this-pan-y) $_view(pan-y)
    10331037            set _settings($this-zoom)  $_view(zoom)
     1038            $itk_component(orientation) value "default"
    10341039        }
    10351040    }
     
    18921897    $inner configure -borderwidth 4
    18931898
     1899    set row 0
     1900    label $inner.orientation_l -text "View" -font "Arial 9"
     1901    itk_component add orientation {
     1902        Rappture::Combobox $inner.orientation -width 10 -editable no
     1903    }
     1904    $inner.orientation choices insert end \
     1905        "1 0 0 0" "front" \
     1906        "0 0 1 0" "back" \
     1907        "0.707107 -0.707107 0 0" "top" \
     1908        "0.707107 0.707107 0 0" "bottom" \
     1909        "0.707107 0 -0.707107 0" "left" \
     1910        "0.707107 0 0.707107 0" "right" \
     1911        "0.853553 -0.353553 0.353553 0.146447" "default"
     1912    $itk_component(orientation) value "default"
     1913    bind $inner.orientation <<Value>> [itcl::code $this SetOrientation]
     1914    if 1 {
     1915    blt::table $inner \
     1916            $row,0 $inner.orientation_l -anchor e -pady 2 \
     1917            $row,1 $inner.orientation -anchor w -pady 2 -fill x
     1918    blt::table configure $inner r$row -resize none
     1919    incr row
     1920    }
     1921
    18941922    set labels { qw qx qy qz pan-x pan-y zoom }
    1895     set row 0
    18961923    foreach tag $labels {
    18971924        label $inner.${tag}label -text $tag -font "Arial 9"
     
    20012028                }
    20022029                "qx" - "qy" - "qz" - "qw" {
     2030                    set _view($who) $_settings($this-$who)
    20032031                    set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)]
    20042032                    $_arcball quaternion $q
     
    20722100    SendCmd "volume statue $bool $name"
    20732101}
     2102
     2103itcl::body Rappture::NanovisViewer::SetOrientation {} {
     2104    set quat [$itk_component(orientation) value]
     2105    set quat [$itk_component(orientation) translate $quat]
     2106    foreach name { qw qx qy qz } comp $quat {
     2107        set _view($name) $comp
     2108        set _settings($this-$name) $comp
     2109    }
     2110    set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)]
     2111    $_arcball quaternion $q
     2112    SendCmd "camera orient $q"
     2113    SendCmd "camera reset"
     2114    set $_view(pan-x) 0.0
     2115    set $_view(pan-y) 0.0
     2116    set $_view(zoom) 1.0
     2117    set _settings($this-pan-x) $_view(pan-x)
     2118    set _settings($this-pan-y) $_view(pan-y)
     2119    set _settings($this-zoom)  $_view(zoom)
     2120}
Note: See TracChangeset for help on using the changeset viewer.