Changeset 3261 for branches


Ignore:
Timestamp:
Jan 24, 2013 11:12:29 AM (11 years ago)
Author:
gah
Message:

fix heightmap scale for stretch-to-fit mode

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/Rappture 1.2/gui/scripts/vtkheightmapviewer.tcl

    r3259 r3261  
    245245        x-scale                 1.0
    246246        y-scale                 1.0
     247        z-scale                 1.0
    247248    }]
    248249
     
    717718    global readyForNextFrame
    718719    set readyForNextFrame 1
     720    set _reset 1
    719721    set _hosts [GetServerList "vtkvis"]
    720722    if { "" == $_hosts } {
     
    917919        $_arcball resize $w $h
    918920        DoResize
     921        if { $_settings(stretch-to-fit) } {
     922            Adjustsetting stretch-to-fit
     923        }
    919924    }
    920925    if { $_reset } {
    921         InitSettings heightmap-mode
     926 puts stderr "initial settings"
     927        InitSettings heightmap-mode background
    922928        #
    923929        # Reset the camera and other view parameters
     
    925931        SendCmd "axis color all [Color2RGB $itk_option(-plotforeground)]"
    926932        SendCmd "axis lrot z 90"
    927         SendCmd "dataset maprange all"
     933        SendCmd "dataset maprange explicit $_limits(zmin) $_limits(zmax)"
    928934        set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)]
    929935        $_arcball quaternion $q
     
    14001406        "background" {
    14011407            set bgcolor [$itk_component(background) value]
     1408 puts stderr "set background to $bgcolor"
    14021409            array set fgcolors {
    14031410                "black" "white"
     
    14871494        "stretch-to-fit" {
    14881495            set bool $_settings(stretch-to-fit)
     1496            set _settings(x-scale) 1.0
     1497            set _settings(y-scale) 1.0
     1498            set _settings(z-scale) 1.0
    14891499            if { $bool } {
    14901500                set w $_width
     
    14921502                set xr [expr $_limits(xmax) - $_limits(xmin)]
    14931503                set yr [expr $_limits(ymax) - $_limits(ymin)]
    1494                 if { $yr < $xr } {
    1495                     set s [expr (double($h)*$xr) / (double($w)*$yr)]
    1496                     SendCmd "heightmap scale 1 $s 1"           
    1497                     set _settings(y-scale) $s
    1498                     set _settings(x-scale) 1.0
     1504                if { $h < $w } {
     1505                    set xs [expr (double($w)*$yr) / (double($h)*$xr)]
     1506                    set _settings(x-scale) $xs
    14991507                } else {
    1500                     set s [expr (double($w)*$yr) / (double($h)*$xr)]
    1501                     SendCmd "heightmap scale $s 1 1"
    1502                     set _settings(x-scale) $s
    1503                     set _settings(y-scale) 1.0
     1508                    set ys [expr (double($h)*$xr) / (double($w)*$yr)]
     1509                    set _settings(y-scale) $ys
     1510                    set _settings(z-scale) $ys
    15041511                }
    1505             } else {
    1506                 set _settings(x-scale) 1.0
    1507                 set _settings(y-scale) 1.0
    1508                 SendCmd "heightmap scale 1 1 1"
    15091512            }
     1513            SendCmd "heightmap scale $_settings(x-scale) $_settings(y-scale) $_settings(z-scale)"
     1514            # It kind of makes sense that I need to reset the camera
     1515            # whenever the scale changes.
     1516            Zoom reset
    15101517        }           
    15111518        "heightmap-mode" {
     
    18431850        append cmap "$x [Color2RGB $color] "
    18441851    }
     1852puts stderr "colormap $colors = ($cmap)"
    18451853    return $cmap
    18461854}
Note: See TracChangeset for help on using the changeset viewer.