Changeset 5009 for branches/1.3


Ignore:
Timestamp:
Feb 12, 2015, 11:00:22 AM (10 years ago)
Author:
ldelgass
Message:

Update vtkviewer in 1.3 branch with current trunk/1.4 branch version

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/1.3/gui/scripts/vtkviewer.tcl

    r4848 r5009  
    1 # -*- mode: tcl; indent-tabs-mode: nil -*-
    2 
     1# -*- mode: tcl; indent-tabs-mode: nil -*-
    32# ----------------------------------------------------------------------
    43#  COMPONENT: vtkviewer - Vtk drawing object viewer
     
    87# ======================================================================
    98#  AUTHOR:  Michael McLennan, Purdue University
    10 #  Copyright (c) 2004-2012  HUBzero Foundation, LLC
     9#  Copyright (c) 2004-2014  HUBzero Foundation, LLC
    1110#
    1211#  See the file "license.terms" for information on usage and
     
    5857    public method get {args}
    5958    public method isconnected {}
    60     public method limits { colormap }
    61     public method parameters {title args} { 
    62         # do nothing 
     59    public method limits { dataobj }
     60    public method parameters {title args} {
     61        # do nothing
    6362    }
    6463    public method scale {args}
    6564
    66     protected method Connect {}
    67     protected method CurrentDatasets {args}
    68     protected method Disconnect {}
    69     protected method DoResize {}
    70     protected method DoRotate {}
    71     protected method AdjustSetting {what {value ""}}
    72     protected method FixSettings { args  }
    73     protected method Pan {option x y}
    74     protected method Pick {x y}
    75     protected method Rebuild {}
    76     protected method ReceiveDataset { args }
    77     protected method ReceiveImage { args }
    78     protected method ReceiveLegend { colormap title vmin vmax size }
    79     protected method Rotate {option x y}
    80     protected method Zoom {option}
    81 
    8265    # The following methods are only used by this class.
     66    private method AdjustSetting {what {value ""}}
    8367    private method BuildAxisTab {}
    8468    private method BuildCameraTab {}
    8569    private method BuildColormap { name styles }
    8670    private method BuildCutawayTab {}
    87     private method BuildDownloadPopup { widget command }
     71    private method BuildDownloadPopup { widget command }
     72    private method BuildGlyphsTab {}
    8873    private method BuildMoleculeTab {}
    8974    private method BuildPolydataTab {}
    9075    private method ChangeColormap { dataobj comp color }
     76    private method Connect {}
     77    private method CurrentDatasets {args}
     78    private method Disconnect {}
     79    private method DoResize {}
     80    private method DoRotate {}
    9181    private method DrawLegend {}
    92     private method EnterLegend { x y }
    93     private method EventuallySetAtomScale { args }
    94     private method EventuallySetBondScale { args }
    95     private method EventuallySetMoleculeOpacity { args }
    96     private method EventuallySetMoleculeQuality { args }
    97     private method EventuallySetPolydataOpacity { args }
    98     private method EventuallyResize { w h }
    99     private method EventuallyRotate { q }
    100     private method GetImage { args }
    101     private method GetVtkData { args }
    102     private method IsValidObject { dataobj }
     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 }
     93    private method InitSettings { args  }
     94    private method IsValidObject { dataobj }
    10395    private method LeaveLegend {}
    104     private method MotionLegend { x y }
     96    private method MotionLegend { x y }
     97    private method Pan {option x y}
    10598    private method PanCamera {}
     99    private method Pick {x y}
     100    private method QuaternionToView { q } {
     101        foreach { _view(-qw) _view(-qx) _view(-qy) _view(-qz) } $q break
     102    }
     103    private method Rebuild {}
     104    private method ReceiveDataset { args }
     105    private method ReceiveImage { args }
     106    private method ReceiveLegend { colormap title vmin vmax size }
    106107    private method RequestLegend {}
     108    private method Rotate {option x y}
    107109    private method SetAtomScale {}
    108110    private method SetBondScale {}
    109111    private method SetColormap { dataobj comp }
     112    private method SetGlyphsOpacity {}
    110113    private method SetLegendTip { x y }
    111114    private method SetMoleculeOpacity {}
    112115    private method SetMoleculeQuality {}
    113     private method SetObjectStyle { dataobj comp } 
     116    private method SetObjectStyle { dataobj comp }
    114117    private method SetOpacity { dataset }
    115118    private method SetOrientation { side }
    116119    private method SetPolydataOpacity {}
    117     private method Slice {option args}
     120    private method Slice {option args}
     121    private method ViewToQuaternion {} {
     122        return [list $_view(-qw) $_view(-qx) $_view(-qy) $_view(-qz)]
     123    }
     124    private method Zoom {option}
    118125
    119126    private variable _arcball ""
    120     private variable _dlist "";         # list of data objects
     127    private variable _dlist "";         # list of data objects
    121128    private variable _obj2datasets
    122     private variable _obj2ovride;       # maps dataobj => style override
    123     private variable _datasets;         # contains all the dataobj-component
    124                                         # datasets in the server
    125     private variable _colormaps;        # contains all the colormaps
    126                                         # in the server.
    127     private variable _dataset2style;    # maps dataobj-component to transfunc
    128     private variable _style2datasets;   # maps tf back to list of
    129                                         # 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.
    130137    private variable _click;            # info used for rotate operations
    131138    private variable _limits;           # autoscale min/max for all axes
     
    157164    private variable _polydataOpacityPending 0
    158165    private variable _glyphsOpacityPending 0
    159     private variable _updatePending 0;
    160166    private variable _rotateDelay 150
    161167    private variable _scaleDelay 100
     
    181187    $_dispatcher register !resize
    182188    $_dispatcher dispatch $this !resize "[itcl::code $this DoResize]; list"
    183 
    184     # Update state event
    185     $_dispatcher register !update
    186     $_dispatcher dispatch $this !update "[itcl::code $this DoUpdate]; list"
    187189
    188190    # Rotate event
     
    214216    $_dispatcher dispatch $this !polydataOpacity \
    215217        "[itcl::code $this SetPolydataOpacity]; list"
     218
     219    # Glyphs opacity event
     220    $_dispatcher register !glyphsOpacity
     221    $_dispatcher dispatch $this !glyphsOpacity \
     222        "[itcl::code $this SetGlyphsOpacity]; list"
     223
    216224    #
    217225    # Populate parser with commands handle incoming requests
    218226    #
    219     $_parser alias image    [itcl::code $this ReceiveImage]
    220     $_parser alias dataset  [itcl::code $this ReceiveDataset]
    221     $_parser alias legend   [itcl::code $this ReceiveLegend]
     227    $_parser alias image [itcl::code $this ReceiveImage]
     228    $_parser alias dataset [itcl::code $this ReceiveDataset]
     229    $_parser alias legend [itcl::code $this ReceiveLegend]
    222230
    223231    # Initialize the view to some default parameters.
    224232    array set _view {
    225         qw              0.853553
    226         qx              -0.353553
    227         qy              0.353553
    228         qz              0.146447
    229         zoom            1.0
    230         xpan            0
    231         ypan            0
    232         ortho           0
     233        -ortho           0
     234        -qw              0.853553
     235        -qx              -0.353553
     236        -qy              0.353553
     237        -qz              0.146447
     238        -xpan            0
     239        -ypan            0
     240        -zoom            1.0
    233241    }
    234242    set _arcball [blt::arcball create 100 100]
    235     set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)]
    236     $_arcball quaternion $q
     243    $_arcball quaternion [ViewToQuaternion]
    237244
    238245    set _limits(zmin) 0.0
     
    240247
    241248    array set _axis [subst {
     249        labels          1
     250        minorticks      1
     251        visible         1
    242252        xgrid           0
    243253        ygrid           0
     
    252262        ydirection      -1
    253263        zdirection      -1
    254         visible         1
    255         labels          1
    256264    }]
    257265    array set _settings [subst {
     266        glyphs-edges            0
     267        glyphs-lighting         1
     268        glyphs-opacity          100
     269        glyphs-outline          0
     270        glyphs-palette          BCGYR
     271        glyphs-visible          1
     272        glyphs-wireframe        0
    258273        legend                  1
    259         glyphs-opacity          100
    260         glyphs-wireframe        0
    261         polydata-edges          0
    262         polydata-lighting       1
    263         polydata-opacity        100
    264         polydata-palette        rainbow
    265         polydata-visible        1
    266         polydata-wireframe      0
     274        molecule-atoms-visible  1
    267275        molecule-atomscale      0.3
     276        molecule-bonds-visible  1
    268277        molecule-bondscale      0.075
    269278        molecule-bondstyle      "cylinder"
    270         molecule-atoms-visible  1
    271         molecule-bonds-visible  1
    272279        molecule-edges          0
    273280        molecule-labels         0
    274281        molecule-lighting       1
    275282        molecule-opacity        100
     283        molecule-outline        0
    276284        molecule-palette        elementDefault
    277285        molecule-quality        1.0
     
    280288        molecule-visible        1
    281289        molecule-wireframe      0
     290        polydata-edges          0
     291        polydata-lighting       1
     292        polydata-opacity        100
     293        polydata-outline        0
     294        polydata-palette        BCGYR
     295        polydata-visible        1
     296        polydata-wireframe      0
    282297    }]
    283298    itk_component add view {
     
    304319
    305320    set _map(id) [$c create image 0 0 -anchor nw -image $_image(plot)]
    306     set _map(cwidth) -1 
    307     set _map(cheight) -1 
     321    set _map(cwidth) -1
     322    set _map(cheight) -1
    308323    set _map(zoom) 1.0
    309324    set _map(original) ""
     
    347362    Rappture::Tooltip::for $itk_component(zoomout) "Zoom out"
    348363
    349     BuildAxisTab
    350     #BuildCutawayTab
    351     BuildCameraTab
     364    if { [catch {
     365        BuildAxisTab
     366        #BuildCutawayTab
     367        BuildCameraTab
     368    } errs] != 0 } {
     369        puts stderr errs=$errs
     370    }
    352371
    353372    # Legend
    354 
    355373    set _image(legend) [image create photo]
    356374    itk_component add legend {
    357         canvas $itk_component(plotarea).legend -width 50 -highlightthickness 0 
     375        canvas $itk_component(plotarea).legend -width 50 -highlightthickness 0
    358376    } {
    359377        usual
     
    362380    }
    363381
    364     # Hack around the Tk panewindow.  The problem is that the requested 
     382    # Hack around the Tk panewindow.  The problem is that the requested
    365383    # size of the 3d view isn't set until an image is retrieved from
    366384    # the server.  So the panewindow uses the tiny size.
     
    368386    pack forget $itk_component(view)
    369387    blt::table $itk_component(plotarea) \
    370         0,0 $itk_component(view) -fill both -reqwidth $w 
     388        0,0 $itk_component(view) -fill both -reqwidth $w
    371389    blt::table configure $itk_component(plotarea) c1 -resize none
    372390
     
    378396    bind $itk_component(view) <ButtonRelease-1> \
    379397        [itcl::code $this Rotate release %x %y]
    380     bind $itk_component(view) <Configure> \
    381         [itcl::code $this EventuallyResize %w %h]
    382398
    383399    # Bindings for panning via mouse
     
    457473
    458474itcl::body Rappture::VtkViewer::DoRotate {} {
    459     set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)]
    460     SendCmd "camera orient $q"
     475    SendCmd "camera orient [ViewToQuaternion]"
    461476    set _rotatePending 0
    462477}
     
    473488
    474489itcl::body Rappture::VtkViewer::EventuallyRotate { q } {
    475     foreach { _view(qw) _view(qx) _view(qy) _view(qz) } $q break
     490    QuaternionToView $q
    476491    if { !$_rotatePending } {
    477492        set _rotatePending 1
     
    506521}
    507522
     523itcl::body Rappture::VtkViewer::SetGlyphsOpacity {} {
     524    set _glyphsOpacityPending 0
     525    foreach dataset [CurrentDatasets -visible $_first] {
     526        foreach { dataobj comp } [split $dataset -] break
     527        if { [$dataobj type $comp] == "glyphs" } {
     528            SetOpacity $dataset
     529        }
     530    }
     531}
     532
    508533itcl::body Rappture::VtkViewer::SetPolydataOpacity {} {
    509534    set _polydataOpacityPending 0
     
    548573        set _polydataOpacityPending 1
    549574        $_dispatcher event -after $_scaleDelay !polydataOpacity
     575    }
     576}
     577
     578itcl::body Rappture::VtkViewer::EventuallySetGlyphsOpacity { args } {
     579    if { !$_glyphsOpacityPending } {
     580        set _glyphsOpacityPending 1
     581        $_dispatcher event -after $_scaleDelay !glyphsOpacity
    550582    }
    551583}
     
    642674                    continue
    643675                }
    644                 if {[info exists _obj2ovride($dataobj-raise)] && 
     676                if {[info exists _obj2ovride($dataobj-raise)] &&
    645677                    $_obj2ovride($dataobj-raise)} {
    646678                    set dlist [linsert $dlist 0 $dataobj]
     
    670702            }
    671703            return $dlist
    672         }           
     704        }
    673705        -image {
    674706            if {[llength $args] != 2} {
     
    716748        }
    717749        array set bounds [limits $dataobj]
    718         if {![info exists _limits(xmin)] || $_limits(xmin) > $bounds(xmin)} {
     750        if {[info exists bounds(xmin)] && (![info exists _limits(xmin)] || $_limits(xmin) > $bounds(xmin))} {
    719751            set _limits(xmin) $bounds(xmin)
    720752        }
    721         if {![info exists _limits(xmax)] || $_limits(xmax) < $bounds(xmax)} {
     753        if {[info exists bounds(xmax)] && (![info exists _limits(xmax)] || $_limits(xmax) < $bounds(xmax))} {
    722754            set _limits(xmax) $bounds(xmax)
    723755        }
    724756
    725         if {![info exists _limits(ymin)] || $_limits(ymin) > $bounds(ymin)} {
     757        if {[info exists bounds(ymin)] && (![info exists _limits(ymin)] || $_limits(ymin) > $bounds(ymin))} {
    726758            set _limits(ymin) $bounds(ymin)
    727759        }
    728         if {![info exists _limits(ymax)] || $_limits(ymax) < $bounds(ymax)} {
     760        if {[info exists bounds(ymax)] && (![info exists _limits(ymax)] || $_limits(ymax) < $bounds(ymax))} {
    729761            set _limits(ymax) $bounds(ymax)
    730762        }
    731763
    732         if {![info exists _limits(zmin)] || $_limits(zmin) > $bounds(zmin)} {
     764        if {[info exists bounds(zmin)] && (![info exists _limits(zmin)] || $_limits(zmin) > $bounds(zmin))} {
    733765            set _limits(zmin) $bounds(zmin)
    734766        }
    735         if {![info exists _limits(zmax)] || $_limits(zmax) < $bounds(zmax)} {
     767        if {[info exists bounds(zmax)] && (![info exists _limits(zmax)] || $_limits(zmax) < $bounds(zmax))} {
    736768            set _limits(zmax) $bounds(zmax)
     769        }
     770    }
     771    if { $_haveGlyphs } {
     772        if { ![$itk_component(main) exists "Glyphs Settings"] } {
     773            if { [catch { BuildGlyphsTab } errs ]  != 0 } {
     774                puts stderr "errs=$errs"
     775            }
    737776        }
    738777    }
     
    828867        if { $_reportClientInfo }  {
    829868            # Tell the server the viewer, hub, user and session.
    830             # Do this immediately on connect before buffing any commands
     869            # Do this immediately on connect before buffering any commands
    831870            global env
    832871
     
    885924
    886925    # disconnected -- no more data sitting on server
    887     array unset _datasets
    888     array unset _data
    889     array unset _colormaps
     926    set _outbuf ""
     927    array unset _datasets
     928    array unset _data
     929    array unset _colormaps
    890930    global readyForNextFrame
    891931    set readyForNextFrame 1
     
    911951    if { $info(-type) == "image" } {
    912952        if 0 {
    913             set f [open "last.ppm" "w"] 
     953            set f [open "last.ppm" "w"]
    914954            fconfigure $f -encoding binary
    915955            puts -nonewline $f $bytes
     
    9891029    # Turn on buffering of commands to the server.  We don't want to
    9901030    # be preempted by a server disconnect/reconnect (which automatically
    991     # generates a new call to Rebuild).   
     1031    # generates a new call to Rebuild).
    9921032    StartBufferingCommands
    9931033
     
    9971037        $_arcball resize $w $h
    9981038        DoResize
    999         FixSettings axis-xgrid axis-ygrid axis-zgrid axis-mode \
    1000             axis-visible axis-labels
    1001 
    1002         if { $_havePolydata } {
    1003             FixSettings polydata-edges polydata-lighting polydata-opacity \
    1004                 polydata-visible polydata-wireframe
    1005         }
     1039        InitSettings axis-xgrid axis-ygrid axis-zgrid axis-mode \
     1040            axis-visible axis-labels axis-minorticks
     1041
    10061042        StopBufferingCommands
    10071043        SendCmd "imgflush"
     
    10251061                if { $bytes == "" } {
    10261062                    continue
     1063                }
     1064                if 0 {
     1065                    set f [open /tmp/vtkviewer.vtk "w"]
     1066                    fconfigure $f -translation binary -encoding binary
     1067                    puts -nonewline $f $bytes
     1068                    close $f
    10271069                }
    10281070                set length [string length $bytes]
     
    10371079                    lappend info "dataset_size"  $length
    10381080                    lappend info "dataset_tag"   $tag
    1039                     SendCmd [list "clientinfo" $info]
     1081                    SendCmd "clientinfo [list $info]"
    10401082                }
    10411083                SendCmd "dataset add $tag data follows $length"
     
    10451087            }
    10461088            lappend _obj2datasets($dataobj) $tag
     1089            set type [$dataobj type $comp]
    10471090            if { [info exists _obj2ovride($dataobj-raise)] } {
    1048                 SendCmd "dataset visible 1 $tag"
     1091                SendCmd "$type visible 1 $tag"
    10491092                SetOpacity $tag
    10501093            }
     
    10601103            set label [$_first hints ${axis}label]
    10611104            if { $label != "" } {
    1062                 SendCmd "axis name $axis $label"
     1105                SendCmd [list axis name $axis $label]
    10631106            }
    10641107            set units [$_first hints ${axis}units]
    10651108            if { $units != "" } {
    1066                 SendCmd "axis units $axis $units"
    1067             }
    1068         }
     1109                SendCmd [list axis units $axis $units]
     1110            }
     1111        }
     1112    }
     1113    if { $_haveGlyphs } {
     1114        InitSettings glyphs-outline
     1115    }
     1116    if { $_haveMolecules } {
     1117        InitSettings molecule-outline
     1118    }
     1119    if { $_havePolydata } {
     1120        InitSettings polydata-outline
    10691121    }
    10701122    if { $_reset } {
    1071         set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)]
    1072         $_arcball quaternion $q
     1123        if { $_haveGlyphs } {
     1124            InitSettings glyphs-edges glyphs-lighting glyphs-opacity \
     1125                glyphs-visible glyphs-wireframe
     1126        }
     1127        if { $_havePolydata } {
     1128            InitSettings polydata-edges polydata-lighting polydata-opacity \
     1129                polydata-visible polydata-wireframe
     1130        }
     1131        if { $_haveMolecules } {
     1132            InitSettings molecule-edges molecule-lighting molecule-opacity \
     1133                molecule-visible molecule-wireframe molecule-labels
     1134        }
     1135
     1136        $_arcball quaternion [ViewToQuaternion]
    10731137        SendCmd "camera reset"
    1074         if { $_view(ortho)} {
     1138        if { $_view(-ortho)} {
    10751139            SendCmd "camera mode ortho"
    10761140        } else {
     
    10831147
    10841148    if { $_haveMolecules } {
    1085         #FixSettings molecule-representation
     1149        #InitSettings molecule-representation
    10861150    }
    10871151    set _reset 0
     
    11061170itcl::body Rappture::VtkViewer::CurrentDatasets {args} {
    11071171    set flag [lindex $args 0]
    1108     switch -- $flag { 
     1172    switch -- $flag {
    11091173        "-all" {
    11101174            if { [llength $args] > 1 } {
     
    11251189                set dlist [get -visible]
    11261190            }
    1127         }           
     1191        }
    11281192        default {
    11291193            set dlist $args
     
    11531217    switch -- $option {
    11541218        "in" {
    1155             set _view(zoom) [expr {$_view(zoom)*1.25}]
    1156             SendCmd "camera zoom $_view(zoom)"
     1219            set _view(-zoom) [expr {$_view(-zoom)*1.25}]
     1220            SendCmd "camera zoom $_view(-zoom)"
    11571221        }
    11581222        "out" {
    1159             set _view(zoom) [expr {$_view(zoom)*0.8}]
    1160             SendCmd "camera zoom $_view(zoom)"
     1223            set _view(-zoom) [expr {$_view(-zoom)*0.8}]
     1224            SendCmd "camera zoom $_view(-zoom)"
    11611225        }
    11621226        "reset" {
    11631227            array set _view {
    1164                 qw      0.853553
    1165                 qx      -0.353553
    1166                 qy      0.353553
    1167                 qz      0.146447
    1168                 zoom    1.0
    1169                 xpan    0
    1170                 ypan    0
     1228                -qw      0.853553
     1229                -qx      -0.353553
     1230                -qy      0.353553
     1231                -qz      0.146447
     1232                -xpan    0
     1233                -ypan    0
     1234                -zoom    1.0
    11711235            }
    11721236            if { $_first != "" } {
     
    11761240                }
    11771241            }
    1178             set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)]
    1179             $_arcball quaternion $q
     1242            $_arcball quaternion [ViewToQuaternion]
    11801243            DoRotate
    11811244            SendCmd "camera reset"
     
    11851248
    11861249itcl::body Rappture::VtkViewer::PanCamera {} {
    1187     set x $_view(xpan)
    1188     set y $_view(ypan)
     1250    set x $_view(-xpan)
     1251    set y $_view(-ypan)
    11891252    SendCmd "camera pan $x $y"
    11901253}
     
    12451308    foreach tag [CurrentDatasets -visible] {
    12461309        SendCmd "dataset getscalar pixel $x $y $tag"
    1247     } 
     1310    }
    12481311}
    12491312
     
    12631326            set x [expr $x / double($w)]
    12641327            set y [expr $y / double($h)]
    1265             set _view(xpan) [expr $_view(xpan) + $x]
    1266             set _view(ypan) [expr $_view(ypan) + $y]
     1328            set _view(-xpan) [expr $_view(-xpan) + $x]
     1329            set _view(-ypan) [expr $_view(-ypan) + $y]
    12671330            PanCamera
    12681331            return
     
    12861349            set _click(x) $x
    12871350            set _click(y) $y
    1288             set _view(xpan) [expr $_view(xpan) - $dx]
    1289             set _view(ypan) [expr $_view(ypan) - $dy]
     1351            set _view(-xpan) [expr $_view(-xpan) - $dx]
     1352            set _view(-ypan) [expr $_view(-ypan) - $dy]
    12901353            PanCamera
    12911354        }
     
    13011364
    13021365# ----------------------------------------------------------------------
    1303 # USAGE: FixSettings <what> ?<value>?
     1366# USAGE: InitSettings <what> ?<value>?
    13041367#
    13051368# Used internally to update rendering settings whenever parameters
     
    13071370# to the back end.
    13081371# ----------------------------------------------------------------------
    1309 itcl::body Rappture::VtkViewer::FixSettings { args } {
     1372itcl::body Rappture::VtkViewer::InitSettings { args } {
    13101373    foreach setting $args {
    13111374        AdjustSetting $setting
     
    13251388    }
    13261389    switch -- $what {
     1390        "glyphs-opacity" {
     1391            foreach dataset [CurrentDatasets -visible $_first] {
     1392                foreach { dataobj comp } [split $dataset -] break
     1393                if { [$dataobj type $comp] == "glyphs" } {
     1394                    SetOpacity $dataset
     1395                }
     1396            }
     1397        }
     1398        "glyphs-outline" {
     1399            set bool $_settings($what)
     1400            foreach dataset [CurrentDatasets -visible $_first] {
     1401                foreach { dataobj comp } [split $dataset -] break
     1402                set type [$dataobj type $comp]
     1403                if { $type == "glyphs" } {
     1404                    SendCmd "outline visible $bool $dataset"
     1405                }
     1406            }
     1407        }
     1408        "glyphs-wireframe" {
     1409            set bool $_settings($what)
     1410            foreach dataset [CurrentDatasets -visible $_first] {
     1411                foreach { dataobj comp } [split $dataset -] break
     1412                set type [$dataobj type $comp]
     1413                if { $type == "glyphs" } {
     1414                    SendCmd "$type wireframe $bool $dataset"
     1415                }
     1416            }
     1417        }
     1418        "glyphs-visible" {
     1419            set bool $_settings($what)
     1420            foreach dataset [CurrentDatasets -visible $_first] {
     1421                foreach { dataobj comp } [split $dataset -] break
     1422                set type [$dataobj type $comp]
     1423                if { $type == "glyphs" } {
     1424                    SendCmd "$type visible $bool $dataset"
     1425                }
     1426            }
     1427        }
     1428        "glyphs-lighting" {
     1429            set bool $_settings($what)
     1430            foreach dataset [CurrentDatasets -visible $_first] {
     1431                foreach { dataobj comp } [split $dataset -] break
     1432                set type [$dataobj type $comp]
     1433                if { $type == "glyphs" } {
     1434                    SendCmd "$type lighting $bool $dataset"
     1435                }
     1436            }
     1437        }
     1438        "glyphs-edges" {
     1439            set bool $_settings($what)
     1440            foreach dataset [CurrentDatasets -visible $_first] {
     1441                foreach { dataobj comp } [split $dataset -] break
     1442                set type [$dataobj type $comp]
     1443                if { $type == "glyphs" } {
     1444                    SendCmd "$type edges $bool $dataset"
     1445                }
     1446            }
     1447        }
     1448        "glyphs-palette" {
     1449            set palette [$itk_component(glyphspalette) value]
     1450            set _settings($what) $palette
     1451            foreach dataset [CurrentDatasets -visible $_first] {
     1452                foreach {dataobj comp} [split $dataset -] break
     1453                set type [$dataobj type $comp]
     1454                if { $type == "glyphs" } {
     1455                    ChangeColormap $dataobj $comp $palette
     1456                    # FIXME: fill in current selected fieldname
     1457                    #SendCmd "glyphs colormode scalar {} $dataset"
     1458                }
     1459            }
     1460            set _legendPending 1
     1461        }
    13271462        "polydata-opacity" {
    13281463            foreach dataset [CurrentDatasets -visible $_first] {
     
    13331468            }
    13341469        }
     1470        "polydata-outline" {
     1471            set bool $_settings($what)
     1472            foreach dataset [CurrentDatasets -visible $_first] {
     1473                foreach { dataobj comp } [split $dataset -] break
     1474                set type [$dataobj type $comp]
     1475                if { $type == "polydata" } {
     1476                    SendCmd "outline visible $bool $dataset"
     1477                }
     1478            }
     1479        }
    13351480        "polydata-wireframe" {
    1336             set bool $_settings(polydata-wireframe)
     1481            set bool $_settings($what)
    13371482            foreach dataset [CurrentDatasets -visible $_first] {
    13381483                foreach { dataobj comp } [split $dataset -] break
     
    13441489        }
    13451490        "polydata-visible" {
    1346             set bool $_settings(polydata-visible)
     1491            set bool $_settings($what)
    13471492            foreach dataset [CurrentDatasets -visible $_first] {
    13481493                foreach { dataobj comp } [split $dataset -] break
     
    13541499        }
    13551500        "polydata-lighting" {
    1356             set bool $_settings(polydata-lighting)
     1501            set bool $_settings($what)
    13571502            foreach dataset [CurrentDatasets -visible $_first] {
    13581503                foreach { dataobj comp } [split $dataset -] break
     
    13641509        }
    13651510        "polydata-edges" {
    1366             set bool $_settings(polydata-edges)
     1511            set bool $_settings($what)
    13671512            foreach dataset [CurrentDatasets -visible $_first] {
    13681513                foreach { dataobj comp } [split $dataset -] break
     
    13751520        "polydata-palette" {
    13761521            set palette [$itk_component(meshpalette) value]
    1377             set _settings(polydata-palette) $palette
     1522            set _settings($what) $palette
    13781523            foreach dataset [CurrentDatasets -visible $_first] {
    13791524                foreach {dataobj comp} [split $dataset -] break
     
    13881533        }
    13891534        "molecule-opacity" {
    1390             set val $_settings(molecule-opacity)
    1391             set sval [expr { 0.01 * double($val) }]
    13921535            foreach dataset [CurrentDatasets -visible $_first] {
    13931536                foreach { dataobj comp } [split $dataset -] break
     
    13971540            }
    13981541        }
     1542        "molecule-outline" {
     1543            set bool $_settings($what)
     1544            foreach dataset [CurrentDatasets -visible $_first] {
     1545                foreach { dataobj comp } [split $dataset -] break
     1546                set type [$dataobj type $comp]
     1547                if { $type == "molecule" } {
     1548                    SendCmd "outline visible $bool $dataset"
     1549                }
     1550            }
     1551        }
    13991552        "molecule-wireframe" {
    1400             set bool $_settings(molecule-wireframe)
     1553            set bool $_settings($what)
    14011554            foreach dataset [CurrentDatasets -visible $_first] {
    14021555                foreach { dataobj comp } [split $dataset -] break
     
    14081561        }
    14091562        "molecule-visible" {
    1410             set bool $_settings(molecule-visible)
     1563            set bool $_settings($what)
    14111564            foreach dataset [CurrentDatasets -visible $_first] {
    14121565                foreach { dataobj comp } [split $dataset -] break
     
    14181571        }
    14191572        "molecule-lighting" {
    1420             set bool $_settings(molecule-lighting)
     1573            set bool $_settings($what)
    14211574            foreach dataset [CurrentDatasets -visible $_first] {
    14221575                foreach { dataobj comp } [split $dataset -] break
     
    14281581        }
    14291582        "molecule-edges" {
    1430             set bool $_settings(molecule-edges)
     1583            set bool $_settings($what)
    14311584            foreach dataset [CurrentDatasets -visible $_first] {
    14321585                foreach { dataobj comp } [split $dataset -] break
     
    14391592        "molecule-palette" {
    14401593            set palette [$itk_component(moleculepalette) value]
    1441             set _moelculeSettings(palette) $palette
     1594            set _settings($what) $palette
    14421595            foreach dataset [CurrentDatasets -visible $_first] {
    14431596                foreach {dataobj comp} [split $dataset -] break
     
    15031656                    set _settings(molecule-atoms-visible) 0
    15041657                    set _settings(molecule-bonds-visible) 1
    1505                     set _settings(molecule-bondstyle) cylinder
     1658                    set _settings(molecule-bondstyle) line
    15061659                    set _settings(molecule-atomscale) 1.0
    15071660                    set _settings(molecule-bondscale) 1.0
     
    15241677                set type [$dataobj type $comp]
    15251678                if { $type == "molecule" } {
    1526                     SendCmd [subst {molecule rscale $_settings(molecule-rscale) $dataset
    1527 molecule ascale $_settings(molecule-atomscale) $dataset
    1528 molecule bscale $_settings(molecule-bondscale) $dataset
    1529 molecule bstyle $_settings(molecule-bondstyle) $dataset
    1530 molecule atoms $_settings(molecule-atoms-visible) $dataset
    1531 molecule bonds $_settings(molecule-bonds-visible) $dataset}]
     1679                    StartBufferingCommands
     1680                    SendCmd [subst {molecule rscale $_settings(molecule-rscale) $dataset}]
     1681                    SendCmd [subst {molecule ascale $_settings(molecule-atomscale) $dataset}]
     1682                    SendCmd [subst {molecule bscale $_settings(molecule-bondscale) $dataset}]
     1683                    SendCmd [subst {molecule bstyle $_settings(molecule-bondstyle) $dataset}]
     1684                    SendCmd [subst {molecule atoms $_settings(molecule-atoms-visible) $dataset}]
     1685                    SendCmd [subst {molecule bonds $_settings(molecule-bonds-visible) $dataset}]
     1686                    StopBufferingCommands
    15321687                }
    15331688            }
     
    15361691            set value [$itk_component(rscale) value]
    15371692            set value [$itk_component(rscale) translate $value]
    1538             set _settings(molecule-rscale) $value
     1693            set _settings($what) $value
    15391694            foreach dataset [CurrentDatasets -visible $_first] {
    15401695                foreach {dataobj comp} [split $dataset -] break
    15411696                set type [$dataobj type $comp]
    15421697                if { $type == "molecule" } {
    1543                     SendCmd [subst {molecule rscale $_settings(molecule-rscale) $dataset}]
     1698                    SendCmd [subst {molecule rscale $_settings($what) $dataset}]
    15441699                }
    15451700            }
    15461701        }
    15471702        "molecule-labels" {
    1548             set bool $_settings(molecule-labels)
     1703            set bool $_settings($what)
    15491704            foreach dataset [CurrentDatasets -visible $_first] {
    15501705               foreach { dataobj comp } [split $dataset -] break
     
    15621717            set bool $_axis(labels)
    15631718            SendCmd "axis labels all $bool"
     1719        }
     1720        "axis-minorticks" {
     1721            set bool $_axis(minorticks)
     1722            SendCmd "axis minticks all $bool"
    15641723        }
    15651724        "axis-xgrid" {
     
    15951754            }
    15961755        }
    1597         "axis-xposition" - "axis-yposition" - "axis-zposition" - 
     1756        "axis-xposition" - "axis-yposition" - "axis-zposition" -
    15981757        "axis-xdirection" - "axis-ydirection" - "axis-zdirection" {
    15991758            set axis [string range $what 5 5]
     
    16181777    set font "Arial 8"
    16191778    set lineht [font metrics $font -linespace]
    1620     set c $itk_component(legend)
    16211779    set w 12
    16221780    set h [expr {$_height - 2 * ($lineht + 2)}]
    1623     if { $h < 1} {
     1781    if { $h < 1 } {
    16241782        return
    16251783    }
     
    17271885itcl::configbody Rappture::VtkViewer::plotbackground {
    17281886    if { [isconnected] } {
    1729         foreach {r g b} [Color2RGB $itk_option(-plotbackground)] break
    1730         SendCmd "screen bgcolor $r $g $b"
     1887        set rgb [Color2RGB $itk_option(-plotbackground)]
     1888        SendCmd "screen bgcolor $rgb"
    17311889    }
    17321890}
     
    17371895itcl::configbody Rappture::VtkViewer::plotforeground {
    17381896    if { [isconnected] } {
    1739         foreach {r g b} [Color2RGB $itk_option(-plotforeground)] break
    1740         #fix this!
    1741         #SendCmd "color background $r $g $b"
     1897        set rgb [Color2RGB $itk_option(-plotforeground)]
     1898        SendCmd "axis color all $rgb"
     1899        SendCmd "outline color $rgb"
    17421900    }
    17431901}
     
    17541912            set f [open "$tmpfile" "w"]
    17551913            fconfigure $f -translation binary -encoding binary
    1756             puts $f $data 
     1914            puts $f $data
    17571915            close $f
    17581916            set reader [vtkDataSetReader $tag-xvtkDataSetReader]
     
    17721930            file delete $tmpfile
    17731931            set output [$reader GetOutput]
     1932            if { $output == "" } {
     1933                # Invalid VTK file -- loader failed to parse
     1934                continue
     1935            }
    17741936            set _limits($tag) [$output GetBounds]
    17751937            if {$debug} {
     
    18301992}
    18311993
    1832 itcl::body Rappture::VtkViewer::BuildPolydataTab {} {
     1994itcl::body Rappture::VtkViewer::BuildGlyphsTab {} {
    18331995
    18341996    set fg [option get $itk_component(hull) font Font]
    18351997    #set bfg [option get $itk_component(hull) boldFont Font]
    18361998
    1837     set inner [$itk_component(main) insert end \
     1999    set inner [$itk_component(main) insert 0 \
     2000        -title "Glyph Settings" \
     2001        -icon [Rappture::icon volume-on]]
     2002    $inner configure -borderwidth 4
     2003
     2004    checkbutton $inner.glyphs \
     2005        -text "Show Glyphs" \
     2006        -variable [itcl::scope _settings(glyphs-visible)] \
     2007        -command [itcl::code $this AdjustSetting glyphs-visible] \
     2008        -font "Arial 9" -anchor w
     2009
     2010    checkbutton $inner.outline \
     2011        -text "Show Outline" \
     2012        -variable [itcl::scope _settings(glyphs-outline)] \
     2013        -command [itcl::code $this AdjustSetting glyphs-outline] \
     2014        -font "Arial 9" -anchor w
     2015
     2016    checkbutton $inner.wireframe \
     2017        -text "Show Wireframe" \
     2018        -variable [itcl::scope _settings(glyphs-wireframe)] \
     2019        -command [itcl::code $this AdjustSetting glyphs-wireframe] \
     2020        -font "Arial 9" -anchor w
     2021
     2022    checkbutton $inner.lighting \
     2023        -text "Enable Lighting" \
     2024        -variable [itcl::scope _settings(glyphs-lighting)] \
     2025        -command [itcl::code $this AdjustSetting glyphs-lighting] \
     2026        -font "Arial 9" -anchor w
     2027
     2028    checkbutton $inner.edges \
     2029        -text "Show Edges" \
     2030        -variable [itcl::scope _settings(glyphs-edges)] \
     2031        -command [itcl::code $this AdjustSetting glyphs-edges] \
     2032        -font "Arial 9" -anchor w
     2033
     2034    label $inner.palette_l -text "Palette" -font "Arial 9" -anchor w
     2035    itk_component add glyphspalette {
     2036        Rappture::Combobox $inner.palette -width 10 -editable no
     2037    }
     2038    $inner.palette choices insert end [GetColormapList]
     2039    $itk_component(glyphspalette) value "BCGYR"
     2040    bind $inner.palette <<Value>> \
     2041        [itcl::code $this AdjustSetting glyphs-palette]
     2042
     2043    label $inner.opacity_l -text "Opacity" -font "Arial 9" -anchor w
     2044    ::scale $inner.opacity -from 0 -to 100 -orient horizontal \
     2045        -variable [itcl::scope _settings(glyphs-opacity)] \
     2046        -width 10 \
     2047        -showvalue off \
     2048        -command [itcl::code $this EventuallySetGlyphsOpacity]
     2049    $inner.opacity set $_settings(glyphs-opacity)
     2050
     2051    blt::table $inner \
     2052        0,0 $inner.glyphs    -cspan 2  -anchor w -pady 2 \
     2053        1,0 $inner.outline   -cspan 2  -anchor w -pady 2 \
     2054        2,0 $inner.wireframe -cspan 2  -anchor w -pady 2 \
     2055        3,0 $inner.lighting  -cspan 2  -anchor w -pady 2 \
     2056        4,0 $inner.edges     -cspan 2  -anchor w -pady 2 \
     2057        5,0 $inner.opacity_l -anchor w -pady 2 \
     2058        5,1 $inner.opacity   -fill x   -pady 2 \
     2059        6,0 $inner.palette_l -anchor w -pady 2 \
     2060        6,1 $inner.palette   -fill x   -pady 2
     2061
     2062    blt::table configure $inner r* c* -resize none
     2063    blt::table configure $inner r8 c1 -resize expand
     2064}
     2065
     2066itcl::body Rappture::VtkViewer::BuildPolydataTab {} {
     2067
     2068    set fg [option get $itk_component(hull) font Font]
     2069    #set bfg [option get $itk_component(hull) boldFont Font]
     2070
     2071    set inner [$itk_component(main) insert 0 \
    18382072        -title "Mesh Settings" \
    18392073        -icon [Rappture::icon mesh]]
     
    18442078        -variable [itcl::scope _settings(polydata-visible)] \
    18452079        -command [itcl::code $this AdjustSetting polydata-visible] \
    1846         -font "Arial 9" -anchor w
     2080        -font "Arial 9" -anchor w
     2081
     2082    checkbutton $inner.outline \
     2083        -text "Show Outline" \
     2084        -variable [itcl::scope _settings(polydata-outline)] \
     2085        -command [itcl::code $this AdjustSetting polydata-outline] \
     2086        -font "Arial 9" -anchor w
    18472087
    18482088    checkbutton $inner.wireframe \
     
    18502090        -variable [itcl::scope _settings(polydata-wireframe)] \
    18512091        -command [itcl::code $this AdjustSetting polydata-wireframe] \
    1852         -font "Arial 9" -anchor w 
     2092        -font "Arial 9" -anchor w
    18532093
    18542094    checkbutton $inner.lighting \
     
    18642104        -font "Arial 9" -anchor w
    18652105
    1866     label $inner.palette_l -text "Palette" -font "Arial 9" -anchor w 
     2106    label $inner.palette_l -text "Palette" -font "Arial 9" -anchor w
    18672107    itk_component add meshpalette {
    18682108        Rappture::Combobox $inner.palette -width 10 -editable no
    18692109    }
    1870     $inner.palette choices insert end \
    1871         "BCGYR"              "BCGYR"            \
    1872         "BGYOR"              "BGYOR"            \
    1873         "blue"               "blue"             \
    1874         "blue-to-brown"      "blue-to-brown"    \
    1875         "blue-to-orange"     "blue-to-orange"   \
    1876         "blue-to-grey"       "blue-to-grey"     \
    1877         "green-to-magenta"   "green-to-magenta" \
    1878         "greyscale"          "greyscale"        \
    1879         "nanohub"            "nanohub"          \
    1880         "rainbow"            "rainbow"          \
    1881         "spectral"           "spectral"         \
    1882         "ROYGB"              "ROYGB"            \
    1883         "RYGCB"              "RYGCB"            \
    1884         "brown-to-blue"      "brown-to-blue"    \
    1885         "grey-to-blue"       "grey-to-blue"     \
    1886         "orange-to-blue"     "orange-to-blue"   
    1887 
     2110    $inner.palette choices insert end [GetColormapList]
    18882111    $itk_component(meshpalette) value "BCGYR"
    18892112    bind $inner.palette <<Value>> \
    18902113        [itcl::code $this AdjustSetting polydata-palette]
    18912114
    1892     label $inner.opacity_l -text "Opacity" -font "Arial 9" -anchor w 
     2115    label $inner.opacity_l -text "Opacity" -font "Arial 9" -anchor w
    18932116    ::scale $inner.opacity -from 0 -to 100 -orient horizontal \
    18942117        -variable [itcl::scope _settings(polydata-opacity)] \
    18952118        -width 10 \
    18962119        -showvalue off \
    1897         -command [itcl::code $this AdjustSetting polydata-opacity]
     2120        -command [itcl::code $this EventuallySetPolydataOpacity]
    18982121    $inner.opacity set $_settings(polydata-opacity)
    18992122
    19002123    blt::table $inner \
    19012124        0,0 $inner.mesh      -cspan 2  -anchor w -pady 2 \
    1902         1,0 $inner.wireframe -cspan 2  -anchor w -pady 2 \
    1903         2,0 $inner.lighting  -cspan 2  -anchor w -pady 2 \
    1904         3,0 $inner.edges     -cspan 2  -anchor w -pady 2 \
    1905         4,0 $inner.opacity_l -anchor w -pady 2 \
    1906         4,1 $inner.opacity   -fill x   -pady 2 \
    1907         5,0 $inner.palette_l -anchor w -pady 2 \
    1908         5,1 $inner.palette   -fill x   -pady 2 
     2125        1,0 $inner.outline   -cspan 2  -anchor w -pady 2 \
     2126        2,0 $inner.wireframe -cspan 2  -anchor w -pady 2 \
     2127        3,0 $inner.lighting  -cspan 2  -anchor w -pady 2 \
     2128        4,0 $inner.edges     -cspan 2  -anchor w -pady 2 \
     2129        5,0 $inner.opacity_l -anchor w -pady 2 \
     2130        5,1 $inner.opacity   -fill x   -pady 2 \
     2131        6,0 $inner.palette_l -anchor w -pady 2 \
     2132        6,1 $inner.palette   -fill x   -pady 2
    19092133
    19102134    blt::table configure $inner r* c* -resize none
    1911     blt::table configure $inner r7 c1 -resize expand
     2135    blt::table configure $inner r8 c1 -resize expand
    19122136}
    19132137
     
    19192143    set inner [$itk_component(main) insert end \
    19202144        -title "Axis Settings" \
    1921         -icon [Rappture::icon axis1]]
     2145        -icon [Rappture::icon axis2]]
    19222146    $inner configure -borderwidth 4
    19232147
    19242148    checkbutton $inner.visible \
    1925         -text "Show Axes" \
     2149        -text "Axes" \
    19262150        -variable [itcl::scope _axis(visible)] \
    19272151        -command [itcl::code $this AdjustSetting axis-visible] \
     
    19292153
    19302154    checkbutton $inner.labels \
    1931         -text "Show Axis Labels" \
     2155        -text "Axis Labels" \
    19322156        -variable [itcl::scope _axis(labels)] \
    19332157        -command [itcl::code $this AdjustSetting axis-labels] \
    19342158        -font "Arial 9"
    1935 
    1936     checkbutton $inner.gridx \
    1937         -text "Show X Grid" \
     2159    label $inner.grid_l -text "Grid" -font "Arial 9"
     2160    checkbutton $inner.xgrid \
     2161        -text "X" \
    19382162        -variable [itcl::scope _axis(xgrid)] \
    19392163        -command [itcl::code $this AdjustSetting axis-xgrid] \
    19402164        -font "Arial 9"
    1941     checkbutton $inner.gridy \
    1942         -text "Show Y Grid" \
     2165    checkbutton $inner.ygrid \
     2166        -text "Y" \
    19432167        -variable [itcl::scope _axis(ygrid)] \
    19442168        -command [itcl::code $this AdjustSetting axis-ygrid] \
    19452169        -font "Arial 9"
    1946     checkbutton $inner.gridz \
    1947         -text "Show Z Grid" \
     2170    checkbutton $inner.zgrid \
     2171        -text "Z" \
    19482172        -variable [itcl::scope _axis(zgrid)] \
    19492173        -command [itcl::code $this AdjustSetting axis-zgrid] \
    19502174        -font "Arial 9"
    1951 
    1952     label $inner.mode_l -text "Mode" -font "Arial 9"
     2175    checkbutton $inner.minorticks \
     2176        -text "Minor Ticks" \
     2177        -variable [itcl::scope _axis(minorticks)] \
     2178        -command [itcl::code $this AdjustSetting axis-minorticks] \
     2179        -font "Arial 9"
     2180
     2181    label $inner.mode_l -text "Mode" -font "Arial 9"
    19532182
    19542183    itk_component add axismode {
     
    19582187        "static_triad"    "static" \
    19592188        "closest_triad"   "closest" \
    1960         "furthest_triad"  "furthest" \
    1961         "outer_edges"     "outer"         
     2189        "furthest_triad"  "farthest" \
     2190        "outer_edges"     "outer"
    19622191    $itk_component(axismode) value "static"
    19632192    bind $inner.mode <<Value>> [itcl::code $this AdjustSetting axis-mode]
    19642193
    19652194    blt::table $inner \
    1966         0,0 $inner.visible -anchor w -cspan 2 \
    1967         1,0 $inner.labels  -anchor w -cspan 2 \
    1968         2,0 $inner.gridx   -anchor w -cspan 2 \
    1969         3,0 $inner.gridy   -anchor w -cspan 2 \
    1970         4,0 $inner.gridz   -anchor w -cspan 2 \
    1971         5,0 $inner.mode_l  -anchor w -cspan 2 -padx { 2 0 } \
    1972         6,0 $inner.mode    -fill x   -cspan 2
     2195        0,0 $inner.visible -anchor w -cspan 4 \
     2196        1,0 $inner.labels  -anchor w -cspan 4 \
     2197        2,0 $inner.minorticks  -anchor w -cspan 4 \
     2198        4,0 $inner.grid_l  -anchor w \
     2199        4,1 $inner.xgrid   -anchor w \
     2200        4,2 $inner.ygrid   -anchor w \
     2201        4,3 $inner.zgrid   -anchor w \
     2202        5,0 $inner.mode_l  -anchor w -padx { 2 0 } \
     2203        5,1 $inner.mode    -fill x   -cspan 3
    19732204
    19742205    blt::table configure $inner r* c* -resize none
    1975     blt::table configure $inner r7 c1 -resize expand
     2206    blt::table configure $inner r7 c6 -resize expand
     2207    blt::table configure $inner r3 -height 0.125i
    19762208}
    19772209
     
    19942226        0,0 $inner.view_l -anchor e -pady 2 \
    19952227        0,1 $inner.view -anchor w -pady 2
     2228    blt::table configure $inner r0 -resize none
    19962229
    19972230    set labels { qx qy qz qw xpan ypan zoom }
     
    20002233        label $inner.${tag}label -text $tag -font "Arial 9"
    20012234        entry $inner.${tag} -font "Arial 9"  -bg white \
    2002             -textvariable [itcl::scope _view($tag)]
    2003         bind $inner.${tag} <KeyPress-Return> \
    2004             [itcl::code $this camera set ${tag}]
     2235            -textvariable [itcl::scope _view(-$tag)]
     2236        bind $inner.${tag} <Return> \
     2237            [itcl::code $this camera set -${tag}]
     2238        bind $inner.${tag} <KP_Enter> \
     2239            [itcl::code $this camera set -${tag}]
    20052240        blt::table $inner \
    20062241            $row,0 $inner.${tag}label -anchor e -pady 2 \
     
    20112246    checkbutton $inner.ortho \
    20122247        -text "Orthographic Projection" \
    2013         -variable [itcl::scope _view(ortho)] \
    2014         -command [itcl::code $this camera set ortho] \
     2248        -variable [itcl::scope _view(-ortho)] \
     2249        -command [itcl::code $this camera set -ortho] \
    20152250        -font "Arial 9"
    20162251    blt::table $inner \
     
    20192254    incr row
    20202255
    2021     blt::table configure $inner c* r* -resize none
     2256    blt::table configure $inner c* -resize none
    20222257    blt::table configure $inner c2 -resize expand
    20232258    blt::table configure $inner r$row -resize expand
     
    20272262
    20282263    set fg [option get $itk_component(hull) font Font]
    2029    
     2264
    20302265    set inner [$itk_component(main) insert end \
    20312266        -title "Cutaway Along Axis" \
    2032         -icon [Rappture::icon cutbutton]] 
     2267        -icon [Rappture::icon cutbutton]]
    20332268
    20342269    $inner configure -borderwidth 4
     
    20702305            -variable [itcl::scope _axis(xdirection)]
    20712306    }
    2072     set _axis(xdirection) -1 
     2307    set _axis(xdirection) -1
    20732308    Rappture::Tooltip::for $itk_component(xDirButton) \
    20742309        "Toggle the direction of the X-axis cutaway"
     
    21122347    Rappture::Tooltip::for $itk_component(yDirButton) \
    21132348        "Toggle the direction of the Y-axis cutaway"
    2114     set _axis(ydirection) -1 
     2349    set _axis(ydirection) -1
    21152350
    21162351    # Z-value slicer...
     
    21372372    $itk_component(zCutScale) set 100
    21382373    $itk_component(zCutScale) configure -state disabled
    2139     #$itk_component(zCutScale) configure -state disabled
    21402374    Rappture::Tooltip::for $itk_component(zCutScale) \
    21412375        "@[itcl::code $this Slice tooltip z]"
     
    21502384            -variable [itcl::scope _axis(zdirection)]
    21512385    }
    2152     set _axis(zdirection) -1 
     2386    set _axis(zdirection) -1
    21532387    Rappture::Tooltip::for $itk_component(zDirButton) \
    21542388        "Toggle the direction of the Z-axis cutaway"
     
    21692403    set fg [option get $itk_component(hull) font Font]
    21702404
    2171     set inner [$itk_component(main) insert end \
     2405    set inner [$itk_component(main) insert 0 \
    21722406        -title "Molecule Settings" \
    21732407        -icon [Rappture::icon molecule]]
     
    21802414        -font "Arial 9"
    21812415
     2416    checkbutton $inner.outline \
     2417        -text "Show Outline" \
     2418        -variable [itcl::scope _settings(molecule-outline)] \
     2419        -command [itcl::code $this AdjustSetting molecule-outline] \
     2420        -font "Arial 9"
     2421
    21822422    checkbutton $inner.label \
    21832423        -text "Show Atom Labels" \
     
    22122452    $inner.rep choices insert end \
    22132453        "ballandstick"  "Ball and Stick" \
    2214         "spheres"       "Spheres"        \
    2215         "sticks"        "Sticks"        \
    2216         "rods"          "Rods"           \
    2217         "wireframe"     "Wireframe"      \
    2218         "spacefilling"  "Space Filling" 
     2454        "spheres"       "Spheres"        \
     2455        "sticks"        "Sticks"        \
     2456        "rods"          "Rods"           \
     2457        "wireframe"     "Wireframe"      \
     2458        "spacefilling"  "Space Filling"
    22192459
    22202460    bind $inner.rep <<Value>> \
     
    22292469    }
    22302470    $inner.rscale choices insert end \
    2231         "atomic"        "Atomic"   \
    2232         "covalent"      "Covalent" \
    2233         "van_der_waals" "VDW"      \
    2234         "none"          "Constant"
     2471        "atomic"        "Atomic"   \
     2472        "covalent"      "Covalent" \
     2473        "van_der_waals" "VDW"      \
     2474        "none"          "Constant"
    22352475
    22362476    bind $inner.rscale <<Value>> \
     
    22382478    $inner.rscale value "Covalent"
    22392479
    2240     label $inner.palette_l -text "Palette" -font "Arial 9" 
     2480    label $inner.palette_l -text "Palette" -font "Arial 9"
    22412481    itk_component add moleculepalette {
    22422482        Rappture::Combobox $inner.palette -width 10 -editable no
    22432483    }
    2244     $inner.palette choices insert end \
    2245         "elementDefault"     "elementDefault"   \
    2246         "BCGYR"              "BCGYR"            \
    2247         "BGYOR"              "BGYOR"            \
    2248         "blue"               "blue"             \
    2249         "blue-to-brown"      "blue-to-brown"    \
    2250         "blue-to-orange"     "blue-to-orange"   \
    2251         "blue-to-grey"       "blue-to-grey"     \
    2252         "green-to-magenta"   "green-to-magenta" \
    2253         "greyscale"          "greyscale"        \
    2254         "nanohub"            "nanohub"          \
    2255         "rainbow"            "rainbow"          \
    2256         "spectral"           "spectral"         \
    2257         "ROYGB"              "ROYGB"            \
    2258         "RYGCB"              "RYGCB"            \
    2259         "brown-to-blue"      "brown-to-blue"    \
    2260         "grey-to-blue"       "grey-to-blue"     \
    2261         "orange-to-blue"     "orange-to-blue"   
    2262 
     2484    $inner.palette choices insert end [GetColormapList -includeElementDefault]
    22632485    $itk_component(moleculepalette) value "elementDefault"
    22642486    bind $inner.palette <<Value>> \
    22652487        [itcl::code $this AdjustSetting molecule-palette]
    2266 
    2267     checkbutton $inner.labels -text "Show labels on atoms" \
    2268         -command [itcl::code $this labels update] \
    2269         -variable [itcl::scope _settings(molecule-labels)] \
    2270         -font "Arial 9"
    2271     Rappture::Tooltip::for $inner.labels \
    2272         "Display atom symbol and serial number."
    2273 
    2274     checkbutton $inner.rock -text "Rock molecule back and forth" \
    2275         -variable [itcl::scope _settings(molecule-rock)] \
    2276         -font "Arial 9"
    2277     Rappture::Tooltip::for $inner.rock \
    2278         "Rotate the object back and forth around the y-axis."
    2279 
    2280     checkbutton $inner.cell -text "Parallelepiped" \
    2281         -font "Arial 9"
    2282     $inner.cell select
    22832488
    22842489    label $inner.atomscale_l -text "Atom Scale" -font "Arial 9"
     
    23212526    blt::table $inner \
    23222527        0,0 $inner.molecule     -anchor w -pady {1 0} \
    2323         1,0 $inner.label        -anchor w -pady {1 0} \
    2324         2,0 $inner.edges        -anchor w -pady {1 0} \
    2325         3,0 $inner.rep_l        -anchor w -pady { 2 0 } \
    2326         4,0 $inner.rep          -fill x    -pady 2 \
    2327         5,0 $inner.rscale_l     -anchor w -pady { 2 0 } \
    2328         6,0 $inner.rscale       -fill x    -pady 2 \
    2329         7,0 $inner.palette_l    -anchor w  -pady 0 \
    2330         8,0 $inner.palette      -fill x    -padx 2 \
    2331         9,0 $inner.atomscale_l  -anchor w -pady {3 0} \
    2332         10,0 $inner.atomscale   -fill x    -padx 2 \
    2333         11,0 $inner.bondscale_l -anchor w -pady {3 0} \
    2334         12,0 $inner.bondscale   -fill x   -padx 2 \
    2335         13,0 $inner.opacity_l   -anchor w -pady {3 0} \
    2336         14,0 $inner.opacity     -fill x    -padx 2 \
    2337         15,0 $inner.quality_l   -anchor w -pady {3 0} \
    2338         16,0 $inner.quality     -fill x    -padx 2
    2339    
     2528        1,0 $inner.outline      -anchor w -pady {1 0} \
     2529        2,0 $inner.label        -anchor w -pady {1 0} \
     2530        3,0 $inner.edges        -anchor w -pady {1 0} \
     2531        4,0 $inner.rep_l        -anchor w -pady { 2 0 } \
     2532        5,0 $inner.rep          -fill x    -pady 2 \
     2533        6,0 $inner.rscale_l     -anchor w -pady { 2 0 } \
     2534        7,0 $inner.rscale       -fill x    -pady 2 \
     2535        8,0 $inner.palette_l    -anchor w  -pady 0 \
     2536        9,0 $inner.palette      -fill x    -padx 2 \
     2537        10,0 $inner.atomscale_l  -anchor w -pady {3 0} \
     2538        11,0 $inner.atomscale   -fill x    -padx 2 \
     2539        12,0 $inner.bondscale_l -anchor w -pady {3 0} \
     2540        13,0 $inner.bondscale   -fill x   -padx 2 \
     2541        14,0 $inner.opacity_l   -anchor w -pady {3 0} \
     2542        15,0 $inner.opacity     -fill x    -padx 2 \
     2543        16,0 $inner.quality_l   -anchor w -pady {3 0} \
     2544        17,0 $inner.quality     -fill x    -padx 2
     2545
    23402546    blt::table configure $inner r* -resize none
    2341     blt::table configure $inner r17 -resize expand
    2342 }
    2343 
    2344 #
    2345 #  camera -- 
     2547    blt::table configure $inner r18 -resize expand
     2548}
     2549
     2550#
     2551#  camera --
    23462552#
    23472553itcl::body Rappture::VtkViewer::camera {option args} {
    2348     switch -- $option { 
     2554    switch -- $option {
    23492555        "show" {
    23502556            puts [array get _view]
    23512557        }
    23522558        "set" {
    2353             set who [lindex $args 0]
    2354             set x $_view($who)
     2559            set what [lindex $args 0]
     2560            set x $_view($what)
    23552561            set code [catch { string is double $x } result]
    23562562            if { $code != 0 || !$result } {
    23572563                return
    23582564            }
    2359             switch -- $who {
    2360                 "ortho" {
    2361                     if {$_view(ortho)} {
     2565            switch -- $what {
     2566                "-ortho" {
     2567                    if {$_view($what)} {
    23622568                        SendCmd "camera mode ortho"
    23632569                    } else {
     
    23652571                    }
    23662572                }
    2367                 "xpan" - "ypan" {
     2573                "-xpan" - "-ypan" {
    23682574                    PanCamera
    23692575                }
    2370                 "qx" - "qy" - "qz" - "qw" {
    2371                     set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)]
     2576                "-qx" - "-qy" - "-qz" - "-qw" {
     2577                    set q [ViewToQuaternion]
    23722578                    $_arcball quaternion $q
    23732579                    EventuallyRotate $q
    23742580                }
    2375                 "zoom" {
    2376                     SendCmd "camera zoom $_view(zoom)"
     2581                "-zoom" {
     2582                    SendCmd "camera zoom $_view($what)"
    23772583                }
    23782584            }
     
    23942600
    23952601itcl::body Rappture::VtkViewer::GetImage { args } {
    2396     if { [image width $_image(download)] > 0 && 
     2602    if { [image width $_image(download)] > 0 &&
    23972603         [image height $_image(download)] > 0 } {
    23982604        set bytes [$_image(download) data -format "jpeg -quality 100"]
     
    24072613        -title "[Rappture::filexfer::label downloadWord] as..."
    24082614    set inner [$popup component inner]
    2409     label $inner.summary -text "" -anchor w 
     2615    label $inner.summary -text "" -anchor w
    24102616    radiobutton $inner.vtk_button -text "VTK data file" \
    24112617        -variable [itcl::scope _downloadPopup(format)] \
    24122618        -font "Helvetica 9 " \
    2413         -value vtk 
     2619        -value vtk
    24142620    Rappture::Tooltip::for $inner.vtk_button "Save as VTK data file."
    24152621    radiobutton $inner.image_button -text "Image File" \
    24162622        -variable [itcl::scope _downloadPopup(format)] \
    2417         -value image 
     2623        -value image
    24182624    Rappture::Tooltip::for $inner.image_button \
    24192625        "Save as digital image."
     
    24362642        2,0 $inner.image_button -anchor w -cspan 2 -padx { 4 0 } \
    24372643        4,1 $inner.cancel -width .9i -fill y \
    2438         4,0 $inner.ok -padx 2 -width .9i -fill y 
     2644        4,0 $inner.ok -padx 2 -width .9i -fill y
    24392645    blt::table configure $inner r3 -height 4
    24402646    blt::table configure $inner r4 -pady 4
     
    24552661        "glyphs" {
    24562662            array set settings {
    2457                 -color \#FFFFFF
     2663                -color white
     2664                -edgecolor black
     2665                -edges 0
    24582666                -gscale 1
    2459                 -edges 0
    2460                 -edgecolor black
     2667                -lighting 1
    24612668                -linewidth 1.0
     2669                -normscale 0
    24622670                -opacity 1.0
     2671                -orientGlyphs 0
     2672                -outline 0
     2673                -ptsize 1.0
     2674                -quality 1
     2675                -scaleMode "vcomp"
     2676                -shape "sphere"
     2677                -visible 1
    24632678                -wireframe 0
    2464                 -lighting 1
    2465                 -visible 1
    2466             }
     2679            }
     2680            array set settings $style
    24672681            set shape [$dataobj shape $comp]
    2468             array set settings $style
    2469             SendCmd "glyphs add $shape $tag"
    2470             SendCmd "glyphs normscale 0 $tag"
     2682            if {$shape != ""} {
     2683                set settings(-shape) $shape
     2684            }
     2685            SendCmd "outline add $tag"
     2686            SendCmd "outline color [Color2RGB $settings(-color)] $tag"
     2687            SendCmd "outline visible $settings(-outline) $tag"
     2688            set _settings(glyphs-outline) $settings(-outline)
     2689
     2690            SendCmd "glyphs add $settings(-shape) $tag"
     2691            SendCmd "glyphs normscale $settings(-normscale) $tag"
    24712692            SendCmd "glyphs gscale $settings(-gscale) $tag"
    24722693            SendCmd "glyphs wireframe $settings(-wireframe) $tag"
    24732694            SendCmd "glyphs color [Color2RGB $settings(-color)] $tag"
    24742695            #SendCmd "glyphs colormode constant {} $tag"
    2475             SendCmd "glyphs gorient 0 {} $tag"
    2476             SendCmd "glyphs smode vcomp {} $tag"
     2696            # Omitting field name for gorient and smode commands
     2697            # defaults to active scalars or vectors depending on mode
     2698            SendCmd "glyphs gorient $settings(-orientGlyphs) {} $tag"
     2699            SendCmd "glyphs smode $settings(-scaleMode) {} $tag"
     2700            SendCmd "glyphs edges $settings(-edges) $tag"
     2701            SendCmd "glyphs linecolor [Color2RGB $settings(-edgecolor)] $tag"
     2702            SendCmd "glyphs linewidth $settings(-linewidth) $tag"
     2703            SendCmd "glyphs ptsize $settings(-ptsize) $tag"
     2704            SendCmd "glyphs quality $settings(-quality) $tag"
     2705            SendCmd "glyphs lighting $settings(-lighting) $tag"
    24772706            SendCmd "glyphs opacity $settings(-opacity) $tag"
     2707            set _settings(glyphs-opacity) [expr 100.0 * $settings(-opacity)]
    24782708            SendCmd "glyphs visible $settings(-visible) $tag"
    24792709            set _settings(glyphs-wireframe) $settings(-wireframe)
    24802710        }
    24812711        "molecule" {
     2712            array set settings {
     2713                -atomscale 0.3
     2714                -atomsvisible 1
     2715                -bondscale 0.075
     2716                -bondstyle "cylinder"
     2717                -bondsvisible 1
     2718                -color "elementDefault"
     2719                -edgecolor black
     2720                -edges 0
     2721                -labels 0
     2722                -lighting 1
     2723                -linewidth 1.0
     2724                -opacity 1.0
     2725                -outline 0
     2726                -quality 1.0
     2727                -representation ""
     2728                -rscale "covalent"
     2729                -visible 1
     2730                -wireframe 0
     2731            }
     2732            array set settings $style
     2733
     2734            SendCmd "outline add $tag"
     2735            SendCmd "outline color [Color2RGB white] $tag"
     2736            SendCmd "outline visible $settings(-outline) $tag"
     2737            set _settings(molecule-outline) $settings(-outline)
     2738
    24822739            SendCmd "molecule add $tag"
    2483             SendCmd "molecule ascale $_settings(molecule-atomscale) $tag"
    2484             SendCmd "molecule bscale $_settings(molecule-bondscale) $tag"
    2485             SendCmd "molecule bstyle $_settings(molecule-bondstyle) $tag"
    2486             SendCmd "molecule atoms $_settings(molecule-atoms-visible) $tag"
    2487             SendCmd "molecule bonds $_settings(molecule-bonds-visible) $tag"
     2740            if {$settings(-representation) != ""} {
     2741                switch -- $settings(-representation) {
     2742                    "ballandstick" {
     2743                        set _settings(molecule-rscale) covalent
     2744                        set _settings(molecule-atoms-visible) 1
     2745                        set _settings(molecule-bonds-visible) 1
     2746                        set _settings(molecule-bondstyle) cylinder
     2747                        set _settings(molecule-atomscale) 0.3
     2748                        set _settings(molecule-bondscale) 0.075
     2749                    }
     2750                    "balls" - "spheres" {
     2751                        set _settings(molecule-rscale) covalent
     2752                        set _settings(molecule-atoms-visible) 1
     2753                        set _settings(molecule-bonds-visible) 0
     2754                        set _settings(molecule-bondstyle) cylinder
     2755                        set _settings(molecule-atomscale) 0.3
     2756                        set _settings(molecule-bondscale) 0.075
     2757                    }
     2758                    "sticks" {
     2759                        set _settings(molecule-rscale) none
     2760                        set _settings(molecule-atoms-visible) 1
     2761                        set _settings(molecule-bonds-visible) 1
     2762                        set _settings(molecule-bondstyle) cylinder
     2763                        set _settings(molecule-atomscale) 0.075
     2764                        set _settings(molecule-bondscale) 0.075
     2765                    }
     2766                    "spacefilling" {
     2767                        set _settings(molecule-rscale) van_der_waals
     2768                        set _settings(molecule-atoms-visible) 1
     2769                        set _settings(molecule-bonds-visible) 0
     2770                        set _settings(molecule-bondstyle) cylinder
     2771                        set _settings(molecule-atomscale) 1.0
     2772                        set _settings(molecule-bondscale) 0.075
     2773                    }
     2774                    "rods"  {
     2775                        set _settings(molecule-rscale) none
     2776                        set _settings(molecule-atoms-visible) 1
     2777                        set _settings(molecule-bonds-visible) 1
     2778                        set _settings(molecule-bondstyle) cylinder
     2779                        set _settings(molecule-atomscale) 0.1
     2780                        set _settings(molecule-bondscale) 0.1
     2781                    }
     2782                    "wireframe" - "lines" {
     2783                        set _settings(molecule-rscale) none
     2784                        set _settings(molecule-atoms-visible) 0
     2785                        set _settings(molecule-bonds-visible) 1
     2786                        set _settings(molecule-bondstyle) line
     2787                        set _settings(molecule-atomscale) 1.0
     2788                        set _settings(molecule-bondscale) 1.0
     2789                    }
     2790                    default {
     2791                        error "unknown representation $value"
     2792                    }
     2793                }
     2794                SendCmd "molecule rscale $_settings(molecule-rscale) $tag"
     2795                SendCmd "molecule atoms $_settings(molecule-atoms-visible) $tag"
     2796                SendCmd "molecule bonds $_settings(molecule-bonds-visible) $tag"
     2797                SendCmd "molecule bstyle $_settings(molecule-bondstyle) $tag"
     2798                SendCmd "molecule ascale $_settings(molecule-atomscale) $tag"
     2799                SendCmd "molecule bscale $_settings(molecule-bondscale) $tag"
     2800                $itk_component(representation) value [$itk_component(representation) label $settings(-representation)]
     2801                $itk_component(rscale) value [$itk_component(rscale) label $_settings(molecule-rscale)]
     2802                switch -- $settings(-representation) {
     2803                    "ballandstick" - "balls" - "spheres" {
     2804                        $itk_component(rscale) configure -state normal
     2805                    }
     2806                    default {
     2807                        $itk_component(rscale) configure -state disabled
     2808                    }
     2809                }
     2810            } else {
     2811                SendCmd "molecule rscale $settings(-rscale) $tag"
     2812                set _settings(molecule-rscale) $settings(-rscale)
     2813                SendCmd "molecule atoms $settings(-atomsvisible) $tag"
     2814                set _settings(molecule-atoms-visible) $settings(-atomsvisible)
     2815                SendCmd "molecule bonds $settings(-bondsvisible) $tag"
     2816                set _settings(molecule-bonds-visible) $settings(-bondsvisible)
     2817                SendCmd "molecule bstyle $settings(-bondstyle) $tag"
     2818                set _settings(molecule-bondstyle) $settings(-bondstyle)
     2819                SendCmd "molecule ascale $settings(-atomscale) $tag"
     2820                set _settings(molecule-atomscale) $settings(-atomscale)
     2821                SendCmd "molecule bscale $settings(-bondscale) $tag"
     2822                set _settings(molecule-bondscale) $settings(-bondscale)
     2823            }
     2824            SendCmd "molecule labels $settings(-labels) $tag"
     2825            set _settings(molecule-labels) $settings(-labels)
     2826            SendCmd "molecule linecolor [Color2RGB $settings(-edgecolor)] $tag"
     2827            SendCmd "molecule linewidth $settings(-linewidth) $tag"
     2828            SendCmd "molecule edges $settings(-edges) $tag"
     2829            set _settings(molecule-edges) $settings(-edges)
     2830            SendCmd "molecule lighting $settings(-lighting) $tag"
     2831            set _settings(molecule-lighting) $settings(-lighting)
     2832            SendCmd "molecule aquality $settings(-quality) $tag"
     2833            SendCmd "molecule bquality $settings(-quality) $tag"
     2834            set _settings(molecule-quality) $settings(-quality)
     2835            SendCmd "molecule visible $settings(-visible) $tag"
     2836            set _settings(molecule-visible) $settings(-visible)
    24882837            set _haveMolecules 1
    24892838        }
    24902839        "polydata" {
    24912840            array set settings {
    2492                 -color \#FFFFFF
     2841                -cloudstyle "mesh"
     2842                -color white
     2843                -edgecolor black
    24932844                -edges 1
    2494                 -edgecolor black
     2845                -lighting 1
    24952846                -linewidth 1.0
    24962847                -opacity 1.0
     2848                -outline 0
     2849                -visible 1
    24972850                -wireframe 0
    2498                 -lighting 1
    2499                 -visible 1
    25002851            }
    25012852            array set settings $style
     2853
     2854            SendCmd "outline add $tag"
     2855            SendCmd "outline color [Color2RGB $settings(-color)] $tag"
     2856            SendCmd "outline visible $settings(-outline) $tag"
     2857            set _settings(polydata-outline) $settings(-outline)
     2858
    25022859            SendCmd "polydata add $tag"
    25032860            SendCmd "polydata visible $settings(-visible) $tag"
     
    25052862            SendCmd "polydata edges $settings(-edges) $tag"
    25062863            set _settings(polydata-edges) $settings(-edges)
     2864            SendCmd "polydata cloudstyle $settings(-cloudstyle) $tag"
    25072865            SendCmd "polydata color [Color2RGB $settings(-color)] $tag"
    25082866            #SendCmd "polydata colormode constant {} $tag"
     
    25612919    set font "Arial 8"
    25622920    set lineht [font metrics $font -linespace]
    2563    
     2921
    25642922    if { $_settings(legend) } {
    25652923        set x [expr $w - 2]
     
    26262984    set font "Arial 8"
    26272985    set lineht [font metrics $font -linespace]
    2628    
     2986
    26292987    set imgHeight [image height $_image(legend)]
    26302988    set coords [$c coords colormap]
     
    26402998    }
    26412999    set color [eval format "\#%02x%02x%02x" $pixel]
    2642     $_image(swatch) put black  -to 0 0 23 23 
    2643     $_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
    26443002    .rappturetooltip configure -icon $_image(swatch)
    26453003
     
    26473005    set t [expr 1.0 - (double($imgY) / double($imgHeight-1))]
    26483006    set value [expr $t * ($_limits(vmax) - $_limits(vmin)) + $_limits(vmin)]
    2649     set tipx [expr $x + 15] 
     3007    set tipx [expr $x + 15]
    26503008    set tipy [expr $y - 5]
    26513009    Rappture::Tooltip::text $c "$_title $value"
    2652     Rappture::Tooltip::tooltip show $c +$tipx,+$tipy   
     3010    Rappture::Tooltip::tooltip show $c +$tipx,+$tipy
    26533011}
    26543012
     
    26653023        "move" {
    26663024            set axis [lindex $args 0]
    2667             set oldval $_axis(${axis}position)
    26683025            set newval [lindex $args 1]
    26693026            if {[llength $args] != 2} {
     
    26843041}
    26853042
    2686 itcl::body Rappture::VtkViewer::SetOrientation { side } { 
     3043itcl::body Rappture::VtkViewer::SetOrientation { side } {
    26873044    array set positions {
    26883045        front "1 0 0 0"
     
    26933050        bottom "0.707107 0.707107 0 0"
    26943051    }
    2695     foreach name { qw qx qy qz } value $positions($side) {
     3052    foreach name { -qw -qx -qy -qz } value $positions($side) {
    26963053        set _view($name) $value
    2697     } 
    2698     set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)]
     3054    }
     3055    set q [ViewToQuaternion]
    26993056    $_arcball quaternion $q
    27003057    SendCmd "camera orient $q"
    27013058    SendCmd "camera reset"
    2702     set _view(xpan) 0
    2703     set _view(ypan) 0
    2704     set _view(zoom) 1.0
    2705 }
    2706 
    2707 itcl::body Rappture::VtkViewer::SetOpacity { dataset } { 
     3059    set _view(-xpan) 0
     3060    set _view(-ypan) 0
     3061    set _view(-zoom) 1.0
     3062}
     3063
     3064itcl::body Rappture::VtkViewer::SetOpacity { dataset } {
    27083065    foreach {dataobj comp} [split $dataset -] break
    27093066    set type [$dataobj type $comp]
Note: See TracChangeset for help on using the changeset viewer.