Changeset 5732
- Timestamp:
- Jun 22, 2015 1:47:32 PM (9 years ago)
- Location:
- branches/1.4
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/1.4
-
branches/1.4/gui/scripts/flowvisviewer.tcl
r5655 r5732 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] … … 263 266 }] 264 267 265 itk_component add 3dview {268 itk_component add view { 266 269 label $itk_component(plotarea).view -image $_image(plot) \ 267 270 -highlightthickness 0 -borderwidth 0 … … 270 273 ignore -highlightthickness -borderwidth -background 271 274 } 272 bind $itk_component( 3dview) <Control-F1> [itcl::code $this ToggleConsole]275 bind $itk_component(view) <Control-F1> [itcl::code $this ToggleConsole] 273 276 274 277 set f [$itk_component(main) component controls] … … 314 317 -onimage [Rappture::icon volume-on] \ 315 318 -offimage [Rappture::icon volume-off] \ 316 - command [itcl::code $this AdjustSetting -volume] \317 - variable [itcl::scope _settings(-volume)]319 -variable [itcl::scope _settings(-volume)] \ 320 -command [itcl::code $this AdjustSetting -volume] 318 321 } 319 322 $itk_component(volume) select … … 359 362 # the server. So the panewindow uses the tiny size. 360 363 set w 10000 361 pack forget $itk_component( 3dview)364 pack forget $itk_component(view) 362 365 blt::table $itk_component(plotarea) \ 363 0,0 $itk_component( 3dview) -fill both -reqwidth $w \366 0,0 $itk_component(view) -fill both -reqwidth $w \ 364 367 1,0 $itk_component(legend) -fill x 365 368 blt::table configure $itk_component(plotarea) r1 -resize none … … 508 511 blt::table configure $itk_component(flowcontrols) r0 -pady 1 509 512 # Bindings for rotation via mouse 510 bind $itk_component( 3dview) <ButtonPress-1> \513 bind $itk_component(view) <ButtonPress-1> \ 511 514 [itcl::code $this Rotate click %x %y] 512 bind $itk_component( 3dview) <B1-Motion> \515 bind $itk_component(view) <B1-Motion> \ 513 516 [itcl::code $this Rotate drag %x %y] 514 bind $itk_component( 3dview) <ButtonRelease-1> \517 bind $itk_component(view) <ButtonRelease-1> \ 515 518 [itcl::code $this Rotate release %x %y] 516 519 517 bind $itk_component( 3dview) <Configure> \520 bind $itk_component(view) <Configure> \ 518 521 [itcl::code $this EventuallyResize %w %h] 519 522 520 523 # Bindings for panning via mouse 521 bind $itk_component( 3dview) <ButtonPress-2> \524 bind $itk_component(view) <ButtonPress-2> \ 522 525 [itcl::code $this Pan click %x %y] 523 bind $itk_component( 3dview) <B2-Motion> \526 bind $itk_component(view) <B2-Motion> \ 524 527 [itcl::code $this Pan drag %x %y] 525 bind $itk_component( 3dview) <ButtonRelease-2> \528 bind $itk_component(view) <ButtonRelease-2> \ 526 529 [itcl::code $this Pan release %x %y] 527 530 528 531 # Bindings for panning via keyboard 529 bind $itk_component( 3dview) <KeyPress-Left> \532 bind $itk_component(view) <KeyPress-Left> \ 530 533 [itcl::code $this Pan set -10 0] 531 bind $itk_component( 3dview) <KeyPress-Right> \534 bind $itk_component(view) <KeyPress-Right> \ 532 535 [itcl::code $this Pan set 10 0] 533 bind $itk_component( 3dview) <KeyPress-Up> \536 bind $itk_component(view) <KeyPress-Up> \ 534 537 [itcl::code $this Pan set 0 -10] 535 bind $itk_component( 3dview) <KeyPress-Down> \538 bind $itk_component(view) <KeyPress-Down> \ 536 539 [itcl::code $this Pan set 0 10] 537 bind $itk_component( 3dview) <Shift-KeyPress-Left> \540 bind $itk_component(view) <Shift-KeyPress-Left> \ 538 541 [itcl::code $this Pan set -2 0] 539 bind $itk_component( 3dview) <Shift-KeyPress-Right> \542 bind $itk_component(view) <Shift-KeyPress-Right> \ 540 543 [itcl::code $this Pan set 2 0] 541 bind $itk_component( 3dview) <Shift-KeyPress-Up> \544 bind $itk_component(view) <Shift-KeyPress-Up> \ 542 545 [itcl::code $this Pan set 0 -2] 543 bind $itk_component( 3dview) <Shift-KeyPress-Down> \546 bind $itk_component(view) <Shift-KeyPress-Down> \ 544 547 [itcl::code $this Pan set 0 2] 545 548 546 549 # Bindings for zoom via keyboard 547 bind $itk_component( 3dview) <KeyPress-Prior> \550 bind $itk_component(view) <KeyPress-Prior> \ 548 551 [itcl::code $this Zoom out] 549 bind $itk_component( 3dview) <KeyPress-Next> \552 bind $itk_component(view) <KeyPress-Next> \ 550 553 [itcl::code $this Zoom in] 551 554 552 bind $itk_component( 3dview) <Enter> "focus $itk_component(3dview)"555 bind $itk_component(view) <Enter> "focus $itk_component(view)" 553 556 554 557 if {[string equal "x11" [tk windowingsystem]]} { 555 558 # Bindings for zoom via mouse 556 bind $itk_component( 3dview) <4> [itcl::code $this Zoom out]557 bind $itk_component( 3dview) <5> [itcl::code $this Zoom in]559 bind $itk_component(view) <4> [itcl::code $this Zoom out] 560 bind $itk_component(view) <5> [itcl::code $this Zoom in] 558 561 } 559 562 … … 562 565 eval itk_initialize $args 563 566 564 EnableWaitDialog 900565 567 Connect 566 568 } … … 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} { … … 865 866 } 866 867 867 set w [winfo width $itk_component( 3dview)]868 set h [winfo height $itk_component( 3dview)]868 set w [winfo width $itk_component(view)] 869 set h [winfo height $itk_component(view)] 869 870 EventuallyResize $w $h 870 871 } … … 875 876 # isconnected -- 876 877 # 877 # 878 # Indicates if we are currently connected to the visualization server. 878 879 # 879 880 itcl::body Rappture::FlowvisViewer::isconnected {} { … … 891 892 # Disconnect -- 892 893 # 893 # Clients use this method to disconnect from the current rendering 894 # server. 894 # Clients use this method to disconnect from the current rendering server. 895 895 # 896 896 itcl::body Rappture::FlowvisViewer::Disconnect {} { … … 1022 1022 # ReceiveLegend -- 1023 1023 # 1024 # 1025 # 1026 # 1027 # 1028 # 1024 # The procedure is the response from the render server to each "legend" 1025 # command. The server sends back a "legend" command invoked our 1026 # the slave interpreter. The purpose is to collect data of the image 1027 # representing the legend in the canvas. In addition, the 1028 # active transfer function is displayed. 1029 1029 # 1030 1030 itcl::body Rappture::FlowvisViewer::ReceiveLegend { tag vmin vmax size } { … … 1042 1042 # ReceiveData -- 1043 1043 # 1044 # 1045 # 1046 # 1047 # 1048 # 1044 # The procedure is the response from the render server to each "data 1045 # follows" command. The server sends back a "data" command invoked our 1046 # the slave interpreter. The purpose was to collect the min/max of the 1047 # volume sent to the render server. This is no longer needed since we 1048 # already know the limits. 1049 1049 # 1050 1050 itcl::body Rappture::FlowvisViewer::ReceiveData { args } { … … 1068 1068 # ---------------------------------------------------------------------- 1069 1069 itcl::body Rappture::FlowvisViewer::Rebuild {} { 1070 set w [winfo width $itk_component( 3dview)]1071 set h [winfo height $itk_component( 3dview)]1070 set w [winfo width $itk_component(view)] 1071 set h [winfo height $itk_component(view)] 1072 1072 if { $w < 2 || $h < 2 } { 1073 1073 update … … 1180 1180 PanCamera 1181 1181 SendCmd "camera zoom $_view(-zoom)" 1182 set _reset 0 1182 1183 } 1183 1184 … … 1194 1195 StopBufferingCommands 1195 1196 blt::busy release $itk_component(hull) 1196 set _reset 01197 1197 } 1198 1198 … … 1292 1292 switch -- $option { 1293 1293 click { 1294 $itk_component( 3dview) configure -cursor fleur1294 $itk_component(view) configure -cursor fleur 1295 1295 set _click(x) $x 1296 1296 set _click(y) $y … … 1300 1300 Rotate click $x $y 1301 1301 } else { 1302 set w [winfo width $itk_component( 3dview)]1303 set h [winfo height $itk_component( 3dview)]1302 set w [winfo width $itk_component(view)] 1303 set h [winfo height $itk_component(view)] 1304 1304 if {$w <= 0 || $h <= 0} { 1305 1305 return … … 1328 1328 release { 1329 1329 Rotate drag $x $y 1330 $itk_component( 3dview) configure -cursor ""1330 $itk_component(view) configure -cursor "" 1331 1331 catch {unset _click} 1332 1332 } … … 1347 1347 itcl::body Rappture::FlowvisViewer::Pan {option x y} { 1348 1348 # Experimental stuff 1349 set w [winfo width $itk_component( 3dview)]1350 set h [winfo height $itk_component( 3dview)]1349 set w [winfo width $itk_component(view)] 1350 set h [winfo height $itk_component(view)] 1351 1351 if { $option == "set" } { 1352 1352 set x [expr $x / double($w)] … … 1362 1362 set _click(x) $x 1363 1363 set _click(y) $y 1364 $itk_component( 3dview) configure -cursor hand11364 $itk_component(view) configure -cursor hand1 1365 1365 } 1366 1366 if { $option == "drag" || $option == "release" } { … … 1376 1376 } 1377 1377 if { $option == "release" } { 1378 $itk_component( 3dview) configure -cursor ""1378 $itk_component(view) configure -cursor "" 1379 1379 } 1380 1380 } … … 1449 1449 if { $_settings($what) } { 1450 1450 blt::table $itk_component(plotarea) \ 1451 0,0 $itk_component( 3dview) -fill both \1451 0,0 $itk_component(view) -fill both \ 1452 1452 1,0 $itk_component(legend) -fill x 1453 1453 blt::table configure $itk_component(plotarea) r1 -resize none … … 1564 1564 # NameTransferFunction -- 1565 1565 # 1566 # 1567 # 1568 # 1569 # 1570 # 1566 # Creates a transfer function name based on the <style> settings in the 1567 # library run.xml file. This placeholder will be used later to create 1568 # and send the actual transfer function once the data info has been sent 1569 # to us by the render server. [We won't know the volume limits until the 1570 # server parses the 3D data and sends back the limits via ReceiveData.] 1571 1571 # 1572 1572 itcl::body Rappture::FlowvisViewer::NameTransferFunction { dataobj cname } { … … 1589 1589 # ComputeTransferFunction -- 1590 1590 # 1591 # 1592 # 1593 # 1594 # 1595 # 1591 # Computes and sends the transfer function to the render server. It's 1592 # assumed that the volume data limits are known and that the global 1593 # transfer-functions slider values have been set up. Both parts are 1594 # needed to compute the relative value (location) of the marker, and 1595 # the alpha map of the transfer function. 1596 1596 # 1597 1597 itcl::body Rappture::FlowvisViewer::ComputeTransferFunction { tf } { … … 2555 2555 } 2556 2556 "next" { 2557 if { ![winfo viewable $itk_component( 3dview)] } {2557 if { ![winfo viewable $itk_component(view)] } { 2558 2558 flow stop 2559 2559 return … … 2870 2870 # BuildVolumeComponents -- 2871 2871 # 2872 # 2873 # 2874 # 2875 # 2876 # 2877 # 2872 # This is called from the "scale" method which is called when a new 2873 # dataset is added or deleted. It repopulates the dropdown menu of 2874 # volume component names. It sets the current component to the first 2875 # component in the list (of components found). Finally, if there is 2876 # only one component, don't display the label or the combobox in the 2877 # volume settings tab. 2878 2878 # 2879 2879 itcl::body Rappture::FlowvisViewer::BuildVolumeComponents {} { … … 2889 2889 # GetDatasetsWithComponents -- 2890 2890 # 2891 # 2892 # 2893 # 2894 # 2891 # Returns a list of all the datasets (known by the combination of their 2892 # data object and component name) that match the given component name. 2893 # For example, this is used where we want to change the settings of 2894 # volumes that have the current component. 2895 2895 # 2896 2896 itcl::body Rappture::FlowvisViewer::GetDatasetsWithComponent { cname } { -
branches/1.4/gui/scripts/molvisviewer.tcl
r5728 r5732 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.4/gui/scripts/nanovisviewer.tcl
r5655 r5732 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 { … … 227 228 }] 228 229 229 itk_component add 3dview {230 itk_component add view { 230 231 label $itk_component(plotarea).view -image $_image(plot) \ 231 232 -highlightthickness 0 -borderwidth 0 … … 234 235 ignore -highlightthickness -borderwidth -background 235 236 } 236 bind $itk_component( 3dview) <Control-F1> [itcl::code $this ToggleConsole]237 bind $itk_component(view) <Control-F1> [itcl::code $this ToggleConsole] 237 238 238 239 set f [$itk_component(main) component controls] … … 278 279 -onimage [Rappture::icon volume-on] \ 279 280 -offimage [Rappture::icon volume-off] \ 280 - command [itcl::code $this AdjustSetting -volume] \281 - variable [itcl::scope _settings(-volume)]281 -variable [itcl::scope _settings(-volume)] \ 282 -command [itcl::code $this AdjustSetting -volume] 282 283 } 283 284 $itk_component(volume) select … … 327 328 # the server. So the panewindow uses the tiny size. 328 329 set w 10000 329 pack forget $itk_component( 3dview)330 pack forget $itk_component(view) 330 331 blt::table $itk_component(plotarea) \ 331 0,0 $itk_component( 3dview) -fill both -reqwidth $w \332 0,0 $itk_component(view) -fill both -reqwidth $w \ 332 333 1,0 $itk_component(legend) -fill x 333 334 blt::table configure $itk_component(plotarea) r1 -resize none 334 335 335 336 # Bindings for rotation via mouse 336 bind $itk_component( 3dview) <ButtonPress-1> \337 bind $itk_component(view) <ButtonPress-1> \ 337 338 [itcl::code $this Rotate click %x %y] 338 bind $itk_component( 3dview) <B1-Motion> \339 bind $itk_component(view) <B1-Motion> \ 339 340 [itcl::code $this Rotate drag %x %y] 340 bind $itk_component( 3dview) <ButtonRelease-1> \341 bind $itk_component(view) <ButtonRelease-1> \ 341 342 [itcl::code $this Rotate release %x %y] 342 343 343 bind $itk_component( 3dview) <Configure> \344 bind $itk_component(view) <Configure> \ 344 345 [itcl::code $this EventuallyResize %w %h] 345 346 346 347 # Bindings for panning via mouse 347 bind $itk_component( 3dview) <ButtonPress-2> \348 bind $itk_component(view) <ButtonPress-2> \ 348 349 [itcl::code $this Pan click %x %y] 349 bind $itk_component( 3dview) <B2-Motion> \350 bind $itk_component(view) <B2-Motion> \ 350 351 [itcl::code $this Pan drag %x %y] 351 bind $itk_component( 3dview) <ButtonRelease-2> \352 bind $itk_component(view) <ButtonRelease-2> \ 352 353 [itcl::code $this Pan release %x %y] 353 354 354 355 # Bindings for panning via keyboard 355 bind $itk_component( 3dview) <KeyPress-Left> \356 bind $itk_component(view) <KeyPress-Left> \ 356 357 [itcl::code $this Pan set -10 0] 357 bind $itk_component( 3dview) <KeyPress-Right> \358 bind $itk_component(view) <KeyPress-Right> \ 358 359 [itcl::code $this Pan set 10 0] 359 bind $itk_component( 3dview) <KeyPress-Up> \360 bind $itk_component(view) <KeyPress-Up> \ 360 361 [itcl::code $this Pan set 0 -10] 361 bind $itk_component( 3dview) <KeyPress-Down> \362 bind $itk_component(view) <KeyPress-Down> \ 362 363 [itcl::code $this Pan set 0 10] 363 bind $itk_component( 3dview) <Shift-KeyPress-Left> \364 bind $itk_component(view) <Shift-KeyPress-Left> \ 364 365 [itcl::code $this Pan set -2 0] 365 bind $itk_component( 3dview) <Shift-KeyPress-Right> \366 bind $itk_component(view) <Shift-KeyPress-Right> \ 366 367 [itcl::code $this Pan set 2 0] 367 bind $itk_component( 3dview) <Shift-KeyPress-Up> \368 bind $itk_component(view) <Shift-KeyPress-Up> \ 368 369 [itcl::code $this Pan set 0 -2] 369 bind $itk_component( 3dview) <Shift-KeyPress-Down> \370 bind $itk_component(view) <Shift-KeyPress-Down> \ 370 371 [itcl::code $this Pan set 0 2] 371 372 372 373 # Bindings for zoom via keyboard 373 bind $itk_component( 3dview) <KeyPress-Prior> \374 bind $itk_component(view) <KeyPress-Prior> \ 374 375 [itcl::code $this Zoom out] 375 bind $itk_component( 3dview) <KeyPress-Next> \376 bind $itk_component(view) <KeyPress-Next> \ 376 377 [itcl::code $this Zoom in] 377 378 378 bind $itk_component( 3dview) <Enter> "focus $itk_component(3dview)"379 bind $itk_component(view) <Enter> "focus $itk_component(view)" 379 380 380 381 if {[string equal "x11" [tk windowingsystem]]} { 381 382 # Bindings for zoom via mouse 382 bind $itk_component( 3dview) <4> [itcl::code $this Zoom out]383 bind $itk_component( 3dview) <5> [itcl::code $this Zoom in]383 bind $itk_component(view) <4> [itcl::code $this Zoom out] 384 bind $itk_component(view) <5> [itcl::code $this Zoom in] 384 385 } 385 386 … … 387 388 388 389 eval itk_initialize $args 389 390 EnableWaitDialog 900391 390 Connect 392 391 } … … 447 446 # ---------------------------------------------------------------------- 448 447 # USAGE: get ?-objects? 449 # USAGE: get ?-image 3dview|legend?448 # USAGE: get ?-image view|legend? 450 449 # 451 450 # Clients use this to query the list of objects being plotted, in … … 477 476 -image { 478 477 if {[llength $args] != 2} { 479 error "wrong # args: should be \"get -image 3dview|legend\""478 error "wrong # args: should be \"get -image view|legend\"" 480 479 } 481 480 switch -- [lindex $args end] { 482 3dview {481 view { 483 482 return $_image(plot) 484 483 } … … 487 486 } 488 487 default { 489 error "bad image name \"[lindex $args end]\": should be 3dview or legend"488 error "bad image name \"[lindex $args end]\": should be view or legend" 490 489 } 491 490 } … … 500 499 # USAGE: delete ?<dataobj1> <dataobj2> ...? 501 500 # 502 # Clients use this to delete a dataobj from the plot. If no dataobjs 503 # are specified, then all dataobjs are deleted. No data objects are 504 # deleted. They are only removed from the display list. 505 # 501 # Clients use this to delete a dataobj from the plot. If no dataobjs 502 # are specified, then all dataobjs are deleted. No data objects are 503 # deleted. They are only removed from the display list. 506 504 # ---------------------------------------------------------------------- 507 505 itcl::body Rappture::NanovisViewer::delete {args} { … … 679 677 } 680 678 681 set w [winfo width $itk_component( 3dview)]682 set h [winfo height $itk_component( 3dview)]679 set w [winfo width $itk_component(view)] 680 set h [winfo height $itk_component(view)] 683 681 EventuallyResize $w $h 684 682 } … … 689 687 # isconnected -- 690 688 # 691 # 689 # Indicates if we are currently connected to the visualization server. 692 690 # 693 691 itcl::body Rappture::NanovisViewer::isconnected {} { … … 705 703 # Disconnect -- 706 704 # 707 # Clients use this method to disconnect from the current rendering 708 # server. 705 # Clients use this method to disconnect from the current rendering server. 709 706 # 710 707 itcl::body Rappture::NanovisViewer::Disconnect {} { … … 806 803 # ReceiveLegend -- 807 804 # 808 # 809 # 810 # 811 # 812 # 805 # The procedure is the response from the render server to each "legend" 806 # command. The server sends back a "legend" command invoked our 807 # the slave interpreter. The purpose is to collect data of the image 808 # representing the legend in the canvas. In addition, the 809 # active transfer function is displayed. 813 810 # 814 811 itcl::body Rappture::NanovisViewer::ReceiveLegend { cname vmin vmax size } { … … 826 823 # ReceiveData -- 827 824 # 828 # 829 # 830 # 831 # 832 # 825 # The procedure is the response from the render server to each "data 826 # follows" command. The server sends back a "data" command invoked our 827 # the slave interpreter. The purpose was to collect the min/max of the 828 # volume sent to the render server. This is no longer needed since we 829 # already know the limits. 833 830 # 834 831 itcl::body Rappture::NanovisViewer::ReceiveData { args } { … … 852 849 # ---------------------------------------------------------------------- 853 850 itcl::body Rappture::NanovisViewer::Rebuild {} { 854 set w [winfo width $itk_component( 3dview)]855 set h [winfo height $itk_component( 3dview)]851 set w [winfo width $itk_component(view)] 852 set h [winfo height $itk_component(view)] 856 853 if { $w < 2 || $h < 2 } { 857 854 update … … 958 955 PanCamera 959 956 SendCmd "camera zoom $_view(-zoom)" 957 set _reset 0 960 958 } 961 959 … … 970 968 StopBufferingCommands 971 969 blt::busy release $itk_component(hull) 972 set _reset 0973 970 } 974 971 … … 1068 1065 switch -- $option { 1069 1066 click { 1070 $itk_component( 3dview) configure -cursor fleur1067 $itk_component(view) configure -cursor fleur 1071 1068 set _click(x) $x 1072 1069 set _click(y) $y … … 1076 1073 Rotate click $x $y 1077 1074 } else { 1078 set w [winfo width $itk_component( 3dview)]1079 set h [winfo height $itk_component( 3dview)]1075 set w [winfo width $itk_component(view)] 1076 set h [winfo height $itk_component(view)] 1080 1077 if {$w <= 0 || $h <= 0} { 1081 1078 return … … 1104 1101 release { 1105 1102 Rotate drag $x $y 1106 $itk_component( 3dview) configure -cursor ""1103 $itk_component(view) configure -cursor "" 1107 1104 catch {unset _click} 1108 1105 } … … 1123 1120 itcl::body Rappture::NanovisViewer::Pan {option x y} { 1124 1121 # Experimental stuff 1125 set w [winfo width $itk_component( 3dview)]1126 set h [winfo height $itk_component( 3dview)]1122 set w [winfo width $itk_component(view)] 1123 set h [winfo height $itk_component(view)] 1127 1124 if { $option == "set" } { 1128 1125 set x [expr $x / double($w)] … … 1138 1135 set _click(x) $x 1139 1136 set _click(y) $y 1140 $itk_component( 3dview) configure -cursor hand11137 $itk_component(view) configure -cursor hand1 1141 1138 } 1142 1139 if { $option == "drag" || $option == "release" } { … … 1152 1149 } 1153 1150 if { $option == "release" } { 1154 $itk_component( 3dview) configure -cursor ""1151 $itk_component(view) configure -cursor "" 1155 1152 } 1156 1153 } … … 1224 1221 if { $_settings($what) } { 1225 1222 blt::table $itk_component(plotarea) \ 1226 0,0 $itk_component( 3dview) -fill both \1223 0,0 $itk_component(view) -fill both \ 1227 1224 1,0 $itk_component(legend) -fill x 1228 1225 blt::table configure $itk_component(plotarea) r1 -resize none … … 1348 1345 # NameTransferFunction -- 1349 1346 # 1350 # 1351 # 1352 # 1353 # 1354 # 1347 # Creates a transfer function name based on the <style> settings in the 1348 # library run.xml file. This placeholder will be used later to create 1349 # and send the actual transfer function once the data info has been sent 1350 # to us by the render server. [We won't know the volume limits until the 1351 # server parses the 3D data and sends back the limits via ReceiveData.] 1355 1352 # 1356 1353 itcl::body Rappture::NanovisViewer::NameTransferFunction { dataobj cname } { … … 1383 1380 # ComputeTransferFunction -- 1384 1381 # 1385 # 1386 # 1387 # 1388 # 1389 # 1382 # Computes and sends the transfer function to the render server. It's 1383 # assumed that the volume data limits are known and that the global 1384 # transfer-functions slider values have been set up. Both parts are 1385 # needed to compute the relative value (location) of the marker, and 1386 # the alpha map of the transfer function. 1390 1387 # 1391 1388 itcl::body Rappture::NanovisViewer::ComputeTransferFunction { cname } { … … 2045 2042 # InitComponentSettings -- 2046 2043 # 2047 # 2048 # 2049 # 2044 # Initializes the volume settings for a specific component. This should 2045 # match what's used as global settings above. This is called the first 2046 # time we try to switch to a given component in SwitchComponent below. 2050 2047 # 2051 2048 itcl::body Rappture::NanovisViewer::InitComponentSettings { cname } { … … 2068 2065 # SwitchComponent -- 2069 2066 # 2070 # 2071 # 2072 # 2067 # This is called when the current component is changed by the dropdown 2068 # menu in the volume tab. It synchronizes the global volume settings 2069 # with the settings of the new current component. 2073 2070 # 2074 2071 itcl::body Rappture::NanovisViewer::SwitchComponent { cname } { … … 2090 2087 # BuildVolumeComponents -- 2091 2088 # 2092 # 2093 # 2094 # 2095 # 2096 # 2097 # 2089 # This is called from the "scale" method which is called when a new 2090 # dataset is added or deleted. It repopulates the dropdown menu of 2091 # volume component names. It sets the current component to the first 2092 # component in the list (of components found). Finally, if there is 2093 # only one component, don't display the label or the combobox in the 2094 # volume settings tab. 2098 2095 # 2099 2096 itcl::body Rappture::NanovisViewer::BuildVolumeComponents {} { … … 2121 2118 # GetDatasetsWithComponents -- 2122 2119 # 2123 # 2124 # 2125 # 2126 # 2120 # Returns a list of all the datasets (known by the combination of their 2121 # data object and component name) that match the given component name. 2122 # For example, this is used where we want to change the settings of 2123 # volumes that have the current component. 2127 2124 # 2128 2125 itcl::body Rappture::NanovisViewer::GetDatasetsWithComponent { cname } { … … 2143 2140 # HideAllMarkers -- 2144 2141 # 2145 # 2146 # 2147 # 2142 # Hide all the markers in all the transfer functions. Can't simply 2143 # delete and recreate markers from the <style> since the user may have 2144 # created, deleted, or moved markers. 2148 2145 # 2149 2146 itcl::body Rappture::NanovisViewer::HideAllMarkers {} { -
branches/1.4/gui/scripts/vtkvolumeviewer.tcl
r5469 r5732 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 {} { … … 1319 1317 # AdjustSetting -- 1320 1318 # 1321 # 1322 # 1323 # 1319 # Changes/updates a specific setting in the widget. There are 1320 # usually user-setable option. Commands are sent to the render 1321 # server. 1324 1322 # 1325 1323 itcl::body Rappture::VtkVolumeViewer::AdjustSetting {what {value ""}} { … … 1517 1515 # RequestLegend -- 1518 1516 # 1519 # 1520 # 1517 # Request a new legend from the server. The size of the legend 1518 # is determined from the height of the canvas. 1521 1519 # 1522 1520 itcl::body Rappture::VtkVolumeViewer::RequestLegend {} { … … 2414 2412 # GetDatasetsWithComponent -- 2415 2413 # 2416 # 2417 # 2418 # 2419 # 2414 # Returns a list of all the datasets (known by the combination of 2415 # their data object and component name) that match the given 2416 # component name. For example, this is used where we want to change 2417 # the settings of volumes that have the current component. 2420 2418 # 2421 2419 itcl::body Rappture::VtkVolumeViewer::GetDatasetsWithComponent { cname } {
Note: See TracChangeset
for help on using the changeset viewer.