Changeset 5729
- Timestamp:
- Jun 22, 2015 1:17:20 PM (9 years ago)
- Location:
- trunk/gui/scripts
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gui/scripts/flowvisviewer.tcl
r5645 r5729 3 3 # COMPONENT: flowvisviewer - 3D flow rendering 4 4 # 5 # This widget performs volume and flow rendering on 3D scalar/vector datasets.5 # This widget performs volume and flow rendering on 3D vector datasets. 6 6 # It connects to the Nanovis server running on a rendering farm, 7 7 # transmits data, and displays the results. 8 8 # ====================================================================== 9 9 # AUTHOR: Michael McLennan, Purdue University 10 # Copyright (c) 2004-201 2HUBzero Foundation, LLC10 # Copyright (c) 2004-2015 HUBzero Foundation, LLC 11 11 # 12 12 # See the file "license.terms" for information on usage and … … 171 171 set _serverType "nanovis" 172 172 173 # Draw legend event 173 #DebugOn 174 EnableWaitDialog 900 175 176 # Rebuild event 177 $_dispatcher register !rebuild 178 $_dispatcher dispatch $this !rebuild "[itcl::code $this Rebuild]; list" 179 180 # Resize event 181 $_dispatcher register !resize 182 $_dispatcher dispatch $this !resize "[itcl::code $this DoResize]; list" 183 184 # Legend event 174 185 $_dispatcher register !legend 175 186 $_dispatcher dispatch $this !legend "[itcl::code $this FixLegend]; list" … … 179 190 $_dispatcher dispatch $this !send_transfunc \ 180 191 "[itcl::code $this SendTransferFunctions]; list" 181 182 # Rebuild event183 $_dispatcher register !rebuild184 $_dispatcher dispatch $this !rebuild "[itcl::code $this Rebuild]; list"185 186 # Resize event187 $_dispatcher register !resize188 $_dispatcher dispatch $this !resize "[itcl::code $this DoResize]; list"189 192 190 193 $_dispatcher register !play … … 211 214 # Initialize the view to some default parameters. 212 215 array set _view { 213 -qw 0.853553214 -qx -0.353553215 -qy 0.353553216 -qz 0.146447217 -xpan 0218 -ypan 0219 -zoom 1.0216 -qw 0.853553 217 -qx -0.353553 218 -qy 0.353553 219 -qz 0.146447 220 -xpan 0 221 -ypan 0 222 -zoom 1.0 220 223 } 221 224 set _arcball [blt::arcball create 100 100] … … 266 269 }] 267 270 268 itk_component add 3dview {271 itk_component add view { 269 272 label $itk_component(plotarea).view -image $_image(plot) \ 270 273 -highlightthickness 0 -borderwidth 0 … … 273 276 ignore -highlightthickness -borderwidth -background 274 277 } 275 bind $itk_component( 3dview) <Control-F1> [itcl::code $this ToggleConsole]278 bind $itk_component(view) <Control-F1> [itcl::code $this ToggleConsole] 276 279 277 280 set f [$itk_component(main) component controls] … … 317 320 -onimage [Rappture::icon volume-on] \ 318 321 -offimage [Rappture::icon volume-off] \ 319 - command [itcl::code $this AdjustSetting -volume] \320 - variable [itcl::scope _settings(-volume)]322 -variable [itcl::scope _settings(-volume)] \ 323 -command [itcl::code $this AdjustSetting -volume] 321 324 } 322 325 $itk_component(volume) select … … 362 365 # the server. So the panewindow uses the tiny size. 363 366 set w 10000 364 pack forget $itk_component( 3dview)367 pack forget $itk_component(view) 365 368 blt::table $itk_component(plotarea) \ 366 0,0 $itk_component( 3dview) -fill both -reqwidth $w \369 0,0 $itk_component(view) -fill both -reqwidth $w \ 367 370 1,0 $itk_component(legend) -fill x 368 371 blt::table configure $itk_component(plotarea) r1 -resize none … … 511 514 blt::table configure $itk_component(flowcontrols) r0 -pady 1 512 515 # Bindings for rotation via mouse 513 bind $itk_component( 3dview) <ButtonPress-1> \516 bind $itk_component(view) <ButtonPress-1> \ 514 517 [itcl::code $this Rotate click %x %y] 515 bind $itk_component( 3dview) <B1-Motion> \518 bind $itk_component(view) <B1-Motion> \ 516 519 [itcl::code $this Rotate drag %x %y] 517 bind $itk_component( 3dview) <ButtonRelease-1> \520 bind $itk_component(view) <ButtonRelease-1> \ 518 521 [itcl::code $this Rotate release %x %y] 519 522 520 bind $itk_component( 3dview) <Configure> \523 bind $itk_component(view) <Configure> \ 521 524 [itcl::code $this EventuallyResize %w %h] 522 525 523 526 # Bindings for panning via mouse 524 bind $itk_component( 3dview) <ButtonPress-2> \527 bind $itk_component(view) <ButtonPress-2> \ 525 528 [itcl::code $this Pan click %x %y] 526 bind $itk_component( 3dview) <B2-Motion> \529 bind $itk_component(view) <B2-Motion> \ 527 530 [itcl::code $this Pan drag %x %y] 528 bind $itk_component( 3dview) <ButtonRelease-2> \531 bind $itk_component(view) <ButtonRelease-2> \ 529 532 [itcl::code $this Pan release %x %y] 530 533 531 534 # Bindings for panning via keyboard 532 bind $itk_component( 3dview) <KeyPress-Left> \535 bind $itk_component(view) <KeyPress-Left> \ 533 536 [itcl::code $this Pan set -10 0] 534 bind $itk_component( 3dview) <KeyPress-Right> \537 bind $itk_component(view) <KeyPress-Right> \ 535 538 [itcl::code $this Pan set 10 0] 536 bind $itk_component( 3dview) <KeyPress-Up> \539 bind $itk_component(view) <KeyPress-Up> \ 537 540 [itcl::code $this Pan set 0 -10] 538 bind $itk_component( 3dview) <KeyPress-Down> \541 bind $itk_component(view) <KeyPress-Down> \ 539 542 [itcl::code $this Pan set 0 10] 540 bind $itk_component( 3dview) <Shift-KeyPress-Left> \543 bind $itk_component(view) <Shift-KeyPress-Left> \ 541 544 [itcl::code $this Pan set -2 0] 542 bind $itk_component( 3dview) <Shift-KeyPress-Right> \545 bind $itk_component(view) <Shift-KeyPress-Right> \ 543 546 [itcl::code $this Pan set 2 0] 544 bind $itk_component( 3dview) <Shift-KeyPress-Up> \547 bind $itk_component(view) <Shift-KeyPress-Up> \ 545 548 [itcl::code $this Pan set 0 -2] 546 bind $itk_component( 3dview) <Shift-KeyPress-Down> \549 bind $itk_component(view) <Shift-KeyPress-Down> \ 547 550 [itcl::code $this Pan set 0 2] 548 551 549 552 # Bindings for zoom via keyboard 550 bind $itk_component( 3dview) <KeyPress-Prior> \553 bind $itk_component(view) <KeyPress-Prior> \ 551 554 [itcl::code $this Zoom out] 552 bind $itk_component( 3dview) <KeyPress-Next> \555 bind $itk_component(view) <KeyPress-Next> \ 553 556 [itcl::code $this Zoom in] 554 557 555 bind $itk_component( 3dview) <Enter> "focus $itk_component(3dview)"558 bind $itk_component(view) <Enter> "focus $itk_component(view)" 556 559 557 560 if {[string equal "x11" [tk windowingsystem]]} { 558 561 # Bindings for zoom via mouse 559 bind $itk_component( 3dview) <4> [itcl::code $this Zoom out]560 bind $itk_component( 3dview) <5> [itcl::code $this Zoom in]562 bind $itk_component(view) <4> [itcl::code $this Zoom out] 563 bind $itk_component(view) <5> [itcl::code $this Zoom in] 561 564 } 562 565 … … 565 568 eval itk_initialize $args 566 569 567 EnableWaitDialog 900568 570 Connect 569 571 } … … 629 631 # ---------------------------------------------------------------------- 630 632 # USAGE: get ?-objects? 631 # USAGE: get ?-image 3dview|legend?633 # USAGE: get ?-image view|legend? 632 634 # 633 635 # Clients use this to query the list of objects being plotted, in … … 659 661 -image { 660 662 if {[llength $args] != 2} { 661 error "wrong # args: should be \"get -image 3dview|legend\""663 error "wrong # args: should be \"get -image view|legend\"" 662 664 } 663 665 switch -- [lindex $args end] { 664 3dview {666 view { 665 667 return $_image(plot) 666 668 } … … 669 671 } 670 672 default { 671 error "bad image name \"[lindex $args end]\": should be 3dview or legend"673 error "bad image name \"[lindex $args end]\": should be view or legend" 672 674 } 673 675 } … … 682 684 # USAGE: delete ?<dataobj1> <dataobj2> ...? 683 685 # 684 # Clients use this to delete a dataobj from the plot. If no dataobjs 685 # are specified, then all dataobjs are deleted. No data objects are 686 # deleted. They are only removed from the display list. 687 # 686 # Clients use this to delete a dataobj from the plot. If no dataobjs 687 # are specified, then all dataobjs are deleted. No data objects are 688 # deleted. They are only removed from the display list. 688 689 # ---------------------------------------------------------------------- 689 690 itcl::body Rappture::FlowvisViewer::delete {args} { … … 868 869 } 869 870 870 set w [winfo width $itk_component( 3dview)]871 set h [winfo height $itk_component( 3dview)]871 set w [winfo width $itk_component(view)] 872 set h [winfo height $itk_component(view)] 872 873 EventuallyResize $w $h 873 874 } … … 878 879 # isconnected -- 879 880 # 880 # 881 # Indicates if we are currently connected to the visualization server. 881 882 # 882 883 itcl::body Rappture::FlowvisViewer::isconnected {} { … … 894 895 # Disconnect -- 895 896 # 896 # Clients use this method to disconnect from the current rendering 897 # server. 897 # Clients use this method to disconnect from the current rendering server. 898 898 # 899 899 itcl::body Rappture::FlowvisViewer::Disconnect {} { … … 1025 1025 # ReceiveLegend -- 1026 1026 # 1027 # 1028 # 1029 # 1030 # 1031 # 1027 # The procedure is the response from the render server to each "legend" 1028 # command. The server sends back a "legend" command invoked our 1029 # the slave interpreter. The purpose is to collect data of the image 1030 # representing the legend in the canvas. In addition, the 1031 # active transfer function is displayed. 1032 1032 # 1033 1033 itcl::body Rappture::FlowvisViewer::ReceiveLegend { tag vmin vmax size } { … … 1045 1045 # ReceiveData -- 1046 1046 # 1047 # 1048 # 1049 # 1050 # 1051 # 1047 # The procedure is the response from the render server to each "data 1048 # follows" command. The server sends back a "data" command invoked our 1049 # the slave interpreter. The purpose was to collect the min/max of the 1050 # volume sent to the render server. This is no longer needed since we 1051 # already know the limits. 1052 1052 # 1053 1053 itcl::body Rappture::FlowvisViewer::ReceiveData { args } { … … 1071 1071 # ---------------------------------------------------------------------- 1072 1072 itcl::body Rappture::FlowvisViewer::Rebuild {} { 1073 set w [winfo width $itk_component( 3dview)]1074 set h [winfo height $itk_component( 3dview)]1073 set w [winfo width $itk_component(view)] 1074 set h [winfo height $itk_component(view)] 1075 1075 if { $w < 2 || $h < 2 } { 1076 1076 update … … 1183 1183 PanCamera 1184 1184 SendCmd "camera zoom $_view(-zoom)" 1185 set _reset 0 1185 1186 } 1186 1187 … … 1197 1198 StopBufferingCommands 1198 1199 blt::busy release $itk_component(hull) 1199 set _reset 01200 1200 } 1201 1201 … … 1295 1295 switch -- $option { 1296 1296 click { 1297 $itk_component( 3dview) configure -cursor fleur1297 $itk_component(view) configure -cursor fleur 1298 1298 set _click(x) $x 1299 1299 set _click(y) $y … … 1303 1303 Rotate click $x $y 1304 1304 } else { 1305 set w [winfo width $itk_component( 3dview)]1306 set h [winfo height $itk_component( 3dview)]1305 set w [winfo width $itk_component(view)] 1306 set h [winfo height $itk_component(view)] 1307 1307 if {$w <= 0 || $h <= 0} { 1308 1308 return … … 1331 1331 release { 1332 1332 Rotate drag $x $y 1333 $itk_component( 3dview) configure -cursor ""1333 $itk_component(view) configure -cursor "" 1334 1334 catch {unset _click} 1335 1335 } … … 1350 1350 itcl::body Rappture::FlowvisViewer::Pan {option x y} { 1351 1351 # Experimental stuff 1352 set w [winfo width $itk_component( 3dview)]1353 set h [winfo height $itk_component( 3dview)]1352 set w [winfo width $itk_component(view)] 1353 set h [winfo height $itk_component(view)] 1354 1354 if { $option == "set" } { 1355 1355 set x [expr $x / double($w)] … … 1365 1365 set _click(x) $x 1366 1366 set _click(y) $y 1367 $itk_component( 3dview) configure -cursor hand11367 $itk_component(view) configure -cursor hand1 1368 1368 } 1369 1369 if { $option == "drag" || $option == "release" } { … … 1379 1379 } 1380 1380 if { $option == "release" } { 1381 $itk_component( 3dview) configure -cursor ""1381 $itk_component(view) configure -cursor "" 1382 1382 } 1383 1383 } … … 1470 1470 if { $_settings($what) } { 1471 1471 blt::table $itk_component(plotarea) \ 1472 0,0 $itk_component( 3dview) -fill both \1472 0,0 $itk_component(view) -fill both \ 1473 1473 1,0 $itk_component(legend) -fill x 1474 1474 blt::table configure $itk_component(plotarea) r1 -resize none … … 1591 1591 # NameTransferFunction -- 1592 1592 # 1593 # 1594 # 1595 # 1596 # 1597 # 1593 # Creates a transfer function name based on the <style> settings in the 1594 # library run.xml file. This placeholder will be used later to create 1595 # and send the actual transfer function once the data info has been sent 1596 # to us by the render server. [We won't know the volume limits until the 1597 # server parses the 3D data and sends back the limits via ReceiveData.] 1598 1598 # 1599 1599 itcl::body Rappture::FlowvisViewer::NameTransferFunction { dataobj cname } { … … 1616 1616 # ComputeTransferFunction -- 1617 1617 # 1618 # 1619 # 1620 # 1621 # 1622 # 1618 # Computes and sends the transfer function to the render server. It's 1619 # assumed that the volume data limits are known and that the global 1620 # transfer-functions slider values have been set up. Both parts are 1621 # needed to compute the relative value (location) of the marker, and 1622 # the alpha map of the transfer function. 1623 1623 # 1624 1624 itcl::body Rappture::FlowvisViewer::ComputeTransferFunction { tf } { … … 2603 2603 } 2604 2604 "next" { 2605 if { ![winfo viewable $itk_component( 3dview)] } {2605 if { ![winfo viewable $itk_component(view)] } { 2606 2606 flow stop 2607 2607 return … … 2918 2918 # BuildVolumeComponents -- 2919 2919 # 2920 # 2921 # 2922 # 2923 # 2924 # 2925 # 2920 # This is called from the "scale" method which is called when a new 2921 # dataset is added or deleted. It repopulates the dropdown menu of 2922 # volume component names. It sets the current component to the first 2923 # component in the list (of components found). Finally, if there is 2924 # only one component, don't display the label or the combobox in the 2925 # volume settings tab. 2926 2926 # 2927 2927 itcl::body Rappture::FlowvisViewer::BuildVolumeComponents {} { … … 2937 2937 # GetDatasetsWithComponents -- 2938 2938 # 2939 # 2940 # 2941 # 2942 # 2939 # Returns a list of all the datasets (known by the combination of their 2940 # data object and component name) that match the given component name. 2941 # For example, this is used where we want to change the settings of 2942 # volumes that have the current component. 2943 2943 # 2944 2944 itcl::body Rappture::FlowvisViewer::GetDatasetsWithComponent { cname } { -
trunk/gui/scripts/molvisviewer.tcl
r5726 r5729 8 8 # ====================================================================== 9 9 # AUTHOR: Michael McLennan, Purdue University 10 # Copyright (c) 2004-201 2HUBzero Foundation, LLC10 # Copyright (c) 2004-2015 HUBzero Foundation, LLC 11 11 # 12 12 # See the file "license.terms" for information on usage and … … 230 230 }] 231 231 232 itk_component add 3dview {232 itk_component add view { 233 233 label $itk_component(plotarea).view -image $_image(plot) \ 234 234 -highlightthickness 0 -borderwidth 0 … … 237 237 ignore -highlightthickness -borderwidth -background 238 238 } 239 bind $itk_component( 3dview) <Control-F1> [itcl::code $this ToggleConsole]239 bind $itk_component(view) <Control-F1> [itcl::code $this ToggleConsole] 240 240 241 241 set f [$itk_component(main) component controls] … … 312 312 BuildSettingsTab 313 313 314 # HACK ALERT. Initially force a requested width of the 3dview label.315 316 # It's a chicken-and-the-egg problem. The size of the 3dview label is set314 # HACK ALERT. Initially force a requested width of the view label. 315 316 # It's a chicken-and-the-egg problem. The size of the view label is set 317 317 # from the size of the image retrieved from the server. But the size of 318 318 # the image is specified by the viewport which is the size of the label. … … 324 324 # (that's why we're using the blt::table to manage the geometry). It has 325 325 # to be big, because we don't know how big the user may want to stretch 326 # the window. This at least forces the sidebarframe to give the 3dview326 # the window. This at least forces the sidebarframe to give the view 327 327 # the maximum size available, which is perfect for an initially closed 328 328 # sidebar. 329 329 330 330 blt::table $itk_component(plotarea) \ 331 0,0 $itk_component( 3dview) -fill both -reqwidth 10000331 0,0 $itk_component(view) -fill both -reqwidth 10000 332 332 # 333 333 # RENDERING AREA … … 338 338 if { $_useVmouseEvents } { 339 339 # set up bindings to bridge mouse events to server 340 bind $itk_component( 3dview) <ButtonPress> \340 bind $itk_component(view) <ButtonPress> \ 341 341 [itcl::code $this Vmouse click %b %s %x %y] 342 bind $itk_component( 3dview) <ButtonRelease> \342 bind $itk_component(view) <ButtonRelease> \ 343 343 [itcl::code $this Vmouse release %b %s %x %y] 344 bind $itk_component( 3dview) <B1-Motion> \344 bind $itk_component(view) <B1-Motion> \ 345 345 [itcl::code $this Vmouse drag 1 %s %x %y] 346 bind $itk_component( 3dview) <B2-Motion> \346 bind $itk_component(view) <B2-Motion> \ 347 347 [itcl::code $this Vmouse drag 2 %s %x %y] 348 bind $itk_component( 3dview) <B3-Motion> \348 bind $itk_component(view) <B3-Motion> \ 349 349 [itcl::code $this Vmouse drag 3 %s %x %y] 350 bind $itk_component( 3dview) <Motion> \350 bind $itk_component(view) <Motion> \ 351 351 [itcl::code $this Vmouse move 0 %s %x %y] 352 352 } else { 353 353 # set up bindings for rotation with mouse 354 bind $itk_component( 3dview) <ButtonPress-1> \354 bind $itk_component(view) <ButtonPress-1> \ 355 355 [itcl::code $this Rotate click %x %y] 356 bind $itk_component( 3dview) <B1-Motion> \356 bind $itk_component(view) <B1-Motion> \ 357 357 [itcl::code $this Rotate drag %x %y] 358 bind $itk_component( 3dview) <ButtonRelease-1> \358 bind $itk_component(view) <ButtonRelease-1> \ 359 359 [itcl::code $this Rotate release %x %y] 360 360 361 361 # set up bindings for panning with mouse 362 bind $itk_component( 3dview) <ButtonPress-2> \362 bind $itk_component(view) <ButtonPress-2> \ 363 363 [itcl::code $this Pan click %x %y] 364 bind $itk_component( 3dview) <B2-Motion> \364 bind $itk_component(view) <B2-Motion> \ 365 365 [itcl::code $this Pan drag %x %y] 366 bind $itk_component( 3dview) <ButtonRelease-2> \366 bind $itk_component(view) <ButtonRelease-2> \ 367 367 [itcl::code $this Pan release %x %y] 368 368 369 369 # scroll wheel zoom 370 370 if {[string equal "x11" [tk windowingsystem]]} { 371 bind $itk_component( 3dview) <4> [itcl::code $this Zoom out 2]372 bind $itk_component( 3dview) <5> [itcl::code $this Zoom in 2]371 bind $itk_component(view) <4> [itcl::code $this Zoom out 2] 372 bind $itk_component(view) <5> [itcl::code $this Zoom in 2] 373 373 } 374 374 } 375 375 376 376 # Set up bindings for panning with keyboard 377 bind $itk_component( 3dview) <KeyPress-Left> \377 bind $itk_component(view) <KeyPress-Left> \ 378 378 [itcl::code $this Pan set -10 0] 379 bind $itk_component( 3dview) <KeyPress-Right> \379 bind $itk_component(view) <KeyPress-Right> \ 380 380 [itcl::code $this Pan set 10 0] 381 bind $itk_component( 3dview) <KeyPress-Up> \381 bind $itk_component(view) <KeyPress-Up> \ 382 382 [itcl::code $this Pan set 0 -10] 383 bind $itk_component( 3dview) <KeyPress-Down> \383 bind $itk_component(view) <KeyPress-Down> \ 384 384 [itcl::code $this Pan set 0 10] 385 bind $itk_component( 3dview) <Shift-KeyPress-Left> \385 bind $itk_component(view) <Shift-KeyPress-Left> \ 386 386 [itcl::code $this Pan set -50 0] 387 bind $itk_component( 3dview) <Shift-KeyPress-Right> \387 bind $itk_component(view) <Shift-KeyPress-Right> \ 388 388 [itcl::code $this Pan set 50 0] 389 bind $itk_component( 3dview) <Shift-KeyPress-Up> \389 bind $itk_component(view) <Shift-KeyPress-Up> \ 390 390 [itcl::code $this Pan set 0 -50] 391 bind $itk_component( 3dview) <Shift-KeyPress-Down> \391 bind $itk_component(view) <Shift-KeyPress-Down> \ 392 392 [itcl::code $this Pan set 0 50] 393 393 394 394 # Set up bindings for zoom with keyboard 395 bind $itk_component( 3dview) <KeyPress-Prior> \395 bind $itk_component(view) <KeyPress-Prior> \ 396 396 [itcl::code $this Zoom out 2] 397 bind $itk_component( 3dview) <KeyPress-Next> \397 bind $itk_component(view) <KeyPress-Next> \ 398 398 [itcl::code $this Zoom in 2] 399 399 400 bind $itk_component( 3dview) <Enter> "focus $itk_component(3dview)"401 402 bind $itk_component( 3dview) <Configure> \400 bind $itk_component(view) <Enter> "focus $itk_component(view)" 401 402 bind $itk_component(view) <Configure> \ 403 403 [itcl::code $this EventuallyResize %w %h] 404 bind $itk_component( 3dview) <Unmap> \404 bind $itk_component(view) <Unmap> \ 405 405 [itcl::code $this Unmap] 406 bind $itk_component( 3dview) <Map> \406 bind $itk_component(view) <Map> \ 407 407 [itcl::code $this Map] 408 408 … … 1106 1106 # Set or restore viewing parameters. We do this for the first 1107 1107 # model and assume this works for everything else. 1108 set w [winfo width $itk_component( 3dview)]1109 set h [winfo height $itk_component( 3dview)]1108 set w [winfo width $itk_component(view)] 1109 set h [winfo height $itk_component(view)] 1110 1110 SendCmd "reset" 1111 1111 SendCmd "screen $w $h" … … 1240 1240 } 1241 1241 if { $option == "click" } { 1242 $itk_component( 3dview) configure -cursor hand11242 $itk_component(view) configure -cursor hand1 1243 1243 } 1244 1244 if { $option == "drag" || $option == "release" } { … … 1253 1253 set _mevent(y) $y 1254 1254 if { $option == "release" } { 1255 $itk_component( 3dview) configure -cursor ""1255 $itk_component(view) configure -cursor "" 1256 1256 } 1257 1257 } … … 1307 1307 unset _rocker(afterid) 1308 1308 } 1309 if { ![winfo viewable $itk_component( 3dview)] } {1309 if { ![winfo viewable $itk_component(view)] } { 1310 1310 return 1311 1311 } … … 1379 1379 } 1380 1380 if { $option == "click" } { 1381 $itk_component( 3dview) configure -cursor fleur1381 $itk_component(view) configure -cursor fleur 1382 1382 } 1383 1383 if { $option == "drag" || $option == "release" } { … … 1388 1388 return 1389 1389 } 1390 set w [winfo width $itk_component( 3dview)]1391 set h [winfo height $itk_component( 3dview)]1390 set w [winfo width $itk_component(view)] 1391 set h [winfo height $itk_component(view)] 1392 1392 if {$w <= 0 || $h <= 0} { 1393 1393 return … … 1430 1430 set _mevent(time) $now 1431 1431 if { $option == "release" } { 1432 $itk_component( 3dview) configure -cursor ""1432 $itk_component(view) configure -cursor "" 1433 1433 } 1434 1434 } … … 1452 1452 switch -- $option { 1453 1453 click { 1454 $itk_component( 3dview) configure -cursor fleur1454 $itk_component(view) configure -cursor fleur 1455 1455 set _click(x) $x 1456 1456 set _click(y) $y … … 1462 1462 Rotate.old click $x $y 1463 1463 } else { 1464 set w [winfo width $itk_component( 3dview)]1465 set h [winfo height $itk_component( 3dview)]1464 set w [winfo width $itk_component(view)] 1465 set h [winfo height $itk_component(view)] 1466 1466 if {$w <= 0 || $h <= 0} { 1467 1467 return … … 1528 1528 release { 1529 1529 Rotate.old drag $x $y 1530 $itk_component( 3dview) configure -cursor ""1530 $itk_component(view) configure -cursor "" 1531 1531 catch {unset _click} 1532 1532 } -
trunk/gui/scripts/nanovisviewer.tcl
r5645 r5729 8 8 # ====================================================================== 9 9 # AUTHOR: Michael McLennan, Purdue University 10 # Copyright (c) 2004-201 2HUBzero Foundation, LLC10 # Copyright (c) 2004-2015 HUBzero Foundation, LLC 11 11 # 12 12 # See the file "license.terms" for information on usage and … … 158 158 set _serverType "nanovis" 159 159 160 # Draw legend event 160 #DebugOn 161 EnableWaitDialog 900 162 163 # Rebuild event 164 $_dispatcher register !rebuild 165 $_dispatcher dispatch $this !rebuild "[itcl::code $this Rebuild]; list" 166 167 # Resize event 168 $_dispatcher register !resize 169 $_dispatcher dispatch $this !resize "[itcl::code $this DoResize]; list" 170 171 # Legend event 161 172 $_dispatcher register !legend 162 173 $_dispatcher dispatch $this !legend "[itcl::code $this FixLegend]; list" … … 166 177 $_dispatcher dispatch $this !send_transfunc \ 167 178 "[itcl::code $this SendTransferFunctions]; list" 168 169 # Rebuild event170 $_dispatcher register !rebuild171 $_dispatcher dispatch $this !rebuild "[itcl::code $this Rebuild]; list"172 173 # Resize event174 $_dispatcher register !resize175 $_dispatcher dispatch $this !resize "[itcl::code $this DoResize]; list"176 179 177 180 # … … 184 187 # Initialize the view to some default parameters. 185 188 array set _view { 186 -qw 0.853553187 -qx -0.353553188 -qy 0.353553189 -qz 0.146447190 -xpan 0191 -ypan 0192 -zoom 1.0189 -qw 0.853553 190 -qx -0.353553 191 -qy 0.353553 192 -qz 0.146447 193 -xpan 0 194 -ypan 0 195 -zoom 1.0 193 196 } 194 197 set _arcball [blt::arcball create 100 100] 195 198 $_arcball quaternion [ViewToQuaternion] 196 197 set _reset 1198 199 199 200 array set _settings [subst { … … 230 231 }] 231 232 232 itk_component add 3dview {233 itk_component add view { 233 234 label $itk_component(plotarea).view -image $_image(plot) \ 234 235 -highlightthickness 0 -borderwidth 0 … … 237 238 ignore -highlightthickness -borderwidth -background 238 239 } 239 bind $itk_component( 3dview) <Control-F1> [itcl::code $this ToggleConsole]240 bind $itk_component(view) <Control-F1> [itcl::code $this ToggleConsole] 240 241 241 242 set f [$itk_component(main) component controls] … … 281 282 -onimage [Rappture::icon volume-on] \ 282 283 -offimage [Rappture::icon volume-off] \ 283 - command [itcl::code $this AdjustSetting -volume] \284 - variable [itcl::scope _settings(-volume)]284 -variable [itcl::scope _settings(-volume)] \ 285 -command [itcl::code $this AdjustSetting -volume] 285 286 } 286 287 $itk_component(volume) select … … 330 331 # the server. So the panewindow uses the tiny size. 331 332 set w 10000 332 pack forget $itk_component( 3dview)333 pack forget $itk_component(view) 333 334 blt::table $itk_component(plotarea) \ 334 0,0 $itk_component( 3dview) -fill both -reqwidth $w \335 0,0 $itk_component(view) -fill both -reqwidth $w \ 335 336 1,0 $itk_component(legend) -fill x 336 337 blt::table configure $itk_component(plotarea) r1 -resize none 337 338 338 339 # Bindings for rotation via mouse 339 bind $itk_component( 3dview) <ButtonPress-1> \340 bind $itk_component(view) <ButtonPress-1> \ 340 341 [itcl::code $this Rotate click %x %y] 341 bind $itk_component( 3dview) <B1-Motion> \342 bind $itk_component(view) <B1-Motion> \ 342 343 [itcl::code $this Rotate drag %x %y] 343 bind $itk_component( 3dview) <ButtonRelease-1> \344 bind $itk_component(view) <ButtonRelease-1> \ 344 345 [itcl::code $this Rotate release %x %y] 345 346 346 bind $itk_component( 3dview) <Configure> \347 bind $itk_component(view) <Configure> \ 347 348 [itcl::code $this EventuallyResize %w %h] 348 349 349 350 # Bindings for panning via mouse 350 bind $itk_component( 3dview) <ButtonPress-2> \351 bind $itk_component(view) <ButtonPress-2> \ 351 352 [itcl::code $this Pan click %x %y] 352 bind $itk_component( 3dview) <B2-Motion> \353 bind $itk_component(view) <B2-Motion> \ 353 354 [itcl::code $this Pan drag %x %y] 354 bind $itk_component( 3dview) <ButtonRelease-2> \355 bind $itk_component(view) <ButtonRelease-2> \ 355 356 [itcl::code $this Pan release %x %y] 356 357 357 358 # Bindings for panning via keyboard 358 bind $itk_component( 3dview) <KeyPress-Left> \359 bind $itk_component(view) <KeyPress-Left> \ 359 360 [itcl::code $this Pan set -10 0] 360 bind $itk_component( 3dview) <KeyPress-Right> \361 bind $itk_component(view) <KeyPress-Right> \ 361 362 [itcl::code $this Pan set 10 0] 362 bind $itk_component( 3dview) <KeyPress-Up> \363 bind $itk_component(view) <KeyPress-Up> \ 363 364 [itcl::code $this Pan set 0 -10] 364 bind $itk_component( 3dview) <KeyPress-Down> \365 bind $itk_component(view) <KeyPress-Down> \ 365 366 [itcl::code $this Pan set 0 10] 366 bind $itk_component( 3dview) <Shift-KeyPress-Left> \367 bind $itk_component(view) <Shift-KeyPress-Left> \ 367 368 [itcl::code $this Pan set -2 0] 368 bind $itk_component( 3dview) <Shift-KeyPress-Right> \369 bind $itk_component(view) <Shift-KeyPress-Right> \ 369 370 [itcl::code $this Pan set 2 0] 370 bind $itk_component( 3dview) <Shift-KeyPress-Up> \371 bind $itk_component(view) <Shift-KeyPress-Up> \ 371 372 [itcl::code $this Pan set 0 -2] 372 bind $itk_component( 3dview) <Shift-KeyPress-Down> \373 bind $itk_component(view) <Shift-KeyPress-Down> \ 373 374 [itcl::code $this Pan set 0 2] 374 375 375 376 # Bindings for zoom via keyboard 376 bind $itk_component( 3dview) <KeyPress-Prior> \377 bind $itk_component(view) <KeyPress-Prior> \ 377 378 [itcl::code $this Zoom out] 378 bind $itk_component( 3dview) <KeyPress-Next> \379 bind $itk_component(view) <KeyPress-Next> \ 379 380 [itcl::code $this Zoom in] 380 381 381 bind $itk_component( 3dview) <Enter> "focus $itk_component(3dview)"382 bind $itk_component(view) <Enter> "focus $itk_component(view)" 382 383 383 384 if {[string equal "x11" [tk windowingsystem]]} { 384 385 # Bindings for zoom via mouse 385 bind $itk_component( 3dview) <4> [itcl::code $this Zoom out]386 bind $itk_component( 3dview) <5> [itcl::code $this Zoom in]386 bind $itk_component(view) <4> [itcl::code $this Zoom out] 387 bind $itk_component(view) <5> [itcl::code $this Zoom in] 387 388 } 388 389 … … 390 391 391 392 eval itk_initialize $args 392 393 EnableWaitDialog 900394 393 Connect 395 394 } … … 450 449 # ---------------------------------------------------------------------- 451 450 # USAGE: get ?-objects? 452 # USAGE: get ?-image 3dview|legend?451 # USAGE: get ?-image view|legend? 453 452 # 454 453 # Clients use this to query the list of objects being plotted, in … … 480 479 -image { 481 480 if {[llength $args] != 2} { 482 error "wrong # args: should be \"get -image 3dview|legend\""481 error "wrong # args: should be \"get -image view|legend\"" 483 482 } 484 483 switch -- [lindex $args end] { 485 3dview {484 view { 486 485 return $_image(plot) 487 486 } … … 490 489 } 491 490 default { 492 error "bad image name \"[lindex $args end]\": should be 3dview or legend"491 error "bad image name \"[lindex $args end]\": should be view or legend" 493 492 } 494 493 } … … 503 502 # USAGE: delete ?<dataobj1> <dataobj2> ...? 504 503 # 505 # Clients use this to delete a dataobj from the plot. If no dataobjs 506 # are specified, then all dataobjs are deleted. No data objects are 507 # deleted. They are only removed from the display list. 508 # 504 # Clients use this to delete a dataobj from the plot. If no dataobjs 505 # are specified, then all dataobjs are deleted. No data objects are 506 # deleted. They are only removed from the display list. 509 507 # ---------------------------------------------------------------------- 510 508 itcl::body Rappture::NanovisViewer::delete {args} { … … 682 680 } 683 681 684 set w [winfo width $itk_component( 3dview)]685 set h [winfo height $itk_component( 3dview)]682 set w [winfo width $itk_component(view)] 683 set h [winfo height $itk_component(view)] 686 684 EventuallyResize $w $h 687 685 } … … 692 690 # isconnected -- 693 691 # 694 # 692 # Indicates if we are currently connected to the visualization server. 695 693 # 696 694 itcl::body Rappture::NanovisViewer::isconnected {} { … … 708 706 # Disconnect -- 709 707 # 710 # Clients use this method to disconnect from the current rendering 711 # server. 708 # Clients use this method to disconnect from the current rendering server. 712 709 # 713 710 itcl::body Rappture::NanovisViewer::Disconnect {} { … … 809 806 # ReceiveLegend -- 810 807 # 811 # 812 # 813 # 814 # 815 # 808 # The procedure is the response from the render server to each "legend" 809 # command. The server sends back a "legend" command invoked our 810 # the slave interpreter. The purpose is to collect data of the image 811 # representing the legend in the canvas. In addition, the 812 # active transfer function is displayed. 816 813 # 817 814 itcl::body Rappture::NanovisViewer::ReceiveLegend { cname vmin vmax size } { … … 829 826 # ReceiveData -- 830 827 # 831 # 832 # 833 # 834 # 835 # 828 # The procedure is the response from the render server to each "data 829 # follows" command. The server sends back a "data" command invoked our 830 # the slave interpreter. The purpose was to collect the min/max of the 831 # volume sent to the render server. This is no longer needed since we 832 # already know the limits. 836 833 # 837 834 itcl::body Rappture::NanovisViewer::ReceiveData { args } { … … 855 852 # ---------------------------------------------------------------------- 856 853 itcl::body Rappture::NanovisViewer::Rebuild {} { 857 set w [winfo width $itk_component( 3dview)]858 set h [winfo height $itk_component( 3dview)]854 set w [winfo width $itk_component(view)] 855 set h [winfo height $itk_component(view)] 859 856 if { $w < 2 || $h < 2 } { 860 857 update … … 961 958 PanCamera 962 959 SendCmd "camera zoom $_view(-zoom)" 960 set _reset 0 963 961 } 964 962 … … 973 971 StopBufferingCommands 974 972 blt::busy release $itk_component(hull) 975 set _reset 0976 973 } 977 974 … … 1071 1068 switch -- $option { 1072 1069 click { 1073 $itk_component( 3dview) configure -cursor fleur1070 $itk_component(view) configure -cursor fleur 1074 1071 set _click(x) $x 1075 1072 set _click(y) $y … … 1079 1076 Rotate click $x $y 1080 1077 } else { 1081 set w [winfo width $itk_component( 3dview)]1082 set h [winfo height $itk_component( 3dview)]1078 set w [winfo width $itk_component(view)] 1079 set h [winfo height $itk_component(view)] 1083 1080 if {$w <= 0 || $h <= 0} { 1084 1081 return … … 1107 1104 release { 1108 1105 Rotate drag $x $y 1109 $itk_component( 3dview) configure -cursor ""1106 $itk_component(view) configure -cursor "" 1110 1107 catch {unset _click} 1111 1108 } … … 1126 1123 itcl::body Rappture::NanovisViewer::Pan {option x y} { 1127 1124 # Experimental stuff 1128 set w [winfo width $itk_component( 3dview)]1129 set h [winfo height $itk_component( 3dview)]1125 set w [winfo width $itk_component(view)] 1126 set h [winfo height $itk_component(view)] 1130 1127 if { $option == "set" } { 1131 1128 set x [expr $x / double($w)] … … 1141 1138 set _click(x) $x 1142 1139 set _click(y) $y 1143 $itk_component( 3dview) configure -cursor hand11140 $itk_component(view) configure -cursor hand1 1144 1141 } 1145 1142 if { $option == "drag" || $option == "release" } { … … 1155 1152 } 1156 1153 if { $option == "release" } { 1157 $itk_component( 3dview) configure -cursor ""1154 $itk_component(view) configure -cursor "" 1158 1155 } 1159 1156 } … … 1248 1245 if { $_settings($what) } { 1249 1246 blt::table $itk_component(plotarea) \ 1250 0,0 $itk_component( 3dview) -fill both \1247 0,0 $itk_component(view) -fill both \ 1251 1248 1,0 $itk_component(legend) -fill x 1252 1249 blt::table configure $itk_component(plotarea) r1 -resize none … … 1368 1365 # NameTransferFunction -- 1369 1366 # 1370 # 1371 # 1372 # 1373 # 1374 # 1367 # Creates a transfer function name based on the <style> settings in the 1368 # library run.xml file. This placeholder will be used later to create 1369 # and send the actual transfer function once the data info has been sent 1370 # to us by the render server. [We won't know the volume limits until the 1371 # server parses the 3D data and sends back the limits via ReceiveData.] 1375 1372 # 1376 1373 itcl::body Rappture::NanovisViewer::NameTransferFunction { dataobj cname } { … … 1403 1400 # ComputeTransferFunction -- 1404 1401 # 1405 # 1406 # 1407 # 1408 # 1409 # 1402 # Computes and sends the transfer function to the render server. It's 1403 # assumed that the volume data limits are known and that the global 1404 # transfer-functions slider values have been set up. Both parts are 1405 # needed to compute the relative value (location) of the marker, and 1406 # the alpha map of the transfer function. 1410 1407 # 1411 1408 itcl::body Rappture::NanovisViewer::ComputeTransferFunction { cname } { … … 2089 2086 # InitComponentSettings -- 2090 2087 # 2091 # 2092 # 2093 # 2088 # Initializes the volume settings for a specific component. This should 2089 # match what's used as global settings above. This is called the first 2090 # time we try to switch to a given component in SwitchComponent below. 2094 2091 # 2095 2092 itcl::body Rappture::NanovisViewer::InitComponentSettings { cname } { … … 2112 2109 # SwitchComponent -- 2113 2110 # 2114 # 2115 # 2116 # 2111 # This is called when the current component is changed by the dropdown 2112 # menu in the volume tab. It synchronizes the global volume settings 2113 # with the settings of the new current component. 2117 2114 # 2118 2115 itcl::body Rappture::NanovisViewer::SwitchComponent { cname } { … … 2137 2134 # BuildVolumeComponents -- 2138 2135 # 2139 # 2140 # 2141 # 2142 # 2143 # 2144 # 2136 # This is called from the "scale" method which is called when a new 2137 # dataset is added or deleted. It repopulates the dropdown menu of 2138 # volume component names. It sets the current component to the first 2139 # component in the list (of components found). Finally, if there is 2140 # only one component, don't display the label or the combobox in the 2141 # volume settings tab. 2145 2142 # 2146 2143 itcl::body Rappture::NanovisViewer::BuildVolumeComponents {} { … … 2168 2165 # GetDatasetsWithComponents -- 2169 2166 # 2170 # 2171 # 2172 # 2173 # 2167 # Returns a list of all the datasets (known by the combination of their 2168 # data object and component name) that match the given component name. 2169 # For example, this is used where we want to change the settings of 2170 # volumes that have the current component. 2174 2171 # 2175 2172 itcl::body Rappture::NanovisViewer::GetDatasetsWithComponent { cname } { … … 2190 2187 # HideAllMarkers -- 2191 2188 # 2192 # 2193 # 2194 # 2189 # Hide all the markers in all the transfer functions. Can't simply 2190 # delete and recreate markers from the <style> since the user may have 2191 # created, deleted, or moved markers. 2195 2192 # 2196 2193 itcl::body Rappture::NanovisViewer::HideAllMarkers {} { -
trunk/gui/scripts/vtkvolumeviewer.tcl
r5727 r5729 568 568 # USAGE: delete ?<dataobj1> <dataobj2> ...? 569 569 # 570 # Clients use this to delete a dataobj from the plot. If no dataobjs 571 # are specified, then all dataobjs are deleted. No data objects are 572 # deleted. They are only removed from the display list. 573 # 570 # Clients use this to delete a dataobj from the plot. If no dataobjs 571 # are specified, then all dataobjs are deleted. No data objects are 572 # deleted. They are only removed from the display list. 574 573 # ---------------------------------------------------------------------- 575 574 itcl::body Rappture::VtkVolumeViewer::delete {args} { … … 853 852 # isconnected -- 854 853 # 855 # 854 # Indicates if we are currently connected to the visualization server. 856 855 # 857 856 itcl::body Rappture::VtkVolumeViewer::isconnected {} { … … 870 869 # Disconnect -- 871 870 # 872 # Clients use this method to disconnect from the current rendering 873 # server. 871 # Clients use this method to disconnect from the current rendering server. 874 872 # 875 873 itcl::body Rappture::VtkVolumeViewer::Disconnect {} { … … 1359 1357 # AdjustSetting -- 1360 1358 # 1361 # 1362 # 1363 # 1359 # Changes/updates a specific setting in the widget. There are 1360 # usually user-setable option. Commands are sent to the render 1361 # server. 1364 1362 # 1365 1363 itcl::body Rappture::VtkVolumeViewer::AdjustSetting {what {value ""}} { … … 1611 1609 # RequestLegend -- 1612 1610 # 1613 # 1614 # 1611 # Request a new legend from the server. The size of the legend 1612 # is determined from the height of the canvas. 1615 1613 # 1616 1614 itcl::body Rappture::VtkVolumeViewer::RequestLegend {} { … … 2537 2535 # SetInitialTransferFunction -- 2538 2536 # 2539 # 2540 # 2541 # 2542 # 2543 # 2537 # Creates a transfer function name based on the <style> settings in the 2538 # library run.xml file. This placeholder will be used later to create 2539 # and send the actual transfer function once the data info has been sent 2540 # to us by the render server. [We won't know the volume limits until the 2541 # server parses the 3D data and sends back the limits via ReceiveData.] 2544 2542 # 2545 2543 itcl::body Rappture::VtkVolumeViewer::SetInitialTransferFunction { dataobj cname } { … … 2556 2554 # ComputeTransferFunction -- 2557 2555 # 2558 # 2559 # 2560 # 2561 # 2562 # 2556 # Computes and sends the transfer function to the render server. It's 2557 # assumed that the volume data limits are known and that the global 2558 # transfer-functions slider values have been set up. Both parts are 2559 # needed to compute the relative value (location) of the marker, and 2560 # the alpha map of the transfer function. 2563 2561 # 2564 2562 itcl::body Rappture::VtkVolumeViewer::ComputeTransferFunction { cname } { … … 2628 2626 # ResetColormap -- 2629 2627 # 2630 # 2628 # Changes only the colormap portion of the transfer function. 2631 2629 # 2632 2630 itcl::body Rappture::VtkVolumeViewer::ResetColormap { cname color } { … … 2647 2645 # USAGE: updateTransferFunctions 2648 2646 # 2649 # This is called by the transfer function editor whenever the 2650 # transfer function definition changes. 2651 # 2647 # This is called by the transfer function editor whenever the 2648 # transfer function definition changes. 2652 2649 # ---------------------------------------------------------------------- 2653 2650 itcl::body Rappture::VtkVolumeViewer::updateTransferFunctions {} { … … 2698 2695 # InitComponentSettings -- 2699 2696 # 2700 # 2701 # 2702 # 2703 # 2697 # Initializes the volume settings for a specific component. This 2698 # should match what's used as global settings above. This 2699 # is called the first time we try to switch to a given component 2700 # in SwitchComponent below. 2704 2701 # 2705 2702 itcl::body Rappture::VtkVolumeViewer::InitComponentSettings { cname } { … … 2724 2721 # SwitchComponent -- 2725 2722 # 2726 # 2727 # 2728 # 2723 # This is called when the current component is changed by the 2724 # dropdown menu in the volume tab. It synchronizes the global 2725 # volume settings with the settings of the new current component. 2729 2726 # 2730 2727 itcl::body Rappture::VtkVolumeViewer::SwitchComponent { cname } { … … 2821 2818 # HideAllMarkers -- 2822 2819 # 2823 # 2824 # 2825 # 2820 # Hide all the markers in all the transfer functions. Can't simply 2821 # delete and recreate markers from the <style> since the user may 2822 # have create, deleted, or moved markers. 2826 2823 # 2827 2824 itcl::body Rappture::VtkVolumeViewer::HideAllMarkers {} { … … 2834 2831 # GetDatasetsWithComponent -- 2835 2832 # 2836 # 2837 # 2838 # 2839 # 2833 # Returns a list of all the datasets (known by the combination of 2834 # their data object and component name) that match the given 2835 # component name. For example, this is used where we want to change 2836 # the settings of volumes that have the current component. 2840 2837 # 2841 2838 itcl::body Rappture::VtkVolumeViewer::GetDatasetsWithComponent { cname } { … … 2849 2846 # BuildVolumeComponents -- 2850 2847 # 2851 # 2852 # 2853 # 2854 # 2855 # 2856 # 2848 # This is called from the "scale" method which is called when a 2849 # new dataset is added or deleted. It repopulates the dropdown 2850 # menu of volume component names. It sets the current component 2851 # to the first component in the list (of components found). 2852 # Finally, if there is only one component, don't display the 2853 # label or the combobox in the volume settings tab. 2857 2854 # 2858 2855 itcl::body Rappture::VtkVolumeViewer::BuildVolumeComponents {} {
Note: See TracChangeset
for help on using the changeset viewer.