Changeset 5764
- Timestamp:
- Jul 20, 2015, 3:07:56 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gui/scripts/vtkstreamlinesviewer.tcl
r5386 r5764 70 70 private method BuildDownloadPopup { widget command } 71 71 private method BuildStreamsTab {} 72 private method Build VolumeTab {}72 private method BuildSurfaceTab {} 73 73 private method DrawLegend {} 74 74 private method Combo { option } … … 135 135 private variable _title "" 136 136 private variable _seeds 137 138 private common _downloadPopup; # download options from popup139 private common _hardcopy140 137 private variable _width 0 141 138 private variable _height 0 … … 145 142 private variable _cutplanePending 0 146 143 private variable _legendPending 0 147 private variable _vectorFields148 private variable _scalarFields149 144 private variable _fields 150 145 private variable _curFldName "" … … 153 148 private variable _numSeeds 200 154 149 private variable _colorMode "vmag";# Mode of colormap (vmag or scalar) 150 151 private common _downloadPopup; # download options from popup 152 private common _hardcopy 155 153 } 156 154 … … 245 243 -streamlinesnumseeds 200 246 244 -streamlinesopacity 100 247 -streamlines scale 1245 -streamlineslength 70 248 246 -streamlinesseedsvisible 0 249 247 -streamlinesvisible 1 250 - volumeedges0251 - volumelighting1252 - volumeopacity40253 - volumevisible1254 - volumewireframe0248 -surfaceedges 0 249 -surfacelighting 1 250 -surfaceopacity 40 251 -surfacevisible 1 252 -surfacewireframe 0 255 253 -xgrid 0 256 254 -ygrid 0 … … 330 328 Rappture::Tooltip::for $itk_component(zoomout) "Zoom out" 331 329 332 itk_component add volume {333 Rappture::PushButton $f. volume \330 itk_component add surface { 331 Rappture::PushButton $f.surface \ 334 332 -onimage [Rappture::icon volume-on] \ 335 333 -offimage [Rappture::icon volume-off] \ 336 -variable [itcl::scope _settings(- volumevisible)] \337 -command [itcl::code $this AdjustSetting - volumevisible]338 } 339 $itk_component( volume) select340 Rappture::Tooltip::for $itk_component( volume) \341 " Don't display the volume"342 pack $itk_component( volume) -padx 2 -pady 2334 -variable [itcl::scope _settings(-surfacevisible)] \ 335 -command [itcl::code $this AdjustSetting -surfacevisible] 336 } 337 $itk_component(surface) select 338 Rappture::Tooltip::for $itk_component(surface) \ 339 "Show/Hide the boundary surface" 340 pack $itk_component(surface) -padx 2 -pady 2 343 341 344 342 itk_component add streamlines { … … 351 349 $itk_component(streamlines) select 352 350 Rappture::Tooltip::for $itk_component(streamlines) \ 353 " Toggle the streamlines on/off"351 "Show/Hide the streamlines" 354 352 pack $itk_component(streamlines) -padx 2 -pady 2 355 353 … … 362 360 } 363 361 Rappture::Tooltip::for $itk_component(cutplane) \ 364 "Show/Hide cutplanes"362 "Show/Hide the cutplanes" 365 363 pack $itk_component(cutplane) -padx 2 -pady 2 366 364 367 368 365 if { [catch { 369 Build VolumeTab366 BuildSurfaceTab 370 367 BuildStreamsTab 371 368 BuildCutplaneTab … … 1031 1028 array unset _fields 1032 1029 set _curFldName "" 1030 set _curFldLabel "" 1033 1031 foreach cname [$_first components] { 1034 1032 foreach fname [$_first fieldnames $cname] { … … 1047 1045 -command [itcl::code $this Combo invoke] 1048 1046 set _fields($fname) [list $label $units $components] 1049 if { $_curFldName == "" } {1047 if { $_curFldName == "" && $components == 3 } { 1050 1048 set _curFldName $fname 1051 1049 set _curFldLabel $label … … 1061 1059 -streamlineslighting \ 1062 1060 -streamlinescolormap -field \ 1063 - volumevisible -volumeedges -volumelighting -volumeopacity \1064 - volumewireframe \1061 -surfacevisible -surfaceedges -surfacelighting -surfaceopacity \ 1062 -surfacewireframe \ 1065 1063 -cutplanevisible \ 1066 1064 -cutplanexposition -cutplaneyposition -cutplanezposition \ … … 1343 1341 set bool $_settings($what) 1344 1342 SendCmd "cutplane visible $bool" 1343 if { $bool } { 1344 Rappture::Tooltip::for $itk_component(cutplane) \ 1345 "Hide the cutplanes" 1346 } else { 1347 Rappture::Tooltip::for $itk_component(cutplane) \ 1348 "Show the cutplanes" 1349 } 1345 1350 } 1346 1351 "-cutplanewireframe" { … … 1450 1455 SendCmd "streamlines opacity $sval" 1451 1456 } 1452 "-streamlines scale" {1457 "-streamlineslength" { 1453 1458 set val $_settings($what) 1454 set sval [expr { 0.01 * double($val) }] 1455 SendCmd "streamlines scale $sval $sval $sval" 1459 set sval [expr { (0.01 * double($val)) / 0.7 }] 1460 foreach axis {x y z} { 1461 foreach {min max} $_limits($axis) break 1462 set ${axis}len [expr double($max) - double($min)] 1463 } 1464 set length [expr { $sval * ($xlen + $ylen + $zlen) } ] 1465 SendCmd "streamlines length $length" 1456 1466 } 1457 1467 "-streamlineslighting" { … … 1459 1469 SendCmd "streamlines lighting $bool" 1460 1470 } 1461 "- volumeopacity" {1471 "-surfaceopacity" { 1462 1472 set val $_settings($what) 1463 1473 set sval [expr { 0.01 * double($val) }] 1464 1474 SendCmd "polydata opacity $sval" 1465 1475 } 1466 "- volumewireframe" {1476 "-surfacewireframe" { 1467 1477 set bool $_settings($what) 1468 1478 SendCmd "polydata wireframe $bool" 1469 1479 } 1470 "- volumevisible" {1480 "-surfacevisible" { 1471 1481 set bool $_settings($what) 1472 1482 SendCmd "polydata visible $bool" 1473 1483 if { $bool } { 1474 Rappture::Tooltip::for $itk_component( volume) \1475 "Hide the volume"1484 Rappture::Tooltip::for $itk_component(surface) \ 1485 "Hide the boundary surface" 1476 1486 } else { 1477 Rappture::Tooltip::for $itk_component( volume) \1478 "Show the volume"1479 } 1480 } 1481 "- volumelighting" {1487 Rappture::Tooltip::for $itk_component(surface) \ 1488 "Show the boundary surface" 1489 } 1490 } 1491 "-surfacelighting" { 1482 1492 set bool $_settings($what) 1483 1493 SendCmd "polydata lighting $bool" 1484 1494 } 1485 "- volumeedges" {1495 "-surfaceedges" { 1486 1496 set bool $_settings($what) 1487 1497 SendCmd "polydata edges $bool" … … 1544 1554 array set style { 1545 1555 -color BCGYR 1546 -levels 61547 -opacity 1.01548 1556 } 1549 1557 set tag $dataobj-$comp … … 1562 1570 array set style $_style($tag) 1563 1571 1564 set name "$style(-color) :$style(-levels):$style(-opacity)"1572 set name "$style(-color)" 1565 1573 if { ![info exists _colormaps($name)] } { 1566 1574 BuildColormap $name [array get style] … … 1584 1592 set cmap "0.0 0.0 0.0 0.0 1.0 1.0 1.0 1.0" 1585 1593 } 1586 if { ![info exists _settings(-volumeopacity)] } {1587 set _settings(-volumeopacity) $style(-opacity)1588 }1589 set max $_settings(-volumeopacity)1590 1591 1594 set amap "0.0 1.0 1.0 1.0" 1592 1595 SendCmd "colormap add $name { $cmap } { $amap }" … … 1615 1618 } 1616 1619 1617 itcl::body Rappture::VtkStreamlinesViewer::Build VolumeTab {} {1620 itcl::body Rappture::VtkStreamlinesViewer::BuildSurfaceTab {} { 1618 1621 1619 1622 set fg [option get $itk_component(hull) font Font] … … 1621 1624 1622 1625 set inner [$itk_component(main) insert end \ 1623 -title " Volume Settings" \1626 -title "Boundary Surface Settings" \ 1624 1627 -icon [Rappture::icon volume-on]] 1625 1628 $inner configure -borderwidth 4 1626 1629 1627 checkbutton $inner. volume \1628 -text "Show Volume" \1629 -variable [itcl::scope _settings(- volumevisible)] \1630 -command [itcl::code $this AdjustSetting - volumevisible] \1630 checkbutton $inner.surface \ 1631 -text "Show Surface" \ 1632 -variable [itcl::scope _settings(-surfacevisible)] \ 1633 -command [itcl::code $this AdjustSetting -surfacevisible] \ 1631 1634 -font "Arial 9" 1632 1635 1633 1636 checkbutton $inner.wireframe \ 1634 1637 -text "Show Wireframe" \ 1635 -variable [itcl::scope _settings(- volumewireframe)] \1636 -command [itcl::code $this AdjustSetting - volumewireframe] \1638 -variable [itcl::scope _settings(-surfacewireframe)] \ 1639 -command [itcl::code $this AdjustSetting -surfacewireframe] \ 1637 1640 -font "Arial 9" 1638 1641 1639 1642 checkbutton $inner.lighting \ 1640 1643 -text "Enable Lighting" \ 1641 -variable [itcl::scope _settings(- volumelighting)] \1642 -command [itcl::code $this AdjustSetting - volumelighting] \1644 -variable [itcl::scope _settings(-surfacelighting)] \ 1645 -command [itcl::code $this AdjustSetting -surfacelighting] \ 1643 1646 -font "Arial 9" 1644 1647 1645 1648 checkbutton $inner.edges \ 1646 1649 -text "Show Edges" \ 1647 -variable [itcl::scope _settings(- volumeedges)] \1648 -command [itcl::code $this AdjustSetting - volumeedges] \1650 -variable [itcl::scope _settings(-surfaceedges)] \ 1651 -command [itcl::code $this AdjustSetting -surfaceedges] \ 1649 1652 -font "Arial 9" 1650 1653 1651 1654 label $inner.opacity_l -text "Opacity" -font "Arial 9" 1652 1655 ::scale $inner.opacity -from 0 -to 100 -orient horizontal \ 1653 -variable [itcl::scope _settings(- volumeopacity)] \1656 -variable [itcl::scope _settings(-surfaceopacity)] \ 1654 1657 -width 10 \ 1655 1658 -showvalue off \ 1656 -command [itcl::code $this AdjustSetting - volumeopacity]1659 -command [itcl::code $this AdjustSetting -surfaceopacity] 1657 1660 1658 1661 blt::table $inner \ … … 1720 1723 -command [itcl::code $this AdjustSetting -streamlinesnumseeds] 1721 1724 1722 label $inner.scale_l -text " Scale" -font "Arial 9"1725 label $inner.scale_l -text "Length" -font "Arial 9" 1723 1726 ::scale $inner.scale -from 1 -to 100 -orient horizontal \ 1724 -variable [itcl::scope _settings(-streamlines scale)] \1727 -variable [itcl::scope _settings(-streamlineslength)] \ 1725 1728 -width 10 \ 1726 1729 -showvalue off \ 1727 -command [itcl::code $this AdjustSetting -streamlines scale]1730 -command [itcl::code $this AdjustSetting -streamlineslength] 1728 1731 1729 1732 label $inner.field_l -text "Color by" -font "Arial 9" … … 1751 1754 2,0 $inner.mode_l -anchor w -pady 2 \ 1752 1755 2,1 $inner.mode -fill x -pady 2 \ 1753 3,0 $inner.opacity_l -anchor w -pady 2 \ 1754 3,1 $inner.opacity -fill x -pady 2 \ 1756 3,0 $inner.scale_l -anchor w -pady 2 \ 1757 3,1 $inner.scale -fill x -pady 2 \ 1758 4,0 $inner.opacity_l -anchor w -pady 2 \ 1759 4,1 $inner.opacity -fill x -pady 2 \ 1755 1760 5,0 $inner.lighting -anchor w -pady 2 -cspan 2 \ 1756 1761 6,0 $inner.seeds -anchor w -pady 2 -cspan 2 \ … … 2137 2142 set style [$dataobj style $comp] 2138 2143 array set settings { 2139 -color \#808080 2144 -color BCGYR 2145 -constcolor white 2146 -edgecolor black 2140 2147 -edges 0 2141 - edgecolor black2148 -lighting 1 2142 2149 -linewidth 1.0 2143 - opacity 0.42144 - wireframe02145 - lighting 12150 -mode lines 2151 -numseeds 200 2152 -opacity 1.0 2146 2153 -seeds 1 2147 2154 -seedcolor white 2155 -streamlineslength 0.7 2156 -surfacecolor white 2157 -surfaceedgecolor black 2158 -surfaceedges 0 2159 -surfacelighting 1 2160 -surfaceopacity 0.4 2161 -surfacevisible 1 2162 -surfacewireframe 0 2148 2163 -visible 1 2164 -wireframe 0 2149 2165 } 2150 2166 if { $dataobj != $_first } { … … 2154 2170 StartBufferingCommands 2155 2171 SendCmd "streamlines add $tag" 2156 SendCmd "streamlines seed visible off $tag" 2172 SendCmd "streamlines color [Color2RGB $settings(-constcolor)] $tag" 2173 SendCmd "streamlines edges $settings(-edges) $tag" 2174 SendCmd "streamlines linecolor [Color2RGB $settings(-edgecolor)] $tag" 2175 SendCmd "streamlines linewidth $settings(-linewidth) $tag" 2176 SendCmd "streamlines lighting $settings(-lighting) $tag" 2177 SendCmd "streamlines opacity $settings(-opacity) $tag" 2178 SendCmd "streamlines seed color [Color2RGB $settings(-seedcolor)] $tag" 2179 SendCmd "streamlines seed visible $settings(-seeds) $tag" 2180 SendCmd "streamlines visible $settings(-visible) $tag" 2157 2181 set seeds [$dataobj hints seeds] 2158 2182 if { $seeds != "" && ![info exists _seeds($dataobj)] } { 2159 2183 set length [string length $seeds] 2160 SendCmd "streamlines seed fmesh 200data follows $length $tag"2184 SendCmd "streamlines seed fmesh $settings(-numseeds) data follows $length $tag" 2161 2185 SendData $seeds 2162 2186 set _seeds($dataobj) 1 2163 2187 } 2188 set _settings(-streamlineslighting) $settings(-lighting) 2189 $itk_component(streammode) value $settings(-mode) 2190 AdjustSetting -streamlinesmode 2191 set _settings(-streamlinesnumseeds) $settings(-numseeds) 2192 set _settings(-streamlinesopacity) [expr $settings(-opacity) * 100.0] 2193 set _settings(-streamlineslength) [expr $settings(-streamlineslength) * 100.0] 2194 set _settings(-streamlinesseedsvisible) $settings(-seeds) 2195 set _settings(-streamlinesvisible) $settings(-visible) 2196 2164 2197 SendCmd "cutplane add $tag" 2198 2165 2199 SendCmd "polydata add $tag" 2200 SendCmd "polydata color [Color2RGB $settings(-surfacecolor)] $tag" 2166 2201 SendCmd "polydata colormode constant {} $tag" 2167 set _settings(-volumeedges) $settings(-edges) 2168 set _settings(-volumelighting) $settings(-lighting) 2169 set _settings(-volumeopacity) $settings(-opacity) 2170 set _settings(-volumewireframe) $settings(-wireframe) 2171 set _settings(-volumeopacity) [expr $settings(-opacity) * 100.0] 2202 SendCmd "polydata edges $settings(-surfaceedges) $tag" 2203 SendCmd "polydata linecolor [Color2RGB $settings(-surfaceedgecolor)] $tag" 2204 SendCmd "polydata lighting $settings(-surfacelighting) $tag" 2205 SendCmd "polydata opacity $settings(-surfaceopacity) $tag" 2206 SendCmd "polydata wireframe $settings(-surfacewireframe) $tag" 2207 SendCmd "polydata visible $settings(-surfacevisible) $tag" 2208 set _settings(-surfaceedges) $settings(-surfaceedges) 2209 set _settings(-surfacelighting) $settings(-surfacelighting) 2210 set _settings(-surfaceopacity) [expr $settings(-surfaceopacity) * 100.0] 2211 set _settings(-surfacewireframe) $settings(-surfacewireframe) 2212 set _settings(-surfacevisible) $settings(-surfacevisible) 2172 2213 StopBufferingCommands 2173 2214 SetColormap $dataobj $comp 2215 $itk_component(colormap) value $settings(-color) 2174 2216 } 2175 2217
Note: See TracChangeset
for help on using the changeset viewer.