Changeset 4919 for branches/r9/gui/scripts/vtkglyphviewer.tcl
- Timestamp:
- Jan 4, 2015, 6:52:23 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/r9/gui/scripts/vtkglyphviewer.tcl
r4344 r4919 118 118 # heightmaps displayed. 119 119 private variable _currentColormap "" 120 private variable _currentOpacity ""121 120 122 121 private variable _dataset2style ;# maps dataobj-component to transfunc … … 183 182 $_dispatcher register !xcutplane 184 183 $_dispatcher dispatch $this !xcutplane \ 185 "[itcl::code $this AdjustSetting cutplaneXPosition]; list"184 "[itcl::code $this AdjustSetting -cutplanexposition]; list" 186 185 187 186 # Y-Cutplane event 188 187 $_dispatcher register !ycutplane 189 188 $_dispatcher dispatch $this !ycutplane \ 190 "[itcl::code $this AdjustSetting cutplaneYPosition]; list"189 "[itcl::code $this AdjustSetting -cutplaneyposition]; list" 191 190 192 191 # Z-Cutplane event 193 192 $_dispatcher register !zcutplane 194 193 $_dispatcher dispatch $this !zcutplane \ 195 "[itcl::code $this AdjustSetting cutplaneZPosition]; list"194 "[itcl::code $this AdjustSetting -cutplanezposition]; list" 196 195 197 196 # … … 218 217 219 218 array set _settings [subst { 220 background black 221 colormap BCGYR 222 colormapVisible 1 223 field "Default" 224 axesVisible 1 225 axisLabelsVisible 1 226 axisXGrid 0 227 axisYGrid 0 228 axisZGrid 0 229 cutplaneEdges 0 230 cutplaneLighting 1 231 cutplanePreinterp 1 232 cutplaneOpacity 100 233 cutplaneVisible 0 234 cutplaneWireframe 0 235 cutplaneXPosition 50 236 cutplaneXVisible 1 237 cutplaneYPosition 50 238 cutplaneYVisible 1 239 cutplaneZPosition 50 240 cutplaneZVisible 1 241 glyphEdges 0 242 glyphLighting 1 243 glyphNormscale 1 244 glyphOpacity 100 245 saveGlyphOpacity 100 246 glyphOrient 1 247 glyphOutline 0 248 glyphScale 1 249 glyphScaleMode "vmag" 250 glyphShape "arrow" 251 glyphVisible 1 252 glyphWireframe 0 253 legendVisible 1 219 -axesvisible 1 220 -axislabels 1 221 -axisminorticks 1 222 -axismode "static" 223 -background black 224 -colormap BCGYR 225 -colormapvisible 1 226 -cutplaneedges 0 227 -cutplanelighting 1 228 -cutplanepreinterp 1 229 -cutplaneopacity 100 230 -cutplanevisible 0 231 -cutplanewireframe 0 232 -cutplanexposition 50 233 -cutplanexvisible 1 234 -cutplaneyposition 50 235 -cutplaneyvisible 1 236 -cutplanezposition 50 237 -cutplanezvisible 1 238 -field "Default" 239 -glyphedges 0 240 -glyphlighting 1 241 -glyphopacity 100 242 -glyphoutline 0 243 -glyphscale 1 244 -glyphvisible 1 245 -glyphwireframe 0 246 -legendvisible 1 247 -saveglyphopacity 100 248 -xgrid 0 249 -ygrid 0 250 -zgrid 0 254 251 }] 255 252 array set _changed { 256 glyphOpacity0257 colormap0253 -colormap 0 254 -glyphopacity 0 258 255 } 259 256 … … 335 332 -onimage [Rappture::icon volume-on] \ 336 333 -offimage [Rappture::icon volume-off] \ 337 -variable [itcl::scope _settings( glyphVisible)] \338 -command [itcl::code $this AdjustSetting glyphVisible]334 -variable [itcl::scope _settings(-glyphvisible)] \ 335 -command [itcl::code $this AdjustSetting -glyphvisible] 339 336 } 340 337 $itk_component(glyphs) select … … 348 345 -onimage [Rappture::icon cutbutton] \ 349 346 -offimage [Rappture::icon cutbutton] \ 350 -variable [itcl::scope _settings( cutplaneVisible)] \351 -command [itcl::code $this AdjustSetting cutplaneVisible]347 -variable [itcl::scope _settings(-cutplanevisible)] \ 348 -command [itcl::code $this AdjustSetting -cutplanevisible] 352 349 } 353 350 Rappture::Tooltip::for $itk_component(cutplane) \ … … 439 436 eval itk_initialize $args 440 437 Connect 441 update442 438 } 443 439 … … 547 543 } 548 544 549 550 545 # ---------------------------------------------------------------------- 551 546 # USAGE: delete ?<dataobj1> <dataobj2> ...? 552 547 # 553 # 554 # 555 # 548 # Clients use this to delete a dataobj from the plot. If no dataobjs 549 # are specified, then all dataobjs are deleted. No data objects are 550 # deleted. They are only removed from the display list. 556 551 # 557 552 # ---------------------------------------------------------------------- … … 782 777 set session $env(SESSION) 783 778 } 779 lappend info "version" "$Rappture::version" 780 lappend info "build" "$Rappture::build" 781 lappend info "svnurl" "$Rappture::svnurl" 782 lappend info "installdir" "$Rappture::installdir" 784 783 lappend info "hub" [exec hostname] 785 784 lappend info "client" "vtkglyphviewer" … … 799 798 # isconnected -- 800 799 # 801 # 800 # Indicates if we are currently connected to the visualization server. 802 801 # 803 802 itcl::body Rappture::VtkGlyphViewer::isconnected {} { … … 816 815 # Disconnect -- 817 816 # 818 # 819 # 817 # Clients use this method to disconnect from the current rendering 818 # server. 820 819 # 821 820 itcl::body Rappture::VtkGlyphViewer::Disconnect {} { … … 955 954 PanCamera 956 955 set _first "" 957 InitSettings axisXGrid axisYGrid axisZGrid axisMode \958 axesVisible axisLabelsVisible956 InitSettings -xgrid -ygrid -zgrid -axismode \ 957 -axesvisible -axislabels -axisminorticks 959 958 foreach axis { x y z } { 960 959 SendCmd "axis lformat $axis %g" … … 975 974 if { ![info exists _datasets($tag)] } { 976 975 set bytes [$dataobj vtkdata $comp] 977 978 979 980 976 if 0 { 977 set f [open "/tmp/glyph.vtk" "w"] 978 puts $f $bytes 979 close $f 981 980 } 982 981 set length [string length $bytes] … … 992 991 SendCmd "clientinfo [list $info]" 993 992 } 994 append _outbuf "dataset add $tag data follows $length\n"993 SendCmd "dataset add $tag data follows $length" 995 994 append _outbuf $bytes 996 995 set _datasets($tag) 1 … … 1001 1000 # Setting dataset visible enables outline 1002 1001 # and glyphs 1003 1002 SendCmd "dataset visible 1 $tag" 1004 1003 } 1005 1004 } … … 1007 1006 1008 1007 if { $_first != "" } { 1009 1010 1011 1008 $itk_component(field) choices delete 0 end 1009 $itk_component(fieldmenu) delete 0 end 1010 array unset _fields 1012 1011 set _curFldName "" 1013 1012 foreach cname [$_first components] { … … 1035 1034 $itk_component(field) value $_curFldLabel 1036 1035 } 1037 InitSettings glyphOutline1038 # cutplaneVisible1036 InitSettings -glyphoutline 1037 #-cutplanevisible 1039 1038 if { $_reset } { 1040 1039 # These are settings that rely on a dataset being loaded. 1041 1040 InitSettings \ 1042 glyphLighting \1043 field \1044 glyphEdges glyphLighting glyphOpacity \1045 glyphWireframe1046 1047 # cutplaneXPosition cutplaneYPosition cutplaneZPosition \1048 cutplaneXVisible cutplaneYVisible cutplaneZVisible \1049 cutplanePreinterp1041 -glyphlighting \ 1042 -field \ 1043 -glyphedges -glyphlighting -glyphopacity \ 1044 -glyphwireframe 1045 1046 #-cutplanexposition -cutplaneyposition -cutplanezposition \ 1047 -cutplanexvisible -cutplaneyvisible -cutplanezvisible \ 1048 -cutplanepreinterp 1050 1049 1051 1050 Zoom reset 1052 1051 foreach axis { x y z } { 1053 1052 # Another problem fixed by a <view>. We looking into a data 1054 1053 # object for the name of the axes. This should be global to 1055 1054 # the viewer itself. 1056 1057 1055 set label [$_first hints ${axis}label] 1056 if { $label == "" } { 1058 1057 set label [string toupper $axis] 1059 1060 1061 1058 } 1059 # May be a space in the axis label. 1060 SendCmd [list axis name $axis $label] 1062 1061 } 1063 1062 if { [array size _fields] < 2 } { 1064 blt::table forget $itk_component(field) $itk_component(field_l)1063 catch {blt::table forget $itk_component(field) $itk_component(field_l)} 1065 1064 } 1066 1065 set _reset 0 … … 1166 1165 SendCmd "camera pan $x $y" 1167 1166 } 1168 1169 1167 1170 1168 # ---------------------------------------------------------------------- … … 1287 1285 itcl::body Rappture::VtkGlyphViewer::InitSettings { args } { 1288 1286 foreach spec $args { 1289 if { [info exists _settings($_first -$spec)] } {1287 if { [info exists _settings($_first${spec})] } { 1290 1288 # Reset global setting with dataobj specific setting 1291 set _settings($spec) $_settings($_first -$spec)1289 set _settings($spec) $_settings($_first${spec}) 1292 1290 } 1293 1291 AdjustSetting $spec … … 1298 1296 # AdjustSetting -- 1299 1297 # 1300 # 1301 # 1302 # 1298 # Changes/updates a specific setting in the widget. There are 1299 # usually user-setable option. Commands are sent to the render 1300 # server. 1303 1301 # 1304 1302 itcl::body Rappture::VtkGlyphViewer::AdjustSetting {what {value ""}} { … … 1307 1305 } 1308 1306 switch -- $what { 1309 " background" {1307 "-background" { 1310 1308 set bgcolor [$itk_component(background) value] 1311 1312 1313 1314 "grey""black"1315 1309 array set fgcolors { 1310 "black" "white" 1311 "white" "black" 1312 "grey" "black" 1313 } 1316 1314 configure -plotbackground $bgcolor \ 1317 1318 1319 1320 } 1321 " axesVisible" {1322 set bool $_settings( axesVisible)1315 -plotforeground $fgcolors($bgcolor) 1316 $itk_component(view) delete "legend" 1317 DrawLegend 1318 } 1319 "-axesvisible" { 1320 set bool $_settings($what) 1323 1321 SendCmd "axis visible all $bool" 1324 1322 } 1325 " axisLabelsVisible" {1326 set bool $_settings( axisLabelsVisible)1323 "-axislabels" { 1324 set bool $_settings($what) 1327 1325 SendCmd "axis labels all $bool" 1328 1326 } 1329 "axisXGrid" - "axisYGrid" - "axisZGrid" { 1330 set axis [string tolower [string range $what 4 4]] 1327 "-axisminorticks" { 1328 set bool $_settings($what) 1329 SendCmd "axis minticks all $bool" 1330 } 1331 "-xgrid" - "-ygrid" - "-zgrid" { 1332 set axis [string tolower [string range $what 1 1]] 1331 1333 set bool $_settings($what) 1332 1334 SendCmd "axis grid $axis $bool" 1333 1335 } 1334 " axisMode" {1336 "-axismode" { 1335 1337 set mode [$itk_component(axisMode) value] 1336 1338 set mode [$itk_component(axisMode) translate $mode] … … 1338 1340 SendCmd "axis flymode $mode" 1339 1341 } 1340 " cutplaneEdges" {1342 "-cutplaneedges" { 1341 1343 set bool $_settings($what) 1342 1344 SendCmd "cutplane edges $bool" 1343 1345 } 1344 " cutplaneVisible" {1346 "-cutplanevisible" { 1345 1347 set bool $_settings($what) 1346 1348 SendCmd "cutplane visible $bool" 1347 1349 } 1348 " cutplaneWireframe" {1350 "-cutplanewireframe" { 1349 1351 set bool $_settings($what) 1350 1352 SendCmd "cutplane wireframe $bool" 1351 1353 } 1352 " cutplaneLighting" {1354 "-cutplanelighting" { 1353 1355 set bool $_settings($what) 1354 1356 SendCmd "cutplane lighting $bool" 1355 1357 } 1356 " cutplaneOpacity" {1358 "-cutplaneopacity" { 1357 1359 set val $_settings($what) 1358 1360 set sval [expr { 0.01 * double($val) }] 1359 1361 SendCmd "cutplane opacity $sval" 1360 1362 } 1361 " cutplanePreinterp" {1363 "-cutplanepreinterp" { 1362 1364 set bool $_settings($what) 1363 1365 SendCmd "cutplane preinterp $bool" 1364 1366 } 1365 " cutplaneXVisible" - "cutplaneYVisible" - "cutplaneZVisible" {1366 set axis [string tolower [string range $what 8 8]]1367 "-cutplanexvisible" - "-cutplaneyvisible" - "-cutplanezvisible" { 1368 set axis [string tolower [string range $what 9 9]] 1367 1369 set bool $_settings($what) 1368 1370 if { $bool } { … … 1373 1375 -troughcolor grey82 1374 1376 } 1375 1376 } 1377 " cutplaneXPosition" - "cutplaneYPosition" - "cutplaneZPosition" {1378 set axis [string tolower [string range $what 8 8]]1377 SendCmd "cutplane axis $axis $bool" 1378 } 1379 "-cutplanexposition" - "-cutplaneyposition" - "-cutplanezposition" { 1380 set axis [string tolower [string range $what 9 9]] 1379 1381 set pos [expr $_settings($what) * 0.01] 1380 1382 SendCmd "cutplane slice ${axis} ${pos}" 1381 1383 set _cutplanePending 0 1382 1384 } 1383 " colormap" {1384 set _changed( colormap) 11385 "-colormap" { 1386 set _changed($what) 1 1385 1387 StartBufferingCommands 1386 1388 set color [$itk_component(colormap) value] 1387 set _settings( colormap) $color1388 1389 if { $_settings(colormapVisible) } {1390 1391 set _settings(colormapVisible) 01392 1393 1394 if { !$_settings(colormapVisible) } {1395 1396 set _settings(colormapVisible) 11397 1398 1399 1389 set _settings($what) $color 1390 if { $color == "none" } { 1391 if { $_settings(-colormapvisible) } { 1392 SendCmd "glyphs colormode constant {}" 1393 set _settings(-colormapvisible) 0 1394 } 1395 } else { 1396 if { !$_settings(-colormapvisible) } { 1397 SendCmd "glyphs colormode $_colorMode $_curFldName" 1398 set _settings(-colormapvisible) 1 1399 } 1400 SetCurrentColormap $color 1401 } 1400 1402 StopBufferingCommands 1401 1402 } 1403 " glyphWireframe" {1403 EventuallyRequestLegend 1404 } 1405 "-glyphwireframe" { 1404 1406 set bool $_settings($what) 1405 1406 } 1407 " glyphVisible" {1407 SendCmd "glyphs wireframe $bool" 1408 } 1409 "-glyphvisible" { 1408 1410 set bool $_settings($what) 1409 1411 SendCmd "glyphs visible $bool" 1410 1412 if { $bool } { 1411 1413 Rappture::Tooltip::for $itk_component(glyphs) \ … … 1415 1417 "Show the glyph" 1416 1418 } 1417 1418 } 1419 " glyphLighting" {1419 DrawLegend 1420 } 1421 "-glyphlighting" { 1420 1422 set bool $_settings($what) 1421 1422 } 1423 " glyphEdges" {1423 SendCmd "glyphs lighting $bool" 1424 } 1425 "-glyphedges" { 1424 1426 set bool $_settings($what) 1425 1426 } 1427 " glyphOutline" {1427 SendCmd "glyphs edges $bool" 1428 } 1429 "-glyphoutline" { 1428 1430 set bool $_settings($what) 1429 1430 } 1431 " glyphOpacity" {1431 SendCmd "outline visible $bool" 1432 } 1433 "-glyphopacity" { 1432 1434 set val $_settings($what) 1433 1435 set sval [expr { 0.01 * double($val) }] 1434 SendCmd "glyphs opacity $sval" 1435 } 1436 "glyphNormscale" { 1437 set bool $_settings($what) 1438 SendCmd "glyphs normscale $bool" 1439 } 1440 "glyphOrient" { 1441 set bool $_settings($what) 1442 SendCmd "glyphs gorient $bool {}" 1443 } 1444 "glyphScale" { 1436 SendCmd "glyphs opacity $sval" 1437 } 1438 "-glyphscale" { 1445 1439 set val $_settings($what) 1446 SendCmd "glyphs gscale $val" 1447 } 1448 "glyphScaleMode" { 1449 set label [$itk_component(scaleMode) value] 1450 set mode [$itk_component(scaleMode) translate $label] 1451 set _settings($what) $mode 1452 SendCmd "glyphs smode $mode {}" 1453 } 1454 "glyphShape" { 1455 set label [$itk_component(gshape) value] 1456 set shape [$itk_component(gshape) translate $label] 1457 set _settings($what) $shape 1458 SendCmd "glyphs shape $shape" 1459 } 1460 "field" { 1440 if { [string is double $val] } { 1441 SendCmd "glyphs gscale $val" 1442 } 1443 } 1444 "-field" { 1461 1445 set label [$itk_component(field) value] 1462 1446 set fname [$itk_component(field) translate $label] 1463 set _settings( field) $fname1447 set _settings($what) $fname 1464 1448 if { [info exists _fields($fname)] } { 1465 1449 foreach { label units components } $_fields($fname) break … … 1475 1459 return 1476 1460 } 1477 #if { ![info exists _limits($_curFldName)] } {1478 # SendCmd "dataset maprange all"1479 #} else {1480 # SendCmd "dataset maprange explicit $_limits($_curFldName) $_curFldName"1481 #}1482 #SendCmd "cutplane colormode $_colorMode $_curFldName"1483 1461 SendCmd "glyphs colormode $_colorMode $_curFldName" 1484 1462 DrawLegend 1485 1463 } 1486 " legendVisible" {1464 "-legendvisible" { 1487 1465 if { !$_settings($what) } { 1488 1466 $itk_component(view) delete legend 1489 1490 1467 } 1468 DrawLegend 1491 1469 } 1492 1470 default { … … 1496 1474 } 1497 1475 1498 1499 1476 # 1500 1477 # RequestLegend -- 1501 1478 # 1502 # 1503 # 1479 # Request a new legend from the server. The size of the legend 1480 # is determined from the height of the canvas. 1504 1481 # 1505 1482 # This should be called when 1506 # 1507 # 1508 # 1509 # 1510 # 1483 # 1. A new current colormap is set. 1484 # 2. Window is resized. 1485 # 3. The limits of the data have changed. (Just need a redraw). 1486 # 4. Number of glyph have changed. (Just need a redraw). 1487 # 5. Legend becomes visible (Just need a redraw). 1511 1488 # 1512 1489 itcl::body Rappture::VtkGlyphViewer::RequestLegend {} { … … 1520 1497 set fname $_curFldName 1521 1498 if { [string match "component*" $fname] } { 1522 1499 set title "" 1523 1500 } else { 1524 1525 1526 1527 1528 1529 1530 1531 1501 if { [info exists _fields($fname)] } { 1502 foreach { title units } $_fields($fname) break 1503 if { $units != "" } { 1504 set title [format "%s (%s)" $title $units] 1505 } 1506 } else { 1507 set title $fname 1508 } 1532 1509 } 1533 1510 # If there's a title too, substract one more line … … 1540 1517 # Set the legend on the first heightmap dataset. 1541 1518 if { $_currentColormap != "" } { 1542 1543 1519 set cmap $_currentColormap 1520 SendCmdNoWait "legend $cmap $_colorMode $_curFldName {} $w $h 0" 1544 1521 } 1545 1522 } … … 1561 1538 if { [isconnected] } { 1562 1539 set rgb [Color2RGB $itk_option(-plotforeground)] 1563 1540 SendCmd "axis color all $rgb" 1564 1541 SendCmd "outline color $rgb" 1565 1542 #SendCmd "cutplane color $rgb" … … 1587 1564 checkbutton $inner.glyphs \ 1588 1565 -text "Glyphs" \ 1589 -variable [itcl::scope _settings( glyphVisible)] \1590 -command [itcl::code $this AdjustSetting glyphVisible] \1566 -variable [itcl::scope _settings(-glyphvisible)] \ 1567 -command [itcl::code $this AdjustSetting -glyphvisible] \ 1591 1568 -font "Arial 9" 1592 1593 label $inner.gshape_l -text "Glyph shape" -font "Arial 9"1594 itk_component add gshape {1595 Rappture::Combobox $inner.gshape -width 10 -editable no1596 }1597 $inner.gshape choices insert end \1598 "arrow" "arrow" \1599 "cone" "cone" \1600 "cube" "cube" \1601 "cylinder" "cylinder" \1602 "dodecahedron" "dodecahedron" \1603 "icosahedron" "icosahedron" \1604 "line" "line" \1605 "octahedron" "octahedron" \1606 "point" "point" \1607 "sphere" "sphere" \1608 "tetrahedron" "tetrahedron"1609 1610 $itk_component(gshape) value $_settings(glyphShape)1611 bind $inner.gshape <<Value>> [itcl::code $this AdjustSetting glyphShape]1612 1613 label $inner.scaleMode_l -text "Scale by" -font "Arial 9"1614 itk_component add scaleMode {1615 Rappture::Combobox $inner.scaleMode -width 10 -editable no1616 }1617 $inner.scaleMode choices insert end \1618 "scalar" "Scalar" \1619 "vmag" "Vector magnitude" \1620 "vcomp" "Vector components" \1621 "off" "Constant size"1622 1623 $itk_component(scaleMode) value "[$itk_component(scaleMode) label $_settings(glyphScaleMode)]"1624 bind $inner.scaleMode <<Value>> [itcl::code $this AdjustSetting glyphScaleMode]1625 1626 checkbutton $inner.normscale \1627 -text "Normalize scaling" \1628 -variable [itcl::scope _settings(glyphNormscale)] \1629 -command [itcl::code $this AdjustSetting glyphNormscale] \1630 -font "Arial 9"1631 Rappture::Tooltip::for $inner.normscale "If enabled, field values are normalized to \[0,1\] before scaling and scale factor is relative to a default size"1632 1633 checkbutton $inner.gorient \1634 -text "Orient" \1635 -variable [itcl::scope _settings(glyphOrient)] \1636 -command [itcl::code $this AdjustSetting glyphOrient] \1637 -font "Arial 9"1638 Rappture::Tooltip::for $inner.gorient "Orient glyphs by vector field directions"1639 1569 1640 1570 checkbutton $inner.wireframe \ 1641 1571 -text "Wireframe" \ 1642 -variable [itcl::scope _settings( glyphWireframe)] \1643 -command [itcl::code $this AdjustSetting glyphWireframe] \1572 -variable [itcl::scope _settings(-glyphwireframe)] \ 1573 -command [itcl::code $this AdjustSetting -glyphwireframe] \ 1644 1574 -font "Arial 9" 1645 1575 1646 1576 checkbutton $inner.lighting \ 1647 1577 -text "Enable Lighting" \ 1648 -variable [itcl::scope _settings( glyphLighting)] \1649 -command [itcl::code $this AdjustSetting glyphLighting] \1578 -variable [itcl::scope _settings(-glyphlighting)] \ 1579 -command [itcl::code $this AdjustSetting -glyphlighting] \ 1650 1580 -font "Arial 9" 1651 1581 1652 1582 checkbutton $inner.edges \ 1653 1583 -text "Edges" \ 1654 -variable [itcl::scope _settings( glyphEdges)] \1655 -command [itcl::code $this AdjustSetting glyphEdges] \1584 -variable [itcl::scope _settings(-glyphedges)] \ 1585 -command [itcl::code $this AdjustSetting -glyphedges] \ 1656 1586 -font "Arial 9" 1657 1587 1658 1588 checkbutton $inner.outline \ 1659 1589 -text "Outline" \ 1660 -variable [itcl::scope _settings( glyphOutline)] \1661 -command [itcl::code $this AdjustSetting glyphOutline] \1590 -variable [itcl::scope _settings(-glyphoutline)] \ 1591 -command [itcl::code $this AdjustSetting -glyphoutline] \ 1662 1592 -font "Arial 9" 1663 1593 1664 1594 checkbutton $inner.legend \ 1665 1595 -text "Legend" \ 1666 -variable [itcl::scope _settings( legendVisible)] \1667 -command [itcl::code $this AdjustSetting legendVisible] \1596 -variable [itcl::scope _settings(-legendvisible)] \ 1597 -command [itcl::code $this AdjustSetting -legendvisible] \ 1668 1598 -font "Arial 9" 1669 1599 … … 1677 1607 "grey" "grey" 1678 1608 1679 $itk_component(background) value $_settings( background)1680 bind $inner.background <<Value>> [itcl::code $this AdjustSetting background]1609 $itk_component(background) value $_settings(-background) 1610 bind $inner.background <<Value>> [itcl::code $this AdjustSetting -background] 1681 1611 1682 1612 label $inner.opacity_l -text "Opacity" -font "Arial 9" 1683 1613 ::scale $inner.opacity -from 0 -to 100 -orient horizontal \ 1684 -variable [itcl::scope _settings( glyphOpacity)] \1614 -variable [itcl::scope _settings(-glyphopacity)] \ 1685 1615 -width 10 \ 1686 1616 -showvalue off \ 1687 -command [itcl::code $this AdjustSetting glyphOpacity]1617 -command [itcl::code $this AdjustSetting -glyphopacity] 1688 1618 1689 1619 label $inner.gscale_l -text "Scale factor" -font "Arial 9" 1690 if {0} {1691 1620 ::scale $inner.gscale -from 1 -to 100 -orient horizontal \ 1692 -variable [itcl::scope _settings( glyphScale)] \1621 -variable [itcl::scope _settings(-glyphscale)] \ 1693 1622 -width 10 \ 1694 1623 -showvalue off \ 1695 -command [itcl::code $this AdjustSetting glyphScale] 1696 } else { 1697 itk_component add gscale { 1698 entry $inner.gscale -font "Arial 9" -bg white \ 1699 -textvariable [itcl::scope _settings(glyphScale)] 1700 } { 1701 ignore -font -background 1702 } 1703 bind $inner.gscale <Return> \ 1704 [itcl::code $this AdjustSetting glyphScale] 1705 bind $inner.gscale <KP_Enter> \ 1706 [itcl::code $this AdjustSetting glyphScale] 1707 } 1624 -command [itcl::code $this AdjustSetting -glyphscale] 1708 1625 Rappture::Tooltip::for $inner.gscale "Set scaling multiplier (or constant size)" 1709 1626 … … 1717 1634 } 1718 1635 bind $inner.field <<Value>> \ 1719 [itcl::code $this AdjustSetting field]1636 [itcl::code $this AdjustSetting -field] 1720 1637 1721 1638 label $inner.colormap_l -text "Colormap" -font "Arial 9" … … 1723 1640 Rappture::Combobox $inner.colormap -width 10 -editable no 1724 1641 } 1725 $inner.colormap choices insert end [GetColormapList -includeNone] 1642 1643 $inner.colormap choices insert end [GetColormapList] 1726 1644 $itk_component(colormap) value "BCGYR" 1727 1645 bind $inner.colormap <<Value>> \ 1728 [itcl::code $this AdjustSetting colormap]1646 [itcl::code $this AdjustSetting -colormap] 1729 1647 1730 1648 blt::table $inner \ … … 1733 1651 1,0 $inner.colormap_l -anchor w -pady 2 \ 1734 1652 1,1 $inner.colormap -anchor w -pady 2 -fill x \ 1735 2,0 $inner.gshape_l -anchor w -pady 2 \ 1736 2,1 $inner.gshape -anchor w -pady 2 -fill x \ 1737 3,0 $inner.background_l -anchor w -pady 2 \ 1738 3,1 $inner.background -anchor w -pady 2 -fill x \ 1739 4,0 $inner.scaleMode_l -anchor w -pady 2 \ 1740 4,1 $inner.scaleMode -anchor w -pady 2 -fill x \ 1741 5,0 $inner.gscale_l -anchor w -pady 2 \ 1742 5,1 $inner.gscale -anchor w -pady 2 -fill x \ 1743 6,0 $inner.normscale -anchor w -pady 2 -cspan 2 \ 1744 7,0 $inner.gorient -anchor w -pady 2 -cspan 2 \ 1745 8,0 $inner.wireframe -anchor w -pady 2 -cspan 2 \ 1746 9,0 $inner.lighting -anchor w -pady 2 -cspan 2 \ 1747 10,0 $inner.edges -anchor w -pady 2 -cspan 2 \ 1748 11,0 $inner.outline -anchor w -pady 2 -cspan 2 \ 1749 12,0 $inner.legend -anchor w -pady 2 \ 1750 13,0 $inner.opacity_l -anchor w -pady 2 \ 1751 13,1 $inner.opacity -fill x -pady 2 -fill x \ 1653 3,0 $inner.background_l -anchor w -pady 2 \ 1654 3,1 $inner.background -anchor w -pady 2 -fill x \ 1655 5,0 $inner.wireframe -anchor w -pady 2 -cspan 2 \ 1656 6,0 $inner.lighting -anchor w -pady 2 -cspan 2 \ 1657 7,0 $inner.edges -anchor w -pady 2 -cspan 2 \ 1658 8,0 $inner.outline -anchor w -pady 2 -cspan 2 \ 1659 9,0 $inner.legend -anchor w -pady 2 \ 1660 10,0 $inner.opacity_l -anchor w -pady 2 \ 1661 10,1 $inner.opacity -fill x -pady 2 -fill x \ 1752 1662 1753 1663 blt::table configure $inner r* c* -resize none 1754 blt::table configure $inner r1 4c1 -resize expand1664 blt::table configure $inner r11 c1 -resize expand 1755 1665 } 1756 1666 … … 1766 1676 1767 1677 checkbutton $inner.visible \ 1768 -text " ShowAxes" \1769 -variable [itcl::scope _settings( axesVisible)] \1770 -command [itcl::code $this AdjustSetting axesVisible] \1678 -text "Axes" \ 1679 -variable [itcl::scope _settings(-axesvisible)] \ 1680 -command [itcl::code $this AdjustSetting -axesvisible] \ 1771 1681 -font "Arial 9" 1772 1682 1773 1683 checkbutton $inner.labels \ 1774 -text " ShowAxis Labels" \1775 -variable [itcl::scope _settings( axisLabelsVisible)] \1776 -command [itcl::code $this AdjustSetting axisLabelsVisible] \1684 -text "Axis Labels" \ 1685 -variable [itcl::scope _settings(-axislabels)] \ 1686 -command [itcl::code $this AdjustSetting -axislabels] \ 1777 1687 -font "Arial 9" 1778 1779 checkbutton $inner. gridx\1780 -text " Show X Grid" \1781 -variable [itcl::scope _settings( axisXGrid)] \1782 -command [itcl::code $this AdjustSetting axisXGrid] \1688 label $inner.grid_l -text "Grid" -font "Arial 9" 1689 checkbutton $inner.xgrid \ 1690 -text "X" \ 1691 -variable [itcl::scope _settings(-xgrid)] \ 1692 -command [itcl::code $this AdjustSetting -xgrid] \ 1783 1693 -font "Arial 9" 1784 checkbutton $inner. gridy\1785 -text " Show Y Grid" \1786 -variable [itcl::scope _settings( axisYGrid)] \1787 -command [itcl::code $this AdjustSetting axisYGrid] \1694 checkbutton $inner.ygrid \ 1695 -text "Y" \ 1696 -variable [itcl::scope _settings(-ygrid)] \ 1697 -command [itcl::code $this AdjustSetting -ygrid] \ 1788 1698 -font "Arial 9" 1789 checkbutton $inner.gridz \ 1790 -text "Show Z Grid" \ 1791 -variable [itcl::scope _settings(axisZGrid)] \ 1792 -command [itcl::code $this AdjustSetting axisZGrid] \ 1699 checkbutton $inner.zgrid \ 1700 -text "Z" \ 1701 -variable [itcl::scope _settings(-zgrid)] \ 1702 -command [itcl::code $this AdjustSetting -zgrid] \ 1703 -font "Arial 9" 1704 checkbutton $inner.minorticks \ 1705 -text "Minor Ticks" \ 1706 -variable [itcl::scope _settings(-axisminorticks)] \ 1707 -command [itcl::code $this AdjustSetting -axisminorticks] \ 1793 1708 -font "Arial 9" 1794 1709 … … 1803 1718 "furthest_triad" "farthest" \ 1804 1719 "outer_edges" "outer" 1805 $itk_component(axisMode) value "static"1806 bind $inner.mode <<Value>> [itcl::code $this AdjustSetting axisMode]1720 $itk_component(axisMode) value $_settings(-axismode) 1721 bind $inner.mode <<Value>> [itcl::code $this AdjustSetting -axismode] 1807 1722 1808 1723 blt::table $inner \ 1809 0,0 $inner.visible -anchor w -cspan 2 \ 1810 1,0 $inner.labels -anchor w -cspan 2 \ 1811 2,0 $inner.gridx -anchor w -cspan 2 \ 1812 3,0 $inner.gridy -anchor w -cspan 2 \ 1813 4,0 $inner.gridz -anchor w -cspan 2 \ 1814 5,0 $inner.mode_l -anchor w -cspan 2 -padx { 2 0 } \ 1815 6,0 $inner.mode -fill x -cspan 2 1724 0,0 $inner.visible -anchor w -cspan 4 \ 1725 1,0 $inner.labels -anchor w -cspan 4 \ 1726 2,0 $inner.minorticks -anchor w -cspan 4 \ 1727 4,0 $inner.grid_l -anchor w \ 1728 4,1 $inner.xgrid -anchor w \ 1729 4,2 $inner.ygrid -anchor w \ 1730 4,3 $inner.zgrid -anchor w \ 1731 5,0 $inner.mode_l -anchor w -padx { 2 0 } \ 1732 5,1 $inner.mode -fill x -cspan 3 1816 1733 1817 1734 blt::table configure $inner r* c* -resize none 1818 blt::table configure $inner r7 c 1-resize expand1819 } 1820 1735 blt::table configure $inner r7 c6 -resize expand 1736 blt::table configure $inner r3 -height 0.125i 1737 } 1821 1738 1822 1739 itcl::body Rappture::VtkGlyphViewer::BuildCameraTab {} { … … 1880 1797 checkbutton $inner.visible \ 1881 1798 -text "Cutplanes" \ 1882 -variable [itcl::scope _settings( cutplaneVisible)] \1883 -command [itcl::code $this AdjustSetting cutplaneVisible] \1799 -variable [itcl::scope _settings(-cutplanevisible)] \ 1800 -command [itcl::code $this AdjustSetting -cutplanevisible] \ 1884 1801 -font "Arial 9" 1885 1802 1886 1803 checkbutton $inner.wireframe \ 1887 1804 -text "Wireframe" \ 1888 -variable [itcl::scope _settings( cutplaneWireframe)] \1889 -command [itcl::code $this AdjustSetting cutplaneWireframe] \1805 -variable [itcl::scope _settings(-cutplanewireframe)] \ 1806 -command [itcl::code $this AdjustSetting -cutplanewireframe] \ 1890 1807 -font "Arial 9" 1891 1808 1892 1809 checkbutton $inner.lighting \ 1893 1810 -text "Enable Lighting" \ 1894 -variable [itcl::scope _settings( cutplaneLighting)] \1895 -command [itcl::code $this AdjustSetting cutplaneLighting] \1811 -variable [itcl::scope _settings(-cutplanelighting)] \ 1812 -command [itcl::code $this AdjustSetting -cutplanelighting] \ 1896 1813 -font "Arial 9" 1897 1814 1898 1815 checkbutton $inner.edges \ 1899 1816 -text "Edges" \ 1900 -variable [itcl::scope _settings( cutplaneEdges)] \1901 -command [itcl::code $this AdjustSetting cutplaneEdges] \1817 -variable [itcl::scope _settings(-cutplaneedges)] \ 1818 -command [itcl::code $this AdjustSetting -cutplaneedges] \ 1902 1819 -font "Arial 9" 1903 1820 1904 1821 checkbutton $inner.preinterp \ 1905 1822 -text "Interpolate Scalars" \ 1906 -variable [itcl::scope _settings( cutplanePreinterp)] \1907 -command [itcl::code $this AdjustSetting cutplanePreinterp] \1823 -variable [itcl::scope _settings(-cutplanepreinterp)] \ 1824 -command [itcl::code $this AdjustSetting -cutplanepreinterp] \ 1908 1825 -font "Arial 9" 1909 1826 1910 1827 label $inner.opacity_l -text "Opacity" -font "Arial 9" 1911 1828 ::scale $inner.opacity -from 0 -to 100 -orient horizontal \ 1912 -variable [itcl::scope _settings( cutplaneOpacity)] \1829 -variable [itcl::scope _settings(-cutplaneopacity)] \ 1913 1830 -width 10 \ 1914 1831 -showvalue off \ 1915 -command [itcl::code $this AdjustSetting cutplaneOpacity]1916 $inner.opacity set $_settings( cutplaneOpacity)1832 -command [itcl::code $this AdjustSetting -cutplaneopacity] 1833 $inner.opacity set $_settings(-cutplaneopacity) 1917 1834 1918 1835 # X-value slicer... … … 1921 1838 -onimage [Rappture::icon x-cutplane-red] \ 1922 1839 -offimage [Rappture::icon x-cutplane-red] \ 1923 -command [itcl::code $this AdjustSetting cutplaneXVisible] \1924 -variable [itcl::scope _settings( cutplaneXVisible)] \1840 -command [itcl::code $this AdjustSetting -cutplanexvisible] \ 1841 -variable [itcl::scope _settings(-cutplanexvisible)] \ 1925 1842 } 1926 1843 Rappture::Tooltip::for $itk_component(xbutton) \ … … 1932 1849 -borderwidth 1 -highlightthickness 0 \ 1933 1850 -command [itcl::code $this EventuallySetCutplane x] \ 1934 -variable [itcl::scope _settings( cutplaneXPosition)] \1935 1851 -variable [itcl::scope _settings(-cutplanexposition)] \ 1852 -foreground red2 -font "Arial 9 bold" 1936 1853 } { 1937 1854 usual … … 1949 1866 -onimage [Rappture::icon y-cutplane-green] \ 1950 1867 -offimage [Rappture::icon y-cutplane-green] \ 1951 -command [itcl::code $this AdjustSetting cutplaneYVisible] \1952 -variable [itcl::scope _settings( cutplaneYVisible)] \1868 -command [itcl::code $this AdjustSetting -cutplaneyvisible] \ 1869 -variable [itcl::scope _settings(-cutplaneyvisible)] \ 1953 1870 } 1954 1871 Rappture::Tooltip::for $itk_component(ybutton) \ … … 1961 1878 -borderwidth 1 -highlightthickness 0 \ 1962 1879 -command [itcl::code $this EventuallySetCutplane y] \ 1963 -variable [itcl::scope _settings( cutplaneYPosition)] \1964 1880 -variable [itcl::scope _settings(-cutplaneyposition)] \ 1881 -foreground green3 -font "Arial 9 bold" 1965 1882 } { 1966 1883 usual … … 1978 1895 -onimage [Rappture::icon z-cutplane-blue] \ 1979 1896 -offimage [Rappture::icon z-cutplane-blue] \ 1980 -command [itcl::code $this AdjustSetting cutplaneZVisible] \1981 -variable [itcl::scope _settings( cutplaneZVisible)] \1897 -command [itcl::code $this AdjustSetting -cutplanezvisible] \ 1898 -variable [itcl::scope _settings(-cutplanezvisible)] \ 1982 1899 } { 1983 1984 1900 usual 1901 ignore -foreground 1985 1902 } 1986 1903 Rappture::Tooltip::for $itk_component(zbutton) \ … … 1993 1910 -borderwidth 1 -highlightthickness 0 \ 1994 1911 -command [itcl::code $this EventuallySetCutplane z] \ 1995 -variable [itcl::scope _settings( cutplaneZPosition)] \1996 1912 -variable [itcl::scope _settings(-cutplanezposition)] \ 1913 -foreground blue3 -font "Arial 9 bold" 1997 1914 } { 1998 1915 usual … … 2005 1922 2006 1923 blt::table $inner \ 2007 0,0 $inner.visible -anchor w -pady 2 -cspan 3 \ 2008 1,0 $inner.lighting -anchor w -pady 2 -cspan 3 \ 2009 2,0 $inner.wireframe -anchor w -pady 2 -cspan 3 \ 2010 3,0 $inner.edges -anchor w -pady 2 -cspan 3 \ 2011 4,0 $inner.preinterp -anchor w -pady 2 -cspan 3 \ 2012 5,0 $inner.opacity_l -anchor w -pady 2 -cspan 1 \ 2013 5,1 $inner.opacity -fill x -pady 2 -cspan 3 \ 2014 6,0 $inner.xbutton -anchor w -padx 2 -pady 2 \ 2015 7,0 $inner.ybutton -anchor w -padx 2 -pady 2 \ 2016 8,0 $inner.zbutton -anchor w -padx 2 -pady 2 \ 2017 6,1 $inner.xval -fill y -rspan 4 \ 2018 6,2 $inner.yval -fill y -rspan 4 \ 2019 6,3 $inner.zval -fill y -rspan 4 \ 2020 1924 0,0 $inner.visible -anchor w -pady 2 -cspan 3 \ 1925 1,0 $inner.lighting -anchor w -pady 2 -cspan 3 \ 1926 2,0 $inner.wireframe -anchor w -pady 2 -cspan 3 \ 1927 3,0 $inner.edges -anchor w -pady 2 -cspan 3 \ 1928 4,0 $inner.preinterp -anchor w -pady 2 -cspan 3 \ 1929 5,0 $inner.opacity_l -anchor w -pady 2 -cspan 1 \ 1930 5,1 $inner.opacity -fill x -pady 2 -cspan 3 \ 1931 6,0 $inner.xbutton -anchor w -padx 2 -pady 2 \ 1932 7,0 $inner.ybutton -anchor w -padx 2 -pady 2 \ 1933 8,0 $inner.zbutton -anchor w -padx 2 -pady 2 \ 1934 6,1 $inner.xval -fill y -rspan 4 \ 1935 6,2 $inner.yval -fill y -rspan 4 \ 1936 6,3 $inner.zval -fill y -rspan 4 \ 2021 1937 2022 1938 blt::table configure $inner r* c* -resize none 2023 1939 blt::table configure $inner r9 c4 -resize expand 2024 1940 } 2025 2026 2027 1941 2028 1942 # … … 2133 2047 set tag $dataobj-$comp 2134 2048 array set style { 2135 -color \#FFFFFF 2136 -colormap BCGYR 2137 -colorMode vmag 2049 -color BCGYR 2138 2050 -edgecolor black 2139 2051 -edges 0 … … 2147 2059 -ptsize 1.0 2148 2060 -quality 1 2149 -scaleMode vmag2150 -shape arrow2061 -scaleMode "vmag" 2062 -shape "arrow" 2151 2063 -wireframe 0 2152 2064 } 2153 set $style(-color) $itk_option(-plotforeground)2154 2065 set numComponents [$dataobj numComponents $comp] 2155 2066 if {$numComponents == 3} { … … 2157 2068 set style(-orientGlyphs) 1 2158 2069 set style(-scaleMode) "vmag" 2159 set style(-colorMode) "vmag"2160 2070 } else { 2161 2071 set style(-shape) "sphere" 2162 2072 set style(-orientGlyphs) 0 2163 2073 set style(-scaleMode) "scalar" 2164 set style(-colorMode) "scalar"2165 2074 } 2166 2075 array set style [$dataobj style $comp] … … 2181 2090 # the code to handle aberrant cases. 2182 2091 2183 if { $_changed( glyphOpacity) } {2184 set style(-opacity) $_settings(glyphOpacity)2185 } 2186 if { $_changed( colormap) } {2187 set style(-color map) $_settings(colormap)2092 if { $_changed(-glyphopacity) } { 2093 set style(-opacity) [expr $_settings(-glyphopacity) * 0.01] 2094 } 2095 if { $_changed(-colormap) } { 2096 set style(-color) $_settings(-colormap) 2188 2097 } 2189 2098 if { $_currentColormap == "" } { 2190 $itk_component(colormap) value $style(-colormap) 2191 } 2192 set _currentOpacity $style(-opacity) 2099 $itk_component(colormap) value $style(-color) 2100 } 2101 2102 SendCmd "outline add $tag" 2103 SendCmd "outline color [Color2RGB $itk_option(-plotforeground)] $tag" 2104 SendCmd "outline visible $style(-outline) $tag" 2105 set _settings(-glyphoutline) $style(-outline) 2106 2193 2107 SendCmd "glyphs add $style(-shape) $tag" 2194 set _settings(glyphShape) $style(-shape)2195 $itk_component(gshape) value $style(-shape)2196 2108 SendCmd "glyphs edges $style(-edges) $tag" 2109 set _settings(-glyphedges) $style(-edges) 2110 2197 2111 # normscale=1 and gscale=1 are defaults 2198 2112 if {$style(-normscale) != 1} { … … 2202 2116 SendCmd "glyphs gscale $style(-gscale) $tag" 2203 2117 } 2204 set _settings(glyphNormscale) $style(-normscale) 2205 set _settings(glyphScale) $style(-gscale) 2206 SendCmd "outline add $tag" 2207 SendCmd "outline color [Color2RGB $style(-color)] $tag" 2208 SendCmd "outline visible $style(-outline) $tag" 2209 set _settings(glyphOutline) $style(-outline) 2210 set _settings(glyphEdges) $style(-edges) 2211 if {$style(-colorMode) == "constant" || $style(-colormap) == "none"} { 2212 SendCmd "glyphs colormode constant {} $tag" 2213 set _settings(colormapVisible) 0 2214 set _settings(colormap) "none" 2215 } else { 2216 SendCmd "glyphs colormode $style(-colorMode) $_curFldName $tag" 2217 set _settings(colormapVisible) 1 2218 set _settings(colormap) $style(-colormap) 2219 SetCurrentColormap $style(-colormap) 2220 } 2221 $itk_component(colormap) value $_settings(colormap) 2222 set _colorMode $style(-colorMode) 2118 2223 2119 # constant color only used if colormode set to constant 2224 SendCmd "glyphs color [Color2RGB $ style(-color)] $tag"2120 SendCmd "glyphs color [Color2RGB $itk_option(-plotforeground)] $tag" 2225 2121 # Omitting field name for gorient and smode commands 2226 2122 # defaults to active scalars or vectors depending on mode 2227 2123 SendCmd "glyphs gorient $style(-orientGlyphs) {} $tag" 2228 2124 SendCmd "glyphs smode $style(-scaleMode) {} $tag" 2229 set _settings(glyphScaleMode) $style(-scaleMode)2230 $itk_component(scaleMode) value "[$itk_component(scaleMode) label $style(-scaleMode)]"2231 2125 SendCmd "glyphs quality $style(-quality) $tag" 2232 2126 SendCmd "glyphs lighting $style(-lighting) $tag" 2233 set _settings( glyphLighting) $style(-lighting)2127 set _settings(-glyphlighting) $style(-lighting) 2234 2128 SendCmd "glyphs linecolor [Color2RGB $style(-edgecolor)] $tag" 2235 2129 SendCmd "glyphs linewidth $style(-linewidth) $tag" 2236 2130 SendCmd "glyphs ptsize $style(-ptsize) $tag" 2237 SendCmd "glyphs opacity $_currentOpacity $tag" 2238 set _settings(glyphOpacity) $style(-opacity) 2131 SendCmd "glyphs opacity $style(-opacity) $tag" 2132 set _settings(-glyphopacity) [expr $style(-opacity) * 100.0] 2133 SetCurrentColormap $style(-color) 2239 2134 SendCmd "glyphs wireframe $style(-wireframe) $tag" 2240 set _settings(glyphWireframe) $style(-wireframe) 2241 set _settings(glyphOpacity) [expr $style(-opacity) * 100.0] 2135 set _settings(-glyphwireframe) $style(-wireframe) 2242 2136 } 2243 2137 … … 2293 2187 2294 2188 if { [string match "component*" $fname] } { 2295 2189 set title "" 2296 2190 } else { 2297 2298 2299 2300 2301 2302 2303 2304 2191 if { [info exists _fields($fname)] } { 2192 foreach { title units } $_fields($fname) break 2193 if { $units != "" } { 2194 set title [format "%s (%s)" $title $units] 2195 } 2196 } else { 2197 set title $fname 2198 } 2305 2199 } 2306 2200 # If there's a legend title, increase the offset by the line height. … … 2334 2228 } 2335 2229 2336 2337 2230 # ---------------------------------------------------------------------- 2338 2231 # USAGE: Slice move x|y|z <newval> … … 2368 2261 # ReceiveLegend -- 2369 2262 # 2370 # 2371 # 2372 # 2263 # Invoked automatically whenever the "legend" command comes in from 2264 # the rendering server. Indicates that binary image data with the 2265 # specified <size> will follow. 2373 2266 # 2374 2267 itcl::body Rappture::VtkGlyphViewer::ReceiveLegend { colormap title min max size } { … … 2384 2277 #puts stderr "read $size bytes for [image width $_image(legend)]x[image height $_image(legend)] legend>" 2385 2278 if { [catch {DrawLegend} errs] != 0 } { 2386 2387 2279 global errorInfo 2280 puts stderr "errs=$errs errorInfo=$errorInfo" 2388 2281 } 2389 2282 } … … 2393 2286 # DrawLegend -- 2394 2287 # 2395 # 2288 # Draws the legend in the own canvas on the right side of the plot area. 2396 2289 # 2397 2290 itcl::body Rappture::VtkGlyphViewer::DrawLegend {} { … … 2404 2297 2405 2298 if { [string match "component*" $fname] } { 2406 2299 set title "" 2407 2300 } else { 2408 2409 2410 2411 2412 2413 2414 2415 2301 if { [info exists _fields($fname)] } { 2302 foreach { title units } $_fields($fname) break 2303 if { $units != "" } { 2304 set title [format "%s (%s)" $title $units] 2305 } 2306 } else { 2307 set title $fname 2308 } 2416 2309 } 2417 2310 set x [expr $w - 2] 2418 if { !$_settings( legendVisible) } {2419 2420 2311 if { !$_settings(-legendvisible) } { 2312 $c delete legend 2313 return 2421 2314 } 2422 2315 if { [$c find withtag "legend"] == "" } { 2423 2424 2316 set y 2 2317 # If there's a legend title, create a text item for the title. 2425 2318 $c create text $x $y \ 2426 2427 2428 2319 -anchor ne \ 2320 -fill $itk_option(-plotforeground) -tags "title legend" \ 2321 -font $font 2429 2322 if { $title != "" } { 2430 2323 incr y $lineht 2431 2324 } 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2325 $c create text $x $y \ 2326 -anchor ne \ 2327 -fill $itk_option(-plotforeground) -tags "vmax legend" \ 2328 -font $font 2329 incr y $lineht 2330 $c create image $x $y \ 2331 -anchor ne \ 2332 -image $_image(legend) -tags "colormap legend" 2333 $c create rectangle $x $y 1 1 \ 2334 -fill "" -outline "" -tags "sensor legend" 2335 $c create text $x [expr {$h-2}] \ 2336 -anchor se \ 2337 -fill $itk_option(-plotforeground) -tags "vmin legend" \ 2338 -font $font 2339 $c bind sensor <Enter> [itcl::code $this EnterLegend %x %y] 2340 $c bind sensor <Leave> [itcl::code $this LeaveLegend] 2341 $c bind sensor <Motion> [itcl::code $this MotionLegend %x %y] 2449 2342 } 2450 2343 set x2 $x … … 2460 2353 if { [info exists _limits($_curFldName)] } { 2461 2354 foreach { vmin vmax } $_limits($_curFldName) break 2462 2463 2355 $c itemconfigure vmin -text [format %g $vmin] 2356 $c itemconfigure vmax -text [format %g $vmax] 2464 2357 } 2465 2358 set y 2 … … 2467 2360 if { $title != "" } { 2468 2361 $c itemconfigure title -text $title 2469 2470 2362 $c coords title $x $y 2363 incr y $lineht 2471 2364 $c raise title 2472 2365 } … … 2510 2403 invoke { 2511 2404 $itk_component(field) value $_curFldLabel 2512 AdjustSetting field2405 AdjustSetting -field 2513 2406 } 2514 2407 default { … … 2534 2427 # BuildColormap -- 2535 2428 # 2536 # 2429 # Build the designated colormap on the server. 2537 2430 # 2538 2431 itcl::body Rappture::VtkGlyphViewer::BuildColormap { name } { … … 2565 2458 set _view(zoom) 1.0 2566 2459 } 2567
Note: See TracChangeset
for help on using the changeset viewer.