Ignore:
Timestamp:
Mar 28, 2008, 1:48:13 PM (17 years ago)
Author:
gah
Message:

major overhaul of isomarkers

File:
1 edited

Legend:

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

    r966 r968  
    2222    private variable _canvas    ""
    2323    private variable _nvobj     "";     # Parent nanovis object.
     24    private variable _ivol      "";     # Id of volume that this marker is
     25                                        # associated with.
    2426    private variable _active_motion   0
    2527    private variable _active_press    0
     
    2729    private common   _activeIcon [Rappture::icon nvlegendmark2]
    2830
    29     constructor {c obj args} {
     31    constructor {c obj ivol args} {
    3032        set _canvas $c
    3133        set _nvobj $obj
    32        
     34        set _ivol $ivol
    3335        set w [winfo width $_canvas]
    3436        set h [winfo height $_canvas]
     
    5658    }
    5759    public method GetRelativeValue {} {
    58         array set limits [$_nvobj get_limits]
    59         if { $limits(vmax) == $limits(vmin) } {
    60             set limits(vmin) 0.0
    61             set limits(vmax) 1.0
     60        array set limits [$_nvobj GetLimits $_ivol]
     61        if { $limits(max) == $limits(min) } {
     62            if { $limits(max) == 0.0 } {
     63                set limits(min) 0.0
     64                set limits(max) 1.0
     65            } else {
     66                set limits(max) [expr $limits(min) + 1.0]
     67            }
    6268        }
    63         return [expr {($_value-$limits(vmin))/($limits(vmax) - $limits(vmin))}]
     69        return [expr {($_value-$limits(min))/($limits(max) - $limits(min))}]
    6470    }
    6571    public method Activate { bool } {
     
    102108    }
    103109    public method SetRelativeValue { x } {
    104         array set limits [$_nvobj get_limits]
    105         if { $limits(vmax) == $limits(vmin) } {
    106             set limits(vmin) 0.0
    107             set limits(vmax) 1.0
     110        array set limits [$_nvobj GetLimits $_ivol]
     111        if { $limits(max) == $limits(min) } {
     112            set limits(min) 0.0
     113            set limits(max) 1.0
    108114        }
    109         set r [expr $limits(vmax) - $limits(vmin)]
    110         SetAbsoluteValue [expr {($x * $r) + $limits(vmin)}]
     115        set r [expr $limits(max) - $limits(min)]
     116        SetAbsoluteValue [expr {($x * $r) + $limits(min)}]
    111117    }
    112118    public method HandleEvent { option args } {
     
    131137                SetRelativeValue [expr {double($x-10)/($w-20)}]
    132138                $_nvobj OverIsoMarker $this $x
    133                 $_nvobj UpdateTransferFunction
     139                foreach { dataobj comp } [$_nvobj GetDataObj $_ivol] break
     140                $_nvobj UpdateTransferFunction $dataobj $comp
    134141            }
    135142            end {
Note: See TracChangeset for help on using the changeset viewer.