Changeset 4547 for branches/1.3/gui


Ignore:
Timestamp:
Jul 17, 2014 7:12:39 PM (10 years ago)
Author:
ldelgass
Message:

merge r3940 from trunk

Location:
branches/1.3
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/1.3

    • Property svn:mergeinfo changed
      /trunkmerged: 3940
  • branches/1.3/gui/scripts/flowvisviewer.tcl

    r4494 r4547  
    4444    itk_option define -plotoutline plotOutline PlotOutline ""
    4545
     46    private variable _volcomponents   ; # Array of components found
     47    private variable _componentsList   ; # Array of components found
     48    private method BuildVolumeComponents {}
     49    private method GetDatasetsWithComponent { cname }
     50
    4651    constructor { hostlist args } {
    4752        Rappture::VisViewer::constructor $hostlist
     
    6368    public method get {args}
    6469    public method isconnected {}
    65     public method limits { tf }
     70    public method limits { cname }
    6671    public method overmarker { m x }
    6772    public method parameters {title args} {
     
    232237    $_arcball quaternion $q
    233238
    234     set _limits(vmin) 0.0
    235     set _limits(vmax) 1.0
     239    set _limits(v) [list 0.0 1.0]
    236240    set _reset 1
    237241
     
    672676# ----------------------------------------------------------------------
    673677itcl::body Rappture::FlowvisViewer::delete {args} {
    674      flow stop
     678    flow stop
    675679    if {[llength $args] == 0} {
    676680        set args $_dlist
     
    722726# ----------------------------------------------------------------------
    723727itcl::body Rappture::FlowvisViewer::scale {args} {
    724     foreach val {xmin xmax ymin ymax vmin vmax} {
    725         set _limits($val) ""
    726     }
    727     foreach obj $args {
    728         foreach axis {x y v} {
    729 
    730             foreach { min max } [$obj limits $axis] break
    731 
     728    array set style {
     729        -color BCGYR
     730        -levels 6
     731        -opacity 1.0
     732        -markers ""
     733    }
     734    array unset _limits
     735    array unset _volcomponents
     736    foreach dataobj $args {
     737        if { ![$dataobj isvalid] } {
     738            continue;                     # Object doesn't contain valid data.
     739        }
     740        foreach cname [$dataobj components] {
     741            if { ![info exists _volcomponents($cname)] } {
     742                lappend _componentsList $cname
     743                array set style [lindex [$dataobj components -style $cname] 0]
     744                set cmap [ColorsToColormap $style(-color)]
     745                set _cname2defaultcolormap($cname) $cmap
     746                set _settings($cname-colormap) $style(-color)
     747            }
     748            lappend _volcomponents($cname) $dataobj-$cname
     749            array unset limits
     750            array set limits [$dataobj valueLimits $cname]
     751            set _limits($cname) $limits(v)
     752        }
     753        foreach axis {x y z v} {
     754            foreach { min max } [$dataobj limits $axis] break
    732755            if {"" != $min && "" != $max} {
    733                 if {"" == $_limits(${axis}min)} {
    734                     set _limits(${axis}min) $min
    735                     set _limits(${axis}max) $max
     756                if { ![info exists _limits($axis)] } {
     757                    set _limits($axis) [list $min $max]
    736758                } else {
    737                     if {$min < $_limits(${axis}min)} {
    738                         set _limits(${axis}min) $min
     759                    foreach {amin amax} $_limits($axis) break
     760                    if {$min < $amin} {
     761                        set amin $min
    739762                    }
    740                     if {$max > $_limits(${axis}max)} {
    741                         set _limits(${axis}max) $max
     763                    if {$max > $amax} {
     764                        set amax $max
    742765                    }
     766                    set _limits($axis) [list $amin $amax]
    743767                }
    744768            }
    745769        }
    746770    }
     771    #BuildVolumeComponents
    747772}
    748773
     
    11121137    # Display the markers used by the active transfer function.
    11131138    set tf $_obj2style($tag)
    1114     array set limits [limits $tf]
    1115     $c itemconfigure vmin -text [format %.2g $limits(vmin)]
     1139    foreach {vmin vmax} [limits $tf] break
     1140    $c itemconfigure vmin -text [format %.2g $vmin]
    11161141    $c coords vmin $lx $ly
    11171142
    1118     $c itemconfigure vmax -text [format %.2g $limits(vmax)]
     1143    $c itemconfigure vmax -text [format %.2g $vmax]
    11191144    $c coords vmax [expr {$w-$lx}] $ly
    11201145
     
    11561181    set dataobj [lindex $parts 0]
    11571182    set _serverObjs($tag) 0
    1158     set _limits($tag-min)  $values(min);  # Minimum value of the volume.
    1159     set _limits($tag-max)  $values(max);  # Maximum value of the volume.
     1183    set _limits($tag) [list $values(min) $values(max)]
    11601184    unset _recvObjs($tag)
    11611185    if { [array size _recvObjs] == 0 } {
     
    13891413
    13901414itcl::body Rappture::FlowvisViewer::PanCamera {} {
    1391     #set x [expr ($_view(xpan)) / $_limits(xrange)]
    1392     #set y [expr ($_view(ypan)) / $_limits(yrange)]
    13931415    set x $_view(xpan)
    13941416    set y $_view(ypan)
     
    17731795#              now.
    17741796#
    1775 itcl::body Rappture::FlowvisViewer::NameTransferFunc { dataobj comp } {
     1797itcl::body Rappture::FlowvisViewer::NameTransferFunc { dataobj cname } {
    17761798    array set style {
    17771799        -color BCGYR
     
    17811803        -transp 50
    17821804    }
    1783     array set style [lindex [$dataobj components -style $comp] 0]
     1805    array set style [lindex [$dataobj components -style $cname] 0]
    17841806    set _settings($this-light) $style(-light)
    17851807    set _settings($this-transp) $style(-transp)
    17861808    set _settings($this-opacity) [expr $style(-opacity) * 100]
    1787     set tf "$style(-color):$style(-levels):$style(-opacity)"
    1788     set _obj2style($dataobj-$comp) $tf
    1789     lappend _style2objs($tf) $dataobj $comp
    1790     return $tf
     1809    set _obj2style($dataobj-$cname) $cname
     1810    lappend _style2objs($cname) $dataobj $cname
     1811    return $cname
    17911812}
    17921813
     
    20642085}
    20652086
    2066 itcl::body Rappture::FlowvisViewer::limits { tf } {
    2067     set _limits(vmin) 0.0
    2068     set _limits(vmax) 1.0
    2069     if { ![info exists _style2objs($tf)] } {
    2070         puts stderr "no style2objs for $tf tf=($tf)"
     2087itcl::body Rappture::FlowvisViewer::limits { cname } {
     2088    set _limits(v) [list 0.0 1.0]
     2089    if { ![info exists _style2objs($cname)] } {
     2090        puts stderr "no style2objs for $cname cname=($cname)"
    20712091        return [array get _limits]
    20722092    }
    20732093    set min ""; set max ""
    2074     foreach {dataobj comp} $_style2objs($tf) {
    2075         set tag $dataobj-$comp
     2094    foreach tag [GetDatasetsWithComponent $cname] {
    20762095        if { ![info exists _serverObjs($tag)] } {
    20772096            puts stderr "$tag not in serverObjs?"
    20782097            continue
    20792098        }
    2080         if { ![info exists _limits($tag-min)] } {
     2099        if { ![info exists _limits($tag)] } {
    20812100            puts stderr "$tag no min?"
    20822101            continue
    20832102        }
    2084         if { $min == "" || $min > $_limits($tag-min) } {
    2085             set min $_limits($tag-min)
    2086         }
    2087         if { $max == "" || $max < $_limits($tag-max) } {
    2088             set max $_limits($tag-max)
    2089         }
    2090     }
    2091     if { $min != "" } {
    2092         set _limits(vmin) $min
    2093     }
    2094     if { $max != "" } {
    2095         set _limits(vmax) $max
    2096     }
    2097     return [array get _limits]
     2103        foreach {vmin vmax} $_limits($tag) break
     2104        if { $min == "" || $min > $vmin } {
     2105            set min $vmin
     2106        }
     2107        if { $max == "" || $max < $vmax } {
     2108            set max $vmax
     2109        }
     2110    }
     2111    if { $min != "" && $max != "" } {
     2112        set _limits(v) [list $min $max]
     2113        set _limits($cname) [list $min $max]
     2114    }
     2115    return $_limits($cname)
    20982116}
    20992117
     
    25582576itcl::body Rappture::FlowvisViewer::SlicerTip {axis} {
    25592577    set val [$itk_component(${axis}CutScale) get]
    2560 #    set val [expr {0.01*($val-50)
    2561 #        *($_limits(${axis}max)-$_limits(${axis}min))
    2562 #          + 0.5*($_limits(${axis}max)+$_limits(${axis}min))}]
    25632578    return "Move the [string toupper $axis] cut plane.\nCurrently:  $axis = $val%"
    25642579}
     
    30143029    set _settings($this-zoom) $_view(zoom)
    30153030}
     3031
     3032# Reset global settings from dataset's settings.
     3033itcl::body Rappture::FlowvisViewer::BuildVolumeComponents {} {
     3034    $itk_component(volcomponents) choices delete 0 end
     3035    foreach name $_componentsList {
     3036        $itk_component(volcomponents) choices insert end $name $name
     3037    }
     3038    set _current [lindex $_componentsList 0]
     3039    $itk_component(volcomponents) value $_current
     3040}
     3041
     3042# Reset global settings from dataset's settings.
     3043itcl::body Rappture::FlowvisViewer::GetDatasetsWithComponent { cname } {
     3044    if { ![info exists _volcomponents($cname)] } {
     3045        return ""
     3046    }
     3047    set list ""
     3048    foreach tag $_volcomponents($cname) {
     3049        if { ![info exists _serverObjs($tag)] } {
     3050            continue
     3051        }
     3052        lappend list $tag
     3053    }
     3054    return $list
     3055}
Note: See TracChangeset for help on using the changeset viewer.