Changeset 3912 for trunk/gui


Ignore:
Timestamp:
Sep 9, 2013 3:07:23 PM (11 years ago)
Author:
gah
Message:

add check to automatically set -stretchtofit when x and y axis scales differ greatly

File:
1 edited

Legend:

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

    r3899 r3912  
    124124    private variable _currentOpacity ""
    125125
     126    private variable _maxScale 100;     # This is the # of times the x-axis
     127                                        # and y-axis ranges can differ before
     128                                        # automatically turning on
     129                                        # -stretchtofit
     130
    126131    private variable _click        ;    # info used for rotate operations
    127132    private variable _limits       ;    # Holds overall limits for all dataobjs
     
    645650            set _limits($fname) [list $fmin $fmax]
    646651        }
     652    }
     653    # Check if the range of the x and y axes requires that we stretch
     654    # the contour to fit the plotting area.  This can happen when the
     655    # x and y scales differ greatly (> 100x)
     656    foreach {xmin xmax} $_limits(x) break
     657    foreach {ymin ymax} $_limits(y) break
     658    if { (($xmax - $xmin) > (($ymax -$ymin) * $_maxScale)) ||
     659         ((($xmax - $xmin) * $_maxScale) < ($ymax -$ymin)) } {
     660        set _settings(stretchToFit) 1
    647661    }
    648662}
     
    22642278        $itk_component(colormap) value $style(-color)
    22652279    }
     2280    if { [info exists style(-stretchtofit)] } {
     2281        set _settings(stretchToFit) $style(-stretchtofit)
     2282        AdjustSetting stretchToFit
     2283    }
    22662284    set _currentOpacity $style(-opacity)
    22672285    if { $_currentNumIsolines != $style(-levels) } {
Note: See TracChangeset for help on using the changeset viewer.