Changeset 3974 for trunk/gui


Ignore:
Timestamp:
Oct 1, 2013 8:28:06 PM (11 years ago)
Author:
gah
Message:

fix in scale method to component overall limits for each component.

Location:
trunk/gui/scripts
Files:
2 edited

Legend:

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

    r3970 r3974  
    308308        SetRelativeValue $name $value
    309309    }
    310     UpdateViewer
    311310}
    312311
  • trunk/gui/scripts/vtkvolumeviewer.tcl

    r3969 r3974  
    539539# ----------------------------------------------------------------------
    540540itcl::body Rappture::VtkVolumeViewer::add {dataobj {settings ""}} {
     541    if { ![IsValidObject $dataobj] } {
     542        return;                         # Ignore invalid objects.
     543    }
    541544    array set params {
    542545        -color auto
     
    689692    array unset _limits
    690693    array unset _volcomponents
     694
    691695    foreach dataobj $args {
    692696        if { ![$dataobj isvalid] } {
    693697            continue;                     # Object doesn't contain valid data.
    694698        }
    695         foreach cname [$dataobj components] {
    696             array unset limits
    697             array set limits [$dataobj valueLimits $cname]
    698             set _limits($cname) $limits(v)
    699             if { ![info exists _volcomponents($cname)] } {
    700                 lappend _componentsList $cname
    701                 ComputeTransferFunction $cname
    702             }
    703             lappend _volcomponents($cname) $dataobj-$cname
    704         }
     699        # Determine limits for each axis.
    705700        foreach axis {x y z v} {
    706701            foreach { min max } [$dataobj limits $axis] break
     
    720715            }
    721716        }
    722     }
    723     BuildVolumeComponents
    724 
    725     foreach dataobj $args {
    726         foreach axis { x y z } {
    727             set lim [$dataobj limits $axis]
    728             if { ![info exists _limits($axis)] } {
    729                 set _limits($axis) $lim
    730                 continue
    731             }
    732             foreach {min max} $lim break
    733             foreach {amin amax} $_limits($axis) break
    734             if { $amin > $min } {
    735                 set amin $min
    736             }
    737             if { $amax < $max } {
    738                 set amax $max
    739             }
    740             set _limits($axis) [list $amin $amax]
    741         }
     717        # Determine limits for each field.
    742718        foreach { fname lim } [$dataobj fieldlimits] {
    743719            if { ![info exists _limits($fname)] } {
     
    755731            set _limits($fname) [list $fmin $fmax]
    756732        }
    757     }
     733        # Get limits for each component.
     734        foreach cname [$dataobj components] {
     735            if { ![info exists _volcomponents($cname)] } {
     736                lappend _componentsList $cname
     737            }
     738            lappend _volcomponents($cname) $dataobj-$cname
     739            array unset limits
     740            array set limits [$dataobj valueLimits $cname]
     741            foreach {min max} $limits(v) break
     742            if { ![info exists _limits($cname)] } {
     743                set vmin $min
     744                set vmax $max
     745            } else {
     746                if { $vmin > $min } {
     747                    set vmin $min
     748                }
     749                if { $vmax < $max } {
     750                    set vmax $max
     751                }
     752            }
     753            set _limits($cname) [list $vmin $vmax]
     754        }
     755    }
     756    BuildVolumeComponents
     757    updateTransferFunctions
    758758}
    759759
Note: See TracChangeset for help on using the changeset viewer.