Changeset 5798
- Timestamp:
- Aug 3, 2015 1:40:43 AM (9 years ago)
- Location:
- branches/1.3
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/1.3
-
branches/1.3/gui/scripts/flowvisviewer.tcl
r5638 r5798 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 … … 172 172 set _serverType "nanovis" 173 173 174 # Draw legend event 174 #DebugOn 175 EnableWaitDialog 900 176 177 # Rebuild event 178 $_dispatcher register !rebuild 179 $_dispatcher dispatch $this !rebuild "[itcl::code $this Rebuild]; list" 180 181 # Resize event 182 $_dispatcher register !resize 183 $_dispatcher dispatch $this !resize "[itcl::code $this DoResize]; list" 184 185 # Legend event 175 186 $_dispatcher register !legend 176 187 $_dispatcher dispatch $this !legend "[itcl::code $this FixLegend]; list" … … 180 191 $_dispatcher dispatch $this !send_transfunc \ 181 192 "[itcl::code $this SendTransferFunctions]; list" 182 183 # Rebuild event184 $_dispatcher register !rebuild185 $_dispatcher dispatch $this !rebuild "[itcl::code $this Rebuild]; list"186 187 # Resize event188 $_dispatcher register !resize189 $_dispatcher dispatch $this !resize "[itcl::code $this DoResize]; list"190 193 191 194 $_dispatcher register !play … … 212 215 # Initialize the view to some default parameters. 213 216 array set _view { 214 -qw 0.853553215 -qx -0.353553216 -qy 0.353553217 -qz 0.146447218 -xpan 0219 -ypan 0220 -zoom 1.0217 -qw 0.853553 218 -qx -0.353553 219 -qy 0.353553 220 -qz 0.146447 221 -xpan 0 222 -ypan 0 223 -zoom 1.0 221 224 } 222 225 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 } … … 626 628 # ---------------------------------------------------------------------- 627 629 # USAGE: get ?-objects? 628 # USAGE: get ?-image 3dview|legend?630 # USAGE: get ?-image view|legend? 629 631 # 630 632 # Clients use this to query the list of objects being plotted, in … … 656 658 -image { 657 659 if {[llength $args] != 2} { 658 error "wrong # args: should be \"get -image 3dview|legend\""660 error "wrong # args: should be \"get -image view|legend\"" 659 661 } 660 662 switch -- [lindex $args end] { 661 3dview {663 view { 662 664 return $_image(plot) 663 665 } … … 666 668 } 667 669 default { 668 error "bad image name \"[lindex $args end]\": should be 3dview or legend"670 error "bad image name \"[lindex $args end]\": should be view or legend" 669 671 } 670 672 } … … 679 681 # USAGE: delete ?<dataobj1> <dataobj2> ...? 680 682 # 681 # Clients use this to delete a dataobj from the plot. If no dataobjs 682 # are specified, then all dataobjs are deleted. No data objects are 683 # deleted. They are only removed from the display list. 684 # 683 # Clients use this to delete a dataobj from the plot. If no dataobjs 684 # are specified, then all dataobjs are deleted. No data objects are 685 # deleted. They are only removed from the display list. 685 686 # ---------------------------------------------------------------------- 686 687 itcl::body Rappture::FlowvisViewer::delete {args} { … … 881 882 } 882 883 883 set w [winfo width $itk_component( 3dview)]884 set h [winfo height $itk_component( 3dview)]884 set w [winfo width $itk_component(view)] 885 set h [winfo height $itk_component(view)] 885 886 EventuallyResize $w $h 886 887 } … … 891 892 # isconnected -- 892 893 # 893 # 894 # Indicates if we are currently connected to the visualization server. 894 895 # 895 896 itcl::body Rappture::FlowvisViewer::isconnected {} { … … 907 908 # Disconnect -- 908 909 # 909 # Clients use this method to disconnect from the current rendering 910 # server. 910 # Clients use this method to disconnect from the current rendering server. 911 911 # 912 912 itcl::body Rappture::FlowvisViewer::Disconnect {} { … … 1033 1033 # ReceiveLegend -- 1034 1034 # 1035 # 1036 # 1037 # 1038 # 1039 # 1035 # The procedure is the response from the render server to each "legend" 1036 # command. The server sends back a "legend" command invoked our 1037 # the slave interpreter. The purpose is to collect data of the image 1038 # representing the legend in the canvas. In addition, the 1039 # active transfer function is displayed. 1040 1040 # 1041 1041 itcl::body Rappture::FlowvisViewer::ReceiveLegend { tag vmin vmax size } { … … 1053 1053 # ReceiveData -- 1054 1054 # 1055 # 1056 # 1057 # 1058 # 1059 # 1060 # 1061 # 1062 # 1055 # The procedure is the response from the render server to each "data 1056 # follows" command. The server sends back a "data" command invoked our 1057 # the slave interpreter. The purpose is to collect the min/max of the 1058 # volume sent to the render server. Since the client (flowvisviewer) 1059 # doesn't parse 3D data formats, we rely on the server (nanovis) to 1060 # tell us what the limits are. Once we've received the limits to all 1061 # the data we've sent (tracked by _recvdDatasets) we can then determine 1062 # what the transfer functions are for these volumes. 1063 1063 # 1064 1064 # … … 1104 1104 # ---------------------------------------------------------------------- 1105 1105 itcl::body Rappture::FlowvisViewer::Rebuild {} { 1106 set w [winfo width $itk_component( 3dview)]1107 set h [winfo height $itk_component( 3dview)]1106 set w [winfo width $itk_component(view)] 1107 set h [winfo height $itk_component(view)] 1108 1108 if { $w < 2 || $h < 2 } { 1109 1109 update … … 1215 1215 NameTransferFunction $dataobj $cname 1216 1216 } 1217 set _reset 0 1217 1218 } 1218 1219 … … 1246 1247 StopBufferingCommands 1247 1248 blt::busy release $itk_component(hull) 1248 set _reset 01249 1249 } 1250 1250 … … 1344 1344 switch -- $option { 1345 1345 click { 1346 $itk_component( 3dview) configure -cursor fleur1346 $itk_component(view) configure -cursor fleur 1347 1347 set _click(x) $x 1348 1348 set _click(y) $y … … 1352 1352 Rotate click $x $y 1353 1353 } else { 1354 set w [winfo width $itk_component( 3dview)]1355 set h [winfo height $itk_component( 3dview)]1354 set w [winfo width $itk_component(view)] 1355 set h [winfo height $itk_component(view)] 1356 1356 if {$w <= 0 || $h <= 0} { 1357 1357 return … … 1380 1380 release { 1381 1381 Rotate drag $x $y 1382 $itk_component( 3dview) configure -cursor ""1382 $itk_component(view) configure -cursor "" 1383 1383 catch {unset _click} 1384 1384 } … … 1399 1399 itcl::body Rappture::FlowvisViewer::Pan {option x y} { 1400 1400 # Experimental stuff 1401 set w [winfo width $itk_component( 3dview)]1402 set h [winfo height $itk_component( 3dview)]1401 set w [winfo width $itk_component(view)] 1402 set h [winfo height $itk_component(view)] 1403 1403 if { $option == "set" } { 1404 1404 set x [expr $x / double($w)] … … 1414 1414 set _click(x) $x 1415 1415 set _click(y) $y 1416 $itk_component( 3dview) configure -cursor hand11416 $itk_component(view) configure -cursor hand1 1417 1417 } 1418 1418 if { $option == "drag" || $option == "release" } { … … 1428 1428 } 1429 1429 if { $option == "release" } { 1430 $itk_component( 3dview) configure -cursor ""1430 $itk_component(view) configure -cursor "" 1431 1431 } 1432 1432 } … … 1501 1501 if { $_settings($what) } { 1502 1502 blt::table $itk_component(plotarea) \ 1503 0,0 $itk_component( 3dview) -fill both \1503 0,0 $itk_component(view) -fill both \ 1504 1504 1,0 $itk_component(legend) -fill x 1505 1505 blt::table configure $itk_component(plotarea) r1 -resize none … … 1616 1616 # NameTransferFunction -- 1617 1617 # 1618 # 1619 # 1620 # 1621 # 1622 # 1618 # Creates a transfer function name based on the <style> settings in the 1619 # library run.xml file. This placeholder will be used later to create 1620 # and send the actual transfer function once the data info has been sent 1621 # to us by the render server. [We won't know the volume limits until the 1622 # server parses the 3D data and sends back the limits via ReceiveData.] 1623 1623 # 1624 1624 itcl::body Rappture::FlowvisViewer::NameTransferFunction { dataobj cname } { … … 1642 1642 # ComputeTransferFunction -- 1643 1643 # 1644 # 1645 # 1646 # 1647 # 1648 # 1644 # Computes and sends the transfer function to the render server. It's 1645 # assumed that the volume data limits are known and that the global 1646 # transfer-functions slider values have been set up. Both parts are 1647 # needed to compute the relative value (location) of the marker, and 1648 # the alpha map of the transfer function. 1649 1649 # 1650 1650 itcl::body Rappture::FlowvisViewer::ComputeTransferFunction { tf } { … … 2634 2634 } 2635 2635 "next" { 2636 if { ![winfo viewable $itk_component( 3dview)] } {2636 if { ![winfo viewable $itk_component(view)] } { 2637 2637 flow stop 2638 2638 return … … 2949 2949 # BuildVolumeComponents -- 2950 2950 # 2951 # 2952 # 2953 # 2954 # 2955 # 2956 # 2951 # This is called from the "scale" method which is called when a new 2952 # dataset is added or deleted. It repopulates the dropdown menu of 2953 # volume component names. It sets the current component to the first 2954 # component in the list (of components found). Finally, if there is 2955 # only one component, don't display the label or the combobox in the 2956 # volume settings tab. 2957 2957 # 2958 2958 itcl::body Rappture::FlowvisViewer::BuildVolumeComponents {} { … … 2968 2968 # GetDatasetsWithComponents -- 2969 2969 # 2970 # 2971 # 2972 # 2973 # 2970 # Returns a list of all the datasets (known by the combination of their 2971 # data object and component name) that match the given component name. 2972 # For example, this is used where we want to change the settings of 2973 # volumes that have the current component. 2974 2974 # 2975 2975 itcl::body Rappture::FlowvisViewer::GetDatasetsWithComponent { cname } { -
branches/1.3/gui/scripts/molvisviewer.tcl
r5734 r5798 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 } -
branches/1.3/gui/scripts/nanovisviewer.tcl
r5615 r5798 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 … … 153 153 set _serverType "nanovis" 154 154 155 # Draw legend event 155 #DebugOn 156 EnableWaitDialog 900 157 158 # Rebuild event 159 $_dispatcher register !rebuild 160 $_dispatcher dispatch $this !rebuild "[itcl::code $this Rebuild]; list" 161 162 # Resize event 163 $_dispatcher register !resize 164 $_dispatcher dispatch $this !resize "[itcl::code $this DoResize]; list" 165 166 # Legend event 156 167 $_dispatcher register !legend 157 168 $_dispatcher dispatch $this !legend "[itcl::code $this FixLegend]; list" … … 161 172 $_dispatcher dispatch $this !send_transfunc \ 162 173 "[itcl::code $this SendTransferFunctions]; list" 163 164 # Rebuild event165 $_dispatcher register !rebuild166 $_dispatcher dispatch $this !rebuild "[itcl::code $this Rebuild]; list"167 168 # Resize event169 $_dispatcher register !resize170 $_dispatcher dispatch $this !resize "[itcl::code $this DoResize]; list"171 174 172 175 # … … 179 182 # Initialize the view to some default parameters. 180 183 array set _view { 181 -qw 0.853553182 -qx -0.353553183 -qy 0.353553184 -qz 0.146447185 -xpan 0186 -ypan 0187 -zoom 1.0184 -qw 0.853553 185 -qx -0.353553 186 -qy 0.353553 187 -qz 0.146447 188 -xpan 0 189 -ypan 0 190 -zoom 1.0 188 191 } 189 192 set _arcball [blt::arcball create 100 100] … … 192 195 set _limits(vmin) 0.0 193 196 set _limits(vmax) 1.0 194 set _reset 1195 197 196 198 array set _settings [subst { … … 223 225 }] 224 226 225 itk_component add 3dview {227 itk_component add view { 226 228 label $itk_component(plotarea).view -image $_image(plot) \ 227 229 -highlightthickness 0 -borderwidth 0 … … 230 232 ignore -highlightthickness -borderwidth -background 231 233 } 232 bind $itk_component( 3dview) <Control-F1> [itcl::code $this ToggleConsole]234 bind $itk_component(view) <Control-F1> [itcl::code $this ToggleConsole] 233 235 234 236 set f [$itk_component(main) component controls] … … 274 276 -onimage [Rappture::icon volume-on] \ 275 277 -offimage [Rappture::icon volume-off] \ 276 - command [itcl::code $this AdjustSetting -volume] \277 - variable [itcl::scope _settings(-volume)]278 -variable [itcl::scope _settings(-volume)] \ 279 -command [itcl::code $this AdjustSetting -volume] 278 280 } 279 281 $itk_component(volume) select … … 319 321 # the server. So the panewindow uses the tiny size. 320 322 set w 10000 321 pack forget $itk_component( 3dview)323 pack forget $itk_component(view) 322 324 blt::table $itk_component(plotarea) \ 323 0,0 $itk_component( 3dview) -fill both -reqwidth $w \325 0,0 $itk_component(view) -fill both -reqwidth $w \ 324 326 1,0 $itk_component(legend) -fill x 325 327 blt::table configure $itk_component(plotarea) r1 -resize none 326 328 327 329 # Bindings for rotation via mouse 328 bind $itk_component( 3dview) <ButtonPress-1> \330 bind $itk_component(view) <ButtonPress-1> \ 329 331 [itcl::code $this Rotate click %x %y] 330 bind $itk_component( 3dview) <B1-Motion> \332 bind $itk_component(view) <B1-Motion> \ 331 333 [itcl::code $this Rotate drag %x %y] 332 bind $itk_component( 3dview) <ButtonRelease-1> \334 bind $itk_component(view) <ButtonRelease-1> \ 333 335 [itcl::code $this Rotate release %x %y] 334 bind $itk_component( 3dview) <Configure> \336 bind $itk_component(view) <Configure> \ 335 337 [itcl::code $this EventuallyResize %w %h] 336 338 337 339 # Bindings for panning via mouse 338 bind $itk_component( 3dview) <ButtonPress-2> \340 bind $itk_component(view) <ButtonPress-2> \ 339 341 [itcl::code $this Pan click %x %y] 340 bind $itk_component( 3dview) <B2-Motion> \342 bind $itk_component(view) <B2-Motion> \ 341 343 [itcl::code $this Pan drag %x %y] 342 bind $itk_component( 3dview) <ButtonRelease-2> \344 bind $itk_component(view) <ButtonRelease-2> \ 343 345 [itcl::code $this Pan release %x %y] 344 346 345 347 # Bindings for panning via keyboard 346 bind $itk_component( 3dview) <KeyPress-Left> \348 bind $itk_component(view) <KeyPress-Left> \ 347 349 [itcl::code $this Pan set -10 0] 348 bind $itk_component( 3dview) <KeyPress-Right> \350 bind $itk_component(view) <KeyPress-Right> \ 349 351 [itcl::code $this Pan set 10 0] 350 bind $itk_component( 3dview) <KeyPress-Up> \352 bind $itk_component(view) <KeyPress-Up> \ 351 353 [itcl::code $this Pan set 0 -10] 352 bind $itk_component( 3dview) <KeyPress-Down> \354 bind $itk_component(view) <KeyPress-Down> \ 353 355 [itcl::code $this Pan set 0 10] 354 bind $itk_component( 3dview) <Shift-KeyPress-Left> \356 bind $itk_component(view) <Shift-KeyPress-Left> \ 355 357 [itcl::code $this Pan set -2 0] 356 bind $itk_component( 3dview) <Shift-KeyPress-Right> \358 bind $itk_component(view) <Shift-KeyPress-Right> \ 357 359 [itcl::code $this Pan set 2 0] 358 bind $itk_component( 3dview) <Shift-KeyPress-Up> \360 bind $itk_component(view) <Shift-KeyPress-Up> \ 359 361 [itcl::code $this Pan set 0 -2] 360 bind $itk_component( 3dview) <Shift-KeyPress-Down> \362 bind $itk_component(view) <Shift-KeyPress-Down> \ 361 363 [itcl::code $this Pan set 0 2] 362 364 363 365 # Bindings for zoom via keyboard 364 bind $itk_component( 3dview) <KeyPress-Prior> \366 bind $itk_component(view) <KeyPress-Prior> \ 365 367 [itcl::code $this Zoom out] 366 bind $itk_component( 3dview) <KeyPress-Next> \368 bind $itk_component(view) <KeyPress-Next> \ 367 369 [itcl::code $this Zoom in] 368 370 369 bind $itk_component( 3dview) <Enter> "focus $itk_component(3dview)"371 bind $itk_component(view) <Enter> "focus $itk_component(view)" 370 372 371 373 if {[string equal "x11" [tk windowingsystem]]} { 372 374 # Bindings for zoom via mouse 373 bind $itk_component( 3dview) <4> [itcl::code $this Zoom out]374 bind $itk_component( 3dview) <5> [itcl::code $this Zoom in]375 bind $itk_component(view) <4> [itcl::code $this Zoom out] 376 bind $itk_component(view) <5> [itcl::code $this Zoom in] 375 377 } 376 378 … … 378 380 379 381 eval itk_initialize $args 380 381 EnableWaitDialog 900382 382 Connect 383 383 } … … 435 435 # ---------------------------------------------------------------------- 436 436 # USAGE: get ?-objects? 437 # USAGE: get ?-image 3dview|legend?437 # USAGE: get ?-image view|legend? 438 438 # 439 439 # Clients use this to query the list of objects being plotted, in … … 465 465 -image { 466 466 if {[llength $args] != 2} { 467 error "wrong # args: should be \"get -image 3dview|legend\""467 error "wrong # args: should be \"get -image view|legend\"" 468 468 } 469 469 switch -- [lindex $args end] { 470 3dview {470 view { 471 471 return $_image(plot) 472 472 } … … 475 475 } 476 476 default { 477 error "bad image name \"[lindex $args end]\": should be 3dview or legend"477 error "bad image name \"[lindex $args end]\": should be view or legend" 478 478 } 479 479 } … … 488 488 # USAGE: delete ?<dataobj1> <dataobj2> ...? 489 489 # 490 # Clients use this to delete a dataobj from the plot. If no dataobjs 491 # are specified, then all dataobjs are deleted. No data objects are 492 # deleted. They are only removed from the display list. 493 # 490 # Clients use this to delete a dataobj from the plot. If no dataobjs 491 # are specified, then all dataobjs are deleted. No data objects are 492 # deleted. They are only removed from the display list. 494 493 # ---------------------------------------------------------------------- 495 494 itcl::body Rappture::NanovisViewer::delete {args} { … … 647 646 } 648 647 649 set w [winfo width $itk_component( 3dview)]650 set h [winfo height $itk_component( 3dview)]648 set w [winfo width $itk_component(view)] 649 set h [winfo height $itk_component(view)] 651 650 EventuallyResize $w $h 652 651 } … … 657 656 # isconnected -- 658 657 # 659 # 658 # Indicates if we are currently connected to the visualization server. 660 659 # 661 660 itcl::body Rappture::NanovisViewer::isconnected {} { … … 673 672 # Disconnect -- 674 673 # 675 # Clients use this method to disconnect from the current rendering 676 # server. 674 # Clients use this method to disconnect from the current rendering server. 677 675 # 678 676 itcl::body Rappture::NanovisViewer::Disconnect {} { … … 814 812 # ReceiveLegend -- 815 813 # 816 # 817 # 818 # 819 # 820 # 814 # The procedure is the response from the render server to each "legend" 815 # command. The server sends back a "legend" command invoked our 816 # the slave interpreter. The purpose is to collect data of the image 817 # representing the legend in the canvas. In addition, the 818 # active transfer function is displayed. 821 819 # 822 820 itcl::body Rappture::NanovisViewer::ReceiveLegend { tf vmin vmax size } { … … 834 832 # ReceiveData -- 835 833 # 836 # 837 # 838 # 839 # 840 # 841 # 842 # 843 # 834 # The procedure is the response from the render server to each "data 835 # follows" command. The server sends back a "data" command invoked our 836 # the slave interpreter. The purpose is to collect the min/max of the 837 # volume sent to the render server. Since the client (nanovisviewer) 838 # doesn't parse 3D data formats, we rely on the server (nanovis) to 839 # tell us what the limits are. Once we've received the limits to all 840 # the data we've sent (tracked by _recvdDatasets) we can then determine 841 # what the transfer functions are for these volumes. 844 842 # 845 843 # … … 893 891 # ---------------------------------------------------------------------- 894 892 itcl::body Rappture::NanovisViewer::Rebuild {} { 895 set w [winfo width $itk_component( 3dview)]896 set h [winfo height $itk_component( 3dview)]893 set w [winfo width $itk_component(view)] 894 set h [winfo height $itk_component(view)] 897 895 if { $w < 2 || $h < 2 } { 898 896 update … … 1004 1002 } 1005 1003 } 1004 set _reset 0 1006 1005 } 1007 1006 … … 1025 1024 StopBufferingCommands 1026 1025 blt::busy release $itk_component(hull) 1027 set _reset 01028 1026 } 1029 1027 … … 1123 1121 switch -- $option { 1124 1122 click { 1125 $itk_component( 3dview) configure -cursor fleur1123 $itk_component(view) configure -cursor fleur 1126 1124 set _click(x) $x 1127 1125 set _click(y) $y … … 1131 1129 Rotate click $x $y 1132 1130 } else { 1133 set w [winfo width $itk_component( 3dview)]1134 set h [winfo height $itk_component( 3dview)]1131 set w [winfo width $itk_component(view)] 1132 set h [winfo height $itk_component(view)] 1135 1133 if {$w <= 0 || $h <= 0} { 1136 1134 return … … 1159 1157 release { 1160 1158 Rotate drag $x $y 1161 $itk_component( 3dview) configure -cursor ""1159 $itk_component(view) configure -cursor "" 1162 1160 catch {unset _click} 1163 1161 } … … 1178 1176 itcl::body Rappture::NanovisViewer::Pan {option x y} { 1179 1177 # Experimental stuff 1180 set w [winfo width $itk_component( 3dview)]1181 set h [winfo height $itk_component( 3dview)]1178 set w [winfo width $itk_component(view)] 1179 set h [winfo height $itk_component(view)] 1182 1180 if { $option == "set" } { 1183 1181 set x [expr $x / double($w)] … … 1193 1191 set _click(x) $x 1194 1192 set _click(y) $y 1195 $itk_component( 3dview) configure -cursor hand11193 $itk_component(view) configure -cursor hand1 1196 1194 } 1197 1195 if { $option == "drag" || $option == "release" } { … … 1207 1205 } 1208 1206 if { $option == "release" } { 1209 $itk_component( 3dview) configure -cursor ""1207 $itk_component(view) configure -cursor "" 1210 1208 } 1211 1209 } … … 1273 1271 if { $_settings($what) } { 1274 1272 blt::table $itk_component(plotarea) \ 1275 0,0 $itk_component( 3dview) -fill both \1273 0,0 $itk_component(view) -fill both \ 1276 1274 1,0 $itk_component(legend) -fill x 1277 1275 blt::table configure $itk_component(plotarea) r1 -resize none … … 1371 1369 # NameTransferFunction -- 1372 1370 # 1373 # 1374 # 1375 # 1376 # 1377 # 1371 # Creates a transfer function name based on the <style> settings in the 1372 # library run.xml file. This placeholder will be used later to create 1373 # and send the actual transfer function once the data info has been sent 1374 # to us by the render server. [We won't know the volume limits until the 1375 # server parses the 3D data and sends back the limits via ReceiveData.] 1378 1376 # 1379 1377 # FIXME: The current way we generate transfer-function names completely … … 1398 1396 # ComputeTransferFunction -- 1399 1397 # 1400 # 1401 # 1402 # 1403 # 1404 # 1398 # Computes and sends the transfer function to the render server. It's 1399 # assumed that the volume data limits are known and that the global 1400 # transfer-functions slider values have been set up. Both parts are 1401 # needed to compute the relative value (location) of the marker, and 1402 # the alpha map of the transfer function. 1405 1403 # 1406 1404 itcl::body Rappture::NanovisViewer::ComputeTransferFunction { tf } { -
branches/1.3/gui/scripts/vtkvolumeviewer.tcl
r5774 r5798 537 537 # USAGE: delete ?<dataobj1> <dataobj2> ...? 538 538 # 539 # Clients use this to delete a dataobj from the plot. If no dataobjs 540 # are specified, then all dataobjs are deleted. No data objects are 541 # deleted. They are only removed from the display list. 542 # 539 # Clients use this to delete a dataobj from the plot. If no dataobjs 540 # are specified, then all dataobjs are deleted. No data objects are 541 # deleted. They are only removed from the display list. 543 542 # ---------------------------------------------------------------------- 544 543 itcl::body Rappture::VtkVolumeViewer::delete {args} { … … 818 817 # isconnected -- 819 818 # 820 # 819 # Indicates if we are currently connected to the visualization server. 821 820 # 822 821 itcl::body Rappture::VtkVolumeViewer::isconnected {} { … … 834 833 # Disconnect -- 835 834 # 836 # Clients use this method to disconnect from the current rendering 837 # server. 835 # Clients use this method to disconnect from the current rendering server. 838 836 # 839 837 itcl::body Rappture::VtkVolumeViewer::Disconnect {} { … … 1314 1312 # AdjustSetting -- 1315 1313 # 1316 # 1317 # 1318 # 1314 # Changes/updates a specific setting in the widget. There are 1315 # usually user-setable option. Commands are sent to the render 1316 # server. 1319 1317 # 1320 1318 itcl::body Rappture::VtkVolumeViewer::AdjustSetting {what {value ""}} { … … 1512 1510 # RequestLegend -- 1513 1511 # 1514 # 1515 # 1512 # Request a new legend from the server. The size of the legend 1513 # is determined from the height of the canvas. 1516 1514 # 1517 1515 itcl::body Rappture::VtkVolumeViewer::RequestLegend {} { … … 2409 2407 # GetDatasetsWithComponent -- 2410 2408 # 2411 # 2412 # 2413 # 2414 # 2409 # Returns a list of all the datasets (known by the combination of 2410 # their data object and component name) that match the given 2411 # component name. For example, this is used where we want to change 2412 # the settings of volumes that have the current component. 2415 2413 # 2416 2414 itcl::body Rappture::VtkVolumeViewer::GetDatasetsWithComponent { cname } {
Note: See TracChangeset
for help on using the changeset viewer.