Changeset 5158 for trunk


Ignore:
Timestamp:
Mar 21, 2015 2:41:25 PM (9 years ago)
Author:
ldelgass
Message:

More surface viewer fixes, including color mode on reset fix

File:
1 edited

Legend:

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

    r5157 r5158  
    9999    private method Rotate {option x y}
    100100    private method SetCurrentColormap { color }
     101    private method SetCurrentFieldName { dataobj }
    101102    private method SetLegendTip { x y }
    102103    private method SetObjectStyle { dataobj comp }
     
    924925    set _first ""
    925926    SendCmd "dataset visible 0"
     927    eval scale $_dlist
    926928    foreach dataobj [get -objects] {
    927929        if { [info exists _obj2ovride($dataobj-raise)] &&  $_first == "" } {
    928930            set _first $dataobj
     931            SetCurrentFieldName $dataobj
    929932        }
    930933        set _obj2datasets($dataobj) ""
     
    964967    }
    965968
    966     if { $_first != "" } {
    967         $itk_component(field) choices delete 0 end
    968         $itk_component(fieldmenu) delete 0 end
    969         array unset _fields
    970         set _curFldName ""
    971         foreach cname [$_first components] {
    972             foreach fname [$_first fieldnames $cname] {
    973                 if { [info exists _fields($fname)] } {
    974                     continue
    975                 }
    976                 foreach { label units components } \
    977                     [$_first fieldinfo $fname] break
    978                 $itk_component(field) choices insert end "$fname" "$label"
    979                 $itk_component(fieldmenu) add radiobutton -label "$label" \
    980                     -value $label -variable [itcl::scope _curFldLabel] \
    981                     -selectcolor red \
    982                     -activebackground $itk_option(-plotbackground) \
    983                     -activeforeground $itk_option(-plotforeground) \
    984                     -font "Arial 8" \
    985                     -command [itcl::code $this Combo invoke]
    986                 set _fields($fname) [list $label $units $components]
    987                 if { $_curFldName == "" } {
    988                     set _curFldName $fname
    989                     set _curFldLabel $label
    990                 }
    991             }
    992         }
    993         $itk_component(field) value $_curFldLabel
    994     }
    995969    InitSettings -isolinesvisible -surfacevisible -outline
    996970    if { $_reset } {
     
    1020994        set _reset 0
    1021995    }
     996    # Redraw the legend even if we're using the same colormap. The position
     997    # of the isolines may have changed because the range of data changed.
     998    DrawLegend
    1022999
    10231000    # Actually write the commands to the server socket.  If it fails, we don't
     
    19141891    set tag $dataobj-$comp
    19151892    array set style {
    1916         -color BCGYR
    1917         -edgecolor black
    1918         -edges 0
    1919         -isolinecolor white
     1893        -color           BCGYR
     1894        -edgecolor       black
     1895        -edges           0
     1896        -isolinecolor    white
    19201897        -isolinesvisible 0
    1921         -levels 10
    1922         -lighting 1
    1923         -linewidth 1.0
    1924         -opacity 1.0
    1925         -outline 0
    1926         -surfacevisible 1
    1927         -wireframe 0
     1898        -levels          10
     1899        -lighting        1
     1900        -linewidth       1.0
     1901        -opacity         1.0
     1902        -outline         0
     1903        -surfacevisible  1
     1904        -wireframe       0
    19281905    }
    19291906    array set style [$dataobj style $comp]
     
    19851962
    19861963    SendCmd "polydata add $tag"
     1964    if { $_curFldName != "" } {
     1965        SendCmd "polydata colormode $_colorMode $_curFldName $tag"
     1966    }
    19871967    SendCmd "polydata edges $style(-edges) $tag"
    19881968    set _settings(-surfaceedges) $style(-edges)
     
    23432323    blt::vector destroy $v
    23442324}
     2325
     2326itcl::body Rappture::VtkSurfaceViewer::SetCurrentFieldName { dataobj } {
     2327    set _first $dataobj
     2328    $itk_component(field) choices delete 0 end
     2329    $itk_component(fieldmenu) delete 0 end
     2330    array unset _fields
     2331    set _curFldName ""
     2332    foreach cname [$_first components] {
     2333        foreach fname [$_first fieldnames $cname] {
     2334            if { [info exists _fields($fname)] } {
     2335                continue
     2336            }
     2337            foreach { label units components } \
     2338                [$_first fieldinfo $fname] break
     2339            $itk_component(field) choices insert end "$fname" "$label"
     2340            $itk_component(fieldmenu) add radiobutton -label "$label" \
     2341                -value $label -variable [itcl::scope _curFldLabel] \
     2342                -selectcolor red \
     2343                -activebackground $itk_option(-plotbackground) \
     2344                -activeforeground $itk_option(-plotforeground) \
     2345                -font "Arial 8" \
     2346                -command [itcl::code $this LegendTitleAction save]
     2347            set _fields($fname) [list $label $units $components]
     2348            if { $_curFldName == "" } {
     2349                set _curFldName $fname
     2350                set _curFldLabel $label
     2351            }
     2352        }
     2353    }
     2354    $itk_component(field) value $_curFldLabel
     2355}
Note: See TracChangeset for help on using the changeset viewer.