Ignore:
Timestamp:
May 23, 2016, 12:07:34 PM (8 years ago)
Author:
ldelgass
Message:

Add SetCurrentFieldName? method to more vtk viewers

File:
1 edited

Legend:

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

    r6338 r6355  
    105105    private method Rotate {option x y}
    106106    private method SetCurrentColormap { color }
     107    private method SetCurrentFieldName { dataobj }
    107108    private method SetLegendTip { x y }
    108109    private method SetObjectStyle { dataobj comp }
     
    978979        if { [info exists _obj2ovride($dataobj-raise)] &&  $_first == "" } {
    979980            set _first $dataobj
     981            SetCurrentFieldName $dataobj
    980982        }
    981983        foreach comp [$dataobj components] {
     
    10231025            }
    10241026        }
    1025         $itk_component(field) choices delete 0 end
    1026         $itk_component(fieldmenu) delete 0 end
    1027         array unset _fields
    1028         set _curFldName ""
    1029         set _curFldLabel ""
    1030         foreach cname [$_first components] {
    1031             foreach fname [$_first fieldnames $cname] {
    1032                 if { [info exists _fields($fname)] } {
    1033                     continue
    1034                 }
    1035                 foreach { label units components } \
    1036                     [$_first fieldinfo $fname] break
    1037                 $itk_component(field) choices insert end "$fname" "$label"
    1038                 $itk_component(fieldmenu) add radiobutton -label "$label" \
    1039                     -value $label -variable [itcl::scope _curFldLabel] \
    1040                     -selectcolor red \
    1041                     -activebackground $itk_option(-plotbackground) \
    1042                     -activeforeground $itk_option(-plotforeground) \
    1043                     -font "Arial 8" \
    1044                     -command [itcl::code $this LegendTitleAction save]
    1045                 set _fields($fname) [list $label $units $components]
    1046                 if { $_curFldName == "" && $components == 3 } {
    1047                     set _curFldName $fname
    1048                     set _curFldLabel $label
    1049                 }
    1050             }
    1051         }
    1052         $itk_component(field) value $_curFldLabel
    10531027    }
    10541028
     
    24342408    set _view(-zoom) 1.0
    24352409}
     2410
     2411itcl::body Rappture::VtkStreamlinesViewer::SetCurrentFieldName { dataobj } {
     2412    set _first $dataobj
     2413    $itk_component(field) choices delete 0 end
     2414    $itk_component(fieldmenu) delete 0 end
     2415    array unset _fields
     2416    set _curFldName ""
     2417    set _curFldLabel ""
     2418    foreach cname [$_first components] {
     2419        foreach fname [$_first fieldnames $cname] {
     2420            if { [info exists _fields($fname)] } {
     2421                continue
     2422            }
     2423            foreach { label units components } \
     2424                [$_first fieldinfo $fname] break
     2425            $itk_component(field) choices insert end "$fname" "$label"
     2426            $itk_component(fieldmenu) add radiobutton -label "$label" \
     2427                -value $label -variable [itcl::scope _curFldLabel] \
     2428                -selectcolor red \
     2429                -activebackground $itk_option(-plotbackground) \
     2430                -activeforeground $itk_option(-plotforeground) \
     2431                -font "Arial 8" \
     2432                -command [itcl::code $this LegendTitleAction save]
     2433            set _fields($fname) [list $label $units $components]
     2434            if { $_curFldName == "" && $components == 3 } {
     2435                set _curFldName $fname
     2436                set _curFldLabel $label
     2437            }
     2438        }
     2439    }
     2440    $itk_component(field) value $_curFldLabel
     2441}
Note: See TracChangeset for help on using the changeset viewer.