Changeset 5226


Ignore:
Timestamp:
Apr 15, 2015, 12:51:55 AM (5 years ago)
Author:
ldelgass
Message:

whitespace

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/1.4/gui/scripts/vtkvolumeviewer.tcl

    r5206 r5226  
    1 # -*- mode: tcl; indent-tabs-mode: nil -*- 
     1# -*- mode: tcl; indent-tabs-mode: nil -*-
    22# ----------------------------------------------------------------------
    33#  COMPONENT: vtkvolumeviewer - Vtk volume viewer
     
    5757    public method get {args}
    5858    public method isconnected {}
    59     public method parameters {title args} { 
    60         # do nothing 
     59    public method parameters {title args} {
     60        # do nothing
    6161    }
    6262    public method scale {args}
    6363
    64     private method GetDatasetsWithComponent { cname } 
    65 
    66     private variable _volcomponents   ; # Array of components found 
     64    private method GetDatasetsWithComponent { cname }
     65
     66    private variable _volcomponents   ; # Array of components found
    6767    private variable _componentsList   ; # List of component names
    6868
     
    7373    private method BuildColormap { name colors }
    7474    private method BuildCutplaneTab {}
    75     private method BuildDownloadPopup { widget command } 
     75    private method BuildDownloadPopup { widget command }
    7676    private method BuildViewTab {}
    7777    private method BuildVolumeTab {}
     
    8484    private method DoResize {}
    8585    private method DoRotate {}
    86     private method EnterLegend { x y } 
    87     private method EventuallyResize { w h } 
    88     private method EventuallyRequestLegend {} 
    89     private method EventuallyRotate { q } 
    90     private method EventuallySetCutplane { axis args } 
    91     private method GetImage { args } 
    92     private method GetVtkData { args } 
     86    private method EnterLegend { x y }
     87    private method EventuallyResize { w h }
     88    private method EventuallyRequestLegend {}
     89    private method EventuallyRotate { q }
     90    private method EventuallySetCutplane { axis args }
     91    private method GetImage { args }
     92    private method GetVtkData { args }
    9393    private method InitSettings { args  }
    94     private method IsValidObject { dataobj } 
     94    private method IsValidObject { dataobj }
    9595    private method LeaveLegend {}
    9696    private method MotionLegend { x y }
     
    9898    private method PanCamera {}
    9999    private method Pick {x y}
    100     private method QuaternionToView { q } { 
     100    private method QuaternionToView { q } {
    101101        foreach { _view(-qw) _view(-qx) _view(-qy) _view(-qz) } $q break
    102102    }
     
    109109    private method Rotate {option x y}
    110110    private method SetLegendTip { x y }
    111     private method SetObjectStyle { dataobj comp } 
     111    private method SetObjectStyle { dataobj comp }
    112112    private method SetOrientation { side }
    113     private method Slice {option args} 
    114     private method ViewToQuaternion {} { 
     113    private method Slice {option args}
     114    private method ViewToQuaternion {} {
    115115        return [list $_view(-qw) $_view(-qx) $_view(-qy) $_view(-qz)]
    116116    }
     
    120120    private variable _dlist ""     ;    # list of data objects
    121121    private variable _obj2ovride   ;    # maps dataobj => style override
    122     private variable _datasets     ;    # contains all the dataobj-component 
     122    private variable _datasets     ;    # contains all the dataobj-component
    123123                                   ;    # datasets in the server
    124124    private variable _colormaps    ;    # contains all the colormaps
     
    146146    private variable _cutplanePending 0
    147147    private variable _legendPending 0
    148     private variable _fields 
     148    private variable _fields
    149149    private variable _curFldName ""
    150150    private variable _curFldLabel ""
     
    215215        -xpan            0
    216216        -ypan            0
    217         -zoom            1.0 
     217        -zoom            1.0
    218218    }
    219219    set _arcball [blt::arcball create 100 100]
     
    258258    itk_component add fieldmenu {
    259259        menu $itk_component(plotarea).menu -bg black -fg white -relief flat \
    260             -tearoff no 
     260            -tearoff no
    261261    } {
    262262        usual
     
    278278
    279279    set _map(id) [$c create image 0 0 -anchor nw -image $_image(plot)]
    280     set _map(cwidth) -1 
    281     set _map(cheight) -1 
     280    set _map(cwidth) -1
     281    set _map(cheight) -1
    282282    set _map(zoom) 1.0
    283283    set _map(original) ""
     
    325325            -offimage [Rappture::icon volume-off] \
    326326            -variable [itcl::scope _settings(-volumevisible)] \
    327             -command [itcl::code $this AdjustSetting -volumevisible] 
     327            -command [itcl::code $this AdjustSetting -volumevisible]
    328328    }
    329329    $itk_component(volume) select
     
    337337            -offimage [Rappture::icon cutbutton] \
    338338            -variable [itcl::scope _settings(-cutplanesvisible)] \
    339             -command [itcl::code $this AdjustSetting -cutplanesvisible] 
     339            -command [itcl::code $this AdjustSetting -cutplanesvisible]
    340340    }
    341341    Rappture::Tooltip::for $itk_component(cutplane) \
     
    357357    set _image(legend) [image create photo]
    358358    itk_component add legend {
    359         canvas $itk_component(plotarea).legend -width 50 -highlightthickness 0 
     359        canvas $itk_component(plotarea).legend -width 50 -highlightthickness 0
    360360    } {
    361361        usual
     
    364364    }
    365365
    366     # Hack around the Tk panewindow.  The problem is that the requested 
     366    # Hack around the Tk panewindow.  The problem is that the requested
    367367    # size of the 3d view isn't set until an image is retrieved from
    368368    # the server.  So the panewindow uses the tiny size.
     
    370370    pack forget $itk_component(view)
    371371    blt::table $itk_component(plotarea) \
    372         0,0 $itk_component(view) -fill both -reqwidth $w 
     372        0,0 $itk_component(view) -fill both -reqwidth $w
    373373    blt::table configure $itk_component(plotarea) c1 -resize none
    374374
     
    455455
    456456itcl::body Rappture::VtkVolumeViewer::DoRotate {} {
    457     SendCmd "camera orient [ViewToQuaternion]" 
     457    SendCmd "camera orient [ViewToQuaternion]"
    458458    set _rotatePending 0
    459459}
     
    482482    if { !$_rotatePending } {
    483483        set _rotatePending 1
    484         global rotate_delay 
     484        global rotate_delay
    485485        $_dispatcher event -after $rotate_delay !rotate
    486486    }
     
    589589                    continue
    590590                }
    591                 if {[info exists _obj2ovride($dataobj-raise)] && 
     591                if {[info exists _obj2ovride($dataobj-raise)] &&
    592592                    $_obj2ovride($dataobj-raise)} {
    593593                    set dlist [linsert $dlist 0 $dataobj]
     
    617617            }
    618618            return $dlist
    619         }           
     619        }
    620620        -image {
    621621            if {[llength $args] != 2} {
     
    850850    $_dispatcher cancel !legend
    851851    # disconnected -- no more data sitting on server
    852     array unset _datasets 
    853     array unset _colormaps 
    854     array unset _dataset2style 
     852    array unset _datasets
     853    array unset _colormaps
     854    array unset _dataset2style
    855855
    856856    set _resizePending 0
     
    959959    # Turn on buffering of commands to the server.  We don't want to
    960960    # be preempted by a server disconnect/reconnect (which automatically
    961     # generates a new call to Rebuild).   
     961    # generates a new call to Rebuild).
    962962    StartBufferingCommands
    963963
     
    10011001            if { ![info exists _datasets($tag)] } {
    10021002                set bytes [$dataobj vtkdata $comp]
    1003                 if 0 { 
     1003                if 0 {
    10041004                    set f [open /tmp/vtkvolume.vtk "w"]
    10051005                    fconfigure $f -translation binary -encoding binary
     
    11061106itcl::body Rappture::VtkVolumeViewer::CurrentDatasets {args} {
    11071107    set flag [lindex $args 0]
    1108     switch -- $flag { 
     1108    switch -- $flag {
    11091109        "-all" {
    11101110            if { [llength $args] > 1 } {
     
    11251125                set dlist [get -visible]
    11261126            }
    1127         }           
     1127        }
    11281128        default {
    11291129            set dlist $args
     
    12441244    foreach tag [CurrentDatasets -visible] {
    12451245        SendCmd "dataset getscalar pixel $x $y $tag"
    1246     } 
     1246    }
    12471247}
    12481248
     
    16321632        SendCmd "outline color $rgb"
    16331633        SendCmd "$_cutplaneCmd color $rgb"
    1634         $itk_component(legend) itemconfigure labels -fill $color 
    1635         $itk_component(legend) itemconfigure limits -fill $color 
     1634        $itk_component(legend) itemconfigure labels -fill $color
     1635        $itk_component(legend) itemconfigure limits -fill $color
    16361636    }
    16371637}
     
    16701670        -font "Arial 9"
    16711671
    1672     label $inner.background_l -text "Background" -font "Arial 9" 
     1672    label $inner.background_l -text "Background" -font "Arial 9"
    16731673    itk_component add background {
    16741674        Rappture::Combobox $inner.background -width 10 -editable no
     
    16771677        "black"              "black"            \
    16781678        "white"              "white"            \
    1679         "grey"               "grey"             
     1679        "grey"               "grey"
    16801680
    16811681    $itk_component(background) value $_settings(-background)
     
    18111811        -font "Arial 9"
    18121812
    1813     label $inner.mode_l -text "Mode" -font "Arial 9" 
     1813    label $inner.mode_l -text "Mode" -font "Arial 9"
    18141814
    18151815    itk_component add axismode {
     
    18201820        "closest_triad"   "closest" \
    18211821        "furthest_triad"  "farthest" \
    1822         "outer_edges"     "outer"         
     1822        "outer_edges"     "outer"
    18231823    $itk_component(axismode) value $_settings(-axisflymode)
    18241824    bind $inner.mode <<Value>> [itcl::code $this AdjustSetting -axisflymode]
     
    18921892itcl::body Rappture::VtkVolumeViewer::BuildCutplaneTab {} {
    18931893    set font [option get $itk_component(hull) font Font]
    1894    
     1894
    18951895    set inner [$itk_component(main) insert end \
    18961896        -title "Cutplane Settings" \
    1897         -icon [Rappture::icon cutbutton]] 
     1897        -icon [Rappture::icon cutbutton]]
    18981898
    18991899    $inner configure -borderwidth 4
     
    20192019
    20202020#
    2021 #  camera -- 
     2021#  camera --
    20222022#
    20232023itcl::body Rappture::VtkVolumeViewer::camera {option args} {
    2024     switch -- $option { 
     2024    switch -- $option {
    20252025        "show" {
    20262026            puts [array get _view]
     
    20702070
    20712071itcl::body Rappture::VtkVolumeViewer::GetImage { args } {
    2072     if { [image width $_image(download)] > 0 && 
     2072    if { [image width $_image(download)] > 0 &&
    20732073         [image height $_image(download)] > 0 } {
    20742074        set bytes [$_image(download) data -format "jpeg -quality 100"]
     
    20832083        -title "[Rappture::filexfer::label downloadWord] as..."
    20842084    set inner [$popup component inner]
    2085     label $inner.summary -text "" -anchor w 
     2085    label $inner.summary -text "" -anchor w
    20862086    radiobutton $inner.vtk_button -text "VTK data file" \
    20872087        -variable [itcl::scope _downloadPopup(format)] \
    20882088        -font "Helvetica 9 " \
    2089         -value vtk 
     2089        -value vtk
    20902090    Rappture::Tooltip::for $inner.vtk_button "Save as VTK data file."
    20912091    radiobutton $inner.image_button -text "Image File" \
    20922092        -variable [itcl::scope _downloadPopup(format)] \
    2093         -value image 
     2093        -value image
    20942094    Rappture::Tooltip::for $inner.image_button \
    20952095        "Save as digital image."
     
    21122112        2,0 $inner.image_button -anchor w -cspan 2 -padx { 4 0 } \
    21132113        4,1 $inner.cancel -width .9i -fill y \
    2114         4,0 $inner.ok -padx 2 -width .9i -fill y 
     2114        4,0 $inner.ok -padx 2 -width .9i -fill y
    21152115    blt::table configure $inner r3 -height 4
    21162116    blt::table configure $inner r4 -pady 4
     
    21922192    set font "Arial 8"
    21932193    set lineht [font metrics $font -linespace]
    2194    
     2194
    21952195    if { [info exists _fields($fname)] } {
    21962196        foreach { title units } $_fields($fname) break
     
    22042204        set x [expr $w - 2]
    22052205        if { [$c find withtag "legend"] == "" } {
    2206             set y 2 
     2206            set y 2
    22072207            $c create text $x $y \
    22082208                -anchor ne \
     
    22792279    set font "Arial 8"
    22802280    set lineht [font metrics $font -linespace]
    2281    
     2281
    22822282    set imgHeight [image height $_image(legend)]
    22832283    set coords [$c coords colormap]
     
    23022302    }
    23032303    set color [eval format "\#%02x%02x%02x" $pixel]
    2304     $_image(swatch) put black  -to 0 0 23 23 
    2305     $_image(swatch) put $color -to 1 1 22 22 
     2304    $_image(swatch) put black  -to 0 0 23 23
     2305    $_image(swatch) put $color -to 1 1 22 22
    23062306    .rappturetooltip configure -icon $_image(swatch)
    23072307
     
    23142314        set value 0.0
    23152315    }
    2316     set tipx [expr $x + 15] 
     2316    set tipx [expr $x + 15]
    23172317    set tipy [expr $y - 5]
    23182318    Rappture::Tooltip::text $c "$title $value"
    2319     Rappture::Tooltip::tooltip show $c +$tipx,+$tipy   
     2319    Rappture::Tooltip::tooltip show $c +$tipx,+$tipy
    23202320}
    23212321
     
    23632363# ----------------------------------------------------------------------
    23642364itcl::body Rappture::VtkVolumeViewer::Combo {option} {
    2365     set c $itk_component(view) 
     2365    set c $itk_component(view)
    23662366    switch -- $option {
    23672367        post {
     
    23762376        }
    23772377        deactivate {
    2378             $c itemconfigure title -fill $itk_option(-plotforeground) 
     2378            $c itemconfigure title -fill $itk_option(-plotforeground)
    23792379        }
    23802380        invoke {
     
    23882388}
    23892389
    2390 itcl::body Rappture::VtkVolumeViewer::SetOrientation { side } { 
     2390itcl::body Rappture::VtkVolumeViewer::SetOrientation { side } {
    23912391    array set positions {
    23922392        front "1 0 0 0"
     
    23992399    foreach name { -qw -qx -qy -qz } value $positions($side) {
    24002400        set _view($name) $value
    2401     } 
     2401    }
    24022402    set q [ViewToQuaternion]
    24032403    $_arcball quaternion $q
    2404     SendCmd "camera orient $q" 
     2404    SendCmd "camera orient $q"
    24052405    SendCmd "camera reset"
    24062406    set _view(-xpan) 0
     
    24132413#
    24142414#       Returns a list of all the datasets (known by the combination of
    2415 #       their data object and component name) that match the given 
    2416 #       component name.  For example, this is used where we want to change 
     2415#       their data object and component name) that match the given
     2416#       component name.  For example, this is used where we want to change
    24172417#       the settings of volumes that have the current component.
    24182418#
    2419 itcl::body Rappture::VtkVolumeViewer::GetDatasetsWithComponent { cname } { 
     2419itcl::body Rappture::VtkVolumeViewer::GetDatasetsWithComponent { cname } {
    24202420    if { ![info exists _volcomponents($cname)] } {
    24212421        return ""
Note: See TracChangeset for help on using the changeset viewer.