Changeset 3794


Ignore:
Timestamp:
Jul 12, 2013 11:18:58 PM (10 years ago)
Author:
ldelgass
Message:

Add atom radii setting to molecule viewer, tweak atom/bond scale slider ranges,
fix polydata/glyph opacity

File:
1 edited

Legend:

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

    r3793 r3794  
    259259    array set _settings [subst {
    260260        legend                  1
     261        glyphs-opacity          100
     262        glyphs-wireframe        0
    261263        polydata-edges          0
    262264        polydata-lighting       1
    263         polydata-opacity        40
     265        polydata-opacity        100
    264266        polydata-palette        rainbow
    265267        polydata-visible        1
    266268        polydata-wireframe      0
    267         molecule-atomscale      1.0
    268         molecule-bondscale      1.0
     269        molecule-atomscale      0.3
     270        molecule-bondscale      0.075
    269271        molecule-atoms-visible  1
    270272        molecule-bonds-visible  1
     
    275277        molecule-palette        elementDefault
    276278        molecule-representation "Ball and Stick"
     279        molecule-rscale         "covalent"
    277280        molecule-visible        1
    278281        molecule-wireframe      0
     
    14461449            switch -- $value {
    14471450                "ballandstick" {
    1448                     set rscale covalent
     1451                    set _settings(molecule-rscale) covalent
    14491452                    set _settings(molecule-atoms-visible) 1
    14501453                    set _settings(molecule-bonds-visible) 1
     
    14541457                }
    14551458                "balls" - "spheres" {
    1456                     set rscale covalent
     1459                    set _settings(molecule-rscale) covalent
    14571460                    set _settings(molecule-atoms-visible) 1
    14581461                    set _settings(molecule-bonds-visible) 0
     
    14621465                }
    14631466                "sticks" {
    1464                     set rscale none
     1467                    set _settings(molecule-rscale) none
    14651468                    set _settings(molecule-atoms-visible) 1
    14661469                    set _settings(molecule-bonds-visible) 1
     
    14701473                }
    14711474                "spacefilling" {
    1472                     set rscale van_der_waals
     1475                    set _settings(molecule-rscale) van_der_waals
    14731476                    set _settings(molecule-atoms-visible) 1
    14741477                    set _settings(molecule-bonds-visible) 0
     
    14781481                }
    14791482                "rods"  {
    1480                     set rscale none
     1483                    set _settings(molecule-rscale) none
    14811484                    set _settings(molecule-atoms-visible) 1
    14821485                    set _settings(molecule-bonds-visible) 1
     
    14861489                }
    14871490                "wireframe" - "lines" {
    1488                     set rscale none
     1491                    set _settings(molecule-rscale) none
    14891492                    set _settings(molecule-atoms-visible) 0
    14901493                    set _settings(molecule-bonds-visible) 1
     
    14971500                }
    14981501            }
     1502            $itk_component(rscale) value [$itk_component(rscale) label $_settings(molecule-rscale)]
     1503            switch -- $value {
     1504                "ballandstick" - "balls" - "spheres" {
     1505                    $itk_component(rscale) configure -state normal
     1506                }
     1507                default {
     1508                    $itk_component(rscale) configure -state disabled
     1509                }
     1510            }
    14991511            foreach dataset [CurrentDatasets -visible $_first] {
    15001512                foreach {dataobj comp} [split $dataset -] break
    15011513                set type [$dataobj type $comp]
    15021514                if { $type == "molecule" } {
    1503                     SendCmd [subst {molecule rscale $rscale $dataset
     1515                    SendCmd [subst {molecule rscale $_settings(molecule-rscale) $dataset
    15041516molecule ascale $_settings(molecule-atomscale) $dataset
    15051517molecule bscale $_settings(molecule-bondscale) $dataset
     
    15071519molecule atoms $_settings(molecule-atoms-visible) $dataset
    15081520molecule bonds $_settings(molecule-bonds-visible) $dataset}]
     1521                }
     1522            }
     1523        }
     1524        "molecule-rscale" {
     1525            set value [$itk_component(rscale) value]
     1526            set value [$itk_component(rscale) translate $value]
     1527            set _settings(molecule-rscale) $value
     1528            foreach dataset [CurrentDatasets -visible $_first] {
     1529                foreach {dataobj comp} [split $dataset -] break
     1530                set type [$dataobj type $comp]
     1531                if { $type == "molecule" } {
     1532                    SendCmd [subst {molecule rscale $_settings(molecule-rscale) $dataset}]
    15091533                }
    15101534            }
     
    18651889        -showvalue off \
    18661890        -command [itcl::code $this AdjustSetting polydata-opacity]
     1891    $inner.opacity set $_settings(polydata-opacity)
    18671892
    18681893    blt::table $inner \
     
    21892214        [itcl::code $this AdjustSetting molecule-representation]
    21902215    $inner.rep value "Ball and Stick"
     2216
     2217    label $inner.rscale_l -text "Atom Radii" \
     2218        -font "Arial 9"
     2219
     2220    itk_component add rscale {
     2221        Rappture::Combobox $inner.rscale -width 20 -editable no
     2222    }
     2223    $inner.rscale choices insert end \
     2224        "atomic"        "Atomic"   \
     2225        "covalent"      "Covalent" \
     2226        "van_der_waals" "VDW"      \
     2227        "none"          "Constant"
     2228
     2229    bind $inner.rscale <<Value>> \
     2230        [itcl::code $this AdjustSetting molecule-rscale]
     2231    $inner.rscale value "Covalent"
    21912232
    21922233    label $inner.palette_l -text "Palette" -font "Arial 9"
     
    22362277    label $inner.atomscale_l -text "Atom Scale" -font "Arial 9"
    22372278    ::scale $inner.atomscale -width 15 -font "Arial 7" \
    2238         -from 0.0 -to 2.0 -resolution 0.05 -label "" \
     2279        -from 0.025 -to 2.0 -resolution 0.025 -label "" \
    22392280        -showvalue true -orient horizontal \
    22402281        -command [itcl::code $this EventuallySetAtomScale] \
     
    22422283    $inner.atomscale set $_settings(molecule-atomscale)
    22432284    Rappture::Tooltip::for $inner.atomscale \
    2244         "Adjust scale of atoms (spheres or balls). 1.0 is the default radius."
     2285        "Adjust relative scale of atoms (spheres or balls)."
    22452286
    22462287    label $inner.bondscale_l -text "Bond Scale" -font "Arial 9"
    22472288    ::scale $inner.bondscale -width 15 -font "Arial 7" \
    2248         -from 0.0 -to 1.0 -resolution 0.025 -label "" \
     2289        -from 0.005 -to 0.3 -resolution 0.005 -label "" \
    22492290        -showvalue true -orient horizontal \
    22502291        -command [itcl::code $this EventuallySetBondScale] \
     
    22622303
    22632304    blt::table $inner \
    2264         0,0 $inner.molecule    -anchor w -pady {1 0} \
    2265         1,0 $inner.label       -anchor w -pady {1 0} \
    2266         2,0 $inner.edges       -anchor w -pady {1 0} \
    2267         3,0 $inner.rep_l       -anchor w -pady { 2 0 } \
    2268         4,0 $inner.rep         -fill x    -pady 2 \
    2269         5,0 $inner.palette_l   -anchor w  -pady 0 \
    2270         6,0 $inner.palette     -fill x    -padx 2 \
    2271         7,0 $inner.atomscale_l -anchor w -pady {3 0} \
    2272         8,0 $inner.atomscale   -fill x    -padx 2 \
    2273         9,0 $inner.bondscale_l -anchor w -pady {3 0} \
    2274         10,0 $inner.bondscale  -fill x   -padx 2 \
    2275         11,0 $inner.opacity_l  -anchor w -pady {3 0} \
    2276         12,0 $inner.opacity    -fill x    -padx 2
     2305        0,0 $inner.molecule     -anchor w -pady {1 0} \
     2306        1,0 $inner.label        -anchor w -pady {1 0} \
     2307        2,0 $inner.edges        -anchor w -pady {1 0} \
     2308        3,0 $inner.rep_l        -anchor w -pady { 2 0 } \
     2309        4,0 $inner.rep          -fill x    -pady 2 \
     2310        5,0 $inner.rscale_l     -anchor w -pady { 2 0 } \
     2311        6,0 $inner.rscale       -fill x    -pady 2 \
     2312        7,0 $inner.palette_l    -anchor w  -pady 0 \
     2313        8,0 $inner.palette      -fill x    -padx 2 \
     2314        9,0 $inner.atomscale_l  -anchor w -pady {3 0} \
     2315        10,0 $inner.atomscale   -fill x    -padx 2 \
     2316        11,0 $inner.bondscale_l -anchor w -pady {3 0} \
     2317        12,0 $inner.bondscale   -fill x   -padx 2 \
     2318        13,0 $inner.opacity_l   -anchor w -pady {3 0} \
     2319        14,0 $inner.opacity     -fill x    -padx 2
    22772320   
    22782321    blt::table configure $inner r* -resize none
    2279     blt::table configure $inner r13 -resize expand
     2322    blt::table configure $inner r15 -resize expand
    22802323}
    22812324
     
    24442487            SendCmd "polydata linewidth $settings(-linewidth) $tag"
    24452488            SendCmd "polydata opacity $settings(-opacity) $tag"
    2446             set _settings(polydata-opacity) $settings(-opacity)
     2489            set _settings(polydata-opacity) [expr 100.0 * $settings(-opacity)]
    24472490            SendCmd "polydata wireframe $settings(-wireframe) $tag"
    24482491            set _settings(polydata-wireframe) $settings(-wireframe)
Note: See TracChangeset for help on using the changeset viewer.