Changeset 6364 for branches/1.7
- Timestamp:
- May 24, 2016, 8:28:53 AM (8 years ago)
- Location:
- branches/1.7
- Files:
-
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/1.7
- Property svn:mergeinfo changed
/branches/1.6 merged: 6237,6340-6342,6358,6363 /trunk merged: 6316,6325-6339,6343-6346,6355-6357,6359-6362
- Property svn:mergeinfo changed
-
branches/1.7/gui/scripts/flowvisviewer.tcl
r6306 r6364 696 696 if { $pos >= 0 } { 697 697 set _dlist [lreplace $_dlist $pos $pos] 698 array unset _limits $dataobj-*699 698 array unset _obj2ovride $dataobj-* 700 array unset _dataset2flow $dataobj-*701 array unset _serverDatasets $dataobj-*702 array unset _dataset2style $dataobj-*703 699 set changed 1 704 700 } … … 706 702 # If anything changed, then rebuild the plot 707 703 if {$changed} { 708 # Repair the reverse lookup709 foreach tf [array names _style2datasets] {710 set list {}711 foreach {dataobj cname} $_style2datasets($tf) {712 if { [info exists _serverDatasets($dataobj-$cname)] } {713 lappend list $dataobj $cname714 }715 }716 if { $list == "" } {717 array unset _style2datasets $tf718 } else {719 set _style2datasets($tf) $list720 }721 }722 704 $_dispatcher event -idle !rebuild 723 705 } … … 1137 1119 DoResize 1138 1120 } 1139 1121 if { $_reset } { 1122 InitSettings -background -axesvisible -gridvisible 1123 } 1140 1124 set _first "" 1141 1125 foreach dataobj [get] { … … 1183 1167 1184 1168 # Reset the camera and other view parameters 1185 InitSettings -axesvisible -gridvisible \ 1186 -opacity -light2side -isosurfaceshading \ 1169 InitSettings -opacity -light2side -isosurfaceshading \ 1187 1170 -light \ 1188 1171 -volume -outlinevisible -cutplanesvisible \ … … 2855 2838 radiobutton $inner.image_button -text "Image File" \ 2856 2839 -variable [itcl::scope _downloadPopup(format)] \ 2857 -font "Arial 9 2840 -font "Arial 9" \ 2858 2841 -value image 2859 2842 Rappture::Tooltip::for $inner.image_button \ -
branches/1.7/gui/scripts/mesh.tcl
r5679 r6364 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.7/gui/scripts/nanovisviewer.tcl
r6310 r6364 502 502 if { $pos >= 0 } { 503 503 set _dlist [lreplace $_dlist $pos $pos] 504 # Don't remove the limits settings because we're not really505 # deleting the volume, just hiding it.506 #array unset _limits $dataobj*507 504 array unset _obj2ovride $dataobj-* 508 505 set changed 1 … … 943 940 DoResize 944 941 } 945 942 if { $_reset } { 943 InitSettings -background -axesvisible -gridvisible 944 } 946 945 foreach dataobj [get] { 947 946 foreach cname [$dataobj components] { … … 1008 1007 } 1009 1008 1010 InitSettings -axesvisible -gridvisible \ 1011 -light2side -isosurfaceshading -opacity \ 1009 InitSettings -opacity -light2side -isosurfaceshading \ 1012 1010 -light \ 1013 1011 -xcutplanevisible -ycutplanevisible -zcutplanevisible … … 2134 2132 radiobutton $inner.image_button -text "Image File" \ 2135 2133 -variable [itcl::scope _downloadPopup(format)] \ 2136 -font "Arial 9 2134 -font "Arial 9" \ 2137 2135 -value image 2138 2136 Rappture::Tooltip::for $inner.image_button \ -
branches/1.7/gui/scripts/probdisteditor.tcl
r5192 r6364 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.7/gui/scripts/visviewer.tcl
r6306 r6364 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.7/gui/scripts/vtkglyphviewer.tcl
r6306 r6364 102 102 private method ReceiveDataset { args } 103 103 private method ReceiveImage { args } 104 private method ReceiveLegend { colormap title vmin vmax size }104 private method ReceiveLegend { colormap title min max size } 105 105 private method RequestLegend {} 106 106 private method Rotate {option x y} … … 151 151 private variable _rotatePending 0 152 152 private variable _cutplanePending 0 153 private variable _field ""154 private variable _colorMode "vmag"; # Mode of colormap (vmag or scalar)155 153 private variable _fields 156 154 private variable _curFldName "" 157 155 private variable _curFldLabel "" 158 156 private variable _curFldComp 3 157 private variable _colorMode "vmag"; # Mode of colormap (vmag or scalar) 159 158 private variable _mouseOver ""; # what called LegendRangeAction: 160 159 # vmin or vmax … … 627 626 set _dlist [lreplace $_dlist $pos $pos] 628 627 array unset _obj2ovride $dataobj-* 629 array unset _settings $dataobj-*630 628 set changed 1 631 629 } … … 1320 1318 itcl::body Rappture::VtkGlyphViewer::InitSettings { args } { 1321 1319 foreach spec $args { 1322 if { [info exists _settings($_first${spec})] } {1323 # Reset global setting with dataobj specific setting1324 set _settings($spec) $_settings($_first${spec})1325 }1326 1320 AdjustSetting $spec 1327 1321 } … … 2210 2204 SendCmd "camera zoom $_view($what)" 2211 2205 } 2212 2206 } 2213 2207 } 2214 2208 } … … 2244 2238 radiobutton $inner.vtk_button -text "VTK data file" \ 2245 2239 -variable [itcl::scope _downloadPopup(format)] \ 2246 -font "Arial 9 2240 -font "Arial 9" \ 2247 2241 -value vtk 2248 2242 Rappture::Tooltip::for $inner.vtk_button "Save as VTK data file." 2249 2243 radiobutton $inner.image_button -text "Image File" \ 2250 2244 -variable [itcl::scope _downloadPopup(format)] \ 2251 -font "Arial 9 2245 -font "Arial 9" \ 2252 2246 -value image 2253 2247 Rappture::Tooltip::for $inner.image_button \ -
branches/1.7/gui/scripts/vtkheightmapviewer.tcl
r6306 r6364 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} … … 103 103 private method Rotate {option x y} 104 104 private method SetCurrentColormap { color } 105 private method SetCurrentFieldName { dataobj } 105 106 private method SetLegendTip { x y } 106 107 private method SetObjectStyle { dataobj comp } … … 214 215 215 216 array set _settings { 216 -ax isflymode "static"217 -axesvisible 1 217 218 -axislabels 1 218 219 -axisminorticks 1 219 -axis visible 1220 -axismode "static" 220 221 -colormap BCGYR 221 222 -colormapdiscrete 0 … … 243 244 array set _changed { 244 245 -colormap 0 246 -colormapdiscrete 0 247 -colormapvisible 0 248 -edges 0 249 -isolinecolor 0 250 -isolinesvisible 0 245 251 -numisolines 0 246 252 -opacity 0 253 -wireframe 0 247 254 } 248 255 itk_component add view { … … 255 262 256 263 itk_component add fieldmenu { 257 menu $itk_component(plotarea).menu \ 258 -relief flat \ 259 -tearoff 0 264 menu $itk_component(plotarea).menu -relief flat -tearoff 0 260 265 } { 261 266 usual … … 286 291 } 287 292 pack $itk_component(reset) -side top -padx 2 -pady { 2 0 } 288 Rappture::Tooltip::for $itk_component(reset) "Reset the view to the default zoom level" 293 Rappture::Tooltip::for $itk_component(reset) \ 294 "Reset the view to the default zoom level" 289 295 290 296 itk_component add zoomin { … … 520 526 set _dlist [lreplace $_dlist $pos $pos] 521 527 array unset _obj2ovride $dataobj-* 522 array unset _settings $dataobj-*523 528 set changed 1 524 529 } … … 917 922 # Reset the camera and other view parameters 918 923 # 919 InitSettings -isheightmap -background 924 InitSettings -isheightmap -background \ 925 -xgrid -ygrid -zgrid -axismode \ 926 -axesvisible -axislabels -axisminorticks 920 927 921 928 # Setting a custom exponent and label format for axes is causing … … 930 937 #SendCmd "axis exp 0 0 0 1" 931 938 939 SendCmd "axis tickpos outside" 932 940 SendCmd "axis lrot z 90" 933 941 $_arcball quaternion [ViewToQuaternion] … … 954 962 if { [info exists _obj2ovride($dataobj-raise)] && $_first == "" } { 955 963 set _first $dataobj 964 SetCurrentFieldName $dataobj 956 965 } 957 966 foreach comp [$dataobj components] { … … 995 1004 } 996 1005 } 997 if { $_first != "" } { 998 $itk_component(field) choices delete 0 end 999 $itk_component(fieldmenu) delete 0 end 1000 array unset _fields 1001 set _curFldName "" 1002 foreach cname [$_first components] { 1003 foreach fname [$_first fieldnames $cname] { 1004 if { [info exists _fields($fname)] } { 1005 continue 1006 } 1007 foreach { label units components } \ 1008 [$_first fieldinfo $fname] break 1009 $itk_component(field) choices insert end "$fname" "$label" 1010 $itk_component(fieldmenu) add radiobutton -label "$label" \ 1011 -value $label -variable [itcl::scope _curFldLabel] \ 1012 -selectcolor red \ 1013 -activebackground $itk_option(-plotbackground) \ 1014 -activeforeground $itk_option(-plotforeground) \ 1015 -font "Arial 8" \ 1016 -command [itcl::code $this Combo invoke] 1017 set _fields($fname) [list $label $units $components] 1018 if { $_curFldName == "" } { 1019 set _curFldName $fname 1020 set _curFldLabel $label 1021 } 1022 } 1023 } 1024 $itk_component(field) value $_curFldLabel 1025 } 1006 1026 1007 InitSettings -stretchtofit -outline 1027 1028 1008 if { $_reset } { 1029 SendCmd "axis tickpos outside"1030 #SendCmd "axis lformat all %g"1031 1032 1009 foreach axis { x y z } { 1033 1010 set label "" … … 1086 1063 } 1087 1064 PanCamera 1088 InitSettings -xgrid -ygrid -zgrid \ 1089 -axisvisible -axislabels -heightmapscale -field -isheightmap \ 1090 -numisolines 1065 InitSettings -heightmapscale -field -isheightmap -numisolines 1091 1066 if { [array size _fields] < 2 } { 1092 1067 catch {blt::table forget $itk_component(field) $itk_component(field_l)} … … 1328 1303 itcl::body Rappture::VtkHeightmapViewer::InitSettings { args } { 1329 1304 foreach spec $args { 1330 if { [info exists _settings($_first${spec})] } {1331 # Reset global setting with dataobj specific setting1332 set _settings($spec) $_settings($_first${spec})1333 }1334 1305 AdjustSetting $spec 1335 1306 } … … 1348 1319 } 1349 1320 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" 1321 "-axesvisible" { 1322 set bool $_settings($what) 1323 SendCmd "axis visible all $bool" 1355 1324 } 1356 1325 "-axislabels" { … … 1362 1331 SendCmd "axis minticks all $bool" 1363 1332 } 1364 "-axisvisible" { 1365 set bool $_settings($what) 1366 SendCmd "axis visible all $bool" 1333 "-axismode" { 1334 set mode [$itk_component(axismode) value] 1335 set mode [$itk_component(axismode) translate $mode] 1336 set _settings($what) $mode 1337 SendCmd "axis flymode $mode" 1367 1338 } 1368 1339 "-background" { … … 1388 1359 if { $color == "none" } { 1389 1360 if { $_settings(-colormapvisible) } { 1361 set _changed(-colormapvisible) 1 1390 1362 SendCmd "heightmap surface 0" 1391 1363 set _settings(-colormapvisible) 0 … … 1393 1365 } else { 1394 1366 if { !$_settings(-colormapvisible) } { 1367 set _changed(-colormapvisible) 1 1395 1368 SendCmd "heightmap surface 1" 1396 1369 set _settings(-colormapvisible) 1 … … 1405 1378 EventuallyRequestLegend 1406 1379 } 1407 "-colormapvisible" {1408 set bool $_settings($what)1409 SendCmd "heightmap surface $bool"1410 }1411 1380 "-colormapdiscrete" { 1381 set _changed($what) 1 1412 1382 set bool $_settings($what) 1413 1383 set numColors [expr $_settings(-numisolines) + 1] … … 1425 1395 EventuallyRequestLegend 1426 1396 } 1397 "-colormapvisible" { 1398 set _changed($what) 1 1399 set bool $_settings($what) 1400 SendCmd "heightmap surface $bool" 1401 } 1427 1402 "-edges" { 1403 set _changed($what) 1 1428 1404 set bool $_settings($what) 1429 1405 SendCmd "heightmap edges $bool" … … 1571 1547 } 1572 1548 "-isolinecolor" { 1549 set _changed($what) 1 1573 1550 set color [$itk_component(isolinecolor) value] 1574 1551 if { $color == "none" } { 1575 1552 if { $_settings(-isolinesvisible) } { 1553 set _changed(-isolinesvisible) 1 1576 1554 SendCmd "heightmap isolines 0" 1577 1555 set _settings(-isolinesvisible) 0 1578 1556 } 1579 1557 } else { 1558 set _settings($what) $color 1580 1559 if { !$_settings(-isolinesvisible) } { 1560 set _changed(-isolinesvisible) 1 1581 1561 SendCmd "heightmap isolines 1" 1582 1562 set _settings(-isolinesvisible) 1 … … 1587 1567 } 1588 1568 "-isolinesvisible" { 1569 set _changed($what) 1 1589 1570 set bool $_settings($what) 1571 set color [$itk_component(isolinecolor) value] 1572 if { $bool && $color != $_settings(-isolinecolor)} { 1573 $itk_component(isolinecolor) value $_settings(-isolinecolor) 1574 } 1590 1575 SendCmd "heightmap isolines $bool" 1591 1576 DrawLegend … … 1631 1616 } 1632 1617 "-outline" { 1618 set _changed($what) 1 1633 1619 if { $_settings(-isheightmap) } { 1634 1620 SendCmd "outline visible 0" … … 1654 1640 } 1655 1641 "-wireframe" { 1642 set _changed($what) 1 1656 1643 set bool $_settings($what) 1657 1644 SendCmd "heightmap wireframe $bool" … … 1714 1701 set cmap $_currentColormap 1715 1702 if { ![info exists _colormaps($cmap)] } { 1716 BuildColormap $cmap1717 set _colormaps($cmap) 11703 BuildColormap $cmap 1704 set _colormaps($cmap) 1 1718 1705 } 1719 1706 #SendCmd "legend $cmap scalar $_curFldName {} $w $h 0" … … 2031 2018 checkbutton $inner.visible \ 2032 2019 -text "Axes" \ 2033 -variable [itcl::scope _settings(-ax isvisible)] \2034 -command [itcl::code $this AdjustSetting -ax isvisible] \2020 -variable [itcl::scope _settings(-axesvisible)] \ 2021 -command [itcl::code $this AdjustSetting -axesvisible] \ 2035 2022 -font "Arial 9" 2036 2023 checkbutton $inner.labels \ … … 2063 2050 label $inner.mode_l -text "Mode" -font "Arial 9" 2064 2051 2065 itk_component add axis flymode {2052 itk_component add axismode { 2066 2053 Rappture::Combobox $inner.mode -width 10 -editable 0 2067 2054 } … … 2071 2058 "furthest_triad" "farthest" \ 2072 2059 "outer_edges" "outer" 2073 $itk_component(axis flymode) value $_settings(-axisflymode)2074 bind $inner.mode <<Value>> [itcl::code $this AdjustSetting -axis flymode]2060 $itk_component(axismode) value $_settings(-axismode) 2061 bind $inner.mode <<Value>> [itcl::code $this AdjustSetting -axismode] 2075 2062 2076 2063 blt::table $inner \ … … 2209 2196 radiobutton $inner.vtk_button -text "VTK data file" \ 2210 2197 -variable [itcl::scope _downloadPopup(format)] \ 2211 -font "Arial 9 2198 -font "Arial 9" \ 2212 2199 -value vtk 2213 2200 Rappture::Tooltip::for $inner.vtk_button "Save as VTK data file." 2214 2201 radiobutton $inner.image_button -text "Image File" \ 2215 2202 -variable [itcl::scope _downloadPopup(format)] \ 2216 -font "Arial 9 2203 -font "Arial 9" \ 2217 2204 -value image 2218 2205 Rappture::Tooltip::for $inner.image_button \ … … 2255 2242 set tag $dataobj-$comp 2256 2243 array set style { 2257 -color BCGYR 2258 -levels 10 2259 -opacity 1.0 2244 -color BCGYR 2245 -colormapdiscrete 0 2246 -colormapvisible 1 2247 -edgecolor black 2248 -edges 0 2249 -isolinecolor black 2250 -isolinesvisible 1 2251 -isolinewidth 1.0 2252 -levels 10 2253 -linewidth 1.0 2254 -opacity 1.0 2255 -outline 0 2256 -wireframe 0 2260 2257 } 2261 2258 set stylelist [$dataobj style $comp] … … 2295 2292 DrawLegend 2296 2293 } 2294 foreach setting {-edges -outline -wireframe -colormapdiscrete \ 2295 -colormapvisible -isolinecolor -isolinesvisible} { 2296 if {$_changed($setting)} { 2297 # User-modified UI setting overrides style 2298 set style($setting) $_settings($setting) 2299 } else { 2300 # Set UI control to style setting (tool provided or default) 2301 set _settings($setting) $style($setting) 2302 } 2303 } 2304 2297 2305 SendCmd "outline add $tag" 2298 2306 SendCmd "outline color [Color2RGB $itk_option(-plotforeground)] $tag" 2299 SendCmd "outline visible $_settings(-outline) $tag" 2307 SendCmd "outline visible $style(-outline) $tag" 2308 2300 2309 set scale [GetHeightmapScale] 2301 2310 SendCmd "[list heightmap add contourlist $_contourList $scale $tag]" 2302 2311 set _comp2scale($tag) $_settings(-heightmapscale) 2303 SendCmd "heightmap edges $_settings(-edges) $tag" 2304 SendCmd "heightmap wireframe $_settings(-wireframe) $tag" 2312 SendCmd "heightmap edges $style(-edges) $tag" 2313 SendCmd "heightmap linecolor [Color2RGB $style(-edgecolor)] $tag" 2314 SendCmd "heightmap linewidth $style(-linewidth) $tag" 2315 SendCmd "heightmap wireframe $style(-wireframe) $tag" 2305 2316 SetCurrentColormap $style(-color) 2306 set color [$itk_component(isolinecolor) value] 2307 SendCmd "heightmap isolinecolor [Color2RGB $color] $tag" 2317 if {$style(-colormapdiscrete)} { 2318 SendCmd "heightmap preinterp 1 $tag" 2319 set numColors [expr $style(-levels) + 1] 2320 SendCmd "colormap res $numColors $style(-color)" 2321 } 2322 SendCmd "heightmap isolinecolor [Color2RGB $style(-isolinecolor)] $tag" 2323 $itk_component(isolinecolor) value $style(-isolinecolor) 2324 SendCmd "heightmap isolinewidth $style(-isolinewidth) $tag" 2308 2325 SendCmd "heightmap lighting $_settings(-isheightmap) $tag" 2309 SendCmd "heightmap isolines $ _settings(-isolinesvisible) $tag"2310 SendCmd "heightmap surface $ _settings(-colormapvisible) $tag"2326 SendCmd "heightmap isolines $style(-isolinesvisible) $tag" 2327 SendCmd "heightmap surface $style(-colormapvisible) $tag" 2311 2328 SendCmd "heightmap opacity $style(-opacity) $tag" 2312 2329 set _settings(-opacity) [expr $style(-opacity) * 100.0] … … 2346 2363 # DrawLegend -- 2347 2364 # 2348 # Draws the legend in theown canvas on the right side of the plot area.2365 # Draws the legend in its own canvas on the right side of the plot area. 2349 2366 # 2350 2367 itcl::body Rappture::VtkHeightmapViewer::DrawLegend {} { … … 2434 2451 } 2435 2452 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]2453 $c bind title <ButtonPress> [itcl::code $this LegendTitleAction post] 2454 $c bind title <Enter> [itcl::code $this LegendTitleAction enter] 2455 $c bind title <Leave> [itcl::code $this LegendTitleAction leave] 2439 2456 # Reset the item coordinates according the current size of the plot. 2440 2457 if { [info exists _limits($_curFldName)] } { … … 2550 2567 2551 2568 # ---------------------------------------------------------------------- 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} { 2569 # USAGE: LegendTitleAction post 2570 # USAGE: LegendTitleAction enter 2571 # USAGE: LegendTitleAction leave 2572 # USAGE: LegendTitleAction save 2573 # 2574 # Used internally to handle the dropdown list for the fields menu combobox. 2575 # The post option is invoked when the field title is pressed to launch the 2576 # dropdown. The enter option is invoked when the user mouses over the field 2577 # title. The leave option is invoked when the user moves the mouse away 2578 # from the field title. The save option is invoked whenever there is a 2579 # selection from the list, to alert the visualization server. 2580 # ---------------------------------------------------------------------- 2581 itcl::body Rappture::VtkHeightmapViewer::LegendTitleAction {option} { 2563 2582 set c $itk_component(view) 2564 2583 switch -- $option { … … 2570 2589 tk_popup $itk_component(fieldmenu) $x $y 2571 2590 } 2572 activate{2591 enter { 2573 2592 $c itemconfigure title -fill red 2574 2593 } 2575 deactivate {2594 leave { 2576 2595 $c itemconfigure title -fill $itk_option(-plotforeground) 2577 2596 } 2578 invoke {2597 save { 2579 2598 $itk_component(field) value $_curFldLabel 2580 2599 AdjustSetting -field 2581 2600 } 2582 2601 default { 2583 error "bad option \"$option\": should be post, unpost, select"2602 error "bad option \"$option\": should be post, enter, leave or save" 2584 2603 } 2585 2604 } … … 2631 2650 blt::vector destroy $v 2632 2651 } 2652 2653 itcl::body Rappture::VtkHeightmapViewer::SetCurrentFieldName { dataobj } { 2654 set _first $dataobj 2655 $itk_component(field) choices delete 0 end 2656 $itk_component(fieldmenu) delete 0 end 2657 array unset _fields 2658 set _curFldName "" 2659 foreach cname [$_first components] { 2660 foreach fname [$_first fieldnames $cname] { 2661 if { [info exists _fields($fname)] } { 2662 continue 2663 } 2664 foreach { label units components } \ 2665 [$_first fieldinfo $fname] break 2666 $itk_component(field) choices insert end "$fname" "$label" 2667 $itk_component(fieldmenu) add radiobutton -label "$label" \ 2668 -value $label -variable [itcl::scope _curFldLabel] \ 2669 -selectcolor red \ 2670 -activebackground $itk_option(-plotbackground) \ 2671 -activeforeground $itk_option(-plotforeground) \ 2672 -font "Arial 8" \ 2673 -command [itcl::code $this LegendTitleAction save] 2674 set _fields($fname) [list $label $units $components] 2675 if { $_curFldName == "" } { 2676 set _curFldName $fname 2677 set _curFldLabel $label 2678 } 2679 } 2680 } 2681 $itk_component(field) value $_curFldLabel 2682 } -
branches/1.7/gui/scripts/vtkimageviewer.tcl
r6306 r6364 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} … … 100 100 private method Rotate {option x y} 101 101 private method SetCurrentColormap { color } 102 private method SetCurrentFieldName { dataobj } 102 103 private method SetLegendTip { x y } 103 104 private method SetObjectStyle { dataobj comp } … … 209 210 210 211 array set _settings { 211 -ax isflymode "static"212 -axesvisible 1 212 213 -axislabels 1 213 214 -axisminorticks 1 214 -axis visible 1215 -axismode "static" 215 216 -backingcolor white 216 217 -backingvisible 1 … … 243 244 244 245 itk_component add fieldmenu { 245 menu $itk_component(plotarea).menu \ 246 -relief flat \ 247 -tearoff 0 246 menu $itk_component(plotarea).menu -relief flat -tearoff 0 248 247 } { 249 248 usual … … 274 273 } 275 274 pack $itk_component(reset) -side top -padx 2 -pady { 2 0 } 276 Rappture::Tooltip::for $itk_component(reset) "Reset the view to the default zoom level" 275 Rappture::Tooltip::for $itk_component(reset) \ 276 "Reset the view to the default zoom level" 277 277 278 278 itk_component add zoomin { … … 510 510 set _dlist [lreplace $_dlist $pos $pos] 511 511 array unset _obj2ovride $dataobj-* 512 array unset _settings $dataobj-*513 512 set changed 1 514 513 } … … 604 603 } 605 604 foreach axis { x y } { 605 set units [$dataobj hints ${axis}units] 606 set found($units) 1 606 607 set lim [$dataobj limits $axis] 607 608 if { ![info exists _limits($axis)] } { … … 618 619 } 619 620 set _limits($axis) [list $amin $amax] 620 set units [$dataobj hints ${axis}units]621 set found($units) 1622 621 } 623 622 foreach { fname lim } [$dataobj fieldlimits] { … … 900 899 DoResize 901 900 if { $_settings(-stretchtofit) } { 902 AdjustSetting -stretch ToFit901 AdjustSetting -stretchtofit 903 902 } 904 903 } … … 907 906 # Reset the camera and other view parameters 908 907 # 909 InitSettings -view3d -background 910 908 InitSettings -view3d -background \ 909 -xgrid -ygrid -zgrid -axismode \ 910 -axesvisible -axislabels -axisminorticks 911 912 SendCmd "axis tickpos outside" 911 913 SendCmd "axis lrot z 90" 912 914 $_arcball quaternion [ViewToQuaternion] … … 932 934 if { [info exists _obj2ovride($dataobj-raise)] && $_first == "" } { 933 935 set _first $dataobj 936 SetCurrentFieldName $dataobj 934 937 } 935 938 foreach comp [$dataobj components] { … … 968 971 } 969 972 } 970 if { $_first != "" } { 971 $itk_component(field) choices delete 0 end 972 $itk_component(fieldmenu) delete 0 end 973 array unset _fields 974 set _curFldName "" 975 foreach cname [$_first components] { 976 foreach fname [$_first fieldnames $cname] { 977 if { [info exists _fields($fname)] } { 978 continue 979 } 980 foreach { label units components } \ 981 [$_first fieldinfo $fname] break 982 $itk_component(field) choices insert end "$fname" "$label" 983 $itk_component(fieldmenu) add radiobutton -label "$label" \ 984 -value $label -variable [itcl::scope _curFldLabel] \ 985 -selectcolor red \ 986 -activebackground $itk_option(-plotbackground) \ 987 -activeforeground $itk_option(-plotforeground) \ 988 -font "Arial 8" \ 989 -command [itcl::code $this Combo invoke] 990 set _fields($fname) [list $label $units $components] 991 if { $_curFldName == "" } { 992 set _curFldName $fname 993 set _curFldLabel $label 994 } 995 } 996 } 997 $itk_component(field) value $_curFldLabel 998 } 973 999 974 InitSettings -stretchtofit -outline 1000 1001 975 if { $_reset } { 1002 SendCmd "axis tickpos outside"1003 #SendCmd "axis lformat all %g"1004 1005 976 foreach axis { x y z } { 1006 977 set label "" … … 1043 1014 } 1044 1015 PanCamera 1045 InitSettings -xgrid -ygrid -zgrid \ 1046 -axisvisible -axislabels -field -view3d 1016 InitSettings -field -view3d 1047 1017 if { [array size _fields] < 2 } { 1048 1018 catch {blt::table forget $itk_component(field) $itk_component(field_l)} … … 1275 1245 itcl::body Rappture::VtkImageViewer::InitSettings { args } { 1276 1246 foreach spec $args { 1277 if { [info exists _settings($_first${spec})] } {1278 # Reset global setting with dataobj specific setting1279 set _settings($spec) $_settings($_first${spec})1280 }1281 1247 AdjustSetting $spec 1282 1248 } … … 1295 1261 } 1296 1262 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" 1263 "-axesvisible" { 1264 set bool $_settings($what) 1265 SendCmd "axis visible all $bool" 1302 1266 } 1303 1267 "-axislabels" { … … 1309 1273 SendCmd "axis minticks all $bool" 1310 1274 } 1311 "-axisvisible" { 1312 set bool $_settings($what) 1313 SendCmd "axis visible all $bool" 1275 "-axismode" { 1276 set mode [$itk_component(axismode) value] 1277 set mode [$itk_component(axismode) translate $mode] 1278 set _settings($what) $mode 1279 SendCmd "axis flymode $mode" 1314 1280 } 1315 1281 "-background" { … … 1393 1359 SendCmd "camera reset" 1394 1360 DrawLegend 1361 } 1362 "-legendvisible" { 1363 if { !$_settings($what) } { 1364 $itk_component(view) delete legend 1365 } 1366 DrawLegend 1367 } 1368 "-level" { 1369 set val $_settings($what) 1370 SendCmd "image level $val" 1371 } 1372 "-opacity" { 1373 set _changed($what) 1 1374 if { $_settings(-view3d) } { 1375 set _settings(-saveopacity) $_settings($what) 1376 set val [expr $_settings($what) * 0.01] 1377 SendCmd "image opacity $val" 1378 } else { 1379 SendCmd "image opacity 1.0" 1380 } 1381 } 1382 "-outline" { 1383 set bool $_settings($what) 1384 SendCmd "outline visible $bool" 1385 } 1386 "-stretchtofit" { 1387 set bool $_settings($what) 1388 if { $bool } { 1389 if { $_settings(-view3d) } { 1390 SendCmd "camera aspect native" 1391 } else { 1392 SendCmd "camera aspect window" 1393 } 1394 } else { 1395 SendCmd "camera aspect native" 1396 } 1395 1397 } 1396 1398 "-view3d" { … … 1448 1450 set val $_settings($what) 1449 1451 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 1452 } 1487 1453 "-xgrid" - "-ygrid" - "-zgrid" { … … 1795 1761 checkbutton $inner.visible \ 1796 1762 -text "Axes" \ 1797 -variable [itcl::scope _settings(-ax isvisible)] \1798 -command [itcl::code $this AdjustSetting -ax isvisible] \1763 -variable [itcl::scope _settings(-axesvisible)] \ 1764 -command [itcl::code $this AdjustSetting -axesvisible] \ 1799 1765 -font "Arial 9" 1800 1766 checkbutton $inner.labels \ … … 1827 1793 label $inner.mode_l -text "Mode" -font "Arial 9" 1828 1794 1829 itk_component add axis flymode {1795 itk_component add axismode { 1830 1796 Rappture::Combobox $inner.mode -width 10 -editable 0 1831 1797 } … … 1835 1801 "furthest_triad" "farthest" \ 1836 1802 "outer_edges" "outer" 1837 $itk_component(axis flymode) value $_settings(-axisflymode)1838 bind $inner.mode <<Value>> [itcl::code $this AdjustSetting -axis flymode]1803 $itk_component(axismode) value $_settings(-axismode) 1804 bind $inner.mode <<Value>> [itcl::code $this AdjustSetting -axismode] 1839 1805 1840 1806 blt::table $inner \ … … 1973 1939 radiobutton $inner.vtk_button -text "VTK data file" \ 1974 1940 -variable [itcl::scope _downloadPopup(format)] \ 1975 -font "Arial 9 1941 -font "Arial 9" \ 1976 1942 -value vtk 1977 1943 Rappture::Tooltip::for $inner.vtk_button "Save as VTK data file." 1978 1944 radiobutton $inner.image_button -text "Image File" \ 1979 1945 -variable [itcl::scope _downloadPopup(format)] \ 1980 -font "Arial 9 1946 -font "Arial 9" \ 1981 1947 -value image 1982 1948 Rappture::Tooltip::for $inner.image_button \ … … 2046 2012 if { [info exists style(-stretchtofit)] } { 2047 2013 set _settings(-stretchtofit) $style(-stretchtofit) 2048 AdjustSetting -stretch ToFit2014 AdjustSetting -stretchtofit 2049 2015 } 2050 2016 SendCmd "outline add $tag" … … 2092 2058 # DrawLegend -- 2093 2059 # 2094 # Draws the legend in theown canvas on the right side of the plot area.2060 # Draws the legend in its own canvas on the right side of the plot area. 2095 2061 # 2096 2062 itcl::body Rappture::VtkImageViewer::DrawLegend {} { … … 2153 2119 set x1 [expr $x2 - ($iw*12)/10] 2154 2120 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]2121 $c bind title <ButtonPress> [itcl::code $this LegendTitleAction post] 2122 $c bind title <Enter> [itcl::code $this LegendTitleAction enter] 2123 $c bind title <Leave> [itcl::code $this LegendTitleAction leave] 2158 2124 # Reset the item coordinates according the current size of the plot. 2159 2125 if { [info exists _limits($_curFldName)] } { … … 2269 2235 2270 2236 # ---------------------------------------------------------------------- 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} { 2237 # USAGE: LegendTitleAction post 2238 # USAGE: LegendTitleAction enter 2239 # USAGE: LegendTitleAction leave 2240 # USAGE: LegendTitleAction save 2241 # 2242 # Used internally to handle the dropdown list for the fields menu combobox. 2243 # The post option is invoked when the field title is pressed to launch the 2244 # dropdown. The enter option is invoked when the user mouses over the field 2245 # title. The leave option is invoked when the user moves the mouse away 2246 # from the field title. The save option is invoked whenever there is a 2247 # selection from the list, to alert the visualization server. 2248 # ---------------------------------------------------------------------- 2249 itcl::body Rappture::VtkImageViewer::LegendTitleAction {option} { 2282 2250 set c $itk_component(view) 2283 2251 switch -- $option { … … 2289 2257 tk_popup $itk_component(fieldmenu) $x $y 2290 2258 } 2291 activate{2259 enter { 2292 2260 $c itemconfigure title -fill red 2293 2261 } 2294 deactivate {2262 leave { 2295 2263 $c itemconfigure title -fill $itk_option(-plotforeground) 2296 2264 } 2297 invoke {2265 save { 2298 2266 $itk_component(field) value $_curFldLabel 2299 2267 AdjustSetting -field 2300 2268 } 2301 2269 default { 2302 error "bad option \"$option\": should be post, unpost, select"2270 error "bad option \"$option\": should be post, enter, leave or save" 2303 2271 } 2304 2272 } … … 2325 2293 set _view(-zoom) 1.0 2326 2294 } 2295 2296 itcl::body Rappture::VtkImageViewer::SetCurrentFieldName { dataobj } { 2297 set _first $dataobj 2298 $itk_component(field) choices delete 0 end 2299 $itk_component(fieldmenu) delete 0 end 2300 array unset _fields 2301 set _curFldName "" 2302 foreach cname [$_first components] { 2303 foreach fname [$_first fieldnames $cname] { 2304 if { [info exists _fields($fname)] } { 2305 continue 2306 } 2307 foreach { label units components } \ 2308 [$_first fieldinfo $fname] break 2309 $itk_component(field) choices insert end "$fname" "$label" 2310 $itk_component(fieldmenu) add radiobutton -label "$label" \ 2311 -value $label -variable [itcl::scope _curFldLabel] \ 2312 -selectcolor red \ 2313 -activebackground $itk_option(-plotbackground) \ 2314 -activeforeground $itk_option(-plotforeground) \ 2315 -font "Arial 8" \ 2316 -command [itcl::code $this LegendTitleAction save] 2317 set _fields($fname) [list $label $units $components] 2318 if { $_curFldName == "" } { 2319 set _curFldName $fname 2320 set _curFldLabel $label 2321 } 2322 } 2323 } 2324 $itk_component(field) value $_curFldLabel 2325 } -
branches/1.7/gui/scripts/vtkisosurfaceviewer.tcl
r6306 r6364 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 private variable _colorMode "scalar"; # Mode of colormap (vmag or scalar)164 162 private variable _fields 165 163 private variable _curFldName "" 166 164 private variable _curFldLabel "" 165 private variable _colorMode "scalar"; # Mode of colormap (vmag or scalar) 167 166 private variable _mouseOver ""; # what called LegendRangeAction: 168 167 # vmin or vmax … … 654 653 set _dlist [lreplace $_dlist $pos $pos] 655 654 array unset _obj2ovride $dataobj-* 656 array unset _settings $dataobj-*657 655 set changed 1 658 656 } … … 1347 1345 itcl::body Rappture::VtkIsosurfaceViewer::InitSettings { args } { 1348 1346 foreach spec $args { 1349 if { [info exists _settings($_first${spec})] } {1350 # Reset global setting with dataobj specific setting1351 set _settings($spec) $_settings($_first${spec})1352 }1353 1347 AdjustSetting $spec 1354 1348 } … … 1502 1496 } 1503 1497 "-isolinecolor" { 1504 set color [$itk_component(isoline Color) value]1498 set color [$itk_component(isolinecolor) value] 1505 1499 set _settings($what) $color 1506 1500 DrawLegend … … 1738 1732 1739 1733 label $inner.linecolor_l -text "Isolines" -font "Arial 9" 1740 itk_component add isoline Color {1734 itk_component add isolinecolor { 1741 1735 Rappture::Combobox $inner.linecolor -width 10 -editable 0 1742 1736 } … … 1753 1747 "none" "none" 1754 1748 1755 $itk_component(isoline Color) value "white"1749 $itk_component(isolinecolor) value $_settings(-isolinecolor) 1756 1750 bind $inner.linecolor <<Value>> \ 1757 1751 [itcl::code $this AdjustSetting -isolinecolor] … … 2181 2175 SendCmd "camera zoom $_view($what)" 2182 2176 } 2183 2177 } 2184 2178 } 2185 2179 } … … 2215 2209 radiobutton $inner.vtk_button -text "VTK data file" \ 2216 2210 -variable [itcl::scope _downloadPopup(format)] \ 2217 -font "Arial 9 2211 -font "Arial 9" \ 2218 2212 -value vtk 2219 2213 Rappture::Tooltip::for $inner.vtk_button "Save as VTK data file." 2220 2214 radiobutton $inner.image_button -text "Image File" \ 2221 2215 -variable [itcl::scope _downloadPopup(format)] \ 2222 -font "Arial 9 2216 -font "Arial 9" \ 2223 2217 -value image 2224 2218 Rappture::Tooltip::for $inner.image_button \ … … 2256 2250 array set style { 2257 2251 -color BCGYR 2252 -constcolor white 2258 2253 -cutplaneedges 0 2259 2254 -cutplanelighting 1 … … 2281 2276 set style(-opacity) 1.0 2282 2277 } 2278 set style(-constcolor) $itk_option(-plotforeground) 2283 2279 array set style [$dataobj style $comp] 2284 2280 #DebugTrace [array get style] … … 2312 2308 } 2313 2309 if { $_currentColormap == "" } { 2314 SetCurrentColormap $style(-color)2315 2310 $itk_component(colormap) value $style(-color) 2316 2311 } … … 2340 2335 2341 2336 SendCmd "cutplane add $tag" 2342 SendCmd "cutplane color [Color2RGB $ itk_option(-plotforeground)] $tag"2337 SendCmd "cutplane color [Color2RGB $style(-constcolor)] $tag" 2343 2338 foreach axis {x y z} { 2344 2339 set pos [expr $style(-${axis}cutplaneposition) * 0.01] … … 2356 2351 2357 2352 SendCmd "outline add $tag" 2358 SendCmd "outline color [Color2RGB $ itk_option(-plotforeground)] $tag"2353 SendCmd "outline color [Color2RGB $style(-constcolor)] $tag" 2359 2354 SendCmd "outline visible $style(-outline) $tag" 2360 2355 … … 2364 2359 SendCmd "contour3d edges $style(-edges) $tag" 2365 2360 set _settings(-isosurfaceedges) $style(-edges) 2366 #SendCmd "contour3d color [Color2RGB $style(-co lor)] $tag"2361 #SendCmd "contour3d color [Color2RGB $style(-constcolor)] $tag" 2367 2362 SendCmd "contour3d lighting $style(-lighting) $tag" 2368 2363 set _settings(-isosurfacelighting) $style(-lighting) -
branches/1.7/gui/scripts/vtkmeshviewer.tcl
r6306 r6364 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.7/gui/scripts/vtkstreamlinesviewer.tcl
r6306 r6364 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} 106 106 private method SetCurrentColormap { color } 107 private method SetCurrentFieldName { dataobj } 107 108 private method SetLegendTip { x y } 108 109 private method SetObjectStyle { dataobj comp } … … 145 146 private variable _curFldName "" 146 147 private variable _curFldLabel "" 147 private variable _ field ""148 private variable _colorMode "vmag"; # Mode of colormap (vmag or scalar) 148 149 private variable _streamlinesLength 0 149 150 private variable _numSeeds 200 150 private variable _colorMode "vmag"; # Mode of colormap (vmag or scalar)151 151 152 152 private common _downloadPopup; # download options from popup … … 301 301 } 302 302 pack $itk_component(reset) -side top -padx 2 -pady 2 303 Rappture::Tooltip::for $itk_component(reset) "Reset the view to the default zoom level" 303 Rappture::Tooltip::for $itk_component(reset) \ 304 "Reset the view to the default zoom level" 304 305 305 306 itk_component add zoomin { … … 589 590 set _dlist [lreplace $_dlist $pos $pos] 590 591 array unset _obj2ovride $dataobj-* 591 array unset _settings $dataobj-*592 592 set changed 1 593 593 } … … 979 979 if { [info exists _obj2ovride($dataobj-raise)] && $_first == "" } { 980 980 set _first $dataobj 981 SetCurrentFieldName $dataobj 981 982 } 982 983 foreach comp [$dataobj components] { … … 1024 1025 } 1025 1026 } 1026 $itk_component(field) choices delete 0 end1027 $itk_component(fieldmenu) delete 0 end1028 array unset _fields1029 set _curFldName ""1030 set _curFldLabel ""1031 foreach cname [$_first components] {1032 foreach fname [$_first fieldnames $cname] {1033 if { [info exists _fields($fname)] } {1034 continue1035 }1036 foreach { label units components } \1037 [$_first fieldinfo $fname] break1038 $itk_component(field) choices insert end "$fname" "$label"1039 $itk_component(fieldmenu) add radiobutton -label "$label" \1040 -value $label -variable [itcl::scope _curFldLabel] \1041 -selectcolor red \1042 -activebackground $itk_option(-plotbackground) \1043 -activeforeground $itk_option(-plotforeground) \1044 -font "Arial 8" \1045 -command [itcl::code $this Combo invoke]1046 set _fields($fname) [list $label $units $components]1047 if { $_curFldName == "" && $components == 3 } {1048 set _curFldName $fname1049 set _curFldLabel $label1050 }1051 }1052 }1053 $itk_component(field) value $_curFldLabel1054 1027 } 1055 1028 … … 1296 1269 itcl::body Rappture::VtkStreamlinesViewer::InitSettings { args } { 1297 1270 foreach spec $args { 1298 if { [info exists _settings($_first${spec})] } {1299 # Reset global setting with dataobj specific setting1300 set _settings($spec) $_settings($_first${spec})1301 }1302 1271 AdjustSetting $spec 1303 1272 } … … 2065 2034 radiobutton $inner.vtk_button -text "VTK data file" \ 2066 2035 -variable [itcl::scope _downloadPopup(format)] \ 2067 -font " Helvetica 9" \2036 -font "Arial 9" \ 2068 2037 -value vtk 2069 2038 Rappture::Tooltip::for $inner.vtk_button "Save as VTK data file." … … 2182 2151 2183 2152 # ---------------------------------------------------------------------- 2184 # USAGE: ReceiveLegend <colormap> <title> < vmin> <vmax> <size>2153 # USAGE: ReceiveLegend <colormap> <title> <min> <max> <size> 2185 2154 # 2186 2155 # Invoked automatically whenever the "legend" command comes in from … … 2188 2157 # specified <size> will follow. 2189 2158 # ---------------------------------------------------------------------- 2190 itcl::body Rappture::VtkStreamlinesViewer::ReceiveLegend { colormap title vmin vmax size } {2159 itcl::body Rappture::VtkStreamlinesViewer::ReceiveLegend { colormap title min max size } { 2191 2160 set _legendPending 0 2192 2161 set _title $title … … 2252 2221 $c bind colormap <Motion> [itcl::code $this MotionLegend %x %y] 2253 2222 } 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]2223 $c bind title <ButtonPress> [itcl::code $this LegendTitleAction post] 2224 $c bind title <Enter> [itcl::code $this LegendTitleAction enter] 2225 $c bind title <Leave> [itcl::code $this LegendTitleAction leave] 2257 2226 # Reset the item coordinates according the current size of the plot. 2258 2227 $c itemconfigure title -text $title … … 2377 2346 2378 2347 # ---------------------------------------------------------------------- 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} { 2348 # USAGE: LegendTitleAction post 2349 # USAGE: LegendTitleAction enter 2350 # USAGE: LegendTitleAction leave 2351 # USAGE: LegendTitleAction save 2352 # 2353 # Used internally to handle the dropdown list for the fields menu combobox. 2354 # The post option is invoked when the field title is pressed to launch the 2355 # dropdown. The enter option is invoked when the user mouses over the field 2356 # title. The leave option is invoked when the user moves the mouse away 2357 # from the field title. The save option is invoked whenever there is a 2358 # selection from the list, to alert the visualization server. 2359 # ---------------------------------------------------------------------- 2360 itcl::body Rappture::VtkStreamlinesViewer::LegendTitleAction {option} { 2390 2361 set c $itk_component(view) 2391 2362 switch -- $option { … … 2397 2368 tk_popup $itk_component(fieldmenu) $x $y 2398 2369 } 2399 activate{2370 enter { 2400 2371 $c itemconfigure title -fill red 2401 2372 } 2402 deactivate {2373 leave { 2403 2374 $c itemconfigure title -fill white 2404 2375 } 2405 invoke {2376 save { 2406 2377 $itk_component(field) value $_curFldLabel 2407 2378 AdjustSetting -field 2408 2379 } 2409 2380 default { 2410 error "bad option \"$option\": should be post, unpost, select"2381 error "bad option \"$option\": should be post, enter, leave or save" 2411 2382 } 2412 2383 } … … 2433 2404 set _view(-zoom) 1.0 2434 2405 } 2406 2407 itcl::body Rappture::VtkStreamlinesViewer::SetCurrentFieldName { dataobj } { 2408 set _first $dataobj 2409 $itk_component(field) choices delete 0 end 2410 $itk_component(fieldmenu) delete 0 end 2411 array unset _fields 2412 set _curFldName "" 2413 set _curFldLabel "" 2414 foreach cname [$_first components] { 2415 foreach fname [$_first fieldnames $cname] { 2416 if { [info exists _fields($fname)] } { 2417 continue 2418 } 2419 foreach { label units components } \ 2420 [$_first fieldinfo $fname] break 2421 $itk_component(field) choices insert end "$fname" "$label" 2422 $itk_component(fieldmenu) add radiobutton -label "$label" \ 2423 -value $label -variable [itcl::scope _curFldLabel] \ 2424 -selectcolor red \ 2425 -activebackground $itk_option(-plotbackground) \ 2426 -activeforeground $itk_option(-plotforeground) \ 2427 -font "Arial 8" \ 2428 -command [itcl::code $this LegendTitleAction save] 2429 set _fields($fname) [list $label $units $components] 2430 if { $_curFldName == "" && $components == 3 } { 2431 set _curFldName $fname 2432 set _curFldLabel $label 2433 } 2434 } 2435 } 2436 $itk_component(field) value $_curFldLabel 2437 } -
branches/1.7/gui/scripts/vtksurfaceviewer.tcl
r6306 r6364 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 private variable _colorMode "scalar"; # Mode of colormap (vmag or scalar)143 141 private variable _fields 144 142 private variable _curFldName "" 145 143 private variable _curFldLabel "" 144 private variable _colorMode "scalar"; # Mode of colormap (vmag or scalar) 146 145 147 146 private common _downloadPopup; # download options from popup … … 510 509 set _dlist [lreplace $_dlist $pos $pos] 511 510 array unset _obj2ovride $dataobj-* 512 array unset _settings $dataobj-*513 511 set changed 1 514 512 } … … 1191 1189 itcl::body Rappture::VtkSurfaceViewer::InitSettings { args } { 1192 1190 foreach spec $args { 1193 if { [info exists _settings($_first${spec})] } {1194 # Reset global setting with dataobj specific setting1195 set _settings($spec) $_settings($_first${spec})1196 }1197 1191 AdjustSetting $spec 1198 1192 } … … 1315 1309 "-isolinecolor" { 1316 1310 set _changed($what) 1 1317 set color [$itk_component(isolineColor) value] 1318 set _settings($what) $color 1319 SendCmd "contour2d linecolor [Color2RGB $color]" 1311 set color [$itk_component(isolinecolor) value] 1312 if { $color == "none" } { 1313 if { $_settings(-isolinesvisible) } { 1314 set _changed(-isolinesvisible) 1 1315 foreach tag [CurrentDatasets -visible] { 1316 SendCmd "contour2d visible 0 $tag" 1317 } 1318 set _settings(-isolinesvisible) 0 1319 } 1320 } else { 1321 set _settings($what) $color 1322 if { !$_settings(-isolinesvisible) } { 1323 set _changed(-isolinesvisible) 1 1324 foreach tag [CurrentDatasets -visible] { 1325 SendCmd "contour2d visible 1 $tag" 1326 } 1327 set _settings(-isolinesvisible) 1 1328 } 1329 SendCmd "contour2d linecolor [Color2RGB $color]" 1330 } 1320 1331 DrawLegend 1321 1332 } … … 1325 1336 SendCmd "contour2d visible 0" 1326 1337 if { $bool } { 1338 if { [$itk_component(isolinecolor) value] != $_settings(-isolinecolor)} { 1339 $itk_component(isolinecolor) value $_settings(-isolinecolor) 1340 } 1327 1341 foreach tag [CurrentDatasets -visible] { 1328 1342 SendCmd "contour2d visible $bool $tag" … … 1543 1557 1544 1558 label $inner.linecolor_l -text "Isolines" -font "Arial 9" 1545 itk_component add isoline Color {1559 itk_component add isolinecolor { 1546 1560 Rappture::Combobox $inner.linecolor -width 10 -editable 0 1547 1561 } … … 1558 1572 "none" "none" 1559 1573 1560 $itk_component(isoline Color) value "white"1574 $itk_component(isolinecolor) value $_settings(-isolinecolor) 1561 1575 bind $inner.linecolor <<Value>> \ 1562 1576 [itcl::code $this AdjustSetting -isolinecolor] … … 1794 1808 SendCmd "camera zoom $_view($what)" 1795 1809 } 1796 1810 } 1797 1811 } 1798 1812 } … … 1828 1842 radiobutton $inner.vtk_button -text "VTK data file" \ 1829 1843 -variable [itcl::scope _downloadPopup(format)] \ 1830 -font "Arial 9 1844 -font "Arial 9" \ 1831 1845 -value vtk 1832 1846 Rappture::Tooltip::for $inner.vtk_button "Save as VTK data file." 1833 1847 radiobutton $inner.image_button -text "Image File" \ 1834 1848 -variable [itcl::scope _downloadPopup(format)] \ 1835 -font "Arial 9 1849 -font "Arial 9" \ 1836 1850 -value image 1837 1851 Rappture::Tooltip::for $inner.image_button \ … … 2167 2181 } 2168 2182 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]2183 $c bind title <ButtonPress> [itcl::code $this LegendTitleAction post] 2184 $c bind title <Enter> [itcl::code $this LegendTitleAction enter] 2185 $c bind title <Leave> [itcl::code $this LegendTitleAction leave] 2172 2186 # Reset the item coordinates according the current size of the plot. 2173 2187 $c itemconfigure title -text $title … … 2194 2208 2195 2209 # ---------------------------------------------------------------------- 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} { 2210 # USAGE: LegendTitleAction post 2211 # USAGE: LegendTitleAction enter 2212 # USAGE: LegendTitleAction leave 2213 # USAGE: LegendTitleAction save 2214 # 2215 # Used internally to handle the dropdown list for the fields menu combobox. 2216 # The post option is invoked when the field title is pressed to launch the 2217 # dropdown. The enter option is invoked when the user mouses over the field 2218 # title. The leave option is invoked when the user moves the mouse away 2219 # from the field title. The save option is invoked whenever there is a 2220 # selection from the list, to alert the visualization server. 2221 # ---------------------------------------------------------------------- 2222 itcl::body Rappture::VtkSurfaceViewer::LegendTitleAction {option} { 2207 2223 set c $itk_component(view) 2208 2224 switch -- $option { … … 2216 2232 tk_popup $itk_component(fieldmenu) $x $y 2217 2233 } 2218 activate{2234 enter { 2219 2235 $c itemconfigure title -fill red 2220 2236 } 2221 deactivate {2237 leave { 2222 2238 $c itemconfigure title -fill $itk_option(-plotforeground) 2223 2239 } 2224 invoke {2240 save { 2225 2241 $itk_component(field) value $_curFldLabel 2226 2242 AdjustSetting -field 2227 2243 } 2228 2244 default { 2229 error "bad option \"$option\": should be post, unpost, select"2245 error "bad option \"$option\": should be post, enter, leave or save" 2230 2246 } 2231 2247 } … … 2317 2333 -activeforeground $itk_option(-plotforeground) \ 2318 2334 -font "Arial 8" \ 2319 -command [itcl::code $this Combo invoke]2335 -command [itcl::code $this LegendTitleAction save] 2320 2336 set _fields($fname) [list $label $units $components] 2321 2337 if { $_curFldName == "" } { -
branches/1.7/gui/scripts/vtkviewer.tcl
r6306 r6364 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} … … 631 631 set _dlist [lreplace $_dlist $pos $pos] 632 632 array unset _obj2ovride $dataobj-* 633 array unset _settings $dataobj-*634 633 set changed 1 635 634 } … … 2585 2584 radiobutton $inner.vtk_button -text "VTK data file" \ 2586 2585 -variable [itcl::scope _downloadPopup(format)] \ 2587 -font " Helvetica 9" \2586 -font "Arial 9" \ 2588 2587 -value vtk 2589 2588 Rappture::Tooltip::for $inner.vtk_button "Save as VTK data file." … … 2863 2862 2864 2863 # ---------------------------------------------------------------------- 2865 # USAGE: ReceiveLegend <colormap> <title> < vmin> <vmax> <size>2864 # USAGE: ReceiveLegend <colormap> <title> <min> <max> <size> 2866 2865 # 2867 2866 # Invoked automatically whenever the "legend" command comes in from … … 2869 2868 # specified <size> will follow. 2870 2869 # ---------------------------------------------------------------------- 2871 itcl::body Rappture::VtkViewer::ReceiveLegend { colormap title vmin vmax size } {2872 set _limits(vmin) $ vmin2873 set _limits(vmax) $ vmax2870 itcl::body Rappture::VtkViewer::ReceiveLegend { colormap title min max size } { 2871 set _limits(vmin) $min 2872 set _limits(vmax) $max 2874 2873 set _title $title 2875 2874 if { [IsConnected] } { -
branches/1.7/gui/scripts/vtkvolumeviewer.tcl
r6306 r6364 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} 106 106 private method SetColormap { dataobj comp } 107 private method SetCurrentFieldName { dataobj } 107 108 private method SetLegendTip { x y } 108 109 private method SetObjectStyle { dataobj cname } … … 224 225 array set _settings { 225 226 -axesvisible 1 226 -axisflymode static227 227 -axislabels 1 228 228 -axisminorticks 1 229 -axismode "static" 229 230 -background black 230 231 -color BCGYR … … 548 549 set _dlist [lreplace $_dlist $pos $pos] 549 550 array unset _obj2ovride $dataobj-* 550 array unset _settings $dataobj-*551 551 set changed 1 552 552 } … … 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 … … 986 986 if { [info exists _obj2ovride($dataobj-raise)] && $_first == "" } { 987 987 set _first $dataobj 988 SetCurrentFieldName $dataobj 988 989 } 989 990 foreach cname [$dataobj components] { … … 1032 1033 } 1033 1034 } 1034 $itk_component(field) choices delete 0 end1035 $itk_component(fieldmenu) delete 0 end1036 array unset _fields1037 set _curFldName ""1038 foreach cname [$_first components] {1039 foreach fname [$_first fieldnames $cname] {1040 if { [info exists _fields($fname)] } {1041 continue1042 }1043 foreach { label units components } \1044 [$_first fieldinfo $fname] break1045 # Only scalar fields are valid1046 if {$_allowMultiComponent || $components == 1} {1047 $itk_component(field) choices insert end "$fname" "$label"1048 $itk_component(fieldmenu) add radiobutton -label "$label" \1049 -value $label -variable [itcl::scope _curFldLabel] \1050 -selectcolor red \1051 -activebackground $itk_option(-plotbackground) \1052 -activeforeground $itk_option(-plotforeground) \1053 -font "Arial 8" \1054 -command [itcl::code $this Combo invoke]1055 set _fields($fname) [list $label $units $components]1056 if { $_curFldName == "" } {1057 set _curFldName $fname1058 set _curFldLabel $label1059 }1060 }1061 }1062 }1063 $itk_component(field) value $_curFldLabel1064 1035 } 1065 1036 … … 1296 1267 itcl::body Rappture::VtkVolumeViewer::InitSettings { args } { 1297 1268 foreach spec $args { 1298 if { [info exists _settings($_first${spec})] } {1299 # Reset global setting with dataobj specific setting1300 set _settings($spec) $_settings($_first${spec})1301 }1302 1269 AdjustSetting $spec 1303 1270 } … … 1316 1283 } 1317 1284 switch -- $what { 1285 "-axesvisible" { 1286 set bool $_settings($what) 1287 SendCmd "axis visible all $bool" 1288 } 1289 "-axislabels" { 1290 set bool $_settings($what) 1291 SendCmd "axis labels all $bool" 1292 } 1293 "-axisminorticks" { 1294 set bool $_settings($what) 1295 SendCmd "axis minticks all $bool" 1296 } 1297 "-axismode" { 1298 set mode [$itk_component(axismode) value] 1299 set mode [$itk_component(axismode) translate $mode] 1300 set _settings($what) $mode 1301 SendCmd "axis flymode $mode" 1302 } 1318 1303 "-background" { 1319 1304 set bgcolor [$itk_component(background) value] … … 1329 1314 DrawLegend 1330 1315 } 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 } 1316 "-color" { 1317 set color [$itk_component(colormap) value] 1318 set _settings($what) $color 1319 foreach dataset [CurrentDatasets -visible $_first] { 1320 foreach {dataobj comp} [split $dataset -] break 1321 ChangeColormap $dataobj $comp $color 1322 } 1323 EventuallyRequestLegend 1413 1324 } 1414 1325 "-cutplanelighting" { … … 1436 1347 } 1437 1348 } 1438 "-xcutplanevisible" - "-ycutplanevisible" - "-zcutplanevisible" { 1439 set axis [string range $what 1 1] 1349 "-cutplanesvisible" { 1440 1350 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 1351 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 1352 SendCmd "$_cutplaneCmd visible $bool $dataset" 1353 } 1468 1354 } 1469 1355 "-field" { … … 1495 1381 SendCmd "camera reset" 1496 1382 DrawLegend 1383 } 1384 "-legendvisible" { 1385 DrawLegend 1386 } 1387 "-volumematerial" { 1388 set val $_settings($what) 1389 set diffuse [expr {0.01*$val}] 1390 set specular [expr {0.01*$val}] 1391 #set power [expr {sqrt(160*$val+1.0)}] 1392 set power [expr {$val+1.0}] 1393 foreach tag [CurrentDatasets -visible] { 1394 SendCmd "volume shading diffuse $diffuse $tag" 1395 SendCmd "volume shading specular $specular $power $tag" 1396 } 1397 } 1398 "-volumelighting" { 1399 set bool $_settings($what) 1400 foreach tag [CurrentDatasets -visible] { 1401 SendCmd "volume lighting $bool $tag" 1402 } 1403 } 1404 "-volumeopacity" { 1405 set val $_settings($what) 1406 set val [expr {0.01*$val}] 1407 foreach tag [CurrentDatasets -visible] { 1408 SendCmd "volume opacity $val $tag" 1409 } 1410 } 1411 "-volumeoutline" { 1412 set bool $_settings($what) 1413 SendCmd "outline visible 0" 1414 foreach tag [CurrentDatasets -visible] { 1415 SendCmd "outline visible $bool $tag" 1416 } 1417 } 1418 "-volumequality" { 1419 set val $_settings($what) 1420 set val [expr {0.01*$val}] 1421 foreach tag [CurrentDatasets -visible] { 1422 SendCmd "volume quality $val $tag" 1423 } 1424 } 1425 "-volumevisible" { 1426 set bool $_settings($what) 1427 foreach tag [CurrentDatasets -visible] { 1428 SendCmd "volume visible $bool $tag" 1429 } 1430 if { $bool } { 1431 Rappture::Tooltip::for $itk_component(volume) \ 1432 "Hide the volume" 1433 } else { 1434 Rappture::Tooltip::for $itk_component(volume) \ 1435 "Show the volume" 1436 } 1437 } 1438 "-xcutplanevisible" - "-ycutplanevisible" - "-zcutplanevisible" { 1439 set axis [string range $what 1 1] 1440 set bool $_settings($what) 1441 if { $bool } { 1442 $itk_component(${axis}CutScale) configure -state normal \ 1443 -troughcolor white 1444 } else { 1445 $itk_component(${axis}CutScale) configure -state disabled \ 1446 -troughcolor grey82 1447 } 1448 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 "-xgrid" - "-ygrid" - "-zgrid" { 1461 set axis [string range $what 1 1] 1462 set bool $_settings($what) 1463 SendCmd "axis grid $axis $bool" 1497 1464 } 1498 1465 default { … … 1807 1774 "furthest_triad" "farthest" \ 1808 1775 "outer_edges" "outer" 1809 $itk_component(axismode) value $_settings(-axis flymode)1810 bind $inner.mode <<Value>> [itcl::code $this AdjustSetting -axis flymode]1776 $itk_component(axismode) value $_settings(-axismode) 1777 bind $inner.mode <<Value>> [itcl::code $this AdjustSetting -axismode] 1811 1778 1812 1779 blt::table $inner \ … … 2073 2040 radiobutton $inner.vtk_button -text "VTK data file" \ 2074 2041 -variable [itcl::scope _downloadPopup(format)] \ 2075 -font " Helvetica 9" \2042 -font "Arial 9" \ 2076 2043 -value vtk 2077 2044 Rappture::Tooltip::for $inner.vtk_button "Save as VTK data file." … … 2148 2115 2149 2116 # ---------------------------------------------------------------------- 2150 # USAGE: ReceiveLegend <colormap> <title> < vmin> <vmax> <size>2117 # USAGE: ReceiveLegend <colormap> <title> <min> <max> <size> 2151 2118 # 2152 2119 # Invoked automatically whenever the "legend" command comes in from … … 2154 2121 # specified <size> will follow. 2155 2122 # ---------------------------------------------------------------------- 2156 itcl::body Rappture::VtkVolumeViewer::ReceiveLegend { colormap title vmin vmax size } {2123 itcl::body Rappture::VtkVolumeViewer::ReceiveLegend { colormap title min max size } { 2157 2124 if { [isconnected] } { 2158 2125 set bytes [ReceiveBytes $size] … … 2217 2184 $c bind colormap <Motion> [itcl::code $this MotionLegend %x %y] 2218 2185 } 2219 $c bind title <ButtonPress> [itcl::code $this Combopost]2220 $c bind title <Enter> [itcl::code $this Combo activate]2221 $c bind title <Leave> [itcl::code $this Combo deactivate]2186 $c bind title <ButtonPress> [itcl::code $this LegendTitleAction post] 2187 $c bind title <Enter> [itcl::code $this LegendTitleAction enter] 2188 $c bind title <Leave> [itcl::code $this LegendTitleAction leave] 2222 2189 # Reset the item coordinates according the current size of the plot. 2223 2190 $c itemconfigure title -text $title … … 2341 2308 2342 2309 # ---------------------------------------------------------------------- 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} { 2310 # USAGE: LegendTitleAction post 2311 # USAGE: LegendTitleAction enter 2312 # USAGE: LegendTitleAction leave 2313 # USAGE: LegendTitleAction save 2314 # 2315 # Used internally to handle the dropdown list for the fields menu combobox. 2316 # The post option is invoked when the field title is pressed to launch the 2317 # dropdown. The enter option is invoked when the user mouses over the field 2318 # title. The leave option is invoked when the user moves the mouse away 2319 # from the field title. The save option is invoked whenever there is a 2320 # selection from the list, to alert the visualization server. 2321 # ---------------------------------------------------------------------- 2322 itcl::body Rappture::VtkVolumeViewer::LegendTitleAction {option} { 2354 2323 set c $itk_component(view) 2355 2324 switch -- $option { … … 2361 2330 tk_popup $itk_component(fieldmenu) $x $y 2362 2331 } 2363 activate{2332 enter { 2364 2333 $c itemconfigure title -fill red 2365 2334 } 2366 deactivate {2335 leave { 2367 2336 $c itemconfigure title -fill $itk_option(-plotforeground) 2368 2337 } 2369 invoke {2338 save { 2370 2339 $itk_component(field) value $_curFldLabel 2371 2340 AdjustSetting -field 2372 2341 } 2373 2342 default { 2374 error "bad option \"$option\": should be post, unpost, select"2343 error "bad option \"$option\": should be post, enter, leave or save" 2375 2344 } 2376 2345 } … … 2412 2381 return $_volcomponents($cname) 2413 2382 } 2383 2384 itcl::body Rappture::VtkVolumeViewer::SetCurrentFieldName { dataobj } { 2385 set _first $dataobj 2386 $itk_component(field) choices delete 0 end 2387 $itk_component(fieldmenu) delete 0 end 2388 array unset _fields 2389 set _curFldName "" 2390 foreach cname [$_first components] { 2391 foreach fname [$_first fieldnames $cname] { 2392 if { [info exists _fields($fname)] } { 2393 continue 2394 } 2395 foreach { label units components } \ 2396 [$_first fieldinfo $fname] break 2397 # Only scalar fields are valid 2398 if {$_allowMultiComponent || $components == 1} { 2399 $itk_component(field) choices insert end "$fname" "$label" 2400 $itk_component(fieldmenu) add radiobutton -label "$label" \ 2401 -value $label -variable [itcl::scope _curFldLabel] \ 2402 -selectcolor red \ 2403 -activebackground $itk_option(-plotbackground) \ 2404 -activeforeground $itk_option(-plotforeground) \ 2405 -font "Arial 8" \ 2406 -command [itcl::code $this LegendTitleAction save] 2407 set _fields($fname) [list $label $units $components] 2408 if { $_curFldName == "" } { 2409 set _curFldName $fname 2410 set _curFldLabel $label 2411 } 2412 } 2413 } 2414 } 2415 $itk_component(field) value $_curFldLabel 2416 }
Note: See TracChangeset
for help on using the changeset viewer.