Changeset 2585
- Timestamp:
- Sep 29, 2011, 8:24:43 AM (13 years ago)
- Location:
- trunk/gui/scripts
- Files:
-
- 2 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gui/scripts/vtkstreamlinesviewer.tcl
r2584 r2585 85 85 private method BuildAxisTab {} 86 86 private method BuildCameraTab {} 87 private method BuildColormap { colormap dataobj comp}87 private method BuildColormap { name colors } 88 88 private method BuildCutplaneTab {} 89 89 private method BuildDownloadPopup { widget command } … … 334 334 $itk_component(volume) select 335 335 Rappture::Tooltip::for $itk_component(volume) \ 336 " Toggle the volume on/off"336 "Don't display the volume" 337 337 pack $itk_component(volume) -padx 2 -pady 2 338 338 339 339 itk_component add streamlines { 340 340 Rappture::PushButton $f.streamlines \ 341 -onimage [Rappture::icon stream ] \342 -offimage [Rappture::icon stream ] \341 -onimage [Rappture::icon streamlines-on] \ 342 -offimage [Rappture::icon streamlines-off] \ 343 343 -variable [itcl::scope _streamlines(visible)] \ 344 344 -command [itcl::code $this AdjustSetting streamlines-visible] \ … … 522 522 # ---------------------------------------------------------------------- 523 523 itcl::body Rappture::VtkStreamlinesViewer::add {dataobj {settings ""}} { 524 puts stderr "add dataobj=$dataobj settings=$settings"525 524 array set params { 526 525 -color auto … … 567 566 # ---------------------------------------------------------------------- 568 567 itcl::body Rappture::VtkStreamlinesViewer::delete {args} { 569 puts stderr "[info level -1]: delete args=$args"570 568 if { [llength $args] == 0} { 571 569 set args $_dlist … … 604 602 # ---------------------------------------------------------------------- 605 603 itcl::body Rappture::VtkStreamlinesViewer::get {args} { 606 puts stderr "get args=$args"607 604 if {[llength $args] == 0} { 608 605 set args "-objects" … … 676 673 # ---------------------------------------------------------------------- 677 674 itcl::body Rappture::VtkStreamlinesViewer::scale {args} { 678 puts stderr "scale args=$args"679 675 array unset _limits 680 676 foreach dataobj $args { … … 718 714 # ---------------------------------------------------------------------- 719 715 itcl::body Rappture::VtkStreamlinesViewer::download {option args} { 720 puts stderr "download option=$option args=$args"721 716 switch $option { 722 717 coming { … … 928 923 # ---------------------------------------------------------------------- 929 924 itcl::body Rappture::VtkStreamlinesViewer::Rebuild {} { 930 puts stderr "Rebuild"925 update 931 926 932 927 set w [winfo width $itk_component(view)] … … 1079 1074 # ---------------------------------------------------------------------- 1080 1075 itcl::body Rappture::VtkStreamlinesViewer::Zoom {option} { 1081 puts stderr "Zoom option=$option"1082 1076 switch -- $option { 1083 1077 "in" { … … 1114 1108 1115 1109 itcl::body Rappture::VtkStreamlinesViewer::PanCamera {} { 1116 puts stderr "PanCamera"1117 1110 set x $_view(xpan) 1118 1111 set y $_view(ypan) … … 1130 1123 # ---------------------------------------------------------------------- 1131 1124 itcl::body Rappture::VtkStreamlinesViewer::Rotate {option x y} { 1132 puts stderr "Rotate option=$option x=$x y=$y"1133 1125 switch -- $option { 1134 1126 "click" { … … 1189 1181 # ---------------------------------------------------------------------- 1190 1182 itcl::body Rappture::VtkStreamlinesViewer::Pan {option x y} { 1191 puts stderr "Pan option=$option x=$x y=$y"1192 1183 switch -- $option { 1193 1184 "set" { … … 1254 1245 # 1255 1246 itcl::body Rappture::VtkStreamlinesViewer::AdjustSetting {what {value ""}} { 1256 puts stderr "AdjustSetting what=$what value=$value"1257 1247 if { ![isconnected] } { 1258 1248 return … … 1277 1267 SendCmd "polydata visible $bool $dataset" 1278 1268 } 1269 if { $bool } { 1270 Rappture::Tooltip::for $itk_component(volume) \ 1271 "Hide the volume" 1272 } else { 1273 Rappture::Tooltip::for $itk_component(volume) \ 1274 "Show the volume" 1275 } 1279 1276 } 1280 1277 "volume-lighting" { … … 1318 1315 set axis [string range $what 0 0] 1319 1316 set bool $_cutplane(${axis}visible) 1320 puts stderr "axis=$axis, bool=$bool"1321 1317 if { $bool } { 1322 1318 $itk_component(${axis}CutScale) configure -state normal \ … … 1326 1322 -troughcolor grey82 1327 1323 } 1328 puts stderr "cutplane axis $axis $bool"1329 1324 SendCmd "cutplane axis $axis $bool" 1330 1325 SendCmd "cutplane colormode vmag" … … 1333 1328 set axis [string range $what 0 0] 1334 1329 set pos [expr $_cutplane(${axis}position) * 0.01] 1335 puts stderr "cutplane slice ${axis} ${pos}"1336 1330 SendCmd "cutplane slice ${axis} ${pos}" 1337 1331 set _cutplanePending 0 … … 1355 1349 SendCmd "streamlines visible $bool $dataset" 1356 1350 } 1351 if { $bool } { 1352 Rappture::Tooltip::for $itk_component(streamlines) \ 1353 "Hide the streamlines" 1354 } else { 1355 Rappture::Tooltip::for $itk_component(streamlines) \ 1356 "Show the streamlines" 1357 } 1357 1358 } 1358 1359 "streamlines-mode" { … … 1399 1400 } 1400 1401 foreach dataset [CurrentDatasets -visible $_first] { 1401 puts stderr "streamlines colormode ${mode} $dataset"1402 1402 SendCmd "dataset scalar ${field} $dataset" 1403 1403 SendCmd "streamlines colormode ${mode} $dataset" … … 1421 1421 # 1422 1422 itcl::body Rappture::VtkStreamlinesViewer::RequestLegend { {mode vmag} } { 1423 puts stderr "RequestLegend mode=$mode"1424 1423 #puts stderr "RequestLegend _first=$_first" 1425 1424 #puts stderr "RequestLegend width=$_width height=$_height" … … 1447 1446 # 1448 1447 itcl::body Rappture::VtkStreamlinesViewer::SetColormap { dataobj comp } { 1449 puts stderr "SetColormap dataobj=$dataobj comp=$comp"1450 1448 array set style { 1451 1449 -color rainbow … … 1466 1464 if { ![info exists _colormaps($colormap)] } { 1467 1465 # Build the pseudo colormap if it doesn't exist. 1468 BuildColormap $colormap $ dataobj $comp1466 BuildColormap $colormap $style(-color) 1469 1467 set _colormaps($colormap) 1 1470 1468 } … … 1474 1472 } 1475 1473 1476 # 1477 # BuildColormap -- 1478 # 1479 itcl::body Rappture::VtkStreamlinesViewer::BuildColormap { colormap dataobj comp } { 1480 puts stderr "BuildColormap colormap=$colormap dataobj=$dataobj comp=$comp" 1481 array set style { 1482 -color rainbow 1483 -levels 6 1484 -opacity 1.0 1485 } 1486 array set style [$dataobj style $comp] 1487 if {$style(-color) == "rainbow"} { 1488 set style(-color) "white:yellow:green:cyan:blue:magenta" 1489 } 1490 set clist [split $style(-color) :] 1474 itcl::body Rappture::VtkStreamlinesViewer::ColorsToColormap { colors } { 1475 switch -- $colors { 1476 "blue-to-gray" { 1477 set clist { 1478 \#0099cc \#66e5ff \#99ffff \#ccffff \#e5e5e5 \#999999 1479 \#666666 \#333333 1480 } 1481 } 1482 "blue" { 1483 set clist { 1484 \#e5ffff \#ccfaff \#b2f2ff \#99e5ff \#7fd4ff \#66bfff 1485 \#4ca5ff \#3387ff \#1966ff \#003fff 1486 } 1487 } 1488 "blue-to-brown" { 1489 return { 1490 0.0 0.200 0.100 0.000 1491 0.09090909090909091 0.400 0.187 0.000 1492 0.18181818181818182 0.600 0.379 0.210 1493 0.2727272727272727 0.800 0.608 0.480 1494 0.36363636363636365 0.850 0.688 0.595 1495 0.45454545454545453 0.950 0.855 0.808 1496 0.5454545454545454 0.800 0.993 1.000 1497 0.6363636363636364 0.600 0.973 1.000 1498 0.7272727272727273 0.400 0.940 1.000 1499 0.8181818181818182 0.200 0.893 1.000 1500 0.9090909090909091 0.000 0.667 0.800 1501 1.0 0.000 0.480 0.600 1502 } 1503 } 1504 "blue-to-orange" { 1505 return { 1506 0.0 0.000 0.167 1.000 1507 0.09090909090909091 0.100 0.400 1.000 1508 0.18181818181818182 0.200 0.600 1.000 1509 0.2727272727272727 0.400 0.800 1.000 1510 0.36363636363636365 0.600 0.933 1.000 1511 0.45454545454545453 0.800 1.000 1.000 1512 0.5454545454545454 1.000 1.000 0.800 1513 0.6363636363636364 1.000 0.933 0.600 1514 0.7272727272727273 1.000 0.800 0.400 1515 0.8181818181818182 1.000 0.600 0.200 1516 0.9090909090909091 1.000 0.400 0.100 1517 1.0 1.000 0.167 0.000 1518 } 1519 } 1520 "rainbow" { 1521 set clist { 1522 "red" "#FFA500" "yellow" "#008000" "blue" "#4B0082" "#EE82EE" 1523 } 1524 } 1525 "typical" { 1526 set clist { 1527 "red" "#FFA500" "yellow" "#008000" "blue" 1528 } 1529 } 1530 "greyscale" { 1531 return { 1532 0.0 0.0 0.0 0.0 1.0 1.0 1.0 1.0 1533 } 1534 } 1535 "nanohub" { 1536 set clist "white yellow green cyan blue magenta" 1537 } 1538 default { 1539 set clist $color 1540 } 1541 } 1491 1542 set cmap {} 1492 1543 for {set i 0} {$i < [llength $clist]} {incr i} { … … 1495 1546 append cmap "$x [Color2RGB $color] " 1496 1547 } 1548 return $cmap 1549 } 1550 1551 # 1552 # BuildColormap -- 1553 # 1554 itcl::body Rappture::VtkStreamlinesViewer::BuildColormap { name colors } { 1555 set cmap [ColorsToColormap $colors] 1497 1556 if { [llength $cmap] == 0 } { 1498 1557 set cmap "0.0 0.0 0.0 0.0 1.0 1.0 1.0 1.0" … … 1504 1563 1505 1564 set wmap "0.0 1.0 1.0 1.0" 1506 SendCmd "colormap add $ colormap{ $cmap } { $wmap }"1565 SendCmd "colormap add $name { $cmap } { $wmap }" 1507 1566 } 1508 1567 … … 1529 1588 1530 1589 itcl::body Rappture::VtkStreamlinesViewer::limits { dataobj } { 1531 puts stderr "[info level -1]: limits dataobj=$dataobj"1532 1590 array unset _limits $dataobj-* 1533 1591 foreach comp [$dataobj components] { … … 1659 1717 set inner [$itk_component(main) insert end \ 1660 1718 -title "Streams Settings" \ 1661 -icon [Rappture::icon stream ]]1719 -icon [Rappture::icon streamlines-on]] 1662 1720 $inner configure -borderwidth 4 1663 1721 … … 1667 1725 -command [itcl::code $this AdjustSetting streamlines-visible] \ 1668 1726 -font "Arial 9" 1669 1727 1670 1728 checkbutton $inner.lighting \ 1671 1729 -text "Enable Lighting" \ … … 1946 2004 # 1947 2005 itcl::body Rappture::VtkStreamlinesViewer::camera {option args} { 1948 puts stderr "camera option=$option args=$args"1949 2006 switch -- $option { 1950 2007 "show" { … … 2066 2123 2067 2124 itcl::body Rappture::VtkStreamlinesViewer::SetObjectStyle { dataobj comp } { 2068 puts stderr "SetObjectStyle dataobj=$dataobj comp=$comp"2069 2125 # Parse style string. 2070 2126 set tag $dataobj-$comp … … 2142 2198 # ---------------------------------------------------------------------- 2143 2199 itcl::body Rappture::VtkStreamlinesViewer::ReceiveLegend { colormap title vmin vmax size } { 2144 puts stderr "ReceiveLegend colormap=$colormap title=$title range=$vmin,$vmax size=$size"2200 #puts stderr "ReceiveLegend colormap=$colormap title=$title range=$vmin,$vmax size=$size" 2145 2201 set _limits(vmin) $vmin 2146 2202 set _limits(vmax) $vmax … … 2170 2226 set lineht [font metrics $font -linespace] 2171 2227 2228 regsub {\(mag\)} $title "" title 2172 2229 if { $_settings(legend) } { 2173 2230 set x [expr $w - 2] … … 2204 2261 } 2205 2262 set y 2 2206 puts stderr "$c coords title $x $y"2207 2263 $c coords title $x $y 2208 2264 incr y $lineht 2209 2265 $c coords vmax $x $y 2210 puts stderr "$c coords vmin $x $y"2211 2266 incr y $lineht 2212 2267 $c coords colormap $x $y 2213 puts stderr "$c coords vmin $x [expr {$h - 2}]"2214 2268 $c coords vmin $x [expr {$h - 2}] 2215 2269 }
Note: See TracChangeset
for help on using the changeset viewer.