- Timestamp:
- Sep 4, 2011, 7:21:41 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gui/scripts/vtkviewer.tcl
r2473 r2474 97 97 private method SetStyles { dataobj comp } 98 98 private method RequestLegend {} 99 private method EnterLegend { x y } 100 private method MotionLegend { x y } 101 private method LeaveLegend {} 102 private method SetLegendMark { x y } 99 103 100 104 private variable _arcball "" … … 116 120 private variable _limits ;# autoscale min/max for all axes 117 121 private variable _view ;# view params for 3D view 118 private common _settings 122 private variable _settings 123 private variable _volume 124 private variable _axis 125 private variable _streamlines 119 126 private variable _reset 1 ;# indicates if camera needs to be reset 120 127 # to starting position. … … 124 131 private variable _start 0 125 132 private variable _buffering 0 126 133 private variable _title "" 134 127 135 common _downloadPopup ;# download options from popup 128 136 private common _hardcopy … … 185 193 set _limits(zmax) 1.0 186 194 195 array set _axis [subst { 196 grid-x 0 197 grid-y 0 198 grid-z 0 199 visible 1 200 }] 201 array set _volume [subst { 202 edges 1 203 lighting 1 204 opacity 40 205 visible 1 206 wireframe 0 207 }] 208 array set _streamlines [subst { 209 seeds 0 210 visible 1 211 opacity 100 212 }] 187 213 array set _settings [subst { 188 $this-axes 1 189 $this-legend 1 190 $this-seeds 1 191 $this-streamlines 1 192 $this-edges 1 193 $this-lighting 1 194 $this-opacity 100 195 $this-volume 1 196 $this-wireframe 0 197 $this-grid-x 0 198 $this-grid-y 0 199 $this-grid-z 0 214 legend 1 200 215 }] 201 216 … … 264 279 Rappture::Tooltip::for $itk_component(zoomout) "Zoom out" 265 280 281 if { [catch { 266 282 BuildVolumeTab 283 BuildStreamsTab 267 284 BuildAxisTab 268 BuildStreamsTab269 285 BuildCameraTab 270 286 } errs] != 0 } { 287 puts stderr errs=$errs 288 } 271 289 # Legend 272 290 273 291 set _image(legend) [image create photo] 274 292 itk_component add legend { 275 canvas $itk_component(plotarea).legend -width 50 -highlightthickness 0 293 canvas $itk_component(plotarea).legend -width 50 -highlightthickness 0 276 294 } { 277 295 usual … … 349 367 350 368 eval itk_initialize $args 351 352 369 Connect 353 370 } … … 362 379 image delete $_image(plot) 363 380 image delete $_image(download) 364 array unset _settings $this-*365 381 catch { blt::arcball destroy $_arcball } 366 382 } … … 865 881 } 866 882 867 FixSettings opacity grid-x grid-y grid-z volume lighting \ 868 wireframe axes edges seeds streamlines axismode 883 FixSettings axis-grid-x axis-grid-y axis-grid-z axis-mode axis-visible \ 884 streamlines-seeds streamlines-visible streamlines-opacity \ 885 volume-edges volume-lighting volume-opacity volume-visible \ 886 volume-wireframe 869 887 870 888 if { !$_haveStreams } { … … 1117 1135 } 1118 1136 switch -- $what { 1119 " opacity" {1120 set val $_ settings($this-opacity)1137 "volume-opacity" { 1138 set val $_volume(opacity) 1121 1139 set sval [expr { 0.01 * double($val) }] 1122 1140 foreach dataset [CurrentDatasets -visible $_first] { … … 1124 1142 } 1125 1143 } 1126 " wireframe" {1127 set bool $_ settings($this-wireframe)1144 "volume-wireframe" { 1145 set bool $_volume(wireframe) 1128 1146 foreach dataset [CurrentDatasets -visible $_first] { 1129 1147 SendCmd "polydata wireframe $bool $dataset" 1130 1148 } 1131 1149 } 1132 "volume " {1133 set bool $_ settings($this-volume)1150 "volume-visible" { 1151 set bool $_volume(visible) 1134 1152 foreach dataset [CurrentDatasets -visible $_first] { 1135 1153 SendCmd "polydata visible $bool $dataset" 1136 1154 } 1137 1155 } 1138 " lighting" {1139 set bool $_ settings($this-lighting)1156 "volume-lighting" { 1157 set bool $_volume(lighting) 1140 1158 foreach dataset [CurrentDatasets -visible $_first] { 1141 1159 SendCmd "polydata lighting $bool $dataset" 1142 1160 } 1143 1161 } 1144 "grid-x" { 1145 set bool $_settings($this-grid-x) 1146 SendCmd "axis grid x $bool" 1147 } 1148 "grid-y" { 1149 set bool $_settings($this-grid-y) 1150 SendCmd "axis grid y $bool" 1151 } 1152 "grid-z" { 1153 set bool $_settings($this-grid-z) 1154 SendCmd "axis grid z $bool" 1155 } 1156 "axes" { 1157 set bool $_settings($this-axes) 1158 SendCmd "axis visible all $bool" 1159 } 1160 "axismode" { 1161 set mode [$itk_component(axismode) value] 1162 set mode [$itk_component(axismode) translate $mode] 1163 SendCmd "axis flymode $mode" 1164 } 1165 "edges" { 1166 set bool $_settings($this-edges) 1162 "volume-edges" { 1163 set bool $_volume(edges) 1167 1164 foreach dataset [CurrentDatasets -visible $_first] { 1168 1165 foreach {dataobj comp} [split $dataset -] break … … 1172 1169 } 1173 1170 } 1174 "seeds" { 1175 set bool $_settings($this-seeds) 1171 "axis-visible" { 1172 set bool $_axis(visible) 1173 SendCmd "axis visible all $bool" 1174 } 1175 "axis-grid-x" { 1176 set bool $_axis(grid-x) 1177 SendCmd "axis grid x $bool" 1178 } 1179 "axis-grid-y" { 1180 set bool $_axis(grid-y) 1181 SendCmd "axis grid y $bool" 1182 } 1183 "axis-grid-z" { 1184 set bool $_axis(grid-z) 1185 SendCmd "axis grid z $bool" 1186 } 1187 "axis-mode" { 1188 set mode [$itk_component(axismode) value] 1189 set mode [$itk_component(axismode) translate $mode] 1190 SendCmd "axis flymode $mode" 1191 } 1192 "streamlines-seeds" { 1193 set bool $_streamlines(seeds) 1176 1194 foreach dataset [CurrentDatasets -visible $_first] { 1177 1195 foreach {dataobj comp} [split $dataset -] break … … 1181 1199 } 1182 1200 } 1183 "streamlines " {1184 set bool $_s ettings($this-streamlines)1201 "streamlines-visible" { 1202 set bool $_streamlines(visible) 1185 1203 foreach dataset [CurrentDatasets -visible $_first] { 1186 1204 foreach {dataobj comp} [split $dataset -] break 1187 1205 if { [$dataobj type $comp] == "streamlines" } { 1188 if { $bool } { 1189 SendCmd "streamlines add $dataset" 1190 } else { 1191 SendCmd "streamlines delete $dataset" 1192 } 1206 SendCmd "streamlines visible $bool $dataset" 1193 1207 } 1194 1208 } 1195 1209 } 1196 "stream mode" {1210 "streamlines-mode" { 1197 1211 set mode [$itk_component(streammode) value] 1198 1212 foreach dataset [CurrentDatasets -visible $_first] { … … 1204 1218 } 1205 1219 "ribbons" { 1206 SendCmd "streamlines ribbons 3.0 20 $dataset"1220 SendCmd "streamlines ribbons 1 0 $dataset" 1207 1221 } 1208 1222 "tubes" { 1209 SendCmd "streamlines tubes 20 10$dataset"1223 SendCmd "streamlines tubes 5 1 $dataset" 1210 1224 } 1211 1225 } … … 1213 1227 } 1214 1228 } 1229 "streamlines-opacity" { 1230 set val $_streamlines(opacity) 1231 set sval [expr { 0.01 * double($val) }] 1232 foreach dataset [CurrentDatasets -visible $_first] { 1233 SendCmd "streamlines opacity $sval $dataset" 1234 } 1235 } 1215 1236 default { 1216 1237 error "don't know how to fix $what" … … 1230 1251 set lineht [font metrics $itk_option(-font) -linespace] 1231 1252 set c $itk_component(legend) 1232 set w [expr {$_height-20}] 1233 set h 45; # Hard coding height of legend 1234 1235 if { $w == 0} { 1253 set w 20 1254 set h [expr {$_height - 2 * $lineht}] 1255 if { $h < 1} { 1236 1256 return 1237 1257 } … … 1299 1319 set cmap "0.0 0.0 0.0 0.0 1.0 1.0 1.0 1.0" 1300 1320 } 1301 set tag $this-$colormap 1302 if { ![info exists _settings($tag-opacity)] } { 1303 set _settings($tag-opacity) $style(-opacity) 1304 } 1305 set max $_settings($tag-opacity) 1321 if { ![info exists _volume(opacity)] } { 1322 set _volume(opacity) $style(-opacity) 1323 } 1324 set max $_volume(opacity) 1306 1325 1307 1326 set wmap "0.0 1.0 1.0 1.0" … … 1380 1399 1381 1400 checkbutton $inner.volume \ 1382 -text " Visible" \1383 -variable [itcl::scope _ settings($this-volume)] \1384 -command [itcl::code $this AdjustSetting volume ] \1401 -text "Show Volume" \ 1402 -variable [itcl::scope _volume(visible)] \ 1403 -command [itcl::code $this AdjustSetting volume-visible] \ 1385 1404 -font "Arial 9" 1386 1405 1387 1406 checkbutton $inner.wireframe \ 1388 -text " Wireframe" \1389 -variable [itcl::scope _ settings($this-wireframe)] \1390 -command [itcl::code $this AdjustSetting wireframe] \1407 -text "Show Wireframe" \ 1408 -variable [itcl::scope _volume(wireframe)] \ 1409 -command [itcl::code $this AdjustSetting volume-wireframe] \ 1391 1410 -font "Arial 9" 1392 1411 1393 1412 checkbutton $inner.lighting \ 1394 -text " Lighting" \1395 -variable [itcl::scope _ settings($this-lighting)] \1396 -command [itcl::code $this AdjustSetting lighting] \1413 -text "Enable Lighting" \ 1414 -variable [itcl::scope _volume(lighting)] \ 1415 -command [itcl::code $this AdjustSetting volume-lighting] \ 1397 1416 -font "Arial 9" 1398 1417 1399 1418 checkbutton $inner.edges \ 1400 -text " Edges" \1401 -variable [itcl::scope _ settings($this-edges)] \1402 -command [itcl::code $this AdjustSetting edges] \1419 -text "Show Edges" \ 1420 -variable [itcl::scope _volume(edges)] \ 1421 -command [itcl::code $this AdjustSetting volume-edges] \ 1403 1422 -font "Arial 9" 1404 1423 1405 1424 label $inner.opacity_l -text "Opacity" -font "Arial 9" 1406 1425 ::scale $inner.opacity -from 0 -to 100 -orient horizontal \ 1407 -variable [itcl::scope _ settings($this-opacity)] \1426 -variable [itcl::scope _volume(opacity)] \ 1408 1427 -width 10 \ 1409 -showvalue off -command [itcl::code $this AdjustSetting opacity] 1428 -showvalue off \ 1429 -command [itcl::code $this AdjustSetting volume-opacity] 1410 1430 1411 1431 blt::table $inner \ 1412 0,0 $inner.volume -columnspan 4-anchor w -pady 2 \1413 1,0 $inner.wireframe - columnspan 4 -anchor w -pady 2 \1414 2,0 $inner.lighting - columnspan 4 -anchor w\1415 3,0 $inner.edges -columnspan 4-anchor w -pady 2 \1432 0,0 $inner.volume -anchor w -pady 2 \ 1433 1,0 $inner.wireframe -anchor w -pady 2 \ 1434 2,0 $inner.lighting -anchor w -pady 2 \ 1435 3,0 $inner.edges -anchor w -pady 2 \ 1416 1436 4,0 $inner.opacity_l -anchor w -pady 2 \ 1417 5,0 $inner.opacity -columnspan 2 -pady 2 -fill x1418 1419 blt::table configure $inner r* -resize none1420 blt::table configure $inner r6 -resize expand1437 5,0 $inner.opacity -fill x -pady 2 1438 1439 blt::table configure $inner r* c* -resize none 1440 blt::table configure $inner r6 c1 -resize expand 1421 1441 } 1422 1442 … … 1433 1453 1434 1454 checkbutton $inner.streamlines \ 1435 -text " Visible" \1436 -variable [itcl::scope _s ettings($this-streamlines)] \1437 -command [itcl::code $this AdjustSetting streamlines ] \1455 -text "Show Streamlines" \ 1456 -variable [itcl::scope _streamlines(visible)] \ 1457 -command [itcl::code $this AdjustSetting streamlines-visible] \ 1438 1458 -font "Arial 9" 1439 1459 1440 1460 checkbutton $inner.seeds \ 1441 -text "Show seeds" \1442 -variable [itcl::scope _s ettings($this-seeds)] \1443 -command [itcl::code $this AdjustSetting s eeds] \1461 -text "Show Seeds" \ 1462 -variable [itcl::scope _streamlines(seeds)] \ 1463 -command [itcl::code $this AdjustSetting streamlines-seeds] \ 1444 1464 -font "Arial 9" 1445 1465 1446 label $inner.streammode -text "Mode" \ 1447 -font "Arial 9" 1448 1466 label $inner.mode_l -text "Mode" -font "Arial 9" 1449 1467 itk_component add streammode { 1450 Rappture::Combobox $inner. streammode_combo-width 10 -editable no1451 } 1452 $inner. streammode_combochoices insert end \1468 Rappture::Combobox $inner.mode -width 10 -editable no 1469 } 1470 $inner.mode choices insert end \ 1453 1471 "lines" "lines" \ 1454 1472 "ribbons" "ribbons" \ 1455 1473 "tubes" "tubes" 1456 1474 $itk_component(streammode) value "lines" 1457 bind $inner.streammode_combo <<Value>> \ 1458 [itcl::code $this AdjustSetting streammode] 1475 bind $inner.mode <<Value>> [itcl::code $this AdjustSetting streamlines-mode] 1459 1476 1460 1477 label $inner.opacity_l -text "Opacity" -font "Arial 9" 1461 1478 ::scale $inner.opacity -from 0 -to 100 -orient horizontal \ 1462 -variable [itcl::scope _s ettings($this-opacity)] \1479 -variable [itcl::scope _streamlines(opacity)] \ 1463 1480 -width 10 \ 1464 -showvalue off -command [itcl::code $this AdjustSetting opacity] 1481 -showvalue off \ 1482 -command [itcl::code $this AdjustSetting streamlines-opacity] 1465 1483 1466 1484 blt::table $inner \ 1467 0,0 $inner.streamlines - columnspan 4 -anchor w -pady2 \1468 1,0 $inner.seeds -columnspan 4 -anchor w -pady2 \1469 2,0 $inner. streammode -anchor w -pady 2\1470 2,1 $inner. streammode_combo -cspan 3 -anchor w -pady 2\1471 3,0 $inner.opacity_l -pady 2 -fill x\1472 4,0 $inner.opacity -columnspan 2 -pady 2 -fill x1473 1474 blt::table configure $inner r* -resize none1475 blt::table configure $inner r5 -resize expand1485 0,0 $inner.streamlines -anchor w -pady 2 -cspan 2 \ 1486 1,0 $inner.seeds -anchor w -pady 2 -cspan 2 \ 1487 2,0 $inner.mode_l -anchor w -pady 2 \ 1488 2,1 $inner.mode -anchor w -pady 2 \ 1489 3,0 $inner.opacity_l -anchor w -pady 2 \ 1490 4,0 $inner.opacity -fill x -pady 2 -cspan 2 1491 1492 blt::table configure $inner r* c* -resize none 1493 blt::table configure $inner r5 c1 c2 -resize expand 1476 1494 } 1477 1495 … … 1486 1504 $inner configure -borderwidth 4 1487 1505 1488 checkbutton $inner. axes\1489 -text " Visible" \1490 -variable [itcl::scope _ settings($this-axes)] \1491 -command [itcl::code $this AdjustSetting ax es] \1506 checkbutton $inner.visible \ 1507 -text "Show Axes" \ 1508 -variable [itcl::scope _axis(visible)] \ 1509 -command [itcl::code $this AdjustSetting axis-visible] \ 1492 1510 -font "Arial 9" 1493 1511 1494 label $inner.grid -text "Grid" -font "Arial 9" 1495 set f [frame $inner.gridf] 1496 checkbutton $f.x \ 1497 -text "X" \ 1498 -variable [itcl::scope _settings($this-grid-x)] \ 1499 -command [itcl::code $this AdjustSetting grid-x] \ 1512 checkbutton $inner.gridx \ 1513 -text "Show X Grid" \ 1514 -variable [itcl::scope _axis(grid-x)] \ 1515 -command [itcl::code $this AdjustSetting axis-grid-x] \ 1500 1516 -font "Arial 9" 1501 checkbutton $ f.y \1502 -text " Y" \1503 -variable [itcl::scope _ settings($this-grid-y)] \1504 -command [itcl::code $this AdjustSetting grid-y] \1517 checkbutton $inner.gridy \ 1518 -text "Show Y Grid" \ 1519 -variable [itcl::scope _axis(grid-y)] \ 1520 -command [itcl::code $this AdjustSetting axis-grid-y] \ 1505 1521 -font "Arial 9" 1506 checkbutton $ f.z \1507 -text " Z" \1508 -variable [itcl::scope _ settings($this-grid-z)] \1509 -command [itcl::code $this AdjustSetting grid-z] \1522 checkbutton $inner.gridz \ 1523 -text "Show Z Grid" \ 1524 -variable [itcl::scope _axis(grid-z)] \ 1525 -command [itcl::code $this AdjustSetting axis-grid-z] \ 1510 1526 -font "Arial 9" 1511 pack $f.x $f.y $f.z -side left 1512 1513 label $inner.axismode -text "Mode" \ 1514 -font "Arial 9" 1527 1528 label $inner.mode_l -text "Mode" -font "Arial 9" 1515 1529 1516 1530 itk_component add axismode { 1517 Rappture::Combobox $inner. axismode_combo-width 10 -editable no1518 } 1519 $inner. axismode_combochoices insert end \1531 Rappture::Combobox $inner.mode -width 10 -editable no 1532 } 1533 $inner.mode choices insert end \ 1520 1534 "static_triad" "static" \ 1521 1535 "closest_triad" "closest" \ … … 1523 1537 "outer_edges" "outer" 1524 1538 $itk_component(axismode) value "outer" 1525 bind $inner.axismode_combo <<Value>> \ 1526 [itcl::code $this AdjustSetting axismode] 1539 bind $inner.mode <<Value>> [itcl::code $this AdjustSetting axis-mode] 1527 1540 1528 1541 blt::table $inner \ 1529 0,0 $inner.axes -columnspan 4 -anchor w -pady 2 \ 1530 1,0 $inner.axismode -anchor w -pady 2 \ 1531 1,1 $inner.axismode_combo -cspan 3 -anchor w -pady 2 \ 1532 2,0 $inner.grid -anchor w -pady 2 \ 1533 2,1 $inner.gridf -anchor w -cspan 3 -fill x 1534 1535 blt::table configure $inner r* -resize none 1536 blt::table configure $inner r3 -resize expand 1542 0,0 $inner.visible -anchor w -pady 2 -cspan 2 \ 1543 1,0 $inner.gridx -anchor w -pady 2 -cspan 2 \ 1544 2,0 $inner.gridy -anchor w -pady 2 -cspan 2 \ 1545 3,0 $inner.gridz -anchor w -pady 2 -cspan 2 \ 1546 4,0 $inner.mode_l -anchor w -pady 2 \ 1547 4,1 $inner.mode -fill x -pady 2 1548 1549 blt::table configure $inner r* c* -resize none 1550 blt::table configure $inner r5 c2 -resize expand 1537 1551 } 1538 1552 … … 1558 1572 } 1559 1573 checkbutton $inner.ortho \ 1560 -text "Orthogr pahic" \1574 -text "Orthographic Projection" \ 1561 1575 -variable [itcl::scope _view(ortho)] \ 1562 1576 -command [itcl::code $this camera set ortho] \ … … 1737 1751 } 1738 1752 SendCmd "polydata wireframe $props(-wireframe) $tag" 1739 set _ settings($this-opacity) [expr $props(-opacity) * 100.0]1753 set _volume(opacity) [expr $props(-opacity) * 100.0] 1740 1754 } 1741 1755 … … 1756 1770 itcl::body Rappture::VtkViewer::ReceiveLegend { colormap title vmin vmax size } { 1757 1771 #puts stderr "ReceiveLegend colormap=$colormap title=$title range=$vmin,$vmax size=$size" 1772 set _limits(vmin) $vmin 1773 set _limits(vmax) $vmax 1774 set _title $title 1758 1775 if { [IsConnected] } { 1759 1776 set bytes [ReceiveBytes $size] … … 1762 1779 } 1763 1780 #puts stderr "read $size bytes for [image width $_image(legend)]x[image height $_image(legend)] legend>" 1764 set src [image create photo -data $bytes] 1765 blt::winop image rotate $src $_image(legend) 90 1766 set dst $_image(legend) 1781 set _image(legend) [image create photo -data $bytes] 1767 1782 DrawLegend 1768 1783 } … … 1781 1796 set lineht [font metrics $itk_option(-font) -linespace] 1782 1797 1783 if { $_settings( $this-legend) } {1784 set x 21798 if { $_settings(legend) } { 1799 set x [expr $w - 2] 1785 1800 if { [$c find withtag "legend"] == "" } { 1786 $c create image $x [expr {$lineht+2}] -anchor nw \ 1787 -image $_image(legend) -tags "transfunc legend" 1788 $c create text $x 2 -anchor nw \ 1789 -fill $itk_option(-plotforeground) -tags "zmax legend" \ 1801 $c create image $x [expr {$lineht+2}] \ 1802 -anchor ne \ 1803 -image $_image(legend) -tags "colormap legend" 1804 $c create text $x 2 \ 1805 -anchor ne \ 1806 -fill $itk_option(-plotforeground) -tags "vmax legend" \ 1807 -font "Arial 6" 1808 $c create text $x [expr {$h-2}] \ 1809 -anchor se \ 1810 -fill $itk_option(-plotforeground) -tags "vmin legend" \ 1790 1811 -font "Arial 6" 1791 $c create text $x [expr {$h-2}] -anchor sw \1792 -fill $itk_option(-plotforeground) -tags "zmin legend" \1793 -font "Arial 6"1812 #$c bind colormap <Enter> [itcl::code $this EnterLegend %x %y] 1813 $c bind colormap <Leave> [itcl::code $this LeaveLegend] 1814 $c bind colormap <Motion> [itcl::code $this MotionLegend %x %y] 1794 1815 } 1795 1816 # Reset the item coordinates according the current size of the plot. 1796 $c coords transfunc$x [expr {$lineht+2}]1797 if { $_limits( zmin) != "" } {1798 $c itemconfigure zmin -text [format %g $_limits(zmin)]1799 } 1800 if { $_limits( zmax) != "" } {1801 $c itemconfigure zmax -text [format %g $_limits(zmax)]1817 $c coords colormap $x [expr {$lineht+2}] 1818 if { $_limits(vmin) != "" } { 1819 $c itemconfigure vmin -text [format %g $_limits(vmin)] 1820 } 1821 if { $_limits(vmax) != "" } { 1822 $c itemconfigure vmax -text [format %g $_limits(vmax)] 1802 1823 } 1803 1824 $c coords zmin $x [expr {$h-2}] … … 1805 1826 } 1806 1827 } 1828 1829 # 1830 # EnterLegend -- 1831 # 1832 itcl::body Rappture::VtkViewer::EnterLegend { x y } { 1833 SetLegendMark $x $y 1834 } 1835 1836 # 1837 # MotionLegend -- 1838 # 1839 itcl::body Rappture::VtkViewer::MotionLegend { x y } { 1840 Rappture::Tooltip::tooltip cancel 1841 set c $itk_component(view) 1842 $c delete mark 1843 SetLegendMark $x $y 1844 } 1845 1846 # 1847 # LeaveLegend -- 1848 # 1849 itcl::body Rappture::VtkViewer::LeaveLegend { } { 1850 Rappture::Tooltip::tooltip cancel 1851 #set c $itk_component(view) 1852 #$c delete mark 1853 } 1854 1855 # 1856 # SetLegendMark -- 1857 # 1858 itcl::body Rappture::VtkViewer::SetLegendMark { x y } { 1859 set c $itk_component(view) 1860 set w [winfo width $c] 1861 set h [winfo height $c] 1862 1863 set imgHeight [image height $_image(legend)] 1864 set coords [$c coords colormap] 1865 set imgX [expr $w - [image width $_image(legend)] - 2] 1866 set imgY [expr $y - 2] 1867 1868 if 0 { 1869 # Make a swatch of the selected color 1870 set pixel [image get 0 $imgY] 1871 set swatch [image create photo -width 20 -height 20] 1872 $swatch puts $pixel -to 0 0 19 19 1873 } 1874 # Create a line over the spot 1875 $c create line [expr $w - 27] $y [expr $w - 2] $y -fill black \ 1876 -tags "legend mark" 1877 1878 # Compute the value of the point 1879 set t [expr 1.0 - (double($imgY) / double($imgHeight))] 1880 #puts stderr "t=$t x=$x y=$y" 1881 set value [expr $t * ($_limits(vmax) - $_limits(vmin)) + $_limits(vmin)] 1882 set tipx [expr $x + 15] 1883 set tipy [expr $y - 5] 1884 #puts stderr "tipx=$tipx tipy=$tipy x=$x y=$y" 1885 Rappture::Tooltip::text $c "$_title $value" 1886 Rappture::Tooltip::tooltip show $c +$tipx,+$tipy 1887 }
Note: See TracChangeset
for help on using the changeset viewer.