Changeset 5018


Ignore:
Timestamp:
Feb 13, 2015 2:58:57 AM (5 years ago)
Author:
ldelgass
Message:

whitespace

File:
1 edited

Legend:

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

    r4969 r5018  
    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"
     
    22092209    SendCmd "outline visible $style(-outline) $tag"
    22102210    set _settings(-outline) $style(-outline)
    2211  
     2211
    22122212    GenerateContourList
    22132213    SendCmd [list contour3d add contourlist $_contourList(values) $tag]
     
    22222222    SendCmd "contour3d opacity $style(-opacity) $tag"
    22232223    set _settings(-isosurfaceopacity) $style(-opacity)
    2224     SetCurrentColormap $style(-color) 
     2224    SetCurrentColormap $style(-color)
    22252225    SendCmd "contour3d wireframe $style(-wireframe) $tag"
    22262226    set _settings(-isosurfacewireframe) $style(-wireframe)
     
    22732273    set font "Arial 8"
    22742274    set lineht [font metrics $font -linespace]
    2275    
     2275
    22762276    set ih [image height $_image(legend)]
    22772277    set iy [expr $y - ($lineht + 2)]
    22782278
    22792279    if { [string match "component*" $fname] } {
    2280         set title ""
     2280        set title ""
    22812281    } else {
    2282         if { [info exists _fields($fname)] } {
    2283             foreach { title units } $_fields($fname) break
    2284             if { $units != "" } {
    2285                 set title [format "%s (%s)" $title $units]
    2286             }
    2287         } else {
    2288             set title $fname
    2289         }
     2282        if { [info exists _fields($fname)] } {
     2283            foreach { title units } $_fields($fname) break
     2284            if { $units != "" } {
     2285                set title [format "%s (%s)" $title $units]
     2286            }
     2287        } else {
     2288            set title $fname
     2289        }
    22902290    }
    22912291    # If there's a legend title, increase the offset by the line height.
     
    23012301    }
    23022302    set color [eval format "\#%02x%02x%02x" $pixel]
    2303     $_image(swatch) put black  -to 0 0 23 23 
    2304     $_image(swatch) put $color -to 1 1 22 22 
     2303    $_image(swatch) put black  -to 0 0 23 23
     2304    $_image(swatch) put $color -to 1 1 22 22
    23052305    .rappturetooltip configure -icon $_image(swatch)
    23062306
     
    23132313        set value 0.0
    23142314    }
    2315     set tx [expr $x + 15] 
     2315    set tx [expr $x + 15]
    23162316    set ty [expr $y - 5]
    23172317    if { [info exists _isolines($y)] } {
     
    23202320        Rappture::Tooltip::text $c [format "$title %g" $value]
    23212321    }
    2322     Rappture::Tooltip::tooltip show $c +$tx,+$ty   
     2322    Rappture::Tooltip::tooltip show $c +$tx,+$ty
    23232323}
    23242324
     
    23542354
    23552355#
    2356 # ReceiveLegend -- 
    2357 #
    2358 #       Invoked automatically whenever the "legend" command comes in from
    2359 #       the rendering server.  Indicates that binary image data with the
    2360 #       specified <size> will follow.
     2356# ReceiveLegend --
     2357#
     2358#   Invoked automatically whenever the "legend" command comes in from
     2359#   the rendering server.  Indicates that binary image data with the
     2360#   specified <size> will follow.
    23612361#
    23622362itcl::body Rappture::VtkIsosurfaceViewer::ReceiveLegend { colormap title min max size } {
    23632363    #puts stderr "ReceiveLegend colormap=$colormap title=$title range=$min,$max size=$size"
    23642364    set _title $title
    2365     regsub {\(mag\)} $title "" _title 
     2365    regsub {\(mag\)} $title "" _title
    23662366    if { [IsConnected] } {
    23672367        set bytes [ReceiveBytes $size]
     
    23722372        #puts stderr "read $size bytes for [image width $_image(legend)]x[image height $_image(legend)] legend>"
    23732373        if { [catch {DrawLegend} errs] != 0 } {
    2374             global errorInfo
    2375             puts stderr "errs=$errs errorInfo=$errorInfo"
     2374            global errorInfo
     2375            puts stderr "errs=$errs errorInfo=$errorInfo"
    23762376        }
    23772377    }
     
    23922392
    23932393    if { [string match "component*" $fname] } {
    2394         set title ""
     2394        set title ""
    23952395    } else {
    2396         if { [info exists _fields($fname)] } {
    2397             foreach { title units } $_fields($fname) break
    2398             if { $units != "" } {
    2399                 set title [format "%s (%s)" $title $units]
    2400             }
    2401         } else {
    2402             set title $fname
    2403         }
     2396        if { [info exists _fields($fname)] } {
     2397            foreach { title units } $_fields($fname) break
     2398            if { $units != "" } {
     2399                set title [format "%s (%s)" $title $units]
     2400            }
     2401        } else {
     2402            set title $fname
     2403        }
    24042404    }
    24052405    set x [expr $w - 2]
    24062406    if { !$_settings(-legendvisible) } {
    2407         $c delete legend
    2408         return
    2409     } 
     2407        $c delete legend
     2408        return
     2409    }
    24102410    if { [$c find withtag "legend"] == "" } {
    2411         set y 2
    2412         # If there's a legend title, create a text item for the title.
     2411        set y 2
     2412        # If there's a legend title, create a text item for the title.
    24132413        $c create text $x $y \
    2414             -anchor ne \
    2415             -fill $itk_option(-plotforeground) -tags "title legend" \
    2416             -font $font
     2414            -anchor ne \
     2415            -fill $itk_option(-plotforeground) -tags "title legend" \
     2416            -font $font
    24172417        if { $title != "" } {
    24182418            incr y $lineht
    24192419        }
    2420         $c create text $x $y \
    2421             -anchor ne \
    2422             -fill $itk_option(-plotforeground) -tags "vmax legend" \
    2423             -font $font
    2424         incr y $lineht
    2425         $c create image $x $y \
    2426             -anchor ne \
    2427             -image $_image(legend) -tags "colormap legend"
    2428         $c create rectangle $x $y 1 1 \
    2429             -fill "" -outline "" -tags "sensor legend"
    2430         $c create text $x [expr {$h-2}] \
    2431             -anchor se \
    2432             -fill $itk_option(-plotforeground) -tags "vmin legend" \
    2433             -font $font
    2434         $c bind sensor <Enter> [itcl::code $this EnterLegend %x %y]
    2435         $c bind sensor <Leave> [itcl::code $this LeaveLegend]
    2436         $c bind sensor <Motion> [itcl::code $this MotionLegend %x %y]
     2420        $c create text $x $y \
     2421            -anchor ne \
     2422            -fill $itk_option(-plotforeground) -tags "vmax legend" \
     2423            -font $font
     2424        incr y $lineht
     2425        $c create image $x $y \
     2426            -anchor ne \
     2427            -image $_image(legend) -tags "colormap legend"
     2428        $c create rectangle $x $y 1 1 \
     2429            -fill "" -outline "" -tags "sensor legend"
     2430        $c create text $x [expr {$h-2}] \
     2431            -anchor se \
     2432            -fill $itk_option(-plotforeground) -tags "vmin legend" \
     2433            -font $font
     2434        $c bind sensor <Enter> [itcl::code $this EnterLegend %x %y]
     2435        $c bind sensor <Leave> [itcl::code $this LeaveLegend]
     2436        $c bind sensor <Motion> [itcl::code $this MotionLegend %x %y]
    24372437    }
    24382438    $c delete isoline
     
    24532453        }
    24542454        set tags "isoline legend"
    2455         set offset [expr 2 + $lineht]
    2456         if { $title != "" } {
    2457             incr offset $lineht
    2458         }
     2455        set offset [expr 2 + $lineht]
     2456        if { $title != "" } {
     2457            incr offset $lineht
     2458        }
    24592459        foreach value $_contourList(values) {
    24602460            set norm [expr 1.0 - (($value - $vmin) / $range)]
     
    24752475    if { [info exists _limits($_curFldName)] } {
    24762476        foreach { vmin vmax } $_limits($_curFldName) break
    2477         $c itemconfigure vmin -text [format %g $vmin]
    2478         $c itemconfigure vmax -text [format %g $vmax]
     2477        $c itemconfigure vmin -text [format %g $vmin]
     2478        $c itemconfigure vmax -text [format %g $vmax]
    24792479    }
    24802480    set y 2
     
    24822482    if { $title != "" } {
    24832483        $c itemconfigure title -text $title
    2484         $c coords title $x $y
    2485         incr y $lineht
     2484        $c coords title $x $y
     2485        incr y $lineht
    24862486        $c raise title
    24872487    }
     
    25062506# ----------------------------------------------------------------------
    25072507itcl::body Rappture::VtkIsosurfaceViewer::Combo {option} {
    2508     set c $itk_component(view) 
     2508    set c $itk_component(view)
    25092509    switch -- $option {
    25102510        post {
     
    25212521        }
    25222522        deactivate {
    2523             $c itemconfigure title -fill $itk_option(-plotforeground) 
     2523            $c itemconfigure title -fill $itk_option(-plotforeground)
    25242524        }
    25252525        invoke {
     
    25392539    # Keep track of the colormaps that we build.
    25402540    if { ![info exists _colormaps($name)] } {
    2541         BuildColormap $name 
     2541        BuildColormap $name
    25422542        set _colormaps($name) 1
    25432543    }
     
    25612561}
    25622562
    2563 itcl::body Rappture::VtkIsosurfaceViewer::SetOrientation { side } { 
     2563itcl::body Rappture::VtkIsosurfaceViewer::SetOrientation { side } {
    25642564    array set positions {
    25652565        front "1 0 0 0"
     
    25822582}
    25832583
    2584 itcl::body Rappture::VtkIsosurfaceViewer::GenerateContourList {} { 
     2584itcl::body Rappture::VtkIsosurfaceViewer::GenerateContourList {} {
    25852585    if { ![info exists _limits($_curFldName)] } {
    25862586        puts stderr "no _curFldName"
     
    26052605}
    26062606
    2607 itcl::body Rappture::VtkIsosurfaceViewer::SetCurrentFieldName { dataobj } { 
     2607itcl::body Rappture::VtkIsosurfaceViewer::SetCurrentFieldName { dataobj } {
    26082608    set _first $dataobj
    26092609    $itk_component(field) choices delete 0 end
Note: See TracChangeset for help on using the changeset viewer.