Changeset 2584 for trunk/gui/scripts
- Timestamp:
- Sep 28, 2011, 4:11:15 PM (13 years ago)
- Location:
- trunk/gui/scripts
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gui/scripts/flowvisviewer.tcl
r2547 r2584 256 256 257 257 itk_component add 3dview { 258 label $itk_component(plotarea).v ol-image $_image(plot) \258 label $itk_component(plotarea).view -image $_image(plot) \ 259 259 -highlightthickness 0 -borderwidth 0 260 260 } { -
trunk/gui/scripts/heightmapviewer.tcl
r1984 r2584 164 164 165 165 itk_component add 3dview { 166 canvas $itk_component(plotarea).v ol\166 canvas $itk_component(plotarea).view \ 167 167 -highlightthickness 0 -borderwidth 0 168 168 } { -
trunk/gui/scripts/molvisviewer.tcl
r2504 r2584 219 219 220 220 itk_component add 3dview { 221 label $itk_component(plotarea).v ol-image $_image(plot) \221 label $itk_component(plotarea).view -image $_image(plot) \ 222 222 -highlightthickness 0 -borderwidth 0 223 223 } { -
trunk/gui/scripts/nanovisviewer.tcl
r2390 r2584 221 221 222 222 itk_component add 3dview { 223 label $itk_component(plotarea).v ol-image $_image(plot) \223 label $itk_component(plotarea).view -image $_image(plot) \ 224 224 -highlightthickness 0 -borderwidth 0 225 225 } { -
trunk/gui/scripts/vtkstreamlinesviewer.tcl
r2583 r2584 86 86 private method BuildCameraTab {} 87 87 private method BuildColormap { colormap dataobj comp } 88 private method BuildCut awayTab {}88 private method BuildCutplaneTab {} 89 89 private method BuildDownloadPopup { widget command } 90 90 private method BuildStreamsTab {} 91 91 private method BuildVolumeTab {} 92 92 private method ConvertToVtkData { dataobj comp } 93 private method DrawLegend { }93 private method DrawLegend { title } 94 94 private method EnterLegend { x y } 95 95 private method EventuallyResize { w h } 96 96 private method EventuallyRotate { q } 97 private method EventuallySetCutplane { axis args } 97 98 private method GetImage { args } 98 99 private method GetVtkData { args } … … 101 102 private method MotionLegend { x y } 102 103 private method PanCamera {} 103 private method RequestLegend { }104 private method RequestLegend { {mode "vmag"} } 104 105 private method SetColormap { dataobj comp } 105 106 private method SetLegendTip { x y } … … 128 129 private variable _volume 129 130 private variable _axis 131 private variable _cutplane 130 132 private variable _streamlines 131 133 private variable _reset 1 ;# indicates if camera needs to be reset … … 144 146 private variable _resizePending 0 145 147 private variable _rotatePending 0 148 private variable _cutplanePending 0 146 149 private variable _outline 150 private variable _fields 147 151 } 148 152 … … 168 172 $_dispatcher dispatch $this !rotate "[itcl::code $this DoRotate]; list" 169 173 170 set _outbuf "" 174 # X-Cutplane event 175 $_dispatcher register !xcutplane 176 $_dispatcher dispatch $this !xcutplane \ 177 "[itcl::code $this AdjustSetting xcutplane-position]; list" 178 179 # Y-Cutplane event 180 $_dispatcher register !ycutplane 181 $_dispatcher dispatch $this !ycutplane \ 182 "[itcl::code $this AdjustSetting ycutplane-position]; list" 183 184 # Z-Cutplane event 185 $_dispatcher register !zcutplane 186 $_dispatcher dispatch $this !zcutplane \ 187 "[itcl::code $this AdjustSetting zcutplane-position]; list" 171 188 172 189 # … … 207 224 ygrid 0 208 225 zgrid 0 209 xcut away0210 ycut away0211 zcut away0226 xcutplane 0 227 ycutplane 0 228 zcutplane 0 212 229 xposition 0 213 230 yposition 0 214 231 zposition 0 215 xdirection -1216 ydirection -1217 zdirection -1218 232 visible 1 219 233 labels 1 234 }] 235 array set _cutplane [subst { 236 xvisible 0 237 yvisible 0 238 zvisible 0 239 xposition 0 240 yposition 0 241 zposition 0 242 visible 1 220 243 }] 221 244 array set _volume [subst { … … 302 325 Rappture::Tooltip::for $itk_component(zoomout) "Zoom out" 303 326 327 itk_component add volume { 328 Rappture::PushButton $f.volume \ 329 -onimage [Rappture::icon volume-on] \ 330 -offimage [Rappture::icon volume-off] \ 331 -variable [itcl::scope _volume(visible)] \ 332 -command [itcl::code $this AdjustSetting volume-visible] 333 } 334 $itk_component(volume) select 335 Rappture::Tooltip::for $itk_component(volume) \ 336 "Toggle the volume on/off" 337 pack $itk_component(volume) -padx 2 -pady 2 338 339 itk_component add streamlines { 340 Rappture::PushButton $f.streamlines \ 341 -onimage [Rappture::icon stream] \ 342 -offimage [Rappture::icon stream] \ 343 -variable [itcl::scope _streamlines(visible)] \ 344 -command [itcl::code $this AdjustSetting streamlines-visible] \ 345 } 346 $itk_component(streamlines) select 347 Rappture::Tooltip::for $itk_component(streamlines) \ 348 "Toggle the streamlines on/off" 349 pack $itk_component(streamlines) -padx 2 -pady 2 350 304 351 if { [catch { 305 352 BuildVolumeTab 306 353 BuildStreamsTab 307 354 BuildAxisTab 308 BuildCut awayTab355 BuildCutplaneTab 309 356 BuildCameraTab 310 357 } errs] != 0 } { … … 402 449 $_dispatcher cancel !resize 403 450 $_dispatcher cancel !rotate 451 $_dispatcher cancel !xcutplane 452 $_dispatcher cancel !ycutplane 453 $_dispatcher cancel !zcutplane 404 454 image delete $_image(plot) 405 455 image delete $_image(download) … … 457 507 } 458 508 509 itcl::body Rappture::VtkStreamlinesViewer::EventuallySetCutplane { axis args } { 510 if { !$_cutplanePending } { 511 set _cutplanePending 1 512 $_dispatcher event -after 100 !${axis}cutplane 513 } 514 } 515 459 516 # ---------------------------------------------------------------------- 460 517 # USAGE: add <dataobj> ?<settings>? … … 465 522 # ---------------------------------------------------------------------- 466 523 itcl::body Rappture::VtkStreamlinesViewer::add {dataobj {settings ""}} { 524 puts stderr "add dataobj=$dataobj settings=$settings" 467 525 array set params { 468 526 -color auto … … 509 567 # ---------------------------------------------------------------------- 510 568 itcl::body Rappture::VtkStreamlinesViewer::delete {args} { 569 puts stderr "[info level -1]: delete args=$args" 511 570 if { [llength $args] == 0} { 512 571 set args $_dlist … … 545 604 # ---------------------------------------------------------------------- 546 605 itcl::body Rappture::VtkStreamlinesViewer::get {args} { 606 puts stderr "get args=$args" 547 607 if {[llength $args] == 0} { 548 608 set args "-objects" … … 616 676 # ---------------------------------------------------------------------- 617 677 itcl::body Rappture::VtkStreamlinesViewer::scale {args} { 678 puts stderr "scale args=$args" 618 679 array unset _limits 619 680 foreach dataobj $args { … … 657 718 # ---------------------------------------------------------------------- 658 719 itcl::body Rappture::VtkStreamlinesViewer::download {option args} { 720 puts stderr "download option=$option args=$args" 659 721 switch $option { 660 722 coming { … … 866 928 # ---------------------------------------------------------------------- 867 929 itcl::body Rappture::VtkStreamlinesViewer::Rebuild {} { 930 puts stderr "Rebuild" 868 931 869 932 set w [winfo width $itk_component(view)] … … 924 987 append _outbuf $bytes 925 988 set _datasets($tag) 1 989 SetObjectStyle $dataobj $comp 926 990 } 927 991 lappend _obj2datasets($dataobj) $tag … … 931 995 SendCmd "dataset visible 0 $tag" 932 996 } 933 SetObjectStyle $dataobj $comp934 997 } 935 998 } … … 1016 1079 # ---------------------------------------------------------------------- 1017 1080 itcl::body Rappture::VtkStreamlinesViewer::Zoom {option} { 1081 puts stderr "Zoom option=$option" 1018 1082 switch -- $option { 1019 1083 "in" { … … 1050 1114 1051 1115 itcl::body Rappture::VtkStreamlinesViewer::PanCamera {} { 1116 puts stderr "PanCamera" 1052 1117 set x $_view(xpan) 1053 1118 set y $_view(ypan) … … 1065 1130 # ---------------------------------------------------------------------- 1066 1131 itcl::body Rappture::VtkStreamlinesViewer::Rotate {option x y} { 1132 puts stderr "Rotate option=$option x=$x y=$y" 1067 1133 switch -- $option { 1068 1134 "click" { … … 1123 1189 # ---------------------------------------------------------------------- 1124 1190 itcl::body Rappture::VtkStreamlinesViewer::Pan {option x y} { 1191 puts stderr "Pan option=$option x=$x y=$y" 1125 1192 switch -- $option { 1126 1193 "set" { … … 1187 1254 # 1188 1255 itcl::body Rappture::VtkStreamlinesViewer::AdjustSetting {what {value ""}} { 1256 puts stderr "AdjustSetting what=$what value=$value" 1189 1257 if { ![isconnected] } { 1190 1258 return … … 1247 1315 SendCmd "axis flymode $mode" 1248 1316 } 1249 "axis-xcutaway" - "axis-ycutaway" - "axis-zcutaway" { 1250 set axis [string range $what 5 5] 1251 set bool $_axis(${axis}cutaway) 1317 "xcutplane-visible" - "ycutplane-visible" - "zcutplane-visible" { 1318 set axis [string range $what 0 0] 1319 set bool $_cutplane(${axis}visible) 1320 puts stderr "axis=$axis, bool=$bool" 1252 1321 if { $bool } { 1253 set pos [expr $_axis(${axis}position) * 0.01]1254 set dir $_axis(${axis}direction)1255 1322 $itk_component(${axis}CutScale) configure -state normal \ 1256 1323 -troughcolor white 1257 SendCmd "renderer clipplane $axis $pos $dir"1258 1324 } else { 1259 1325 $itk_component(${axis}CutScale) configure -state disabled \ 1260 1326 -troughcolor grey82 1261 SendCmd "renderer clipplane $axis 1 -1"1262 1327 } 1263 } 1264 "axis-xposition" - "axis-yposition" - "axis-zposition" - 1265 "axis-xdirection" - "axis-ydirection" - "axis-zdirection" { 1266 set axis [string range $what 5 5] 1267 #set dir $_axis(${axis}direction) 1268 set pos [expr $_axis(${axis}position) * 0.01] 1269 SendCmd "renderer clipplane ${axis} $pos -1" 1328 puts stderr "cutplane axis $axis $bool" 1329 SendCmd "cutplane axis $axis $bool" 1330 SendCmd "cutplane colormode vmag" 1331 } 1332 "xcutplane-position" - "ycutplane-position" - "zcutplane-position" { 1333 set axis [string range $what 0 0] 1334 set pos [expr $_cutplane(${axis}position) * 0.01] 1335 puts stderr "cutplane slice ${axis} ${pos}" 1336 SendCmd "cutplane slice ${axis} ${pos}" 1337 set _cutplanePending 0 1270 1338 } 1271 1339 "streamlines-seeds" { … … 1324 1392 } 1325 1393 } 1394 "streamlines-field" { 1395 set field [$itk_component(field) value] 1396 set mode scalar 1397 if { $field == "U" } { 1398 set mode vmag 1399 } 1400 foreach dataset [CurrentDatasets -visible $_first] { 1401 puts stderr "streamlines colormode ${mode} $dataset" 1402 SendCmd "dataset scalar ${field} $dataset" 1403 SendCmd "streamlines colormode ${mode} $dataset" 1404 SendCmd "streamlines colormode ${mode} $dataset" 1405 #SendCmd "dataset vector ${field} $dataset" 1406 } 1407 RequestLegend $mode 1408 } 1326 1409 default { 1327 1410 error "don't know how to fix $what" … … 1337 1420 # to be vertical when drawn. 1338 1421 # 1339 itcl::body Rappture::VtkStreamlinesViewer::RequestLegend {} { 1422 itcl::body Rappture::VtkStreamlinesViewer::RequestLegend { {mode vmag} } { 1423 puts stderr "RequestLegend mode=$mode" 1340 1424 #puts stderr "RequestLegend _first=$_first" 1341 1425 #puts stderr "RequestLegend width=$_width height=$_height" … … 1344 1428 set c $itk_component(legend) 1345 1429 set w 12 1346 set h [expr {$_height - 2* ($lineht + 2)}]1430 set h [expr {$_height - 3 * ($lineht + 2)}] 1347 1431 if { $h < 1} { 1348 1432 return … … 1353 1437 if { [info exists _dataset2style($dataset)] } { 1354 1438 #puts stderr "RequestLegend w=$w h=$h" 1355 SendCmd "legend $_dataset2style($dataset) vmag{} $w $h 0"1439 SendCmd "legend $_dataset2style($dataset) $mode {} $w $h 0" 1356 1440 break; 1357 1441 } … … 1363 1447 # 1364 1448 itcl::body Rappture::VtkStreamlinesViewer::SetColormap { dataobj comp } { 1449 puts stderr "SetColormap dataobj=$dataobj comp=$comp" 1365 1450 array set style { 1366 1451 -color rainbow … … 1385 1470 } 1386 1471 SendCmd "streamlines colormap $colormap $tag" 1472 SendCmd "cutplane colormap $colormap $tag" 1387 1473 return $colormap 1388 1474 } … … 1392 1478 # 1393 1479 itcl::body Rappture::VtkStreamlinesViewer::BuildColormap { colormap dataobj comp } { 1480 puts stderr "BuildColormap colormap=$colormap dataobj=$dataobj comp=$comp" 1394 1481 array set style { 1395 1482 -color rainbow … … 1442 1529 1443 1530 itcl::body Rappture::VtkStreamlinesViewer::limits { dataobj } { 1444 1531 puts stderr "[info level -1]: limits dataobj=$dataobj" 1445 1532 array unset _limits $dataobj-* 1446 1533 foreach comp [$dataobj components] { … … 1454 1541 set reader [vtkDataSetReader $tag-xvtkDataSetReader] 1455 1542 $reader SetFileName $tmpfile 1456 $reader ReadAllNormalsOn1457 1543 $reader ReadAllScalarsOn 1458 1544 $reader ReadAllVectorsOn … … 1463 1549 set pointData [$output GetPointData] 1464 1550 puts stderr "\#scalars=[$reader GetNumberOfScalarsInFile]" 1465 puts stderr "\#vectors=[$reader GetNumberOfVectorsInFile]"1466 puts stderr "\#tensors=[$reader GetNumberOfTensorsInFile]"1467 puts stderr "\#normals=[$reader GetNumberOfNormalsInFile]"1468 1551 puts stderr "\#fielddata=[$reader GetNumberOfFieldDataInFile]" 1469 1552 puts stderr "fielddataname=[$reader GetFieldDataNameInFile 0]" … … 1471 1554 set pointData [$output GetPointData] 1472 1555 puts stderr "field \#arrays=[$fieldData GetNumberOfArrays]" 1556 for { set i 0 } { $i < [$fieldData GetNumberOfArrays] } { incr i } { 1557 puts stderr [$fieldData GetArrayName $i] 1558 } 1473 1559 puts stderr "point \#arrays=[$pointData GetNumberOfArrays]" 1560 for { set i 0 } { $i < [$pointData GetNumberOfArrays] } { incr i } { 1561 set name [$pointData GetArrayName $i] 1562 if { ![info exists _fields($name)] } { 1563 $itk_component(field) choices insert end "$name" "$name" 1564 set _fields($name) 1 1565 } 1566 } 1474 1567 puts stderr "field \#components=[$fieldData GetNumberOfComponents]" 1475 1568 puts stderr "point \#components=[$pointData GetNumberOfComponents]" … … 1619 1712 -command [itcl::code $this AdjustSetting streamlines-scale] 1620 1713 1714 label $inner.field_l -text "Field" -font "Arial 9" 1715 itk_component add field { 1716 Rappture::Combobox $inner.field -width 10 -editable no 1717 } 1718 bind $inner.field <<Value>> \ 1719 [itcl::code $this AdjustSetting streamlines-field] 1720 1621 1721 blt::table $inner \ 1622 1722 0,0 $inner.streamlines -anchor w -pady 2 -cspan 2 \ 1623 1723 1,0 $inner.lighting -anchor w -pady 2 -cspan 2 \ 1624 1724 2,0 $inner.seeds -anchor w -pady 2 -cspan 2 \ 1625 3,0 $inner.density_l -anchor w -pady 2 \1725 3,0 $inner.density_l -anchor w -pady 2 -cspan 2 \ 1626 1726 4,0 $inner.density -fill x -pady 2 -cspan 2 \ 1627 1727 5,0 $inner.mode_l -anchor w -pady 2 \ 1628 1728 5,1 $inner.mode -anchor w -pady 2 \ 1629 6,0 $inner.opacity_l -anchor w -pady 2 \ 1630 7,0 $inner.opacity -fill x -pady 2 -cspan 2 1729 6,0 $inner.opacity_l -anchor w -pady 2 -cspan 2 \ 1730 7,0 $inner.opacity -fill x -pady 2 -cspan 2 \ 1731 8,0 $inner.field_l -anchor w -pady 2 \ 1732 8,1 $inner.field -anchor w -pady 2 \ 1733 1631 1734 1632 1735 blt::table configure $inner r* c* -resize none 1633 blt::table configure $inner r 8c1 c2 -resize expand1736 blt::table configure $inner r9 c1 c2 -resize expand 1634 1737 } 1635 1738 … … 1734 1837 } 1735 1838 1736 itcl::body Rappture::VtkStreamlinesViewer::BuildCut awayTab {} {1839 itcl::body Rappture::VtkStreamlinesViewer::BuildCutplaneTab {} { 1737 1840 1738 1841 set fg [option get $itk_component(hull) font Font] 1739 1842 1740 1843 set inner [$itk_component(main) insert end \ 1741 -title "Cut awayAlong Axis" \1844 -title "Cutplane Along Axis" \ 1742 1845 -icon [Rappture::icon cutbutton]] 1743 1846 … … 1749 1852 -onimage [Rappture::icon x-cutplane] \ 1750 1853 -offimage [Rappture::icon x-cutplane] \ 1751 -command [itcl::code $this AdjustSetting axis-xcutaway] \1752 -variable [itcl::scope _ axis(xcutaway)]1854 -command [itcl::code $this AdjustSetting xcutplane-visible] \ 1855 -variable [itcl::scope _cutplane(xvisible)] 1753 1856 } 1754 1857 Rappture::Tooltip::for $itk_component(xCutButton) \ 1755 "Toggle the X-axis cut awayon/off"1858 "Toggle the X-axis cutplane on/off" 1756 1859 1757 1860 itk_component add xCutScale { … … 1759 1862 -width 10 -orient vertical -showvalue yes \ 1760 1863 -borderwidth 1 -highlightthickness 0 \ 1761 -command [itcl::code $this Slice move x] \1762 -variable [itcl::scope _ axis(xposition)]1864 -command [itcl::code $this EventuallySetCutplane x] \ 1865 -variable [itcl::scope _cutplane(xposition)] 1763 1866 } { 1764 1867 usual 1765 1868 ignore -borderwidth -highlightthickness 1766 1869 } 1767 # Set the default cut awayvalue before disabling the scale.1870 # Set the default cutplane value before disabling the scale. 1768 1871 $itk_component(xCutScale) set 100 1769 1872 $itk_component(xCutScale) configure -state disabled 1770 1873 Rappture::Tooltip::for $itk_component(xCutScale) \ 1771 1874 "@[itcl::code $this Slice tooltip x]" 1772 1773 itk_component add xDirButton {1774 Rappture::PushButton $inner.xdir \1775 -onimage [Rappture::icon arrow-down] \1776 -onvalue -1 \1777 -offimage [Rappture::icon arrow-up] \1778 -offvalue 1 \1779 -command [itcl::code $this AdjustSetting axis-xdirection] \1780 -variable [itcl::scope _axis(xdirection)]1781 }1782 set _axis(xdirection) -11783 Rappture::Tooltip::for $itk_component(xDirButton) \1784 "Toggle the direction of the X-axis cutaway"1785 1875 1786 1876 # Y-value slicer... … … 1789 1879 -onimage [Rappture::icon y-cutplane] \ 1790 1880 -offimage [Rappture::icon y-cutplane] \ 1791 -command [itcl::code $this AdjustSetting axis-ycutaway] \1792 -variable [itcl::scope _ axis(ycutaway)]1881 -command [itcl::code $this AdjustSetting ycutplane-visible] \ 1882 -variable [itcl::scope _cutplane(yvisible)] 1793 1883 } 1794 1884 Rappture::Tooltip::for $itk_component(yCutButton) \ 1795 "Toggle the Y-axis cut awayon/off"1885 "Toggle the Y-axis cutplane on/off" 1796 1886 1797 1887 itk_component add yCutScale { … … 1799 1889 -width 10 -orient vertical -showvalue yes \ 1800 1890 -borderwidth 1 -highlightthickness 0 \ 1801 -command [itcl::code $this Slice move y] \1802 -variable [itcl::scope _ axis(yposition)]1891 -command [itcl::code $this EventuallySetCutplane y] \ 1892 -variable [itcl::scope _cutplane(yposition)] 1803 1893 } { 1804 1894 usual … … 1807 1897 Rappture::Tooltip::for $itk_component(yCutScale) \ 1808 1898 "@[itcl::code $this Slice tooltip y]" 1809 # Set the default cut awayvalue before disabling the scale.1899 # Set the default cutplane value before disabling the scale. 1810 1900 $itk_component(yCutScale) set 100 1811 1901 $itk_component(yCutScale) configure -state disabled 1812 1813 itk_component add yDirButton {1814 Rappture::PushButton $inner.ydir \1815 -onimage [Rappture::icon arrow-down] \1816 -onvalue -1 \1817 -offimage [Rappture::icon arrow-up] \1818 -offvalue 1 \1819 -command [itcl::code $this AdjustSetting axis-ydirection] \1820 -variable [itcl::scope _axis(ydirection)]1821 }1822 Rappture::Tooltip::for $itk_component(yDirButton) \1823 "Toggle the direction of the Y-axis cutaway"1824 set _axis(ydirection) -11825 1902 1826 1903 # Z-value slicer... … … 1829 1906 -onimage [Rappture::icon z-cutplane] \ 1830 1907 -offimage [Rappture::icon z-cutplane] \ 1831 -command [itcl::code $this AdjustSetting axis-zcutaway] \1832 -variable [itcl::scope _ axis(zcutaway)]1908 -command [itcl::code $this AdjustSetting zcutplane-visible] \ 1909 -variable [itcl::scope _cutplane(zvisible)] 1833 1910 } 1834 1911 Rappture::Tooltip::for $itk_component(zCutButton) \ 1835 "Toggle the Z-axis cut awayon/off"1912 "Toggle the Z-axis cutplane on/off" 1836 1913 1837 1914 itk_component add zCutScale { … … 1839 1916 -width 10 -orient vertical -showvalue yes \ 1840 1917 -borderwidth 1 -highlightthickness 0 \ 1841 -command [itcl::code $this Slice move z] \1842 -variable [itcl::scope _ axis(zposition)]1918 -command [itcl::code $this EventuallySetCutplane z] \ 1919 -variable [itcl::scope _cutplane(zposition)] 1843 1920 } { 1844 1921 usual … … 1850 1927 Rappture::Tooltip::for $itk_component(zCutScale) \ 1851 1928 "@[itcl::code $this Slice tooltip z]" 1852 1853 itk_component add zDirButton {1854 Rappture::PushButton $inner.zdir \1855 -onimage [Rappture::icon arrow-down] \1856 -onvalue -1 \1857 -offimage [Rappture::icon arrow-up] \1858 -offvalue 1 \1859 -command [itcl::code $this AdjustSetting axis-zdirection] \1860 -variable [itcl::scope _axis(zdirection)]1861 }1862 set _axis(zdirection) -11863 Rappture::Tooltip::for $itk_component(zDirButton) \1864 "Toggle the direction of the Z-axis cutaway"1865 1929 1866 1930 blt::table $inner \ … … 1882 1946 # 1883 1947 itcl::body Rappture::VtkStreamlinesViewer::camera {option args} { 1948 puts stderr "camera option=$option args=$args" 1884 1949 switch -- $option { 1885 1950 "show" { … … 1946 2011 } 1947 2012 } 1948 return [list . txt$bytes]2013 return [list .vtk $bytes] 1949 2014 } 1950 2015 … … 2001 2066 2002 2067 itcl::body Rappture::VtkStreamlinesViewer::SetObjectStyle { dataobj comp } { 2068 puts stderr "SetObjectStyle dataobj=$dataobj comp=$comp" 2003 2069 # Parse style string. 2004 2070 set tag $dataobj-$comp … … 2030 2096 set _seeds($dataobj) 1 2031 2097 } 2098 SendCmd "cutplane add $tag" 2099 SendCmd "cutplane colormode vmag $tag" 2100 SendCmd "cutplane edges 0 $tag" 2101 SendCmd "cutplane wireframe 0 $tag" 2102 SendCmd "cutplane lighting 1 $tag" 2103 SendCmd "cutplane linewidth 1 $tag" 2104 #SendCmd "cutplane linecolor 1 1 1 $tag" 2105 #puts stderr "cutplane axis $axis $bool" 2106 #SendCmd "cutplane visible $tag" 2107 SendCmd "cutplane colormode vmag $tag" 2108 foreach axis { x y z } { 2109 SendCmd "cutplane slice $axis 1.0 $tag" 2110 SendCmd "cutplane axis $axis 0 $tag" 2111 } 2112 2032 2113 SendCmd "polydata add $tag" 2033 2114 SendCmd "polydata edges $settings(-edges) $tag" … … 2061 2142 # ---------------------------------------------------------------------- 2062 2143 itcl::body Rappture::VtkStreamlinesViewer::ReceiveLegend { colormap title vmin vmax size } { 2063 #puts stderr "ReceiveLegend colormap=$colormap title=$title range=$vmin,$vmax size=$size"2144 puts stderr "ReceiveLegend colormap=$colormap title=$title range=$vmin,$vmax size=$size" 2064 2145 set _limits(vmin) $vmin 2065 2146 set _limits(vmax) $vmax … … 2072 2153 $_image(legend) configure -data $bytes 2073 2154 #puts stderr "read $size bytes for [image width $_image(legend)]x[image height $_image(legend)] legend>" 2074 DrawLegend 2155 DrawLegend $title 2075 2156 } 2076 2157 } … … 2082 2163 # of the contour plot area. 2083 2164 # 2084 itcl::body Rappture::VtkStreamlinesViewer::DrawLegend { } {2165 itcl::body Rappture::VtkStreamlinesViewer::DrawLegend { title } { 2085 2166 set c $itk_component(view) 2086 2167 set w [winfo width $c] … … 2092 2173 set x [expr $w - 2] 2093 2174 if { [$c find withtag "legend"] == "" } { 2094 $c create image $x [expr {$lineht+2}] \ 2175 set y 2 2176 $c create text $x $y \ 2095 2177 -anchor ne \ 2096 -image $_image(legend) -tags "colormap legend" 2097 $c create text $x 2 \ 2178 -fill $itk_option(-plotforeground) -tags "title legend" \ 2179 -font $font 2180 incr y $lineht 2181 $c create text $x $y \ 2098 2182 -anchor ne \ 2099 2183 -fill $itk_option(-plotforeground) -tags "vmax legend" \ 2100 2184 -font $font 2185 incr y $lineht 2186 $c create image $x $y \ 2187 -anchor ne \ 2188 -image $_image(legend) -tags "colormap legend" 2101 2189 $c create text $x [expr {$h-2}] \ 2102 2190 -anchor se \ … … 2108 2196 } 2109 2197 # Reset the item coordinates according the current size of the plot. 2110 $c coords colormap $x [expr {$lineht+2}]2198 $c itemconfigure title -text $title 2111 2199 if { $_limits(vmin) != "" } { 2112 2200 $c itemconfigure vmin -text [format %g $_limits(vmin)] … … 2115 2203 $c itemconfigure vmax -text [format %g $_limits(vmax)] 2116 2204 } 2117 $c coords vmin $x [expr {$h-2}] 2118 $c coords vmax $x 2 2205 set y 2 2206 puts stderr "$c coords title $x $y" 2207 $c coords title $x $y 2208 incr y $lineht 2209 $c coords vmax $x $y 2210 puts stderr "$c coords vmin $x $y" 2211 incr y $lineht 2212 $c coords colormap $x $y 2213 puts stderr "$c coords vmin $x [expr {$h - 2}]" 2214 $c coords vmin $x [expr {$h - 2}] 2119 2215 } 2120 2216 } … … 2157 2253 set coords [$c coords colormap] 2158 2254 set imgX [expr $w - [image width $_image(legend)] - 2] 2159 set imgY [expr $y - $lineht - 2]2255 set imgY [expr $y - 2 * ($lineht + 2)] 2160 2256 2161 2257 # Make a swatch of the selected color … … 2202 2298 } 2203 2299 set newpos [expr {0.01*$newval}] 2204 SendCmd " renderer clipplane $axis $newpos -1"2300 SendCmd "cutplane slice $axis $newpos" 2205 2301 } 2206 2302 "tooltip" {
Note: See TracChangeset
for help on using the changeset viewer.