- Timestamp:
- Jul 3, 2014, 3:37:04 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/1.3/gui/scripts/vtkviewer.tcl
r4449 r4464 1 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 2 3 2 # ---------------------------------------------------------------------- 4 3 # COMPONENT: vtkviewer - Vtk drawing object viewer … … 8 7 # ====================================================================== 9 8 # AUTHOR: Michael McLennan, Purdue University 10 # Copyright (c) 2004-201 2HUBzero Foundation, LLC9 # Copyright (c) 2004-2014 HUBzero Foundation, LLC 11 10 # 12 11 # See the file "license.terms" for information on usage and … … 70 69 protected method DoRotate {} 71 70 protected method AdjustSetting {what {value ""}} 72 protected method FixSettings { args }71 protected method InitSettings { args } 73 72 protected method Pan {option x y} 74 73 protected method Pick {x y} … … 86 85 private method BuildCutawayTab {} 87 86 private method BuildDownloadPopup { widget command } 87 private method BuildGlyphsTab {} 88 88 private method BuildMoleculeTab {} 89 89 private method BuildPolydataTab {} … … 91 91 private method DrawLegend {} 92 92 private method EnterLegend { x y } 93 private method EventuallyResize { w h } 94 private method EventuallyRotate { q } 93 95 private method EventuallySetAtomScale { args } 94 96 private method EventuallySetBondScale { args } … … 96 98 private method EventuallySetMoleculeQuality { args } 97 99 private method EventuallySetPolydataOpacity { args } 98 private method EventuallyResize { w h }99 private method EventuallyRotate { q }100 100 private method GetImage { args } 101 101 private method GetVtkData { args } … … 157 157 private variable _polydataOpacityPending 0 158 158 private variable _glyphsOpacityPending 0 159 private variable _updatePending 0;160 159 private variable _rotateDelay 150 161 160 private variable _scaleDelay 100 … … 181 180 $_dispatcher register !resize 182 181 $_dispatcher dispatch $this !resize "[itcl::code $this DoResize]; list" 183 184 # Update state event185 $_dispatcher register !update186 $_dispatcher dispatch $this !update "[itcl::code $this DoUpdate]; list"187 182 188 183 # Rotate event … … 257 252 array set _settings [subst { 258 253 legend 1 254 glyphs-edges 0 255 glyphs-lighting 1 259 256 glyphs-opacity 100 257 glyphs-outline 0 258 glyphs-palette BCGYR 259 glyphs-visible 1 260 260 glyphs-wireframe 0 261 261 polydata-edges 0 262 262 polydata-lighting 1 263 263 polydata-opacity 100 264 polydata-palette rainbow 264 polydata-outline 0 265 polydata-palette BCGYR 265 266 polydata-visible 1 266 267 polydata-wireframe 0 … … 274 275 molecule-lighting 1 275 276 molecule-opacity 100 277 molecule-outline 0 276 278 molecule-palette elementDefault 277 279 molecule-quality 1.0 … … 737 739 } 738 740 } 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 } 739 748 if { $_havePolydata } { 740 749 if { ![$itk_component(main) exists "Mesh Settings"] } { … … 993 1002 $_arcball resize $w $h 994 1003 DoResize 995 FixSettings axis-xgrid axis-ygrid axis-zgrid axis-mode \1004 InitSettings axis-xgrid axis-ygrid axis-zgrid axis-mode \ 996 1005 axis-visible axis-labels 997 1006 998 if { $_havePolydata } {999 FixSettings polydata-edges polydata-lighting polydata-opacity \1000 polydata-visible polydata-wireframe1001 }1002 1007 StopBufferingCommands 1003 1008 SendCmd "imgflush" … … 1040 1045 } 1041 1046 lappend _obj2datasets($dataobj) $tag 1047 set type [$dataobj type $comp] 1042 1048 if { [info exists _obj2ovride($dataobj-raise)] } { 1043 SendCmd " datasetvisible 1 $tag"1049 SendCmd "$type visible 1 $tag" 1044 1050 SetOpacity $tag 1045 1051 } … … 1055 1061 set label [$_first hints ${axis}label] 1056 1062 if { $label != "" } { 1057 SendCmd "axis name $axis $label"1063 SendCmd [list axis name $axis $label] 1058 1064 } 1059 1065 set units [$_first hints ${axis}units] 1060 1066 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 1064 1079 } 1065 1080 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 1066 1094 set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)] 1067 1095 $_arcball quaternion $q … … 1078 1106 1079 1107 if { $_haveMolecules } { 1080 # FixSettings molecule-representation1108 #InitSettings molecule-representation 1081 1109 } 1082 1110 set _reset 0 … … 1296 1324 1297 1325 # ---------------------------------------------------------------------- 1298 # USAGE: FixSettings <what> ?<value>?1326 # USAGE: InitSettings <what> ?<value>? 1299 1327 # 1300 1328 # Used internally to update rendering settings whenever parameters … … 1302 1330 # to the back end. 1303 1331 # ---------------------------------------------------------------------- 1304 itcl::body Rappture::VtkViewer:: FixSettings { args } {1332 itcl::body Rappture::VtkViewer::InitSettings { args } { 1305 1333 foreach setting $args { 1306 1334 AdjustSetting $setting … … 1320 1348 } 1321 1349 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 } 1322 1422 "polydata-opacity" { 1323 1423 foreach dataset [CurrentDatasets -visible $_first] { … … 1325 1425 if { [$dataobj type $comp] == "polydata" } { 1326 1426 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" 1327 1437 } 1328 1438 } … … 1383 1493 } 1384 1494 "molecule-opacity" { 1385 set val $_settings(molecule-opacity)1386 set sval [expr { 0.01 * double($val) }]1387 1495 foreach dataset [CurrentDatasets -visible $_first] { 1388 1496 foreach { dataobj comp } [split $dataset -] break 1389 1497 if { [$dataobj type $comp] == "molecule" } { 1390 1498 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" 1391 1509 } 1392 1510 } … … 1434 1552 "molecule-palette" { 1435 1553 set palette [$itk_component(moleculepalette) value] 1436 set _ moelculeSettings(palette) $palette1554 set _settings(molecule-palette) $palette 1437 1555 foreach dataset [CurrentDatasets -visible $_first] { 1438 1556 foreach {dataobj comp} [split $dataset -] break … … 1498 1616 set _settings(molecule-atoms-visible) 0 1499 1617 set _settings(molecule-bonds-visible) 1 1500 set _settings(molecule-bondstyle) cylinder1618 set _settings(molecule-bondstyle) line 1501 1619 set _settings(molecule-atomscale) 1.0 1502 1620 set _settings(molecule-bondscale) 1.0 … … 1613 1731 set font "Arial 8" 1614 1732 set lineht [font metrics $font -linespace] 1615 set c $itk_component(legend)1616 1733 set w 12 1617 1734 set h [expr {$_height - 2 * ($lineht + 2)}] 1618 if { $h < 1 } {1735 if { $h < 1 } { 1619 1736 return 1620 1737 } … … 1825 1942 } 1826 1943 1827 itcl::body Rappture::VtkViewer::Build PolydataTab {} {1944 itcl::body Rappture::VtkViewer::BuildGlyphsTab {} { 1828 1945 1829 1946 set fg [option get $itk_component(hull) font Font] 1830 1947 #set bfg [option get $itk_component(hull) boldFont Font] 1831 1948 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 2016 itcl::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 \ 1833 2022 -title "Mesh Settings" \ 1834 2023 -icon [Rappture::icon mesh]] … … 1841 2030 -font "Arial 9" -anchor w 1842 2031 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 1843 2038 checkbutton $inner.wireframe \ 1844 2039 -text "Show Wireframe" \ … … 1863 2058 Rappture::Combobox $inner.palette -width 10 -editable no 1864 2059 } 1865 1866 2060 $inner.palette choices insert end [GetColormapList] 1867 2061 $itk_component(meshpalette) value "BCGYR" … … 1879 2073 blt::table $inner \ 1880 2074 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 1888 2083 1889 2084 blt::table configure $inner r* c* -resize none 1890 blt::table configure $inner r 7c1 -resize expand2085 blt::table configure $inner r8 c1 -resize expand 1891 2086 } 1892 2087 … … 1937 2132 "static_triad" "static" \ 1938 2133 "closest_triad" "closest" \ 1939 "furthest_triad" "f urthest" \2134 "furthest_triad" "farthest" \ 1940 2135 "outer_edges" "outer" 1941 2136 $itk_component(axismode) value "static" … … 2116 2311 $itk_component(zCutScale) set 100 2117 2312 $itk_component(zCutScale) configure -state disabled 2118 #$itk_component(zCutScale) configure -state disabled2119 2313 Rappture::Tooltip::for $itk_component(zCutScale) \ 2120 2314 "@[itcl::code $this Slice tooltip z]" … … 2148 2342 set fg [option get $itk_component(hull) font Font] 2149 2343 2150 set inner [$itk_component(main) insert end\2344 set inner [$itk_component(main) insert 0 \ 2151 2345 -title "Molecule Settings" \ 2152 2346 -icon [Rappture::icon molecule]] … … 2157 2351 -variable [itcl::scope _settings(molecule-visible)] \ 2158 2352 -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] \ 2159 2359 -font "Arial 9" 2160 2360 … … 2221 2421 Rappture::Combobox $inner.palette -width 10 -editable no 2222 2422 } 2223 2224 2423 $inner.palette choices insert end [GetColormapList -includeElementDefault] 2225 2424 $itk_component(moleculepalette) value "elementDefault" 2226 2425 bind $inner.palette <<Value>> \ 2227 2426 [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 select2245 2427 2246 2428 label $inner.atomscale_l -text "Atom Scale" -font "Arial 9" … … 2283 2465 blt::table $inner \ 2284 2466 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 2301 2484 2302 2485 blt::table configure $inner r* -resize none 2303 blt::table configure $inner r1 7-resize expand2486 blt::table configure $inner r18 -resize expand 2304 2487 } 2305 2488 … … 2417 2600 "glyphs" { 2418 2601 array set settings { 2419 -color \#FFFFFF 2602 -color white 2603 -edgecolor black 2604 -edges 0 2420 2605 -gscale 1 2421 -edges 0 2422 -edgecolor black 2606 -lighting 1 2423 2607 -linewidth 1.0 2608 -normscale 0 2424 2609 -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 2425 2617 -wireframe 0 2426 -lighting 1 2427 -visible 1 2428 } 2618 } 2619 array set settings $style 2429 2620 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" 2433 2631 SendCmd "glyphs gscale $settings(-gscale) $tag" 2434 2632 SendCmd "glyphs wireframe $settings(-wireframe) $tag" 2435 2633 SendCmd "glyphs color [Color2RGB $settings(-color)] $tag" 2436 2634 #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" 2439 2645 SendCmd "glyphs opacity $settings(-opacity) $tag" 2646 set _settings(glyphs-opacity) [expr 100.0 * $settings(-opacity)] 2440 2647 SendCmd "glyphs visible $settings(-visible) $tag" 2441 2648 set _settings(glyphs-wireframe) $settings(-wireframe) 2442 2649 } 2443 2650 "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 2444 2677 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) 2450 2775 set _haveMolecules 1 2451 2776 } 2452 2777 "polydata" { 2453 2778 array set settings { 2454 -color \#FFFFFF 2779 -cloudstyle "mesh" 2780 -color white 2781 -edgecolor black 2455 2782 -edges 1 2456 - edgecolor black2783 -lighting 1 2457 2784 -linewidth 1.0 2458 2785 -opacity 1.0 2786 -outline 0 2787 -visible 1 2459 2788 -wireframe 0 2460 -lighting 12461 -visible 12462 2789 } 2463 2790 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 2464 2797 SendCmd "polydata add $tag" 2465 2798 SendCmd "polydata visible $settings(-visible) $tag" … … 2467 2800 SendCmd "polydata edges $settings(-edges) $tag" 2468 2801 set _settings(polydata-edges) $settings(-edges) 2802 SendCmd "polydata cloudstyle $settings(-cloudstyle) $tag" 2469 2803 SendCmd "polydata color [Color2RGB $settings(-color)] $tag" 2470 2804 #SendCmd "polydata colormode constant {} $tag" … … 2627 2961 "move" { 2628 2962 set axis [lindex $args 0] 2629 set oldval $_axis(${axis}position)2630 2963 set newval [lindex $args 1] 2631 2964 if {[llength $args] != 2} {
Note: See TracChangeset
for help on using the changeset viewer.