Ignore:
Timestamp:
Jul 1, 2016 7:11:32 AM (8 years ago)
Author:
ldelgass
Message:

merge from trunk

Location:
branches/blt4_trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/blt4_trunk

  • branches/blt4_trunk/gui/scripts/vtkimageviewer.tcl

    r6351 r6414  
    100100    private method Rotate {option x y}
    101101    private method SetCurrentColormap { color }
     102    private method SetCurrentFieldName { dataobj }
    102103    private method SetLegendTip { x y }
    103104    private method SetObjectStyle { dataobj comp }
     
    243244
    244245    itk_component add fieldmenu {
    245         menu $itk_component(plotarea).menu \
    246             -relief flat \
    247             -tearoff 0
     246        menu $itk_component(plotarea).menu -relief flat -tearoff 0
    248247    } {
    249248        usual
     
    274273    }
    275274    pack $itk_component(reset) -side top -padx 2 -pady { 2 0 }
    276     Rappture::Tooltip::for $itk_component(reset) "Reset the view to the default zoom level"
     275    Rappture::Tooltip::for $itk_component(reset) \
     276        "Reset the view to the default zoom level"
    277277
    278278    itk_component add zoomin {
     
    510510        set _dlist [lreplace $_dlist $pos $pos]
    511511        array unset _obj2ovride $dataobj-*
    512         array unset _settings $dataobj-*
    513512        set changed 1
    514513    }
     
    604603        }
    605604        foreach axis { x y } {
     605            set units [$dataobj hints ${axis}units]
     606            set found($units) 1
    606607            set lim [$dataobj limits $axis]
    607608            if { ![info exists _limits($axis)] } {
     
    618619            }
    619620            set _limits($axis) [list $amin $amax]
    620             set units [$dataobj hints ${axis}units]
    621             set found($units) 1
    622621        }
    623622        foreach { fname lim } [$dataobj fieldlimits] {
     
    900899        DoResize
    901900        if { $_settings(-stretchtofit) } {
    902             AdjustSetting -stretchToFit
     901            AdjustSetting -stretchtofit
    903902        }
    904903    }
     
    907906        # Reset the camera and other view parameters
    908907        #
    909         InitSettings -view3d -background
    910 
     908        InitSettings -view3d -background \
     909            -xgrid -ygrid -zgrid -axismode \
     910            -axesvisible -axislabels -axisminorticks
     911
     912        SendCmd "axis tickpos outside"
    911913        SendCmd "axis lrot z 90"
    912914        $_arcball quaternion [ViewToQuaternion]
     
    932934        if { [info exists _obj2ovride($dataobj-raise)] &&  $_first == "" } {
    933935            set _first $dataobj
     936            SetCurrentFieldName $dataobj
    934937        }
    935938        foreach comp [$dataobj components] {
     
    968971        }
    969972    }
    970     if { $_first != ""  } {
    971         $itk_component(field) choices delete 0 end
    972         $itk_component(fieldmenu) delete 0 end
    973         array unset _fields
    974         set _curFldName ""
    975         foreach cname [$_first components] {
    976             foreach fname [$_first fieldnames $cname] {
    977                 if { [info exists _fields($fname)] } {
    978                     continue
    979                 }
    980                 foreach { label units components } \
    981                     [$_first fieldinfo $fname] break
    982                 $itk_component(field) choices insert end "$fname" "$label"
    983                 $itk_component(fieldmenu) add radiobutton -label "$label" \
    984                     -value $label -variable [itcl::scope _curFldLabel] \
    985                     -selectcolor red \
    986                     -activebackground $itk_option(-plotbackground) \
    987                     -activeforeground $itk_option(-plotforeground) \
    988                     -font "Arial 8" \
    989                     -command [itcl::code $this LegendTitleAction save]
    990                 set _fields($fname) [list $label $units $components]
    991                 if { $_curFldName == "" } {
    992                     set _curFldName $fname
    993                     set _curFldLabel $label
    994                 }
    995             }
    996         }
    997         $itk_component(field) value $_curFldLabel
    998     }
     973
    999974    InitSettings -stretchtofit -outline
    1000 
    1001975    if { $_reset } {
    1002         SendCmd "axis tickpos outside"
    1003         #SendCmd "axis lformat all %g"
    1004 
    1005976        foreach axis { x y z } {
    1006977            set label ""
     
    10431014        }
    10441015        PanCamera
    1045         InitSettings -xgrid -ygrid -zgrid \
    1046             -axesvisible -axislabels -field -view3d
     1016        InitSettings -field -view3d
    10471017        if { [array size _fields] < 2 } {
    10481018            catch {blt::table forget $itk_component(field) $itk_component(field_l)}
     
    12751245itcl::body Rappture::VtkImageViewer::InitSettings { args } {
    12761246    foreach spec $args {
    1277         if { [info exists _settings($_first${spec})] } {
    1278             # Reset global setting with dataobj specific setting
    1279             set _settings($spec) $_settings($_first${spec})
    1280         }
    12811247        AdjustSetting $spec
    12821248    }
     
    13891355
    13901356            # Get the new limits because the field changed.
    1391             SendCmd "dataset scalar $_curFldName"
    1392             #SendCmd "image colormode scalar $_curFldName"
     1357            SendCmd [list dataset scalar $_curFldName]
     1358            #SendCmd [list image colormode scalar $_curFldName]
    13931359            SendCmd "camera reset"
    13941360            DrawLegend
     
    15451511            set _colormaps($cmap) 1
    15461512        }
    1547         #SendCmd "legend $cmap scalar $_curFldName {} $w $h 0"
     1513        #SendCmd [list legend $cmap scalar $_curFldName {} $w $h 0]
    15481514        SendCmd "legend2 $cmap $w $h"
    15491515    }
     
    20462012    if { [info exists style(-stretchtofit)] } {
    20472013        set _settings(-stretchtofit) $style(-stretchtofit)
    2048         AdjustSetting -stretchToFit
     2014        AdjustSetting -stretchtofit
    20492015    }
    20502016    SendCmd "outline add $tag"
     
    23272293    set _view(-zoom) 1.0
    23282294}
     2295
     2296itcl::body Rappture::VtkImageViewer::SetCurrentFieldName { dataobj } {
     2297    set _first $dataobj
     2298    $itk_component(field) choices delete 0 end
     2299    $itk_component(fieldmenu) delete 0 end
     2300    array unset _fields
     2301    set _curFldName ""
     2302    foreach cname [$_first components] {
     2303        foreach fname [$_first fieldnames $cname] {
     2304            if { [info exists _fields($fname)] } {
     2305                continue
     2306            }
     2307            foreach { label units components } \
     2308                [$_first fieldinfo $fname] break
     2309            $itk_component(field) choices insert end "$fname" "$label"
     2310            $itk_component(fieldmenu) add radiobutton -label "$label" \
     2311                -value $label -variable [itcl::scope _curFldLabel] \
     2312                -selectcolor red \
     2313                -activebackground $itk_option(-plotbackground) \
     2314                -activeforeground $itk_option(-plotforeground) \
     2315                -font "Arial 8" \
     2316                -command [itcl::code $this LegendTitleAction save]
     2317            set _fields($fname) [list $label $units $components]
     2318            if { $_curFldName == "" } {
     2319                set _curFldName $fname
     2320                set _curFldLabel $label
     2321            }
     2322        }
     2323    }
     2324    $itk_component(field) value $_curFldLabel
     2325}
Note: See TracChangeset for help on using the changeset viewer.