Changeset 4953


Ignore:
Timestamp:
Jan 26, 2015 10:31:00 PM (7 years ago)
Author:
dkearney
Message:

cleaning up spaces and tabs

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/uiuc_vtk_viewers/gui/scripts/vtkisosurfaceviewer.tcl

    r4942 r4953  
    1 # -*- mode: tcl; indent-tabs-mode: nil -*- 
     1# -*- mode: tcl; indent-tabs-mode: nil -*-
    22# ----------------------------------------------------------------------
    33#  COMPONENT: vtkisosurfaceviewer - Vtk 3D contour object 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}
     
    6868    private method BuildColormap { name }
    6969    private method BuildCutplaneTab {}
    70     private method BuildDownloadPopup { widget command } 
     70    private method BuildDownloadPopup { widget command }
    7171    private method BuildIsosurfaceTab {}
    7272    private method Combo { option }
     
    7878    private method DoRotate {}
    7979    private method DrawLegend {}
    80     private method EnterLegend { x y } 
    81     private method EventuallyChangeContourLevels {} 
    82     private method EventuallyRequestLegend {} 
    83     private method EventuallyResize { w h } 
    84     private method EventuallyRotate { q } 
    85     private method EventuallySetCutplane { axis args } 
     80    private method EnterLegend { x y }
     81    private method EventuallyChangeContourLevels {}
     82    private method EventuallyRequestLegend {}
     83    private method EventuallyResize { w h }
     84    private method EventuallyRotate { q }
     85    private method EventuallySetCutplane { axis args }
    8686    private method GenerateContourList {}
    87     private method GetImage { args } 
    88     private method GetVtkData { args } 
     87    private method GetImage { args }
     88    private method GetVtkData { args }
    8989    private method InitSettings { args  }
    90     private method IsValidObject { dataobj } 
     90    private method IsValidObject { dataobj }
    9191    private method LeaveLegend {}
    92     private method MotionLegend { x y } 
     92    private method MotionLegend { x y }
    9393    private method Pan {option x y}
    9494    private method PanCamera {}
    9595    private method Pick {x y}
    96     private method QuaternionToView { q } { 
     96    private method QuaternionToView { q } {
    9797        foreach { _view(-qw) _view(-qx) _view(-qy) _view(-qz) } $q break
    9898    }
     
    109109    private method SetOrientation { side }
    110110    private method Slice {option args}
    111     private method ViewToQuaternion {} { 
     111    private method ViewToQuaternion {} {
    112112        return [list $_view(-qw) $_view(-qx) $_view(-qy) $_view(-qz)]
    113113    }
     
    119119    private variable _obj2datasets
    120120    private variable _obj2ovride   ;    # maps dataobj => style override
    121     private variable _datasets     ;    # contains all the dataobj-component 
     121    private variable _datasets     ;    # contains all the dataobj-component
    122122                                   ;    # datasets in the server
    123123    private variable _colormaps    ;    # contains all the colormaps
     
    157157    private variable _legendPending 0
    158158    private variable _field      ""
    159     private variable _colorMode "scalar";       #  Mode of colormap (vmag or scalar)
    160     private variable _fieldNames {} 
    161     private variable _fields 
     159    private variable _colorMode "scalar";   #  Mode of colormap (vmag or scalar)
     160    private variable _fieldNames {}
     161    private variable _fields
    162162    private variable _curFldName ""
    163163    private variable _curFldLabel ""
     
    294294    itk_component add fieldmenu {
    295295        menu $itk_component(plotarea).menu -bg black -fg white -relief flat \
    296             -tearoff 0 
     296            -tearoff 0
    297297    } {
    298298        usual
     
    314314
    315315    set _map(id) [$c create image 0 0 -anchor nw -image $_image(plot)]
    316     set _map(cwidth) -1 
    317     set _map(cheight) -1 
     316    set _map(cwidth) -1
     317    set _map(cheight) -1
    318318    set _map(zoom) 1.0
    319319    set _map(original) ""
     
    362362            -offimage [Rappture::icon volume-off] \
    363363            -variable [itcl::scope _settings(-isosurfacevisible)] \
    364             -command [itcl::code $this AdjustSetting -isosurfacevisible] 
     364            -command [itcl::code $this AdjustSetting -isosurfacevisible]
    365365    }
    366366    $itk_component(contour) select
     
    374374            -offimage [Rappture::icon cutbutton] \
    375375            -variable [itcl::scope _settings(-cutplanesvisible)] \
    376             -command [itcl::code $this AdjustSetting -cutplanesvisible] 
     376            -command [itcl::code $this AdjustSetting -cutplanesvisible]
    377377    }
    378378    Rappture::Tooltip::for $itk_component(cutplane) \
     
    393393    set _image(legend) [image create photo]
    394394    itk_component add legend {
    395         canvas $itk_component(plotarea).legend -width 50 -highlightthickness 0 
     395        canvas $itk_component(plotarea).legend -width 50 -highlightthickness 0
    396396    } {
    397397        usual
     
    400400    }
    401401
    402     # Hack around the Tk panewindow.  The problem is that the requested 
     402    # Hack around the Tk panewindow.  The problem is that the requested
    403403    # size of the 3d view isn't set until an image is retrieved from
    404404    # the server.  So the panewindow uses the tiny size.
     
    406406    pack forget $itk_component(view)
    407407    blt::table $itk_component(plotarea) \
    408         0,0 $itk_component(view) -fill both -reqwidth $w 
     408        0,0 $itk_component(view) -fill both -reqwidth $w
    409409    blt::table configure $itk_component(plotarea) c1 -resize none
    410410
     
    501501
    502502itcl::body Rappture::VtkIsosurfaceViewer::DoRotate {} {
    503     SendCmd "camera orient [ViewToQuaternion]" 
     503    SendCmd "camera orient [ViewToQuaternion]"
    504504    set _rotatePending 0
    505505}
     
    528528    if { !$_rotatePending } {
    529529        set _rotatePending 1
    530         global rotate_delay 
     530        global rotate_delay
    531531        $_dispatcher event -after $rotate_delay !rotate
    532532    }
     
    545545    if { !$_contourList(updatePending) } {
    546546        set _contourList(updatePending) 1
    547         global rotate_delay 
     547        global rotate_delay
    548548        $_dispatcher event -after $rotate_delay !contours
    549549    }
     
    644644                    continue
    645645                }
    646                 if {[info exists _obj2ovride($dataobj-raise)] && 
     646                if {[info exists _obj2ovride($dataobj-raise)] &&
    647647                    $_obj2ovride($dataobj-raise)} {
    648648                    set dlist [linsert $dlist 0 $dataobj]
     
    672672            }
    673673            return $dlist
    674         }           
     674        }
    675675        -image {
    676676            if {[llength $args] != 2} {
     
    911911        #set w [image width $_image(plot)]
    912912        #set h [image height $_image(plot)]
    913         #puts stderr "$date: received image ${w}x${h} image"       
     913        #puts stderr "$date: received image ${w}x${h} image"
    914914        if { $_start > 0 } {
    915915            set finish [clock clicks -milliseconds]
     
    982982    # Turn on buffering of commands to the server.  We don't want to
    983983    # be preempted by a server disconnect/reconnect (which automatically
    984     # generates a new call to Rebuild).   
     984    # generates a new call to Rebuild).
    985985    StartBufferingCommands
    986986
     
    10441044            lappend _obj2datasets($dataobj) $tag
    10451045            if { [info exists _obj2ovride($dataobj-raise)] } {
    1046                 SendCmd "contour3d visible 1 $tag"
     1046                SendCmd "contour3d visible 1 $tag"
    10471047            }
    10481048        }
     
    10511051    InitSettings -cutplanesvisible -isosurfacevisible -outline
    10521052    if { $_reset } {
    1053         # These are settings that rely on a dataset being loaded.
     1053        # These are settings that rely on a dataset being loaded.
    10541054        InitSettings \
    10551055            -isosurfacelighting \
     
    10571057            -isosurfacevisible \
    10581058            -isosurfaceedges -isosurfacelighting -isosurfaceopacity \
    1059             -isosurfacewireframe \
     1059            -isosurfacewireframe \
    10601060            -cutplanesvisible \
    1061             -xcutplaneposition -ycutplaneposition -zcutplaneposition \
    1062             -xcutplanevisible -ycutplanevisible -zcutplanevisible \
     1061            -xcutplaneposition -ycutplaneposition -zcutplaneposition \
     1062            -xcutplanevisible -ycutplanevisible -zcutplanevisible \
    10631063            -cutplanepreinterp -numcontours
    10641064
    10651065        Zoom reset
    1066         foreach axis { x y z } {
     1066        foreach axis { x y z } {
    10671067            # Another problem fixed by a <view>. We looking into a data
    10681068            # object for the name of the axes. This should be global to
    10691069            # the viewer itself.
    1070             set label [$_first hints ${axis}label]
    1071             if { $label == "" } {
     1070            set label [$_first hints ${axis}label]
     1071            if { $label == "" } {
    10721072                set label [string toupper $axis]
    1073             }
     1073            }
    10741074            # May be a space in the axis label
    1075             SendCmd [list axis name $axis $label]
     1075            SendCmd [list axis name $axis $label]
    10761076        }
    10771077        if { [array size _fields] < 2 } {
     
    11001100itcl::body Rappture::VtkIsosurfaceViewer::CurrentDatasets {args} {
    11011101    set flag [lindex $args 0]
    1102     switch -- $flag { 
     1102    switch -- $flag {
    11031103        "-all" {
    11041104            if { [llength $args] > 1 } {
     
    11191119                set dlist [get -visible]
    11201120            }
    1121         }           
     1121        }
    11221122        default {
    11231123            set dlist $args
     
    12381238    foreach tag [CurrentDatasets -visible] {
    12391239        SendCmd "dataset getscalar pixel $x $y $tag"
    1240     } 
     1240    }
    12411241}
    12421242
     
    13421342        "-background" {
    13431343            set bgcolor [$itk_component(background) value]
    1344             array set fgcolors {
    1345                 "black" "white"
    1346                 "white" "black"
    1347                 "grey"  "black"
    1348             }
     1344            array set fgcolors {
     1345                "black" "white"
     1346                "white" "black"
     1347                "grey"  "black"
     1348            }
    13491349            configure -plotbackground $bgcolor \
    1350                 -plotforeground $fgcolors($bgcolor)
    1351             $itk_component(view) delete "legend"
    1352             DrawLegend
     1350                -plotforeground $fgcolors($bgcolor)
     1351            $itk_component(view) delete "legend"
     1352            DrawLegend
    13531353        }
    13541354        "-cutplaneedges" {
     
    13701370        "-cutplanesvisible" {
    13711371            set bool $_settings($what)
    1372             SendCmd "cutplane visible 0"
     1372            SendCmd "cutplane visible 0"
    13731373            if { $bool } {
    13741374                foreach tag [CurrentDatasets -visible] {
     
    13931393            set color [$itk_component(colormap) value]
    13941394            set _settings($what) $color
    1395             if { $color == "none" } {
    1396                 if { $_settings(-colormapvisible) } {
    1397                     SendCmd "contour3d colormode constant {}"
    1398                     set _settings(-colormapvisible) 0
    1399                 }
    1400             } else {
    1401                 if { !$_settings(-colormapvisible) } {
    1402                     SendCmd "contour3d colormode $_colorMode $_curFldName"
    1403                     set _settings(-colormapvisible) 1
    1404                 }
    1405                 SetCurrentColormap $color
    1406             }
     1395            if { $color == "none" } {
     1396                if { $_settings(-colormapvisible) } {
     1397                    SendCmd "contour3d colormode constant {}"
     1398                    set _settings(-colormapvisible) 0
     1399                }
     1400            } else {
     1401                if { !$_settings(-colormapvisible) } {
     1402                    SendCmd "contour3d colormode $_colorMode $_curFldName"
     1403                    set _settings(-colormapvisible) 1
     1404                }
     1405                SetCurrentColormap $color
     1406            }
    14071407            StopBufferingCommands
    1408             EventuallyRequestLegend
     1408            EventuallyRequestLegend
    14091409        }
    14101410        "-field" {
     
    14391439        "-isolinecolor" {
    14401440            set color [$itk_component(isolineColor) value]
    1441             set _settings($what) $color
    1442             DrawLegend
     1441            set _settings($what) $color
     1442            DrawLegend
    14431443        }
    14441444        "-isosurfaceedges" {
    14451445            set bool $_settings($what)
    1446             SendCmd "contour3d edges $bool"
     1446            SendCmd "contour3d edges $bool"
    14471447        }
    14481448        "-isosurfacelighting" {
    14491449            set bool $_settings($what)
    1450             SendCmd "contour3d lighting $bool"
     1450            SendCmd "contour3d lighting $bool"
    14511451        }
    14521452        "-isosurfaceopacity" {
    14531453            set _settings($what) [expr $_widget($what) * 0.01]
    1454             SendCmd "contour3d opacity $_settings($what)"
     1454            SendCmd "contour3d opacity $_settings($what)"
    14551455        }
    14561456        "-isosurfacevisible" {
    14571457            set bool $_settings($what)
    1458             SendCmd "contour3d visible 0"
     1458            SendCmd "contour3d visible 0"
    14591459            if { $bool } {
    14601460                foreach tag [CurrentDatasets -visible] {
     
    14721472        "-isosurfacewireframe" {
    14731473            set bool $_settings($what)
    1474             SendCmd "contour3d wireframe $bool"
     1474            SendCmd "contour3d wireframe $bool"
    14751475        }
    14761476        "-legendvisible" {
    14771477            if { !$_settings($what) } {
    14781478                $itk_component(view) delete legend
    1479             }
    1480             DrawLegend
     1479            }
     1480            DrawLegend
    14811481        }
    14821482        "-numcontours" {
     
    14971497        "-outline" {
    14981498            set bool $_settings($what)
    1499             SendCmd "outline visible 0"
     1499            SendCmd "outline visible 0"
    15001500            if { $bool } {
    15011501                foreach tag [CurrentDatasets -visible] {
     
    15141514                    -troughcolor grey82
    15151515            }
    1516             SendCmd "cutplane axis $axis $bool"
     1516            SendCmd "cutplane axis $axis $bool"
    15171517        }
    15181518        "-xcutplaneposition" - "-ycutplaneposition" - "-zcutplaneposition" {
     
    15371537#
    15381538#       Request a new legend from the server.  The size of the legend
    1539 #       is determined from the height of the canvas. 
     1539#       is determined from the height of the canvas.
    15401540#
    15411541# This should be called when
    1542 #       1.  A new current colormap is set.
    1543 #       2.  Window is resized.
    1544 #       3.  The limits of the data have changed.  (Just need a redraw).
    1545 #       4.  Number of isolines have changed. (Just need a redraw).
    1546 #       5.  Legend becomes visible (Just need a redraw).
     1542#   1.  A new current colormap is set.
     1543#   2.  Window is resized.
     1544#   3.  The limits of the data have changed.  (Just need a redraw).
     1545#   4.  Number of isolines have changed. (Just need a redraw).
     1546#   5.  Legend becomes visible (Just need a redraw).
    15471547#
    15481548itcl::body Rappture::VtkIsosurfaceViewer::RequestLegend {} {
     
    15601560    }
    15611561    if { [string match "component*" $fname] } {
    1562         set title ""
     1562        set title ""
    15631563    } else {
    1564         if { [info exists _fields($fname)] } {
    1565             foreach { title units } $_fields($fname) break
    1566             if { $units != "" } {
    1567                 set title [format "%s (%s)" $title $units]
    1568             }
    1569         } else {
    1570             set title $fname
    1571         }
     1564        if { [info exists _fields($fname)] } {
     1565            foreach { title units } $_fields($fname) break
     1566            if { $units != "" } {
     1567                set title [format "%s (%s)" $title $units]
     1568            }
     1569        } else {
     1570            set title $fname
     1571        }
    15721572    }
    15731573    # If there's a title too, subtract one more line
    15741574    if { $title != "" } {
    1575         incr h -$lineht 
     1575        incr h -$lineht
    15761576    }
    15771577    # Set the legend on the first heightmap dataset.
    15781578    if { $_currentColormap != ""  } {
    1579         set cmap $_currentColormap
    1580         SendCmdNoWait "legend $cmap scalar $_curFldName {} $w $h 0"
     1579        set cmap $_currentColormap
     1580        SendCmdNoWait "legend $cmap scalar $_curFldName {} $w $h 0"
    15811581    }
    15821582}
     
    15981598    if { [isconnected] } {
    15991599        set rgb [Color2RGB $itk_option(-plotforeground)]
    1600         SendCmd "axis color all $rgb"
     1600        SendCmd "axis color all $rgb"
    16011601        SendCmd "outline color $rgb"
    16021602        SendCmd "cutplane color $rgb"
     
    16501650        -font "Arial 9"
    16511651
    1652     label $inner.linecolor_l -text "Isolines" -font "Arial 9" 
     1652    label $inner.linecolor_l -text "Isolines" -font "Arial 9"
    16531653    itk_component add isolineColor {
    16541654        Rappture::Combobox $inner.linecolor -width 10 -editable 0
     
    16641664        "red"                "red"              \
    16651665        "white"              "white"            \
    1666         "none"               "none"
     1666        "none"               "none"
    16671667
    16681668    $itk_component(isolineColor) value "white"
    16691669    bind $inner.linecolor <<Value>> \
    1670         [itcl::code $this AdjustSetting -isolinecolor]
    1671 
    1672     label $inner.background_l -text "Background" -font "Arial 9" 
     1670        [itcl::code $this AdjustSetting -isolinecolor]
     1671
     1672    label $inner.background_l -text "Background" -font "Arial 9"
    16731673    itk_component add background {
    16741674        Rappture::Combobox $inner.background -width 10 -editable 0
     
    16771677        "black"              "black"            \
    16781678        "white"              "white"            \
    1679         "grey"               "grey"             
     1679        "grey"               "grey"
    16801680
    16811681    $itk_component(background) value $_settings(-background)
     
    16921692
    16931693    itk_component add field_l {
    1694         label $inner.field_l -text "Field" -font "Arial 9" 
     1694        label $inner.field_l -text "Field" -font "Arial 9"
    16951695    } {
    16961696        ignore -font
     
    17021702        [itcl::code $this AdjustSetting -field]
    17031703
    1704     label $inner.colormap_l -text "Colormap" -font "Arial 9" 
     1704    label $inner.colormap_l -text "Colormap" -font "Arial 9"
    17051705    itk_component add colormap {
    17061706        Rappture::Combobox $inner.colormap -width 10 -editable 0
     
    17281728        2,0 $inner.linecolor_l  -anchor w -pady 2  \
    17291729        2,1 $inner.linecolor    -anchor w -pady 2 -fill x  \
    1730         3,0 $inner.background_l -anchor w -pady 2 \
    1731         3,1 $inner.background -anchor w -pady 2  -fill x \
     1730        3,0 $inner.background_l -anchor w -pady 2 \
     1731        3,1 $inner.background -anchor w -pady 2  -fill x \
    17321732        4,0 $inner.numcontours_l -anchor w -pady 2 \
    17331733        4,1 $inner.numcontours -anchor w -pady 2 \
     
    17651765        -command [itcl::code $this AdjustSetting -axislabels] \
    17661766        -font "Arial 9"
    1767     label $inner.grid_l -text "Grid" -font "Arial 9" 
     1767    label $inner.grid_l -text "Grid" -font "Arial 9"
    17681768    checkbutton $inner.xgrid \
    17691769        -text "X" \
     
    17871787        -font "Arial 9"
    17881788
    1789     label $inner.mode_l -text "Mode" -font "Arial 9" 
     1789    label $inner.mode_l -text "Mode" -font "Arial 9"
    17901790
    17911791    itk_component add axisMode {
     
    17961796        "closest_triad"   "closest" \
    17971797        "furthest_triad"  "farthest" \
    1798         "outer_edges"     "outer"         
     1798        "outer_edges"     "outer"
    17991799    $itk_component(axisMode) value $_settings(-axismode)
    18001800    bind $inner.mode <<Value>> [itcl::code $this AdjustSetting -axismode]
     
    18711871
    18721872    set fg [option get $itk_component(hull) font Font]
    1873    
     1873
    18741874    set inner [$itk_component(main) insert end \
    18751875        -title "Cutplane Settings" \
    1876         -icon [Rappture::icon cutbutton]] 
     1876        -icon [Rappture::icon cutbutton]]
    18771877
    18781878    $inner configure -borderwidth 4
     
    19331933            -command [itcl::code $this EventuallySetCutplane x] \
    19341934            -variable [itcl::scope _settings(-xcutplaneposition)] \
    1935             -foreground red2 -font "Arial 9 bold"
     1935            -foreground red2 -font "Arial 9 bold"
    19361936    } {
    19371937        usual
     
    19621962            -command [itcl::code $this EventuallySetCutplane y] \
    19631963            -variable [itcl::scope _settings(-ycutplaneposition)] \
    1964             -foreground green3 -font "Arial 9 bold"
     1964            -foreground green3 -font "Arial 9 bold"
    19651965    } {
    19661966        usual
     
    19811981            -variable [itcl::scope _settings(-zcutplanevisible)] \
    19821982    } {
    1983         usual
    1984         ignore -foreground
     1983        usual
     1984        ignore -foreground
    19851985    }
    19861986    Rappture::Tooltip::for $itk_component(zbutton) \
     
    19941994            -command [itcl::code $this EventuallySetCutplane z] \
    19951995            -variable [itcl::scope _settings(-zcutplaneposition)] \
    1996             -foreground blue3 -font "Arial 9 bold"
     1996            -foreground blue3 -font "Arial 9 bold"
    19971997    } {
    19981998        usual
     
    20122012        5,0 $inner.opacity_l            -anchor w -pady 2 -cspan 1 \
    20132013        5,1 $inner.opacity              -fill x   -pady 2 -cspan 3 \
    2014         6,0 $inner.xbutton              -anchor w -padx 2 -pady 2 \
    2015         7,0 $inner.ybutton              -anchor w -padx 2 -pady 2 \
    2016         8,0 $inner.zbutton              -anchor w -padx 2 -pady 2 \
    2017         6,1 $inner.xval                 -fill y -rspan 4 \
    2018         6,2 $inner.yval                 -fill y -rspan 4 \
    2019         6,3 $inner.zval                 -fill y -rspan 4 \
     2014        6,0 $inner.xbutton              -anchor w -padx 2 -pady 2 \
     2015        7,0 $inner.ybutton              -anchor w -padx 2 -pady 2 \
     2016        8,0 $inner.zbutton              -anchor w -padx 2 -pady 2 \
     2017        6,1 $inner.xval                 -fill y -rspan 4 \
     2018        6,2 $inner.yval                 -fill y -rspan 4 \
     2019        6,3 $inner.zval                 -fill y -rspan 4 \
    20202020
    20212021
     
    20252025
    20262026#
    2027 #  camera -- 
     2027#  camera --
    20282028#
    20292029itcl::body Rappture::VtkIsosurfaceViewer::camera {option args} {
    2030     switch -- $option { 
     2030    switch -- $option {
    20312031        "show" {
    20322032            puts [array get _view]
     
    20762076
    20772077itcl::body Rappture::VtkIsosurfaceViewer::GetImage { args } {
    2078     if { [image width $_image(download)] > 0 && 
     2078    if { [image width $_image(download)] > 0 &&
    20792079         [image height $_image(download)] > 0 } {
    20802080        set bytes [$_image(download) data -format "jpeg -quality 100"]
     
    20892089        -title "[Rappture::filexfer::label downloadWord] as..."
    20902090    set inner [$popup component inner]
    2091     label $inner.summary -text "" -anchor w 
     2091    label $inner.summary -text "" -anchor w
    20922092    radiobutton $inner.vtk_button -text "VTK data file" \
    20932093        -variable [itcl::scope _downloadPopup(format)] \
    20942094        -font "Arial 9 " \
    2095         -value vtk 
     2095        -value vtk
    20962096    Rappture::Tooltip::for $inner.vtk_button "Save as VTK data file."
    20972097    radiobutton $inner.image_button -text "Image File" \
    20982098        -variable [itcl::scope _downloadPopup(format)] \
    20992099        -font "Arial 9 " \
    2100         -value image 
     2100        -value image
    21012101    Rappture::Tooltip::for $inner.image_button \
    21022102        "Save as digital image."
     
    21192119        2,0 $inner.image_button -anchor w -cspan 2 -padx { 4 0 } \
    21202120        4,1 $inner.cancel -width .9i -fill y \
    2121         4,0 $inner.ok -padx 2 -width .9i -fill y 
     2121        4,0 $inner.ok -padx 2 -width .9i -fill y
    21222122    blt::table configure $inner r3 -height 4
    21232123    blt::table configure $inner r4 -pady 4
     
    21322132    array set style {
    21332133        -color                  BCGYR
    2134         -cutplanesvisible       0 
     2134        -cutplanesvisible       0
    21352135        -edgecolor              black
    21362136        -edges                  0
     
    21842184            set _contourList(numLevels) $style(-levels)
    21852185        }
    2186         EventuallyChangeContourLevels 
     2186        EventuallyChangeContourLevels
    21872187    }
    21882188    set _settings(-isosurfacevisible) $style(-isosurfacevisible)
     
    21942194    set _settings(-ycutplaneposition) $style(-ycutplaneposition)
    21952195    set _settings(-zcutplaneposition) $style(-zcutplaneposition)
    2196  
     2196
    21972197    SendCmd "cutplane add $tag"
    21982198    SendCmd "cutplane color [Color2RGB $itk_option(-plotforeground)] $tag"
     
    22032203    SendCmd "outline visible $style(-outline) $tag"
    22042204    set _settings(-outline) $style(-outline)
    2205  
     2205
    22062206    GenerateContourList
    22072207    SendCmd [list contour3d add contourlist $_contourList(values) $tag]
     
    22162216    SendCmd "contour3d opacity $style(-opacity) $tag"
    22172217    set _settings(-isosurfaceopacity) $style(-opacity)
    2218     SetCurrentColormap $style(-color) 
     2218    SetCurrentColormap $style(-color)
    22192219    SendCmd "contour3d wireframe $style(-wireframe) $tag"
    22202220    set _settings(-isosurfacewireframe) $style(-wireframe)
     
    22672267    set font "Arial 8"
    22682268    set lineht [font metrics $font -linespace]
    2269    
     2269
    22702270    set ih [image height $_image(legend)]
    22712271    set iy [expr $y - ($lineht + 2)]
    22722272
    22732273    if { [string match "component*" $fname] } {
    2274         set title ""
     2274        set title ""
    22752275    } else {
    2276         if { [info exists _fields($fname)] } {
    2277             foreach { title units } $_fields($fname) break
    2278             if { $units != "" } {
    2279                 set title [format "%s (%s)" $title $units]
    2280             }
    2281         } else {
    2282             set title $fname
    2283         }
     2276        if { [info exists _fields($fname)] } {
     2277            foreach { title units } $_fields($fname) break
     2278            if { $units != "" } {
     2279                set title [format "%s (%s)" $title $units]
     2280            }
     2281        } else {
     2282            set title $fname
     2283        }
    22842284    }
    22852285    # If there's a legend title, increase the offset by the line height.
     
    22952295    }
    22962296    set color [eval format "\#%02x%02x%02x" $pixel]
    2297     $_image(swatch) put black  -to 0 0 23 23 
    2298     $_image(swatch) put $color -to 1 1 22 22 
     2297    $_image(swatch) put black  -to 0 0 23 23
     2298    $_image(swatch) put $color -to 1 1 22 22
    22992299    .rappturetooltip configure -icon $_image(swatch)
    23002300
     
    23072307        set value 0.0
    23082308    }
    2309     set tx [expr $x + 15] 
     2309    set tx [expr $x + 15]
    23102310    set ty [expr $y - 5]
    23112311    if { [info exists _isolines($y)] } {
     
    23142314        Rappture::Tooltip::text $c [format "$title %g" $value]
    23152315    }
    2316     Rappture::Tooltip::tooltip show $c +$tx,+$ty   
     2316    Rappture::Tooltip::tooltip show $c +$tx,+$ty
    23172317}
    23182318
     
    23482348
    23492349#
    2350 # ReceiveLegend -- 
    2351 #
    2352 #       Invoked automatically whenever the "legend" command comes in from
    2353 #       the rendering server.  Indicates that binary image data with the
    2354 #       specified <size> will follow.
     2350# ReceiveLegend --
     2351#
     2352#   Invoked automatically whenever the "legend" command comes in from
     2353#   the rendering server.  Indicates that binary image data with the
     2354#   specified <size> will follow.
    23552355#
    23562356itcl::body Rappture::VtkIsosurfaceViewer::ReceiveLegend { colormap title min max size } {
    23572357    #puts stderr "ReceiveLegend colormap=$colormap title=$title range=$min,$max size=$size"
    23582358    set _title $title
    2359     regsub {\(mag\)} $title "" _title 
     2359    regsub {\(mag\)} $title "" _title
    23602360    if { [IsConnected] } {
    23612361        set bytes [ReceiveBytes $size]
     
    23662366        #puts stderr "read $size bytes for [image width $_image(legend)]x[image height $_image(legend)] legend>"
    23672367        if { [catch {DrawLegend} errs] != 0 } {
    2368             global errorInfo
    2369             puts stderr "errs=$errs errorInfo=$errorInfo"
     2368            global errorInfo
     2369            puts stderr "errs=$errs errorInfo=$errorInfo"
    23702370        }
    23712371    }
     
    23862386
    23872387    if { [string match "component*" $fname] } {
    2388         set title ""
     2388        set title ""
    23892389    } else {
    2390         if { [info exists _fields($fname)] } {
    2391             foreach { title units } $_fields($fname) break
    2392             if { $units != "" } {
    2393                 set title [format "%s (%s)" $title $units]
    2394             }
    2395         } else {
    2396             set title $fname
    2397         }
     2390        if { [info exists _fields($fname)] } {
     2391            foreach { title units } $_fields($fname) break
     2392            if { $units != "" } {
     2393                set title [format "%s (%s)" $title $units]
     2394            }
     2395        } else {
     2396            set title $fname
     2397        }
    23982398    }
    23992399    set x [expr $w - 2]
    24002400    if { !$_settings(-legendvisible) } {
    2401         $c delete legend
    2402         return
    2403     } 
     2401        $c delete legend
     2402        return
     2403    }
    24042404    if { [$c find withtag "legend"] == "" } {
    2405         set y 2
    2406         # If there's a legend title, create a text item for the title.
     2405        set y 2
     2406        # If there's a legend title, create a text item for the title.
    24072407        $c create text $x $y \
    2408             -anchor ne \
    2409             -fill $itk_option(-plotforeground) -tags "title legend" \
    2410             -font $font
     2408            -anchor ne \
     2409            -fill $itk_option(-plotforeground) -tags "title legend" \
     2410            -font $font
    24112411        if { $title != "" } {
    24122412            incr y $lineht
    24132413        }
    2414         $c create text $x $y \
    2415             -anchor ne \
    2416             -fill $itk_option(-plotforeground) -tags "vmax legend" \
    2417             -font $font
    2418         incr y $lineht
    2419         $c create image $x $y \
    2420             -anchor ne \
    2421             -image $_image(legend) -tags "colormap legend"
    2422         $c create rectangle $x $y 1 1 \
    2423             -fill "" -outline "" -tags "sensor legend"
    2424         $c create text $x [expr {$h-2}] \
    2425             -anchor se \
    2426             -fill $itk_option(-plotforeground) -tags "vmin legend" \
    2427             -font $font
    2428         $c bind sensor <Enter> [itcl::code $this EnterLegend %x %y]
    2429         $c bind sensor <Leave> [itcl::code $this LeaveLegend]
    2430         $c bind sensor <Motion> [itcl::code $this MotionLegend %x %y]
     2414        $c create text $x $y \
     2415            -anchor ne \
     2416            -fill $itk_option(-plotforeground) -tags "vmax legend" \
     2417            -font $font
     2418        incr y $lineht
     2419        $c create image $x $y \
     2420            -anchor ne \
     2421            -image $_image(legend) -tags "colormap legend"
     2422        $c create rectangle $x $y 1 1 \
     2423            -fill "" -outline "" -tags "sensor legend"
     2424        $c create text $x [expr {$h-2}] \
     2425            -anchor se \
     2426            -fill $itk_option(-plotforeground) -tags "vmin legend" \
     2427            -font $font
     2428        $c bind sensor <Enter> [itcl::code $this EnterLegend %x %y]
     2429        $c bind sensor <Leave> [itcl::code $this LeaveLegend]
     2430        $c bind sensor <Motion> [itcl::code $this MotionLegend %x %y]
    24312431    }
    24322432    $c delete isoline
     
    24472447        }
    24482448        set tags "isoline legend"
    2449         set offset [expr 2 + $lineht]
    2450         if { $title != "" } {
    2451             incr offset $lineht
    2452         }
     2449        set offset [expr 2 + $lineht]
     2450        if { $title != "" } {
     2451            incr offset $lineht
     2452        }
    24532453        foreach value $_contourList(values) {
    24542454            set norm [expr 1.0 - (($value - $vmin) / $range)]
     
    24692469    if { [info exists _limits($_curFldName)] } {
    24702470        foreach { vmin vmax } $_limits($_curFldName) break
    2471         $c itemconfigure vmin -text [format %g $vmin]
    2472         $c itemconfigure vmax -text [format %g $vmax]
     2471        $c itemconfigure vmin -text [format %g $vmin]
     2472        $c itemconfigure vmax -text [format %g $vmax]
    24732473    }
    24742474    set y 2
     
    24762476    if { $title != "" } {
    24772477        $c itemconfigure title -text $title
    2478         $c coords title $x $y
    2479         incr y $lineht
     2478        $c coords title $x $y
     2479        incr y $lineht
    24802480        $c raise title
    24812481    }
     
    25002500# ----------------------------------------------------------------------
    25012501itcl::body Rappture::VtkIsosurfaceViewer::Combo {option} {
    2502     set c $itk_component(view) 
     2502    set c $itk_component(view)
    25032503    switch -- $option {
    25042504        post {
     
    25152515        }
    25162516        deactivate {
    2517             $c itemconfigure title -fill $itk_option(-plotforeground) 
     2517            $c itemconfigure title -fill $itk_option(-plotforeground)
    25182518        }
    25192519        invoke {
     
    25332533    # Keep track of the colormaps that we build.
    25342534    if { ![info exists _colormaps($name)] } {
    2535         BuildColormap $name 
     2535        BuildColormap $name
    25362536        set _colormaps($name) 1
    25372537    }
     
    25552555}
    25562556
    2557 itcl::body Rappture::VtkIsosurfaceViewer::SetOrientation { side } { 
     2557itcl::body Rappture::VtkIsosurfaceViewer::SetOrientation { side } {
    25582558    array set positions {
    25592559        front "1 0 0 0"
     
    25762576}
    25772577
    2578 itcl::body Rappture::VtkIsosurfaceViewer::GenerateContourList {} { 
     2578itcl::body Rappture::VtkIsosurfaceViewer::GenerateContourList {} {
    25792579    if { ![info exists _limits($_curFldName)] } {
    25802580        puts stderr "no _curFldName"
     
    25992599}
    26002600
    2601 itcl::body Rappture::VtkIsosurfaceViewer::SetCurrentFieldName { dataobj } { 
     2601itcl::body Rappture::VtkIsosurfaceViewer::SetCurrentFieldName { dataobj } {
    26022602    set _first $dataobj
    26032603    $itk_component(field) choices delete 0 end
Note: See TracChangeset for help on using the changeset viewer.