Changeset 5006 for trunk/gui


Ignore:
Timestamp:
Feb 11, 2015, 3:05:26 PM (10 years ago)
Author:
ldelgass
Message:

whitespace

Location:
trunk/gui/scripts
Files:
5 edited

Legend:

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

    r4769 r5006  
    1 # -*- mode: tcl; indent-tabs-mode: nil -*- 
     1# -*- mode: tcl; indent-tabs-mode: nil -*-
    22# ----------------------------------------------------------------------
    33#  COMPONENT: vtkimageviewer - Vtk image viewer
     
    5858    public method get {args}
    5959    public method isconnected {}
    60     public method parameters {title args} { 
    61         # do nothing 
     60    public method parameters {title args} {
     61        # do nothing
    6262    }
    6363    public method scale {args}
     
    6969    private method BuildColormap { name }
    7070    private method BuildImageTab {}
    71     private method BuildDownloadPopup { widget command } 
     71    private method BuildDownloadPopup { widget command }
    7272    private method Combo { option }
    7373    private method Connect {}
     
    7777    private method DoRotate {}
    7878    private method DrawLegend {}
    79     private method EnterLegend { x y } 
    80     private method EventuallyRequestLegend {} 
    81     private method EventuallyResize { w h } 
     79    private method EnterLegend { x y }
     80    private method EventuallyRequestLegend {}
     81    private method EventuallyResize { w h }
    8282    private method EventuallyRotate { q }
    83     private method GetImage { args } 
    84     private method GetVtkData { args } 
     83    private method GetImage { args }
     84    private method GetVtkData { args }
    8585    private method InitSettings { args  }
    86     private method IsValidObject { dataobj } 
     86    private method IsValidObject { dataobj }
    8787    private method LeaveLegend {}
    88     private method MotionLegend { x y } 
     88    private method MotionLegend { x y }
    8989    private method Pan {option x y}
    9090    private method PanCamera {}
    9191    private method Pick {x y}
    92     private method QuaternionToView { q } { 
     92    private method QuaternionToView { q } {
    9393        foreach { _view(-qw) _view(-qx) _view(-qy) _view(-qz) } $q break
    9494    }
     
    101101    private method SetCurrentColormap { color }
    102102    private method SetLegendTip { x y }
    103     private method SetObjectStyle { dataobj comp } 
     103    private method SetObjectStyle { dataobj comp }
    104104    private method SetOrientation { side }
    105     private method ViewToQuaternion {} { 
     105    private method ViewToQuaternion {} {
    106106        return [list $_view(-qw) $_view(-qx) $_view(-qy) $_view(-qz)]
    107107    }
     
    112112    private variable _obj2datasets
    113113    private variable _obj2ovride   ;    # maps dataobj => style override
    114     private variable _datasets     ;    # contains all the dataobj-component 
     114    private variable _datasets     ;    # contains all the dataobj-component
    115115                                   ;    # datasets in the server
    116116    private variable _colormaps    ;    # contains all the colormaps
     
    128128
    129129    private variable _click        ;    # info used for rotate operations
    130     private variable _limits       ;    # Holds overall limits for all dataobjs 
     130    private variable _limits       ;    # Holds overall limits for all dataobjs
    131131                                        # using the viewer.
    132132    private variable _view         ;    # view params for 3D view
     
    153153    private variable _rotatePending 0
    154154    private variable _legendPending 0
    155     private variable _fieldNames {} 
    156     private variable _fields 
     155    private variable _fieldNames {}
     156    private variable _fields
    157157    private variable _curFldName ""
    158158    private variable _curFldLabel ""
     
    243243    } {
    244244        usual
    245         ignore -highlightthickness -borderwidth -background 
     245        ignore -highlightthickness -borderwidth -background
    246246    }
    247247
     
    249249        menu $itk_component(plotarea).menu \
    250250            -relief flat \
    251             -tearoff no 
     251            -tearoff no
    252252    } {
    253253        usual
     
    269269
    270270    set _map(id) [$c create image 0 0 -anchor nw -image $_image(plot)]
    271     set _map(cwidth) -1 
    272     set _map(cheight) -1 
     271    set _map(cwidth) -1
     272    set _map(cheight) -1
    273273    set _map(zoom) 1.0
    274274    set _map(original) ""
     
    338338        BuildCameraTab
    339339    } errs] != 0 } {
    340         global errorInfo
     340        global errorInfo
    341341        puts stderr "errs=$errs errorInfo=$errorInfo"
    342342    }
    343343
    344     # Hack around the Tk panewindow.  The problem is that the requested 
     344    # Hack around the Tk panewindow.  The problem is that the requested
    345345    # size of the 3d view isn't set until an image is retrieved from
    346346    # the server.  So the panewindow uses the tiny size.
     
    348348    pack forget $itk_component(view)
    349349    blt::table $itk_component(plotarea) \
    350         0,0 $itk_component(view) -fill both -reqwidth $w 
     350        0,0 $itk_component(view) -fill both -reqwidth $w
    351351    blt::table configure $itk_component(plotarea) c1 -resize none
    352352
     
    432432
    433433itcl::body Rappture::VtkImageViewer::DoRotate {} {
    434     SendCmd "camera orient [ViewToQuaternion]" 
     434    SendCmd "camera orient [ViewToQuaternion]"
    435435    set _rotatePending 0
    436436}
     
    459459    if { !$_rotatePending } {
    460460        set _rotatePending 1
    461         global rotate_delay 
     461        global rotate_delay
    462462        $_dispatcher event -after $rotate_delay !rotate
    463463    }
     
    558558                    continue
    559559                }
    560                 if {[info exists _obj2ovride($dataobj-raise)] && 
     560                if {[info exists _obj2ovride($dataobj-raise)] &&
    561561                    $_obj2ovride($dataobj-raise)} {
    562562                    set dlist [linsert $dlist 0 $dataobj]
     
    586586            }
    587587            return $dlist
    588         }           
     588        }
    589589        -image {
    590590            if {[llength $args] != 2} {
     
    606606}
    607607
    608 # 
     608#
    609609# scale  --
    610610#
    611611#       This gets called either incrementally as new simulations are
    612612#       added or all at once as a sequence of images.
    613 #       This  accounts for all objects--even those not showing on the 
    614 #       screen.  Because of this, the limits are appropriate for all 
     613#       This  accounts for all objects--even those not showing on the
     614#       screen.  Because of this, the limits are appropriate for all
    615615#       objects as the user scans through data in the ResultSet viewer.
    616616#
     
    804804    $_dispatcher cancel !legend
    805805    # disconnected -- no more data sitting on server
    806     array unset _datasets 
    807     array unset _data 
    808     array unset _colormaps 
    809     array unset _obj2datasets 
     806    array unset _datasets
     807    array unset _data
     808    array unset _colormaps
     809    array unset _obj2datasets
    810810    global readyForNextFrame
    811811    set readyForNextFrame 1
     
    839839        set time [clock seconds]
    840840        set date [clock format $time]
    841         #puts stderr "$date: received image [image width $_image(plot)]x[image height $_image(plot)] image>"       
     841        #puts stderr "$date: received image [image width $_image(plot)]x[image height $_image(plot)] image>"
    842842        if { $_start > 0 } {
    843843            set finish [clock clicks -milliseconds]
     
    910910    # Turn on buffering of commands to the server.  We don't want to
    911911    # be preempted by a server disconnect/reconnect (which automatically
    912     # generates a new call to Rebuild).   
     912    # generates a new call to Rebuild).
    913913    StartBufferingCommands
    914914
    915915    if { $_width != $w || $_height != $h || $_reset } {
    916         set _width $w
    917         set _height $h
    918         $_arcball resize $w $h
    919         DoResize
    920         if { $_settings(-stretchtofit) } {
    921             AdjustSetting -stretchToFit
    922         }
     916        set _width $w
     917        set _height $h
     918        $_arcball resize $w $h
     919        DoResize
     920        if { $_settings(-stretchtofit) } {
     921            AdjustSetting -stretchToFit
     922        }
    923923    }
    924924    if { $_reset } {
    925         #
    926         # Reset the camera and other view parameters
    927         #
     925        #
     926        # Reset the camera and other view parameters
     927        #
    928928        InitSettings -view3d -background
    929929
    930         SendCmd "axis lrot z 90"
    931         $_arcball quaternion [ViewToQuaternion]
     930        SendCmd "axis lrot z 90"
     931        $_arcball quaternion [ViewToQuaternion]
    932932        if {$_settings(-view3d) } {
    933933            if { $_view(-ortho)} {
     
    938938            DoRotate
    939939            SendCmd "camera reset"
    940         }
    941         PanCamera
     940        }
     941        PanCamera
    942942        StopBufferingCommands
    943943        SendCmd "imgflush"
     
    957957            if { ![info exists _datasets($tag)] } {
    958958                set bytes [$dataobj vtkdata $comp]
    959                 if 0 {
     959                if 0 {
    960960                    set f [open /tmp/vtkimage.vtk "w"]
    961961                    fconfigure $f -translation binary -encoding binary
    962962                    puts -nonewline $f $bytes
    963963                    close $f
    964                 }
     964                }
    965965                set length [string length $bytes]
    966966                if { $_reportClientInfo }  {
     
    990990    }
    991991    if { $_first != ""  } {
    992         $itk_component(field) choices delete 0 end
    993         $itk_component(fieldmenu) delete 0 end
    994         array unset _fields
     992        $itk_component(field) choices delete 0 end
     993        $itk_component(fieldmenu) delete 0 end
     994        array unset _fields
    995995        set _curFldName ""
    996996        foreach cname [$_first components] {
     
    10211021
    10221022    if { $_reset } {
    1023         SendCmd "axis tickpos outside"
     1023        SendCmd "axis tickpos outside"
    10241024        #SendCmd "axis lformat all %g"
    1025        
    1026         foreach axis { x y z } {
     1025
     1026        foreach axis { x y z } {
    10271027            set label [$_first hints ${axis}label]
    1028             if { $label == "" } {
    1029                 set label [string toupper $axis]
    1030             }
    1031             # May be a space in the axis label.
    1032             SendCmd [list axis name $axis $label]
    1033 
    1034             if {$axis == "z" && [$_first hints ${axis}units] == ""} {
     1028            if { $label == "" } {
     1029                set label [string toupper $axis]
     1030            }
     1031            # May be a space in the axis label.
     1032            SendCmd [list axis name $axis $label]
     1033
     1034            if {$axis == "z" && [$_first hints ${axis}units] == ""} {
    10351035                if {$_curFldName != ""} {
    10361036                    set units [lindex $_fields($_curFldName) 1]
    10371037                }
    1038             } else {
    1039                 set units [$_first hints ${axis}units]
    1040             }
    1041             if { $units != "" } {
    1042                 # May be a space in the axis units.
    1043                 SendCmd [list axis units $axis $units]
    1044             }
    1045         }
    1046         #
    1047         # Reset the camera and other view parameters
    1048         #
    1049         $_arcball quaternion [ViewToQuaternion]
     1038            } else {
     1039                set units [$_first hints ${axis}units]
     1040            }
     1041            if { $units != "" } {
     1042                # May be a space in the axis units.
     1043                SendCmd [list axis units $axis $units]
     1044            }
     1045        }
     1046        #
     1047        # Reset the camera and other view parameters
     1048        #
     1049        $_arcball quaternion [ViewToQuaternion]
    10501050        if {$_settings(-view3d) } {
    10511051            if { $_view(-ortho)} {
     
    10571057            SendCmd "camera reset"
    10581058        }
    1059         PanCamera
    1060         InitSettings -xgrid -ygrid -zgrid \
     1059        PanCamera
     1060        InitSettings -xgrid -ygrid -zgrid \
    10611061            -axisvisible -axislabels -field -view3d
    10621062        if { [array size _fields] < 2 } {
     
    10671067    }
    10681068    global readyForNextFrame
    1069     set readyForNextFrame 0;            # Don't advance to the next frame
     1069    set readyForNextFrame 0;                # Don't advance to the next frame
    10701070
    10711071    # Actually write the commands to the server socket.  If it fails, we don't
     
    10851085itcl::body Rappture::VtkImageViewer::CurrentDatasets {args} {
    10861086    set flag [lindex $args 0]
    1087     switch -- $flag { 
     1087    switch -- $flag {
    10881088        "-all" {
    10891089            if { [llength $args] > 1 } {
     
    11041104                set dlist [get -visible]
    11051105            }
    1106         }           
     1106        }
    11071107        default {
    11081108            set dlist $args
     
    12261226    foreach tag [CurrentDatasets -visible] {
    12271227        SendCmd "dataset getscalar pixel $x $y $tag"
    1228     } 
     1228    }
    12291229}
    12301230
     
    13301330        "-background" {
    13311331            set bg [$itk_component(background) value]
    1332             array set fgcolors {
    1333                 "black" "white"
    1334                 "white" "black"
    1335                 "grey"  "black"
    1336             }
     1332            array set fgcolors {
     1333                "black" "white"
     1334                "white" "black"
     1335                "grey"  "black"
     1336            }
    13371337            set fg $fgcolors($bg)
    13381338            configure -plotbackground $bg -plotforeground $fg
    1339             $itk_component(view) delete "legend"
     1339            $itk_component(view) delete "legend"
    13401340            SendCmd "screen bgcolor [Color2RGB $bg]"
    13411341            SendCmd "outline color [Color2RGB $fg]"
    13421342            SendCmd "axis color all [Color2RGB $fg]"
    1343             DrawLegend
     1343            DrawLegend
    13441344        }
    13451345        "-backingcolor" {
    13461346            set color [$itk_component(backingcolor) value]
    1347             if { $color == "none" } {
    1348                 if { $_settings(-backingvisible) } {
    1349                     SendCmd "image backing 0"
    1350                     set _settings(-backingvisible) 0
    1351                 }
    1352             } else {
    1353                 if { !$_settings(-backingvisible) } {
    1354                     SendCmd "image backing 1"
    1355                     set _settings(-backingvisible) 1
    1356                 }
    1357                 SendCmd "image color [Color2RGB $color]"
    1358             }
     1347            if { $color == "none" } {
     1348                if { $_settings(-backingvisible) } {
     1349                    SendCmd "image backing 0"
     1350                    set _settings(-backingvisible) 0
     1351                }
     1352            } else {
     1353                if { !$_settings(-backingvisible) } {
     1354                    SendCmd "image backing 1"
     1355                    set _settings(-backingvisible) 1
     1356                }
     1357                SendCmd "image color [Color2RGB $color]"
     1358            }
    13591359        }
    13601360        "-backingvisible" {
    1361             set bool $_settings($what)
     1361            set bool $_settings($what)
    13621362            SendCmd "image backing $bool"
    13631363        }
     
    13721372            }
    13731373            StopBufferingCommands
    1374             EventuallyRequestLegend
     1374            EventuallyRequestLegend
    13751375        }
    13761376        "-colormapdiscrete" {
     
    14101410        }
    14111411        "-view3d" {
    1412             set bool $_settings($what)
     1412            set bool $_settings($what)
    14131413            set c $itk_component(view)
    14141414            StartBufferingCommands
     
    14201420            }
    14211421            AdjustSetting -opacity
    1422             if { $bool } {
    1423                 $itk_component(opacity) configure -state normal
    1424                 $itk_component(opacity_l) configure -state normal
     1422            if { $bool } {
     1423                $itk_component(opacity) configure -state normal
     1424                $itk_component(opacity_l) configure -state normal
    14251425                if {$_view(-ortho)} {
    14261426                    SendCmd "camera mode ortho"
     
    14291429                }
    14301430                SendCmd "camera aspect native"
    1431             } else {
    1432                 $itk_component(opacity) configure -state disabled
    1433                 $itk_component(opacity_l) configure -state disabled
     1431            } else {
     1432                $itk_component(opacity) configure -state disabled
     1433                $itk_component(opacity_l) configure -state disabled
    14341434                SendCmd "camera mode image"
    14351435                if {$_settings(-stretchtofit)} {
     
    14401440                set q [ViewToQuaternion]
    14411441                $_arcball quaternion $q
    1442                 SendCmd "camera orient $q" 
     1442                SendCmd "camera orient $q"
    14431443            } else {
    14441444                bind $c <ButtonPress-1> {}
     
    14471447            }
    14481448            SendCmd "camera reset"
    1449             # Fix the mouse bindings for rotation/panning and the 
     1449            # Fix the mouse bindings for rotation/panning and the
    14501450            # camera mode. Ideally we'd create a bindtag for these.
    14511451            if { $bool } {
     
    14701470        "-legendvisible" {
    14711471            if { !$_settings($what) } {
    1472                 $itk_component(view) delete legend
    1473             }
    1474             DrawLegend
     1472                $itk_component(view) delete legend
     1473            }
     1474            DrawLegend
    14751475        }
    14761476        "-opacity" {
    14771477            set _changed($what) 1
    1478             if { $_settings(-view3d) } {
     1478            if { $_settings(-view3d) } {
    14791479                set _settings(-saveopacity) $_settings($what)
    14801480                set val [expr $_settings($what) * 0.01]
    14811481                SendCmd "image opacity $val"
    14821482            } else {
    1483                 SendCmd "image opacity 1.0"
     1483                SendCmd "image opacity 1.0"
    14841484            }
    14851485        }
     
    14871487            set bool $_settings($what)
    14881488            SendCmd "outline visible $bool"
    1489         }
     1489        }
    14901490        "-stretchtofit" {
    1491             set bool $_settings($what)
    1492             if { $bool } {
    1493                 if { $_settings(-view3d) } {
    1494                     SendCmd "camera aspect native"
    1495                 } else {
    1496                     SendCmd "camera aspect window"
    1497                 }
    1498             } else {
    1499                 SendCmd "camera aspect native"
    1500             }
    1501         }
     1491            set bool $_settings($what)
     1492            if { $bool } {
     1493                if { $_settings(-view3d) } {
     1494                    SendCmd "camera aspect native"
     1495                } else {
     1496                    SendCmd "camera aspect window"
     1497                }
     1498            } else {
     1499                SendCmd "camera aspect native"
     1500            }
     1501        }
    15021502        "-xgrid" - "-ygrid" - "-zgrid" {
    15031503            set axis [string tolower [string range $what 1 1]]
     
    15051505            SendCmd "axis grid $axis $bool"
    15061506        }
    1507         default {
     1507        default {
    15081508            error "don't know how to fix $what"
    15091509        }
     
    15151515#
    15161516#       Request a new legend from the server.  The size of the legend
    1517 #       is determined from the height of the canvas. 
     1517#       is determined from the height of the canvas.
    15181518#
    15191519# This should be called when
    1520 #       1.  A new current colormap is set.
    1521 #       2.  Window is resized.
    1522 #       3.  The limits of the data have changed.  (Just need a redraw).
    1523 #       4.  Number of isolines have changed. (Just need a redraw).
    1524 #       5.  Legend becomes visible (Just need a redraw).
     1520#        1.  A new current colormap is set.
     1521#        2.  Window is resized.
     1522#        3.  The limits of the data have changed.  (Just need a redraw).
     1523#        4.  Number of isolines have changed. (Just need a redraw).
     1524#        5.  Legend becomes visible (Just need a redraw).
    15251525#
    15261526itcl::body Rappture::VtkImageViewer::RequestLegend {} {
     
    15291529    set w 12
    15301530    set lineht [font metrics $font -linespace]
    1531     # color ramp height = (canvas height) - (min and max value lines) - 2 
     1531    # color ramp height = (canvas height) - (min and max value lines) - 2
    15321532    set h [expr {$_height - 2 * ($lineht + 2)}]
    15331533    set _legendHeight $h
     
    15351535    set fname $_curFldName
    15361536    if { [string match "component*" $fname] } {
    1537         set title ""
     1537        set title ""
    15381538    } else {
    1539         if { [info exists _fields($fname)] } {
    1540             foreach { title units } $_fields($fname) break
    1541             if { $units != "" } {
    1542                 set title [format "%s (%s)" $title $units]
    1543             }
    1544         } else {
    1545             set title $fname
    1546         }
     1539        if { [info exists _fields($fname)] } {
     1540            foreach { title units } $_fields($fname) break
     1541            if { $units != "" } {
     1542                set title [format "%s (%s)" $title $units]
     1543            }
     1544        } else {
     1545            set title $fname
     1546        }
    15471547    }
    15481548    # If there's a title too, substract one more line
    15491549    if { $title != "" } {
    1550         incr h -$lineht 
     1550        incr h -$lineht
    15511551    }
    15521552    if { $h < 1 } {
     
    15551555    # Set the legend on the first image dataset.
    15561556    if { $_currentColormap != "" && $_currentColormap != "none" } {
    1557         #SendCmd "legend $_currentColormap scalar $_curFldName {} $w $h 0"
     1557        #SendCmd "legend $_currentColormap scalar $_curFldName {} $w $h 0"
    15581558        SendCmd "legend2 $_currentColormap $w $h"
    15591559    }
     
    15661566    # Keep track of the colormaps that we build.
    15671567    if { $name != "none" && ![info exists _colormaps($name)] } {
    1568         BuildColormap $name 
     1568        BuildColormap $name
    15691569        set _colormaps($name) 1
    15701570    }
     
    15931593itcl::configbody Rappture::VtkImageViewer::mode {
    15941594    switch -- $itk_option(-mode) {
    1595         "volume" {
    1596             set _settings(-view3d) 1
    1597         }
    1598         "vtkimage" {
    1599             set _settings(-view3d) 0
    1600         }
    1601         default {
    1602             error "unknown mode settings \"$itk_option(-mode)\""
    1603         }
     1595        "volume" {
     1596            set _settings(-view3d) 1
     1597        }
     1598        "vtkimage" {
     1599            set _settings(-view3d) 0
     1600        }
     1601        default {
     1602            error "unknown mode settings \"$itk_option(-mode)\""
     1603        }
    16041604    }
    16051605    if { !$_reset } {
     
    16171617            SendCmd "screen bgcolor $rgb"
    16181618        }
    1619         $itk_component(view) configure -background $itk_option(-plotbackground)
     1619        $itk_component(view) configure -background $itk_option(-plotbackground)
    16201620    }
    16211621}
     
    16751675
    16761676    itk_component add field_l {
    1677         label $inner.field_l -text "Field" -font "Arial 9" 
     1677        label $inner.field_l -text "Field" -font "Arial 9"
    16781678    } {
    16791679        ignore -font
     
    16851685        [itcl::code $this AdjustSetting -field]
    16861686
    1687     label $inner.colormap_l -text "Colormap" -font "Arial 9" 
     1687    label $inner.colormap_l -text "Colormap" -font "Arial 9"
    16881688    itk_component add colormap {
    16891689        Rappture::Combobox $inner.colormap -width 10 -editable no
     
    16951695        [itcl::code $this AdjustSetting -colormap]
    16961696
    1697     label $inner.backingcolor_l -text "Backing Color" -font "Arial 9" 
     1697    label $inner.backingcolor_l -text "Backing Color" -font "Arial 9"
    16981698    itk_component add backingcolor {
    16991699        Rappture::Combobox $inner.backingcolor -width 10 -editable no
     
    17091709        "red"                "red"              \
    17101710        "white"              "white"            \
    1711         "none"               "none"
     1711        "none"               "none"
    17121712
    17131713    $itk_component(backingcolor) value $_settings(-backingcolor)
    17141714    bind $inner.backingcolor <<Value>> \
    1715         [itcl::code $this AdjustSetting -backingcolor]
    1716 
    1717     label $inner.background_l -text "Background Color" -font "Arial 9" 
     1715        [itcl::code $this AdjustSetting -backingcolor]
     1716
     1717    label $inner.background_l -text "Background Color" -font "Arial 9"
    17181718    itk_component add background {
    17191719        Rappture::Combobox $inner.background -width 10 -editable no
     
    17221722        "black"              "black"            \
    17231723        "white"              "white"            \
    1724         "grey"               "grey"             
     1724        "grey"               "grey"
    17251725
    17261726    $itk_component(background) value "white"
     
    17731773        2,0 $inner.backingcolor_l  -anchor w -pady 2  \
    17741774        2,1 $inner.backingcolor    -anchor w -pady 2 -fill x  \
    1775         3,0 $inner.background_l -anchor w -pady 2 \
    1776         3,1 $inner.background -anchor w -pady 2  -fill x \
     1775        3,0 $inner.background_l -anchor w -pady 2 \
     1776        3,1 $inner.background -anchor w -pady 2  -fill x \
    17771777        4,0 $inner.backing -anchor w -pady 2 -cspan 2 \
    17781778        5,0 $inner.stretch    -anchor w -pady 2 -cspan 2 \
     
    17871787        16,1 $inner.window   -fill x   -pady 2 \
    17881788        17,0 $inner.level_l -anchor w -pady 2 \
    1789         17,1 $inner.level   -fill x   -pady 2 
     1789        17,1 $inner.level   -fill x   -pady 2
    17901790
    17911791    blt::table configure $inner r* c* -resize none
     
    18131813        -command [itcl::code $this AdjustSetting -axislabels] \
    18141814        -font "Arial 9"
    1815     label $inner.grid_l -text "Grid" -font "Arial 9" 
     1815    label $inner.grid_l -text "Grid" -font "Arial 9"
    18161816    checkbutton $inner.xgrid \
    18171817        -text "X" \
     
    18351835        -font "Arial 9"
    18361836
    1837     label $inner.mode_l -text "Mode" -font "Arial 9" 
     1837    label $inner.mode_l -text "Mode" -font "Arial 9"
    18381838
    18391839    itk_component add axisflymode {
     
    18441844        "closest_triad"   "closest" \
    18451845        "furthest_triad"  "farthest" \
    1846         "outer_edges"     "outer"         
     1846        "outer_edges"     "outer"
    18471847    $itk_component(axisflymode) value $_settings(-axisflymode)
    18481848    bind $inner.mode <<Value>> [itcl::code $this AdjustSetting -axisflymode]
     
    18521852        1,0 $inner.labels  -anchor w -cspan 4 \
    18531853        2,0 $inner.minorticks  -anchor w -cspan 4 \
    1854         4,0 $inner.grid_l  -anchor w \
     1854        4,0 $inner.grid_l  -anchor w \
    18551855        4,1 $inner.xgrid   -anchor w \
    18561856        4,2 $inner.ygrid   -anchor w \
    18571857        4,3 $inner.zgrid   -anchor w \
    18581858        5,0 $inner.mode_l  -anchor w -padx { 2 0 } \
    1859         5,1 $inner.mode    -fill x -cspan 3 
     1859        5,1 $inner.mode    -fill x -cspan 3
    18601860
    18611861    blt::table configure $inner r* c* -resize none
     
    19161916
    19171917#
    1918 #  camera -- 
     1918#  camera --
    19191919#
    19201920itcl::body Rappture::VtkImageViewer::camera {option args} {
    1921     switch -- $option { 
     1921    switch -- $option {
    19221922        "show" {
    19231923            puts [array get _view]
     
    19671967
    19681968itcl::body Rappture::VtkImageViewer::GetImage { args } {
    1969     if { [image width $_image(download)] > 0 && 
     1969    if { [image width $_image(download)] > 0 &&
    19701970         [image height $_image(download)] > 0 } {
    19711971        set bytes [$_image(download) data -format "jpeg -quality 100"]
     
    19801980        -title "[Rappture::filexfer::label downloadWord] as..."
    19811981    set inner [$popup component inner]
    1982     label $inner.summary -text "" -anchor w 
     1982    label $inner.summary -text "" -anchor w
    19831983    radiobutton $inner.vtk_button -text "VTK data file" \
    19841984        -variable [itcl::scope _downloadPopup(format)] \
    19851985        -font "Arial 9 " \
    1986         -value vtk 
     1986        -value vtk
    19871987    Rappture::Tooltip::for $inner.vtk_button "Save as VTK data file."
    19881988    radiobutton $inner.image_button -text "Image File" \
    19891989        -variable [itcl::scope _downloadPopup(format)] \
    19901990        -font "Arial 9 " \
    1991         -value image 
     1991        -value image
    19921992    Rappture::Tooltip::for $inner.image_button \
    19931993        "Save as digital image."
     
    20102010        2,0 $inner.image_button -anchor w -cspan 2 -padx { 4 0 } \
    20112011        4,1 $inner.cancel -width .9i -fill y \
    2012         4,0 $inner.ok -padx 2 -width .9i -fill y 
     2012        4,0 $inner.ok -padx 2 -width .9i -fill y
    20132013    blt::table configure $inner r3 -height 4
    20142014    blt::table configure $inner r4 -pady 4
     
    20212021# SetObjectStyle --
    20222022#
    2023 #       Set the style of the image/contour object.  This gets calls 
     2023#       Set the style of the image/contour object.  This gets calls
    20242024#       for each dataset once as it is loaded.  It can overridden by
    20252025#       the user controls.
     
    20632063    SendCmd "outline visible $_settings(-outline) $tag"
    20642064    SendCmd "image add $tag"
    2065     SetCurrentColormap $style(-color) 
     2065    SetCurrentColormap $style(-color)
    20662066    set color [$itk_component(backingcolor) value]
    20672067    SendCmd "image color [Color2RGB $color] $tag"
     
    20942094        #puts stderr "read $size bytes for [image width $_image(legend)]x[image height $_image(legend)] legend>"
    20952095        if { [catch {DrawLegend} errs] != 0 } {
    2096             global errorInfo
    2097             puts stderr "errs=$errs errorInfo=$errorInfo"
     2096            global errorInfo
     2097            puts stderr "errs=$errs errorInfo=$errorInfo"
    20982098        }
    20992099    }
     
    21122112    set font "Arial 8"
    21132113    set lineht [font metrics $font -linespace]
    2114    
     2114
    21152115    if { [string match "component*" $fname] } {
    2116         set title ""
     2116        set title ""
    21172117    } else {
    2118         if { [info exists _fields($fname)] } {
    2119             foreach { title units } $_fields($fname) break
    2120             if { $units != "" } {
    2121                 set title [format "%s (%s)" $title $units]
    2122             }
    2123         } else {
    2124             set title $fname
    2125         }
     2118        if { [info exists _fields($fname)] } {
     2119            foreach { title units } $_fields($fname) break
     2120            if { $units != "" } {
     2121                set title [format "%s (%s)" $title $units]
     2122            }
     2123        } else {
     2124            set title $fname
     2125        }
    21262126    }
    21272127    set x [expr $w - 2]
    21282128    if { !$_settings(-legendvisible) } {
    2129         $c delete legend
    2130         return
    2131     } 
     2129        $c delete legend
     2130        return
     2131    }
    21322132    if { [$c find withtag "legend"] == "" } {
    2133         set y 2
    2134         # If there's a legend title, create a text item for the title.
     2133        set y 2
     2134        # If there's a legend title, create a text item for the title.
    21352135        $c create text $x $y \
    21362136            -anchor ne \
     
    21402140            incr y $lineht
    21412141        }
    2142         $c create text $x $y \
     2142        $c create text $x $y \
    21432143            -anchor ne \
    21442144            -fill $itk_option(-plotforeground) -tags "vmax legend" \
    21452145            -font $font
    21462146        incr y $lineht
    2147         $c create image $x $y \
    2148             -anchor ne \
    2149             -image $_image(legend) -tags "colormap legend"
    2150         $c create rectangle $x $y 1 1 \
    2151             -fill "" -outline "" -tags "sensor legend"
    2152         $c create text $x [expr {$h-2}] \
    2153             -anchor se \
    2154             -fill $itk_option(-plotforeground) -tags "vmin legend" \
    2155             -font $font
    2156         $c bind sensor <Enter> [itcl::code $this EnterLegend %x %y]
    2157         $c bind sensor <Leave> [itcl::code $this LeaveLegend]
    2158         $c bind sensor <Motion> [itcl::code $this MotionLegend %x %y]
     2147        $c create image $x $y \
     2148            -anchor ne \
     2149            -image $_image(legend) -tags "colormap legend"
     2150        $c create rectangle $x $y 1 1 \
     2151            -fill "" -outline "" -tags "sensor legend"
     2152        $c create text $x [expr {$h-2}] \
     2153            -anchor se \
     2154            -fill $itk_option(-plotforeground) -tags "vmin legend" \
     2155            -font $font
     2156        $c bind sensor <Enter> [itcl::code $this EnterLegend %x %y]
     2157        $c bind sensor <Leave> [itcl::code $this LeaveLegend]
     2158        $c bind sensor <Motion> [itcl::code $this MotionLegend %x %y]
    21592159    }
    21602160
     
    21702170    if { [info exists _limits($_curFldName)] } {
    21712171        foreach { vmin vmax } $_limits($_curFldName) break
    2172         $c itemconfigure vmin -text [format %g $vmin]
    2173         $c itemconfigure vmax -text [format %g $vmax]
     2172        $c itemconfigure vmin -text [format %g $vmin]
     2173        $c itemconfigure vmax -text [format %g $vmax]
    21742174    }
    21752175    set y 2
     
    21772177    if { $title != "" } {
    21782178        $c itemconfigure title -text $title
    2179         $c coords title $x $y
    2180         incr y $lineht
     2179        $c coords title $x $y
     2180        incr y $lineht
    21812181    }
    21822182    $c coords vmax $x $y
     
    22262226    set font "Arial 8"
    22272227    set lineht [font metrics $font -linespace]
    2228    
     2228
    22292229    set ih [image height $_image(legend)]
    22302230    # Subtract off the offset of the color ramp from the top of the canvas
     
    22322232
    22332233    if { [string match "component*" $fname] } {
    2234         set title ""
     2234        set title ""
    22352235    } else {
    2236         if { [info exists _fields($fname)] } {
    2237             foreach { title units } $_fields($fname) break
    2238             if { $units != "" } {
    2239                 set title [format "%s (%s)" $title $units]
    2240             }
    2241         } else {
    2242             set title $fname
    2243         }
     2236        if { [info exists _fields($fname)] } {
     2237            foreach { title units } $_fields($fname) break
     2238            if { $units != "" } {
     2239                set title [format "%s (%s)" $title $units]
     2240            }
     2241        } else {
     2242            set title $fname
     2243        }
    22442244    }
    22452245    # If there's a legend title, increase the offset by the line height.
     
    22572257    }
    22582258    set color [eval format "\#%02x%02x%02x" $pixel]
    2259     $_image(swatch) put black  -to 0 0 23 23 
    2260     $_image(swatch) put $color -to 1 1 22 22 
     2259    $_image(swatch) put black  -to 0 0 23 23
     2260    $_image(swatch) put $color -to 1 1 22 22
    22612261
    22622262    # Compute the value of the point
     
    22682268        set value 0.0
    22692269    }
    2270     set tipx [expr $x + 15] 
     2270    set tipx [expr $x + 15]
    22712271    set tipy [expr $y - 5]
    22722272    .rappturetooltip configure -icon $_image(swatch)
     
    22762276        Rappture::Tooltip::text $c [format "$title %g" $value]
    22772277    }
    2278     Rappture::Tooltip::tooltip show $c +$tipx,+$tipy   
     2278    Rappture::Tooltip::tooltip show $c +$tipx,+$tipy
    22792279}
    22802280
     
    22912291# ----------------------------------------------------------------------
    22922292itcl::body Rappture::VtkImageViewer::Combo {option} {
    2293     set c $itk_component(view) 
     2293    set c $itk_component(view)
    22942294    switch -- $option {
    22952295        post {
     
    23042304        }
    23052305        deactivate {
    2306             $c itemconfigure title -fill $itk_option(-plotforeground) 
     2306            $c itemconfigure title -fill $itk_option(-plotforeground)
    23072307        }
    23082308        invoke {
     
    23162316}
    23172317
    2318 itcl::body Rappture::VtkImageViewer::SetOrientation { side } { 
     2318itcl::body Rappture::VtkImageViewer::SetOrientation { side } {
    23192319    array set positions {
    23202320        front  "0.707107 0.707107 0 0"
     
    23272327    foreach name { -qw -qx -qy -qz } value $positions($side) {
    23282328        set _view($name) $value
    2329     } 
     2329    }
    23302330    set q [ViewToQuaternion]
    23312331    $_arcball quaternion $q
  • trunk/gui/scripts/vtkmeshviewer.tcl

    r4771 r5006  
    1 # -*- mode: tcl; indent-tabs-mode: nil -*- 
     1# -*- mode: tcl; indent-tabs-mode: nil -*-
    22# ----------------------------------------------------------------------
    33#  COMPONENT: vtkmeshviewer - Vtk mesh viewer
     
    5858    public method isconnected {}
    5959    public method limits { dataobj }
    60     public method parameters {title args} { 
    61         # do nothing 
     60    public method parameters {title args} {
     61        # do nothing
    6262    }
    6363    public method scale {args}
     
    6767    private method BuildAxisTab {}
    6868    private method BuildCameraTab {}
    69     private method BuildDownloadPopup { widget command } 
     69    private method BuildDownloadPopup { widget command }
    7070    private method BuildPolydataTab {}
    7171    private method Connect {}
     
    7474    private method DoResize {}
    7575    private method DoRotate {}
    76     private method EventuallyResize { w h } 
    77     private method EventuallyRotate { q } 
    78     private method EventuallySetPolydataOpacity {} 
    79     private method GetImage { args } 
    80     private method GetVtkData { args } 
     76    private method EventuallyResize { w h }
     77    private method EventuallyRotate { q }
     78    private method EventuallySetPolydataOpacity {}
     79    private method GetImage { args }
     80    private method GetVtkData { args }
    8181    private method InitSettings { args  }
    82     private method IsValidObject { dataobj } 
     82    private method IsValidObject { dataobj }
    8383    private method Pan {option x y}
    8484    private method PanCamera {}
    8585    private method Pick {x y}
    86     private method QuaternionToView { q } { 
     86    private method QuaternionToView { q } {
    8787        foreach { _view(-qw) _view(-qx) _view(-qy) _view(-qz) } $q break
    8888    }
     
    9191    private method ReceiveImage { args }
    9292    private method Rotate {option x y}
    93     private method SetObjectStyle { dataobj } 
     93    private method SetObjectStyle { dataobj }
    9494    private method SetOrientation { side }
    9595    private method SetPolydataOpacity {}
    96     private method ViewToQuaternion {} { 
     96    private method ViewToQuaternion {} {
    9797        return [list $_view(-qw) $_view(-qx) $_view(-qy) $_view(-qz)]
    9898    }
     
    100100
    101101    private variable _arcball ""
    102     private variable _dlist "";         # list of data objects
     102    private variable _dlist "";         # list of data objects
    103103    private variable _obj2datasets
    104     private variable _obj2ovride;       # maps dataobj => style override
    105     private variable _datasets;         # contains all the dataobj-component
    106                                         # datasets in the server
    107     private variable _dataset2style;    # maps dataobj-component to transfunc
    108     private variable _style2datasets;   # maps tf back to list of
    109                                         # dataobj-components using the tf.
     104    private variable _obj2ovride;       # maps dataobj => style override
     105    private variable _datasets;         # contains all the dataobj-component
     106                                        # datasets in the server
     107    private variable _dataset2style;    # maps dataobj-component to transfunc
     108    private variable _style2datasets;   # maps tf back to list of
     109                                        # dataobj-components using the tf.
    110110    private variable _click;            # info used for rotate operations
    111111    private variable _limits;           # autoscale min/max for all axes
     
    200200    array set _widget {
    201201        -polydataopacity        100
    202     }       
     202    }
    203203    itk_component add view {
    204204        canvas $itk_component(plotarea).view \
     
    211211    itk_component add fieldmenu {
    212212        menu $itk_component(plotarea).menu -bg black -fg white -relief flat \
    213             -tearoff no 
     213            -tearoff no
    214214    } {
    215215        usual
     
    232232
    233233    set _map(id) [$c create image 0 0 -anchor nw -image $_image(plot)]
    234     set _map(cwidth) -1 
    235     set _map(cheight) -1 
     234    set _map(cwidth) -1
     235    set _map(cheight) -1
    236236    set _map(zoom) 1.0
    237237    set _map(original) ""
     
    279279    BuildCameraTab
    280280
    281     # Hack around the Tk panewindow.  The problem is that the requested 
     281    # Hack around the Tk panewindow.  The problem is that the requested
    282282    # size of the 3d view isn't set until an image is retrieved from
    283283    # the server.  So the panewindow uses the tiny size.
     
    285285    pack forget $itk_component(view)
    286286    blt::table $itk_component(plotarea) \
    287         0,0 $itk_component(view) -fill both -reqwidth $w 
     287        0,0 $itk_component(view) -fill both -reqwidth $w
    288288    blt::table configure $itk_component(plotarea) c1 -resize none
    289289
     
    372372
    373373itcl::body Rappture::VtkMeshViewer::DoRotate {} {
    374     SendCmd "camera orient [ViewToQuaternion]" 
     374    SendCmd "camera orient [ViewToQuaternion]"
    375375    set _rotatePending 0
    376376}
     
    497497                    continue
    498498                }
    499                 if {[info exists _obj2ovride($dataobj-raise)] && 
     499                if {[info exists _obj2ovride($dataobj-raise)] &&
    500500                    $_obj2ovride($dataobj-raise)} {
    501501                    set dlist [linsert $dlist 0 $dataobj]
     
    525525            }
    526526            return $dlist
    527         }           
     527        }
    528528        -image {
    529529            if {[llength $args] != 2} {
     
    814814    # Turn on buffering of commands to the server.  We don't want to
    815815    # be preempted by a server disconnect/reconnect (which automatically
    816     # generates a new call to Rebuild).   
     816    # generates a new call to Rebuild).
    817817    StartBufferingCommands
    818818
     
    897897        InitSettings -polydataedges -polydatalighting -polydataopacity \
    898898            -polydatavisible -polydatawireframe
    899  
     899
    900900        #SendCmd "axis lformat all %g"
    901901
     
    933933itcl::body Rappture::VtkMeshViewer::CurrentDatasets {args} {
    934934    set flag [lindex $args 0]
    935     switch -- $flag { 
     935    switch -- $flag {
    936936        "-all" {
    937937            if { [llength $args] > 1 } {
     
    952952                set dlist [get -visible]
    953953            }
    954         }           
     954        }
    955955        default {
    956956            set dlist $args
     
    10681068    foreach tag [CurrentDatasets -visible] {
    10691069        SendCmd "dataset getscalar pixel $x $y $tag"
    1070     } 
     1070    }
    10711071}
    10721072
     
    12451245        set f [open "$tmpfile" "w"]
    12461246        fconfigure $f -translation binary -encoding binary
    1247         puts $f $data 
     1247        puts $f $data
    12481248        close $f
    12491249        set reader [vtkDataSetReader $tag-xvtkDataSetReader]
     
    12931293        -variable [itcl::scope _settings(-polydatavisible)] \
    12941294        -command [itcl::code $this AdjustSetting -polydatavisible] \
    1295         -font "Arial 9" -anchor w 
     1295        -font "Arial 9" -anchor w
    12961296
    12971297    checkbutton $inner.outline \
     
    12991299        -variable [itcl::scope _settings(-outline)] \
    13001300        -command [itcl::code $this AdjustSetting -outline] \
    1301         -font "Arial 9" -anchor w 
     1301        -font "Arial 9" -anchor w
    13021302
    13031303    checkbutton $inner.wireframe \
     
    13051305        -variable [itcl::scope _settings(-polydatawireframe)] \
    13061306        -command [itcl::code $this AdjustSetting -polydatawireframe] \
    1307         -font "Arial 9" -anchor w 
     1307        -font "Arial 9" -anchor w
    13081308
    13091309    checkbutton $inner.lighting \
     
    13201320
    13211321    itk_component add field_l {
    1322         label $inner.field_l -text "Field" -font "Arial 9" 
     1322        label $inner.field_l -text "Field" -font "Arial 9"
    13231323    } {
    13241324        ignore -font
     
    13301330        [itcl::code $this AdjustSetting -field]
    13311331
    1332     label $inner.opacity_l -text "Opacity" -font "Arial 9" -anchor w 
     1332    label $inner.opacity_l -text "Opacity" -font "Arial 9" -anchor w
    13331333    ::scale $inner.opacity -from 0 -to 100 -orient horizontal \
    13341334        -variable [itcl::scope _widget(-polydataopacity)] \
     
    13451345        4,0 $inner.edges     -cspan 2  -anchor w -pady 2 \
    13461346        5,0 $inner.opacity_l -anchor w -pady 2 \
    1347         5,1 $inner.opacity   -fill x   -pady 2 
     1347        5,1 $inner.opacity   -fill x   -pady 2
    13481348
    13491349    blt::table configure $inner r* c* -resize none
     
    13721372        -command [itcl::code $this AdjustSetting -axislabels] \
    13731373        -font "Arial 9"
    1374     label $inner.grid_l -text "Grid" -font "Arial 9" 
     1374    label $inner.grid_l -text "Grid" -font "Arial 9"
    13751375    checkbutton $inner.xgrid \
    13761376        -text "X" \
     
    13941394        -font "Arial 9"
    13951395
    1396     label $inner.mode_l -text "Mode" -font "Arial 9" 
     1396    label $inner.mode_l -text "Mode" -font "Arial 9"
    13971397
    13981398    itk_component add axismode {
     
    14031403        "closest_triad"   "closest" \
    14041404        "furthest_triad"  "farthest" \
    1405         "outer_edges"     "outer"         
     1405        "outer_edges"     "outer"
    14061406    $itk_component(axismode) value "static"
    14071407    bind $inner.mode <<Value>> [itcl::code $this AdjustSetting -axismode]
     
    14751475
    14761476#
    1477 #  camera -- 
     1477#  camera --
    14781478#
    14791479itcl::body Rappture::VtkMeshViewer::camera {option args} {
    1480     switch -- $option { 
     1480    switch -- $option {
    14811481        "show" {
    14821482            puts [array get _view]
     
    15231523
    15241524itcl::body Rappture::VtkMeshViewer::GetImage { args } {
    1525     if { [image width $_image(download)] > 0 && 
     1525    if { [image width $_image(download)] > 0 &&
    15261526         [image height $_image(download)] > 0 } {
    15271527        set bytes [$_image(download) data -format "jpeg -quality 100"]
     
    15361536        -title "[Rappture::filexfer::label downloadWord] as..."
    15371537    set inner [$popup component inner]
    1538     label $inner.summary -text "" -anchor w 
     1538    label $inner.summary -text "" -anchor w
    15391539    radiobutton $inner.vtk_button -text "VTK data file" \
    15401540        -variable [itcl::scope _downloadPopup(format)] \
    15411541        -font "Helvetica 9 " \
    1542         -value vtk 
     1542        -value vtk
    15431543    Rappture::Tooltip::for $inner.vtk_button "Save as VTK data file."
    15441544    radiobutton $inner.image_button -text "Image File" \
    15451545        -variable [itcl::scope _downloadPopup(format)] \
    1546         -value image 
     1546        -value image
    15471547    Rappture::Tooltip::for $inner.image_button \
    15481548        "Save as digital image."
     
    15651565        2,0 $inner.image_button -anchor w -cspan 2 -padx { 4 0 } \
    15661566        4,1 $inner.cancel -width .9i -fill y \
    1567         4,0 $inner.ok -padx 2 -width .9i -fill y 
     1567        4,0 $inner.ok -padx 2 -width .9i -fill y
    15681568    blt::table configure $inner r3 -height 4
    15691569    blt::table configure $inner r4 -pady 4
     
    16341634}
    16351635
    1636 itcl::body Rappture::VtkMeshViewer::SetOrientation { side } { 
     1636itcl::body Rappture::VtkMeshViewer::SetOrientation { side } {
    16371637    array set positions {
    16381638        front "1 0 0 0"
     
    16451645    foreach name { -qw -qx -qy -qz } value $positions($side) {
    16461646        set _view($name) $value
    1647     } 
     1647    }
    16481648    set q [ViewToQuaternion]
    16491649    $_arcball quaternion $q
  • trunk/gui/scripts/vtkstreamlinesviewer.tcl

    r4942 r5006  
    1 # -*- mode: tcl; indent-tabs-mode: nil -*- 
     1# -*- mode: tcl; indent-tabs-mode: nil -*-
    22# ----------------------------------------------------------------------
    33#  COMPONENT: vtkstreamlinesviewer - Vtk streamlines 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 colors }
    6969    private method BuildCutplaneTab {}
    70     private method BuildDownloadPopup { widget command } 
     70    private method BuildDownloadPopup { widget command }
    7171    private method BuildStreamsTab {}
    7272    private method BuildVolumeTab {}
     
    7979    private method DoReseed {}
    8080    private method DoRotate {}
    81     private method EnterLegend { x y } 
    82     private method EventuallyResize { w h } 
    83     private method EventuallyReseed { numPoints } 
    84     private method EventuallyRotate { q } 
    85     private method EventuallySetCutplane { axis args } 
    86     private method GetImage { args } 
    87     private method GetVtkData { args } 
     81    private method EnterLegend { x y }
     82    private method EventuallyResize { w h }
     83    private method EventuallyReseed { numPoints }
     84    private method EventuallyRotate { q }
     85    private method EventuallySetCutplane { axis args }
     86    private method GetImage { args }
     87    private method GetVtkData { args }
    8888    private method InitSettings { args  }
    89     private method IsValidObject { dataobj } 
     89    private method IsValidObject { dataobj }
    9090    private method LeaveLegend {}
    91     private method MotionLegend { x y } 
     91    private method MotionLegend { x y }
    9292    private method Pan {option x y}
    9393    private method PanCamera {}
    9494    private method Pick {x y}
    95     private method QuaternionToView { q } { 
     95    private method QuaternionToView { q } {
    9696        foreach { _view(-qw) _view(-qx) _view(-qy) _view(-qz) } $q break
    9797    }
     
    105105    private method ChangeColormap { dataobj comp color }
    106106    private method SetLegendTip { x y }
    107     private method SetObjectStyle { dataobj comp } 
    108     private method Slice {option args} 
     107    private method SetObjectStyle { dataobj comp }
     108    private method Slice {option args}
    109109    private method SetOrientation { side }
    110     private method ViewToQuaternion {} { 
     110    private method ViewToQuaternion {} {
    111111        return [list $_view(-qw) $_view(-qx) $_view(-qy) $_view(-qz)]
    112112    }
     
    118118    private variable _obj2datasets
    119119    private variable _obj2ovride   ;    # maps dataobj => style override
    120     private variable _datasets     ;    # contains all the dataobj-component 
     120    private variable _datasets     ;    # contains all the dataobj-component
    121121                                   ;    # datasets in the server
    122122    private variable _colormaps    ;    # contains all the colormaps
     
    147147    private variable _cutplanePending 0
    148148    private variable _legendPending 0
    149     private variable _vectorFields 
    150     private variable _scalarFields 
    151     private variable _fields 
     149    private variable _vectorFields
     150    private variable _scalarFields
     151    private variable _fields
    152152    private variable _curFldName ""
    153153    private variable _curFldLabel ""
     
    271271    itk_component add fieldmenu {
    272272        menu $itk_component(plotarea).menu -bg black -fg white -relief flat \
    273             -tearoff no 
     273            -tearoff no
    274274    } {
    275275        usual
     
    291291
    292292    set _map(id) [$c create image 0 0 -anchor nw -image $_image(plot)]
    293     set _map(cwidth) -1 
    294     set _map(cheight) -1 
     293    set _map(cwidth) -1
     294    set _map(cheight) -1
    295295    set _map(zoom) 1.0
    296296    set _map(original) ""
     
    338338            -offimage [Rappture::icon volume-off] \
    339339            -variable [itcl::scope _settings(-volumevisible)] \
    340             -command [itcl::code $this AdjustSetting -volumevisible] 
     340            -command [itcl::code $this AdjustSetting -volumevisible]
    341341    }
    342342    $itk_component(volume) select
     
    362362            -offimage [Rappture::icon cutbutton] \
    363363            -variable [itcl::scope _settings(-cutplanevisible)] \
    364             -command [itcl::code $this AdjustSetting -cutplanevisible] 
     364            -command [itcl::code $this AdjustSetting -cutplanevisible]
    365365    }
    366366    Rappture::Tooltip::for $itk_component(cutplane) \
     
    382382    set _image(legend) [image create photo]
    383383    itk_component add legend {
    384         canvas $itk_component(plotarea).legend -width 50 -highlightthickness 0 
     384        canvas $itk_component(plotarea).legend -width 50 -highlightthickness 0
    385385    } {
    386386        usual
     
    389389    }
    390390
    391     # Hack around the Tk panewindow.  The problem is that the requested 
     391    # Hack around the Tk panewindow.  The problem is that the requested
    392392    # size of the 3d view isn't set until an image is retrieved from
    393393    # the server.  So the panewindow uses the tiny size.
     
    395395    pack forget $itk_component(view)
    396396    blt::table $itk_component(plotarea) \
    397         0,0 $itk_component(view) -fill both -reqwidth $w 
     397        0,0 $itk_component(view) -fill both -reqwidth $w
    398398    blt::table configure $itk_component(plotarea) c1 -resize none
    399399
     
    480480
    481481itcl::body Rappture::VtkStreamlinesViewer::DoRotate {} {
    482     SendCmd "camera orient [ViewToQuaternion]" 
     482    SendCmd "camera orient [ViewToQuaternion]"
    483483    set _rotatePending 0
    484484}
     
    517517    if { !$_rotatePending } {
    518518        set _rotatePending 1
    519         global rotate_delay 
     519        global rotate_delay
    520520        $_dispatcher event -after $rotate_delay !rotate
    521521    }
     
    621621                    continue
    622622                }
    623                 if {[info exists _obj2ovride($dataobj-raise)] && 
     623                if {[info exists _obj2ovride($dataobj-raise)] &&
    624624                    $_obj2ovride($dataobj-raise)} {
    625625                    set dlist [linsert $dlist 0 $dataobj]
     
    649649            }
    650650            return $dlist
    651         }           
     651        }
    652652        -image {
    653653            if {[llength $args] != 2} {
     
    791791            set info {}
    792792            set user "???"
    793             if { [info exists env(USER)] } {
     793            if { [info exists env(USER)] } {
    794794                set user $env(USER)
    795             }
     795            }
    796796            set session "???"
    797             if { [info exists env(SESSION)] } {
     797            if { [info exists env(SESSION)] } {
    798798                set session $env(SESSION)
    799             }
     799            }
    800800            lappend info "version" "$Rappture::version"
    801801            lappend info "build" "$Rappture::build"
     
    851851    $_dispatcher cancel !legend
    852852    # disconnected -- no more data sitting on server
    853     array unset _datasets 
    854     array unset _data 
    855     array unset _colormaps 
    856     array unset _seeds 
    857     array unset _dataset2style 
    858     array unset _obj2datasets 
     853    array unset _datasets
     854    array unset _data
     855    array unset _colormaps
     856    array unset _seeds
     857    array unset _dataset2style
     858    array unset _obj2datasets
    859859}
    860860
     
    884884        set time [clock seconds]
    885885        set date [clock format $time]
    886         #puts stderr "$date: received image [image width $_image(plot)]x[image height $_image(plot)] image>"       
     886        #puts stderr "$date: received image [image width $_image(plot)]x[image height $_image(plot)] image>"
    887887        if { $_start > 0 } {
    888888            set finish [clock clicks -milliseconds]
     
    964964    set _first ""
    965965    if { $_reset } {
    966         set _width $w
    967         set _height $h
    968         $_arcball resize $w $h
    969         DoResize
    970         InitSettings -xgrid -ygrid -zgrid -axismode \
    971             -axesvisible -axislabelsvisible -axisminorticks
     966        set _width $w
     967        set _height $h
     968        $_arcball resize $w $h
     969        DoResize
     970        InitSettings -xgrid -ygrid -zgrid -axismode \
     971            -axesvisible -axislabelsvisible -axisminorticks
    972972        # This "imgflush" is to force an image returned before vtkvis starts
    973973        # reading a (big) dataset.  This will display an empty plot with axes
     
    988988                set bytes [$dataobj vtkdata $comp]
    989989                set length [string length $bytes]
    990                 if 0 {
     990                if 0 {
    991991                    set f [open /tmp/vtkstreamlines.vtk "w"]
    992992                    fconfigure $f -translation binary -encoding binary
    993993                    puts -nonewline $f $bytes
    994994                    close $f
    995                 }
     995                }
    996996                if { $_reportClientInfo }  {
    997997                    set info {}
     
    10321032            }
    10331033        }
    1034         $itk_component(field) choices delete 0 end
    1035         $itk_component(fieldmenu) delete 0 end
    1036         array unset _fields
     1034        $itk_component(field) choices delete 0 end
     1035        $itk_component(fieldmenu) delete 0 end
     1036        array unset _fields
    10371037        set _curFldName ""
    10381038        foreach cname [$_first components] {
     
    10681068            -volumevisible -volumeedges -volumelighting -volumeopacity \
    10691069            -volumewireframe \
    1070             -cutplanevisible \
    1071             -cutplanexposition -cutplaneyposition -cutplanezposition \
    1072             -cutplanexvisible -cutplaneyvisible -cutplanezvisible
    1073 
    1074         # Reset the camera and other view parameters
    1075         $_arcball quaternion [ViewToQuaternion]
    1076         if {$_view(-ortho)} {
    1077             SendCmd "camera mode ortho"
    1078         } else {
    1079             SendCmd "camera mode persp"
    1080         }
    1081         DoRotate
    1082         PanCamera
     1070            -cutplanevisible \
     1071            -cutplanexposition -cutplaneyposition -cutplanezposition \
     1072            -cutplanexvisible -cutplaneyvisible -cutplanezvisible
     1073
     1074        # Reset the camera and other view parameters
     1075        $_arcball quaternion [ViewToQuaternion]
     1076        if {$_view(-ortho)} {
     1077            SendCmd "camera mode ortho"
     1078        } else {
     1079            SendCmd "camera mode persp"
     1080        }
     1081        DoRotate
     1082        PanCamera
    10831083        Zoom reset
    10841084        SendCmd "camera reset"
     
    11011101itcl::body Rappture::VtkStreamlinesViewer::CurrentDatasets {args} {
    11021102    set flag [lindex $args 0]
    1103     switch -- $flag { 
     1103    switch -- $flag {
    11041104        "-all" {
    11051105            if { [llength $args] > 1 } {
     
    11201120                set dlist [get -visible]
    11211121            }
    1122         }           
     1122        }
    11231123        default {
    11241124            set dlist $args
     
    12391239    foreach tag [CurrentDatasets -visible] {
    12401240        SendCmdNoWait "dataset getscalar pixel $x $y $tag"
    1241     } 
     1241    }
    12421242}
    12431243
     
    16661666        2,0 $inner.edges     -anchor w -pady 2 -cspan 3 \
    16671667        3,0 $inner.opacity_l -anchor w -pady 2 \
    1668         3,1 $inner.opacity   -fill x   -pady 2 
     1668        3,1 $inner.opacity   -fill x   -pady 2
    16691669
    16701670    blt::table configure $inner r* c* -resize none
     
    16871687        -command [itcl::code $this AdjustSetting -streamlinesvisible] \
    16881688        -font "Arial 9"
    1689    
     1689
    16901690    checkbutton $inner.lighting \
    16911691        -text "Enable Lighting" \
     
    17001700        -font "Arial 9"
    17011701
    1702     label $inner.mode_l -text "Mode" -font "Arial 9" 
     1702    label $inner.mode_l -text "Mode" -font "Arial 9"
    17031703    itk_component add streammode {
    17041704        Rappture::Combobox $inner.mode -width 10 -editable no
     
    17071707        "lines"    "lines" \
    17081708        "ribbons"   "ribbons" \
    1709         "tubes"     "tubes" 
     1709        "tubes"     "tubes"
    17101710    $itk_component(streammode) value $_settings(-streamlinesmode)
    17111711    bind $inner.mode <<Value>> [itcl::code $this AdjustSetting -streamlinesmode]
     
    17321732        -command [itcl::code $this AdjustSetting -streamlinesscale]
    17331733
    1734     label $inner.field_l -text "Color by" -font "Arial 9" 
     1734    label $inner.field_l -text "Color by" -font "Arial 9"
    17351735    itk_component add field {
    17361736        Rappture::Combobox $inner.field -width 10 -editable no
     
    17391739        [itcl::code $this AdjustSetting -field]
    17401740
    1741     label $inner.colormap_l -text "Colormap" -font "Arial 9" 
     1741    label $inner.colormap_l -text "Colormap" -font "Arial 9"
    17421742    itk_component add colormap {
    17431743        Rappture::Combobox $inner.colormap -width 10 -editable no
     
    17881788        -command [itcl::code $this AdjustSetting -axislabelsvisible] \
    17891789        -font "Arial 9"
    1790     label $inner.grid_l -text "Grid" -font "Arial 9" 
     1790    label $inner.grid_l -text "Grid" -font "Arial 9"
    17911791    checkbutton $inner.xgrid \
    17921792        -text "X" \
     
    18101810        -font "Arial 9"
    18111811
    1812     label $inner.mode_l -text "Mode" -font "Arial 9" 
     1812    label $inner.mode_l -text "Mode" -font "Arial 9"
    18131813
    18141814    itk_component add axismode {
     
    18191819        "closest_triad"   "closest" \
    18201820        "furthest_triad"  "farthest" \
    1821         "outer_edges"     "outer"         
     1821        "outer_edges"     "outer"
    18221822    $itk_component(axismode) value $_settings(-axismode)
    18231823    bind $inner.mode <<Value>> [itcl::code $this AdjustSetting -axismode]
     
    18931893
    18941894    set fg [option get $itk_component(hull) font Font]
    1895    
     1895
    18961896    set inner [$itk_component(main) insert end \
    18971897        -title "Cutplane Settings" \
    1898         -icon [Rappture::icon cutbutton]] 
     1898        -icon [Rappture::icon cutbutton]]
    18991899
    19001900    $inner configure -borderwidth 4
     
    19501950            -command [itcl::code $this EventuallySetCutplane x] \
    19511951            -variable [itcl::scope _settings(-cutplanexposition)] \
    1952             -foreground red3 -font "Arial 9 bold"
     1952            -foreground red3 -font "Arial 9 bold"
    19531953    } {
    19541954        usual
     
    19791979            -command [itcl::code $this EventuallySetCutplane y] \
    19801980            -variable [itcl::scope _settings(-cutplaneyposition)] \
    1981             -foreground green3 -font "Arial 9 bold"
     1981            -foreground green3 -font "Arial 9 bold"
    19821982    } {
    19831983        usual
     
    20082008            -command [itcl::code $this EventuallySetCutplane z] \
    20092009            -variable [itcl::scope _settings(-cutplanezposition)] \
    2010             -foreground blue3 -font "Arial 9 bold"
     2010            -foreground blue3 -font "Arial 9 bold"
    20112011    } {
    20122012        usual
     
    20242024        3,0 $inner.opacity_l            -anchor w -pady 2 -cspan 1 \
    20252025        3,1 $inner.opacity              -fill x   -pady 2 -cspan 3 \
    2026         4,0 $itk_component(xCutButton)  -anchor w -padx 2 -pady 2 \
     2026        4,0 $itk_component(xCutButton)  -anchor w -padx 2 -pady 2 \
    20272027        5,0 $itk_component(yCutButton)  -anchor w -padx 2 -pady 2 \
    20282028        6,0 $itk_component(zCutButton)  -anchor w -padx 2 -pady 2 \
     
    20362036
    20372037#
    2038 #  camera -- 
     2038#  camera --
    20392039#
    20402040itcl::body Rappture::VtkStreamlinesViewer::camera {option args} {
    2041     switch -- $option { 
     2041    switch -- $option {
    20422042        "show" {
    20432043            puts [array get _view]
     
    20872087
    20882088itcl::body Rappture::VtkStreamlinesViewer::GetImage { args } {
    2089     if { [image width $_image(download)] > 0 && 
     2089    if { [image width $_image(download)] > 0 &&
    20902090         [image height $_image(download)] > 0 } {
    20912091        set bytes [$_image(download) data -format "jpeg -quality 100"]
     
    21002100        -title "[Rappture::filexfer::label downloadWord] as..."
    21012101    set inner [$popup component inner]
    2102     label $inner.summary -text "" -anchor w 
     2102    label $inner.summary -text "" -anchor w
    21032103    radiobutton $inner.vtk_button -text "VTK data file" \
    21042104        -variable [itcl::scope _downloadPopup(format)] \
    21052105        -font "Helvetica 9 " \
    2106         -value vtk 
     2106        -value vtk
    21072107    Rappture::Tooltip::for $inner.vtk_button "Save as VTK data file."
    21082108    radiobutton $inner.image_button -text "Image File" \
    21092109        -variable [itcl::scope _downloadPopup(format)] \
    2110         -value image 
     2110        -value image
    21112111    Rappture::Tooltip::for $inner.image_button \
    21122112        "Save as digital image."
     
    21292129        2,0 $inner.image_button -anchor w -cspan 2 -padx { 4 0 } \
    21302130        4,1 $inner.cancel -width .9i -fill y \
    2131         4,0 $inner.ok -padx 2 -width .9i -fill y 
     2131        4,0 $inner.ok -padx 2 -width .9i -fill y
    21322132    blt::table configure $inner r3 -height 4
    21332133    blt::table configure $inner r4 -pady 4
     
    21962196    set _legendPending 0
    21972197    set _title $title
    2198     regsub {\(mag\)} $title "" _title 
     2198    regsub {\(mag\)} $title "" _title
    21992199    if { [IsConnected] } {
    22002200        set bytes [ReceiveBytes $size]
     
    22232223    set font "Arial 8"
    22242224    set lineht [font metrics $font -linespace]
    2225    
     2225
    22262226    if { [info exists _fields($fname)] } {
    22272227        foreach { title units } $_fields($fname) break
     
    22352235        set x [expr $w - 2]
    22362236        if { [$c find withtag "legend"] == "" } {
    2237             set y 2 
     2237            set y 2
    22382238            $c create text $x $y \
    22392239                -anchor ne \
     
    23102310    set font "Arial 8"
    23112311    set lineht [font metrics $font -linespace]
    2312    
     2312
    23132313    set imgHeight [image height $_image(legend)]
    23142314    set coords [$c coords colormap]
     
    23332333    }
    23342334    set color [eval format "\#%02x%02x%02x" $pixel]
    2335     $_image(swatch) put black  -to 0 0 23 23 
    2336     $_image(swatch) put $color -to 1 1 22 22 
     2335    $_image(swatch) put black  -to 0 0 23 23
     2336    $_image(swatch) put $color -to 1 1 22 22
    23372337    .rappturetooltip configure -icon $_image(swatch)
    23382338
     
    23452345        set value 0.0
    23462346    }
    2347     set tipx [expr $x + 15] 
     2347    set tipx [expr $x + 15]
    23482348    set tipy [expr $y - 5]
    23492349    Rappture::Tooltip::text $c "$title $value"
    2350     Rappture::Tooltip::tooltip show $c +$tipx,+$tipy   
     2350    Rappture::Tooltip::tooltip show $c +$tipx,+$tipy
    23512351}
    23522352
     
    23932393# ----------------------------------------------------------------------
    23942394itcl::body Rappture::VtkStreamlinesViewer::Combo {option} {
    2395     set c $itk_component(view) 
     2395    set c $itk_component(view)
    23962396    switch -- $option {
    23972397        post {
     
    24062406        }
    24072407        deactivate {
    2408             $c itemconfigure title -fill white 
     2408            $c itemconfigure title -fill white
    24092409        }
    24102410        invoke {
     
    24182418}
    24192419
    2420 itcl::body Rappture::VtkStreamlinesViewer::SetOrientation { side } { 
     2420itcl::body Rappture::VtkStreamlinesViewer::SetOrientation { side } {
    24212421    array set positions {
    24222422        front "1 0 0 0"
     
    24292429    foreach name { -qw -qx -qy -qz } value $positions($side) {
    24302430        set _view($name) $value
    2431     } 
     2431    }
    24322432    set q [ViewToQuaternion]
    24332433    $_arcball quaternion $q
    2434     SendCmd "camera orient $q" 
     2434    SendCmd "camera orient $q"
    24352435    SendCmd "camera reset"
    24362436    set _view(-xpan) 0
  • trunk/gui/scripts/vtksurfaceviewer.tcl

    r4767 r5006  
    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
  • trunk/gui/scripts/vtkviewer.tcl

    r4773 r5006  
    1 # -*- mode: tcl; indent-tabs-mode: nil -*- 
     1# -*- mode: tcl; indent-tabs-mode: nil -*-
    22# ----------------------------------------------------------------------
    33#  COMPONENT: vtkviewer - Vtk drawing object viewer
     
    5858    public method isconnected {}
    5959    public method limits { dataobj }
    60     public method parameters {title args} { 
    61         # do nothing 
     60    public method parameters {title args} {
     61        # do nothing
    6262    }
    6363    public method scale {args}
     
    6969    private method BuildColormap { name styles }
    7070    private method BuildCutawayTab {}
    71     private method BuildDownloadPopup { widget command } 
     71    private method BuildDownloadPopup { widget command }
    7272    private method BuildGlyphsTab {}
    7373    private method BuildMoleculeTab {}
     
    8080    private method DoRotate {}
    8181    private method DrawLegend {}
    82     private method EnterLegend { x y } 
    83     private method EventuallyResize { w h } 
    84     private method EventuallyRotate { q } 
    85     private method EventuallySetAtomScale { args } 
    86     private method EventuallySetBondScale { args } 
    87     private method EventuallySetGlyphsOpacity { args } 
    88     private method EventuallySetMoleculeOpacity { args } 
    89     private method EventuallySetMoleculeQuality { args } 
    90     private method EventuallySetPolydataOpacity { args } 
    91     private method GetImage { args } 
    92     private method GetVtkData { args } 
     82    private method EnterLegend { x y }
     83    private method EventuallyResize { w h }
     84    private method EventuallyRotate { q }
     85    private method EventuallySetAtomScale { args }
     86    private method EventuallySetBondScale { args }
     87    private method EventuallySetGlyphsOpacity { args }
     88    private method EventuallySetMoleculeOpacity { args }
     89    private method EventuallySetMoleculeQuality { args }
     90    private method EventuallySetPolydataOpacity { args }
     91    private method GetImage { args }
     92    private method GetVtkData { args }
    9393    private method InitSettings { args  }
    94     private method IsValidObject { dataobj } 
     94    private method IsValidObject { dataobj }
    9595    private method LeaveLegend {}
    96     private method MotionLegend { x y } 
     96    private method MotionLegend { x y }
    9797    private method Pan {option x y}
    9898    private method PanCamera {}
    9999    private method Pick {x y}
    100     private method QuaternionToView { q } { 
     100    private method QuaternionToView { q } {
    101101        foreach { _view(-qw) _view(-qx) _view(-qy) _view(-qz) } $q break
    102102    }
     
    114114    private method SetMoleculeOpacity {}
    115115    private method SetMoleculeQuality {}
    116     private method SetObjectStyle { dataobj comp } 
     116    private method SetObjectStyle { dataobj comp }
    117117    private method SetOpacity { dataset }
    118118    private method SetOrientation { side }
    119119    private method SetPolydataOpacity {}
    120     private method Slice {option args} 
    121     private method ViewToQuaternion {} { 
     120    private method Slice {option args}
     121    private method ViewToQuaternion {} {
    122122        return [list $_view(-qw) $_view(-qx) $_view(-qy) $_view(-qz)]
    123123    }
     
    125125
    126126    private variable _arcball ""
    127     private variable _dlist "";         # list of data objects
     127    private variable _dlist "";         # list of data objects
    128128    private variable _obj2datasets
    129     private variable _obj2ovride;       # maps dataobj => style override
    130     private variable _datasets;         # contains all the dataobj-component
    131                                         # datasets in the server
    132     private variable _colormaps;        # contains all the colormaps
    133                                         # in the server.
    134     private variable _dataset2style;    # maps dataobj-component to transfunc
    135     private variable _style2datasets;   # maps tf back to list of
    136                                         # dataobj-components using the tf.
     129    private variable _obj2ovride;       # maps dataobj => style override
     130    private variable _datasets;         # contains all the dataobj-component
     131                                        # datasets in the server
     132    private variable _colormaps;        # contains all the colormaps
     133                                        # in the server.
     134    private variable _dataset2style;    # maps dataobj-component to transfunc
     135    private variable _style2datasets;   # maps tf back to list of
     136                                        # dataobj-components using the tf.
    137137    private variable _click;            # info used for rotate operations
    138138    private variable _limits;           # autoscale min/max for all axes
     
    319319
    320320    set _map(id) [$c create image 0 0 -anchor nw -image $_image(plot)]
    321     set _map(cwidth) -1 
    322     set _map(cheight) -1 
     321    set _map(cwidth) -1
     322    set _map(cheight) -1
    323323    set _map(zoom) 1.0
    324324    set _map(original) ""
     
    373373    set _image(legend) [image create photo]
    374374    itk_component add legend {
    375         canvas $itk_component(plotarea).legend -width 50 -highlightthickness 0 
     375        canvas $itk_component(plotarea).legend -width 50 -highlightthickness 0
    376376    } {
    377377        usual
     
    380380    }
    381381
    382     # Hack around the Tk panewindow.  The problem is that the requested 
     382    # Hack around the Tk panewindow.  The problem is that the requested
    383383    # size of the 3d view isn't set until an image is retrieved from
    384384    # the server.  So the panewindow uses the tiny size.
     
    386386    pack forget $itk_component(view)
    387387    blt::table $itk_component(plotarea) \
    388         0,0 $itk_component(view) -fill both -reqwidth $w 
     388        0,0 $itk_component(view) -fill both -reqwidth $w
    389389    blt::table configure $itk_component(plotarea) c1 -resize none
    390390
     
    473473
    474474itcl::body Rappture::VtkViewer::DoRotate {} {
    475     SendCmd "camera orient [ViewToQuaternion]" 
     475    SendCmd "camera orient [ViewToQuaternion]"
    476476    set _rotatePending 0
    477477}
     
    674674                    continue
    675675                }
    676                 if {[info exists _obj2ovride($dataobj-raise)] && 
     676                if {[info exists _obj2ovride($dataobj-raise)] &&
    677677                    $_obj2ovride($dataobj-raise)} {
    678678                    set dlist [linsert $dlist 0 $dataobj]
     
    702702            }
    703703            return $dlist
    704         }           
     704        }
    705705        -image {
    706706            if {[llength $args] != 2} {
     
    925925    # disconnected -- no more data sitting on server
    926926    set _outbuf ""
    927     array unset _datasets 
    928     array unset _data 
    929     array unset _colormaps 
     927    array unset _datasets
     928    array unset _data
     929    array unset _colormaps
    930930    global readyForNextFrame
    931931    set readyForNextFrame 1
     
    10291029    # Turn on buffering of commands to the server.  We don't want to
    10301030    # be preempted by a server disconnect/reconnect (which automatically
    1031     # generates a new call to Rebuild).   
     1031    # generates a new call to Rebuild).
    10321032    StartBufferingCommands
    10331033
     
    11231123        if { $_haveGlyphs } {
    11241124            InitSettings glyphs-edges glyphs-lighting glyphs-opacity \
    1125                 glyphs-visible glyphs-wireframe 
     1125                glyphs-visible glyphs-wireframe
    11261126        }
    11271127        if { $_havePolydata } {
    11281128            InitSettings polydata-edges polydata-lighting polydata-opacity \
    1129                 polydata-visible polydata-wireframe 
     1129                polydata-visible polydata-wireframe
    11301130        }
    11311131        if { $_haveMolecules } {
     
    11471147
    11481148    if { $_haveMolecules } {
    1149         #InitSettings molecule-representation 
     1149        #InitSettings molecule-representation
    11501150    }
    11511151    set _reset 0
     
    11701170itcl::body Rappture::VtkViewer::CurrentDatasets {args} {
    11711171    set flag [lindex $args 0]
    1172     switch -- $flag { 
     1172    switch -- $flag {
    11731173        "-all" {
    11741174            if { [llength $args] > 1 } {
     
    11891189                set dlist [get -visible]
    11901190            }
    1191         }           
     1191        }
    11921192        default {
    11931193            set dlist $args
     
    13081308    foreach tag [CurrentDatasets -visible] {
    13091309        SendCmd "dataset getscalar pixel $x $y $tag"
    1310     } 
     1310    }
    13111311}
    13121312
     
    17541754            }
    17551755        }
    1756         "axis-xposition" - "axis-yposition" - "axis-zposition" - 
     1756        "axis-xposition" - "axis-yposition" - "axis-zposition" -
    17571757        "axis-xdirection" - "axis-ydirection" - "axis-zdirection" {
    17581758            set axis [string range $what 5 5]
     
    19121912            set f [open "$tmpfile" "w"]
    19131913            fconfigure $f -translation binary -encoding binary
    1914             puts $f $data 
     1914            puts $f $data
    19151915            close $f
    19161916            set reader [vtkDataSetReader $tag-xvtkDataSetReader]
     
    20062006        -variable [itcl::scope _settings(glyphs-visible)] \
    20072007        -command [itcl::code $this AdjustSetting glyphs-visible] \
    2008         -font "Arial 9" -anchor w 
     2008        -font "Arial 9" -anchor w
    20092009
    20102010    checkbutton $inner.outline \
     
    20122012        -variable [itcl::scope _settings(glyphs-outline)] \
    20132013        -command [itcl::code $this AdjustSetting glyphs-outline] \
    2014         -font "Arial 9" -anchor w 
     2014        -font "Arial 9" -anchor w
    20152015
    20162016    checkbutton $inner.wireframe \
     
    20182018        -variable [itcl::scope _settings(glyphs-wireframe)] \
    20192019        -command [itcl::code $this AdjustSetting glyphs-wireframe] \
    2020         -font "Arial 9" -anchor w 
     2020        -font "Arial 9" -anchor w
    20212021
    20222022    checkbutton $inner.lighting \
     
    20322032        -font "Arial 9" -anchor w
    20332033
    2034     label $inner.palette_l -text "Palette" -font "Arial 9" -anchor w 
     2034    label $inner.palette_l -text "Palette" -font "Arial 9" -anchor w
    20352035    itk_component add glyphspalette {
    20362036        Rappture::Combobox $inner.palette -width 10 -editable no
     
    20412041        [itcl::code $this AdjustSetting glyphs-palette]
    20422042
    2043     label $inner.opacity_l -text "Opacity" -font "Arial 9" -anchor w 
     2043    label $inner.opacity_l -text "Opacity" -font "Arial 9" -anchor w
    20442044    ::scale $inner.opacity -from 0 -to 100 -orient horizontal \
    20452045        -variable [itcl::scope _settings(glyphs-opacity)] \
     
    20582058        5,1 $inner.opacity   -fill x   -pady 2 \
    20592059        6,0 $inner.palette_l -anchor w -pady 2 \
    2060         6,1 $inner.palette   -fill x   -pady 2 
     2060        6,1 $inner.palette   -fill x   -pady 2
    20612061
    20622062    blt::table configure $inner r* c* -resize none
     
    20782078        -variable [itcl::scope _settings(polydata-visible)] \
    20792079        -command [itcl::code $this AdjustSetting polydata-visible] \
    2080         -font "Arial 9" -anchor w 
     2080        -font "Arial 9" -anchor w
    20812081
    20822082    checkbutton $inner.outline \
     
    20842084        -variable [itcl::scope _settings(polydata-outline)] \
    20852085        -command [itcl::code $this AdjustSetting polydata-outline] \
    2086         -font "Arial 9" -anchor w 
     2086        -font "Arial 9" -anchor w
    20872087
    20882088    checkbutton $inner.wireframe \
     
    20902090        -variable [itcl::scope _settings(polydata-wireframe)] \
    20912091        -command [itcl::code $this AdjustSetting polydata-wireframe] \
    2092         -font "Arial 9" -anchor w 
     2092        -font "Arial 9" -anchor w
    20932093
    20942094    checkbutton $inner.lighting \
     
    21042104        -font "Arial 9" -anchor w
    21052105
    2106     label $inner.palette_l -text "Palette" -font "Arial 9" -anchor w 
     2106    label $inner.palette_l -text "Palette" -font "Arial 9" -anchor w
    21072107    itk_component add meshpalette {
    21082108        Rappture::Combobox $inner.palette -width 10 -editable no
     
    21132113        [itcl::code $this AdjustSetting polydata-palette]
    21142114
    2115     label $inner.opacity_l -text "Opacity" -font "Arial 9" -anchor w 
     2115    label $inner.opacity_l -text "Opacity" -font "Arial 9" -anchor w
    21162116    ::scale $inner.opacity -from 0 -to 100 -orient horizontal \
    21172117        -variable [itcl::scope _settings(polydata-opacity)] \
     
    21302130        5,1 $inner.opacity   -fill x   -pady 2 \
    21312131        6,0 $inner.palette_l -anchor w -pady 2 \
    2132         6,1 $inner.palette   -fill x   -pady 2 
     2132        6,1 $inner.palette   -fill x   -pady 2
    21332133
    21342134    blt::table configure $inner r* c* -resize none
     
    21572157        -command [itcl::code $this AdjustSetting axis-labels] \
    21582158        -font "Arial 9"
    2159     label $inner.grid_l -text "Grid" -font "Arial 9" 
     2159    label $inner.grid_l -text "Grid" -font "Arial 9"
    21602160    checkbutton $inner.xgrid \
    21612161        -text "X" \
     
    21792179        -font "Arial 9"
    21802180
    2181     label $inner.mode_l -text "Mode" -font "Arial 9" 
     2181    label $inner.mode_l -text "Mode" -font "Arial 9"
    21822182
    21832183    itk_component add axismode {
     
    21882188        "closest_triad"   "closest" \
    21892189        "furthest_triad"  "farthest" \
    2190         "outer_edges"     "outer"         
     2190        "outer_edges"     "outer"
    21912191    $itk_component(axismode) value "static"
    21922192    bind $inner.mode <<Value>> [itcl::code $this AdjustSetting axis-mode]
     
    22622262
    22632263    set fg [option get $itk_component(hull) font Font]
    2264    
     2264
    22652265    set inner [$itk_component(main) insert end \
    22662266        -title "Cutaway Along Axis" \
    2267         -icon [Rappture::icon cutbutton]] 
     2267        -icon [Rappture::icon cutbutton]]
    22682268
    22692269    $inner configure -borderwidth 4
     
    23052305            -variable [itcl::scope _axis(xdirection)]
    23062306    }
    2307     set _axis(xdirection) -1 
     2307    set _axis(xdirection) -1
    23082308    Rappture::Tooltip::for $itk_component(xDirButton) \
    23092309        "Toggle the direction of the X-axis cutaway"
     
    23472347    Rappture::Tooltip::for $itk_component(yDirButton) \
    23482348        "Toggle the direction of the Y-axis cutaway"
    2349     set _axis(ydirection) -1 
     2349    set _axis(ydirection) -1
    23502350
    23512351    # Z-value slicer...
     
    23842384            -variable [itcl::scope _axis(zdirection)]
    23852385    }
    2386     set _axis(zdirection) -1 
     2386    set _axis(zdirection) -1
    23872387    Rappture::Tooltip::for $itk_component(zDirButton) \
    23882388        "Toggle the direction of the Z-axis cutaway"
     
    24522452    $inner.rep choices insert end \
    24532453        "ballandstick"  "Ball and Stick" \
    2454         "spheres"       "Spheres"        \
    2455         "sticks"        "Sticks"        \
    2456         "rods"          "Rods"           \
    2457         "wireframe"     "Wireframe"      \
    2458         "spacefilling"  "Space Filling" 
     2454        "spheres"       "Spheres"        \
     2455        "sticks"        "Sticks"        \
     2456        "rods"          "Rods"           \
     2457        "wireframe"     "Wireframe"      \
     2458        "spacefilling"  "Space Filling"
    24592459
    24602460    bind $inner.rep <<Value>> \
     
    24692469    }
    24702470    $inner.rscale choices insert end \
    2471         "atomic"        "Atomic"   \
    2472         "covalent"      "Covalent" \
    2473         "van_der_waals" "VDW"      \
    2474         "none"          "Constant"
     2471        "atomic"        "Atomic"   \
     2472        "covalent"      "Covalent" \
     2473        "van_der_waals" "VDW"      \
     2474        "none"          "Constant"
    24752475
    24762476    bind $inner.rscale <<Value>> \
     
    24782478    $inner.rscale value "Covalent"
    24792479
    2480     label $inner.palette_l -text "Palette" -font "Arial 9" 
     2480    label $inner.palette_l -text "Palette" -font "Arial 9"
    24812481    itk_component add moleculepalette {
    24822482        Rappture::Combobox $inner.palette -width 10 -editable no
     
    25432543        16,0 $inner.quality_l   -anchor w -pady {3 0} \
    25442544        17,0 $inner.quality     -fill x    -padx 2
    2545    
     2545
    25462546    blt::table configure $inner r* -resize none
    25472547    blt::table configure $inner r18 -resize expand
     
    25492549
    25502550#
    2551 #  camera -- 
     2551#  camera --
    25522552#
    25532553itcl::body Rappture::VtkViewer::camera {option args} {
    2554     switch -- $option { 
     2554    switch -- $option {
    25552555        "show" {
    25562556            puts [array get _view]
     
    26002600
    26012601itcl::body Rappture::VtkViewer::GetImage { args } {
    2602     if { [image width $_image(download)] > 0 && 
     2602    if { [image width $_image(download)] > 0 &&
    26032603         [image height $_image(download)] > 0 } {
    26042604        set bytes [$_image(download) data -format "jpeg -quality 100"]
     
    26132613        -title "[Rappture::filexfer::label downloadWord] as..."
    26142614    set inner [$popup component inner]
    2615     label $inner.summary -text "" -anchor w 
     2615    label $inner.summary -text "" -anchor w
    26162616    radiobutton $inner.vtk_button -text "VTK data file" \
    26172617        -variable [itcl::scope _downloadPopup(format)] \
    26182618        -font "Helvetica 9 " \
    2619         -value vtk 
     2619        -value vtk
    26202620    Rappture::Tooltip::for $inner.vtk_button "Save as VTK data file."
    26212621    radiobutton $inner.image_button -text "Image File" \
    26222622        -variable [itcl::scope _downloadPopup(format)] \
    2623         -value image 
     2623        -value image
    26242624    Rappture::Tooltip::for $inner.image_button \
    26252625        "Save as digital image."
     
    26422642        2,0 $inner.image_button -anchor w -cspan 2 -padx { 4 0 } \
    26432643        4,1 $inner.cancel -width .9i -fill y \
    2644         4,0 $inner.ok -padx 2 -width .9i -fill y 
     2644        4,0 $inner.ok -padx 2 -width .9i -fill y
    26452645    blt::table configure $inner r3 -height 4
    26462646    blt::table configure $inner r4 -pady 4
     
    29192919    set font "Arial 8"
    29202920    set lineht [font metrics $font -linespace]
    2921    
     2921
    29222922    if { $_settings(legend) } {
    29232923        set x [expr $w - 2]
     
    29842984    set font "Arial 8"
    29852985    set lineht [font metrics $font -linespace]
    2986    
     2986
    29872987    set imgHeight [image height $_image(legend)]
    29882988    set coords [$c coords colormap]
     
    29982998    }
    29992999    set color [eval format "\#%02x%02x%02x" $pixel]
    3000     $_image(swatch) put black  -to 0 0 23 23 
    3001     $_image(swatch) put $color -to 1 1 22 22 
     3000    $_image(swatch) put black  -to 0 0 23 23
     3001    $_image(swatch) put $color -to 1 1 22 22
    30023002    .rappturetooltip configure -icon $_image(swatch)
    30033003
     
    30053005    set t [expr 1.0 - (double($imgY) / double($imgHeight-1))]
    30063006    set value [expr $t * ($_limits(vmax) - $_limits(vmin)) + $_limits(vmin)]
    3007     set tipx [expr $x + 15] 
     3007    set tipx [expr $x + 15]
    30083008    set tipy [expr $y - 5]
    30093009    Rappture::Tooltip::text $c "$_title $value"
    3010     Rappture::Tooltip::tooltip show $c +$tipx,+$tipy   
     3010    Rappture::Tooltip::tooltip show $c +$tipx,+$tipy
    30113011}
    30123012
     
    30413041}
    30423042
    3043 itcl::body Rappture::VtkViewer::SetOrientation { side } { 
     3043itcl::body Rappture::VtkViewer::SetOrientation { side } {
    30443044    array set positions {
    30453045        front "1 0 0 0"
     
    30523052    foreach name { -qw -qx -qy -qz } value $positions($side) {
    30533053        set _view($name) $value
    3054     } 
     3054    }
    30553055    set q [ViewToQuaternion]
    30563056    $_arcball quaternion $q
     
    30623062}
    30633063
    3064 itcl::body Rappture::VtkViewer::SetOpacity { dataset } { 
     3064itcl::body Rappture::VtkViewer::SetOpacity { dataset } {
    30653065    foreach {dataobj comp} [split $dataset -] break
    30663066    set type [$dataobj type $comp]
Note: See TracChangeset for help on using the changeset viewer.