Ignore:
Timestamp:
Apr 23, 2009 8:46:21 AM (15 years ago)
Author:
gah
Message:

add camera method to update camera settings

File:
1 edited

Legend:

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

    r1419 r1423  
    6666    public method rmdupmarker { m x }
    6767    public method overmarker { m x }
     68    public method camera {option args}
    6869
    6970    protected method Connect {}
     
    20002001    $_dispatcher event -idle !legend
    20012002}
     2003
     2004#  camera --
     2005#
     2006itcl::body Rappture::NanovisViewer::camera {option args} {
     2007    switch -- $option {
     2008        "show" {
     2009            puts [array get view_]
     2010        }
     2011        "set" {
     2012            set who [lindex $args 0]
     2013            set x $settings_($this-$who)
     2014            set code [catch { string is double $x } result]
     2015            if { $code != 0 || !$result } {
     2016                set settings_($this-$who) $view_($who)
     2017                return
     2018            }
     2019            switch -- $who {
     2020                "pan-x" - "pan-y" {
     2021                    set view_($who) $settings_($this-$who)
     2022                    PanCamera
     2023                }
     2024                "phi" - "theta" - "psi" {
     2025                    set view_($who) $settings_($this-$who)
     2026                    set xyz [Euler2XYZ $view_(theta) $view_(phi) $view_(psi)]
     2027                    SendCmd "camera angle $xyz"
     2028                }
     2029                "zoom" {
     2030                    set view_($who) $settings_($this-$who)
     2031                    SendCmd "camera zoom $view_(zoom)"
     2032                }
     2033            }
     2034        }
     2035    }
     2036}
     2037
Note: See TracChangeset for help on using the changeset viewer.