Ignore:
Timestamp:
Feb 12, 2015, 3:31:03 PM (5 years ago)
Author:
ldelgass
Message:

Merge r5001:5003,r5005:5006 from trunk (whitespace)

Location:
branches/1.3
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/1.3

  • branches/1.3/gui/scripts/vtksurfaceviewer.tcl

    r4768 r5011  
    1 # -*- mode: tcl; indent-tabs-mode: nil -*- 
     1# -*- mode: tcl; indent-tabs-mode: nil -*-
    22# ----------------------------------------------------------------------
    33#  COMPONENT: vtksurfaceviewer - Vtk 3D boundary surface viewer
     
    5757    public method get {args}
    5858    public method isconnected {}
    59     public method parameters {title args} { 
    60         # do nothing 
     59    public method parameters {title args} {
     60        # do nothing
    6161    }
    6262    public method scale {args}
     
    6767    private method BuildCameraTab {}
    6868    private method BuildColormap { name }
    69     private method BuildDownloadPopup { widget command } 
     69    private method BuildDownloadPopup { widget command }
    7070    private method BuildSurfaceTab {}
    7171    private method Combo { option }
     
    7676    private method DoRotate {}
    7777    private method DrawLegend {}
    78     private method EnterLegend { x y } 
    79     private method EventuallyRequestLegend {} 
    80     private method EventuallyResize { w h } 
    81     private method EventuallyRotate { q } 
    82     private method GetImage { args } 
    83     private method GetVtkData { args } 
     78    private method EnterLegend { x y }
     79    private method EventuallyRequestLegend {}
     80    private method EventuallyResize { w h }
     81    private method EventuallyRotate { q }
     82    private method GetImage { args }
     83    private method GetVtkData { args }
    8484    private method InitSettings { args  }
    85     private method IsValidObject { dataobj } 
     85    private method IsValidObject { dataobj }
    8686    private method LeaveLegend {}
    87     private method MotionLegend { x y } 
     87    private method MotionLegend { x y }
    8888    private method Pan {option x y}
    8989    private method PanCamera {}
    9090    private method Pick {x y}
    91     private method QuaternionToView { q } { 
     91    private method QuaternionToView { q } {
    9292        foreach { _view(-qw) _view(-qx) _view(-qy) _view(-qz) } $q break
    9393    }
     
    103103    private method SetOrientation { side }
    104104    private method UpdateContourList {}
    105     private method ViewToQuaternion {} { 
     105    private method ViewToQuaternion {} {
    106106        return [list $_view(-qw) $_view(-qx) $_view(-qy) $_view(-qz)]
    107107    }
     
    113113    private variable _obj2datasets
    114114    private variable _obj2ovride   ;    # maps dataobj => style override
    115     private variable _datasets     ;    # contains all the dataobj-component 
     115    private variable _datasets     ;    # contains all the dataobj-component
    116116                                   ;    # datasets in the server
    117117    private variable _colormaps    ;    # contains all the colormaps
     
    148148    private variable _legendPending 0
    149149    private variable _field      ""
    150     private variable _colorMode "scalar";       #  Mode of colormap (vmag or scalar)
    151     private variable _fieldNames {} 
    152     private variable _fields 
     150    private variable _colorMode "scalar";        #  Mode of colormap (vmag or scalar)
     151    private variable _fieldNames {}
     152    private variable _fields
    153153    private variable _curFldName ""
    154154    private variable _curFldLabel ""
     
    243243    itk_component add fieldmenu {
    244244        menu $itk_component(plotarea).menu -bg black -fg white -relief flat \
    245             -tearoff 0 
     245            -tearoff 0
    246246    } {
    247247        usual
     
    263263
    264264    set _map(id) [$c create image 0 0 -anchor nw -image $_image(plot)]
    265     set _map(cwidth) -1 
    266     set _map(cheight) -1 
     265    set _map(cwidth) -1
     266    set _map(cheight) -1
    267267    set _map(zoom) 1.0
    268268    set _map(original) ""
     
    311311            -offimage [Rappture::icon volume-off] \
    312312            -variable [itcl::scope _settings(-surfacevisible)] \
    313             -command [itcl::code $this AdjustSetting -surfacevisible] 
     313            -command [itcl::code $this AdjustSetting -surfacevisible]
    314314    }
    315315    $itk_component(surface) select
     
    329329    set _image(legend) [image create photo]
    330330    itk_component add legend {
    331         canvas $itk_component(plotarea).legend -width 50 -highlightthickness 0 
     331        canvas $itk_component(plotarea).legend -width 50 -highlightthickness 0
    332332    } {
    333333        usual
     
    336336    }
    337337
    338     # Hack around the Tk panewindow.  The problem is that the requested 
     338    # Hack around the Tk panewindow.  The problem is that the requested
    339339    # size of the 3d view isn't set until an image is retrieved from
    340340    # the server.  So the panewindow uses the tiny size.
     
    342342    pack forget $itk_component(view)
    343343    blt::table $itk_component(plotarea) \
    344         0,0 $itk_component(view) -fill both -reqwidth $w 
     344        0,0 $itk_component(view) -fill both -reqwidth $w
    345345    blt::table configure $itk_component(plotarea) c1 -resize none
    346346
     
    429429
    430430itcl::body Rappture::VtkSurfaceViewer::DoRotate {} {
    431     SendCmd "camera orient [ViewToQuaternion]" 
     431    SendCmd "camera orient [ViewToQuaternion]"
    432432    set _rotatePending 0
    433433}
     
    456456    if { !$_rotatePending } {
    457457        set _rotatePending 1
    458         global rotate_delay 
     458        global rotate_delay
    459459        $_dispatcher event -after $rotate_delay !rotate
    460460    }
     
    555555                    continue
    556556                }
    557                 if {[info exists _obj2ovride($dataobj-raise)] && 
     557                if {[info exists _obj2ovride($dataobj-raise)] &&
    558558                    $_obj2ovride($dataobj-raise)} {
    559559                    set dlist [linsert $dlist 0 $dataobj]
     
    583583            }
    584584            return $dlist
    585         }           
     585        }
    586586        -image {
    587587            if {[llength $args] != 2} {
     
    819819        #set w [image width $_image(plot)]
    820820        #set h [image height $_image(plot)]
    821         #puts stderr "$date: received image ${w}x${h} image"       
     821        #puts stderr "$date: received image ${w}x${h} image"
    822822        if { $_start > 0 } {
    823823            set finish [clock clicks -milliseconds]
     
    890890    # Turn on buffering of commands to the server.  We don't want to
    891891    # be preempted by a server disconnect/reconnect (which automatically
    892     # generates a new call to Rebuild).   
     892    # generates a new call to Rebuild).
    893893    StartBufferingCommands
    894894
     
    960960
    961961    if { $_first != "" } {
    962         $itk_component(field) choices delete 0 end
    963         $itk_component(fieldmenu) delete 0 end
    964         array unset _fields
     962        $itk_component(field) choices delete 0 end
     963        $itk_component(fieldmenu) delete 0 end
     964        array unset _fields
    965965        set _curFldName ""
    966966        foreach cname [$_first components] {
     
    990990    InitSettings -isolinesvisible -surfacevisible -outline
    991991    if { $_reset } {
    992         # These are settings that rely on a dataset being loaded.
     992        # These are settings that rely on a dataset being loaded.
    993993        InitSettings \
    994994            -surfacelighting \
    995995            -field \
    996996            -surfaceedges -surfacelighting -surfaceopacity \
    997             -surfacewireframe \
     997            -surfacewireframe \
    998998            -numcontours
    999999
    10001000        Zoom reset
    1001         foreach axis { x y z } {
     1001        foreach axis { x y z } {
    10021002            # Another problem fixed by a <view>. We looking into a data
    10031003            # object for the name of the axes. This should be global to
    10041004            # the viewer itself.
    1005             set label [$_first hints ${axis}label]
    1006             if { $label == "" } {
     1005            set label [$_first hints ${axis}label]
     1006            if { $label == "" } {
    10071007                set label [string toupper $axis]
    1008             }
    1009             # May be a space in the axis label.
    1010             SendCmd [list axis name $axis $label]
     1008            }
     1009            # May be a space in the axis label.
     1010            SendCmd [list axis name $axis $label]
    10111011        }
    10121012        if { [array size _fields] < 2 } {
     
    10321032itcl::body Rappture::VtkSurfaceViewer::CurrentDatasets {args} {
    10331033    set flag [lindex $args 0]
    1034     switch -- $flag { 
     1034    switch -- $flag {
    10351035        "-all" {
    10361036            if { [llength $args] > 1 } {
     
    10511051                set dlist [get -visible]
    10521052            }
    1053         }           
     1053        }
    10541054        default {
    10551055            set dlist $args
     
    11701170    foreach tag [CurrentDatasets -visible] {
    11711171        SendCmd "dataset getscalar pixel $x $y $tag"
    1172     } 
     1172    }
    11731173}
    11741174
     
    12741274        "-background" {
    12751275            set bgcolor [$itk_component(background) value]
    1276             array set fgcolors {
    1277                 "black" "white"
    1278                 "white" "black"
    1279                 "grey"  "black"
    1280             }
     1276            array set fgcolors {
     1277                "black" "white"
     1278                "white" "black"
     1279                "grey"  "black"
     1280            }
    12811281            configure -plotbackground $bgcolor \
    1282                 -plotforeground $fgcolors($bgcolor)
    1283             $itk_component(view) delete "legend"
    1284             DrawLegend
     1282                -plotforeground $fgcolors($bgcolor)
     1283            $itk_component(view) delete "legend"
     1284            DrawLegend
    12851285        }
    12861286        "-colormap" {
     
    12891289            set color [$itk_component(colormap) value]
    12901290            set _settings($what) $color
    1291             if { $color == "none" } {
    1292                 if { $_settings(-colormapvisible) } {
    1293                     SendCmd "contour2d colormode constant {}"
     1291            if { $color == "none" } {
     1292                if { $_settings(-colormapvisible) } {
     1293                    SendCmd "contour2d colormode constant {}"
    12941294                    SendCmd "polydata colormode constant {}"
    1295                     set _settings(-colormapvisible) 0
    1296                 }
    1297             } else {
    1298                 if { !$_settings(-colormapvisible) } {
    1299                     #SendCmd "contour2d colormode $_colorMode $_curFldName"
     1295                    set _settings(-colormapvisible) 0
     1296                }
     1297            } else {
     1298                if { !$_settings(-colormapvisible) } {
     1299                    #SendCmd "contour2d colormode $_colorMode $_curFldName"
    13001300                    SendCmd "polydata colormode $_colorMode $_curFldName"
    1301                     set _settings(-colormapvisible) 1
    1302                 }
    1303                 SetCurrentColormap $color
     1301                    set _settings(-colormapvisible) 1
     1302                }
     1303                SetCurrentColormap $color
    13041304                if {$_settings(-colormapdiscrete)} {
    13051305                    set numColors [expr $_settings(-numcontours) + 1]
    13061306                    SendCmd "colormap res $numColors $color"
    13071307                }
    1308             }
     1308            }
    13091309            StopBufferingCommands
    1310             EventuallyRequestLegend
     1310            EventuallyRequestLegend
    13111311        }
    13121312        "-colormapdiscrete" {
     
    13571357        "-isolinecolor" {
    13581358            set color [$itk_component(isolineColor) value]
    1359             set _settings($what) $color
     1359            set _settings($what) $color
    13601360            SendCmd "contour2d linecolor [Color2RGB $color]"
    1361             DrawLegend
     1361            DrawLegend
    13621362        }
    13631363        "-isolinesvisible" {
    13641364            set bool $_settings($what)
    1365             SendCmd "contour2d visible $bool"
    1366             DrawLegend
     1365            SendCmd "contour2d visible $bool"
     1366            DrawLegend
    13671367        }
    13681368        "-legendvisible" {
    13691369            if { !$_settings($what) } {
    13701370                $itk_component(view) delete legend
    1371             }
    1372             DrawLegend
     1371            }
     1372            DrawLegend
    13731373        }
    13741374        "-numcontours" {
     
    13881388        "-outline" {
    13891389            set bool $_settings($what)
    1390             SendCmd "outline visible $bool"
     1390            SendCmd "outline visible $bool"
    13911391        }
    13921392        "-surfaceedges" {
    13931393            set bool $_settings($what)
    1394             SendCmd "polydata edges $bool"
     1394            SendCmd "polydata edges $bool"
    13951395        }
    13961396        "-surfacelighting" {
    13971397            set bool $_settings($what)
    1398             SendCmd "polydata lighting $bool"
     1398            SendCmd "polydata lighting $bool"
    13991399        }
    14001400        "-surfaceopacity" {
    14011401            set val $_settings($what)
    14021402            set sval [expr { 0.01 * double($val) }]
    1403             SendCmd "polydata opacity $sval"
     1403            SendCmd "polydata opacity $sval"
    14041404        }
    14051405        "-surfacevisible" {
    14061406            set bool $_settings($what)
    1407             SendCmd "polydata visible $bool"
     1407            SendCmd "polydata visible $bool"
    14081408            if { $bool } {
    14091409                Rappture::Tooltip::for $itk_component(surface) \
     
    14131413                    "Show the surface"
    14141414            }
    1415             DrawLegend
     1415            DrawLegend
    14161416        }
    14171417        "-surfacewireframe" {
    14181418            set bool $_settings($what)
    1419             SendCmd "polydata wireframe $bool"
     1419            SendCmd "polydata wireframe $bool"
    14201420        }
    14211421        "-xgrid" - "-ygrid" - "-zgrid" {
     
    14341434#
    14351435#       Request a new legend from the server.  The size of the legend
    1436 #       is determined from the height of the canvas. 
     1436#       is determined from the height of the canvas.
    14371437#
    14381438# This should be called when
    1439 #       1.  A new current colormap is set.
    1440 #       2.  Window is resized.
    1441 #       3.  The limits of the data have changed.  (Just need a redraw).
    1442 #       4.  Number of isolines have changed. (Just need a redraw).
    1443 #       5.  Legend becomes visible (Just need a redraw).
     1439#        1.  A new current colormap is set.
     1440#        2.  Window is resized.
     1441#        3.  The limits of the data have changed.  (Just need a redraw).
     1442#        4.  Number of isolines have changed. (Just need a redraw).
     1443#        5.  Legend becomes visible (Just need a redraw).
    14441444#
    14451445itcl::body Rappture::VtkSurfaceViewer::RequestLegend {} {
     
    14571457    }
    14581458    if { [string match "component*" $fname] } {
    1459         set title ""
     1459        set title ""
    14601460    } else {
    1461         if { [info exists _fields($fname)] } {
    1462             foreach { title units } $_fields($fname) break
    1463             if { $units != "" } {
    1464                 set title [format "%s (%s)" $title $units]
    1465             }
    1466         } else {
    1467             set title $fname
    1468         }
     1461        if { [info exists _fields($fname)] } {
     1462            foreach { title units } $_fields($fname) break
     1463            if { $units != "" } {
     1464                set title [format "%s (%s)" $title $units]
     1465            }
     1466        } else {
     1467            set title $fname
     1468        }
    14691469    }
    14701470    # If there's a title too, subtract one more line
    14711471    if { $title != "" } {
    1472         incr h -$lineht 
     1472        incr h -$lineht
    14731473    }
    14741474    # Set the legend on the first heightmap dataset.
    14751475    if { $_currentColormap != ""  } {
    1476         set cmap $_currentColormap
    1477         SendCmdNoWait "legend $cmap scalar $_curFldName {} $w $h 0"
     1476        set cmap $_currentColormap
     1477        SendCmdNoWait "legend $cmap scalar $_curFldName {} $w $h 0"
    14781478    }
    14791479}
     
    14951495    if { [isconnected] } {
    14961496        set rgb [Color2RGB $itk_option(-plotforeground)]
    1497         SendCmd "axis color all $rgb"
     1497        SendCmd "axis color all $rgb"
    14981498        SendCmd "outline color $rgb"
    14991499    }
     
    15581558        -font "Arial 9"
    15591559
    1560     label $inner.linecolor_l -text "Isolines" -font "Arial 9" 
     1560    label $inner.linecolor_l -text "Isolines" -font "Arial 9"
    15611561    itk_component add isolineColor {
    15621562        Rappture::Combobox $inner.linecolor -width 10 -editable 0
     
    15721572        "red"                "red"              \
    15731573        "white"              "white"            \
    1574         "none"               "none"
     1574        "none"               "none"
    15751575
    15761576    $itk_component(isolineColor) value "white"
    15771577    bind $inner.linecolor <<Value>> \
    1578         [itcl::code $this AdjustSetting -isolinecolor]
    1579 
    1580     label $inner.background_l -text "Background" -font "Arial 9" 
     1578        [itcl::code $this AdjustSetting -isolinecolor]
     1579
     1580    label $inner.background_l -text "Background" -font "Arial 9"
    15811581    itk_component add background {
    15821582        Rappture::Combobox $inner.background -width 10 -editable 0
     
    15851585        "black"              "black"            \
    15861586        "white"              "white"            \
    1587         "grey"               "grey"             
     1587        "grey"               "grey"
    15881588
    15891589    $itk_component(background) value $_settings(-background)
     
    15991599
    16001600    itk_component add field_l {
    1601         label $inner.field_l -text "Field" -font "Arial 9" 
     1601        label $inner.field_l -text "Field" -font "Arial 9"
    16021602    } {
    16031603        ignore -font
     
    16091609        [itcl::code $this AdjustSetting -field]
    16101610
    1611     label $inner.colormap_l -text "Colormap" -font "Arial 9" 
     1611    label $inner.colormap_l -text "Colormap" -font "Arial 9"
    16121612    itk_component add colormap {
    16131613        Rappture::Combobox $inner.colormap -width 10 -editable 0
     
    16351635        2,0 $inner.linecolor_l  -anchor w -pady 2  \
    16361636        2,1 $inner.linecolor    -anchor w -pady 2 -fill x  \
    1637         3,0 $inner.background_l -anchor w -pady 2 \
    1638         3,1 $inner.background -anchor w -pady 2  -fill x \
     1637        3,0 $inner.background_l -anchor w -pady 2 \
     1638        3,1 $inner.background -anchor w -pady 2  -fill x \
    16391639        4,0 $inner.numcontours_l -anchor w -pady 2 \
    16401640        4,1 $inner.numcontours -anchor w -pady 2 \
     
    16741674        -command [itcl::code $this AdjustSetting -axislabels] \
    16751675        -font "Arial 9"
    1676     label $inner.grid_l -text "Grid" -font "Arial 9" 
     1676    label $inner.grid_l -text "Grid" -font "Arial 9"
    16771677    checkbutton $inner.xgrid \
    16781678        -text "X" \
     
    16961696        -font "Arial 9"
    16971697
    1698     label $inner.mode_l -text "Mode" -font "Arial 9" 
     1698    label $inner.mode_l -text "Mode" -font "Arial 9"
    16991699
    17001700    itk_component add axisMode {
     
    17051705        "closest_triad"   "closest" \
    17061706        "furthest_triad"  "farthest" \
    1707         "outer_edges"     "outer"         
     1707        "outer_edges"     "outer"
    17081708    $itk_component(axisMode) value $_settings(-axismode)
    17091709    bind $inner.mode <<Value>> [itcl::code $this AdjustSetting -axismode]
     
    17771777
    17781778#
    1779 #  camera -- 
     1779#  camera --
    17801780#
    17811781itcl::body Rappture::VtkSurfaceViewer::camera {option args} {
    1782     switch -- $option { 
     1782    switch -- $option {
    17831783        "show" {
    17841784            puts [array get _view]
     
    18281828
    18291829itcl::body Rappture::VtkSurfaceViewer::GetImage { args } {
    1830     if { [image width $_image(download)] > 0 && 
     1830    if { [image width $_image(download)] > 0 &&
    18311831         [image height $_image(download)] > 0 } {
    18321832        set bytes [$_image(download) data -format "jpeg -quality 100"]
     
    18411841        -title "[Rappture::filexfer::label downloadWord] as..."
    18421842    set inner [$popup component inner]
    1843     label $inner.summary -text "" -anchor w 
     1843    label $inner.summary -text "" -anchor w
    18441844    radiobutton $inner.vtk_button -text "VTK data file" \
    18451845        -variable [itcl::scope _downloadPopup(format)] \
    18461846        -font "Arial 9 " \
    1847         -value vtk 
     1847        -value vtk
    18481848    Rappture::Tooltip::for $inner.vtk_button "Save as VTK data file."
    18491849    radiobutton $inner.image_button -text "Image File" \
    18501850        -variable [itcl::scope _downloadPopup(format)] \
    18511851        -font "Arial 9 " \
    1852         -value image 
     1852        -value image
    18531853    Rappture::Tooltip::for $inner.image_button \
    18541854        "Save as digital image."
     
    18711871        2,0 $inner.image_button -anchor w -cspan 2 -padx { 4 0 } \
    18721872        4,1 $inner.cancel -width .9i -fill y \
    1873         4,0 $inner.ok -padx 2 -width .9i -fill y 
     1873        4,0 $inner.ok -padx 2 -width .9i -fill y
    18741874    blt::table configure $inner r3 -height 4
    18751875    blt::table configure $inner r4 -pady 4
     
    19321932    set _settings(-isolinesvisible) $style(-isolinesvisible)
    19331933    set _settings(-surfacevisible) $style(-surfacevisible)
    1934  
     1934
    19351935    SendCmd "outline add $tag"
    19361936    SendCmd "outline color [Color2RGB $itk_option(-plotforeground)] $tag"
     
    19481948    SendCmd "polydata opacity $style(-opacity) $tag"
    19491949    set _settings(-surfaceopacity) [expr $style(-opacity) * 100.0]
    1950     SetCurrentColormap $style(-color) 
     1950    SetCurrentColormap $style(-color)
    19511951    SendCmd "polydata wireframe $style(-wireframe) $tag"
    19521952    set _settings(-surfacewireframe) $style(-wireframe)
     
    20032003    set font "Arial 8"
    20042004    set lineht [font metrics $font -linespace]
    2005    
     2005
    20062006    set ih [image height $_image(legend)]
    20072007    set iy [expr $y - ($lineht + 2)]
    20082008
    20092009    if { [string match "component*" $fname] } {
    2010         set title ""
     2010        set title ""
    20112011    } else {
    2012         if { [info exists _fields($fname)] } {
    2013             foreach { title units } $_fields($fname) break
    2014             if { $units != "" } {
    2015                 set title [format "%s (%s)" $title $units]
    2016             }
    2017         } else {
    2018             set title $fname
    2019         }
     2012        if { [info exists _fields($fname)] } {
     2013            foreach { title units } $_fields($fname) break
     2014            if { $units != "" } {
     2015                set title [format "%s (%s)" $title $units]
     2016            }
     2017        } else {
     2018            set title $fname
     2019        }
    20202020    }
    20212021    # If there's a legend title, increase the offset by the line height.
     
    20312031    }
    20322032    set color [eval format "\#%02x%02x%02x" $pixel]
    2033     $_image(swatch) put black  -to 0 0 23 23 
    2034     $_image(swatch) put $color -to 1 1 22 22 
     2033    $_image(swatch) put black  -to 0 0 23 23
     2034    $_image(swatch) put $color -to 1 1 22 22
    20352035    .rappturetooltip configure -icon $_image(swatch)
    20362036
     
    20432043        set value 0.0
    20442044    }
    2045     set tx [expr $x + 15] 
     2045    set tx [expr $x + 15]
    20462046    set ty [expr $y - 5]
    20472047    if { [info exists _isolines($y)] } {
     
    20502050        Rappture::Tooltip::text $c [format "$title %g" $value]
    20512051    }
    2052     Rappture::Tooltip::tooltip show $c +$tx,+$ty   
    2053 }
    2054 
    2055 #
    2056 # ReceiveLegend -- 
    2057 #
    2058 #       Invoked automatically whenever the "legend" command comes in from
    2059 #       the rendering server.  Indicates that binary image data with the
    2060 #       specified <size> will follow.
     2052    Rappture::Tooltip::tooltip show $c +$tx,+$ty
     2053}
     2054
     2055#
     2056# ReceiveLegend --
     2057#
     2058#        Invoked automatically whenever the "legend" command comes in from
     2059#        the rendering server.  Indicates that binary image data with the
     2060#        specified <size> will follow.
    20612061#
    20622062itcl::body Rappture::VtkSurfaceViewer::ReceiveLegend { colormap title min max size } {
    20632063    #puts stderr "ReceiveLegend colormap=$colormap title=$title range=$min,$max size=$size"
    20642064    set _title $title
    2065     regsub {\(mag\)} $title "" _title 
     2065    regsub {\(mag\)} $title "" _title
    20662066    if { [IsConnected] } {
    20672067        set bytes [ReceiveBytes $size]
     
    20722072        #puts stderr "read $size bytes for [image width $_image(legend)]x[image height $_image(legend)] legend>"
    20732073        if { [catch {DrawLegend} errs] != 0 } {
    2074             global errorInfo
    2075             puts stderr "errs=$errs errorInfo=$errorInfo"
     2074            global errorInfo
     2075            puts stderr "errs=$errs errorInfo=$errorInfo"
    20762076        }
    20772077    }
     
    20922092
    20932093    if { [string match "component*" $fname] } {
    2094         set title ""
     2094        set title ""
    20952095    } else {
    2096         if { [info exists _fields($fname)] } {
    2097             foreach { title units } $_fields($fname) break
    2098             if { $units != "" } {
    2099                 set title [format "%s (%s)" $title $units]
    2100             }
    2101         } else {
    2102             set title $fname
    2103         }
     2096        if { [info exists _fields($fname)] } {
     2097            foreach { title units } $_fields($fname) break
     2098            if { $units != "" } {
     2099                set title [format "%s (%s)" $title $units]
     2100            }
     2101        } else {
     2102            set title $fname
     2103        }
    21042104    }
    21052105    set x [expr $w - 2]
    21062106    if { !$_settings(-legendvisible) } {
    2107         $c delete legend
    2108         return
    2109     } 
     2107        $c delete legend
     2108        return
     2109    }
    21102110    if { [$c find withtag "legend"] == "" } {
    2111         set y 2
    2112         # If there's a legend title, create a text item for the title.
     2111        set y 2
     2112        # If there's a legend title, create a text item for the title.
    21132113        $c create text $x $y \
    2114             -anchor ne \
    2115             -fill $itk_option(-plotforeground) -tags "title legend" \
    2116             -font $font
     2114            -anchor ne \
     2115            -fill $itk_option(-plotforeground) -tags "title legend" \
     2116            -font $font
    21172117        if { $title != "" } {
    21182118            incr y $lineht
    21192119        }
    2120         $c create text $x $y \
    2121             -anchor ne \
    2122             -fill $itk_option(-plotforeground) -tags "vmax legend" \
    2123             -font $font
    2124         incr y $lineht
    2125         $c create image $x $y \
    2126             -anchor ne \
    2127             -image $_image(legend) -tags "colormap legend"
    2128         $c create rectangle $x $y 1 1 \
    2129             -fill "" -outline "" -tags "sensor legend"
    2130         $c create text $x [expr {$h-2}] \
    2131             -anchor se \
    2132             -fill $itk_option(-plotforeground) -tags "vmin legend" \
    2133             -font $font
    2134         $c bind sensor <Enter> [itcl::code $this EnterLegend %x %y]
    2135         $c bind sensor <Leave> [itcl::code $this LeaveLegend]
    2136         $c bind sensor <Motion> [itcl::code $this MotionLegend %x %y]
     2120        $c create text $x $y \
     2121            -anchor ne \
     2122            -fill $itk_option(-plotforeground) -tags "vmax legend" \
     2123            -font $font
     2124        incr y $lineht
     2125        $c create image $x $y \
     2126            -anchor ne \
     2127            -image $_image(legend) -tags "colormap legend"
     2128        $c create rectangle $x $y 1 1 \
     2129            -fill "" -outline "" -tags "sensor legend"
     2130        $c create text $x [expr {$h-2}] \
     2131            -anchor se \
     2132            -fill $itk_option(-plotforeground) -tags "vmin legend" \
     2133            -font $font
     2134        $c bind sensor <Enter> [itcl::code $this EnterLegend %x %y]
     2135        $c bind sensor <Leave> [itcl::code $this LeaveLegend]
     2136        $c bind sensor <Motion> [itcl::code $this MotionLegend %x %y]
    21372137    }
    21382138    $c delete isoline
     
    21532153        }
    21542154        set tags "isoline legend"
    2155         set offset [expr 2 + $lineht]
    2156         if { $title != "" } {
    2157             incr offset $lineht
    2158         }
     2155        set offset [expr 2 + $lineht]
     2156        if { $title != "" } {
     2157            incr offset $lineht
     2158        }
    21592159        foreach value $_contourList {
    21602160            set norm [expr 1.0 - (($value - $vmin) / $range)]
     
    21752175    if { [info exists _limits($_curFldName)] } {
    21762176        foreach { vmin vmax } $_limits($_curFldName) break
    2177         $c itemconfigure vmin -text [format %g $vmin]
    2178         $c itemconfigure vmax -text [format %g $vmax]
     2177        $c itemconfigure vmin -text [format %g $vmin]
     2178        $c itemconfigure vmax -text [format %g $vmax]
    21792179    }
    21802180    set y 2
     
    21822182    if { $title != "" } {
    21832183        $c itemconfigure title -text $title
    2184         $c coords title $x $y
    2185         incr y $lineht
     2184        $c coords title $x $y
     2185        incr y $lineht
    21862186        $c raise title
    21872187    }
     
    22062206# ----------------------------------------------------------------------
    22072207itcl::body Rappture::VtkSurfaceViewer::Combo {option} {
    2208     set c $itk_component(view) 
     2208    set c $itk_component(view)
    22092209    switch -- $option {
    22102210        post {
     
    22212221        }
    22222222        deactivate {
    2223             $c itemconfigure title -fill $itk_option(-plotforeground) 
     2223            $c itemconfigure title -fill $itk_option(-plotforeground)
    22242224        }
    22252225        invoke {
     
    22392239    # Keep track of the colormaps that we build.
    22402240    if { ![info exists _colormaps($name)] } {
    2241         BuildColormap $name 
     2241        BuildColormap $name
    22422242        set _colormaps($name) 1
    22432243    }
     
    22612261}
    22622262
    2263 itcl::body Rappture::VtkSurfaceViewer::SetOrientation { side } { 
     2263itcl::body Rappture::VtkSurfaceViewer::SetOrientation { side } {
    22642264    array set positions {
    22652265        front "1 0 0 0"
     
    22822282}
    22832283
    2284 itcl::body Rappture::VtkSurfaceViewer::UpdateContourList {} { 
     2284itcl::body Rappture::VtkSurfaceViewer::UpdateContourList {} {
    22852285    if { ![info exists _limits($_curFldName)] } {
    22862286        return
Note: See TracChangeset for help on using the changeset viewer.