Ignore:
Timestamp:
Jan 4, 2015 6:52:23 PM (9 years ago)
Author:
gah
Message:
 
File:
1 edited

Legend:

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

    r4344 r4919  
    5757    public method get {args}
    5858    public method isconnected {}
    59     public method limits { colormap }
     59    public method limits { dataobj }
    6060    public method parameters {title args} {
    6161        # do nothing
     
    6969    protected method DoRotate {}
    7070    protected method AdjustSetting {what {value ""}}
    71     protected method FixSettings { args  }
     71    protected method InitSettings { args  }
    7272    protected method Pan {option x y}
    7373    protected method Pick {x y}
     
    8585    private method BuildCutawayTab {}
    8686    private method BuildDownloadPopup { widget command }
     87    private method BuildGlyphsTab {}
    8788    private method BuildMoleculeTab {}
    8889    private method BuildPolydataTab {}
     
    9495    private method EventuallySetAtomScale { args }
    9596    private method EventuallySetBondScale { args }
     97    private method EventuallySetGlyphsOpacity { args }
    9698    private method EventuallySetMoleculeOpacity { args }
    9799    private method EventuallySetMoleculeQuality { args }
     
    107109    private method SetBondScale {}
    108110    private method SetColormap { dataobj comp }
     111    private method SetGlyphsOpacity {}
    109112    private method SetLegendTip { x y }
    110113    private method SetMoleculeOpacity {}
     
    208211    $_dispatcher dispatch $this !polydataOpacity \
    209212        "[itcl::code $this SetPolydataOpacity]; list"
     213
     214    # Glyphs opacity event
     215    $_dispatcher register !glyphsOpacity
     216    $_dispatcher dispatch $this !glyphsOpacity \
     217        "[itcl::code $this SetGlyphsOpacity]; list"
     218
    210219    #
    211220    # Populate parser with commands handle incoming requests
     
    248257        visible         1
    249258        labels          1
     259        minorticks      1
    250260    }]
    251261    array set _settings [subst {
    252262        legend                  1
     263        glyphs-edges            0
     264        glyphs-lighting         1
    253265        glyphs-opacity          100
     266        glyphs-outline          0
     267        glyphs-palette          BCGYR
     268        glyphs-visible          1
    254269        glyphs-wireframe        0
    255270        polydata-edges          0
    256271        polydata-lighting       1
    257272        polydata-opacity        100
    258         polydata-palette        rainbow
     273        polydata-outline        0
     274        polydata-palette        BCGYR
    259275        polydata-visible        1
    260276        polydata-wireframe      0
     
    268284        molecule-lighting       1
    269285        molecule-opacity        100
     286        molecule-outline        0
    270287        molecule-palette        elementDefault
    271288        molecule-quality        1.0
     
    500517}
    501518
     519itcl::body Rappture::VtkViewer::SetGlyphsOpacity {} {
     520    set _glyphsOpacityPending 0
     521    foreach dataset [CurrentDatasets -visible $_first] {
     522        foreach { dataobj comp } [split $dataset -] break
     523        if { [$dataobj type $comp] == "glyphs" } {
     524            SetOpacity $dataset
     525        }
     526    }
     527}
     528
    502529itcl::body Rappture::VtkViewer::SetPolydataOpacity {} {
    503530    set _polydataOpacityPending 0
     
    542569        set _polydataOpacityPending 1
    543570        $_dispatcher event -after $_scaleDelay !polydataOpacity
     571    }
     572}
     573
     574itcl::body Rappture::VtkViewer::EventuallySetGlyphsOpacity { args } {
     575    if { !$_glyphsOpacityPending } {
     576        set _glyphsOpacityPending 1
     577        $_dispatcher event -after $_scaleDelay !glyphsOpacity
    544578    }
    545579}
     
    710744        }
    711745        array set bounds [limits $dataobj]
    712         if {![info exists _limits(xmin)] || $_limits(xmin) > $bounds(xmin)} {
     746        if {[info exists bounds(xmin)] && (![info exists _limits(xmin)] || $_limits(xmin) > $bounds(xmin))} {
    713747            set _limits(xmin) $bounds(xmin)
    714748        }
    715         if {![info exists _limits(xmax)] || $_limits(xmax) < $bounds(xmax)} {
     749        if {[info exists bounds(xmax)] && (![info exists _limits(xmax)] || $_limits(xmax) < $bounds(xmax))} {
    716750            set _limits(xmax) $bounds(xmax)
    717751        }
    718752
    719         if {![info exists _limits(ymin)] || $_limits(ymin) > $bounds(ymin)} {
     753        if {[info exists bounds(ymin)] && (![info exists _limits(ymin)] || $_limits(ymin) > $bounds(ymin))} {
    720754            set _limits(ymin) $bounds(ymin)
    721755        }
    722         if {![info exists _limits(ymax)] || $_limits(ymax) < $bounds(ymax)} {
     756        if {[info exists bounds(ymax)] && (![info exists _limits(ymax)] || $_limits(ymax) < $bounds(ymax))} {
    723757            set _limits(ymax) $bounds(ymax)
    724758        }
    725759
    726         if {![info exists _limits(zmin)] || $_limits(zmin) > $bounds(zmin)} {
     760        if {[info exists bounds(zmin)] && (![info exists _limits(zmin)] || $_limits(zmin) > $bounds(zmin))} {
    727761            set _limits(zmin) $bounds(zmin)
    728762        }
    729         if {![info exists _limits(zmax)] || $_limits(zmax) < $bounds(zmax)} {
     763        if {[info exists bounds(zmax)] && (![info exists _limits(zmax)] || $_limits(zmax) < $bounds(zmax))} {
    730764            set _limits(zmax) $bounds(zmax)
     765        }
     766    }
     767    if { $_haveGlyphs } {
     768        if { ![$itk_component(main) exists "Glyphs Settings"] } {
     769            if { [catch { BuildGlyphsTab } errs ]  != 0 } {
     770                puts stderr "errs=$errs"
     771            }
    731772        }
    732773    }
     
    834875                set session $env(SESSION)
    835876            }
     877            lappend info "version" "$Rappture::version"
     878            lappend info "build" "$Rappture::build"
     879            lappend info "svnurl" "$Rappture::svnurl"
     880            lappend info "installdir" "$Rappture::installdir"
    836881            lappend info "hub" [exec hostname]
    837882            lappend info "client" "vtkviewer"
     
    9871032        $_arcball resize $w $h
    9881033        DoResize
    989         FixSettings axis-xgrid axis-ygrid axis-zgrid axis-mode \
    990             axis-visible axis-labels
    991 
    992         if { $_havePolydata } {
    993             FixSettings polydata-edges polydata-lighting polydata-opacity \
    994                 polydata-visible polydata-wireframe
    995         }
     1034        InitSettings axis-xgrid axis-ygrid axis-zgrid axis-mode \
     1035            axis-visible axis-labels axis-minorticks
     1036
    9961037        StopBufferingCommands
    9971038        SendCmd "imgflush"
     
    10341075            }
    10351076            lappend _obj2datasets($dataobj) $tag
     1077            set type [$dataobj type $comp]
    10361078            if { [info exists _obj2ovride($dataobj-raise)] } {
    1037                 SendCmd "dataset visible 1 $tag"
     1079                SendCmd "$type visible 1 $tag"
    10381080                SetOpacity $tag
    10391081            }
     
    10571099        }
    10581100    }
     1101    if { $_haveGlyphs } {
     1102        InitSettings glyphs-outline
     1103    }
     1104    if { $_haveMolecules } {
     1105        InitSettings molecule-outline
     1106    }
     1107    if { $_havePolydata } {
     1108        InitSettings polydata-outline
     1109    }
    10591110    if { $_reset } {
     1111        if { $_haveGlyphs } {
     1112            InitSettings glyphs-edges glyphs-lighting glyphs-opacity \
     1113                glyphs-visible glyphs-wireframe
     1114        }
     1115        if { $_havePolydata } {
     1116            InitSettings polydata-edges polydata-lighting polydata-opacity \
     1117                polydata-visible polydata-wireframe
     1118        }
     1119        if { $_haveMolecules } {
     1120            InitSettings molecule-edges molecule-lighting molecule-opacity \
     1121                molecule-visible molecule-wireframe molecule-labels
     1122        }
     1123
    10601124        set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)]
    10611125        $_arcball quaternion $q
     
    10721136
    10731137    if { $_haveMolecules } {
    1074         #FixSettings molecule-representation
     1138        #InitSettings molecule-representation
    10751139    }
    10761140    set _reset 0
     
    12901354
    12911355# ----------------------------------------------------------------------
    1292 # USAGE: FixSettings <what> ?<value>?
     1356# USAGE: InitSettings <what> ?<value>?
    12931357#
    12941358# Used internally to update rendering settings whenever parameters
     
    12961360# to the back end.
    12971361# ----------------------------------------------------------------------
    1298 itcl::body Rappture::VtkViewer::FixSettings { args } {
     1362itcl::body Rappture::VtkViewer::InitSettings { args } {
    12991363    foreach setting $args {
    13001364        AdjustSetting $setting
     
    13141378    }
    13151379    switch -- $what {
     1380        "glyphs-opacity" {
     1381            foreach dataset [CurrentDatasets -visible $_first] {
     1382                foreach { dataobj comp } [split $dataset -] break
     1383                if { [$dataobj type $comp] == "glyphs" } {
     1384                    SetOpacity $dataset
     1385                }
     1386            }
     1387        }
     1388        "glyphs-outline" {
     1389            set bool $_settings($what)
     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 "outline visible $bool $dataset"
     1395                }
     1396            }
     1397        }
     1398        "glyphs-wireframe" {
     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 "$type wireframe $bool $dataset"
     1405                }
     1406            }
     1407        }
     1408        "glyphs-visible" {
     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 visible $bool $dataset"
     1415                }
     1416            }
     1417        }
     1418        "glyphs-lighting" {
     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 lighting $bool $dataset"
     1425                }
     1426            }
     1427        }
     1428        "glyphs-edges" {
     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 edges $bool $dataset"
     1435                }
     1436            }
     1437        }
     1438        "glyphs-palette" {
     1439            set palette [$itk_component(glyphspalette) value]
     1440            set _settings($what) $palette
     1441            foreach dataset [CurrentDatasets -visible $_first] {
     1442                foreach {dataobj comp} [split $dataset -] break
     1443                set type [$dataobj type $comp]
     1444                if { $type == "glyphs" } {
     1445                    ChangeColormap $dataobj $comp $palette
     1446                    # FIXME: fill in current selected fieldname
     1447                    #SendCmd "glyphs colormode scalar {} $dataset"
     1448                }
     1449            }
     1450            set _legendPending 1
     1451        }
    13161452        "polydata-opacity" {
    13171453            foreach dataset [CurrentDatasets -visible $_first] {
     
    13221458            }
    13231459        }
     1460        "polydata-outline" {
     1461            set bool $_settings($what)
     1462            foreach dataset [CurrentDatasets -visible $_first] {
     1463                foreach { dataobj comp } [split $dataset -] break
     1464                set type [$dataobj type $comp]
     1465                if { $type == "polydata" } {
     1466                    SendCmd "outline visible $bool $dataset"
     1467                }
     1468            }
     1469        }
    13241470        "polydata-wireframe" {
    1325             set bool $_settings(polydata-wireframe)
     1471            set bool $_settings($what)
    13261472            foreach dataset [CurrentDatasets -visible $_first] {
    13271473                foreach { dataobj comp } [split $dataset -] break
     
    13331479        }
    13341480        "polydata-visible" {
    1335             set bool $_settings(polydata-visible)
     1481            set bool $_settings($what)
    13361482            foreach dataset [CurrentDatasets -visible $_first] {
    13371483                foreach { dataobj comp } [split $dataset -] break
     
    13431489        }
    13441490        "polydata-lighting" {
    1345             set bool $_settings(polydata-lighting)
     1491            set bool $_settings($what)
    13461492            foreach dataset [CurrentDatasets -visible $_first] {
    13471493                foreach { dataobj comp } [split $dataset -] break
     
    13531499        }
    13541500        "polydata-edges" {
    1355             set bool $_settings(polydata-edges)
     1501            set bool $_settings($what)
    13561502            foreach dataset [CurrentDatasets -visible $_first] {
    13571503                foreach { dataobj comp } [split $dataset -] break
     
    13641510        "polydata-palette" {
    13651511            set palette [$itk_component(meshpalette) value]
    1366             set _settings(polydata-palette) $palette
     1512            set _settings($what) $palette
    13671513            foreach dataset [CurrentDatasets -visible $_first] {
    13681514                foreach {dataobj comp} [split $dataset -] break
     
    13771523        }
    13781524        "molecule-opacity" {
    1379             set val $_settings(molecule-opacity)
    1380             set sval [expr { 0.01 * double($val) }]
    13811525            foreach dataset [CurrentDatasets -visible $_first] {
    13821526                foreach { dataobj comp } [split $dataset -] break
     
    13861530            }
    13871531        }
     1532        "molecule-outline" {
     1533            set bool $_settings($what)
     1534            foreach dataset [CurrentDatasets -visible $_first] {
     1535                foreach { dataobj comp } [split $dataset -] break
     1536                set type [$dataobj type $comp]
     1537                if { $type == "molecule" } {
     1538                    SendCmd "outline visible $bool $dataset"
     1539                }
     1540            }
     1541        }
    13881542        "molecule-wireframe" {
    1389             set bool $_settings(molecule-wireframe)
     1543            set bool $_settings($what)
    13901544            foreach dataset [CurrentDatasets -visible $_first] {
    13911545                foreach { dataobj comp } [split $dataset -] break
     
    13971551        }
    13981552        "molecule-visible" {
    1399             set bool $_settings(molecule-visible)
     1553            set bool $_settings($what)
    14001554            foreach dataset [CurrentDatasets -visible $_first] {
    14011555                foreach { dataobj comp } [split $dataset -] break
     
    14071561        }
    14081562        "molecule-lighting" {
    1409             set bool $_settings(molecule-lighting)
     1563            set bool $_settings($what)
    14101564            foreach dataset [CurrentDatasets -visible $_first] {
    14111565                foreach { dataobj comp } [split $dataset -] break
     
    14171571        }
    14181572        "molecule-edges" {
    1419             set bool $_settings(molecule-edges)
     1573            set bool $_settings($what)
    14201574            foreach dataset [CurrentDatasets -visible $_first] {
    14211575                foreach { dataobj comp } [split $dataset -] break
     
    14281582        "molecule-palette" {
    14291583            set palette [$itk_component(moleculepalette) value]
    1430             set _moelculeSettings(palette) $palette
     1584            set _settings($what) $palette
    14311585            foreach dataset [CurrentDatasets -visible $_first] {
    14321586                foreach {dataobj comp} [split $dataset -] break
     
    14921646                    set _settings(molecule-atoms-visible) 0
    14931647                    set _settings(molecule-bonds-visible) 1
    1494                     set _settings(molecule-bondstyle) cylinder
     1648                    set _settings(molecule-bondstyle) line
    14951649                    set _settings(molecule-atomscale) 1.0
    14961650                    set _settings(molecule-bondscale) 1.0
     
    15251679            set value [$itk_component(rscale) value]
    15261680            set value [$itk_component(rscale) translate $value]
    1527             set _settings(molecule-rscale) $value
     1681            set _settings($what) $value
    15281682            foreach dataset [CurrentDatasets -visible $_first] {
    15291683                foreach {dataobj comp} [split $dataset -] break
    15301684                set type [$dataobj type $comp]
    15311685                if { $type == "molecule" } {
    1532                     SendCmd [subst {molecule rscale $_settings(molecule-rscale) $dataset}]
     1686                    SendCmd [subst {molecule rscale $_settings($what) $dataset}]
    15331687                }
    15341688            }
    15351689        }
    15361690        "molecule-labels" {
    1537             set bool $_settings(molecule-labels)
     1691            set bool $_settings($what)
    15381692            foreach dataset [CurrentDatasets -visible $_first] {
    15391693               foreach { dataobj comp } [split $dataset -] break
     
    15511705            set bool $_axis(labels)
    15521706            SendCmd "axis labels all $bool"
     1707        }
     1708        "axis-minorticks" {
     1709            set bool $_axis(minorticks)
     1710            SendCmd "axis minticks all $bool"
    15531711        }
    15541712        "axis-xgrid" {
     
    17601918            file delete $tmpfile
    17611919            set output [$reader GetOutput]
     1920            if { $output == "" } {
     1921                # Invalid VTK file -- loader failed to parse
     1922                continue
     1923            }
    17621924            set _limits($tag) [$output GetBounds]
    17631925            if {$debug} {
     
    18181980}
    18191981
    1820 itcl::body Rappture::VtkViewer::BuildPolydataTab {} {
     1982itcl::body Rappture::VtkViewer::BuildGlyphsTab {} {
    18211983
    18221984    set fg [option get $itk_component(hull) font Font]
    18231985    #set bfg [option get $itk_component(hull) boldFont Font]
    18241986
    1825     set inner [$itk_component(main) insert end \
     1987    set inner [$itk_component(main) insert 0 \
     1988        -title "Glyph Settings" \
     1989        -icon [Rappture::icon volume-on]]
     1990    $inner configure -borderwidth 4
     1991
     1992    checkbutton $inner.glyphs \
     1993        -text "Show Glyphs" \
     1994        -variable [itcl::scope _settings(glyphs-visible)] \
     1995        -command [itcl::code $this AdjustSetting glyphs-visible] \
     1996        -font "Arial 9" -anchor w
     1997
     1998    checkbutton $inner.outline \
     1999        -text "Show Outline" \
     2000        -variable [itcl::scope _settings(glyphs-outline)] \
     2001        -command [itcl::code $this AdjustSetting glyphs-outline] \
     2002        -font "Arial 9" -anchor w
     2003
     2004    checkbutton $inner.wireframe \
     2005        -text "Show Wireframe" \
     2006        -variable [itcl::scope _settings(glyphs-wireframe)] \
     2007        -command [itcl::code $this AdjustSetting glyphs-wireframe] \
     2008        -font "Arial 9" -anchor w
     2009
     2010    checkbutton $inner.lighting \
     2011        -text "Enable Lighting" \
     2012        -variable [itcl::scope _settings(glyphs-lighting)] \
     2013        -command [itcl::code $this AdjustSetting glyphs-lighting] \
     2014        -font "Arial 9" -anchor w
     2015
     2016    checkbutton $inner.edges \
     2017        -text "Show Edges" \
     2018        -variable [itcl::scope _settings(glyphs-edges)] \
     2019        -command [itcl::code $this AdjustSetting glyphs-edges] \
     2020        -font "Arial 9" -anchor w
     2021
     2022    label $inner.palette_l -text "Palette" -font "Arial 9" -anchor w
     2023    itk_component add glyphspalette {
     2024        Rappture::Combobox $inner.palette -width 10 -editable no
     2025    }
     2026    $inner.palette choices insert end [GetColormapList]
     2027    $itk_component(glyphspalette) value "BCGYR"
     2028    bind $inner.palette <<Value>> \
     2029        [itcl::code $this AdjustSetting glyphs-palette]
     2030
     2031    label $inner.opacity_l -text "Opacity" -font "Arial 9" -anchor w
     2032    ::scale $inner.opacity -from 0 -to 100 -orient horizontal \
     2033        -variable [itcl::scope _settings(glyphs-opacity)] \
     2034        -width 10 \
     2035        -showvalue off \
     2036        -command [itcl::code $this EventuallySetGlyphsOpacity]
     2037    $inner.opacity set $_settings(glyphs-opacity)
     2038
     2039    blt::table $inner \
     2040        0,0 $inner.glyphs    -cspan 2  -anchor w -pady 2 \
     2041        1,0 $inner.outline   -cspan 2  -anchor w -pady 2 \
     2042        2,0 $inner.wireframe -cspan 2  -anchor w -pady 2 \
     2043        3,0 $inner.lighting  -cspan 2  -anchor w -pady 2 \
     2044        4,0 $inner.edges     -cspan 2  -anchor w -pady 2 \
     2045        5,0 $inner.opacity_l -anchor w -pady 2 \
     2046        5,1 $inner.opacity   -fill x   -pady 2 \
     2047        6,0 $inner.palette_l -anchor w -pady 2 \
     2048        6,1 $inner.palette   -fill x   -pady 2 
     2049
     2050    blt::table configure $inner r* c* -resize none
     2051    blt::table configure $inner r8 c1 -resize expand
     2052}
     2053
     2054itcl::body Rappture::VtkViewer::BuildPolydataTab {} {
     2055
     2056    set fg [option get $itk_component(hull) font Font]
     2057    #set bfg [option get $itk_component(hull) boldFont Font]
     2058
     2059    set inner [$itk_component(main) insert 0 \
    18262060        -title "Mesh Settings" \
    18272061        -icon [Rappture::icon mesh]]
     
    18342068        -font "Arial 9" -anchor w
    18352069
     2070    checkbutton $inner.outline \
     2071        -text "Show Outline" \
     2072        -variable [itcl::scope _settings(polydata-outline)] \
     2073        -command [itcl::code $this AdjustSetting polydata-outline] \
     2074        -font "Arial 9" -anchor w
     2075
    18362076    checkbutton $inner.wireframe \
    18372077        -text "Show Wireframe" \
     
    18662106        -width 10 \
    18672107        -showvalue off \
    1868         -command [itcl::code $this AdjustSetting polydata-opacity]
     2108        -command [itcl::code $this EventuallySetPolydataOpacity]
    18692109    $inner.opacity set $_settings(polydata-opacity)
    18702110
    18712111    blt::table $inner \
    18722112        0,0 $inner.mesh      -cspan 2  -anchor w -pady 2 \
    1873         1,0 $inner.wireframe -cspan 2  -anchor w -pady 2 \
    1874         2,0 $inner.lighting  -cspan 2  -anchor w -pady 2 \
    1875         3,0 $inner.edges     -cspan 2  -anchor w -pady 2 \
    1876         4,0 $inner.opacity_l -anchor w -pady 2 \
    1877         4,1 $inner.opacity   -fill x   -pady 2 \
    1878         5,0 $inner.palette_l -anchor w -pady 2 \
    1879         5,1 $inner.palette   -fill x   -pady 2 
     2113        1,0 $inner.outline   -cspan 2  -anchor w -pady 2 \
     2114        2,0 $inner.wireframe -cspan 2  -anchor w -pady 2 \
     2115        3,0 $inner.lighting  -cspan 2  -anchor w -pady 2 \
     2116        4,0 $inner.edges     -cspan 2  -anchor w -pady 2 \
     2117        5,0 $inner.opacity_l -anchor w -pady 2 \
     2118        5,1 $inner.opacity   -fill x   -pady 2 \
     2119        6,0 $inner.palette_l -anchor w -pady 2 \
     2120        6,1 $inner.palette   -fill x   -pady 2 
    18802121
    18812122    blt::table configure $inner r* c* -resize none
    1882     blt::table configure $inner r7 c1 -resize expand
     2123    blt::table configure $inner r8 c1 -resize expand
    18832124}
    18842125
     
    18902131    set inner [$itk_component(main) insert end \
    18912132        -title "Axis Settings" \
    1892         -icon [Rappture::icon axis1]]
     2133        -icon [Rappture::icon axis2]]
    18932134    $inner configure -borderwidth 4
    18942135
     
    19202161        -command [itcl::code $this AdjustSetting axis-zgrid] \
    19212162        -font "Arial 9"
     2163    checkbutton $inner.minorticks \
     2164        -text "Minor Ticks" \
     2165        -variable [itcl::scope _axis(minorticks)] \
     2166        -command [itcl::code $this AdjustSetting axis-minorticks] \
     2167        -font "Arial 9"
    19222168
    19232169    label $inner.mode_l -text "Mode" -font "Arial 9"
     
    19352181
    19362182    blt::table $inner \
    1937         0,0 $inner.visible -anchor w -cspan 2 \
    1938         1,0 $inner.labels  -anchor w -cspan 2 \
    1939         2,0 $inner.gridx   -anchor w -cspan 2 \
    1940         3,0 $inner.gridy   -anchor w -cspan 2 \
    1941         4,0 $inner.gridz   -anchor w -cspan 2 \
    1942         5,0 $inner.mode_l  -anchor w -cspan 2 -padx { 2 0 } \
    1943         6,0 $inner.mode    -fill x   -cspan 2
     2183        0,0 $inner.visible -anchor w -cspan 4 \
     2184        1,0 $inner.labels  -anchor w -cspan 4 \
     2185        2,0 $inner.minorticks  -anchor w -cspan 4 \
     2186        4,0 $inner.grid_l  -anchor w \
     2187        4,1 $inner.xgrid   -anchor w \
     2188        4,2 $inner.ygrid   -anchor w \
     2189        4,3 $inner.zgrid   -anchor w \
     2190        5,0 $inner.mode_l  -anchor w -padx { 2 0 } \
     2191        5,1 $inner.mode    -fill x   -cspan 3
    19442192
    19452193    blt::table configure $inner r* c* -resize none
    1946     blt::table configure $inner r7 c1 -resize expand
     2194    blt::table configure $inner r7 c6 -resize expand
     2195    blt::table configure $inner r3 -height 0.125i
    19472196}
    19482197
     
    21392388    set fg [option get $itk_component(hull) font Font]
    21402389
    2141     set inner [$itk_component(main) insert end \
     2390    set inner [$itk_component(main) insert 0 \
    21422391        -title "Molecule Settings" \
    21432392        -icon [Rappture::icon molecule]]
     
    21482397        -variable [itcl::scope _settings(molecule-visible)] \
    21492398        -command [itcl::code $this AdjustSetting molecule-visible] \
     2399        -font "Arial 9"
     2400
     2401    checkbutton $inner.outline \
     2402        -text "Show Outline" \
     2403        -variable [itcl::scope _settings(molecule-outline)] \
     2404        -command [itcl::code $this AdjustSetting molecule-outline] \
    21502405        -font "Arial 9"
    21512406
     
    22562511    blt::table $inner \
    22572512        0,0 $inner.molecule     -anchor w -pady {1 0} \
    2258         1,0 $inner.label        -anchor w -pady {1 0} \
    2259         2,0 $inner.edges        -anchor w -pady {1 0} \
    2260         3,0 $inner.rep_l        -anchor w -pady { 2 0 } \
    2261         4,0 $inner.rep          -fill x    -pady 2 \
    2262         5,0 $inner.rscale_l     -anchor w -pady { 2 0 } \
    2263         6,0 $inner.rscale       -fill x    -pady 2 \
    2264         7,0 $inner.palette_l    -anchor w  -pady 0 \
    2265         8,0 $inner.palette      -fill x    -padx 2 \
    2266         9,0 $inner.atomscale_l  -anchor w -pady {3 0} \
    2267         10,0 $inner.atomscale   -fill x    -padx 2 \
    2268         11,0 $inner.bondscale_l -anchor w -pady {3 0} \
    2269         12,0 $inner.bondscale   -fill x   -padx 2 \
    2270         13,0 $inner.opacity_l   -anchor w -pady {3 0} \
    2271         14,0 $inner.opacity     -fill x    -padx 2 \
    2272         15,0 $inner.quality_l   -anchor w -pady {3 0} \
    2273         16,0 $inner.quality     -fill x    -padx 2
     2513        1,0 $inner.outline      -anchor w -pady {1 0} \
     2514        2,0 $inner.label        -anchor w -pady {1 0} \
     2515        3,0 $inner.edges        -anchor w -pady {1 0} \
     2516        4,0 $inner.rep_l        -anchor w -pady { 2 0 } \
     2517        5,0 $inner.rep          -fill x    -pady 2 \
     2518        6,0 $inner.rscale_l     -anchor w -pady { 2 0 } \
     2519        7,0 $inner.rscale       -fill x    -pady 2 \
     2520        8,0 $inner.palette_l    -anchor w  -pady 0 \
     2521        9,0 $inner.palette      -fill x    -padx 2 \
     2522        10,0 $inner.atomscale_l  -anchor w -pady {3 0} \
     2523        11,0 $inner.atomscale   -fill x    -padx 2 \
     2524        12,0 $inner.bondscale_l -anchor w -pady {3 0} \
     2525        13,0 $inner.bondscale   -fill x   -padx 2 \
     2526        14,0 $inner.opacity_l   -anchor w -pady {3 0} \
     2527        15,0 $inner.opacity     -fill x    -padx 2 \
     2528        16,0 $inner.quality_l   -anchor w -pady {3 0} \
     2529        17,0 $inner.quality     -fill x    -padx 2
    22742530   
    22752531    blt::table configure $inner r* -resize none
    2276     blt::table configure $inner r17 -resize expand
     2532    blt::table configure $inner r18 -resize expand
    22772533}
    22782534
     
    23902646        "glyphs" {
    23912647            array set settings {
    2392                 -color \#FFFFFF
     2648                -color white
    23932649                -edgecolor black
    23942650                -edges 0
     
    23992655                -opacity 1.0
    24002656                -orientGlyphs 0
     2657                -outline 0
    24012658                -ptsize 1.0
    24022659                -quality 1
     
    24112668                set settings(-shape) $shape
    24122669            }
     2670            SendCmd "outline add $tag"
     2671            SendCmd "outline color [Color2RGB $settings(-color)] $tag"
     2672            SendCmd "outline visible $settings(-outline) $tag"
     2673            set _settings(glyphs-outline) $settings(-outline)
     2674
    24132675            SendCmd "glyphs add $settings(-shape) $tag"
    24142676            SendCmd "glyphs normscale $settings(-normscale) $tag"
     
    24282690            SendCmd "glyphs lighting $settings(-lighting) $tag"
    24292691            SendCmd "glyphs opacity $settings(-opacity) $tag"
     2692            set _settings(glyphs-opacity) [expr 100.0 * $settings(-opacity)]
    24302693            SendCmd "glyphs visible $settings(-visible) $tag"
    24312694            set _settings(glyphs-wireframe) $settings(-wireframe)
    24322695        }
    24332696        "molecule" {
     2697            array set settings {
     2698                -atomscale 0.3
     2699                -atomsvisible 1
     2700                -bondscale 0.075
     2701                -bondstyle "cylinder"
     2702                -bondsvisible 1
     2703                -color "elementDefault"
     2704                -edgecolor black
     2705                -edges 0
     2706                -labels 0
     2707                -lighting 1
     2708                -linewidth 1.0
     2709                -opacity 1.0
     2710                -outline 0
     2711                -quality 1.0
     2712                -representation ""
     2713                -rscale "covalent"
     2714                -visible 1
     2715                -wireframe 0
     2716            }
     2717            array set settings $style
     2718
     2719            SendCmd "outline add $tag"
     2720            SendCmd "outline color [Color2RGB white] $tag"
     2721            SendCmd "outline visible $settings(-outline) $tag"
     2722            set _settings(molecule-outline) $settings(-outline)
     2723
    24342724            SendCmd "molecule add $tag"
    2435             SendCmd "molecule ascale $_settings(molecule-atomscale) $tag"
    2436             SendCmd "molecule bscale $_settings(molecule-bondscale) $tag"
    2437             SendCmd "molecule bstyle $_settings(molecule-bondstyle) $tag"
    2438             SendCmd "molecule atoms $_settings(molecule-atoms-visible) $tag"
    2439             SendCmd "molecule bonds $_settings(molecule-bonds-visible) $tag"
     2725            if {$settings(-representation) != ""} {
     2726                switch -- $settings(-representation) {
     2727                    "ballandstick" {
     2728                        set _settings(molecule-rscale) covalent
     2729                        set _settings(molecule-atoms-visible) 1
     2730                        set _settings(molecule-bonds-visible) 1
     2731                        set _settings(molecule-bondstyle) cylinder
     2732                        set _settings(molecule-atomscale) 0.3
     2733                        set _settings(molecule-bondscale) 0.075
     2734                    }
     2735                    "balls" - "spheres" {
     2736                        set _settings(molecule-rscale) covalent
     2737                        set _settings(molecule-atoms-visible) 1
     2738                        set _settings(molecule-bonds-visible) 0
     2739                        set _settings(molecule-bondstyle) cylinder
     2740                        set _settings(molecule-atomscale) 0.3
     2741                        set _settings(molecule-bondscale) 0.075
     2742                    }
     2743                    "sticks" {
     2744                        set _settings(molecule-rscale) none
     2745                        set _settings(molecule-atoms-visible) 1
     2746                        set _settings(molecule-bonds-visible) 1
     2747                        set _settings(molecule-bondstyle) cylinder
     2748                        set _settings(molecule-atomscale) 0.075
     2749                        set _settings(molecule-bondscale) 0.075
     2750                    }
     2751                    "spacefilling" {
     2752                        set _settings(molecule-rscale) van_der_waals
     2753                        set _settings(molecule-atoms-visible) 1
     2754                        set _settings(molecule-bonds-visible) 0
     2755                        set _settings(molecule-bondstyle) cylinder
     2756                        set _settings(molecule-atomscale) 1.0
     2757                        set _settings(molecule-bondscale) 0.075
     2758                    }
     2759                    "rods"  {
     2760                        set _settings(molecule-rscale) none
     2761                        set _settings(molecule-atoms-visible) 1
     2762                        set _settings(molecule-bonds-visible) 1
     2763                        set _settings(molecule-bondstyle) cylinder
     2764                        set _settings(molecule-atomscale) 0.1
     2765                        set _settings(molecule-bondscale) 0.1
     2766                    }
     2767                    "wireframe" - "lines" {
     2768                        set _settings(molecule-rscale) none
     2769                        set _settings(molecule-atoms-visible) 0
     2770                        set _settings(molecule-bonds-visible) 1
     2771                        set _settings(molecule-bondstyle) line
     2772                        set _settings(molecule-atomscale) 1.0
     2773                        set _settings(molecule-bondscale) 1.0
     2774                    }
     2775                    default {
     2776                        error "unknown representation $value"
     2777                    }
     2778                }
     2779                SendCmd "molecule rscale $_settings(molecule-rscale) $tag"
     2780                SendCmd "molecule atoms $_settings(molecule-atoms-visible) $tag"
     2781                SendCmd "molecule bonds $_settings(molecule-bonds-visible) $tag"
     2782                SendCmd "molecule bstyle $_settings(molecule-bondstyle) $tag"
     2783                SendCmd "molecule ascale $_settings(molecule-atomscale) $tag"
     2784                SendCmd "molecule bscale $_settings(molecule-bondscale) $tag"
     2785                $itk_component(representation) value [$itk_component(representation) label $settings(-representation)]
     2786                $itk_component(rscale) value [$itk_component(rscale) label $_settings(molecule-rscale)]
     2787                switch -- $settings(-representation) {
     2788                    "ballandstick" - "balls" - "spheres" {
     2789                        $itk_component(rscale) configure -state normal
     2790                    }
     2791                    default {
     2792                        $itk_component(rscale) configure -state disabled
     2793                    }
     2794                }
     2795            } else {
     2796                SendCmd "molecule rscale $settings(-rscale) $tag"
     2797                set _settings(molecule-rscale) $settings(-rscale)
     2798                SendCmd "molecule atoms $settings(-atomsvisible) $tag"
     2799                set _settings(molecule-atoms-visible) $settings(-atomsvisible)
     2800                SendCmd "molecule bonds $settings(-bondsvisible) $tag"
     2801                set _settings(molecule-bonds-visible) $settings(-bondsvisible)
     2802                SendCmd "molecule bstyle $settings(-bondstyle) $tag"
     2803                set _settings(molecule-bondstyle) $settings(-bondstyle)
     2804                SendCmd "molecule ascale $settings(-atomscale) $tag"
     2805                set _settings(molecule-atomscale) $settings(-atomscale)
     2806                SendCmd "molecule bscale $settings(-bondscale) $tag"
     2807                set _settings(molecule-bondscale) $settings(-bondscale)
     2808            }
     2809            SendCmd "molecule labels $settings(-labels) $tag"
     2810            set _settings(molecule-labels) $settings(-labels)
     2811            SendCmd "molecule linecolor [Color2RGB $settings(-edgecolor)] $tag"
     2812            SendCmd "molecule linewidth $settings(-linewidth) $tag"
     2813            SendCmd "molecule edges $settings(-edges) $tag"
     2814            set _settings(molecule-edges) $settings(-edges)
     2815            SendCmd "molecule lighting $settings(-lighting) $tag"
     2816            set _settings(molecule-lighting) $settings(-lighting)
     2817            SendCmd "molecule aquality $settings(-quality) $tag"
     2818            SendCmd "molecule bquality $settings(-quality) $tag"
     2819            set _settings(molecule-quality) $settings(-quality)
     2820            SendCmd "molecule visible $settings(-visible) $tag"
     2821            set _settings(molecule-visible) $settings(-visible)
    24402822            set _haveMolecules 1
    24412823        }
     
    24432825            array set settings {
    24442826                -cloudstyle "mesh"
    2445                 -color \#FFFFFF
     2827                -color white
    24462828                -edgecolor black
    24472829                -edges 1
     
    24492831                -linewidth 1.0
    24502832                -opacity 1.0
     2833                -outline 0
    24512834                -visible 1
    24522835                -wireframe 0
    24532836            }
    24542837            array set settings $style
     2838
     2839            SendCmd "outline add $tag"
     2840            SendCmd "outline color [Color2RGB $settings(-color)] $tag"
     2841            SendCmd "outline visible $settings(-outline) $tag"
     2842            set _settings(polydata-outline) $settings(-outline)
     2843
    24552844            SendCmd "polydata add $tag"
    24562845            SendCmd "polydata visible $settings(-visible) $tag"
Note: See TracChangeset for help on using the changeset viewer.