- Timestamp:
- Jul 7, 2009, 3:51:50 PM (15 years ago)
- Location:
- trunk/gui/scripts
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gui/scripts/field.tcl
r1526 r1545 763 763 set _comp2dims($cname) "3D" 764 764 set data [$_field get -decode yes $cname.opendx] 765 set data [Rappture::encoding::decode -as zb64 $data]766 767 765 set data "<ODX>$data" 768 766 set data [Rappture::encoding::encode -as zb64 $data] -
trunk/gui/scripts/flowvisviewer.tcl
r1543 r1545 257 257 }] 258 258 259 itk_component add 3dview { 260 label $itk_component(plotarea).vol -image $_image(plot) \ 261 -highlightthickness 0 -borderwidth 0 262 } { 263 usual 264 ignore -highlightthickness -borderwidth -background 265 } 259 266 set f [$itk_component(main) component controls] 260 267 itk_component add reset { -
trunk/gui/scripts/heightmapviewer.tcl
r1543 r1545 1 1 2 2 # ---------------------------------------------------------------------- 3 # C OMPONENT: heightmapviewer - 3D surface rendering3 # Component: heightmapviewer - 3D surface rendering 4 4 # 5 5 # This widget performs surface rendering on 3D scalar/vector datasets. … … 70 70 private method BuildCameraTab {} 71 71 private method PanCamera {} 72 72 protected method CurrentSurfaces {{what -all}} 73 73 protected method Rebuild {} 74 74 protected method Zoom {option} … … 94 94 private variable _serverObjs ;# contains all the dataobj-component 95 95 ;# to heightmaps in the server 96 private variable _location "" 96 97 private variable _first "" 97 98 private variable _width 0 … … 142 143 pan-y 0 143 144 } 144 145 foreach val {xmin xmax ymin ymax zmin zmax vmin vmax} { 146 set _limits($val) "" 147 } 145 148 array set _settings [subst { 146 149 $this-pan-x $_view(pan-x) … … 159 162 }] 160 163 164 itk_component add 3dview { 165 canvas $itk_component(plotarea).vol \ 166 -highlightthickness 0 -borderwidth 0 167 } { 168 usual 169 ignore -highlightthickness -borderwidth -background 170 } 171 $_image(plot) configure -data "" 172 $itk_component(3dview) create image 0 0 -anchor nw -image $_image(plot) 161 173 set f [$itk_component(main) component controls] 162 174 itk_component add zoom { … … 175 187 } 176 188 pack $itk_component(reset) -side top -padx 1 -pady { 4 0 } 177 Rappture::Tooltip::for $itk_component(reset) "Reset the view to the default zoom level" 189 Rappture::Tooltip::for $itk_component(reset) \ 190 "Reset the view to the default zoom level" 178 191 179 192 itk_component add zoomin { … … 216 229 BuildCameraTab 217 230 218 # Legend219 set _image(legend) [image create photo]220 itk_component add legend {221 canvas $itk_component(plotarea).legend -width 30 -highlightthickness 0222 } {223 usual224 ignore -highlightthickness225 rename -background -plotbackground plotBackground Background226 }227 231 set w [expr [winfo reqwidth $itk_component(hull)] - 80] 228 232 pack forget $itk_component(3dview) 229 233 pack $itk_component(3dview) -side left -fill both -expand yes 230 pack $itk_component(legend) -side left -fill y 231 232 bind $itk_component(legend) <Configure> \ 233 [list $_dispatcher event -idle !legend] 234 234 235 235 236 # Bindings for rotation via mouse … … 331 332 set _obj2ovride($dataobj-width) $params(-width) 332 333 set _obj2ovride($dataobj-raise) $params(-raise) 334 set _obj2ovride($dataobj-brightness) $params(-brightness) 333 335 $_dispatcher event -idle !rebuild 334 336 } … … 429 431 # ---------------------------------------------------------------------- 430 432 itcl::body Rappture::HeightmapViewer::scale { args } { 433 if 0 { 431 434 foreach val {xmin xmax ymin ymax zmin zmax vmin vmax} { 432 435 set _limits($val) "" 436 } 433 437 } 434 438 foreach obj $args { … … 586 590 if { [IsConnected] } { 587 591 set bytes [ReceiveBytes $size] 592 if { ![info exists _image(legend)] } { 593 set _image(legend) [image create photo] 594 } 588 595 ReceiveEcho <<line "<read $size bytes for [image width $_image(legend)]x[image height $_image(legend)] legend>" 589 if 1 {590 596 set src [image create photo -data $bytes] 591 597 blt::winop image rotate $src $_image(legend) 90 592 598 set dst $_image(legend) 593 } else { 594 $_image(legend) configure -data $bytes 595 } 596 set c $itk_component(legend) 599 600 set c $itk_component(3dview) 597 601 set w [winfo width $c] 598 602 set h [winfo height $c] 599 set lineht [expr [font metrics $itk_option(-font) -linespace] + 4] 600 if {"" == [$c find withtag transfunc]} { 601 $c create image 0 [expr $lineht] -anchor ne \ 602 -image $_image(legend) -tags transfunc 603 $c create text 10 [expr {$h-8}] -anchor se \ 604 -fill $itk_option(-plotforeground) -tags vmin \ 605 -font "Arial 8 bold" 606 $c create text [expr {$w-10}] [expr {$h-8}] -anchor ne \ 607 -fill $itk_option(-plotforeground) -tags vmax \ 608 -font "Arial 8 bold" 609 } 610 $c coords transfunc [expr $w - 5] [expr $lineht] 611 $c itemconfigure vmin -text $vmin 612 $c itemconfigure vmax -text $vmax 613 $c coords vmax [expr $w - 5] 2 614 $c coords vmin [expr $w - 5] [expr $h - 2] 603 set lineht [font metrics $itk_option(-font) -linespace] 604 605 if { $_settings($this-legend) } { 606 if { [$c find withtag "legend"] == "" } { 607 $c create image [expr {$w-2}] [expr {$lineht+2}] -anchor ne \ 608 -image $_image(legend) -tags "transfunc legend" 609 $c create text [expr {$w-2}] 2 -anchor ne \ 610 -fill $itk_option(-plotforeground) -tags "vmax legend" \ 611 -font "Arial 8 bold" 612 $c create text [expr {$w-2}] [expr {$h-2}] -anchor se \ 613 -fill $itk_option(-plotforeground) -tags "vmin legend" \ 614 -font "Arial 8 bold" 615 } 616 # Reset the item coordinates according the current size of the plot. 617 $c coords transfunc [expr {$w-2}] [expr {$lineht+2}] 618 $c itemconfigure vmin -text $vmin 619 $c itemconfigure vmax -text $vmax 620 $c coords vmin [expr {$w-2}] [expr {$h-2}] 621 $c coords vmax [expr {$w-2}] 2 622 } 615 623 } 616 624 } … … 647 655 foreach comp [$dataobj components] { 648 656 # Tell the engine to expect some data 649 set data [$dataobj blob $comp]650 set nbytes [string length $data]651 append _outbuf "heightmap data follows $nbytes $dataobj-$comp\n"652 append _outbuf $data653 654 657 set tag $dataobj-$comp 655 set _serverObjs($tag) $tag 656 657 # 658 # Determine the transfer function needed for this surface 659 # and make sure that it's defined on the server. 660 # 661 foreach {sname cmap wmap} [GetTransfuncData $dataobj $comp] break 662 SendCmd [list "transfunc" "define" $sname $cmap $wmap] 663 set _obj2style($tag) $sname 658 if { ![info exists _serverObjs($tag)] } { 659 set data [$dataobj blob $comp] 660 set nbytes [string length $data] 661 append _outbuf "heightmap data follows $nbytes $dataobj-$comp\n" 662 append _outbuf $data 663 664 set _serverObjs($tag) $tag 665 666 # Determine the transfer function needed for this surface 667 # and make sure that it's defined on the server. 668 foreach {sname cmap wmap} [GetTransfuncData $dataobj $comp] break 669 SendCmd [list "transfunc" "define" $sname $cmap $wmap] 670 set _obj2style($tag) $sname 671 } 664 672 } 665 673 } … … 674 682 # This is where the initial camera position is set. 675 683 set location [$_first hints camera] 676 if { $ location != "" } {684 if { $_location == "" && $location != "" } { 677 685 array set _view $location 686 set _location $location 678 687 } 679 688 } 680 689 SendCmd "heightmap data visible 0" 681 set heightmaps [ array names _serverObjs $_first-*]690 set heightmaps [CurrentSurfaces] 682 691 if { $heightmaps != "" && $_settings($this-surface) } { 683 692 SendCmd "heightmap data visible 1 $heightmaps" 693 } 694 set heightmaps [CurrentSurfaces -raise] 695 if { $heightmaps != "" } { 696 SendCmd "heightmap opacity 0.25" 697 SendCmd "heightmap opacity 0.95 $heightmaps" 698 } else { 699 SendCmd "heightmap opacity 0.85" 684 700 } 685 701 foreach key $heightmaps { … … 923 939 switch -- $what { 924 940 "legend" { 925 if { $_settings($this-legend) } {926 pack $itk_component(legend) -side left -fill y927 } else {928 pack forget $itk_component(legend)929 }930 set lineht [expr [font metrics $itk_option(-font) -linespace] + 4]931 set w [expr { [winfo height $itk_component(legend)] - 2*$lineht}]932 set h [expr {[winfo width $itk_component(legend)] - 16}]941 if { !$_settings($this-legend) } { 942 $itk_component(3dview) delete "legend" 943 } 944 set lineht [font metrics $itk_option(-font) -linespace] 945 set w [winfo height $itk_component(3dview)] 946 set h [winfo width $itk_component(3dview)] 947 set w [expr {$w - 2*$lineht - 4}] 948 set h 12 933 949 set tag "" 934 950 if {"" != $_first} { … … 939 955 SendCmd "heightmap legend $tag $w $h" 940 956 } else { 941 $itk_component(legend) delete all957 #$itk_component(legend) delete all 942 958 } 943 959 } … … 1198 1214 SendCmd "screen $_width $_height" 1199 1215 set _resizePending 0 1216 $_dispatcher event -idle !legend 1200 1217 } 1201 1218 … … 1208 1225 } 1209 1226 } 1227 1228 # ---------------------------------------------------------------------- 1229 # USAGE: CurrentVolumes ?-cutplanes? 1230 # 1231 # Returns a list of volume server IDs for the current volume being 1232 # displayed. This is normally a single ID, but it might be a list 1233 # of IDs if the current data object has multiple components. 1234 # ---------------------------------------------------------------------- 1235 itcl::body Rappture::HeightmapViewer::CurrentSurfaces {{what -all}} { 1236 set list {} 1237 if { $what == "-all" } { 1238 foreach key [array names _serverObjs] { 1239 foreach {dataobj comp} [split $key -] break 1240 if { [info exists _obj2ovride($dataobj-raise)] } { 1241 lappend list $dataobj-$comp 1242 } 1243 } 1244 } else { 1245 foreach key [array names _serverObjs] { 1246 foreach {dataobj comp} [split $key -] break 1247 if { [info exists _obj2ovride($dataobj$what)] && 1248 $_obj2ovride($dataobj$what) } { 1249 lappend list $dataobj-$comp 1250 } 1251 } 1252 } 1253 return $list 1254 } -
trunk/gui/scripts/molvisviewer.tcl
r1543 r1545 197 197 }] 198 198 199 # 200 # Set up the widgets in the main body 201 # 199 itk_component add 3dview { 200 label $itk_component(plotarea).vol -image $_image(plot) \ 201 -highlightthickness 0 -borderwidth 0 202 } { 203 usual 204 ignore -highlightthickness -borderwidth -background 205 } 206 202 207 set f [$itk_component(main) component controls] 203 208 itk_component add reset { -
trunk/gui/scripts/nanovisviewer.tcl
r1543 r1545 207 207 $this-zoom $_view(zoom) 208 208 }] 209 210 itk_component add 3dview { 211 label $itk_component(plotarea).vol -image $_image(plot) \ 212 -highlightthickness 0 -borderwidth 0 213 } { 214 usual 215 ignore -highlightthickness -borderwidth -background 216 } 209 217 210 218 set f [$itk_component(main) component controls] -
trunk/gui/scripts/visviewer.tcl
r1539 r1545 133 133 pack $itk_component(plotarea) -fill both -expand yes 134 134 set _image(plot) [image create photo] 135 itk_component add 3dview {136 label $itk_component(plotarea).vol -image $_image(plot) \137 -highlightthickness 0 -borderwidth 0138 } {139 usual140 ignore -highlightthickness -borderwidth -background141 }142 135 eval itk_initialize $args 143 136 }
Note: See TracChangeset
for help on using the changeset viewer.