Changeset 1141
- Timestamp:
- Sep 4, 2008, 5:23:26 PM (16 years ago)
- Location:
- trunk/gui/scripts
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gui/scripts/nanovisviewer.tcl
r1081 r1141 57 57 public method delete {args} 58 58 public method scale {args} 59 public method GetLimits { ivol } { 60 if { [info exists _id2style($ivol)] } { 61 set tf $_id2style($ivol) 62 set _limits(min) "" 63 set _limits(max) "" 64 foreach ivol $_style2ids($tf) { 65 if { ![info exists _limits($ivol-min)] } { 66 puts stderr "In GetLimits $ivol" 67 parray _limits 68 error "can't find $ivol limits" 69 } 70 if { $_limits(min) == "" || 71 $_limits(min) > $_limits($ivol-min) } { 72 set _limits(min) $_limits($ivol-min) 73 } 74 if { $_limits(max) == "" || 75 $_limits(max) < $_limits($ivol-max) } { 76 set _limits(max) $_limits($ivol-max) 77 } 78 } 79 } 80 return [array get _limits] 81 } 59 public method GetLimits { ivol } 82 60 public method download {option args} 83 61 public method parameters {title args} { … … 609 587 # USAGE: delete ?<dataobj1> <dataobj2> ...? 610 588 # 611 # Clients use this to delete a dataobj from the plot. If no dataobjs 612 # are specified, then all dataobjs are deleted. 589 # Clients use this to delete a dataobj from the plot. If no dataobjs 590 # are specified, then all dataobjs are deleted. No data objects are 591 # deleted. They are only removed from the display list. 592 # 613 593 # ---------------------------------------------------------------------- 614 594 itcl::body Rappture::NanovisViewer::delete {args} { … … 616 596 set args $_dlist 617 597 } 618 # delete all specified dataobjs598 # Delete all specified dataobjs 619 599 set changed 0 620 600 foreach dataobj $args { 621 601 set pos [lsearch -exact $_dlist $dataobj] 622 if { $pos >= 0} {602 if { $pos >= 0 } { 623 603 set _dlist [lreplace $_dlist $pos $pos] 624 604 foreach key [array names _obj2ovride $dataobj-*] { … … 628 608 } 629 609 } 630 # if anything changed, then rebuild the plot610 # If anything changed, then rebuild the plot 631 611 if {$changed} { 632 612 $_dispatcher event -idle !rebuild … … 717 697 } 718 698 set result [VisViewer::Connect $_hosts] 699 if { $result } { 700 set w [winfo width $itk_component(3dview)] 701 set h [winfo height $itk_component(3dview)] 702 _send "screen $w $h" 703 } 719 704 return $result 720 705 } … … 826 811 827 812 if 0 { 813 # Add this when we fix grid for volumes 828 814 _send "volume axis label x \"\"" 829 815 _send "volume axis label y \"\"" … … 1035 1021 } 1036 1022 } 1023 set w [winfo width $itk_component(3dview)] 1024 set h [winfo height $itk_component(3dview)] 1025 _send "screen $w $h" 1026 1027 # 1028 # Reset the camera and other view parameters 1029 # 1030 set xyz [Euler2XYZ $_view(theta) $_view(phi) $_view(psi)] 1031 _send "camera angle $xyz" 1032 _send "camera zoom $_view(zoom)" 1033 1034 _fixSettings light 1035 _fixSettings transp 1036 _fixSettings isosurface 1037 _fixSettings grid 1038 _fixSettings axes 1039 _fixSettings outline 1040 1037 1041 if {[llength $_sendobjs] > 0} { 1038 1042 # send off new data objects … … 1040 1044 return 1041 1045 } 1042 1043 set w [winfo width $itk_component(3dview)]1044 set h [winfo height $itk_component(3dview)]1045 _send "screen $w $h"1046 1046 1047 1047 # nothing to send -- activate the proper ivol … … 1082 1082 _send "volume data state [_state volume] $vols" 1083 1083 $_dispatcher event -idle !legend 1084 1085 #1086 # Reset the camera and other view parameters1087 #1088 _send "camera angle [Euler2XYZ $_view(theta) $_view(phi) $_view(psi)]"1089 _send "camera zoom $_view(zoom)"1090 1091 _fixSettings light1092 _fixSettings transp1093 _fixSettings isosurface1094 _fixSettings grid1095 _fixSettings axes1096 _fixSettings outline1097 1084 } 1098 1085 … … 1577 1564 } 1578 1565 SendBytes "transfunc define $tf { $cmap } { $wmap }\n" 1579 #puts stdout "transfunc define $tf { $cmap } { $wmap }\n"1580 1566 return [SendBytes "volume shading transfunc $tf $_style2ids($tf)\n"] 1581 1567 } … … 1745 1731 return "" 1746 1732 } 1733 1734 itcl::body Rappture::NanovisViewer::GetLimits { ivol } { 1735 if { ![info exists _id2style($ivol)] } { 1736 return 1737 } 1738 set tf $_id2style($ivol) 1739 set _limits(min) "" 1740 set _limits(max) "" 1741 foreach ivol $_style2ids($tf) { 1742 if { ![info exists _limits($ivol-min)] } { 1743 error "can't find $ivol limits" 1744 } 1745 if { $_limits(min) == "" || $_limits(min) > $_limits($ivol-min) } { 1746 set _limits(min) $_limits($ivol-min) 1747 } 1748 if { $_limits(max) == "" || $_limits(max) < $_limits($ivol-max) } { 1749 set _limits(max) $_limits($ivol-max) 1750 } 1751 } 1752 return [array get _limits] 1753 } -
trunk/gui/scripts/visviewer.tcl
r1111 r1141 23 23 set _servers(nanovis) "" 24 24 set _servers(pymol) "" 25 #set _servers(nanovis) "128.210.189.216:2000"26 #set _servers(pymol) "128.210.189.216:2020"25 set _servers(nanovis) "128.210.189.216:2000" 26 set _servers(pymol) "128.210.189.216:2020" 27 27 28 28 protected variable _dispatcher "" ;# dispatcher for !events … … 273 273 # 274 274 # Helper routine called from a file event to send data when the 275 # connection is writable (i.e. not blocked). Sets a magic 276 # variable _done($this) when we're done. 277 # 278 itcl::body Rappture::VisViewer::_SendHelper {} { 279 puts $_sid $_buffer(out) 280 flush $_sid 281 set _done($this) 1; # Success 282 } 283 284 # 285 # _SendHelper.old -- 286 # 287 # Helper routine called from a file event to send data when the 275 288 # connection is writable (i.e. not blocked). Sends data in chunks 276 289 # of 8k (or less). Sets magic variable _done($this) to indicate … … 278 291 # the server (failure). 279 292 # 280 itcl::body Rappture::VisViewer::_SendHelper {} {281 puts $_sid $_buffer(out)282 flush $_sid283 set _done($this) 1; # Success284 }285 286 293 itcl::body Rappture::VisViewer::_SendHelper.old {} { 287 294 set bytesLeft [string length $_buffer(out)] … … 326 333 if { $code == 0 && $ok} { 327 334 $_dispatcher event -idle !rebuild 328 Rappture::Tooltip::cue hide 329 } else { 335 Rappture::Tooltip::cue hide 336 return 1 337 } else { 330 338 Rappture::Tooltip::cue @$x,$y "Can't connect to visualization server. This may be a network problem. Wait a few moments and try resetting the view." 339 return 0 331 340 } 332 return 333 } 341 } 342 # Even though the data is sent in only 1 "puts", we need to verify that 343 # the server is ready first. Wait for the socket to become writable 344 # before sending anything. 334 345 set _done($this) 1 335 346 set _buffer(out) $bytes -
trunk/gui/scripts/xylegend.tcl
r1140 r1141 29 29 private variable tree_ "" 30 30 private variable diff_ "" 31 private variable focus_ -131 private variable focus_ "" 32 32 private variable diffelements_ 33 33 … … 102 102 grid $itk_component(controls) -column 0 -row 1 -sticky nsew 103 103 grid columnconfigure $itk_component(hull) 0 -weight 1 104 grid rowconfigure $itk_component(hull) 1 -weight 0 104 grid rowconfigure $itk_component(hull) 1 \ 105 -minsize [winfo reqheight $itk_component(scrollbars)] 105 106 grid rowconfigure $itk_component(hull) 0 -weight 1 106 107 grid $itk_component(scrollbars) -column 0 -row 0 -sticky nsew … … 196 197 set label [$graph_ element cget $elem -label] 197 198 if { $label == "" } { 198 continue199 set label $elem 199 200 } 200 201 Add $elem $label … … 330 331 lappend delnodes $node 331 332 if { $diff_ != "" && [info exists diffelements_($elem)] } { 332 $graph_ elementdelete $diff_333 $graph_ marker delete $diff_ 333 334 array unset diffelements_ 334 335 set diff_ "" … … 457 458 458 459 itcl::body Rappture::XyLegend::Difference {} { 459 set nodes [$itk_component(legend) curselection]460 set elements {}461 set sum [blt::vector create \#auto -command ""]462 463 set xcoords [blt::vector create \#auto -command ""]464 set ycoords [blt::vector create \#auto -command ""]465 466 # Step 1. Get the x-values for each curve, then sort them to get the467 # unique values.468 469 foreach node $nodes {470 set elem [$tree_ label $node]471 $xcoords append [GetData $elem -x]472 set elements [linsert $elements 0 $elem]473 }474 # Sort the abscissas keeping unique values.475 $xcoords sort -uniq476 477 # Step 2. Now for each curve, generate a cubic spline of that curve478 # and interpolate to get the corresponding y-values for each479 # abscissa. Normally the abscissa are the same, so we're480 # interpolation the knots.481 482 set x [blt::vector create \#auto -command ""]483 set y [blt::vector create \#auto -command ""]484 $sum length [$xcoords length]485 486 foreach node $nodes {487 set elem [$tree_ label $node]488 $x set [GetData $elem -x]489 $y set [GetData $elem -y]490 blt::spline natural $x $y $xcoords $ycoords491 492 # Sum the interpolated y-coordinate values.493 $sum expr "fabs($ycoords - $sum)"494 }495 blt::vector destroy $x $y496 497 # Get the average498 #$sum expr "$sum / [llength $elements]"499 500 # Step 3. Create a new curve which is the average. Append it to the501 # the end.502 503 set count 0504 while {[$graph_ element exists diff$count] } {505 incr count506 }507 set elements [lsort -dictionary $elements]508 set name "diff$count"509 set label "Diff. [join $elements ,]"510 511 # Don't use the vector because we don't know when it will be cleaned up.512 513 $graph_ element create $name -label $label -x [$xcoords range 0 end] \514 -y [$sum range 0 end]515 blt::vector destroy $xcoords $ycoords $sum516 set node [Add $name $label]517 Raise $node518 }519 520 itcl::body Rappture::XyLegend::Difference {} {521 460 522 461 if { $diff_ != "" } { … … 529 468 if { [info exists diffelements_($elem1)] && 530 469 [info exists diffelements_($elem2)] } { 531 array unset diffelements_ 532 return 470 array unset diffelements_; # Toggle the difference. 471 return; 533 472 } 534 473 array unset diffelements_ … … 581 520 activate { 582 521 set focus_ [$itk_component(legend) index focus] 583 if { $focus_ == -1} {522 if { $focus_ == "" } { 584 523 return; 585 524 }
Note: See TracChangeset
for help on using the changeset viewer.