Ignore:
Timestamp:
Jul 3, 2014, 3:37:04 PM (10 years ago)
Author:
ldelgass
Message:

Merge vtkviewer from trunk

File:
1 edited

Legend:

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

    r4449 r4464  
    11# -*- mode: tcl; indent-tabs-mode: nil -*-
    2 
    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
     
    7069    protected method DoRotate {}
    7170    protected method AdjustSetting {what {value ""}}
    72     protected method FixSettings { args  }
     71    protected method InitSettings { args  }
    7372    protected method Pan {option x y}
    7473    protected method Pick {x y}
     
    8685    private method BuildCutawayTab {}
    8786    private method BuildDownloadPopup { widget command }
     87    private method BuildGlyphsTab {}
    8888    private method BuildMoleculeTab {}
    8989    private method BuildPolydataTab {}
     
    9191    private method DrawLegend {}
    9292    private method EnterLegend { x y }
     93    private method EventuallyResize { w h }
     94    private method EventuallyRotate { q }
    9395    private method EventuallySetAtomScale { args }
    9496    private method EventuallySetBondScale { args }
     
    9698    private method EventuallySetMoleculeQuality { args }
    9799    private method EventuallySetPolydataOpacity { args }
    98     private method EventuallyResize { w h }
    99     private method EventuallyRotate { q }
    100100    private method GetImage { args }
    101101    private method GetVtkData { args }
     
    157157    private variable _polydataOpacityPending 0
    158158    private variable _glyphsOpacityPending 0
    159     private variable _updatePending 0;
    160159    private variable _rotateDelay 150
    161160    private variable _scaleDelay 100
     
    181180    $_dispatcher register !resize
    182181    $_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"
    187182
    188183    # Rotate event
     
    257252    array set _settings [subst {
    258253        legend                  1
     254        glyphs-edges            0
     255        glyphs-lighting         1
    259256        glyphs-opacity          100
     257        glyphs-outline          0
     258        glyphs-palette          BCGYR
     259        glyphs-visible          1
    260260        glyphs-wireframe        0
    261261        polydata-edges          0
    262262        polydata-lighting       1
    263263        polydata-opacity        100
    264         polydata-palette        rainbow
     264        polydata-outline        0
     265        polydata-palette        BCGYR
    265266        polydata-visible        1
    266267        polydata-wireframe      0
     
    274275        molecule-lighting       1
    275276        molecule-opacity        100
     277        molecule-outline        0
    276278        molecule-palette        elementDefault
    277279        molecule-quality        1.0
     
    737739        }
    738740    }
     741    if { $_haveGlyphs } {
     742        if { ![$itk_component(main) exists "Glyphs Settings"] } {
     743            if { [catch { BuildGlyphsTab } errs ]  != 0 } {
     744                puts stderr "errs=$errs"
     745            }
     746        }
     747    }
    739748    if { $_havePolydata } {
    740749        if { ![$itk_component(main) exists "Mesh Settings"] } {
     
    9931002        $_arcball resize $w $h
    9941003        DoResize
    995         FixSettings axis-xgrid axis-ygrid axis-zgrid axis-mode \
     1004        InitSettings axis-xgrid axis-ygrid axis-zgrid axis-mode \
    9961005            axis-visible axis-labels
    9971006
    998         if { $_havePolydata } {
    999             FixSettings polydata-edges polydata-lighting polydata-opacity \
    1000                 polydata-visible polydata-wireframe
    1001         }
    10021007        StopBufferingCommands
    10031008        SendCmd "imgflush"
     
    10401045            }
    10411046            lappend _obj2datasets($dataobj) $tag
     1047            set type [$dataobj type $comp]
    10421048            if { [info exists _obj2ovride($dataobj-raise)] } {
    1043                 SendCmd "dataset visible 1 $tag"
     1049                SendCmd "$type visible 1 $tag"
    10441050                SetOpacity $tag
    10451051            }
     
    10551061            set label [$_first hints ${axis}label]
    10561062            if { $label != "" } {
    1057                 SendCmd "axis name $axis $label"
     1063                SendCmd [list axis name $axis $label]
    10581064            }
    10591065            set units [$_first hints ${axis}units]
    10601066            if { $units != "" } {
    1061                 SendCmd "axis units $axis $units"
    1062             }
    1063         }
     1067                SendCmd [list axis units $axis $units]
     1068            }
     1069        }
     1070    }
     1071    if { $_haveGlyphs } {
     1072        InitSettings glyphs-outline
     1073    }
     1074    if { $_haveMolecules } {
     1075        InitSettings molecule-outline
     1076    }
     1077    if { $_havePolydata } {
     1078        InitSettings polydata-outline
    10641079    }
    10651080    if { $_reset } {
     1081        if { $_haveGlyphs } {
     1082            InitSettings glyphs-edges glyphs-lighting glyphs-opacity \
     1083                glyphs-visible glyphs-wireframe
     1084        }
     1085        if { $_havePolydata } {
     1086            InitSettings polydata-edges polydata-lighting polydata-opacity \
     1087                polydata-visible polydata-wireframe
     1088        }
     1089        if { $_haveMolecules } {
     1090            InitSettings molecule-edges molecule-lighting molecule-opacity \
     1091                molecule-visible molecule-wireframe molecule-labels
     1092        }
     1093
    10661094        set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)]
    10671095        $_arcball quaternion $q
     
    10781106
    10791107    if { $_haveMolecules } {
    1080         #FixSettings molecule-representation
     1108        #InitSettings molecule-representation
    10811109    }
    10821110    set _reset 0
     
    12961324
    12971325# ----------------------------------------------------------------------
    1298 # USAGE: FixSettings <what> ?<value>?
     1326# USAGE: InitSettings <what> ?<value>?
    12991327#
    13001328# Used internally to update rendering settings whenever parameters
     
    13021330# to the back end.
    13031331# ----------------------------------------------------------------------
    1304 itcl::body Rappture::VtkViewer::FixSettings { args } {
     1332itcl::body Rappture::VtkViewer::InitSettings { args } {
    13051333    foreach setting $args {
    13061334        AdjustSetting $setting
     
    13201348    }
    13211349    switch -- $what {
     1350        "glyphs-opacity" {
     1351            foreach dataset [CurrentDatasets -visible $_first] {
     1352                foreach { dataobj comp } [split $dataset -] break
     1353                if { [$dataobj type $comp] == "glyphs" } {
     1354                    SetOpacity $dataset
     1355                }
     1356            }
     1357        }
     1358        "glyphs-outline" {
     1359            set bool $_settings(glyphs-outline)
     1360            foreach dataset [CurrentDatasets -visible $_first] {
     1361                foreach { dataobj comp } [split $dataset -] break
     1362                set type [$dataobj type $comp]
     1363                if { $type == "glyphs" } {
     1364                    SendCmd "outline visible $bool $dataset"
     1365                }
     1366            }
     1367        }
     1368        "glyphs-wireframe" {
     1369            set bool $_settings(glyphs-wireframe)
     1370            foreach dataset [CurrentDatasets -visible $_first] {
     1371                foreach { dataobj comp } [split $dataset -] break
     1372                set type [$dataobj type $comp]
     1373                if { $type == "glyphs" } {
     1374                    SendCmd "$type wireframe $bool $dataset"
     1375                }
     1376            }
     1377        }
     1378        "glyphs-visible" {
     1379            set bool $_settings(glyphs-visible)
     1380            foreach dataset [CurrentDatasets -visible $_first] {
     1381                foreach { dataobj comp } [split $dataset -] break
     1382                set type [$dataobj type $comp]
     1383                if { $type == "glyphs" } {
     1384                    SendCmd "$type visible $bool $dataset"
     1385                }
     1386            }
     1387        }
     1388        "glyphs-lighting" {
     1389            set bool $_settings(glyphs-lighting)
     1390            foreach dataset [CurrentDatasets -visible $_first] {
     1391                foreach { dataobj comp } [split $dataset -] break
     1392                set type [$dataobj type $comp]
     1393                if { $type == "glyphs" } {
     1394                    SendCmd "$type lighting $bool $dataset"
     1395                }
     1396            }
     1397        }
     1398        "glyphs-edges" {
     1399            set bool $_settings(glyphs-edges)
     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 "$type edges $bool $dataset"
     1405                }
     1406            }
     1407        }
     1408        "glyphs-palette" {
     1409            set palette [$itk_component(glyphspalette) value]
     1410            set _settings(glyphs-palette) $palette
     1411            foreach dataset [CurrentDatasets -visible $_first] {
     1412                foreach {dataobj comp} [split $dataset -] break
     1413                set type [$dataobj type $comp]
     1414                if { $type == "glyphs" } {
     1415                    ChangeColormap $dataobj $comp $palette
     1416                    # FIXME: fill in current selected fieldname
     1417                    #SendCmd "glyphs colormode scalar {} $dataset"
     1418                }
     1419            }
     1420            set _legendPending 1
     1421        }
    13221422        "polydata-opacity" {
    13231423            foreach dataset [CurrentDatasets -visible $_first] {
     
    13251425                if { [$dataobj type $comp] == "polydata" } {
    13261426                    SetOpacity $dataset
     1427                }
     1428            }
     1429        }
     1430        "polydata-outline" {
     1431            set bool $_settings(polydata-outline)
     1432            foreach dataset [CurrentDatasets -visible $_first] {
     1433                foreach { dataobj comp } [split $dataset -] break
     1434                set type [$dataobj type $comp]
     1435                if { $type == "polydata" } {
     1436                    SendCmd "outline visible $bool $dataset"
    13271437                }
    13281438            }
     
    13831493        }
    13841494        "molecule-opacity" {
    1385             set val $_settings(molecule-opacity)
    1386             set sval [expr { 0.01 * double($val) }]
    13871495            foreach dataset [CurrentDatasets -visible $_first] {
    13881496                foreach { dataobj comp } [split $dataset -] break
    13891497                if { [$dataobj type $comp] == "molecule" } {
    13901498                    SetOpacity $dataset
     1499                }
     1500            }
     1501        }
     1502        "molecule-outline" {
     1503            set bool $_settings(molecule-outline)
     1504            foreach dataset [CurrentDatasets -visible $_first] {
     1505                foreach { dataobj comp } [split $dataset -] break
     1506                set type [$dataobj type $comp]
     1507                if { $type == "molecule" } {
     1508                    SendCmd "outline visible $bool $dataset"
    13911509                }
    13921510            }
     
    14341552        "molecule-palette" {
    14351553            set palette [$itk_component(moleculepalette) value]
    1436             set _moelculeSettings(palette) $palette
     1554            set _settings(molecule-palette) $palette
    14371555            foreach dataset [CurrentDatasets -visible $_first] {
    14381556                foreach {dataobj comp} [split $dataset -] break
     
    14981616                    set _settings(molecule-atoms-visible) 0
    14991617                    set _settings(molecule-bonds-visible) 1
    1500                     set _settings(molecule-bondstyle) cylinder
     1618                    set _settings(molecule-bondstyle) line
    15011619                    set _settings(molecule-atomscale) 1.0
    15021620                    set _settings(molecule-bondscale) 1.0
     
    16131731    set font "Arial 8"
    16141732    set lineht [font metrics $font -linespace]
    1615     set c $itk_component(legend)
    16161733    set w 12
    16171734    set h [expr {$_height - 2 * ($lineht + 2)}]
    1618     if { $h < 1} {
     1735    if { $h < 1 } {
    16191736        return
    16201737    }
     
    18251942}
    18261943
    1827 itcl::body Rappture::VtkViewer::BuildPolydataTab {} {
     1944itcl::body Rappture::VtkViewer::BuildGlyphsTab {} {
    18281945
    18291946    set fg [option get $itk_component(hull) font Font]
    18301947    #set bfg [option get $itk_component(hull) boldFont Font]
    18311948
    1832     set inner [$itk_component(main) insert end \
     1949    set inner [$itk_component(main) insert 0 \
     1950        -title "Glyph Settings" \
     1951        -icon [Rappture::icon volume-on]]
     1952    $inner configure -borderwidth 4
     1953
     1954    checkbutton $inner.glyphs \
     1955        -text "Show Glyphs" \
     1956        -variable [itcl::scope _settings(glyphs-visible)] \
     1957        -command [itcl::code $this AdjustSetting glyphs-visible] \
     1958        -font "Arial 9" -anchor w
     1959
     1960    checkbutton $inner.outline \
     1961        -text "Show Outline" \
     1962        -variable [itcl::scope _settings(glyphs-outline)] \
     1963        -command [itcl::code $this AdjustSetting glyphs-outline] \
     1964        -font "Arial 9" -anchor w
     1965
     1966    checkbutton $inner.wireframe \
     1967        -text "Show Wireframe" \
     1968        -variable [itcl::scope _settings(glyphs-wireframe)] \
     1969        -command [itcl::code $this AdjustSetting glyphs-wireframe] \
     1970        -font "Arial 9" -anchor w
     1971
     1972    checkbutton $inner.lighting \
     1973        -text "Enable Lighting" \
     1974        -variable [itcl::scope _settings(glyphs-lighting)] \
     1975        -command [itcl::code $this AdjustSetting glyphs-lighting] \
     1976        -font "Arial 9" -anchor w
     1977
     1978    checkbutton $inner.edges \
     1979        -text "Show Edges" \
     1980        -variable [itcl::scope _settings(glyphs-edges)] \
     1981        -command [itcl::code $this AdjustSetting glyphs-edges] \
     1982        -font "Arial 9" -anchor w
     1983
     1984    label $inner.palette_l -text "Palette" -font "Arial 9" -anchor w
     1985    itk_component add glyphspalette {
     1986        Rappture::Combobox $inner.palette -width 10 -editable no
     1987    }
     1988    $inner.palette choices insert end [GetColormapList]
     1989    $itk_component(glyphspalette) value "BCGYR"
     1990    bind $inner.palette <<Value>> \
     1991        [itcl::code $this AdjustSetting glyphs-palette]
     1992
     1993    label $inner.opacity_l -text "Opacity" -font "Arial 9" -anchor w
     1994    ::scale $inner.opacity -from 0 -to 100 -orient horizontal \
     1995        -variable [itcl::scope _settings(glyphs-opacity)] \
     1996        -width 10 \
     1997        -showvalue off \
     1998        -command [itcl::code $this AdjustSetting glyphs-opacity]
     1999    $inner.opacity set $_settings(glyphs-opacity)
     2000
     2001    blt::table $inner \
     2002        0,0 $inner.glyphs    -cspan 2  -anchor w -pady 2 \
     2003        1,0 $inner.outline   -cspan 2  -anchor w -pady 2 \
     2004        2,0 $inner.wireframe -cspan 2  -anchor w -pady 2 \
     2005        3,0 $inner.lighting  -cspan 2  -anchor w -pady 2 \
     2006        4,0 $inner.edges     -cspan 2  -anchor w -pady 2 \
     2007        5,0 $inner.opacity_l -anchor w -pady 2 \
     2008        5,1 $inner.opacity   -fill x   -pady 2 \
     2009        6,0 $inner.palette_l -anchor w -pady 2 \
     2010        6,1 $inner.palette   -fill x   -pady 2 
     2011
     2012    blt::table configure $inner r* c* -resize none
     2013    blt::table configure $inner r8 c1 -resize expand
     2014}
     2015
     2016itcl::body Rappture::VtkViewer::BuildPolydataTab {} {
     2017
     2018    set fg [option get $itk_component(hull) font Font]
     2019    #set bfg [option get $itk_component(hull) boldFont Font]
     2020
     2021    set inner [$itk_component(main) insert 0 \
    18332022        -title "Mesh Settings" \
    18342023        -icon [Rappture::icon mesh]]
     
    18412030        -font "Arial 9" -anchor w
    18422031
     2032    checkbutton $inner.outline \
     2033        -text "Show Outline" \
     2034        -variable [itcl::scope _settings(polydata-outline)] \
     2035        -command [itcl::code $this AdjustSetting polydata-outline] \
     2036        -font "Arial 9" -anchor w
     2037
    18432038    checkbutton $inner.wireframe \
    18442039        -text "Show Wireframe" \
     
    18632058        Rappture::Combobox $inner.palette -width 10 -editable no
    18642059    }
    1865 
    18662060    $inner.palette choices insert end [GetColormapList]
    18672061    $itk_component(meshpalette) value "BCGYR"
     
    18792073    blt::table $inner \
    18802074        0,0 $inner.mesh      -cspan 2  -anchor w -pady 2 \
    1881         1,0 $inner.wireframe -cspan 2  -anchor w -pady 2 \
    1882         2,0 $inner.lighting  -cspan 2  -anchor w -pady 2 \
    1883         3,0 $inner.edges     -cspan 2  -anchor w -pady 2 \
    1884         4,0 $inner.opacity_l -anchor w -pady 2 \
    1885         4,1 $inner.opacity   -fill x   -pady 2 \
    1886         5,0 $inner.palette_l -anchor w -pady 2 \
    1887         5,1 $inner.palette   -fill x   -pady 2 
     2075        1,0 $inner.outline   -cspan 2  -anchor w -pady 2 \
     2076        2,0 $inner.wireframe -cspan 2  -anchor w -pady 2 \
     2077        3,0 $inner.lighting  -cspan 2  -anchor w -pady 2 \
     2078        4,0 $inner.edges     -cspan 2  -anchor w -pady 2 \
     2079        5,0 $inner.opacity_l -anchor w -pady 2 \
     2080        5,1 $inner.opacity   -fill x   -pady 2 \
     2081        6,0 $inner.palette_l -anchor w -pady 2 \
     2082        6,1 $inner.palette   -fill x   -pady 2 
    18882083
    18892084    blt::table configure $inner r* c* -resize none
    1890     blt::table configure $inner r7 c1 -resize expand
     2085    blt::table configure $inner r8 c1 -resize expand
    18912086}
    18922087
     
    19372132        "static_triad"    "static" \
    19382133        "closest_triad"   "closest" \
    1939         "furthest_triad"  "furthest" \
     2134        "furthest_triad"  "farthest" \
    19402135        "outer_edges"     "outer"         
    19412136    $itk_component(axismode) value "static"
     
    21162311    $itk_component(zCutScale) set 100
    21172312    $itk_component(zCutScale) configure -state disabled
    2118     #$itk_component(zCutScale) configure -state disabled
    21192313    Rappture::Tooltip::for $itk_component(zCutScale) \
    21202314        "@[itcl::code $this Slice tooltip z]"
     
    21482342    set fg [option get $itk_component(hull) font Font]
    21492343
    2150     set inner [$itk_component(main) insert end \
     2344    set inner [$itk_component(main) insert 0 \
    21512345        -title "Molecule Settings" \
    21522346        -icon [Rappture::icon molecule]]
     
    21572351        -variable [itcl::scope _settings(molecule-visible)] \
    21582352        -command [itcl::code $this AdjustSetting molecule-visible] \
     2353        -font "Arial 9"
     2354
     2355    checkbutton $inner.outline \
     2356        -text "Show Outline" \
     2357        -variable [itcl::scope _settings(molecule-outline)] \
     2358        -command [itcl::code $this AdjustSetting molecule-outline] \
    21592359        -font "Arial 9"
    21602360
     
    22212421        Rappture::Combobox $inner.palette -width 10 -editable no
    22222422    }
    2223 
    22242423    $inner.palette choices insert end [GetColormapList -includeElementDefault]
    22252424    $itk_component(moleculepalette) value "elementDefault"
    22262425    bind $inner.palette <<Value>> \
    22272426        [itcl::code $this AdjustSetting molecule-palette]
    2228 
    2229     checkbutton $inner.labels -text "Show labels on atoms" \
    2230         -command [itcl::code $this labels update] \
    2231         -variable [itcl::scope _settings(molecule-labels)] \
    2232         -font "Arial 9"
    2233     Rappture::Tooltip::for $inner.labels \
    2234         "Display atom symbol and serial number."
    2235 
    2236     checkbutton $inner.rock -text "Rock molecule back and forth" \
    2237         -variable [itcl::scope _settings(molecule-rock)] \
    2238         -font "Arial 9"
    2239     Rappture::Tooltip::for $inner.rock \
    2240         "Rotate the object back and forth around the y-axis."
    2241 
    2242     checkbutton $inner.cell -text "Parallelepiped" \
    2243         -font "Arial 9"
    2244     $inner.cell select
    22452427
    22462428    label $inner.atomscale_l -text "Atom Scale" -font "Arial 9"
     
    22832465    blt::table $inner \
    22842466        0,0 $inner.molecule     -anchor w -pady {1 0} \
    2285         1,0 $inner.label        -anchor w -pady {1 0} \
    2286         2,0 $inner.edges        -anchor w -pady {1 0} \
    2287         3,0 $inner.rep_l        -anchor w -pady { 2 0 } \
    2288         4,0 $inner.rep          -fill x    -pady 2 \
    2289         5,0 $inner.rscale_l     -anchor w -pady { 2 0 } \
    2290         6,0 $inner.rscale       -fill x    -pady 2 \
    2291         7,0 $inner.palette_l    -anchor w  -pady 0 \
    2292         8,0 $inner.palette      -fill x    -padx 2 \
    2293         9,0 $inner.atomscale_l  -anchor w -pady {3 0} \
    2294         10,0 $inner.atomscale   -fill x    -padx 2 \
    2295         11,0 $inner.bondscale_l -anchor w -pady {3 0} \
    2296         12,0 $inner.bondscale   -fill x   -padx 2 \
    2297         13,0 $inner.opacity_l   -anchor w -pady {3 0} \
    2298         14,0 $inner.opacity     -fill x    -padx 2 \
    2299         15,0 $inner.quality_l   -anchor w -pady {3 0} \
    2300         16,0 $inner.quality     -fill x    -padx 2
     2467        1,0 $inner.outline      -anchor w -pady {1 0} \
     2468        2,0 $inner.label        -anchor w -pady {1 0} \
     2469        3,0 $inner.edges        -anchor w -pady {1 0} \
     2470        4,0 $inner.rep_l        -anchor w -pady { 2 0 } \
     2471        5,0 $inner.rep          -fill x    -pady 2 \
     2472        6,0 $inner.rscale_l     -anchor w -pady { 2 0 } \
     2473        7,0 $inner.rscale       -fill x    -pady 2 \
     2474        8,0 $inner.palette_l    -anchor w  -pady 0 \
     2475        9,0 $inner.palette      -fill x    -padx 2 \
     2476        10,0 $inner.atomscale_l  -anchor w -pady {3 0} \
     2477        11,0 $inner.atomscale   -fill x    -padx 2 \
     2478        12,0 $inner.bondscale_l -anchor w -pady {3 0} \
     2479        13,0 $inner.bondscale   -fill x   -padx 2 \
     2480        14,0 $inner.opacity_l   -anchor w -pady {3 0} \
     2481        15,0 $inner.opacity     -fill x    -padx 2 \
     2482        16,0 $inner.quality_l   -anchor w -pady {3 0} \
     2483        17,0 $inner.quality     -fill x    -padx 2
    23012484   
    23022485    blt::table configure $inner r* -resize none
    2303     blt::table configure $inner r17 -resize expand
     2486    blt::table configure $inner r18 -resize expand
    23042487}
    23052488
     
    24172600        "glyphs" {
    24182601            array set settings {
    2419                 -color \#FFFFFF
     2602                -color white
     2603                -edgecolor black
     2604                -edges 0
    24202605                -gscale 1
    2421                 -edges 0
    2422                 -edgecolor black
     2606                -lighting 1
    24232607                -linewidth 1.0
     2608                -normscale 0
    24242609                -opacity 1.0
     2610                -orientGlyphs 0
     2611                -outline 0
     2612                -ptsize 1.0
     2613                -quality 1
     2614                -scaleMode "vcomp"
     2615                -shape "sphere"
     2616                -visible 1
    24252617                -wireframe 0
    2426                 -lighting 1
    2427                 -visible 1
    2428             }
     2618            }
     2619            array set settings $style
    24292620            set shape [$dataobj shape $comp]
    2430             array set settings $style
    2431             SendCmd "glyphs add $shape $tag"
    2432             SendCmd "glyphs normscale 0 $tag"
     2621            if {$shape != ""} {
     2622                set settings(-shape) $shape
     2623            }
     2624            SendCmd "outline add $tag"
     2625            SendCmd "outline color [Color2RGB $settings(-color)] $tag"
     2626            SendCmd "outline visible $settings(-outline) $tag"
     2627            set _settings(glyphs-outline) $settings(-outline)
     2628
     2629            SendCmd "glyphs add $settings(-shape) $tag"
     2630            SendCmd "glyphs normscale $settings(-normscale) $tag"
    24332631            SendCmd "glyphs gscale $settings(-gscale) $tag"
    24342632            SendCmd "glyphs wireframe $settings(-wireframe) $tag"
    24352633            SendCmd "glyphs color [Color2RGB $settings(-color)] $tag"
    24362634            #SendCmd "glyphs colormode constant {} $tag"
    2437             SendCmd "glyphs gorient 0 {} $tag"
    2438             SendCmd "glyphs smode vcomp {} $tag"
     2635            # Omitting field name for gorient and smode commands
     2636            # defaults to active scalars or vectors depending on mode
     2637            SendCmd "glyphs gorient $settings(-orientGlyphs) {} $tag"
     2638            SendCmd "glyphs smode $settings(-scaleMode) {} $tag"
     2639            SendCmd "glyphs edges $settings(-edges) $tag"
     2640            SendCmd "glyphs linecolor [Color2RGB $settings(-edgecolor)] $tag"
     2641            SendCmd "glyphs linewidth $settings(-linewidth) $tag"
     2642            SendCmd "glyphs ptsize $settings(-ptsize) $tag"
     2643            SendCmd "glyphs quality $settings(-quality) $tag"
     2644            SendCmd "glyphs lighting $settings(-lighting) $tag"
    24392645            SendCmd "glyphs opacity $settings(-opacity) $tag"
     2646            set _settings(glyphs-opacity) [expr 100.0 * $settings(-opacity)]
    24402647            SendCmd "glyphs visible $settings(-visible) $tag"
    24412648            set _settings(glyphs-wireframe) $settings(-wireframe)
    24422649        }
    24432650        "molecule" {
     2651            array set settings {
     2652                -atomscale 0.3
     2653                -atomsvisible 1
     2654                -bondscale 0.075
     2655                -bondstyle "cylinder"
     2656                -bondsvisible 1
     2657                -edgecolor black
     2658                -edges 0
     2659                -labels 0
     2660                -lighting 1
     2661                -linewidth 1.0
     2662                -opacity 1.0
     2663                -outline 0
     2664                -quality 1.0
     2665                -representation ""
     2666                -rscale "covalent"
     2667                -visible 1
     2668                -wireframe 0
     2669            }
     2670            array set settings $style
     2671
     2672            SendCmd "outline add $tag"
     2673            SendCmd "outline color [Color2RGB white] $tag"
     2674            SendCmd "outline visible $settings(-outline) $tag"
     2675            set _settings(molecule-outline) $settings(-outline)
     2676
    24442677            SendCmd "molecule add $tag"
    2445             SendCmd "molecule ascale $_settings(molecule-atomscale) $tag"
    2446             SendCmd "molecule bscale $_settings(molecule-bondscale) $tag"
    2447             SendCmd "molecule bstyle $_settings(molecule-bondstyle) $tag"
    2448             SendCmd "molecule atoms $_settings(molecule-atoms-visible) $tag"
    2449             SendCmd "molecule bonds $_settings(molecule-bonds-visible) $tag"
     2678            if {$settings(-representation) != ""} {
     2679                switch -- $settings(-representation) {
     2680                    "ballandstick" {
     2681                        set _settings(molecule-rscale) covalent
     2682                        set _settings(molecule-atoms-visible) 1
     2683                        set _settings(molecule-bonds-visible) 1
     2684                        set _settings(molecule-bondstyle) cylinder
     2685                        set _settings(molecule-atomscale) 0.3
     2686                        set _settings(molecule-bondscale) 0.075
     2687                    }
     2688                    "balls" - "spheres" {
     2689                        set _settings(molecule-rscale) covalent
     2690                        set _settings(molecule-atoms-visible) 1
     2691                        set _settings(molecule-bonds-visible) 0
     2692                        set _settings(molecule-bondstyle) cylinder
     2693                        set _settings(molecule-atomscale) 0.3
     2694                        set _settings(molecule-bondscale) 0.075
     2695                    }
     2696                    "sticks" {
     2697                        set _settings(molecule-rscale) none
     2698                        set _settings(molecule-atoms-visible) 1
     2699                        set _settings(molecule-bonds-visible) 1
     2700                        set _settings(molecule-bondstyle) cylinder
     2701                        set _settings(molecule-atomscale) 0.075
     2702                        set _settings(molecule-bondscale) 0.075
     2703                    }
     2704                    "spacefilling" {
     2705                        set _settings(molecule-rscale) van_der_waals
     2706                        set _settings(molecule-atoms-visible) 1
     2707                        set _settings(molecule-bonds-visible) 0
     2708                        set _settings(molecule-bondstyle) cylinder
     2709                        set _settings(molecule-atomscale) 1.0
     2710                        set _settings(molecule-bondscale) 0.075
     2711                    }
     2712                    "rods"  {
     2713                        set _settings(molecule-rscale) none
     2714                        set _settings(molecule-atoms-visible) 1
     2715                        set _settings(molecule-bonds-visible) 1
     2716                        set _settings(molecule-bondstyle) cylinder
     2717                        set _settings(molecule-atomscale) 0.1
     2718                        set _settings(molecule-bondscale) 0.1
     2719                    }
     2720                    "wireframe" - "lines" {
     2721                        set _settings(molecule-rscale) none
     2722                        set _settings(molecule-atoms-visible) 0
     2723                        set _settings(molecule-bonds-visible) 1
     2724                        set _settings(molecule-bondstyle) line
     2725                        set _settings(molecule-atomscale) 1.0
     2726                        set _settings(molecule-bondscale) 1.0
     2727                    }
     2728                    default {
     2729                        error "unknown representation $value"
     2730                    }
     2731                }
     2732                SendCmd "molecule rscale $_settings(molecule-rscale) $tag"
     2733                SendCmd "molecule atoms $_settings(molecule-atoms-visible) $tag"
     2734                SendCmd "molecule bonds $_settings(molecule-bonds-visible) $tag"
     2735                SendCmd "molecule bstyle $_settings(molecule-bondstyle) $tag"
     2736                SendCmd "molecule ascale $_settings(molecule-atomscale) $tag"
     2737                SendCmd "molecule bscale $_settings(molecule-bondscale) $tag"
     2738                $itk_component(representation) value [$itk_component(representation) label $settings(-representation)]
     2739                $itk_component(rscale) value [$itk_component(rscale) label $_settings(molecule-rscale)]
     2740                switch -- $settings(-representation) {
     2741                    "ballandstick" - "balls" - "spheres" {
     2742                        $itk_component(rscale) configure -state normal
     2743                    }
     2744                    default {
     2745                        $itk_component(rscale) configure -state disabled
     2746                    }
     2747                }
     2748            } else {
     2749                SendCmd "molecule rscale $settings(-rscale) $tag"
     2750                set _settings(molecule-rscale) $settings(-rscale)
     2751                SendCmd "molecule atoms $settings(-atomsvisible) $tag"
     2752                set _settings(molecule-atoms-visible) $settings(-atomsvisible)
     2753                SendCmd "molecule bonds $settings(-bondsvisible) $tag"
     2754                set _settings(molecule-bonds-visible) $settings(-bondsvisible)
     2755                SendCmd "molecule bstyle $settings(-bondstyle) $tag"
     2756                set _settings(molecule-bondstyle) $settings(-bondstyle)
     2757                SendCmd "molecule ascale $settings(-atomscale) $tag"
     2758                set _settings(molecule-atomscale) $settings(-atomscale)
     2759                SendCmd "molecule bscale $settings(-bondscale) $tag"
     2760                set _settings(molecule-bondscale) $settings(-bondscale)
     2761            }
     2762            SendCmd "molecule labels $settings(-labels) $tag"
     2763            set _settings(molecule-labels) $settings(-labels)
     2764            SendCmd "molecule linecolor [Color2RGB $settings(-edgecolor)] $tag"
     2765            SendCmd "molecule linewidth $settings(-linewidth) $tag"
     2766            SendCmd "molecule edges $settings(-edges) $tag"
     2767            set _settings(molecule-edges) $settings(-edges)
     2768            SendCmd "molecule lighting $settings(-lighting) $tag"
     2769            set _settings(molecule-lighting) $settings(-lighting)
     2770            SendCmd "molecule aquality $settings(-quality) $tag"
     2771            SendCmd "molecule bquality $settings(-quality) $tag"
     2772            set _settings(molecule-quality) $settings(-quality)
     2773            SendCmd "molecule visible $settings(-visible) $tag"
     2774            set _settings(molecule-visible) $settings(-visible)
    24502775            set _haveMolecules 1
    24512776        }
    24522777        "polydata" {
    24532778            array set settings {
    2454                 -color \#FFFFFF
     2779                -cloudstyle "mesh"
     2780                -color white
     2781                -edgecolor black
    24552782                -edges 1
    2456                 -edgecolor black
     2783                -lighting 1
    24572784                -linewidth 1.0
    24582785                -opacity 1.0
     2786                -outline 0
     2787                -visible 1
    24592788                -wireframe 0
    2460                 -lighting 1
    2461                 -visible 1
    24622789            }
    24632790            array set settings $style
     2791
     2792            SendCmd "outline add $tag"
     2793            SendCmd "outline color [Color2RGB $settings(-color)] $tag"
     2794            SendCmd "outline visible $settings(-outline) $tag"
     2795            set _settings(polydata-outline) $settings(-outline)
     2796
    24642797            SendCmd "polydata add $tag"
    24652798            SendCmd "polydata visible $settings(-visible) $tag"
     
    24672800            SendCmd "polydata edges $settings(-edges) $tag"
    24682801            set _settings(polydata-edges) $settings(-edges)
     2802            SendCmd "polydata cloudstyle $settings(-cloudstyle) $tag"
    24692803            SendCmd "polydata color [Color2RGB $settings(-color)] $tag"
    24702804            #SendCmd "polydata colormode constant {} $tag"
     
    26272961        "move" {
    26282962            set axis [lindex $args 0]
    2629             set oldval $_axis(${axis}position)
    26302963            set newval [lindex $args 1]
    26312964            if {[llength $args] != 2} {
Note: See TracChangeset for help on using the changeset viewer.