Changeset 4766 for branches/1.3/gui/scripts/flowvisviewer.tcl
- Timestamp:
- Nov 23, 2014, 1:12:25 AM (10 years ago)
- Location:
- branches/1.3
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/1.3
-
branches/1.3/gui/scripts/flowvisviewer.tcl
r4759 r4766 43 43 itk_option define -plotbackground plotBackground Background "" 44 44 itk_option define -plotoutline plotOutline PlotOutline "" 45 46 private variable _volcomponents ; # Array of components found47 private variable _componentsList ; # Array of components found48 private method BuildVolumeComponents {}49 private method GetDatasetsWithComponent { cname }50 45 51 46 constructor { hostlist args } { … … 77 72 public method updateTransferFunctions {} 78 73 79 protected method Connect {}80 protected method CurrentVolumeIds {{what -all}}81 protected method Disconnect {}82 protected method Resize {}83 protected method ResizeLegend {}84 protected method AdjustSetting {what {value ""}}85 protected method InitSettings { args }86 protected method Pan {option x y}87 protected method Rebuild {}88 protected method ReceiveData { args }89 protected method ReceiveImage { args }90 protected method ReceiveLegend { tf vmin vmax size }91 protected method Rotate {option x y}92 protected method SendTransferFuncs {}93 protected method Slice {option args}94 protected method SlicerTip {axis}95 protected method Zoom {option}96 97 74 # soon to be removed. 98 protected method Flow {option args} 99 protected method Play {} 100 protected method Pause {} 101 75 private method Flow {option args} 76 private method Play {} 77 private method Pause {} 102 78 103 79 # The following methods are only used by this class. 104 80 private method AdjustSetting {what {value ""}} 105 81 private method AddIsoMarker { x y } 106 82 private method BuildCameraTab {} 107 83 private method BuildCutplanesTab {} 108 84 private method BuildViewTab {} 85 private method BuildVolumeComponents {} 109 86 private method BuildVolumeTab {} 110 87 private method ComputeTransferFunc { tf } 88 private method Connect {} 89 private method CurrentVolumeIds {{what -all}} 90 private method Disconnect {} 111 91 private method EventuallyResize { w h } 112 92 private method EventuallyGoto { nSteps } 113 93 private method EventuallyResizeLegend { } 114 94 private method FlowCmd { dataobj comp nbytes extents } 95 private method GetDatasetsWithComponent { cname } 96 private method GetFlowInfo { widget } 115 97 private method GetMovie { widget width height } 116 98 private method GetPngImage { widget width height } 99 private method InitSettings { args } 117 100 private method NameTransferFunc { dataobj comp } 101 private method Pan {option x y} 118 102 private method PanCamera {} 119 103 private method ParseLevelsOption { tf levels } 120 104 private method ParseMarkersOption { tf markers } 105 private method QuaternionToView { q } { 106 foreach { _view(-qw) _view(-qx) _view(-qy) _view(-qz) } $q break 107 } 108 private method Rebuild {} 109 private method ReceiveData { args } 110 private method ReceiveImage { args } 111 private method ReceiveLegend { tf vmin vmax size } 112 private method Resize {} 113 private method ResizeLegend {} 114 private method Rotate {option x y} 115 private method SendTransferFuncs {} 116 private method SetOrientation { side } 117 private method Slice {option args} 118 private method SlicerTip {axis} 119 private method ViewToQuaternion {} { 120 return [list $_view(-qw) $_view(-qx) $_view(-qy) $_view(-qz)] 121 } 121 122 private method WaitIcon { option widget } 123 private method Zoom {option} 124 private method arrows { tag name } 125 private method box { tag name } 126 private method millisecs2str { value } 127 private method particles { tag name } 122 128 private method str2millisecs { value } 123 private method millisecs2str { value }124 private method GetFlowInfo { widget }125 private method particles { tag name }126 private method box { tag name }127 129 private method streams { tag name } 128 private method arrows { tag name }129 private method SetOrientation { side }130 130 131 131 private variable _arcball "" … … 149 149 private variable _activeTf "" ;# The currently active transfer function. 150 150 private variable _first "" ;# This is the topmost volume. 151 private variable _volcomponents ; # Array of components found 152 private variable _componentsList ; # Array of components found 151 153 private variable _nextToken 0 152 154 private variable _icon 0 … … 218 220 # Initialize the view to some default parameters. 219 221 array set _view { 220 qw 0.853553221 qx -0.353553222 qy 0.353553223 qz 0.146447224 zoom 1.0225 xpan 0226 ypan0222 -qw 0.853553 223 -qx -0.353553 224 -qy 0.353553 225 -qz 0.146447 226 -xpan 0 227 -ypan 0 228 -zoom 1.0 227 229 } 228 230 set _arcball [blt::arcball create 100 100] 229 set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)] 230 $_arcball quaternion $q 231 $_arcball quaternion [ViewToQuaternion] 231 232 232 233 set _limits(v) [list 0.0 1.0] … … 234 235 235 236 array set _settings [subst { 236 $this-qw $_view( qw)237 $this-qx $_view( qx)238 $this-qy $_view( qy)239 $this-qz $_view( qz)240 $this-zoom $_view( zoom)241 $this-xpan $_view( xpan)242 $this-ypan $_view( ypan)237 $this-qw $_view(-qw) 238 $this-qx $_view(-qx) 239 $this-qy $_view(-qy) 240 $this-qz $_view(-qz) 241 $this-zoom $_view(-zoom) 242 $this-xpan $_view(-xpan) 243 $this-ypan $_view(-ypan) 243 244 $this-arrows 0 244 245 $this-currenttime 0 … … 1191 1192 1192 1193 } 1193 set _settings($this-qw) $_view( qw)1194 set _settings($this-qx) $_view( qx)1195 set _settings($this-qy) $_view( qy)1196 set _settings($this-qz) $_view( qz)1197 set _settings($this-xpan) $_view( xpan)1198 set _settings($this-ypan) $_view( ypan)1199 set _settings($this-zoom) $_view( zoom)1200 1201 set q [ list $_view(qw) $_view(qx) $_view(qy) $_view(qz)]1194 set _settings($this-qw) $_view(-qw) 1195 set _settings($this-qx) $_view(-qx) 1196 set _settings($this-qy) $_view(-qy) 1197 set _settings($this-qz) $_view(-qz) 1198 set _settings($this-xpan) $_view(-xpan) 1199 set _settings($this-ypan) $_view(-ypan) 1200 set _settings($this-zoom) $_view(-zoom) 1201 1202 set q [ViewToQuaternion] 1202 1203 $_arcball quaternion $q 1203 1204 SendCmd "camera orient $q" 1204 1205 SendCmd "camera reset" 1205 1206 PanCamera 1206 SendCmd "camera zoom $_view( zoom)"1207 SendCmd "camera zoom $_view(-zoom)" 1207 1208 1208 1209 foreach dataobj [get] { … … 1284 1285 switch -- $option { 1285 1286 "in" { 1286 set _view( zoom) [expr {$_view(zoom)*1.25}]1287 set _settings($this-zoom) $_view( zoom)1288 SendCmd "camera zoom $_view( zoom)"1287 set _view(-zoom) [expr {$_view(-zoom)*1.25}] 1288 set _settings($this-zoom) $_view(-zoom) 1289 SendCmd "camera zoom $_view(-zoom)" 1289 1290 } 1290 1291 "out" { 1291 set _view( zoom) [expr {$_view(zoom)*0.8}]1292 set _settings($this-zoom) $_view( zoom)1293 SendCmd "camera zoom $_view( zoom)"1292 set _view(-zoom) [expr {$_view(-zoom)*0.8}] 1293 set _settings($this-zoom) $_view(-zoom) 1294 SendCmd "camera zoom $_view(-zoom)" 1294 1295 } 1295 1296 "reset" { 1296 1297 array set _view { 1297 qw 0.8535531298 qx -0.3535531299 qy 0.3535531300 qz 0.1464471301 zoom 1.01302 xpan01303 ypan01298 -qw 0.853553 1299 -qx -0.353553 1300 -qy 0.353553 1301 -qz 0.146447 1302 -zoom 1.0 1303 -xpan 0 1304 -ypan 0 1304 1305 } 1305 1306 if { $_first != "" } { … … 1309 1310 } 1310 1311 } 1311 set q [ list $_view(qw) $_view(qx) $_view(qy) $_view(qz)]1312 set q [ViewToQuaternion] 1312 1313 $_arcball quaternion $q 1313 1314 SendCmd "camera orient $q" 1314 1315 SendCmd "camera reset" 1315 set _settings($this-qw) $_view( qw)1316 set _settings($this-qx) $_view( qx)1317 set _settings($this-qy) $_view( qy)1318 set _settings($this-qz) $_view( qz)1319 set _settings($this-xpan) $_view( xpan)1320 set _settings($this-ypan) $_view( ypan)1321 set _settings($this-zoom) $_view( zoom)1316 set _settings($this-qw) $_view(-qw) 1317 set _settings($this-qx) $_view(-qx) 1318 set _settings($this-qy) $_view(-qy) 1319 set _settings($this-qz) $_view(-qz) 1320 set _settings($this-xpan) $_view(-xpan) 1321 set _settings($this-ypan) $_view(-ypan) 1322 set _settings($this-zoom) $_view(-zoom) 1322 1323 } 1323 1324 } … … 1325 1326 1326 1327 itcl::body Rappture::FlowvisViewer::PanCamera {} { 1327 set x $_view( xpan)1328 set y $_view( ypan)1328 set x $_view(-xpan) 1329 set y $_view(-ypan) 1329 1330 SendCmd "camera pan $x $y" 1330 1331 } … … 1364 1365 1365 1366 set q [$_arcball rotate $x $y $_click(x) $_click(y)] 1366 foreach { _view(qw) _view(qx) _view(qy) _view(qz) } $q break1367 set _settings($this-qw) $_view( qw)1368 set _settings($this-qx) $_view( qx)1369 set _settings($this-qy) $_view( qy)1370 set _settings($this-qz) $_view( qz)1367 QuaternionToView $q 1368 set _settings($this-qw) $_view(-qw) 1369 set _settings($this-qx) $_view(-qx) 1370 set _settings($this-qy) $_view(-qy) 1371 set _settings($this-qz) $_view(-qz) 1371 1372 SendCmd "camera orient $q" 1372 1373 … … 1401 1402 set x [expr $x / double($w)] 1402 1403 set y [expr $y / double($h)] 1403 set _view( xpan) [expr $_view(xpan) + $x]1404 set _view( ypan) [expr $_view(ypan) + $y]1404 set _view(-xpan) [expr $_view(-xpan) + $x] 1405 set _view(-ypan) [expr $_view(-ypan) + $y] 1405 1406 PanCamera 1406 set _settings($this-xpan) $_view( xpan)1407 set _settings($this-ypan) $_view( ypan)1407 set _settings($this-xpan) $_view(-xpan) 1408 set _settings($this-ypan) $_view(-ypan) 1408 1409 return 1409 1410 } … … 1418 1419 set _click(x) $x 1419 1420 set _click(y) $y 1420 set _view( xpan) [expr $_view(xpan) - $dx]1421 set _view( ypan) [expr $_view(ypan) - $dy]1421 set _view(-xpan) [expr $_view(-xpan) - $dx] 1422 set _view(-ypan) [expr $_view(-ypan) - $dy] 1422 1423 PanCamera 1423 set _settings($this-xpan) $_view( xpan)1424 set _settings($this-ypan) $_view( ypan)1424 set _settings($this-xpan) $_view(-xpan) 1425 set _settings($this-ypan) $_view(-ypan) 1425 1426 } 1426 1427 if { $option == "release" } { … … 2309 2310 -textvariable [itcl::scope _settings($this-$tag)] 2310 2311 bind $inner.${tag} <Return> \ 2311 [itcl::code $this camera set ${tag}]2312 [itcl::code $this camera set -${tag}] 2312 2313 bind $inner.${tag} <KP_Enter> \ 2313 [itcl::code $this camera set ${tag}]2314 [itcl::code $this camera set -${tag}] 2314 2315 blt::table $inner \ 2315 2316 $row,0 $inner.${tag}label -anchor e -pady 2 \ … … 2513 2514 } 2514 2515 "set" { 2515 set wh o[lindex $args 0]2516 set x $_settings($ this-$who)2516 set what [lindex $args 0] 2517 set x $_settings(${this}${what}) 2517 2518 set code [catch { string is double $x } result] 2518 2519 if { $code != 0 || !$result } { 2519 set _settings($ this-$who) $_view($who)2520 set _settings(${this}${what}) $_view($what) 2520 2521 return 2521 2522 } 2522 switch -- $wh o{2523 " xpan" - "ypan" {2524 set _view($wh o) $_settings($this-$who)2523 switch -- $what { 2524 "-xpan" - "-ypan" { 2525 set _view($what) $_settings(${this}${what}) 2525 2526 PanCamera 2526 2527 } 2527 " qx" - "qy" - "qz" - "qw" {2528 set _view($wh o) $_settings($this-$who)2529 set q [ list $_view(qw) $_view(qx) $_view(qy) $_view(qz)]2528 "-qx" - "-qy" - "-qz" - "-qw" { 2529 set _view($what) $_settings(${this}${what}) 2530 set q [ViewToQuaternion] 2530 2531 $_arcball quaternion $q 2531 2532 SendCmd "camera orient $q" 2532 2533 } 2533 " zoom" {2534 set _view($wh o) $_settings($this-$who)2535 SendCmd "camera zoom $_view( zoom)"2534 "-zoom" { 2535 set _view($what) $_settings(${this}${what}) 2536 SendCmd "camera zoom $_view($what)" 2536 2537 } 2537 2538 } … … 2911 2912 bottom "0.707107 0.707107 0 0" 2912 2913 } 2913 foreach name { qw qx qyqz } value $positions($side) {2914 foreach name { -qw -qx -qy -qz } value $positions($side) { 2914 2915 set _view($name) $value 2915 2916 } 2916 set q [ list $_view(qw) $_view(qx) $_view(qy) $_view(qz)]2917 set q [ViewToQuaternion] 2917 2918 $_arcball quaternion $q 2918 2919 SendCmd "camera orient $q" 2919 2920 SendCmd "camera reset" 2920 set _view( xpan) 0.02921 set _view( ypan) 0.02922 set _view( zoom) 1.02923 set _settings($this-xpan) $_view( xpan)2924 set _settings($this-ypan) $_view( ypan)2925 set _settings($this-zoom) $_view( zoom)2921 set _view(-xpan) 0.0 2922 set _view(-ypan) 0.0 2923 set _view(-zoom) 1.0 2924 set _settings($this-xpan) $_view(-xpan) 2925 set _settings($this-ypan) $_view(-ypan) 2926 set _settings($this-zoom) $_view(-zoom) 2926 2927 } 2927 2928
Note: See TracChangeset
for help on using the changeset viewer.