Changeset 4919 for branches/r9/gui/scripts/vtkviewer.tcl
- Timestamp:
- Jan 4, 2015 6:52:23 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/r9/gui/scripts/vtkviewer.tcl
r4344 r4919 57 57 public method get {args} 58 58 public method isconnected {} 59 public method limits { colormap}59 public method limits { dataobj } 60 60 public method parameters {title args} { 61 61 # do nothing … … 69 69 protected method DoRotate {} 70 70 protected method AdjustSetting {what {value ""}} 71 protected method FixSettings { args }71 protected method InitSettings { args } 72 72 protected method Pan {option x y} 73 73 protected method Pick {x y} … … 85 85 private method BuildCutawayTab {} 86 86 private method BuildDownloadPopup { widget command } 87 private method BuildGlyphsTab {} 87 88 private method BuildMoleculeTab {} 88 89 private method BuildPolydataTab {} … … 94 95 private method EventuallySetAtomScale { args } 95 96 private method EventuallySetBondScale { args } 97 private method EventuallySetGlyphsOpacity { args } 96 98 private method EventuallySetMoleculeOpacity { args } 97 99 private method EventuallySetMoleculeQuality { args } … … 107 109 private method SetBondScale {} 108 110 private method SetColormap { dataobj comp } 111 private method SetGlyphsOpacity {} 109 112 private method SetLegendTip { x y } 110 113 private method SetMoleculeOpacity {} … … 208 211 $_dispatcher dispatch $this !polydataOpacity \ 209 212 "[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 210 219 # 211 220 # Populate parser with commands handle incoming requests … … 248 257 visible 1 249 258 labels 1 259 minorticks 1 250 260 }] 251 261 array set _settings [subst { 252 262 legend 1 263 glyphs-edges 0 264 glyphs-lighting 1 253 265 glyphs-opacity 100 266 glyphs-outline 0 267 glyphs-palette BCGYR 268 glyphs-visible 1 254 269 glyphs-wireframe 0 255 270 polydata-edges 0 256 271 polydata-lighting 1 257 272 polydata-opacity 100 258 polydata-palette rainbow 273 polydata-outline 0 274 polydata-palette BCGYR 259 275 polydata-visible 1 260 276 polydata-wireframe 0 … … 268 284 molecule-lighting 1 269 285 molecule-opacity 100 286 molecule-outline 0 270 287 molecule-palette elementDefault 271 288 molecule-quality 1.0 … … 500 517 } 501 518 519 itcl::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 502 529 itcl::body Rappture::VtkViewer::SetPolydataOpacity {} { 503 530 set _polydataOpacityPending 0 … … 542 569 set _polydataOpacityPending 1 543 570 $_dispatcher event -after $_scaleDelay !polydataOpacity 571 } 572 } 573 574 itcl::body Rappture::VtkViewer::EventuallySetGlyphsOpacity { args } { 575 if { !$_glyphsOpacityPending } { 576 set _glyphsOpacityPending 1 577 $_dispatcher event -after $_scaleDelay !glyphsOpacity 544 578 } 545 579 } … … 710 744 } 711 745 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))} { 713 747 set _limits(xmin) $bounds(xmin) 714 748 } 715 if { ![info exists _limits(xmax)] || $_limits(xmax) < $bounds(xmax)} {749 if {[info exists bounds(xmax)] && (![info exists _limits(xmax)] || $_limits(xmax) < $bounds(xmax))} { 716 750 set _limits(xmax) $bounds(xmax) 717 751 } 718 752 719 if { ![info exists _limits(ymin)] || $_limits(ymin) > $bounds(ymin)} {753 if {[info exists bounds(ymin)] && (![info exists _limits(ymin)] || $_limits(ymin) > $bounds(ymin))} { 720 754 set _limits(ymin) $bounds(ymin) 721 755 } 722 if { ![info exists _limits(ymax)] || $_limits(ymax) < $bounds(ymax)} {756 if {[info exists bounds(ymax)] && (![info exists _limits(ymax)] || $_limits(ymax) < $bounds(ymax))} { 723 757 set _limits(ymax) $bounds(ymax) 724 758 } 725 759 726 if { ![info exists _limits(zmin)] || $_limits(zmin) > $bounds(zmin)} {760 if {[info exists bounds(zmin)] && (![info exists _limits(zmin)] || $_limits(zmin) > $bounds(zmin))} { 727 761 set _limits(zmin) $bounds(zmin) 728 762 } 729 if { ![info exists _limits(zmax)] || $_limits(zmax) < $bounds(zmax)} {763 if {[info exists bounds(zmax)] && (![info exists _limits(zmax)] || $_limits(zmax) < $bounds(zmax))} { 730 764 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 } 731 772 } 732 773 } … … 834 875 set session $env(SESSION) 835 876 } 877 lappend info "version" "$Rappture::version" 878 lappend info "build" "$Rappture::build" 879 lappend info "svnurl" "$Rappture::svnurl" 880 lappend info "installdir" "$Rappture::installdir" 836 881 lappend info "hub" [exec hostname] 837 882 lappend info "client" "vtkviewer" … … 987 1032 $_arcball resize $w $h 988 1033 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 996 1037 StopBufferingCommands 997 1038 SendCmd "imgflush" … … 1034 1075 } 1035 1076 lappend _obj2datasets($dataobj) $tag 1077 set type [$dataobj type $comp] 1036 1078 if { [info exists _obj2ovride($dataobj-raise)] } { 1037 SendCmd " datasetvisible 1 $tag"1079 SendCmd "$type visible 1 $tag" 1038 1080 SetOpacity $tag 1039 1081 } … … 1057 1099 } 1058 1100 } 1101 if { $_haveGlyphs } { 1102 InitSettings glyphs-outline 1103 } 1104 if { $_haveMolecules } { 1105 InitSettings molecule-outline 1106 } 1107 if { $_havePolydata } { 1108 InitSettings polydata-outline 1109 } 1059 1110 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 1060 1124 set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)] 1061 1125 $_arcball quaternion $q … … 1072 1136 1073 1137 if { $_haveMolecules } { 1074 # FixSettings molecule-representation1138 #InitSettings molecule-representation 1075 1139 } 1076 1140 set _reset 0 … … 1290 1354 1291 1355 # ---------------------------------------------------------------------- 1292 # USAGE: FixSettings <what> ?<value>?1356 # USAGE: InitSettings <what> ?<value>? 1293 1357 # 1294 1358 # Used internally to update rendering settings whenever parameters … … 1296 1360 # to the back end. 1297 1361 # ---------------------------------------------------------------------- 1298 itcl::body Rappture::VtkViewer:: FixSettings { args } {1362 itcl::body Rappture::VtkViewer::InitSettings { args } { 1299 1363 foreach setting $args { 1300 1364 AdjustSetting $setting … … 1314 1378 } 1315 1379 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 } 1316 1452 "polydata-opacity" { 1317 1453 foreach dataset [CurrentDatasets -visible $_first] { … … 1322 1458 } 1323 1459 } 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 } 1324 1470 "polydata-wireframe" { 1325 set bool $_settings( polydata-wireframe)1471 set bool $_settings($what) 1326 1472 foreach dataset [CurrentDatasets -visible $_first] { 1327 1473 foreach { dataobj comp } [split $dataset -] break … … 1333 1479 } 1334 1480 "polydata-visible" { 1335 set bool $_settings( polydata-visible)1481 set bool $_settings($what) 1336 1482 foreach dataset [CurrentDatasets -visible $_first] { 1337 1483 foreach { dataobj comp } [split $dataset -] break … … 1343 1489 } 1344 1490 "polydata-lighting" { 1345 set bool $_settings( polydata-lighting)1491 set bool $_settings($what) 1346 1492 foreach dataset [CurrentDatasets -visible $_first] { 1347 1493 foreach { dataobj comp } [split $dataset -] break … … 1353 1499 } 1354 1500 "polydata-edges" { 1355 set bool $_settings( polydata-edges)1501 set bool $_settings($what) 1356 1502 foreach dataset [CurrentDatasets -visible $_first] { 1357 1503 foreach { dataobj comp } [split $dataset -] break … … 1364 1510 "polydata-palette" { 1365 1511 set palette [$itk_component(meshpalette) value] 1366 set _settings( polydata-palette) $palette1512 set _settings($what) $palette 1367 1513 foreach dataset [CurrentDatasets -visible $_first] { 1368 1514 foreach {dataobj comp} [split $dataset -] break … … 1377 1523 } 1378 1524 "molecule-opacity" { 1379 set val $_settings(molecule-opacity)1380 set sval [expr { 0.01 * double($val) }]1381 1525 foreach dataset [CurrentDatasets -visible $_first] { 1382 1526 foreach { dataobj comp } [split $dataset -] break … … 1386 1530 } 1387 1531 } 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 } 1388 1542 "molecule-wireframe" { 1389 set bool $_settings( molecule-wireframe)1543 set bool $_settings($what) 1390 1544 foreach dataset [CurrentDatasets -visible $_first] { 1391 1545 foreach { dataobj comp } [split $dataset -] break … … 1397 1551 } 1398 1552 "molecule-visible" { 1399 set bool $_settings( molecule-visible)1553 set bool $_settings($what) 1400 1554 foreach dataset [CurrentDatasets -visible $_first] { 1401 1555 foreach { dataobj comp } [split $dataset -] break … … 1407 1561 } 1408 1562 "molecule-lighting" { 1409 set bool $_settings( molecule-lighting)1563 set bool $_settings($what) 1410 1564 foreach dataset [CurrentDatasets -visible $_first] { 1411 1565 foreach { dataobj comp } [split $dataset -] break … … 1417 1571 } 1418 1572 "molecule-edges" { 1419 set bool $_settings( molecule-edges)1573 set bool $_settings($what) 1420 1574 foreach dataset [CurrentDatasets -visible $_first] { 1421 1575 foreach { dataobj comp } [split $dataset -] break … … 1428 1582 "molecule-palette" { 1429 1583 set palette [$itk_component(moleculepalette) value] 1430 set _ moelculeSettings(palette) $palette1584 set _settings($what) $palette 1431 1585 foreach dataset [CurrentDatasets -visible $_first] { 1432 1586 foreach {dataobj comp} [split $dataset -] break … … 1492 1646 set _settings(molecule-atoms-visible) 0 1493 1647 set _settings(molecule-bonds-visible) 1 1494 set _settings(molecule-bondstyle) cylinder1648 set _settings(molecule-bondstyle) line 1495 1649 set _settings(molecule-atomscale) 1.0 1496 1650 set _settings(molecule-bondscale) 1.0 … … 1525 1679 set value [$itk_component(rscale) value] 1526 1680 set value [$itk_component(rscale) translate $value] 1527 set _settings( molecule-rscale) $value1681 set _settings($what) $value 1528 1682 foreach dataset [CurrentDatasets -visible $_first] { 1529 1683 foreach {dataobj comp} [split $dataset -] break 1530 1684 set type [$dataobj type $comp] 1531 1685 if { $type == "molecule" } { 1532 SendCmd [subst {molecule rscale $_settings( molecule-rscale) $dataset}]1686 SendCmd [subst {molecule rscale $_settings($what) $dataset}] 1533 1687 } 1534 1688 } 1535 1689 } 1536 1690 "molecule-labels" { 1537 set bool $_settings( molecule-labels)1691 set bool $_settings($what) 1538 1692 foreach dataset [CurrentDatasets -visible $_first] { 1539 1693 foreach { dataobj comp } [split $dataset -] break … … 1551 1705 set bool $_axis(labels) 1552 1706 SendCmd "axis labels all $bool" 1707 } 1708 "axis-minorticks" { 1709 set bool $_axis(minorticks) 1710 SendCmd "axis minticks all $bool" 1553 1711 } 1554 1712 "axis-xgrid" { … … 1760 1918 file delete $tmpfile 1761 1919 set output [$reader GetOutput] 1920 if { $output == "" } { 1921 # Invalid VTK file -- loader failed to parse 1922 continue 1923 } 1762 1924 set _limits($tag) [$output GetBounds] 1763 1925 if {$debug} { … … 1818 1980 } 1819 1981 1820 itcl::body Rappture::VtkViewer::Build PolydataTab {} {1982 itcl::body Rappture::VtkViewer::BuildGlyphsTab {} { 1821 1983 1822 1984 set fg [option get $itk_component(hull) font Font] 1823 1985 #set bfg [option get $itk_component(hull) boldFont Font] 1824 1986 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 2054 itcl::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 \ 1826 2060 -title "Mesh Settings" \ 1827 2061 -icon [Rappture::icon mesh]] … … 1834 2068 -font "Arial 9" -anchor w 1835 2069 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 1836 2076 checkbutton $inner.wireframe \ 1837 2077 -text "Show Wireframe" \ … … 1866 2106 -width 10 \ 1867 2107 -showvalue off \ 1868 -command [itcl::code $this AdjustSetting polydata-opacity]2108 -command [itcl::code $this EventuallySetPolydataOpacity] 1869 2109 $inner.opacity set $_settings(polydata-opacity) 1870 2110 1871 2111 blt::table $inner \ 1872 2112 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 1880 2121 1881 2122 blt::table configure $inner r* c* -resize none 1882 blt::table configure $inner r 7c1 -resize expand2123 blt::table configure $inner r8 c1 -resize expand 1883 2124 } 1884 2125 … … 1890 2131 set inner [$itk_component(main) insert end \ 1891 2132 -title "Axis Settings" \ 1892 -icon [Rappture::icon axis 1]]2133 -icon [Rappture::icon axis2]] 1893 2134 $inner configure -borderwidth 4 1894 2135 … … 1920 2161 -command [itcl::code $this AdjustSetting axis-zgrid] \ 1921 2162 -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" 1922 2168 1923 2169 label $inner.mode_l -text "Mode" -font "Arial 9" … … 1935 2181 1936 2182 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 1944 2192 1945 2193 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 1947 2196 } 1948 2197 … … 2139 2388 set fg [option get $itk_component(hull) font Font] 2140 2389 2141 set inner [$itk_component(main) insert end\2390 set inner [$itk_component(main) insert 0 \ 2142 2391 -title "Molecule Settings" \ 2143 2392 -icon [Rappture::icon molecule]] … … 2148 2397 -variable [itcl::scope _settings(molecule-visible)] \ 2149 2398 -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] \ 2150 2405 -font "Arial 9" 2151 2406 … … 2256 2511 blt::table $inner \ 2257 2512 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 2274 2530 2275 2531 blt::table configure $inner r* -resize none 2276 blt::table configure $inner r1 7-resize expand2532 blt::table configure $inner r18 -resize expand 2277 2533 } 2278 2534 … … 2390 2646 "glyphs" { 2391 2647 array set settings { 2392 -color \#FFFFFF2648 -color white 2393 2649 -edgecolor black 2394 2650 -edges 0 … … 2399 2655 -opacity 1.0 2400 2656 -orientGlyphs 0 2657 -outline 0 2401 2658 -ptsize 1.0 2402 2659 -quality 1 … … 2411 2668 set settings(-shape) $shape 2412 2669 } 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 2413 2675 SendCmd "glyphs add $settings(-shape) $tag" 2414 2676 SendCmd "glyphs normscale $settings(-normscale) $tag" … … 2428 2690 SendCmd "glyphs lighting $settings(-lighting) $tag" 2429 2691 SendCmd "glyphs opacity $settings(-opacity) $tag" 2692 set _settings(glyphs-opacity) [expr 100.0 * $settings(-opacity)] 2430 2693 SendCmd "glyphs visible $settings(-visible) $tag" 2431 2694 set _settings(glyphs-wireframe) $settings(-wireframe) 2432 2695 } 2433 2696 "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 2434 2724 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) 2440 2822 set _haveMolecules 1 2441 2823 } … … 2443 2825 array set settings { 2444 2826 -cloudstyle "mesh" 2445 -color \#FFFFFF2827 -color white 2446 2828 -edgecolor black 2447 2829 -edges 1 … … 2449 2831 -linewidth 1.0 2450 2832 -opacity 1.0 2833 -outline 0 2451 2834 -visible 1 2452 2835 -wireframe 0 2453 2836 } 2454 2837 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 2455 2844 SendCmd "polydata add $tag" 2456 2845 SendCmd "polydata visible $settings(-visible) $tag"
Note: See TracChangeset
for help on using the changeset viewer.