Changeset 6340 for branches/1.6/gui/scripts/vtkvolumeviewer.tcl
- Timestamp:
- May 14, 2016, 6:13:27 PM (8 years ago)
- Location:
- branches/1.6
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/1.6
- Property svn:mergeinfo changed
/trunk merged: 6316,6325-6339
- Property svn:mergeinfo changed
-
branches/1.6/gui/scripts/vtkvolumeviewer.tcl
r6305 r6340 73 73 private method BuildVolumeTab {} 74 74 private method ChangeColormap { dataobj comp color } 75 private method Combo { option }76 75 private method Connect {} 77 76 private method CurrentDatasets {args} … … 91 90 private method IsValidObject { dataobj } 92 91 private method LeaveLegend {} 92 private method LegendTitleAction { option } 93 93 private method MotionLegend { x y } 94 94 private method Pan {option x y} … … 101 101 private method ReceiveDataset { args } 102 102 private method ReceiveImage { args } 103 private method ReceiveLegend { colormap title vmin vmax size }103 private method ReceiveLegend { colormap title min max size } 104 104 private method RequestLegend {} 105 105 private method Rotate {option x y} … … 224 224 array set _settings { 225 225 -axesvisible 1 226 -axisflymode static227 226 -axislabels 1 228 227 -axisminorticks 1 228 -axismode "static" 229 229 -background black 230 230 -color BCGYR … … 970 970 set _first "" 971 971 InitSettings -background \ 972 -xgrid -ygrid -zgrid -axis flymode \972 -xgrid -ygrid -zgrid -axismode \ 973 973 -axesvisible -axislabels -axisminorticks 974 974 StopBufferingCommands … … 1052 1052 -activeforeground $itk_option(-plotforeground) \ 1053 1053 -font "Arial 8" \ 1054 -command [itcl::code $this Combo invoke]1054 -command [itcl::code $this LegendTitleAction save] 1055 1055 set _fields($fname) [list $label $units $components] 1056 1056 if { $_curFldName == "" } { … … 1316 1316 } 1317 1317 switch -- $what { 1318 "-axesvisible" { 1319 set bool $_settings($what) 1320 SendCmd "axis visible all $bool" 1321 } 1322 "-axislabels" { 1323 set bool $_settings($what) 1324 SendCmd "axis labels all $bool" 1325 } 1326 "-axisminorticks" { 1327 set bool $_settings($what) 1328 SendCmd "axis minticks all $bool" 1329 } 1330 "-axismode" { 1331 set mode [$itk_component(axismode) value] 1332 set mode [$itk_component(axismode) translate $mode] 1333 set _settings($what) $mode 1334 SendCmd "axis flymode $mode" 1335 } 1318 1336 "-background" { 1319 1337 set bgcolor [$itk_component(background) value] … … 1329 1347 DrawLegend 1330 1348 } 1331 "-volumeoutline" { 1332 set bool $_settings($what) 1333 SendCmd "outline visible 0" 1334 foreach tag [CurrentDatasets -visible] { 1335 SendCmd "outline visible $bool $tag" 1336 } 1337 } 1338 "-legendvisible" { 1339 DrawLegend 1340 } 1341 "-volumevisible" { 1342 set bool $_settings($what) 1343 foreach tag [CurrentDatasets -visible] { 1344 SendCmd "volume visible $bool $tag" 1345 } 1346 if { $bool } { 1347 Rappture::Tooltip::for $itk_component(volume) \ 1348 "Hide the volume" 1349 } else { 1350 Rappture::Tooltip::for $itk_component(volume) \ 1351 "Show the volume" 1352 } 1353 } 1354 "-volumematerial" { 1355 set val $_settings($what) 1356 set diffuse [expr {0.01*$val}] 1357 set specular [expr {0.01*$val}] 1358 #set power [expr {sqrt(160*$val+1.0)}] 1359 set power [expr {$val+1.0}] 1360 foreach tag [CurrentDatasets -visible] { 1361 SendCmd "volume shading diffuse $diffuse $tag" 1362 SendCmd "volume shading specular $specular $power $tag" 1363 } 1364 } 1365 "-volumelighting" { 1366 set bool $_settings($what) 1367 foreach tag [CurrentDatasets -visible] { 1368 SendCmd "volume lighting $bool $tag" 1369 } 1370 } 1371 "-volumeopacity" { 1372 set val $_settings($what) 1373 set val [expr {0.01*$val}] 1374 foreach tag [CurrentDatasets -visible] { 1375 SendCmd "volume opacity $val $tag" 1376 } 1377 } 1378 "-volumequality" { 1379 set val $_settings($what) 1380 set val [expr {0.01*$val}] 1381 foreach tag [CurrentDatasets -visible] { 1382 SendCmd "volume quality $val $tag" 1383 } 1384 } 1385 "-axesvisible" { 1386 set bool $_settings($what) 1387 SendCmd "axis visible all $bool" 1388 } 1389 "-axislabels" { 1390 set bool $_settings($what) 1391 SendCmd "axis labels all $bool" 1392 } 1393 "-axisminorticks" { 1394 set bool $_settings($what) 1395 SendCmd "axis minticks all $bool" 1396 } 1397 "-xgrid" - "-ygrid" - "-zgrid" { 1398 set axis [string range $what 1 1] 1399 set bool $_settings($what) 1400 SendCmd "axis grid $axis $bool" 1401 } 1402 "-axisflymode" { 1403 set mode [$itk_component(axismode) value] 1404 set mode [$itk_component(axismode) translate $mode] 1405 set _settings($what) $mode 1406 SendCmd "axis flymode $mode" 1407 } 1408 "-cutplanesvisible" { 1409 set bool $_settings($what) 1410 foreach dataset [CurrentDatasets -visible] { 1411 SendCmd "$_cutplaneCmd visible $bool $dataset" 1412 } 1349 "-color" { 1350 set color [$itk_component(colormap) value] 1351 set _settings($what) $color 1352 foreach dataset [CurrentDatasets -visible $_first] { 1353 foreach {dataobj comp} [split $dataset -] break 1354 ChangeColormap $dataobj $comp $color 1355 } 1356 EventuallyRequestLegend 1413 1357 } 1414 1358 "-cutplanelighting" { … … 1436 1380 } 1437 1381 } 1438 "-xcutplanevisible" - "-ycutplanevisible" - "-zcutplanevisible" { 1439 set axis [string range $what 1 1] 1382 "-cutplanesvisible" { 1440 1383 set bool $_settings($what) 1441 if { $bool } {1442 $itk_component(${axis}CutScale) configure -state normal \1443 -troughcolor white1444 } else {1445 $itk_component(${axis}CutScale) configure -state disabled \1446 -troughcolor grey821447 }1448 1384 foreach dataset [CurrentDatasets -visible] { 1449 SendCmd "$_cutplaneCmd axis $axis $bool $dataset" 1450 } 1451 } 1452 "-xcutplaneposition" - "-ycutplaneposition" - "-zcutplaneposition" { 1453 set axis [string range $what 1 1] 1454 set pos [expr $_settings($what) * 0.01] 1455 foreach dataset [CurrentDatasets -visible] { 1456 SendCmd "$_cutplaneCmd slice ${axis} ${pos} $dataset" 1457 } 1458 set _cutplanePending 0 1459 } 1460 "-color" { 1461 set color [$itk_component(colormap) value] 1462 set _settings($what) $color 1463 foreach dataset [CurrentDatasets -visible $_first] { 1464 foreach {dataobj comp} [split $dataset -] break 1465 ChangeColormap $dataobj $comp $color 1466 } 1467 EventuallyRequestLegend 1385 SendCmd "$_cutplaneCmd visible $bool $dataset" 1386 } 1468 1387 } 1469 1388 "-field" { … … 1495 1414 SendCmd "camera reset" 1496 1415 DrawLegend 1416 } 1417 "-legendvisible" { 1418 DrawLegend 1419 } 1420 "-volumematerial" { 1421 set val $_settings($what) 1422 set diffuse [expr {0.01*$val}] 1423 set specular [expr {0.01*$val}] 1424 #set power [expr {sqrt(160*$val+1.0)}] 1425 set power [expr {$val+1.0}] 1426 foreach tag [CurrentDatasets -visible] { 1427 SendCmd "volume shading diffuse $diffuse $tag" 1428 SendCmd "volume shading specular $specular $power $tag" 1429 } 1430 } 1431 "-volumelighting" { 1432 set bool $_settings($what) 1433 foreach tag [CurrentDatasets -visible] { 1434 SendCmd "volume lighting $bool $tag" 1435 } 1436 } 1437 "-volumeopacity" { 1438 set val $_settings($what) 1439 set val [expr {0.01*$val}] 1440 foreach tag [CurrentDatasets -visible] { 1441 SendCmd "volume opacity $val $tag" 1442 } 1443 } 1444 "-volumeoutline" { 1445 set bool $_settings($what) 1446 SendCmd "outline visible 0" 1447 foreach tag [CurrentDatasets -visible] { 1448 SendCmd "outline visible $bool $tag" 1449 } 1450 } 1451 "-volumequality" { 1452 set val $_settings($what) 1453 set val [expr {0.01*$val}] 1454 foreach tag [CurrentDatasets -visible] { 1455 SendCmd "volume quality $val $tag" 1456 } 1457 } 1458 "-volumevisible" { 1459 set bool $_settings($what) 1460 foreach tag [CurrentDatasets -visible] { 1461 SendCmd "volume visible $bool $tag" 1462 } 1463 if { $bool } { 1464 Rappture::Tooltip::for $itk_component(volume) \ 1465 "Hide the volume" 1466 } else { 1467 Rappture::Tooltip::for $itk_component(volume) \ 1468 "Show the volume" 1469 } 1470 } 1471 "-xcutplanevisible" - "-ycutplanevisible" - "-zcutplanevisible" { 1472 set axis [string range $what 1 1] 1473 set bool $_settings($what) 1474 if { $bool } { 1475 $itk_component(${axis}CutScale) configure -state normal \ 1476 -troughcolor white 1477 } else { 1478 $itk_component(${axis}CutScale) configure -state disabled \ 1479 -troughcolor grey82 1480 } 1481 foreach dataset [CurrentDatasets -visible] { 1482 SendCmd "$_cutplaneCmd axis $axis $bool $dataset" 1483 } 1484 } 1485 "-xcutplaneposition" - "-ycutplaneposition" - "-zcutplaneposition" { 1486 set axis [string range $what 1 1] 1487 set pos [expr $_settings($what) * 0.01] 1488 foreach dataset [CurrentDatasets -visible] { 1489 SendCmd "$_cutplaneCmd slice ${axis} ${pos} $dataset" 1490 } 1491 set _cutplanePending 0 1492 } 1493 "-xgrid" - "-ygrid" - "-zgrid" { 1494 set axis [string range $what 1 1] 1495 set bool $_settings($what) 1496 SendCmd "axis grid $axis $bool" 1497 1497 } 1498 1498 default { … … 1807 1807 "furthest_triad" "farthest" \ 1808 1808 "outer_edges" "outer" 1809 $itk_component(axismode) value $_settings(-axis flymode)1810 bind $inner.mode <<Value>> [itcl::code $this AdjustSetting -axis flymode]1809 $itk_component(axismode) value $_settings(-axismode) 1810 bind $inner.mode <<Value>> [itcl::code $this AdjustSetting -axismode] 1811 1811 1812 1812 blt::table $inner \ … … 2073 2073 radiobutton $inner.vtk_button -text "VTK data file" \ 2074 2074 -variable [itcl::scope _downloadPopup(format)] \ 2075 -font " Helvetica 9" \2075 -font "Arial 9" \ 2076 2076 -value vtk 2077 2077 Rappture::Tooltip::for $inner.vtk_button "Save as VTK data file." … … 2148 2148 2149 2149 # ---------------------------------------------------------------------- 2150 # USAGE: ReceiveLegend <colormap> <title> < vmin> <vmax> <size>2150 # USAGE: ReceiveLegend <colormap> <title> <min> <max> <size> 2151 2151 # 2152 2152 # Invoked automatically whenever the "legend" command comes in from … … 2154 2154 # specified <size> will follow. 2155 2155 # ---------------------------------------------------------------------- 2156 itcl::body Rappture::VtkVolumeViewer::ReceiveLegend { colormap title vmin vmax size } {2156 itcl::body Rappture::VtkVolumeViewer::ReceiveLegend { colormap title min max size } { 2157 2157 if { [isconnected] } { 2158 2158 set bytes [ReceiveBytes $size] … … 2341 2341 2342 2342 # ---------------------------------------------------------------------- 2343 # USAGE: _dropdown post 2344 # USAGE: _dropdown unpost 2345 # USAGE: _dropdown select 2346 # 2347 # Used internally to handle the dropdown list for this combobox. The 2348 # post/unpost options are invoked when the list is posted or unposted 2349 # to manage the relief of the controlling button. The select option 2350 # is invoked whenever there is a selection from the list, to assign 2351 # the value back to the gauge. 2352 # ---------------------------------------------------------------------- 2353 itcl::body Rappture::VtkVolumeViewer::Combo {option} { 2343 # USAGE: LegendTitleAction post 2344 # USAGE: LegendTitleAction enter 2345 # USAGE: LegendTitleAction leave 2346 # USAGE: LegendTitleAction save 2347 # 2348 # Used internally to handle the dropdown list for the fields menu combobox. 2349 # The post option is invoked when the field title is pressed to launch the 2350 # dropdown. The enter option is invoked when the user mouses over the field 2351 # title. The leave option is invoked when the user moves the mouse away 2352 # from the field title. The save option is invoked whenever there is a 2353 # selection from the list, to alert the visualization server. 2354 # ---------------------------------------------------------------------- 2355 itcl::body Rappture::VtkVolumeViewer::LegendTitleAction {option} { 2354 2356 set c $itk_component(view) 2355 2357 switch -- $option { … … 2361 2363 tk_popup $itk_component(fieldmenu) $x $y 2362 2364 } 2363 activate{2365 enter { 2364 2366 $c itemconfigure title -fill red 2365 2367 } 2366 deactivate {2368 leave { 2367 2369 $c itemconfigure title -fill $itk_option(-plotforeground) 2368 2370 } 2369 invoke {2371 save { 2370 2372 $itk_component(field) value $_curFldLabel 2371 2373 AdjustSetting -field 2372 2374 } 2373 2375 default { 2374 error "bad option \"$option\": should be post, unpost, select"2376 error "bad option \"$option\": should be post, enter, leave or save" 2375 2377 } 2376 2378 }
Note: See TracChangeset
for help on using the changeset viewer.