Changeset 6340
- Timestamp:
- May 14, 2016, 6:13:27 PM (8 years ago)
- Location:
- branches/1.6
- Files:
-
- 15 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/flowvisviewer.tcl
r6305 r6340 2855 2855 radiobutton $inner.image_button -text "Image File" \ 2856 2856 -variable [itcl::scope _downloadPopup(format)] \ 2857 -font "Arial 9 2857 -font "Arial 9" \ 2858 2858 -value image 2859 2859 Rappture::Tooltip::for $inner.image_button \ -
branches/1.6/gui/scripts/mesh.tcl
r5679 r6340 211 211 set result [ReadUnstructuredGrid $path] 212 212 } elseif {[$_mesh element "node"] != "" && [$_mesh element "element"] != ""} { 213 puts stderr "WARNING: <node>/<element> mesh is deprecated. Please use an unstructured mesh instead." 213 214 set result [ReadNodesElements $path] 214 215 } … … 1438 1439 array set node2celltype { 1439 1440 3 5 1440 4 101441 4 9 1441 1442 8 12 1442 1443 6 13 … … 1452 1453 set numNodes [llength $nodeList] 1453 1454 if { ![info exists node2celltype($numNodes)] } { 1454 puts stderr "WARNING: bad node s/elements mesh \$path\": unknown number of indices \"$_numNodes\": should be 3, 4, 5, 6, or 8"1455 puts stderr "WARNING: bad node/element mesh \$path\": unknown number of nodes \"$numNodes\": should be 3, 4, 5, 6, or 8" 1455 1456 return 0 1456 1457 } 1457 1458 set celltype $node2celltype($numNodes) 1459 if { $_dim == 3 && $numNodes == 4 } { 1460 # If mesh is 3D, assume a tetrahedron (default is quad) 1461 # XXX: Does prophet output tets, and if so what is the node order? 1462 set celltype 10 1463 } 1458 1464 append celltypes "$celltype\n" 1459 if { $celltype == 12 } { 1460 # Formerly used voxels instead of hexahedrons. We're converting 1461 # it here to be backward compatible and still fault-tolerant of 1462 # non-axis aligned cells. 1465 if { $celltype == 9 } { 1466 # Fix the node order for quad cells 1467 # (this converts from PROPHET convention to VTK convention) 1468 set newList {} 1469 foreach i { 0 1 3 2 } { 1470 lappend newList [lindex $nodeList $i] 1471 } 1472 set nodeList $newList 1473 } elseif { $celltype == 12 } { 1474 # Fix the node order for hexahedron cells 1475 # (this converts from PROPHET convention to VTK convention) 1463 1476 set newList {} 1464 1477 foreach i { 0 1 3 2 4 5 7 6 } { -
branches/1.6/gui/scripts/nanovisviewer.tcl
r6309 r6340 2134 2134 radiobutton $inner.image_button -text "Image File" \ 2135 2135 -variable [itcl::scope _downloadPopup(format)] \ 2136 -font "Arial 9 2136 -font "Arial 9" \ 2137 2137 -value image 2138 2138 Rappture::Tooltip::for $inner.image_button \ -
branches/1.6/gui/scripts/probdisteditor.tcl
r5192 r6340 19 19 option add *ProbDistEditor*Entry.width 10 widgetDefault 20 20 21 21 itcl::class Rappture::ProbDistEditor { 22 22 inherit itk::Widget 23 23 24 24 itk_option define -fillcolor fillColor FillColor "" 25 25 26 constructor {args} { # defined below } 26 constructor {args} { 27 # defined below 28 } 27 29 public method value {{newval ""}} 28 30 public method mode {{newval ""}} … … 33 35 protected method _apply {op {widget ""}} 34 36 35 protected variable _dispatcher "" ;# dispatcher for !events36 protected variable _mode "" ;# type of distribution function37 protected variable _value ;# data values for mode-detail38 protected variable _uvalue ;# data values for mode-detail with units39 protected variable _umin ;# minimum allowed value for tool with units40 protected variable _umax ;# maximum allowed value for tool with units41 protected variable _units ;# units for min and max37 protected variable _dispatcher ""; # dispatcher for !events 38 protected variable _mode ""; # type of distribution function 39 protected variable _value; # data values for mode-detail 40 protected variable _uvalue; # data values for mode-detail with units 41 protected variable _umin; # minimum allowed value for tool with units 42 protected variable _umax; # maximum allowed value for tool with units 43 protected variable _units; # units for min and max 42 44 } 43 45 -
branches/1.6/gui/scripts/visviewer.tcl
r6305 r6340 20 20 itk_option define -receivecommand receiveCommand ReceiveCommand "" 21 21 22 private common _servers; # array of visualization server lists23 set _servers(nanovis) "localhost:2000"24 set _servers(pymol) "localhost:2020"25 set _servers(vmdmds) "localhost:2018"26 set _servers(vtkvis) "localhost:2010"27 28 private common _done; # Used to indicate status of send.29 private variable _buffer; # buffer for incoming/outgoing commands30 private variable _outbuf; # buffer for outgoing commands31 private variable _blockOnWrite 0; # Should writes to socket block?32 private variable _initialized33 private variable _isOpen 034 private variable _afterId -135 private variable _icon 036 private variable _trace 0; # Protocol tracing for console37 private variable _logging 0; # Command logging to file38 # Number of milliseconds to wait before idle timeout. If greater than 0,39 # automatically disconnect from the visualization server when idle timeout40 # is reached.41 private variable _idleTimeout 43200000; # 12 hours42 #private variable _idleTimeout 5000;# 5 seconds43 #private variable _idleTimeout 0; # No timeout44 45 protected variable _debug 046 protected variable _serverType "???";# Type of server.47 protected variable _sid ""; # socket connection to server48 protected variable _maxConnects 10049 protected variable _buffering 050 protected variable _cmdSeq 0; # Command sequence number51 protected variable _dispatcher ""; # dispatcher for !events52 protected variable _hosts ""; # list of hosts for server53 protected variable _parser ""; # interpreter for incoming commands54 protected variable _image55 protected variable _hostname56 protected variable _numConnectTries 057 protected variable _debugConsole 058 protected variable _reportClientInfo 159 # Number of milliscends to wait for server reply before displaying wait60 # dialog. If set to 0, dialog is never displayed.61 protected variable _waitTimeout 062 63 22 constructor { args } { 64 23 # defined below … … 67 26 # defined below 68 27 } 69 # Used internally only. 70 private method BuildConsole {} 71 private method DebugConsole {} 72 private method HideConsole {} 73 private method ReceiveHelper {} 74 private method SendDebugCommand {} 75 private method SendHelper {} 76 private method ServerDown {} 77 private method Shuffle { servers } 78 private method TraceComm { channel {data {}} } 79 private method WaitDialog { state } 80 private method Waiting { option widget } 28 public proc GetServerList { type } { 29 return $_servers($type) 30 } 31 public proc SetServerList { type namelist } { 32 # Convert the comma separated list into a Tcl list. OGRE also adds 33 # a trailing comma that we want to ignore. 34 regsub -all "," $namelist " " namelist 35 CheckNameList $namelist 36 set _servers($type) $namelist 37 } 38 public proc RemoveServerFromList { type server } { 39 if { ![info exists _servers($type)] } { 40 error "unknown server type \"$type\"" 41 } 42 set i [lsearch $_servers($type) $server] 43 if { $i < 0 } { 44 return 45 } 46 set _servers($type) [lreplace $_servers($type) $i $i] 47 } 48 public proc SetPymolServerList { namelist } { 49 SetServerList "pymol" $namelist 50 } 51 public proc SetNanovisServerList { namelist } { 52 SetServerList "nanovis" $namelist 53 } 54 public proc SetVtkServerList { namelist } { 55 SetServerList "vtk" $namelist 56 } 81 57 82 58 protected method CheckConnection {} … … 116 92 protected method ToggleConsole {} 117 93 94 protected variable _debug 0 95 protected variable _serverType "???";# Type of server. 96 protected variable _sid ""; # socket connection to server 97 protected variable _maxConnects 100 98 protected variable _buffering 0 99 protected variable _cmdSeq 0; # Command sequence number 100 protected variable _dispatcher ""; # dispatcher for !events 101 protected variable _hosts ""; # list of hosts for server 102 protected variable _parser ""; # interpreter for incoming commands 103 protected variable _image 104 protected variable _hostname 105 protected variable _numConnectTries 0 106 protected variable _debugConsole 0 107 protected variable _reportClientInfo 1 108 # Number of milliscends to wait for server reply before displaying wait 109 # dialog. If set to 0, dialog is never displayed. 110 protected variable _waitTimeout 0 111 112 private method BuildConsole {} 113 private method DebugConsole {} 114 private method HideConsole {} 115 private method ReceiveHelper {} 116 private method SendDebugCommand {} 117 private method SendHelper {} 118 private method ServerDown {} 119 private method Shuffle { servers } 120 private method TraceComm { channel {data {}} } 121 private method WaitDialog { state } 122 private method Waiting { option widget } 123 118 124 private proc CheckNameList { namelist } { 119 125 foreach host $namelist { … … 124 130 } 125 131 } 126 public proc GetServerList { type } { 127 return $_servers($type) 128 } 129 public proc SetServerList { type namelist } { 130 # Convert the comma separated list into a Tcl list. OGRE also adds 131 # a trailing comma that we want to ignore. 132 regsub -all "," $namelist " " namelist 133 CheckNameList $namelist 134 set _servers($type) $namelist 135 } 136 public proc RemoveServerFromList { type server } { 137 if { ![info exists _servers($type)] } { 138 error "unknown server type \"$type\"" 139 } 140 set i [lsearch $_servers($type) $server] 141 if { $i < 0 } { 142 return 143 } 144 set _servers($type) [lreplace $_servers($type) $i $i] 145 } 146 public proc SetPymolServerList { namelist } { 147 SetServerList "pymol" $namelist 148 } 149 public proc SetNanovisServerList { namelist } { 150 SetServerList "nanovis" $namelist 151 } 152 public proc SetVtkServerList { namelist } { 153 SetServerList "vtk" $namelist 154 } 132 133 private variable _buffer; # buffer for incoming/outgoing commands 134 private variable _outbuf; # buffer for outgoing commands 135 private variable _blockOnWrite 0; # Should writes to socket block? 136 private variable _initialized 137 private variable _isOpen 0 138 private variable _afterId -1 139 private variable _icon 0 140 private variable _trace 0; # Protocol tracing for console 141 private variable _logging 0; # Command logging to file 142 # Number of milliseconds to wait before idle timeout. If greater than 0, 143 # automatically disconnect from the visualization server when idle timeout 144 # is reached. 145 private variable _idleTimeout 43200000; # 12 hours 146 #private variable _idleTimeout 5000;# 5 seconds 147 #private variable _idleTimeout 0; # No timeout 148 149 private common _servers; # array of visualization server lists 150 set _servers(nanovis) "localhost:2000" 151 set _servers(pymol) "localhost:2020" 152 set _servers(vmdmds) "localhost:2018" 153 set _servers(vtkvis) "localhost:2010" 154 private common _done; # Used to indicate status of send. 155 155 } 156 156 … … 863 863 -xscrollmode auto -yscrollmode auto 864 864 text $inner.scrl.text \ 865 -font "Arial 9 865 -font "Arial 9" -background white -relief sunken -bd 1 \ 866 866 -height 5 -wrap word -width 60 867 867 $inner.scrl contents $inner.scrl.text -
branches/1.6/gui/scripts/vtkglyphviewer.tcl
r6305 r6340 97 97 private method ReceiveDataset { args } 98 98 private method ReceiveImage { args } 99 private method ReceiveLegend { colormap title vmin vmax size }99 private method ReceiveLegend { colormap title min max size } 100 100 private method RequestLegend {} 101 101 private method Rotate {option x y} … … 144 144 private variable _rotatePending 0 145 145 private variable _cutplanePending 0 146 private variable _field ""147 146 private variable _colorMode "vmag"; # Mode of colormap (vmag or scalar) 148 147 private variable _fields … … 2110 2109 SendCmd "camera zoom $_view($what)" 2111 2110 } 2112 2111 } 2113 2112 } 2114 2113 } … … 2144 2143 radiobutton $inner.vtk_button -text "VTK data file" \ 2145 2144 -variable [itcl::scope _downloadPopup(format)] \ 2146 -font "Arial 9 2145 -font "Arial 9" \ 2147 2146 -value vtk 2148 2147 Rappture::Tooltip::for $inner.vtk_button "Save as VTK data file." 2149 2148 radiobutton $inner.image_button -text "Image File" \ 2150 2149 -variable [itcl::scope _downloadPopup(format)] \ 2151 -font "Arial 9 2150 -font "Arial 9" \ 2152 2151 -value image 2153 2152 Rappture::Tooltip::for $inner.image_button \ -
branches/1.6/gui/scripts/vtkheightmapviewer.tcl
r6305 r6340 71 71 private method BuildDownloadPopup { widget command } 72 72 private method CameraReset {} 73 private method Combo { option }74 73 private method Connect {} 75 74 private method CurrentDatasets {args} … … 88 87 private method IsValidObject { dataobj } 89 88 private method LeaveLegend {} 89 private method LegendTitleAction { option } 90 90 private method MotionLegend { x y } 91 91 private method Pan {option x y} … … 214 214 215 215 array set _settings { 216 -ax isflymode "static"216 -axesvisible 1 217 217 -axislabels 1 218 218 -axisminorticks 1 219 -axis visible 1219 -axismode "static" 220 220 -colormap BCGYR 221 221 -colormapdiscrete 0 … … 243 243 array set _changed { 244 244 -colormap 0 245 -colormapdiscrete 0 246 -colormapvisible 0 247 -edges 0 248 -isolinecolor 0 249 -isolinesvisible 0 245 250 -numisolines 0 246 251 -opacity 0 252 -wireframe 0 247 253 } 248 254 itk_component add view { … … 1014 1020 -activeforeground $itk_option(-plotforeground) \ 1015 1021 -font "Arial 8" \ 1016 -command [itcl::code $this Combo invoke]1022 -command [itcl::code $this LegendTitleAction save] 1017 1023 set _fields($fname) [list $label $units $components] 1018 1024 if { $_curFldName == "" } { … … 1087 1093 PanCamera 1088 1094 InitSettings -xgrid -ygrid -zgrid \ 1089 -ax isvisible -axislabels -heightmapscale -field -isheightmap \1095 -axesvisible -axislabels -heightmapscale -field -isheightmap \ 1090 1096 -numisolines 1091 1097 if { [array size _fields] < 2 } { … … 1348 1354 } 1349 1355 switch -- $what { 1350 "-axisflymode" { 1351 set mode [$itk_component(axisflymode) value] 1352 set mode [$itk_component(axisflymode) translate $mode] 1353 set _settings($what) $mode 1354 SendCmd "axis flymode $mode" 1356 "-axesvisible" { 1357 set bool $_settings($what) 1358 SendCmd "axis visible all $bool" 1355 1359 } 1356 1360 "-axislabels" { … … 1362 1366 SendCmd "axis minticks all $bool" 1363 1367 } 1364 "-axisvisible" { 1365 set bool $_settings($what) 1366 SendCmd "axis visible all $bool" 1368 "-axismode" { 1369 set mode [$itk_component(axismode) value] 1370 set mode [$itk_component(axismode) translate $mode] 1371 set _settings($what) $mode 1372 SendCmd "axis flymode $mode" 1367 1373 } 1368 1374 "-background" { … … 1388 1394 if { $color == "none" } { 1389 1395 if { $_settings(-colormapvisible) } { 1396 set _changed(-colormapvisible) 1 1390 1397 SendCmd "heightmap surface 0" 1391 1398 set _settings(-colormapvisible) 0 … … 1393 1400 } else { 1394 1401 if { !$_settings(-colormapvisible) } { 1402 set _changed(-colormapvisible) 1 1395 1403 SendCmd "heightmap surface 1" 1396 1404 set _settings(-colormapvisible) 1 … … 1405 1413 EventuallyRequestLegend 1406 1414 } 1407 "-colormapvisible" {1408 set bool $_settings($what)1409 SendCmd "heightmap surface $bool"1410 }1411 1415 "-colormapdiscrete" { 1416 set _changed($what) 1 1412 1417 set bool $_settings($what) 1413 1418 set numColors [expr $_settings(-numisolines) + 1] … … 1425 1430 EventuallyRequestLegend 1426 1431 } 1432 "-colormapvisible" { 1433 set _changed($what) 1 1434 set bool $_settings($what) 1435 SendCmd "heightmap surface $bool" 1436 } 1427 1437 "-edges" { 1438 set _changed($what) 1 1428 1439 set bool $_settings($what) 1429 1440 SendCmd "heightmap edges $bool" … … 1571 1582 } 1572 1583 "-isolinecolor" { 1584 set _changed($what) 1 1573 1585 set color [$itk_component(isolinecolor) value] 1574 1586 if { $color == "none" } { 1575 1587 if { $_settings(-isolinesvisible) } { 1588 set _changed(-isolinesvisible) 1 1576 1589 SendCmd "heightmap isolines 0" 1577 1590 set _settings(-isolinesvisible) 0 1578 1591 } 1579 1592 } else { 1593 set _settings($what) $color 1580 1594 if { !$_settings(-isolinesvisible) } { 1595 set _changed(-isolinesvisible) 1 1581 1596 SendCmd "heightmap isolines 1" 1582 1597 set _settings(-isolinesvisible) 1 … … 1587 1602 } 1588 1603 "-isolinesvisible" { 1604 set _changed($what) 1 1589 1605 set bool $_settings($what) 1606 if { $bool } { 1607 $itk_component(isolinecolor) value $_settings(-isolinecolor) 1608 } 1590 1609 SendCmd "heightmap isolines $bool" 1591 1610 DrawLegend … … 1631 1650 } 1632 1651 "-outline" { 1652 set _changed($what) 1 1633 1653 if { $_settings(-isheightmap) } { 1634 1654 SendCmd "outline visible 0" … … 1654 1674 } 1655 1675 "-wireframe" { 1676 set _changed($what) 1 1656 1677 set bool $_settings($what) 1657 1678 SendCmd "heightmap wireframe $bool" … … 1714 1735 set cmap $_currentColormap 1715 1736 if { ![info exists _colormaps($cmap)] } { 1716 BuildColormap $cmap1717 set _colormaps($cmap) 11737 BuildColormap $cmap 1738 set _colormaps($cmap) 1 1718 1739 } 1719 1740 #SendCmd "legend $cmap scalar $_curFldName {} $w $h 0" … … 2031 2052 checkbutton $inner.visible \ 2032 2053 -text "Axes" \ 2033 -variable [itcl::scope _settings(-ax isvisible)] \2034 -command [itcl::code $this AdjustSetting -ax isvisible] \2054 -variable [itcl::scope _settings(-axesvisible)] \ 2055 -command [itcl::code $this AdjustSetting -axesvisible] \ 2035 2056 -font "Arial 9" 2036 2057 checkbutton $inner.labels \ … … 2063 2084 label $inner.mode_l -text "Mode" -font "Arial 9" 2064 2085 2065 itk_component add axis flymode {2086 itk_component add axismode { 2066 2087 Rappture::Combobox $inner.mode -width 10 -editable 0 2067 2088 } … … 2071 2092 "furthest_triad" "farthest" \ 2072 2093 "outer_edges" "outer" 2073 $itk_component(axis flymode) value $_settings(-axisflymode)2074 bind $inner.mode <<Value>> [itcl::code $this AdjustSetting -axis flymode]2094 $itk_component(axismode) value $_settings(-axismode) 2095 bind $inner.mode <<Value>> [itcl::code $this AdjustSetting -axismode] 2075 2096 2076 2097 blt::table $inner \ … … 2209 2230 radiobutton $inner.vtk_button -text "VTK data file" \ 2210 2231 -variable [itcl::scope _downloadPopup(format)] \ 2211 -font "Arial 9 2232 -font "Arial 9" \ 2212 2233 -value vtk 2213 2234 Rappture::Tooltip::for $inner.vtk_button "Save as VTK data file." 2214 2235 radiobutton $inner.image_button -text "Image File" \ 2215 2236 -variable [itcl::scope _downloadPopup(format)] \ 2216 -font "Arial 9 2237 -font "Arial 9" \ 2217 2238 -value image 2218 2239 Rappture::Tooltip::for $inner.image_button \ … … 2255 2276 set tag $dataobj-$comp 2256 2277 array set style { 2257 -color BCGYR 2258 -levels 10 2259 -opacity 1.0 2278 -color BCGYR 2279 -colormapvisible 1 2280 -edgecolor black 2281 -edges 0 2282 -isolinecolor black 2283 -isolinesvisible 1 2284 -isolinewidth 1.0 2285 -levels 10 2286 -linewidth 1.0 2287 -opacity 1.0 2288 -outline 0 2289 -wireframe 0 2260 2290 } 2261 2291 set stylelist [$dataobj style $comp] … … 2295 2325 DrawLegend 2296 2326 } 2327 foreach setting {-edges -outline -wireframe \ 2328 -colormapvisible -isolinecolor -isolinesvisible} { 2329 if {$_changed($setting)} { 2330 # User-modified UI setting overrides style 2331 set style($setting) $_settings($setting) 2332 } else { 2333 # Set UI control to style setting (tool provided or default) 2334 set _settings($setting) $style($setting) 2335 } 2336 } 2337 2297 2338 SendCmd "outline add $tag" 2298 2339 SendCmd "outline color [Color2RGB $itk_option(-plotforeground)] $tag" 2299 SendCmd "outline visible $_settings(-outline) $tag" 2340 SendCmd "outline visible $style(-outline) $tag" 2341 2300 2342 set scale [GetHeightmapScale] 2301 2343 SendCmd "[list heightmap add contourlist $_contourList $scale $tag]" 2302 2344 set _comp2scale($tag) $_settings(-heightmapscale) 2303 SendCmd "heightmap edges $_settings(-edges) $tag" 2304 SendCmd "heightmap wireframe $_settings(-wireframe) $tag" 2345 SendCmd "heightmap edges $style(-edges) $tag" 2346 SendCmd "heightmap linecolor [Color2RGB $style(-edgecolor)] $tag" 2347 SendCmd "heightmap linewidth $style(-linewidth) $tag" 2348 SendCmd "heightmap wireframe $style(-wireframe) $tag" 2305 2349 SetCurrentColormap $style(-color) 2306 set color [$itk_component(isolinecolor) value] 2307 SendCmd "heightmap isolinecolor [Color2RGB $color] $tag" 2350 SendCmd "heightmap isolinecolor [Color2RGB $style(-isolinecolor)] $tag" 2351 $itk_component(isolinecolor) value $style(-isolinecolor) 2352 SendCmd "heightmap isolinewidth $style(-isolinewidth) $tag" 2308 2353 SendCmd "heightmap lighting $_settings(-isheightmap) $tag" 2309 SendCmd "heightmap isolines $ _settings(-isolinesvisible) $tag"2310 SendCmd "heightmap surface $ _settings(-colormapvisible) $tag"2354 SendCmd "heightmap isolines $style(-isolinesvisible) $tag" 2355 SendCmd "heightmap surface $style(-colormapvisible) $tag" 2311 2356 SendCmd "heightmap opacity $style(-opacity) $tag" 2312 2357 set _settings(-opacity) [expr $style(-opacity) * 100.0] … … 2434 2479 } 2435 2480 2436 $c bind title <ButtonPress> [itcl::code $this Combopost]2437 $c bind title <Enter> [itcl::code $this Combo activate]2438 $c bind title <Leave> [itcl::code $this Combo deactivate]2481 $c bind title <ButtonPress> [itcl::code $this LegendTitleAction post] 2482 $c bind title <Enter> [itcl::code $this LegendTitleAction enter] 2483 $c bind title <Leave> [itcl::code $this LegendTitleAction leave] 2439 2484 # Reset the item coordinates according the current size of the plot. 2440 2485 if { [info exists _limits($_curFldName)] } { … … 2550 2595 2551 2596 # ---------------------------------------------------------------------- 2552 # USAGE: _dropdown post 2553 # USAGE: _dropdown unpost 2554 # USAGE: _dropdown select 2555 # 2556 # Used internally to handle the dropdown list for this combobox. The 2557 # post/unpost options are invoked when the list is posted or unposted 2558 # to manage the relief of the controlling button. The select option 2559 # is invoked whenever there is a selection from the list, to assign 2560 # the value back to the gauge. 2561 # ---------------------------------------------------------------------- 2562 itcl::body Rappture::VtkHeightmapViewer::Combo {option} { 2597 # USAGE: LegendTitleAction post 2598 # USAGE: LegendTitleAction enter 2599 # USAGE: LegendTitleAction leave 2600 # USAGE: LegendTitleAction save 2601 # 2602 # Used internally to handle the dropdown list for the fields menu combobox. 2603 # The post option is invoked when the field title is pressed to launch the 2604 # dropdown. The enter option is invoked when the user mouses over the field 2605 # title. The leave option is invoked when the user moves the mouse away 2606 # from the field title. The save option is invoked whenever there is a 2607 # selection from the list, to alert the visualization server. 2608 # ---------------------------------------------------------------------- 2609 itcl::body Rappture::VtkHeightmapViewer::LegendTitleAction {option} { 2563 2610 set c $itk_component(view) 2564 2611 switch -- $option { … … 2570 2617 tk_popup $itk_component(fieldmenu) $x $y 2571 2618 } 2572 activate{2619 enter { 2573 2620 $c itemconfigure title -fill red 2574 2621 } 2575 deactivate {2622 leave { 2576 2623 $c itemconfigure title -fill $itk_option(-plotforeground) 2577 2624 } 2578 invoke {2625 save { 2579 2626 $itk_component(field) value $_curFldLabel 2580 2627 AdjustSetting -field 2581 2628 } 2582 2629 default { 2583 error "bad option \"$option\": should be post, unpost, select"2630 error "bad option \"$option\": should be post, enter, leave or save" 2584 2631 } 2585 2632 } -
branches/1.6/gui/scripts/vtkimageviewer.tcl
r6305 r6340 70 70 private method BuildImageTab {} 71 71 private method BuildDownloadPopup { widget command } 72 private method Combo { option }73 72 private method Connect {} 74 73 private method CurrentDatasets {args} … … 86 85 private method IsValidObject { dataobj } 87 86 private method LeaveLegend {} 87 private method LegendTitleAction { option } 88 88 private method MotionLegend { x y } 89 89 private method Pan {option x y} … … 209 209 210 210 array set _settings { 211 -ax isflymode "static"211 -axesvisible 1 212 212 -axislabels 1 213 213 -axisminorticks 1 214 -axis visible 1214 -axismode "static" 215 215 -backingcolor white 216 216 -backingvisible 1 … … 987 987 -activeforeground $itk_option(-plotforeground) \ 988 988 -font "Arial 8" \ 989 -command [itcl::code $this Combo invoke]989 -command [itcl::code $this LegendTitleAction save] 990 990 set _fields($fname) [list $label $units $components] 991 991 if { $_curFldName == "" } { … … 1044 1044 PanCamera 1045 1045 InitSettings -xgrid -ygrid -zgrid \ 1046 -ax isvisible -axislabels -field -view3d1046 -axesvisible -axislabels -field -view3d 1047 1047 if { [array size _fields] < 2 } { 1048 1048 catch {blt::table forget $itk_component(field) $itk_component(field_l)} … … 1295 1295 } 1296 1296 switch -- $what { 1297 "-axisflymode" { 1298 set mode [$itk_component(axisflymode) value] 1299 set mode [$itk_component(axisflymode) translate $mode] 1300 set _settings($what) $mode 1301 SendCmd "axis flymode $mode" 1297 "-axesvisible" { 1298 set bool $_settings($what) 1299 SendCmd "axis visible all $bool" 1302 1300 } 1303 1301 "-axislabels" { … … 1309 1307 SendCmd "axis minticks all $bool" 1310 1308 } 1311 "-axisvisible" { 1312 set bool $_settings($what) 1313 SendCmd "axis visible all $bool" 1309 "-axismode" { 1310 set mode [$itk_component(axismode) value] 1311 set mode [$itk_component(axismode) translate $mode] 1312 set _settings($what) $mode 1313 SendCmd "axis flymode $mode" 1314 1314 } 1315 1315 "-background" { … … 1393 1393 SendCmd "camera reset" 1394 1394 DrawLegend 1395 } 1396 "-legendvisible" { 1397 if { !$_settings($what) } { 1398 $itk_component(view) delete legend 1399 } 1400 DrawLegend 1401 } 1402 "-level" { 1403 set val $_settings($what) 1404 SendCmd "image level $val" 1405 } 1406 "-opacity" { 1407 set _changed($what) 1 1408 if { $_settings(-view3d) } { 1409 set _settings(-saveopacity) $_settings($what) 1410 set val [expr $_settings($what) * 0.01] 1411 SendCmd "image opacity $val" 1412 } else { 1413 SendCmd "image opacity 1.0" 1414 } 1415 } 1416 "-outline" { 1417 set bool $_settings($what) 1418 SendCmd "outline visible $bool" 1419 } 1420 "-stretchtofit" { 1421 set bool $_settings($what) 1422 if { $bool } { 1423 if { $_settings(-view3d) } { 1424 SendCmd "camera aspect native" 1425 } else { 1426 SendCmd "camera aspect window" 1427 } 1428 } else { 1429 SendCmd "camera aspect native" 1430 } 1395 1431 } 1396 1432 "-view3d" { … … 1448 1484 set val $_settings($what) 1449 1485 SendCmd "image window $val" 1450 }1451 "-level" {1452 set val $_settings($what)1453 SendCmd "image level $val"1454 }1455 "-legendvisible" {1456 if { !$_settings($what) } {1457 $itk_component(view) delete legend1458 }1459 DrawLegend1460 }1461 "-opacity" {1462 set _changed($what) 11463 if { $_settings(-view3d) } {1464 set _settings(-saveopacity) $_settings($what)1465 set val [expr $_settings($what) * 0.01]1466 SendCmd "image opacity $val"1467 } else {1468 SendCmd "image opacity 1.0"1469 }1470 }1471 "-outline" {1472 set bool $_settings($what)1473 SendCmd "outline visible $bool"1474 }1475 "-stretchtofit" {1476 set bool $_settings($what)1477 if { $bool } {1478 if { $_settings(-view3d) } {1479 SendCmd "camera aspect native"1480 } else {1481 SendCmd "camera aspect window"1482 }1483 } else {1484 SendCmd "camera aspect native"1485 }1486 1486 } 1487 1487 "-xgrid" - "-ygrid" - "-zgrid" { … … 1795 1795 checkbutton $inner.visible \ 1796 1796 -text "Axes" \ 1797 -variable [itcl::scope _settings(-ax isvisible)] \1798 -command [itcl::code $this AdjustSetting -ax isvisible] \1797 -variable [itcl::scope _settings(-axesvisible)] \ 1798 -command [itcl::code $this AdjustSetting -axesvisible] \ 1799 1799 -font "Arial 9" 1800 1800 checkbutton $inner.labels \ … … 1827 1827 label $inner.mode_l -text "Mode" -font "Arial 9" 1828 1828 1829 itk_component add axis flymode {1829 itk_component add axismode { 1830 1830 Rappture::Combobox $inner.mode -width 10 -editable 0 1831 1831 } … … 1835 1835 "furthest_triad" "farthest" \ 1836 1836 "outer_edges" "outer" 1837 $itk_component(axis flymode) value $_settings(-axisflymode)1838 bind $inner.mode <<Value>> [itcl::code $this AdjustSetting -axis flymode]1837 $itk_component(axismode) value $_settings(-axismode) 1838 bind $inner.mode <<Value>> [itcl::code $this AdjustSetting -axismode] 1839 1839 1840 1840 blt::table $inner \ … … 1973 1973 radiobutton $inner.vtk_button -text "VTK data file" \ 1974 1974 -variable [itcl::scope _downloadPopup(format)] \ 1975 -font "Arial 9 1975 -font "Arial 9" \ 1976 1976 -value vtk 1977 1977 Rappture::Tooltip::for $inner.vtk_button "Save as VTK data file." 1978 1978 radiobutton $inner.image_button -text "Image File" \ 1979 1979 -variable [itcl::scope _downloadPopup(format)] \ 1980 -font "Arial 9 1980 -font "Arial 9" \ 1981 1981 -value image 1982 1982 Rappture::Tooltip::for $inner.image_button \ … … 2153 2153 set x1 [expr $x2 - ($iw*12)/10] 2154 2154 2155 $c bind title <ButtonPress> [itcl::code $this Combopost]2156 $c bind title <Enter> [itcl::code $this Combo activate]2157 $c bind title <Leave> [itcl::code $this Combo deactivate]2155 $c bind title <ButtonPress> [itcl::code $this LegendTitleAction post] 2156 $c bind title <Enter> [itcl::code $this LegendTitleAction enter] 2157 $c bind title <Leave> [itcl::code $this LegendTitleAction leave] 2158 2158 # Reset the item coordinates according the current size of the plot. 2159 2159 if { [info exists _limits($_curFldName)] } { … … 2269 2269 2270 2270 # ---------------------------------------------------------------------- 2271 # USAGE: _dropdown post 2272 # USAGE: _dropdown unpost 2273 # USAGE: _dropdown select 2274 # 2275 # Used internally to handle the dropdown list for this combobox. The 2276 # post/unpost options are invoked when the list is posted or unposted 2277 # to manage the relief of the controlling button. The select option 2278 # is invoked whenever there is a selection from the list, to assign 2279 # the value back to the gauge. 2280 # ---------------------------------------------------------------------- 2281 itcl::body Rappture::VtkImageViewer::Combo {option} { 2271 # USAGE: LegendTitleAction post 2272 # USAGE: LegendTitleAction enter 2273 # USAGE: LegendTitleAction leave 2274 # USAGE: LegendTitleAction save 2275 # 2276 # Used internally to handle the dropdown list for the fields menu combobox. 2277 # The post option is invoked when the field title is pressed to launch the 2278 # dropdown. The enter option is invoked when the user mouses over the field 2279 # title. The leave option is invoked when the user moves the mouse away 2280 # from the field title. The save option is invoked whenever there is a 2281 # selection from the list, to alert the visualization server. 2282 # ---------------------------------------------------------------------- 2283 itcl::body Rappture::VtkImageViewer::LegendTitleAction {option} { 2282 2284 set c $itk_component(view) 2283 2285 switch -- $option { … … 2289 2291 tk_popup $itk_component(fieldmenu) $x $y 2290 2292 } 2291 activate{2293 enter { 2292 2294 $c itemconfigure title -fill red 2293 2295 } 2294 deactivate {2296 leave { 2295 2297 $c itemconfigure title -fill $itk_option(-plotforeground) 2296 2298 } 2297 invoke {2299 save { 2298 2300 $itk_component(field) value $_curFldLabel 2299 2301 AdjustSetting -field 2300 2302 } 2301 2303 default { 2302 error "bad option \"$option\": should be post, unpost, select"2304 error "bad option \"$option\": should be post, enter, leave or save" 2303 2305 } 2304 2306 } -
branches/1.6/gui/scripts/vtkisosurfaceviewer.tcl
r6305 r6340 107 107 private method ReceiveDataset { args } 108 108 private method ReceiveImage { args } 109 private method ReceiveLegend { colormap title vmin vmax size }109 private method ReceiveLegend { colormap title min max size } 110 110 private method RequestLegend {} 111 111 private method Rotate {option x y} … … 160 160 private variable _rotatePending 0 161 161 private variable _cutplanePending 0 162 private variable _field ""163 162 private variable _colorMode "scalar"; # Mode of colormap (vmag or scalar) 164 163 private variable _fields … … 1502 1501 } 1503 1502 "-isolinecolor" { 1504 set color [$itk_component(isoline Color) value]1503 set color [$itk_component(isolinecolor) value] 1505 1504 set _settings($what) $color 1506 1505 DrawLegend … … 1738 1737 1739 1738 label $inner.linecolor_l -text "Isolines" -font "Arial 9" 1740 itk_component add isoline Color {1739 itk_component add isolinecolor { 1741 1740 Rappture::Combobox $inner.linecolor -width 10 -editable 0 1742 1741 } … … 1753 1752 "none" "none" 1754 1753 1755 $itk_component(isoline Color) value "white"1754 $itk_component(isolinecolor) value $_settings(-isolinecolor) 1756 1755 bind $inner.linecolor <<Value>> \ 1757 1756 [itcl::code $this AdjustSetting -isolinecolor] … … 2181 2180 SendCmd "camera zoom $_view($what)" 2182 2181 } 2183 2182 } 2184 2183 } 2185 2184 } … … 2215 2214 radiobutton $inner.vtk_button -text "VTK data file" \ 2216 2215 -variable [itcl::scope _downloadPopup(format)] \ 2217 -font "Arial 9 2216 -font "Arial 9" \ 2218 2217 -value vtk 2219 2218 Rappture::Tooltip::for $inner.vtk_button "Save as VTK data file." 2220 2219 radiobutton $inner.image_button -text "Image File" \ 2221 2220 -variable [itcl::scope _downloadPopup(format)] \ 2222 -font "Arial 9 2221 -font "Arial 9" \ 2223 2222 -value image 2224 2223 Rappture::Tooltip::for $inner.image_button \ … … 2256 2255 array set style { 2257 2256 -color BCGYR 2257 -constcolor white 2258 2258 -cutplaneedges 0 2259 2259 -cutplanelighting 1 … … 2281 2281 set style(-opacity) 1.0 2282 2282 } 2283 set style(-constcolor) $itk_option(-plotforeground) 2283 2284 array set style [$dataobj style $comp] 2284 2285 #DebugTrace [array get style] … … 2312 2313 } 2313 2314 if { $_currentColormap == "" } { 2314 SetCurrentColormap $style(-color)2315 2315 $itk_component(colormap) value $style(-color) 2316 2316 } … … 2340 2340 2341 2341 SendCmd "cutplane add $tag" 2342 SendCmd "cutplane color [Color2RGB $ itk_option(-plotforeground)] $tag"2342 SendCmd "cutplane color [Color2RGB $style(-constcolor)] $tag" 2343 2343 foreach axis {x y z} { 2344 2344 set pos [expr $style(-${axis}cutplaneposition) * 0.01] … … 2356 2356 2357 2357 SendCmd "outline add $tag" 2358 SendCmd "outline color [Color2RGB $ itk_option(-plotforeground)] $tag"2358 SendCmd "outline color [Color2RGB $style(-constcolor)] $tag" 2359 2359 SendCmd "outline visible $style(-outline) $tag" 2360 2360 … … 2364 2364 SendCmd "contour3d edges $style(-edges) $tag" 2365 2365 set _settings(-isosurfaceedges) $style(-edges) 2366 #SendCmd "contour3d color [Color2RGB $style(-co lor)] $tag"2366 #SendCmd "contour3d color [Color2RGB $style(-constcolor)] $tag" 2367 2367 SendCmd "contour3d lighting $style(-lighting) $tag" 2368 2368 set _settings(-isosurfacelighting) $style(-lighting) -
branches/1.6/gui/scripts/vtkmeshviewer.tcl
r6305 r6340 1464 1464 radiobutton $inner.vtk_button -text "VTK data file" \ 1465 1465 -variable [itcl::scope _downloadPopup(format)] \ 1466 -font " Helvetica 9" \1466 -font "Arial 9" \ 1467 1467 -value vtk 1468 1468 Rappture::Tooltip::for $inner.vtk_button "Save as VTK data file." -
branches/1.6/gui/scripts/vtkstreamlinesviewer.tcl
r6305 r6340 72 72 private method BuildSurfaceTab {} 73 73 private method DrawLegend {} 74 private method Combo { option }75 74 private method Connect {} 76 75 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} … … 145 145 private variable _curFldName "" 146 146 private variable _curFldLabel "" 147 private variable _field ""148 147 private variable _streamlinesLength 0 149 148 private variable _numSeeds 200 … … 1043 1042 -activeforeground $itk_option(-plotforeground) \ 1044 1043 -font "Arial 8" \ 1045 -command [itcl::code $this Combo invoke]1044 -command [itcl::code $this LegendTitleAction save] 1046 1045 set _fields($fname) [list $label $units $components] 1047 1046 if { $_curFldName == "" && $components == 3 } { … … 2065 2064 radiobutton $inner.vtk_button -text "VTK data file" \ 2066 2065 -variable [itcl::scope _downloadPopup(format)] \ 2067 -font " Helvetica 9" \2066 -font "Arial 9" \ 2068 2067 -value vtk 2069 2068 Rappture::Tooltip::for $inner.vtk_button "Save as VTK data file." … … 2182 2181 2183 2182 # ---------------------------------------------------------------------- 2184 # USAGE: ReceiveLegend <colormap> <title> < vmin> <vmax> <size>2183 # USAGE: ReceiveLegend <colormap> <title> <min> <max> <size> 2185 2184 # 2186 2185 # Invoked automatically whenever the "legend" command comes in from … … 2188 2187 # specified <size> will follow. 2189 2188 # ---------------------------------------------------------------------- 2190 itcl::body Rappture::VtkStreamlinesViewer::ReceiveLegend { colormap title vmin vmax size } {2189 itcl::body Rappture::VtkStreamlinesViewer::ReceiveLegend { colormap title min max size } { 2191 2190 set _legendPending 0 2192 2191 set _title $title … … 2252 2251 $c bind colormap <Motion> [itcl::code $this MotionLegend %x %y] 2253 2252 } 2254 $c bind title <ButtonPress> [itcl::code $this Combopost]2255 $c bind title <Enter> [itcl::code $this Combo activate]2256 $c bind title <Leave> [itcl::code $this Combo deactivate]2253 $c bind title <ButtonPress> [itcl::code $this LegendTitleAction post] 2254 $c bind title <Enter> [itcl::code $this LegendTitleAction enter] 2255 $c bind title <Leave> [itcl::code $this LegendTitleAction leave] 2257 2256 # Reset the item coordinates according the current size of the plot. 2258 2257 $c itemconfigure title -text $title … … 2377 2376 2378 2377 # ---------------------------------------------------------------------- 2379 # USAGE: _dropdown post 2380 # USAGE: _dropdown unpost 2381 # USAGE: _dropdown select 2382 # 2383 # Used internally to handle the dropdown list for this combobox. The 2384 # post/unpost options are invoked when the list is posted or unposted 2385 # to manage the relief of the controlling button. The select option 2386 # is invoked whenever there is a selection from the list, to assign 2387 # the value back to the gauge. 2388 # ---------------------------------------------------------------------- 2389 itcl::body Rappture::VtkStreamlinesViewer::Combo {option} { 2378 # USAGE: LegendTitleAction post 2379 # USAGE: LegendTitleAction enter 2380 # USAGE: LegendTitleAction leave 2381 # USAGE: LegendTitleAction save 2382 # 2383 # Used internally to handle the dropdown list for the fields menu combobox. 2384 # The post option is invoked when the field title is pressed to launch the 2385 # dropdown. The enter option is invoked when the user mouses over the field 2386 # title. The leave option is invoked when the user moves the mouse away 2387 # from the field title. The save option is invoked whenever there is a 2388 # selection from the list, to alert the visualization server. 2389 # ---------------------------------------------------------------------- 2390 itcl::body Rappture::VtkStreamlinesViewer::LegendTitleAction {option} { 2390 2391 set c $itk_component(view) 2391 2392 switch -- $option { … … 2397 2398 tk_popup $itk_component(fieldmenu) $x $y 2398 2399 } 2399 activate{2400 enter { 2400 2401 $c itemconfigure title -fill red 2401 2402 } 2402 deactivate {2403 leave { 2403 2404 $c itemconfigure title -fill white 2404 2405 } 2405 invoke {2406 save { 2406 2407 $itk_component(field) value $_curFldLabel 2407 2408 AdjustSetting -field 2408 2409 } 2409 2410 default { 2410 error "bad option \"$option\": should be post, unpost, select"2411 error "bad option \"$option\": should be post, enter, leave or save" 2411 2412 } 2412 2413 } -
branches/1.6/gui/scripts/vtksurfaceviewer.tcl
r6305 r6340 69 69 private method BuildDownloadPopup { widget command } 70 70 private method BuildSurfaceTab {} 71 private method Combo { option }72 71 private method Connect {} 73 72 private method CurrentDatasets {args} … … 85 84 private method IsValidObject { dataobj } 86 85 private method LeaveLegend {} 86 private method LegendTitleAction { option } 87 87 private method MotionLegend { x y } 88 88 private method Pan {option x y} … … 95 95 private method ReceiveDataset { args } 96 96 private method ReceiveImage { args } 97 private method ReceiveLegend { colormap title vmin vmax size }97 private method ReceiveLegend { colormap title min max size } 98 98 private method RequestLegend {} 99 99 private method Rotate {option x y} … … 139 139 private variable _legendPending 0 140 140 private variable _rotatePending 0 141 private variable _field ""142 141 private variable _colorMode "scalar"; # Mode of colormap (vmag or scalar) 143 142 private variable _fields … … 1315 1314 "-isolinecolor" { 1316 1315 set _changed($what) 1 1317 set color [$itk_component(isoline Color) value]1316 set color [$itk_component(isolinecolor) value] 1318 1317 set _settings($what) $color 1319 1318 SendCmd "contour2d linecolor [Color2RGB $color]" … … 1543 1542 1544 1543 label $inner.linecolor_l -text "Isolines" -font "Arial 9" 1545 itk_component add isoline Color {1544 itk_component add isolinecolor { 1546 1545 Rappture::Combobox $inner.linecolor -width 10 -editable 0 1547 1546 } … … 1558 1557 "none" "none" 1559 1558 1560 $itk_component(isoline Color) value "white"1559 $itk_component(isolinecolor) value $_settings(-isolinecolor) 1561 1560 bind $inner.linecolor <<Value>> \ 1562 1561 [itcl::code $this AdjustSetting -isolinecolor] … … 1794 1793 SendCmd "camera zoom $_view($what)" 1795 1794 } 1796 1795 } 1797 1796 } 1798 1797 } … … 1828 1827 radiobutton $inner.vtk_button -text "VTK data file" \ 1829 1828 -variable [itcl::scope _downloadPopup(format)] \ 1830 -font "Arial 9 1829 -font "Arial 9" \ 1831 1830 -value vtk 1832 1831 Rappture::Tooltip::for $inner.vtk_button "Save as VTK data file." 1833 1832 radiobutton $inner.image_button -text "Image File" \ 1834 1833 -variable [itcl::scope _downloadPopup(format)] \ 1835 -font "Arial 9 1834 -font "Arial 9" \ 1836 1835 -value image 1837 1836 Rappture::Tooltip::for $inner.image_button \ … … 2167 2166 } 2168 2167 2169 $c bind title <ButtonPress> [itcl::code $this Combopost]2170 $c bind title <Enter> [itcl::code $this Combo activate]2171 $c bind title <Leave> [itcl::code $this Combo deactivate]2168 $c bind title <ButtonPress> [itcl::code $this LegendTitleAction post] 2169 $c bind title <Enter> [itcl::code $this LegendTitleAction enter] 2170 $c bind title <Leave> [itcl::code $this LegendTitleAction leave] 2172 2171 # Reset the item coordinates according the current size of the plot. 2173 2172 $c itemconfigure title -text $title … … 2194 2193 2195 2194 # ---------------------------------------------------------------------- 2196 # USAGE: _dropdown post 2197 # USAGE: _dropdown unpost 2198 # USAGE: _dropdown select 2199 # 2200 # Used internally to handle the dropdown list for this combobox. The 2201 # post/unpost options are invoked when the list is posted or unposted 2202 # to manage the relief of the controlling button. The select option 2203 # is invoked whenever there is a selection from the list, to assign 2204 # the value back to the gauge. 2205 # ---------------------------------------------------------------------- 2206 itcl::body Rappture::VtkSurfaceViewer::Combo {option} { 2195 # USAGE: LegendTitleAction post 2196 # USAGE: LegendTitleAction enter 2197 # USAGE: LegendTitleAction leave 2198 # USAGE: LegendTitleAction save 2199 # 2200 # Used internally to handle the dropdown list for the fields menu combobox. 2201 # The post option is invoked when the field title is pressed to launch the 2202 # dropdown. The enter option is invoked when the user mouses over the field 2203 # title. The leave option is invoked when the user moves the mouse away 2204 # from the field title. The save option is invoked whenever there is a 2205 # selection from the list, to alert the visualization server. 2206 # ---------------------------------------------------------------------- 2207 itcl::body Rappture::VtkSurfaceViewer::LegendTitleAction {option} { 2207 2208 set c $itk_component(view) 2208 2209 switch -- $option { … … 2216 2217 tk_popup $itk_component(fieldmenu) $x $y 2217 2218 } 2218 activate{2219 enter { 2219 2220 $c itemconfigure title -fill red 2220 2221 } 2221 deactivate {2222 leave { 2222 2223 $c itemconfigure title -fill $itk_option(-plotforeground) 2223 2224 } 2224 invoke {2225 save { 2225 2226 $itk_component(field) value $_curFldLabel 2226 2227 AdjustSetting -field 2227 2228 } 2228 2229 default { 2229 error "bad option \"$option\": should be post, unpost, select"2230 error "bad option \"$option\": should be post, enter, leave or save" 2230 2231 } 2231 2232 } … … 2317 2318 -activeforeground $itk_option(-plotforeground) \ 2318 2319 -font "Arial 8" \ 2319 -command [itcl::code $this Combo invoke]2320 -command [itcl::code $this LegendTitleAction save] 2320 2321 set _fields($fname) [list $label $units $components] 2321 2322 if { $_curFldName == "" } { -
branches/1.6/gui/scripts/vtkviewer.tcl
r6305 r6340 104 104 private method ReceiveDataset { args } 105 105 private method ReceiveImage { args } 106 private method ReceiveLegend { colormap title vmin vmax size }106 private method ReceiveLegend { colormap title min max size } 107 107 private method RequestLegend {} 108 108 private method Rotate {option x y} … … 2585 2585 radiobutton $inner.vtk_button -text "VTK data file" \ 2586 2586 -variable [itcl::scope _downloadPopup(format)] \ 2587 -font " Helvetica 9" \2587 -font "Arial 9" \ 2588 2588 -value vtk 2589 2589 Rappture::Tooltip::for $inner.vtk_button "Save as VTK data file." … … 2863 2863 2864 2864 # ---------------------------------------------------------------------- 2865 # USAGE: ReceiveLegend <colormap> <title> < vmin> <vmax> <size>2865 # USAGE: ReceiveLegend <colormap> <title> <min> <max> <size> 2866 2866 # 2867 2867 # Invoked automatically whenever the "legend" command comes in from … … 2869 2869 # specified <size> will follow. 2870 2870 # ---------------------------------------------------------------------- 2871 itcl::body Rappture::VtkViewer::ReceiveLegend { colormap title vmin vmax size } {2872 set _limits(vmin) $ vmin2873 set _limits(vmax) $ vmax2871 itcl::body Rappture::VtkViewer::ReceiveLegend { colormap title min max size } { 2872 set _limits(vmin) $min 2873 set _limits(vmax) $max 2874 2874 set _title $title 2875 2875 if { [IsConnected] } { -
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.