Changeset 4708 for branches/1.3
- Timestamp:
- Nov 12, 2014, 7:23:44 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/1.3/gui/scripts/vtkglyphviewer.tcl
r4706 r4708 143 143 private variable _legendPending 0 144 144 private variable _field "" 145 private variable _colorMode "vmag"; 145 private variable _colorMode "vmag"; # Mode of colormap (vmag or scalar) 146 146 private variable _fieldNames {} 147 147 private variable _fields … … 181 181 $_dispatcher register !xcutplane 182 182 $_dispatcher dispatch $this !xcutplane \ 183 "[itcl::code $this AdjustSetting cutplaneXPosition]; list"183 "[itcl::code $this AdjustSetting -cutplanexposition]; list" 184 184 185 185 # Y-Cutplane event 186 186 $_dispatcher register !ycutplane 187 187 $_dispatcher dispatch $this !ycutplane \ 188 "[itcl::code $this AdjustSetting cutplaneYPosition]; list"188 "[itcl::code $this AdjustSetting -cutplaneyposition]; list" 189 189 190 190 # Z-Cutplane event 191 191 $_dispatcher register !zcutplane 192 192 $_dispatcher dispatch $this !zcutplane \ 193 "[itcl::code $this AdjustSetting cutplaneZPosition]; list"193 "[itcl::code $this AdjustSetting -cutplanezposition]; list" 194 194 195 195 # … … 216 216 217 217 array set _settings [subst { 218 background black 219 colormap BCGYR 220 colormapVisible 1 221 field "Default" 222 axesVisible 1 223 axisLabelsVisible 1 224 axisXGrid 0 225 axisYGrid 0 226 axisZGrid 0 227 cutplaneEdges 0 228 cutplaneLighting 1 229 cutplanePreinterp 1 230 cutplaneOpacity 100 231 cutplaneVisible 0 232 cutplaneWireframe 0 233 cutplaneXPosition 50 234 cutplaneXVisible 1 235 cutplaneYPosition 50 236 cutplaneYVisible 1 237 cutplaneZPosition 50 238 cutplaneZVisible 1 239 glyphEdges 0 240 glyphLighting 1 241 glyphOpacity 100 242 saveGlyphOpacity 100 243 glyphOutline 0 244 glyphVisible 1 245 glyphWireframe 0 246 legendVisible 1 218 -axesvisible 1 219 -axislabels 1 220 -axisminorticks 1 221 -axismode "static" 222 -background black 223 -colormap BCGYR 224 -colormapvisible 1 225 -cutplaneedges 0 226 -cutplanelighting 1 227 -cutplanepreinterp 1 228 -cutplaneopacity 100 229 -cutplanevisible 0 230 -cutplanewireframe 0 231 -cutplanexposition 50 232 -cutplanexvisible 1 233 -cutplaneyposition 50 234 -cutplaneyvisible 1 235 -cutplanezposition 50 236 -cutplanezvisible 1 237 -field "Default" 238 -glyphedges 0 239 -glyphlighting 1 240 -glyphopacity 100 241 -glyphoutline 0 242 -glyphscale 1 243 -glyphvisible 1 244 -glyphwireframe 0 245 -legendvisible 1 246 -saveglyphopacity 100 247 -xgrid 0 248 -ygrid 0 249 -zgrid 0 247 250 }] 248 251 array set _changed { 249 glyphOpacity0250 colormap0252 -colormap 0 253 -glyphopacity 0 251 254 } 252 255 … … 328 331 -onimage [Rappture::icon volume-on] \ 329 332 -offimage [Rappture::icon volume-off] \ 330 -variable [itcl::scope _settings( glyphVisible)] \331 -command [itcl::code $this AdjustSetting glyphVisible]333 -variable [itcl::scope _settings(-glyphvisible)] \ 334 -command [itcl::code $this AdjustSetting -glyphvisible] 332 335 } 333 336 $itk_component(glyphs) select … … 341 344 -onimage [Rappture::icon cutbutton] \ 342 345 -offimage [Rappture::icon cutbutton] \ 343 -variable [itcl::scope _settings( cutplaneVisible)] \344 -command [itcl::code $this AdjustSetting cutplaneVisible]346 -variable [itcl::scope _settings(-cutplanevisible)] \ 347 -command [itcl::code $this AdjustSetting -cutplanevisible] 345 348 } 346 349 Rappture::Tooltip::for $itk_component(cutplane) \ … … 539 542 } 540 543 541 542 544 # ---------------------------------------------------------------------- 543 545 # USAGE: delete ?<dataobj1> <dataobj2> ...? 544 546 # 545 # 546 # 547 # 547 # Clients use this to delete a dataobj from the plot. If no dataobjs 548 # are specified, then all dataobjs are deleted. No data objects are 549 # deleted. They are only removed from the display list. 548 550 # 549 551 # ---------------------------------------------------------------------- … … 795 797 # isconnected -- 796 798 # 797 # 799 # Indicates if we are currently connected to the visualization server. 798 800 # 799 801 itcl::body Rappture::VtkGlyphViewer::isconnected {} { … … 812 814 # Disconnect -- 813 815 # 814 # 815 # 816 # Clients use this method to disconnect from the current rendering 817 # server. 816 818 # 817 819 itcl::body Rappture::VtkGlyphViewer::Disconnect {} { … … 951 953 PanCamera 952 954 set _first "" 953 InitSettings axisXGrid axisYGrid axisZGrid axisMode \ 954 axesVisible axisLabelsVisible 955 foreach axis { x y z } { 956 SendCmd "axis lformat $axis %g" 957 } 955 InitSettings -xgrid -ygrid -zgrid -axismode \ 956 -axesvisible -axislabels -axisminorticks 957 #SendCmd "axis lformat all %g" 958 958 StopBufferingCommands 959 959 SendCmd "imgflush" … … 971 971 if { ![info exists _datasets($tag)] } { 972 972 set bytes [$dataobj vtkdata $comp] 973 974 975 976 973 if 0 { 974 set f [open "/tmp/glyph.vtk" "w"] 975 puts $f $bytes 976 close $f 977 977 } 978 978 set length [string length $bytes] … … 988 988 SendCmd "clientinfo [list $info]" 989 989 } 990 append _outbuf "dataset add $tag data follows $length\n"990 SendCmd "dataset add $tag data follows $length" 991 991 append _outbuf $bytes 992 992 set _datasets($tag) 1 … … 997 997 # Setting dataset visible enables outline 998 998 # and glyphs 999 999 SendCmd "dataset visible 1 $tag" 1000 1000 } 1001 1001 } … … 1003 1003 1004 1004 if { $_first != "" } { 1005 1006 1007 1005 $itk_component(field) choices delete 0 end 1006 $itk_component(fieldmenu) delete 0 end 1007 array unset _fields 1008 1008 set _curFldName "" 1009 1009 foreach cname [$_first components] { … … 1031 1031 $itk_component(field) value $_curFldLabel 1032 1032 } 1033 InitSettings glyphOutline1034 # cutplaneVisible1033 InitSettings -glyphoutline 1034 #-cutplanevisible 1035 1035 if { $_reset } { 1036 1036 # These are settings that rely on a dataset being loaded. 1037 1037 InitSettings \ 1038 glyphLighting \1039 field \1040 glyphEdges glyphLighting glyphOpacity \1041 glyphWireframe1042 1043 # cutplaneXPosition cutplaneYPosition cutplaneZPosition \1044 cutplaneXVisible cutplaneYVisible cutplaneZVisible \1045 cutplanePreinterp1038 -glyphlighting \ 1039 -field \ 1040 -glyphedges -glyphlighting -glyphopacity \ 1041 -glyphwireframe 1042 1043 #-cutplanexposition -cutplaneyposition -cutplanezposition \ 1044 -cutplanexvisible -cutplaneyvisible -cutplanezvisible \ 1045 -cutplanepreinterp 1046 1046 1047 1047 Zoom reset 1048 1048 foreach axis { x y z } { 1049 1049 # Another problem fixed by a <view>. We looking into a data 1050 1050 # object for the name of the axes. This should be global to 1051 1051 # the viewer itself. 1052 1053 1052 set label [$_first hints ${axis}label] 1053 if { $label == "" } { 1054 1054 set label [string toupper $axis] 1055 1056 1057 1055 } 1056 # May be a space in the axis label. 1057 SendCmd [list axis name $axis $label] 1058 1058 } 1059 1059 if { [array size _fields] < 2 } { … … 1162 1162 SendCmd "camera pan $x $y" 1163 1163 } 1164 1165 1164 1166 1165 # ---------------------------------------------------------------------- … … 1283 1282 itcl::body Rappture::VtkGlyphViewer::InitSettings { args } { 1284 1283 foreach spec $args { 1285 if { [info exists _settings($_first -$spec)] } {1284 if { [info exists _settings($_first${spec})] } { 1286 1285 # Reset global setting with dataobj specific setting 1287 set _settings($spec) $_settings($_first -$spec)1286 set _settings($spec) $_settings($_first${spec}) 1288 1287 } 1289 1288 AdjustSetting $spec … … 1294 1293 # AdjustSetting -- 1295 1294 # 1296 # 1297 # 1298 # 1295 # Changes/updates a specific setting in the widget. There are 1296 # usually user-setable option. Commands are sent to the render 1297 # server. 1299 1298 # 1300 1299 itcl::body Rappture::VtkGlyphViewer::AdjustSetting {what {value ""}} { … … 1303 1302 } 1304 1303 switch -- $what { 1305 " background" {1304 "-background" { 1306 1305 set bgcolor [$itk_component(background) value] 1307 1308 1309 1310 "grey""black"1311 1306 array set fgcolors { 1307 "black" "white" 1308 "white" "black" 1309 "grey" "black" 1310 } 1312 1311 configure -plotbackground $bgcolor \ 1313 1314 1315 1316 } 1317 " axesVisible" {1318 set bool $_settings( axesVisible)1312 -plotforeground $fgcolors($bgcolor) 1313 $itk_component(view) delete "legend" 1314 DrawLegend 1315 } 1316 "-axesvisible" { 1317 set bool $_settings($what) 1319 1318 SendCmd "axis visible all $bool" 1320 1319 } 1321 " axisLabelsVisible" {1322 set bool $_settings( axisLabelsVisible)1320 "-axislabels" { 1321 set bool $_settings($what) 1323 1322 SendCmd "axis labels all $bool" 1324 1323 } 1325 "axisXGrid" - "axisYGrid" - "axisZGrid" { 1326 set axis [string tolower [string range $what 4 4]] 1324 "-axisminorticks" { 1325 set bool $_settings($what) 1326 SendCmd "axis minticks all $bool" 1327 } 1328 "-xgrid" - "-ygrid" - "-zgrid" { 1329 set axis [string tolower [string range $what 1 1]] 1327 1330 set bool $_settings($what) 1328 1331 SendCmd "axis grid $axis $bool" 1329 1332 } 1330 " axisMode" {1333 "-axismode" { 1331 1334 set mode [$itk_component(axisMode) value] 1332 1335 set mode [$itk_component(axisMode) translate $mode] … … 1334 1337 SendCmd "axis flymode $mode" 1335 1338 } 1336 " cutplaneEdges" {1339 "-cutplaneedges" { 1337 1340 set bool $_settings($what) 1338 1341 SendCmd "cutplane edges $bool" 1339 1342 } 1340 " cutplaneVisible" {1343 "-cutplanevisible" { 1341 1344 set bool $_settings($what) 1342 1345 SendCmd "cutplane visible $bool" 1343 1346 } 1344 " cutplaneWireframe" {1347 "-cutplanewireframe" { 1345 1348 set bool $_settings($what) 1346 1349 SendCmd "cutplane wireframe $bool" 1347 1350 } 1348 " cutplaneLighting" {1351 "-cutplanelighting" { 1349 1352 set bool $_settings($what) 1350 1353 SendCmd "cutplane lighting $bool" 1351 1354 } 1352 " cutplaneOpacity" {1355 "-cutplaneopacity" { 1353 1356 set val $_settings($what) 1354 1357 set sval [expr { 0.01 * double($val) }] 1355 1358 SendCmd "cutplane opacity $sval" 1356 1359 } 1357 " cutplanePreinterp" {1360 "-cutplanepreinterp" { 1358 1361 set bool $_settings($what) 1359 1362 SendCmd "cutplane preinterp $bool" 1360 1363 } 1361 " cutplaneXVisible" - "cutplaneYVisible" - "cutplaneZVisible" {1362 set axis [string tolower [string range $what 8 8]]1364 "-cutplanexvisible" - "-cutplaneyvisible" - "-cutplanezvisible" { 1365 set axis [string tolower [string range $what 9 9]] 1363 1366 set bool $_settings($what) 1364 1367 if { $bool } { … … 1369 1372 -troughcolor grey82 1370 1373 } 1371 1372 } 1373 " cutplaneXPosition" - "cutplaneYPosition" - "cutplaneZPosition" {1374 set axis [string tolower [string range $what 8 8]]1374 SendCmd "cutplane axis $axis $bool" 1375 } 1376 "-cutplanexposition" - "-cutplaneyposition" - "-cutplanezposition" { 1377 set axis [string tolower [string range $what 9 9]] 1375 1378 set pos [expr $_settings($what) * 0.01] 1376 1379 SendCmd "cutplane slice ${axis} ${pos}" 1377 1380 set _cutplanePending 0 1378 1381 } 1379 " colormap" {1380 set _changed( colormap) 11382 "-colormap" { 1383 set _changed($what) 1 1381 1384 StartBufferingCommands 1382 1385 set color [$itk_component(colormap) value] 1383 set _settings( colormap) $color1384 1385 if { $_settings(colormapVisible) } {1386 1387 set _settings(colormapVisible) 01388 1389 1390 if { !$_settings(colormapVisible) } {1391 1392 set _settings(colormapVisible) 11393 1394 1395 1386 set _settings($what) $color 1387 if { $color == "none" } { 1388 if { $_settings(-colormapvisible) } { 1389 SendCmd "glyphs colormode constant {}" 1390 set _settings(-colormapvisible) 0 1391 } 1392 } else { 1393 if { !$_settings(-colormapvisible) } { 1394 SendCmd "glyphs colormode $_colorMode $_curFldName" 1395 set _settings(-colormapvisible) 1 1396 } 1397 SetCurrentColormap $color 1398 } 1396 1399 StopBufferingCommands 1397 1398 } 1399 " glyphWireframe" {1400 set bool $_settings( glyphWireframe)1401 1402 } 1403 " glyphVisible" {1404 set bool $_settings( glyphVisible)1405 1400 EventuallyRequestLegend 1401 } 1402 "-glyphwireframe" { 1403 set bool $_settings($what) 1404 SendCmd "glyphs wireframe $bool" 1405 } 1406 "-glyphvisible" { 1407 set bool $_settings($what) 1408 SendCmd "glyphs visible $bool" 1406 1409 if { $bool } { 1407 1410 Rappture::Tooltip::for $itk_component(glyphs) \ … … 1411 1414 "Show the glyph" 1412 1415 } 1413 1414 } 1415 " glyphLighting" {1416 set bool $_settings( glyphLighting)1417 1418 } 1419 " glyphEdges" {1420 set bool $_settings( glyphEdges)1421 1422 } 1423 " glyphOutline" {1424 set bool $_settings( glyphOutline)1425 1426 } 1427 " glyphOpacity" {1428 set val $_settings( glyphOpacity)1416 DrawLegend 1417 } 1418 "-glyphlighting" { 1419 set bool $_settings($what) 1420 SendCmd "glyphs lighting $bool" 1421 } 1422 "-glyphedges" { 1423 set bool $_settings($what) 1424 SendCmd "glyphs edges $bool" 1425 } 1426 "-glyphoutline" { 1427 set bool $_settings($what) 1428 SendCmd "outline visible $bool" 1429 } 1430 "-glyphopacity" { 1431 set val $_settings($what) 1429 1432 set sval [expr { 0.01 * double($val) }] 1430 1431 } 1432 " field" {1433 SendCmd "glyphs opacity $sval" 1434 } 1435 "-field" { 1433 1436 set label [$itk_component(field) value] 1434 1437 set fname [$itk_component(field) translate $label] 1435 set _settings( field) $fname1438 set _settings($what) $fname 1436 1439 if { [info exists _fields($fname)] } { 1437 1440 foreach { label units components } $_fields($fname) break … … 1447 1450 return 1448 1451 } 1449 #SendCmd "dataset maprange explicit $_limits($_curFldName) $_curFldName" 1452 #if { ![info exists _limits($_curFldName)] } { 1453 # SendCmd "dataset maprange all" 1454 #} else { 1455 # SendCmd "dataset maprange explicit $_limits($_curFldName) $_curFldName" 1456 #} 1450 1457 #SendCmd "cutplane colormode $_colorMode $_curFldName" 1451 1458 SendCmd "glyphs colormode $_colorMode $_curFldName" 1452 1459 DrawLegend 1453 1460 } 1454 " legendVisible" {1455 if { !$_settings( legendVisible) } {1461 "-legendvisible" { 1462 if { !$_settings($what) } { 1456 1463 $itk_component(view) delete legend 1457 1458 1464 } 1465 DrawLegend 1459 1466 } 1460 1467 default { … … 1464 1471 } 1465 1472 1466 1467 1473 # 1468 1474 # RequestLegend -- 1469 1475 # 1470 # 1471 # 1476 # Request a new legend from the server. The size of the legend 1477 # is determined from the height of the canvas. 1472 1478 # 1473 1479 # This should be called when 1474 # 1475 # 1476 # 1477 # 1478 # 1480 # 1. A new current colormap is set. 1481 # 2. Window is resized. 1482 # 3. The limits of the data have changed. (Just need a redraw). 1483 # 4. Number of glyph have changed. (Just need a redraw). 1484 # 5. Legend becomes visible (Just need a redraw). 1479 1485 # 1480 1486 itcl::body Rappture::VtkGlyphViewer::RequestLegend {} { … … 1488 1494 set fname $_curFldName 1489 1495 if { [string match "component*" $fname] } { 1490 1496 set title "" 1491 1497 } else { 1492 1493 1494 1495 1496 1497 1498 1499 1498 if { [info exists _fields($fname)] } { 1499 foreach { title units } $_fields($fname) break 1500 if { $units != "" } { 1501 set title [format "%s (%s)" $title $units] 1502 } 1503 } else { 1504 set title $fname 1505 } 1500 1506 } 1501 1507 # If there's a title too, substract one more line … … 1508 1514 # Set the legend on the first heightmap dataset. 1509 1515 if { $_currentColormap != "" } { 1510 1511 1516 set cmap $_currentColormap 1517 SendCmdNoWait "legend $cmap $_colorMode $_curFldName {} $w $h 0" 1512 1518 } 1513 1519 } … … 1529 1535 if { [isconnected] } { 1530 1536 set rgb [Color2RGB $itk_option(-plotforeground)] 1531 1537 SendCmd "axis color all $rgb" 1532 1538 SendCmd "outline color $rgb" 1533 1539 #SendCmd "cutplane color $rgb" … … 1547 1553 checkbutton $inner.glyphs \ 1548 1554 -text "Glyphs" \ 1549 -variable [itcl::scope _settings( glyphVisible)] \1550 -command [itcl::code $this AdjustSetting glyphVisible] \1555 -variable [itcl::scope _settings(-glyphvisible)] \ 1556 -command [itcl::code $this AdjustSetting -glyphvisible] \ 1551 1557 -font "Arial 9" 1552 1558 1553 1559 checkbutton $inner.wireframe \ 1554 1560 -text "Wireframe" \ 1555 -variable [itcl::scope _settings( glyphWireframe)] \1556 -command [itcl::code $this AdjustSetting glyphWireframe] \1561 -variable [itcl::scope _settings(-glyphwireframe)] \ 1562 -command [itcl::code $this AdjustSetting -glyphwireframe] \ 1557 1563 -font "Arial 9" 1558 1564 1559 1565 checkbutton $inner.lighting \ 1560 1566 -text "Enable Lighting" \ 1561 -variable [itcl::scope _settings( glyphLighting)] \1562 -command [itcl::code $this AdjustSetting glyphLighting] \1567 -variable [itcl::scope _settings(-glyphlighting)] \ 1568 -command [itcl::code $this AdjustSetting -glyphlighting] \ 1563 1569 -font "Arial 9" 1564 1570 1565 1571 checkbutton $inner.edges \ 1566 1572 -text "Edges" \ 1567 -variable [itcl::scope _settings( glyphEdges)] \1568 -command [itcl::code $this AdjustSetting glyphEdges] \1573 -variable [itcl::scope _settings(-glyphedges)] \ 1574 -command [itcl::code $this AdjustSetting -glyphedges] \ 1569 1575 -font "Arial 9" 1570 1576 1571 1577 checkbutton $inner.outline \ 1572 1578 -text "Outline" \ 1573 -variable [itcl::scope _settings( glyphOutline)] \1574 -command [itcl::code $this AdjustSetting glyphOutline] \1579 -variable [itcl::scope _settings(-glyphoutline)] \ 1580 -command [itcl::code $this AdjustSetting -glyphoutline] \ 1575 1581 -font "Arial 9" 1576 1582 1577 1583 checkbutton $inner.legend \ 1578 1584 -text "Legend" \ 1579 -variable [itcl::scope _settings( legendVisible)] \1580 -command [itcl::code $this AdjustSetting legendVisible] \1585 -variable [itcl::scope _settings(-legendvisible)] \ 1586 -command [itcl::code $this AdjustSetting -legendvisible] \ 1581 1587 -font "Arial 9" 1582 1588 … … 1590 1596 "grey" "grey" 1591 1597 1592 $itk_component(background) value $_settings( background)1593 bind $inner.background <<Value>> [itcl::code $this AdjustSetting background]1598 $itk_component(background) value $_settings(-background) 1599 bind $inner.background <<Value>> [itcl::code $this AdjustSetting -background] 1594 1600 1595 1601 label $inner.opacity_l -text "Opacity" -font "Arial 9" 1596 1602 ::scale $inner.opacity -from 0 -to 100 -orient horizontal \ 1597 -variable [itcl::scope _settings( glyphOpacity)] \1603 -variable [itcl::scope _settings(-glyphopacity)] \ 1598 1604 -width 10 \ 1599 1605 -showvalue off \ 1600 -command [itcl::code $this AdjustSetting glyphOpacity]1601 1602 label $inner. scale_l -text "Scale" -font "Arial 9"1603 ::scale $inner. scale -from 1 -to 100 -orient horizontal \1604 -variable [itcl::scope _settings( glyphs-scale)] \1606 -command [itcl::code $this AdjustSetting -glyphopacity] 1607 1608 label $inner.gscale_l -text "Scale factor" -font "Arial 9" 1609 ::scale $inner.gscale -from 1 -to 100 -orient horizontal \ 1610 -variable [itcl::scope _settings(-glyphscale)] \ 1605 1611 -width 10 \ 1606 1612 -showvalue off \ 1607 -command [itcl::code $this AdjustSetting glyphs-scale] 1613 -command [itcl::code $this AdjustSetting -glyphscale] 1614 Rappture::Tooltip::for $inner.gscale "Set scaling multiplier (or constant size)" 1608 1615 1609 1616 itk_component add field_l { … … 1616 1623 } 1617 1624 bind $inner.field <<Value>> \ 1618 [itcl::code $this AdjustSetting field]1625 [itcl::code $this AdjustSetting -field] 1619 1626 1620 1627 label $inner.colormap_l -text "Colormap" -font "Arial 9" … … 1626 1633 $itk_component(colormap) value "BCGYR" 1627 1634 bind $inner.colormap <<Value>> \ 1628 [itcl::code $this AdjustSetting colormap]1635 [itcl::code $this AdjustSetting -colormap] 1629 1636 1630 1637 blt::table $inner \ 1631 0,0 $inner.field_l -anchor w -pady 2 \1632 0,1 $inner.field -anchor w -pady 2 -fill x \1633 1,0 $inner.colormap_l -anchor w -pady 2 \1634 1,1 $inner.colormap -anchor w -pady 2 -fill x \1635 1636 3,1 $inner.background-anchor w -pady 2 -fill x \1637 5,0 $inner.wireframe -anchor w -pady 2 -cspan 2 \1638 6,0 $inner.lighting -anchor w -pady 2 -cspan 2 \1639 7,0 $inner.edges -anchor w -pady 2 -cspan 2 \1640 8,0 $inner.outline -anchor w -pady 2 -cspan 2 \1641 9,0 $inner.legend -anchor w -pady 2 \1642 10,0 $inner.opacity_l -anchor w -pady 2 \1643 10,1 $inner.opacity -fill x -pady 2 -fill x \1638 0,0 $inner.field_l -anchor w -pady 2 \ 1639 0,1 $inner.field -anchor w -pady 2 -fill x \ 1640 1,0 $inner.colormap_l -anchor w -pady 2 \ 1641 1,1 $inner.colormap -anchor w -pady 2 -fill x \ 1642 3,0 $inner.background_l -anchor w -pady 2 \ 1643 3,1 $inner.background -anchor w -pady 2 -fill x \ 1644 5,0 $inner.wireframe -anchor w -pady 2 -cspan 2 \ 1645 6,0 $inner.lighting -anchor w -pady 2 -cspan 2 \ 1646 7,0 $inner.edges -anchor w -pady 2 -cspan 2 \ 1647 8,0 $inner.outline -anchor w -pady 2 -cspan 2 \ 1648 9,0 $inner.legend -anchor w -pady 2 \ 1649 10,0 $inner.opacity_l -anchor w -pady 2 \ 1650 10,1 $inner.opacity -fill x -pady 2 -fill x \ 1644 1651 1645 1652 blt::table configure $inner r* c* -resize none … … 1658 1665 1659 1666 checkbutton $inner.visible \ 1660 -text " ShowAxes" \1661 -variable [itcl::scope _settings( axesVisible)] \1662 -command [itcl::code $this AdjustSetting axesVisible] \1667 -text "Axes" \ 1668 -variable [itcl::scope _settings(-axesvisible)] \ 1669 -command [itcl::code $this AdjustSetting -axesvisible] \ 1663 1670 -font "Arial 9" 1664 1671 1665 1672 checkbutton $inner.labels \ 1666 -text " ShowAxis Labels" \1667 -variable [itcl::scope _settings( axisLabelsVisible)] \1668 -command [itcl::code $this AdjustSetting axisLabelsVisible] \1673 -text "Axis Labels" \ 1674 -variable [itcl::scope _settings(-axislabels)] \ 1675 -command [itcl::code $this AdjustSetting -axislabels] \ 1669 1676 -font "Arial 9" 1670 1671 checkbutton $inner. gridx\1672 -text " Show X Grid" \1673 -variable [itcl::scope _settings( axisXGrid)] \1674 -command [itcl::code $this AdjustSetting axisXGrid] \1677 label $inner.grid_l -text "Grid" -font "Arial 9" 1678 checkbutton $inner.xgrid \ 1679 -text "X" \ 1680 -variable [itcl::scope _settings(-xgrid)] \ 1681 -command [itcl::code $this AdjustSetting -xgrid] \ 1675 1682 -font "Arial 9" 1676 checkbutton $inner. gridy\1677 -text " Show Y Grid" \1678 -variable [itcl::scope _settings( axisYGrid)] \1679 -command [itcl::code $this AdjustSetting axisYGrid] \1683 checkbutton $inner.ygrid \ 1684 -text "Y" \ 1685 -variable [itcl::scope _settings(-ygrid)] \ 1686 -command [itcl::code $this AdjustSetting -ygrid] \ 1680 1687 -font "Arial 9" 1681 checkbutton $inner.gridz \ 1682 -text "Show Z Grid" \ 1683 -variable [itcl::scope _settings(axisZGrid)] \ 1684 -command [itcl::code $this AdjustSetting axisZGrid] \ 1688 checkbutton $inner.zgrid \ 1689 -text "Z" \ 1690 -variable [itcl::scope _settings(-zgrid)] \ 1691 -command [itcl::code $this AdjustSetting -zgrid] \ 1692 -font "Arial 9" 1693 checkbutton $inner.minorticks \ 1694 -text "Minor Ticks" \ 1695 -variable [itcl::scope _settings(-axisminorticks)] \ 1696 -command [itcl::code $this AdjustSetting -axisminorticks] \ 1685 1697 -font "Arial 9" 1686 1698 … … 1695 1707 "furthest_triad" "farthest" \ 1696 1708 "outer_edges" "outer" 1697 $itk_component(axisMode) value "static"1698 bind $inner.mode <<Value>> [itcl::code $this AdjustSetting axisMode]1709 $itk_component(axisMode) value $_settings(-axismode) 1710 bind $inner.mode <<Value>> [itcl::code $this AdjustSetting -axismode] 1699 1711 1700 1712 blt::table $inner \ 1701 0,0 $inner.visible -anchor w -cspan 2 \ 1702 1,0 $inner.labels -anchor w -cspan 2 \ 1703 2,0 $inner.gridx -anchor w -cspan 2 \ 1704 3,0 $inner.gridy -anchor w -cspan 2 \ 1705 4,0 $inner.gridz -anchor w -cspan 2 \ 1706 5,0 $inner.mode_l -anchor w -cspan 2 -padx { 2 0 } \ 1707 6,0 $inner.mode -fill x -cspan 2 1713 0,0 $inner.visible -anchor w -cspan 4 \ 1714 1,0 $inner.labels -anchor w -cspan 4 \ 1715 2,0 $inner.minorticks -anchor w -cspan 4 \ 1716 4,0 $inner.grid_l -anchor w \ 1717 4,1 $inner.xgrid -anchor w \ 1718 4,2 $inner.ygrid -anchor w \ 1719 4,3 $inner.zgrid -anchor w \ 1720 5,0 $inner.mode_l -anchor w -padx { 2 0 } \ 1721 5,1 $inner.mode -fill x -cspan 3 1708 1722 1709 1723 blt::table configure $inner r* c* -resize none 1710 blt::table configure $inner r7 c 1-resize expand1711 } 1712 1724 blt::table configure $inner r7 c6 -resize expand 1725 blt::table configure $inner r3 -height 0.125i 1726 } 1713 1727 1714 1728 itcl::body Rappture::VtkGlyphViewer::BuildCameraTab {} { … … 1772 1786 checkbutton $inner.visible \ 1773 1787 -text "Cutplanes" \ 1774 -variable [itcl::scope _settings( cutplaneVisible)] \1775 -command [itcl::code $this AdjustSetting cutplaneVisible] \1788 -variable [itcl::scope _settings(-cutplanevisible)] \ 1789 -command [itcl::code $this AdjustSetting -cutplanevisible] \ 1776 1790 -font "Arial 9" 1777 1791 1778 1792 checkbutton $inner.wireframe \ 1779 1793 -text "Wireframe" \ 1780 -variable [itcl::scope _settings( cutplaneWireframe)] \1781 -command [itcl::code $this AdjustSetting cutplaneWireframe] \1794 -variable [itcl::scope _settings(-cutplanewireframe)] \ 1795 -command [itcl::code $this AdjustSetting -cutplanewireframe] \ 1782 1796 -font "Arial 9" 1783 1797 1784 1798 checkbutton $inner.lighting \ 1785 1799 -text "Enable Lighting" \ 1786 -variable [itcl::scope _settings( cutplaneLighting)] \1787 -command [itcl::code $this AdjustSetting cutplaneLighting] \1800 -variable [itcl::scope _settings(-cutplanelighting)] \ 1801 -command [itcl::code $this AdjustSetting -cutplanelighting] \ 1788 1802 -font "Arial 9" 1789 1803 1790 1804 checkbutton $inner.edges \ 1791 1805 -text "Edges" \ 1792 -variable [itcl::scope _settings( cutplaneEdges)] \1793 -command [itcl::code $this AdjustSetting cutplaneEdges] \1806 -variable [itcl::scope _settings(-cutplaneedges)] \ 1807 -command [itcl::code $this AdjustSetting -cutplaneedges] \ 1794 1808 -font "Arial 9" 1795 1809 1796 1810 checkbutton $inner.preinterp \ 1797 1811 -text "Interpolate Scalars" \ 1798 -variable [itcl::scope _settings( cutplanePreinterp)] \1799 -command [itcl::code $this AdjustSetting cutplanePreinterp] \1812 -variable [itcl::scope _settings(-cutplanepreinterp)] \ 1813 -command [itcl::code $this AdjustSetting -cutplanepreinterp] \ 1800 1814 -font "Arial 9" 1801 1815 1802 1816 label $inner.opacity_l -text "Opacity" -font "Arial 9" 1803 1817 ::scale $inner.opacity -from 0 -to 100 -orient horizontal \ 1804 -variable [itcl::scope _settings( cutplaneOpacity)] \1818 -variable [itcl::scope _settings(-cutplaneopacity)] \ 1805 1819 -width 10 \ 1806 1820 -showvalue off \ 1807 -command [itcl::code $this AdjustSetting cutplaneOpacity]1808 $inner.opacity set $_settings( cutplaneOpacity)1821 -command [itcl::code $this AdjustSetting -cutplaneopacity] 1822 $inner.opacity set $_settings(-cutplaneopacity) 1809 1823 1810 1824 # X-value slicer... … … 1813 1827 -onimage [Rappture::icon x-cutplane-red] \ 1814 1828 -offimage [Rappture::icon x-cutplane-red] \ 1815 -command [itcl::code $this AdjustSetting cutplaneXVisible] \1816 -variable [itcl::scope _settings( cutplaneXVisible)] \1829 -command [itcl::code $this AdjustSetting -cutplanexvisible] \ 1830 -variable [itcl::scope _settings(-cutplanexvisible)] \ 1817 1831 } 1818 1832 Rappture::Tooltip::for $itk_component(xbutton) \ … … 1824 1838 -borderwidth 1 -highlightthickness 0 \ 1825 1839 -command [itcl::code $this EventuallySetCutplane x] \ 1826 -variable [itcl::scope _settings( cutplaneXPosition)] \1827 1840 -variable [itcl::scope _settings(-cutplanexposition)] \ 1841 -foreground red2 -font "Arial 9 bold" 1828 1842 } { 1829 1843 usual … … 1841 1855 -onimage [Rappture::icon y-cutplane-green] \ 1842 1856 -offimage [Rappture::icon y-cutplane-green] \ 1843 -command [itcl::code $this AdjustSetting cutplaneYVisible] \1844 -variable [itcl::scope _settings( cutplaneYVisible)] \1857 -command [itcl::code $this AdjustSetting -cutplaneyvisible] \ 1858 -variable [itcl::scope _settings(-cutplaneyvisible)] \ 1845 1859 } 1846 1860 Rappture::Tooltip::for $itk_component(ybutton) \ … … 1853 1867 -borderwidth 1 -highlightthickness 0 \ 1854 1868 -command [itcl::code $this EventuallySetCutplane y] \ 1855 -variable [itcl::scope _settings( cutplaneYPosition)] \1856 1869 -variable [itcl::scope _settings(-cutplaneyposition)] \ 1870 -foreground green3 -font "Arial 9 bold" 1857 1871 } { 1858 1872 usual … … 1870 1884 -onimage [Rappture::icon z-cutplane-blue] \ 1871 1885 -offimage [Rappture::icon z-cutplane-blue] \ 1872 -command [itcl::code $this AdjustSetting cutplaneZVisible] \1873 -variable [itcl::scope _settings( cutplaneZVisible)] \1886 -command [itcl::code $this AdjustSetting -cutplanezvisible] \ 1887 -variable [itcl::scope _settings(-cutplanezvisible)] \ 1874 1888 } { 1875 1876 1889 usual 1890 ignore -foreground 1877 1891 } 1878 1892 Rappture::Tooltip::for $itk_component(zbutton) \ … … 1885 1899 -borderwidth 1 -highlightthickness 0 \ 1886 1900 -command [itcl::code $this EventuallySetCutplane z] \ 1887 -variable [itcl::scope _settings( cutplaneZPosition)] \1888 1901 -variable [itcl::scope _settings(-cutplanezposition)] \ 1902 -foreground blue3 -font "Arial 9 bold" 1889 1903 } { 1890 1904 usual … … 1897 1911 1898 1912 blt::table $inner \ 1899 0,0 $inner.visible -anchor w -pady 2 -cspan 3 \ 1900 1,0 $inner.lighting -anchor w -pady 2 -cspan 3 \ 1901 2,0 $inner.wireframe -anchor w -pady 2 -cspan 3 \ 1902 3,0 $inner.edges -anchor w -pady 2 -cspan 3 \ 1903 4,0 $inner.preinterp -anchor w -pady 2 -cspan 3 \ 1904 5,0 $inner.opacity_l -anchor w -pady 2 -cspan 1 \ 1905 5,1 $inner.opacity -fill x -pady 2 -cspan 3 \ 1906 6,0 $inner.xbutton -anchor w -padx 2 -pady 2 \ 1907 7,0 $inner.ybutton -anchor w -padx 2 -pady 2 \ 1908 8,0 $inner.zbutton -anchor w -padx 2 -pady 2 \ 1909 6,1 $inner.xval -fill y -rspan 4 \ 1910 6,2 $inner.yval -fill y -rspan 4 \ 1911 6,3 $inner.zval -fill y -rspan 4 \ 1912 1913 0,0 $inner.visible -anchor w -pady 2 -cspan 3 \ 1914 1,0 $inner.lighting -anchor w -pady 2 -cspan 3 \ 1915 2,0 $inner.wireframe -anchor w -pady 2 -cspan 3 \ 1916 3,0 $inner.edges -anchor w -pady 2 -cspan 3 \ 1917 4,0 $inner.preinterp -anchor w -pady 2 -cspan 3 \ 1918 5,0 $inner.opacity_l -anchor w -pady 2 -cspan 1 \ 1919 5,1 $inner.opacity -fill x -pady 2 -cspan 3 \ 1920 6,0 $inner.xbutton -anchor w -padx 2 -pady 2 \ 1921 7,0 $inner.ybutton -anchor w -padx 2 -pady 2 \ 1922 8,0 $inner.zbutton -anchor w -padx 2 -pady 2 \ 1923 6,1 $inner.xval -fill y -rspan 4 \ 1924 6,2 $inner.yval -fill y -rspan 4 \ 1925 6,3 $inner.zval -fill y -rspan 4 \ 1913 1926 1914 1927 blt::table configure $inner r* c* -resize none 1915 1928 blt::table configure $inner r9 c4 -resize expand 1916 1929 } 1917 1918 1919 1930 1920 1931 # … … 2068 2079 # the code to handle aberrant cases. 2069 2080 2070 if { $_changed( glyphOpacity) } {2071 set style(-opacity) [expr $_settings( glyphOpacity) * 0.01]2072 } 2073 if { $_changed( colormap) } {2074 set style(-color) $_settings( colormap)2081 if { $_changed(-glyphopacity) } { 2082 set style(-opacity) [expr $_settings(-glyphopacity) * 0.01] 2083 } 2084 if { $_changed(-colormap) } { 2085 set style(-color) $_settings(-colormap) 2075 2086 } 2076 2087 if { $_currentColormap == "" } { 2077 2088 $itk_component(colormap) value $style(-color) 2078 2089 } 2090 2091 SendCmd "outline add $tag" 2092 SendCmd "outline color [Color2RGB $itk_option(-plotforeground)] $tag" 2093 SendCmd "outline visible $style(-outline) $tag" 2094 set _settings(-glyphoutline) $style(-outline) 2095 2079 2096 SendCmd "glyphs add $style(-shape) $tag" 2080 2097 SendCmd "glyphs edges $style(-edges) $tag" 2098 set _settings(-glyphedges) $style(-edges) 2099 2081 2100 # normscale=1 and gscale=1 are defaults 2082 2101 if {$style(-normscale) != 1} { … … 2086 2105 SendCmd "glyphs gscale $style(-gscale) $tag" 2087 2106 } 2088 SendCmd "outline add $tag" 2089 SendCmd "outline color [Color2RGB $itk_option(-plotforeground)] $tag" 2090 SendCmd "outline visible $style(-outline) $tag" 2091 set _settings(glyphOutline) $style(-outline) 2092 set _settings(glyphEdges) $style(-edges) 2107 2093 2108 # constant color only used if colormode set to constant 2094 2109 SendCmd "glyphs color [Color2RGB $itk_option(-plotforeground)] $tag" … … 2099 2114 SendCmd "glyphs quality $style(-quality) $tag" 2100 2115 SendCmd "glyphs lighting $style(-lighting) $tag" 2101 set _settings( glyphLighting) $style(-lighting)2116 set _settings(-glyphlighting) $style(-lighting) 2102 2117 SendCmd "glyphs linecolor [Color2RGB $style(-edgecolor)] $tag" 2103 2118 SendCmd "glyphs linewidth $style(-linewidth) $tag" 2104 2119 SendCmd "glyphs ptsize $style(-ptsize) $tag" 2105 2120 SendCmd "glyphs opacity $style(-opacity) $tag" 2106 set _settings( glyphOpacity) [expr $style(-opacity) * 100.0]2121 set _settings(-glyphopacity) [expr $style(-opacity) * 100.0] 2107 2122 SetCurrentColormap $style(-color) 2108 2123 SendCmd "glyphs wireframe $style(-wireframe) $tag" 2109 set _settings( glyphWireframe) $style(-wireframe)2124 set _settings(-glyphwireframe) $style(-wireframe) 2110 2125 } 2111 2126 … … 2161 2176 2162 2177 if { [string match "component*" $fname] } { 2163 2178 set title "" 2164 2179 } else { 2165 2166 2167 2168 2169 2170 2171 2172 2180 if { [info exists _fields($fname)] } { 2181 foreach { title units } $_fields($fname) break 2182 if { $units != "" } { 2183 set title [format "%s (%s)" $title $units] 2184 } 2185 } else { 2186 set title $fname 2187 } 2173 2188 } 2174 2189 # If there's a legend title, increase the offset by the line height. … … 2202 2217 } 2203 2218 2204 2205 2219 # ---------------------------------------------------------------------- 2206 2220 # USAGE: Slice move x|y|z <newval> … … 2236 2250 # ReceiveLegend -- 2237 2251 # 2238 # 2239 # 2240 # 2252 # Invoked automatically whenever the "legend" command comes in from 2253 # the rendering server. Indicates that binary image data with the 2254 # specified <size> will follow. 2241 2255 # 2242 2256 itcl::body Rappture::VtkGlyphViewer::ReceiveLegend { colormap title min max size } { … … 2252 2266 #puts stderr "read $size bytes for [image width $_image(legend)]x[image height $_image(legend)] legend>" 2253 2267 if { [catch {DrawLegend} errs] != 0 } { 2254 2255 2268 global errorInfo 2269 puts stderr "errs=$errs errorInfo=$errorInfo" 2256 2270 } 2257 2271 } … … 2261 2275 # DrawLegend -- 2262 2276 # 2263 # 2277 # Draws the legend in the own canvas on the right side of the plot area. 2264 2278 # 2265 2279 itcl::body Rappture::VtkGlyphViewer::DrawLegend {} { … … 2272 2286 2273 2287 if { [string match "component*" $fname] } { 2274 2288 set title "" 2275 2289 } else { 2276 2277 2278 2279 2280 2281 2282 2283 2290 if { [info exists _fields($fname)] } { 2291 foreach { title units } $_fields($fname) break 2292 if { $units != "" } { 2293 set title [format "%s (%s)" $title $units] 2294 } 2295 } else { 2296 set title $fname 2297 } 2284 2298 } 2285 2299 set x [expr $w - 2] 2286 if { !$_settings( legendVisible) } {2287 2288 2300 if { !$_settings(-legendvisible) } { 2301 $c delete legend 2302 return 2289 2303 } 2290 2304 if { [$c find withtag "legend"] == "" } { 2291 2292 2305 set y 2 2306 # If there's a legend title, create a text item for the title. 2293 2307 $c create text $x $y \ 2294 2295 2296 2308 -anchor ne \ 2309 -fill $itk_option(-plotforeground) -tags "title legend" \ 2310 -font $font 2297 2311 if { $title != "" } { 2298 2312 incr y $lineht 2299 2313 } 2300 2314 $c create text $x $y \ 2301 2315 -anchor ne \ 2302 2316 -fill $itk_option(-plotforeground) -tags "vmax legend" \ 2303 2317 -font $font 2304 2305 2318 incr y $lineht 2319 $c create image $x $y \ 2306 2320 -anchor ne \ 2307 2321 -image $_image(legend) -tags "colormap legend" 2308 2322 $c create rectangle $x $y 1 1 \ 2309 2323 -fill "" -outline "" -tags "sensor legend" 2310 2324 $c create text $x [expr {$h-2}] \ 2311 2325 -anchor se \ 2312 2326 -fill $itk_option(-plotforeground) -tags "vmin legend" \ 2313 2327 -font $font 2314 2315 2316 2328 $c bind sensor <Enter> [itcl::code $this EnterLegend %x %y] 2329 $c bind sensor <Leave> [itcl::code $this LeaveLegend] 2330 $c bind sensor <Motion> [itcl::code $this MotionLegend %x %y] 2317 2331 } 2318 2332 set x2 $x … … 2328 2342 if { [info exists _limits($_curFldName)] } { 2329 2343 foreach { vmin vmax } $_limits($_curFldName) break 2330 2331 2344 $c itemconfigure vmin -text [format %g $vmin] 2345 $c itemconfigure vmax -text [format %g $vmax] 2332 2346 } 2333 2347 set y 2 … … 2335 2349 if { $title != "" } { 2336 2350 $c itemconfigure title -text $title 2337 2338 2351 $c coords title $x $y 2352 incr y $lineht 2339 2353 $c raise title 2340 2354 } … … 2378 2392 invoke { 2379 2393 $itk_component(field) value $_curFldLabel 2380 AdjustSetting field2394 AdjustSetting -field 2381 2395 } 2382 2396 default { … … 2402 2416 # BuildColormap -- 2403 2417 # 2404 # 2418 # Build the designated colormap on the server. 2405 2419 # 2406 2420 itcl::body Rappture::VtkGlyphViewer::BuildColormap { name } { … … 2433 2447 set _view(zoom) 1.0 2434 2448 } 2435
Note: See TracChangeset
for help on using the changeset viewer.