- Timestamp:
- Jun 13, 2009, 1:02:20 PM (15 years ago)
- Location:
- trunk/gui/scripts
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gui/scripts/flowvisviewer.tcl
r1511 r1514 2615 2615 set _settings($this-duration) $info(duration) 2616 2616 $itk_component(speed) value $info(speed) 2617 append cmd "flow add $tag -position $info(position) -axis $info(axis) " 2618 append cmd "-volume $info(volume) -outline $info(outline) " 2619 append cmd "-slice $info(streams) -arrows $info(arrows)\n" 2617 append cmd "flow add $tag" 2618 append cmd " -position $info(position)" 2619 append cmd " -axis $info(axis)" 2620 append cmd " -volume $info(volume)" 2621 append cmd " -outline $info(outline)" 2622 append cmd " -slice $info(streams)" 2623 append cmd " -arrows $info(arrows)\n" 2620 2624 foreach part [$flowobj particles] { 2621 2625 array unset info 2622 2626 array set info $part 2623 2627 set color [Color2RGB $info(color)] 2624 append cmd "$tag particles add $info(name) -position $info(position) " 2625 append cmd "-axis $info(axis) -color {$color} -size $info(size)\n" 2628 append cmd "$tag particles add $info(name)" 2629 append cmd " -position $info(position)" 2630 append cmd " -hide $info(hide)" 2631 append cmd " -axis $info(axis)" 2632 append cmd " -color {$color}" 2633 append cmd " -size $info(size)\n" 2626 2634 } 2627 2635 foreach box [$flowobj boxes] { … … 2634 2642 } 2635 2643 set color [Color2RGB $info(color)] 2636 append cmd "$tag box add $info(name) -color {$color} " 2637 append cmd "-hide $info(hide) -linewidth $info(linewidth) " 2638 append cmd "-corner1 {$info(corner1)} -corner2 {$info(corner2)}\n" 2644 append cmd "$tag box add $info(name)" 2645 append cmd " -color {$color}" 2646 append cmd " -hide $info(hide)" 2647 append cmd " -linewidth $info(linewidth) " 2648 append cmd " -corner1 {$info(corner1)} " 2649 append cmd " -corner2 {$info(corner2)}\n" 2639 2650 } 2640 2651 append cmd "$tag data follows $nbytes $extents\n" … … 2849 2860 } 2850 2861 2851 itcl::body Rappture::FlowvisViewer::GetMovie { widget w idth height} {2862 itcl::body Rappture::FlowvisViewer::GetMovie { widget w h } { 2852 2863 set token "movie[incr _nextToken]" 2853 2864 set var ::Rappture::FlowvisViewer::_hardcopy($this-$token) … … 2858 2869 set popup .flowvisviewermovie 2859 2870 if {![winfo exists $popup]} { 2860 Rappture::Balloon $popup -title "Generating video..."2871 Rappture::Balloon $popup -title "Generating movie..." 2861 2872 set inner [$popup component inner] 2862 label $inner.title -text "Generating Hardcopy" -font "Arial 10 bold" 2863 label $inner.please -text "This may take a few minutes." -font "Arial 10" 2873 label $inner.title -text "Generating movie for download" \ 2874 -font "Arial 10 bold" 2875 label $inner.please -text "This may take a few minutes." \ 2876 -font "Arial 10" 2864 2877 label $inner.icon -image [Rappture::icon bigroller0] 2865 2878 button $inner.cancel -text "Cancel" -font "Arial 10 bold" \ … … 2876 2889 set inner [$popup component inner] 2877 2890 } 2878 $_dispatcher event -after 300000 !movietimeout 2891 # Timeout is set to 10 minutes. 2892 $_dispatcher event -after 600000 !movietimeout 2879 2893 WaitIcon start $inner.icon 2880 2894 grab set -local $inner … … 2885 2899 set nframes [expr round($_flow(duration) / $_flow(delay))] 2886 2900 set framerate [expr 1000.0 / $_flow(delay)] 2901 2902 # These are specific to MPEG1 video generation 2887 2903 set framerate 25.0 2888 set bitrate 6 0000002904 set bitrate 6.0e+6 2889 2905 2890 2906 set start [clock seconds] 2891 SendCmd "flow video $ width $height $nframes $framerate $bitrate $token"2907 SendCmd "flow video $token -width $w -height $h -numframes $nframes " 2892 2908 2893 2909 $popup activate $widget below 2894 2910 update 2895 # We wait here for either2896 # 1 ) the png to bedelivered or2897 # 2 ) timeout or2898 # 3 ) user cancels the operation.2911 # We wait here until 2912 # 1. the movie is delivered or 2913 # 2. we've timed out or 2914 # 3. the user has canceled the operation.b 2899 2915 tkwait variable $var 2900 2916 2901 puts stderr "I'm back in [expr [clock seconds] - $start] seconds." 2917 puts stderr "Video generated in [expr [clock seconds] - $start] seconds." 2918 2902 2919 # Clean up. 2903 2920 $_dispatcher cancel !movietimeout … … 2908 2925 update 2909 2926 2927 # This will both cancel the movie generation (if it hasn't already 2928 # completed) and reset the flow. 2929 SendCmd "flow reset" 2910 2930 if { $_hardcopy($this-$token) != "" } { 2911 2931 return [list .mpg $_hardcopy($this-$token)] -
trunk/gui/scripts/nanovisviewer.tcl
r1448 r1514 56 56 public method camera {option args} 57 57 public method delete {args} 58 public method disconnect {} 58 59 public method download {option args} 59 60 public method get {args} … … 61 62 public method limits { tf } 62 63 public method overmarker { m x } 64 public method sendto { string } 63 65 public method parameters {title args} { 64 66 # do nothing … … 69 71 70 72 protected method Connect {} 71 protected method CurrentVolume Ids {{what -all}}73 protected method CurrentVolumes {{what -all}} 72 74 protected method Disconnect {} 73 75 protected method DoResize {} … … 106 108 private variable _allDataObjs 107 109 private variable _obj2ovride ;# maps dataobj => style override 108 private variable _obj2id ;# maps dataobj-component to volume ID 109 # in the server 110 private variable _id2obj ;# maps dataobj => volume ID in server 110 private variable _serverObjs ;# contains all the dataobj-component 111 ;# to volumes in the server 111 112 private variable _sendobjs "" ;# list of data objs to send to server 112 private variable _rec eiveIds ;# list of data objs to send to server113 private variable _recvdObjs ;# list of data objs to send to server 113 114 private variable _obj2style ;# maps dataobj-component to transfunc 114 115 private variable _style2objs ;# maps tf back to list of … … 186 187 pan-y 0 187 188 } 188 set _obj2id(count) 0189 set _id2obj(count) 0190 189 set _limits(vmin) 0.0 191 190 set _limits(vmax) 1.0 … … 463 462 if { $pos >= 0 } { 464 463 foreach comp [$dataobj components] { 465 if { [info exists obj2id($dataobj-$comp)] } {466 set ivol $_obj2id($dataobj-$comp)467 array unset _limits $ ivol-*464 set tag $dataobj-$comp 465 if { [info exists obj2id($tag)] } { 466 array unset _limits $tag-* 468 467 } 469 468 } 470 469 set _dlist [lreplace $_dlist $pos $pos] 471 470 array unset _obj2ovride $dataobj-* 472 array unset _ obj2id$dataobj-*471 array unset _serverObjs $dataobj-* 473 472 array unset _obj2style $dataobj-* 474 473 set changed 1 … … 481 480 set list {} 482 481 foreach {dataobj comp} $_style2objs($tf) break 483 if { [info exists _ obj2id($dataobj-$comp)] } {482 if { [info exists _serverObjs($dataobj-$comp)] } { 484 483 lappend list $dataobj $comp 485 484 } … … 599 598 600 599 # 600 # disconnect -- 601 # 602 itcl::body Rappture::NanovisViewer::disconnect {} { 603 Disconnect 604 } 605 606 # 601 607 # Disconnect -- 602 608 # … … 609 615 # disconnected -- no more data sitting on server 610 616 set _outbuf "" 611 catch {unset _obj2id} 612 array unset _id2obj 613 set _obj2id(count) 0 614 set _id2obj(count) 0 617 catch {unset _serverObjs} 615 618 set _sendobjs "" 619 } 620 621 # 622 # sendto -- 623 # 624 itcl::body Rappture::NanovisViewer::sendto { bytes } { 625 SendBytes "$bytes\n" 616 626 } 617 627 … … 655 665 return 656 666 } 657 set ivol $_obj2id(count)658 incr _obj2id(count)659 667 NameTransferFunc $dataobj $comp 660 set _rec eiveIds($ivol) 1668 set _recvdObjs($dataobj-$comp) 1 661 669 } 662 670 } … … 687 695 } 688 696 SendCmd "volume state 0" 689 set vols {} 690 foreach key [array names _obj2id $_first-*] { 691 lappend vols $_obj2id($key) 692 } 697 set vols [array names _serverObjs $_first-*] 693 698 if { $vols != "" && $_settings($this-volume) } { 694 699 SendCmd "volume state 1 $vols" 695 700 } 696 701 # sync the state of slicers 697 set vols [CurrentVolume Ids -cutplanes]702 set vols [CurrentVolumes -cutplanes] 698 703 foreach axis {x y z} { 699 704 SendCmd "cutplane state $_settings($this-${axis}cutplane) $axis $vols" … … 809 814 set w [winfo width $c] 810 815 set h [winfo height $c] 811 #foreach { dataobj comp } $_id2obj($ivol) break812 816 set lx 10 813 817 set ly [expr {$h - 1}] … … 849 853 # doesn't parse 3D data formats, we rely on the server (nanovis) to 850 854 # tell us what the limits are. Once we've received the limits to all 851 # the data we've sent (tracked by _rec eiveIds) we can then determine855 # the data we've sent (tracked by _recvdObjs) we can then determine 852 856 # what the transfer functions are for these volumes. 853 857 # … … 868 872 array set info $args 869 873 870 set ivol $info(id); # Id of volume created by server.871 874 set tag $info(tag) 872 875 set parts [split $tag -] … … 875 878 # Volumes don't exist until we're told about them. 876 879 # 877 set _id2obj($ivol) $parts878 880 set dataobj [lindex $parts 0] 879 set _ obj2id($tag) $ivol881 set _serverObjs($tag) $tag 880 882 if { $_settings($this-volume) && $dataobj == $_first } { 881 SendCmd "volume state 1 $ ivol"882 } 883 set _limits($ ivol-min) $info(min); # Minimum value of the volume.884 set _limits($ ivol-max) $info(max); # Maximum value of the volume.883 SendCmd "volume state 1 $tag" 884 } 885 set _limits($tag-min) $info(min); # Minimum value of the volume. 886 set _limits($tag-max) $info(max); # Maximum value of the volume. 885 887 set _limits(vmin) $info(vmin); # Overall minimum value. 886 888 set _limits(vmax) $info(vmax); # Overall maximum value. 887 889 888 unset _rec eiveIds($ivol)890 unset _recvdObjs($tag) 889 891 if { [array size _receiveIds] == 0 } { 890 892 updatetransferfuncs … … 936 938 foreach dataobj [get] { 937 939 set comp [lindex [$dataobj components] 0] 938 if {![info exists _ obj2id($dataobj-$comp)]} {940 if {![info exists _serverObjs($dataobj-$comp)]} { 939 941 set i [lsearch -exact $_sendobjs $dataobj] 940 942 if {$i < 0} { … … 971 973 } 972 974 SendCmd "volume state 0" 973 foreach key [array names _obj2id $_first-*] { 974 SendCmd "volume state 1 $_obj2id($key)" 975 } 976 # 977 # The _obj2id and _id2style arrays may or may not have the right 978 # information. It's possible for the server to know about volumes 979 # that the client has assumed it's deleted. We could add checks. 980 # But this problem needs to be fixed not bandaided. 981 set comp [lindex [$_first components] 0] 982 set ivol $_obj2id($_first-$comp) 983 975 set vols [array names _serverObjs $_first-*] 976 if { $vols != "" } { 977 SendCmd "volume state 1 $vols" 978 } 984 979 foreach comp [$_first components] { 985 980 NameTransferFunc $_first $comp … … 988 983 989 984 # sync the state of slicers 990 set vols [CurrentVolume Ids -cutplanes]985 set vols [CurrentVolumes -cutplanes] 991 986 foreach axis {x y z} { 992 987 SendCmd "cutplane state $_settings($this-${axis}cutplane) $axis $vols" … … 1005 1000 1006 1001 # ---------------------------------------------------------------------- 1007 # USAGE: CurrentVolume Ids ?-cutplanes?1002 # USAGE: CurrentVolumes ?-cutplanes? 1008 1003 # 1009 1004 # Returns a list of volume server IDs for the current volume being … … 1011 1006 # of IDs if the current data object has multiple components. 1012 1007 # ---------------------------------------------------------------------- 1013 itcl::body Rappture::NanovisViewer::CurrentVolume Ids {{what -all}} {1008 itcl::body Rappture::NanovisViewer::CurrentVolumes {{what -all}} { 1014 1009 set rlist "" 1015 1010 if { $_first == "" } { 1016 1011 return 1017 1012 } 1018 foreach key [array names _obj2id *-*] { 1019 if {[string match $_first-* $key]} { 1020 array set style { 1021 -cutplanes 1 1022 } 1023 foreach {dataobj comp} [split $key -] break 1024 array set style [lindex [$dataobj components -style $comp] 0] 1025 1026 if {$what != "-cutplanes" || $style(-cutplanes)} { 1027 lappend rlist $_obj2id($key) 1028 } 1013 foreach key [array names _serverObjs $_first-*] { 1014 array set style { 1015 -cutplanes 1 1016 } 1017 foreach {dataobj comp} [split $key -] break 1018 array set style [lindex [$dataobj components -style $comp] 0] 1019 if {$what != "-cutplanes" || $style(-cutplanes)} { 1020 lappend rlist $key 1029 1021 } 1030 1022 } … … 1289 1281 "volume" { 1290 1282 if { [isconnected] } { 1291 set vols [CurrentVolume Ids -cutplanes]1283 set vols [CurrentVolumes -cutplanes] 1292 1284 SendCmd "volume data state $_settings($this-volume) $vols" 1293 1285 } … … 1297 1289 set bool $_settings($this-$what) 1298 1290 if { [isconnected] } { 1299 set vols [CurrentVolume Ids -cutplanes]1291 set vols [CurrentVolumes -cutplanes] 1300 1292 SendCmd "cutplane state $bool $axis $vols" 1301 1293 } … … 1479 1471 } 1480 1472 SendBytes "transfunc define $tf { $cmap } { $wmap }\n" 1481 if { [info exists _ obj2id($dataobj-$comp)] } {1482 return [SendBytes "volume shading transfunc $tf $ _obj2id($dataobj-$comp)\n"]1473 if { [info exists _serverObjs($dataobj-$comp)] } { 1474 return [SendBytes "volume shading transfunc $tf $dataobj-$comp\n"] 1483 1475 } 1484 1476 } … … 1649 1641 set min ""; set max "" 1650 1642 foreach {dataobj comp} $_style2objs($tf) { 1651 if { ![info exists _obj2id($dataobj-$comp)] } { 1643 set tag $dataobj-$comp 1644 if { ![info exists _serverObjs($tag)] } { 1652 1645 continue 1653 1646 } 1654 set ivol $_obj2id($dataobj-$comp) 1655 if { ![info exists _limits($ivol-min)] } { 1647 if { ![info exists _limits($tag-min)] } { 1656 1648 continue 1657 1649 } 1658 if { $min == "" || $min > $_limits($ ivol-min) } {1659 set min $_limits($ ivol-min)1660 } 1661 if { $max == "" || $max < $_limits($ ivol-max) } {1662 set max $_limits($ ivol-max)1650 if { $min == "" || $min > $_limits($tag-min) } { 1651 set min $_limits($tag-min) 1652 } 1653 if { $max == "" || $max < $_limits($tag-max) } { 1654 set max $_limits($tag-max) 1663 1655 } 1664 1656 } … … 1958 1950 1959 1951 set newpos [expr {0.01*$newval}] 1960 set ids [CurrentVolumeIds -cutplanes]1961 SendCmd "cutplane position $newpos $axis $ ids"1952 set vols [CurrentVolumes -cutplanes] 1953 SendCmd "cutplane position $newpos $axis $vols" 1962 1954 } 1963 1955 default { -
trunk/gui/scripts/unirect3d.tcl
r1511 r1514 57 57 set path [$field get $cname.mesh] 58 58 set m [$xmlobj element -as object $path] 59 puts stderr [$m children]60 59 GetValue $m "xaxis.max" _xMax 61 60 GetValue $m "xaxis.min" _xMin … … 89 88 # ---------------------------------------------------------------------- 90 89 itcl::body Rappture::Unirect3d::blob {} { 91 set time [time {92 90 lappend data "unirect3d" 93 91 lappend data "xmin" $_xMin "xmax" $_xMax "xnum" $_xNum … … 98 96 lappend data "values" [$_values range 0 end] 99 97 } 100 }]101 puts stderr blob7=$time102 98 return $data 103 #return [Rappture::encoding::encode -as b64 "$data"]104 99 } 105 100
Note: See TracChangeset
for help on using the changeset viewer.