- Timestamp:
- Dec 27, 2011, 2:46:12 PM (13 years ago)
- Location:
- branches/blt4/gui/scripts
- Files:
-
- 2 added
- 50 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/blt4/gui/scripts/analyzer.tcl
r2690 r2745 445 445 set ::errorInfo "\n\n== RAPPTURE INPUT ==\n[$_tool xml xml]" 446 446 Rappture::bugreport::register "Problem launching job:\n$result" 447 447 Rappture::bugreport::attachment [$_tool xml xml] 448 448 Rappture::bugreport::send 449 449 } … … 567 567 _autoLabel $xmlobj output.$item "Sequence" counters 568 568 } 569 570 571 572 573 569 default { 570 if 0 { 571 puts stderr "unknown output $item" 572 } 573 } 574 574 } 575 575 set label [$xmlobj get output.$item.about.group] … … 596 596 } 597 597 set hidden [$xmlobj get output.$item.hide] 598 599 600 598 if { $hidden == "" } { 599 set hidden 0 600 } 601 601 if {"" != $label && !$hidden} { 602 602 if {![info exists _label2page($label)]} { … … 668 668 foreach label [array names _label2page] { 669 669 set page $_label2page($label) 670 670 destroy $page.rviewer 671 671 #$page.rviewer clear 672 672 } … … 1249 1249 set line [string trim $line] 1250 1250 if { $line == "" } { 1251 continue; 1251 continue; # Skip blank lines. 1252 1252 } 1253 1253 if { [string match "ENDMDL*" $line] } { … … 1295 1295 set line [string trim $line] 1296 1296 if { $line == "" } { 1297 continue; 1297 continue; # Skip blank lines 1298 1298 } 1299 1299 if {[regexp {^[\t ]*ITEM:[ \t]+ATOMS} $line] } { … … 1331 1331 # USAGE: _trajToSequence <xmlobj> ?<path>? 1332 1332 # 1333 # 1334 # 1335 # 1336 # 1337 # 1338 # 1333 # Check for PDB and LAMMPS trajectories in molecule data and rewrite 1334 # the individual models as a sequence of molecules. Used internally 1335 # to detect any molecule output elements that contain trajectory data. 1336 # Trajectories will be converted into sequences of individual molecules. 1337 # All other elements will be unaffected. Scans the entire xml tree if a 1338 # starting path is not specified. 1339 1339 # 1340 1340 # ---------------------------------------------------------------------- … … 1350 1350 set isTraj [$xmlobj get ${current}.components.molecule.trajectory] 1351 1351 if { $isTraj == "" || !$isTraj } { 1352 continue; 1352 continue; # Not a trajectory. 1353 1353 } 1354 1354 # Look for trajectory if molecule element found. Check both pdb -
branches/blt4/gui/scripts/bugreport.tcl
r2690 r2745 86 86 set w [winfo reqwidth .bugreport] 87 87 set h [winfo reqheight .bugreport] 88 89 88 #gah@purdue: temporary hack to force view of dismiss button 89 incr h 300 90 90 set x [expr {([winfo screenwidth .bugreport]-$w)/2}] 91 91 if {$x < 0} {set x "+0"} else {set x "+$x"} … … 471 471 set toolFile "" 472 472 if { [info exists details(attachment)] } { 473 474 475 476 477 473 set toolFile "/tmp/tool[pid].xml" 474 set f [open $toolFile "w"] 475 puts $f $details(attachment) 476 close $f 477 unset details(attachment) 478 478 } 479 479 set query [http::formatQuery \ … … 496 496 set url [Rappture::Tool::resources -huburl] 497 497 if { $url == "" } { 498 498 set url "http://hubzero.org" 499 499 } 500 500 if {[string index $url end] == "/"} { … … 514 514 515 515 if { $toolFile != "" } { 516 516 file delete $toolFile 517 517 } 518 518 if {[regexp {Ticket #[0-9]* +\(.*?\) +[0-9]+ +times} $info match]} { -
branches/blt4/gui/scripts/datatable.tcl
r2287 r2745 36 36 37 37 protected method Build {} 38 private variable _xmlobj "" ; 39 private variable _datatable ""; 38 private variable _xmlobj "" ; # ref to lib obj with datatable data 39 private variable _datatable ""; # lib obj representing this datatable 40 40 private variable _columns "" 41 private variable _hints ; 41 private variable _hints ; # cache of hints stored in XML 42 42 private variable _tree "" 43 43 } … … 132 132 # Sniff for column information: label, descriptions, and style 133 133 foreach cname [$_datatable children -type "column"] { 134 set label 134 set label [$_datatable get "$cname.label"] 135 135 set description [$_datatable get "$cname.description"] 136 set style 137 set format 136 set style [$_datatable get "$cname.style"] 137 set format [$_datatable get "$cname.format"] 138 138 lappend _columns $label $description $style $format 139 139 } … … 141 141 set _tree [blt::tree create] 142 142 if {"" != $csvdata} { 143 144 145 143 set d0 [blt::datatable create] 144 package require blt_datatable_csv 145 $d0 import csv -data $csvdata 146 146 for { set row 1 } { $row <= [$d0 numrows] } { incr row } { 147 147 set child [$_tree insert 0] 148 148 set c 0 149 149 set values [$d0 row values $row] 150 150 foreach value $values {label description style format} $_columns { 151 151 if { $label == "" } { … … 156 156 } 157 157 } 158 158 blt::datatable destroy $d0 159 159 } 160 160 } -
branches/blt4/gui/scripts/datatableresult.tcl
r2287 r2745 68 68 private variable _dataobj2dashes ;# maps dataobj => BLT -dashes list 69 69 private variable _dataobj2raise ;# maps dataobj => raise flag 0/1 70 private variable _raised 70 private variable _raised ""; 71 71 common _downloadPopup ;# download options from popup 72 72 } … … 246 246 # generate the comma-separated value data for these objects 247 247 248 249 250 251 248 # This is at least better than what was there. 249 # For each datatable object convert the values 250 # in the tree by loading it into a blt::datatable 251 # and then exporting the comma separated values 252 252 set csvdata "" 253 253 foreach dataobj $dlist { 254 255 256 257 254 set tree [$dataobj values] 255 set d0 [blt::datatable create] 256 package require blt_datatable_tree 257 $d0 import tree $tree 0 258 258 append csvdata "[string repeat - 60]\n" 259 259 append csvdata " [$dataobj hints label]\n" … … 267 267 } 268 268 append csvdata "[string repeat - 60]\n" 269 270 269 $d0 column delete 1 270 append csvdata [$d0 export csv -columnlabels] 271 271 append csvdata "\n" 272 272 blt::datatable destroy $d0 273 273 } 274 274 return [list .csv $csvdata] … … 324 324 $itk_component(treeview) column bind $c <Leave> \ 325 325 { Rappture::Tooltip::tooltip cancel } 326 327 328 329 326 if { $fmt != "" } { 327 $itk_component(treeview) column configure $c \ 328 -formatcommand [itcl::code $this FormatColumn $fmt] 329 } 330 330 } 331 331 } -
branches/blt4/gui/scripts/deviceViewer1D.tcl
r1923 r2745 362 362 foreach name $tabs { 363 363 $itk_component(tabs) insert end $name 364 # 364 # -activebackground $itk_option(-background) 365 365 } 366 366 $itk_component(tabs) select 0 -
branches/blt4/gui/scripts/dispatcher.tcl
r1923 r2745 224 224 # ---------------------------------------------------------------------- 225 225 # USAGE: cancel ?!event ...? 226 # 226 # cancel all 227 227 # 228 228 # Used to cancel any event notifications pending for the specified -
branches/blt4/gui/scripts/drawing.tcl
r2534 r2745 75 75 set _styles($elem) [$_xmlobj get $path.$elem.about.style] 76 76 set _labels($elem) [$_xmlobj get $path.$elem.about.label] 77 78 77 set _types($elem) polydata 78 } 79 79 streamlines* { 80 80 set _data($elem) [$_xmlobj get $path.$elem.vtk] 81 81 set _styles($elem) [$_xmlobj get $path.$elem.about.style] 82 82 set _labels($elem) [$_xmlobj get $path.$elem.about.label] 83 84 83 set _types($elem) streamlines 84 } 85 85 spheres* { 86 86 set _data($elem) [$_xmlobj get $path.$elem.vtk] 87 87 set _styles($elem) [$_xmlobj get $path.$elem.about.style] 88 88 set _labels($elem) [$_xmlobj get $path.$elem.about.label] 89 89 set _types($elem) spheres 90 90 } 91 91 } … … 95 95 label about.label 96 96 color about.color 97 cameraabout.camera97 camera about.camera 98 98 type about.type 99 99 xlabel xaxis.label … … 139 139 # label -- 140 140 # 141 # 141 # Returns the label of the named drawing element. 142 142 # 143 143 itcl::body Rappture::Drawing::label { elem } { … … 151 151 # type -- 152 152 # 153 # 153 # Returns the type of the named drawing element. 154 154 # 155 155 itcl::body Rappture::Drawing::type { elem } { … … 163 163 # style -- 164 164 # 165 # 165 # Returns the style string of the named drawing element. 166 166 # 167 167 itcl::body Rappture::Drawing::style { elem } { … … 175 175 # data -- 176 176 # 177 # 177 # Returns the data of the named drawing element. 178 178 # 179 179 itcl::body Rappture::Drawing::data { elem } { … … 186 186 # ---------------------------------------------------------------------- 187 187 # method values 188 # 189 # 190 # 188 # Returns a base64 encoded, gzipped Tcl list that represents the 189 # Tcl command and data to recreate the uniform rectangular grid 190 # on the nanovis server. 191 191 # ---------------------------------------------------------------------- 192 192 itcl::body Rappture::Drawing::values { elem } { … … 203 203 # ---------------------------------------------------------------------- 204 204 # method limits <axis> 205 # 206 # 205 # Returns a list {min max} representing the limits for the 206 # specified axis. 207 207 # ---------------------------------------------------------------------- 208 208 itcl::body Rappture::Drawing::limits {which} { -
branches/blt4/gui/scripts/field.tcl
r2742 r2745 40 40 protected method _getValue {expr} 41 41 42 private variable _xmlobj "" ; 43 private variable _path ""; 44 private variable _units "" ; 42 private variable _xmlobj "" ; # ref to XML obj with device data 43 private variable _path ""; # Path of this object in the XML 44 private variable _units "" ; # system of units for this field 45 45 private variable _limits ;# maps box name => {z0 z1} limits 46 46 private variable _zmax 0 ;# length of the device … … 233 233 } 234 234 if { [info exists _comp2vtkstreamlines($what)] } { 235 236 237 235 # FIXME: Need to process the vtk file data to pull out the field's 236 # values. 237 error "vtkstreamlines: values not implements" 238 238 return [lindex $_comp2vtkstreamlines($what) 1] 239 239 } … … 272 272 } 273 273 if { [info exists _comp2vtkstreamlines($what)] } { 274 274 # Return the contents of the vtk file. 275 275 return $_comp2vtkstreamlines($what) 276 276 } … … 538 538 set hints(path) $_path 539 539 if 0 { 540 541 540 # to be compatible with curve objects 541 set hints(xlabel) "Position" 542 542 } 543 543 if {[info exists hints(group)] && [info exists hints(label)]} { … … 607 607 set type "points-on-mesh" 608 608 } elseif {[$_field element $cname.vtk] != ""} { 609 610 611 612 613 609 if { [$_field get "about.view"] == "streamlines" } { 610 set type "vtkstreamlines" 611 } else { 612 set type "vtk" 613 } 614 614 } elseif {[$_field element $cname.opendx] != ""} { 615 616 617 618 619 620 615 global env 616 if { [info exists env(VTKVOLUME)] } { 617 set type "vtkvolume" 618 } else { 619 set type "dx" 620 } 621 621 } elseif {[$_field element $cname.dx] != ""} { 622 623 624 625 626 627 622 global env 623 if { [info exists env(VTKVOLUME)] } { 624 set type "vtkvolume" 625 } else { 626 set type "dx" 627 } 628 628 } 629 629 set _comp2style($cname) "" … … 636 636 } 637 637 set _comp2extents($cname) $extents 638 638 set _type $type 639 639 if {$type == "1D"} { 640 640 # … … 798 798 } elseif {$type == "vtkstreamlines"} { 799 799 set _comp2dims($cname) "3D" 800 800 # Allow redirects to another element. 801 801 set vtkdata [$_field get $cname.vtk] 802 803 804 805 806 807 808 809 810 811 812 813 814 815 802 if { ![string match "!*" $vtkdata] } { 803 set _comp2vtkstreamlines($cname) $vtkdata 804 } else { 805 set path [string range $vtkdata 1 end] 806 if { [$_xmlobj element $path] == "" } { 807 error "bad redirection path \"$path\"" 808 } 809 puts stderr path=$path 810 set element [$_xmlobj element -as type $path] 811 if { $element != "vtk" } { 812 error "bad path \"$path\": must redirect to a vtk element" 813 } 814 set _comp2vtkstreamlines($cname) [$_xmlobj get $path] 815 } 816 816 set _comp2style($cname) [$_field get $cname.style] 817 817 incr _counter 818 818 } elseif {$type == "vtkvolume"} { 819 819 set _comp2dims($cname) "3D" 820 821 820 # Allow redirects to another element. 821 set data [$_field get -decode no $cname.dx] 822 822 set data [Rappture::encoding::decode -as zb64 $data] 823 824 825 826 827 828 829 830 831 832 833 834 835 836 823 if 1 { 824 set file "/tmp/$cname.dx" 825 set f [open $file "w"] 826 puts $f $data 827 close $f 828 } 829 set data [Rappture::ConvertDxToVtk $data] 830 if 1 { 831 set file "/tmp/$cname.vtk" 832 set f [open $file "w"] 833 puts $f $data 834 close $f 835 } 836 set _comp2vtkvolume($cname) $data 837 837 set _comp2style($cname) [$_field get $cname.style] 838 838 incr _counter … … 850 850 set _comp2dims($cname) "3D" 851 851 set _comp2dx($cname) [$_field get -decode no $cname.dx] 852 852 if 1 { 853 853 set data [$_field get -decode yes $cname.dx] 854 855 856 857 858 859 860 861 862 863 854 set file "/tmp/junk.dx" 855 set f [open $file "w"] 856 puts $f $data 857 close $f 858 if { [string match "<ODX>*" $data] } { 859 set data [string range $data 5 end] 860 set _comp2dx($cname) \ 861 [Rappture::encoding::encode -as zb64 $data] 862 } 863 } 864 864 set _comp2style($cname) [$_field get $cname.style] 865 865 if {[$_field element $cname.flow] != ""} { … … 1025 1025 } 1026 1026 if { [info exists _comp2vtkstreamlines($what)] } { 1027 1027 # Return the contents of the vtk file. 1028 1028 return $_comp2vtkstreamlines($what) 1029 1029 } 1030 1030 if { [info exists _comp2vtkvolume($what)] } { 1031 1031 # Return the contents of the vtk file. 1032 1032 return $_comp2vtkvolume($what) 1033 1033 } 1034 1034 if {[info exists _comp2dx($what)]} { 1035 1035 return $_comp2dx($what) 1036 1036 } 1037 1037 if {[info exists _comp2unirect2d($what)]} { -
branches/blt4/gui/scripts/field2dresult.tcl
r2742 r2745 58 58 set servers "" 59 59 switch -- $flags(-mode) { 60 61 62 63 64 65 66 67 68 69 70 71 72 } 60 "auto" - "heightmap" - "flowvis" { 61 set servers [Rappture::VisViewer::GetServerList "nanovis"] 62 } 63 "vtkcontour" - "vtkheightmap" { 64 set servers [Rappture::VisViewer::GetServerList "vtkvis"] 65 } 66 "vtk" { 67 # Old vtk contour widget 68 } 69 default { 70 puts stderr "unknown render mode \"$flags(-mode)\"" 71 } 72 } 73 73 if {"" != $servers && $flags(-mode) != "vtk"} { 74 74 switch -- $flags(-mode) { … … 96 96 puts stderr "unknown render mode \"$flags(-mode)\"" 97 97 } 98 } 98 } 99 99 pack $itk_component(renderer) -expand yes -fill both 100 100 # can't connect to rendering farm? then fall back to older viewer -
branches/blt4/gui/scripts/field3dresult.tcl
r2742 r2745 56 56 array set flags $args 57 57 switch -- $flags(-mode) { 58 59 60 61 62 63 64 65 66 67 68 69 70 71 } 58 "auto" - "nanovis" - "flowvis" { 59 set servers [Rappture::VisViewer::GetServerList "nanovis"] 60 } 61 "vtkcontour" - "vtkstreamlines" - "vtkvolume" - "vtkviewer" { 62 set servers [Rappture::VisViewer::GetServerList "vtkvis"] 63 } 64 "vtk" { 65 # Old vtk contour widget 66 set servers "" 67 } 68 default { 69 puts stderr "unknown render mode \"$flags(-mode)\"" 70 } 71 } 72 72 if {"" != $servers && $flags(-mode) != "vtk"} { 73 73 switch -- $flags(-mode) { … … 83 83 } 84 84 "vtkvolume" { 85 85 catch { 86 86 itk_component add renderer { 87 87 Rappture::VtkVolumeViewer $itk_interior.ren $servers 88 88 } 89 90 89 } errs 90 puts stderr errs=$errs 91 91 } 92 92 "vtkstreamlines" { … … 98 98 puts stderr "unknown render mode \"$flags(-mode)\"" 99 99 } 100 } 100 } 101 101 pack $itk_component(renderer) -expand yes -fill both 102 102 -
branches/blt4/gui/scripts/filechoiceentry.tcl
r1976 r2745 211 211 } 212 212 # Replace the template with the substituted value. 213 214 213 set files [Glob $glob] 214 set allfiles [concat $allfiles $files] 215 215 } 216 216 set first "" … … 287 287 set files "" 288 288 if { [llength $rest] > 0 } { 289 290 291 292 293 294 295 296 297 289 if { [catch { 290 glob -nocomplain -type d $pattern 291 } dirs] != 0 } { 292 puts stderr "can't glob \"$pattern\": $dirs" 293 return 294 } 295 foreach d $dirs { 296 set files [concat $files [DoGlob $d $rest]] 297 } 298 298 } else { 299 300 301 302 303 304 299 if { [catch { 300 glob -nocomplain $pattern 301 } files] != 0 } { 302 puts stderr "can't glob \"$pattern\": $files" 303 return 304 } 305 305 } 306 306 return $files … … 310 310 # Glob -- 311 311 # 312 # 313 # 314 # 315 # 316 # 312 # Matches a single pattern for files. This differs from the 313 # Tcl glob by 314 # 315 # 1. Only matches files, not directories. 316 # 2. Doesn't stop on errors (e.g. unreadable directories). 317 317 # 318 318 itcl::body Rappture::FileChoiceEntry::Glob { pattern } { -
branches/blt4/gui/scripts/filelistentry.tcl
r1976 r2745 101 101 102 102 # Standard ButtonPress-1 103 $itk_component(tree) bind Entry <ButtonPress-1> { 103 $itk_component(tree) bind Entry <ButtonPress-1> { 104 104 Rappture::FileListEntry::SetSelectionAnchor %W current yes set 105 105 set blt::TreeView::_private(scroll) 1 … … 122 122 } 123 123 # Shift-ButtonPress-1 124 $itk_component(tree) bind Entry <Shift-ButtonPress-1> { 124 $itk_component(tree) bind Entry <Shift-ButtonPress-1> { 125 125 Rappture::FileListEntry::SetSelectionAnchor %W current yes set 126 126 set blt::TreeView::_private(scroll) 1 … … 146 146 set blt::TreeView::_private(scroll) 0 147 147 } 148 $itk_component(tree) bind Entry <Control-ButtonPress-1> { 148 $itk_component(tree) bind Entry <Control-ButtonPress-1> { 149 149 Rappture::FileListEntry::SetSelectionAnchor %W current no toggle 150 150 set blt::TreeView::_private(scroll) 1 … … 304 304 } 305 305 # Replace the template with the substituted value. 306 307 306 set files [Glob $glob] 307 set allfiles [concat $allfiles $files] 308 308 } 309 309 set first "" … … 402 402 set files "" 403 403 if { [llength $rest] > 0 } { 404 405 406 407 408 409 410 411 412 404 if { [catch { 405 glob -nocomplain -type d $pattern 406 } dirs] != 0 } { 407 puts stderr "can't glob \"$pattern\": $dirs" 408 return 409 } 410 foreach d $dirs { 411 set files [concat $files [DoGlob $d $rest]] 412 } 413 413 } else { 414 415 416 417 418 419 414 if { [catch { 415 glob -nocomplain $pattern 416 } files] != 0 } { 417 puts stderr "can't glob \"$pattern\": $files" 418 return 419 } 420 420 } 421 421 return $files … … 425 425 # Glob -- 426 426 # 427 # 428 # 429 # 430 # 431 # 427 # Matches a single pattern for files. This differs from the 428 # Tcl glob by 429 # 430 # 1. Only matches files, not directories. 431 # 2. Doesn't stop on errors (e.g. unreadable directories). 432 432 # 433 433 itcl::body Rappture::FileListEntry::Glob { pattern } { -
branches/blt4/gui/scripts/filexfer.tcl
r2173 r2745 343 343 foreach prog { 344 344 clientaction 345 345 /usr/lib/hubzero/clientaction 346 346 /apps/bin/clientaction 347 347 /apps/xvnc/bin/clientaction -
branches/blt4/gui/scripts/flowdial.tcl
r1923 r2745 151 151 if { $relval > 1.0 } { 152 152 set relval 1.0 153 } 153 } 154 154 set _current $relval 155 155 after cancel [itcl::code $this _redraw] -
branches/blt4/gui/scripts/flowhints.tcl
r1923 r2745 40 40 private method GetSize { obj path varName } 41 41 42 private variable _boxes ""; 43 private variable _particles ""; 44 private variable _hints; 42 private variable _boxes ""; # List of boxes for the flow. 43 private variable _particles ""; # List of particle injection planes. 44 private variable _hints; # Array of settings for the flow. 45 45 private variable _units "" 46 46 } … … 55 55 } 56 56 array set _hints { 57 "axis" 57 "axis" "x" 58 58 "description" "" 59 "outline" 60 "position" 61 "streams" 62 "arrows" 63 "volume" 64 "duration" 65 "speed" 59 "outline" "on" 60 "position" "0.0%" 61 "streams" "on" 62 "arrows" "off" 63 "volume" "on" 64 "duration" "1:00" 65 "speed" "1x" 66 66 } 67 67 set _units $units … … 84 84 array unset data 85 85 array set data { 86 "axis" 87 "color" 86 "axis" "x" 87 "color" "blue" 88 88 "description" "" 89 "hide" 89 "hide" "no" 90 90 "label" "" 91 "position" 92 "size" 91 "position" "0.0%" 92 "size" "1.2" 93 93 } 94 94 set p [$f element -as object $child] … … 115 115 array unset data 116 116 array set data { 117 "color" 117 "color" "green" 118 118 "description" "" 119 "hide" 120 "label" 121 "linewidth" 119 "hide" "no" 120 "label" "" 121 "linewidth" "2" 122 122 } 123 123 set b [$f element -as object $child] -
branches/blt4/gui/scripts/flowvisviewer.tcl
r2690 r2745 137 137 private variable _style2objs ;# maps tf back to list of 138 138 # dataobj-components using the tf. 139 private variable _obj2flow; 139 private variable _obj2flow; # Maps dataobj-component to a flow. 140 140 141 141 private variable _click ;# info used for rotate operations … … 230 230 psi 0 231 231 zoom 1.0 232 pan-x 233 pan-y 232 pan-x 0 233 pan-y 0 234 234 } 235 235 set _limits(vmin) 0.0 … … 237 237 238 238 array set _settings [subst { 239 $this-arrows 240 $this-currenttime 241 $this-duration 242 $this-loop 243 $this-pan-x 244 $this-pan-y 245 $this-phi 246 $this-play 247 $this-psi 248 $this-speed 249 $this-step 250 $this-streams 251 $this-theta 252 $this-volume 253 $this-xcutplane 254 $this-xcutposition 255 $this-ycutplane 256 $this-ycutposition 257 $this-zcutplane 258 $this-zcutposition 259 $this-zoom 239 $this-arrows 0 240 $this-currenttime 0 241 $this-duration 1:00 242 $this-loop 0 243 $this-pan-x $_view(pan-x) 244 $this-pan-y $_view(pan-y) 245 $this-phi $_view(phi) 246 $this-play 0 247 $this-psi $_view(psi) 248 $this-speed 500 249 $this-step 0 250 $this-streams 0 251 $this-theta $_view(theta) 252 $this-volume 1 253 $this-xcutplane 0 254 $this-xcutposition 0 255 $this-ycutplane 0 256 $this-ycutposition 0 257 $this-zcutplane 0 258 $this-zcutposition 0 259 $this-zoom $_view(zoom) 260 260 }] 261 261 … … 484 484 0,7 $itk_component(speed) -padx {2 3} 485 485 486 # 486 # 0,6 $itk_component(speedlabel) -padx {2 0} 487 487 blt::table configure $itk_component(flowcontrols) c* -resize none 488 488 blt::table configure $itk_component(flowcontrols) c4 -resize both … … 983 983 # Actually write the commands to the server socket. If it fails, we don't 984 984 # care. We're finished here. 985 SendBytes $_outbuf; 986 set _buffering 0; 987 set _outbuf ""; # Clear the buffer.985 SendBytes $_outbuf; 986 set _buffering 0; # Turn off buffering. 987 set _outbuf ""; # Clear the buffer. 988 988 } 989 989 … … 1116 1116 # ReceiveData -- 1117 1117 # 1118 # 1119 # 1120 # 1121 # 1122 # 1123 # 1124 # 1125 # 1118 # The procedure is the response from the render server to each "data 1119 # follows" command. The server sends back a "data" command invoked our 1120 # the slave interpreter. The purpose is to collect the min/max of the 1121 # volume sent to the render server. Since the client (flowvisviewer) 1122 # doesn't parse 3D data formats, we rely on the server (flowvis) to 1123 # tell us what the limits are. Once we've received the limits to all 1124 # the data we've sent (tracked by _recvObjs) we can then determine 1125 # what the transfer functions are for these # volumes. 1126 1126 # 1127 1127 # Note: There is a considerable tradeoff in having the server report … … 1275 1275 SendBytes $_outbuf 1276 1276 blt::busy release $itk_component(hull) 1277 set _buffering 0; 1278 set _outbuf ""; # Clear the buffer.1277 set _buffering 0; # Turn off buffering. 1278 set _outbuf ""; # Clear the buffer. 1279 1279 } 1280 1280 … … 1329 1329 phi 45 1330 1330 psi 0 1331 zoom 1332 pan-x 1333 pan-y 1331 zoom 1.0 1332 pan-x 0 1333 pan-y 0 1334 1334 } 1335 1335 if { $_first != "" } { … … 2073 2073 itcl::body Rappture::FlowvisViewer::BuildViewTab {} { 2074 2074 foreach { key value } { 2075 grid 2076 axes 2077 outline 2078 volume 2079 legend 2080 particles 2081 lic 2075 grid 0 2076 axes 0 2077 outline 1 2078 volume 1 2079 legend 1 2080 particles 1 2081 lic 1 2082 2082 } { 2083 2083 set _settings($this-$key) $value … … 2095 2095 -window $tab.ss.frame 2096 2096 pack $tab.ss -fill both -expand yes 2097 blt::tk::scrollbar $tab.ss.xs 2098 blt::tk::scrollbar $tab.ss.ys 2097 blt::tk::scrollbar $tab.ss.xs 2098 blt::tk::scrollbar $tab.ss.ys 2099 2099 set inner [blt::tk::frame $tab.ss.frame] 2100 2100 … … 2167 2167 itcl::body Rappture::FlowvisViewer::BuildVolumeTab {} { 2168 2168 foreach { key value } { 2169 light 2170 transp 2171 opacity 2172 thickness 2169 light 40 2170 transp 50 2171 opacity 100 2172 thickness 350 2173 2173 } { 2174 2174 set _settings($this-$key) $value … … 2183 2183 -window $tab.ss.frame 2184 2184 pack $tab.ss -fill both -expand yes 2185 blt::tk::scrollbar $tab.ss.xs 2186 blt::tk::scrollbar $tab.ss.ys 2185 blt::tk::scrollbar $tab.ss.xs 2186 blt::tk::scrollbar $tab.ss.ys 2187 2187 set inner [blt::tk::frame $tab.ss.frame] 2188 2188 $inner configure -borderwidth 4 … … 2270 2270 -window $tab.ss.frame 2271 2271 pack $tab.ss -fill both -expand yes 2272 blt::tk::scrollbar $tab.ss.xs 2273 blt::tk::scrollbar $tab.ss.ys 2272 blt::tk::scrollbar $tab.ss.xs 2273 blt::tk::scrollbar $tab.ss.ys 2274 2274 set inner [blt::tk::frame $tab.ss.frame] 2275 2275 $inner configure -borderwidth 4 … … 2379 2379 -window $tab.ss.frame 2380 2380 pack $tab.ss -fill both -expand yes 2381 blt::tk::scrollbar $tab.ss.xs 2382 blt::tk::scrollbar $tab.ss.ys 2381 blt::tk::scrollbar $tab.ss.xs 2382 blt::tk::scrollbar $tab.ss.ys 2383 2383 set inner [blt::tk::frame $tab.ss.frame] 2384 2384 $inner configure -borderwidth 4 … … 2430 2430 -font "Arial 9" 2431 2431 2432 label $inner.particles -text "Particles" 2433 label $inner.boxes -text "Boxes" 2432 label $inner.particles -text "Particles" -font "Arial 9 bold" 2433 label $inner.boxes -text "Boxes" -font "Arial 9 bold" 2434 2434 2435 2435 blt::table $inner \ … … 2685 2685 # for flow visualization. 2686 2686 # 2687 # 2688 # 2689 # 2690 # 2691 # 2692 # 2687 # $this flow play 2688 # $this flow stop 2689 # $this flow toggle 2690 # $this flow reset 2691 # $this flow pause 2692 # $this flow next 2693 2693 # 2694 2694 itcl::body Rappture::FlowvisViewer::flow { args } { -
branches/blt4/gui/scripts/heightmapviewer.tcl
r2690 r2745 75 75 private method AddImageControls { frame widget } 76 76 private method SetWaitVariable { value } { 77 77 set _getimage $value 78 78 } 79 79 private method GetWaitVariable {} { 80 80 return $_getimage 81 81 } 82 82 private method WaitForImage {} { 83 84 83 tkwait variable [itcl::scope _getimage] 84 return $_getimage 85 85 } 86 86 … … 117 117 private variable _resizePending 0 118 118 private variable _resizeLegendPending 0 119 private variable _frame 0; 119 private variable _frame 0; # Current frame number. 120 120 private variable _getimage 0; 121 121 private variable _downloadPopup … … 157 157 158 158 array set _downloadPopup { 159 160 159 format image 160 image_controls "" 161 161 } 162 162 # Initialize the view to some default parameters. … … 166 166 psi 0 167 167 zoom 1.0 168 pan-x 169 pan-y 168 pan-x 0 169 pan-y 0 170 170 } 171 171 foreach val {xmin xmax ymin ymax zmin zmax vmin vmax} { … … 173 173 } 174 174 array set _settings [subst { 175 $this-pan-x 176 $this-pan-y 177 $this-phi 178 $this-psi 179 $this-theta 180 $this-surface 181 $this-xcutplane 182 $this-xcutposition 183 $this-ycutplane 184 $this-ycutposition 185 $this-zcutplane 186 $this-zcutposition 187 $this-zoom 175 $this-pan-x $_view(pan-x) 176 $this-pan-y $_view(pan-y) 177 $this-phi $_view(phi) 178 $this-psi $_view(psi) 179 $this-theta $_view(theta) 180 $this-surface 1 181 $this-xcutplane 0 182 $this-xcutposition 0 183 $this-ycutplane 0 184 $this-ycutposition 0 185 $this-zcutplane 0 186 $this-zcutposition 0 187 $this-zoom $_view(zoom) 188 188 }] 189 189 … … 509 509 label $inner.summary -text "" -anchor w 510 510 pack $inner.summary -side top 511 512 513 514 515 516 511 radiobutton $inner.image -text "Image (PNG/JPEG/GIF)" \ 512 -variable \ 513 ::Rappture::HeightmapViewer::_downloadPopup(format) \ 514 -font "Arial 10 " \ 515 -value image 516 Rappture::Tooltip::for $inner.image "Save as image." 517 517 pack $inner.image -anchor w 518 518 button $inner.go -text [Rappture::filexfer::label download] \ 519 519 -command [lindex $args 0] 520 520 pack $inner.go -side bottom -pady 4 521 521 $inner.image select 522 522 } else { 523 523 set inner [$popup component inner] … … 527 527 set word [Rappture::filexfer::label downloadWord] 528 528 $inner.summary configure -text "$word $num in the following format:" 529 update idletasks ; 529 update idletasks ; # Fix initial sizes 530 530 return $popup 531 531 } … … 542 542 # dialog widget to it. 543 543 Rappture::Balloon $popup -title "Save as image..." \ 544 545 544 -deactivatecommand \ 545 [itcl::code $this SetWaitVariable 0] 546 546 set inner [$popup component inner] 547 547 AddImageControls $inner [lindex $args 0] 548 548 } else { 549 549 set inner [$popup component inner] 550 } 551 550 } 551 set _downloadPopup(image_controls) $inner 552 552 update 553 553 # Activate the popup and call for the output. 554 554 foreach { widget toolName plotName } $args break 555 555 SetWaitVariable 0 556 556 $popup activate $widget left 557 557 set bool [WaitForImage] 558 558 $popup deactivate 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 } 581 559 if { $bool } { 560 set inner $_downloadPopup(image_controls) 561 set fmt [$inner.format translate [$inner.format value]] 562 switch $fmt { 563 "jpg" { 564 $_image(download) export jpg -quality 100 \ 565 -data bytes 566 } 567 "png" { 568 $_image(download) export png -data bytes 569 } 570 "gif" { 571 $_image(download) export gif -data bytes 572 } 573 default { 574 return "" 575 } 576 } 577 return [list .$fmt $bytes] 578 } 579 } 580 } 581 return "" 582 582 } 583 583 default { … … 827 827 # care. We're finished here. 828 828 blt::busy hold $itk_component(hull) 829 SendBytes $_outbuf; 829 SendBytes $_outbuf; 830 830 blt::busy release $itk_component(hull) 831 831 832 832 # The "readyForNextFrame" variable throttles the sequence play rate. 833 833 global readyForNextFrame 834 set readyForNextFrame 0; 835 836 set _buffering 0; 837 set _outbuf ""; # Clear the buffer.834 set readyForNextFrame 0; # Don't advance to the next frame 835 # until we get an image. 836 set _buffering 0; # Turn off buffering. 837 set _outbuf ""; # Clear the buffer. 838 838 } 839 839 … … 861 861 phi 45 862 862 psi 0 863 zoom 864 pan-x 865 pan-y 863 zoom 1.0 864 pan-x 0 865 pan-y 0 866 866 } 867 867 if { $_first != "" } { … … 1233 1233 -window $tab.ss.frame 1234 1234 pack $tab.ss -fill both -expand yes 1235 blt::tk::scrollbar $tab.ss.xs 1236 blt::tk::scrollbar $tab.ss.ys 1235 blt::tk::scrollbar $tab.ss.xs 1236 blt::tk::scrollbar $tab.ss.ys 1237 1237 set inner [blt::tk::frame $tab.ss.frame] 1238 1238 $inner configure -borderwidth 4 1239 1239 1240 1240 foreach { key value } { 1241 grid 1242 axes 1243 contourlines 1244 wireframe 1245 legend 1241 grid 1 1242 axes 0 1243 contourlines 1 1244 wireframe fill 1245 legend 1 1246 1246 } { 1247 1247 set _settings($this-$key) $value … … 1305 1305 -window $tab.ss.frame 1306 1306 pack $tab.ss -fill both -expand yes 1307 blt::tk::scrollbar $tab.ss.xs 1308 blt::tk::scrollbar $tab.ss.ys 1307 blt::tk::scrollbar $tab.ss.xs 1308 blt::tk::scrollbar $tab.ss.ys 1309 1309 set inner [blt::tk::frame $tab.ss.frame] 1310 1310 $inner configure -borderwidth 4 -
branches/blt4/gui/scripts/histogram.tcl
r2518 r2745 42 42 private variable _widths ;# array of vectors of bin widths 43 43 private variable _yvalues ;# array of vectors of bin heights along 44 44 ;# y-axis. 45 45 private variable _xvalues ;# array of vectors of bin locations along 46 46 ;# x-axis. 47 47 private variable _xlabels ;# array of labels 48 48 private variable _hints ;# cache of hints stored in XML … … 84 84 itcl::body Rappture::Histogram::mesh { comp } { 85 85 if { [info exists _xvalues($comp)] } { 86 86 return $_xvalues($comp) 87 87 } 88 88 return "" … … 96 96 itcl::body Rappture::Histogram::values { comp } { 97 97 if { [info exists _yvalues($comp)] } { 98 98 return $_yvalues($comp) 99 99 } 100 100 return "" … … 110 110 itcl::body Rappture::Histogram::widths { comp } { 111 111 if { [info exists _widths($comp)] } { 112 112 return $_widths($comp) 113 113 } 114 114 return "" … … 124 124 itcl::body Rappture::Histogram::xlabels { comp } { 125 125 if { [info exists _xlabels($comp)] } { 126 126 return $_xlabels($comp) 127 127 } 128 128 return "" … … 314 314 # 315 315 foreach cname [$_hist children -type component] { 316 316 ParseData $cname 317 317 } 318 318 # Creates lists of x and y marker data. … … 338 338 # ParseData -- 339 339 # 340 # 341 # 342 # 340 # Parse the components data representations. The following 341 # elements may be used <xy>, <xhw>, <namevalue>, <xvector>, 342 # <yvector>. Only one element is used for data. 343 343 # 344 344 itcl::body Rappture::Histogram::ParseData { comp } { … … 351 351 set xydata [$_hist get ${comp}.xy] 352 352 if { $xydata != "" } { 353 353 set count 0 354 354 foreach line [split $xydata \n] { 355 356 357 358 359 360 }361 362 355 foreach {name value} $line break 356 $_yvalues($comp) append $value 357 $_xvalues($comp) append $count 358 lappend _xlabels($comp) $name 359 incr count 360 } 361 set _comp2hist($comp) [list $_xvalues($comp) $_yvalues($comp)] 362 return 363 363 } 364 364 set xhwdata [$_hist get ${comp}.xhw] 365 365 if { $xhwdata != "" } { 366 366 set count 0 367 367 foreach line [split $xhwdata \n] { 368 368 set n [scan $line {%s %s %s} name h w] 369 370 371 369 lappend _xlabels($comp) $name 370 $_xvalues($comp) append $count 371 $_yvalues($comp) append $h 372 372 if { $n == 3 } { 373 373 $_widths($comp) append $w 374 374 } 375 376 }377 378 375 incr count 376 } 377 set _comp2hist($comp) [list $_xvalues($comp) $_yvalues($comp)] 378 return 379 379 380 380 # FIXME: There must be a width specified for each bin location. 381 # 382 # 381 # If this isn't true, we default to uniform widths 382 # (zero-length _widths vector == uniform). 383 383 if { [$_xvalues($comp) length] != [$_widths($comp) length] } { 384 384 $_widths($comp) set {} 385 385 } 386 387 386 set _comp2hist($comp) [list $_xvalues($comp) $_yvalues($comp)] 387 return 388 388 } 389 389 set xv [$_hist get $comp.xvector] 390 390 set yv [$_hist get $comp.yvector] 391 391 if { $xv != "" && $yv != "" } { 392 393 394 392 $_yvalues($comp) set $yv 393 $_xvalues($comp) seq 0 [$yv length] 394 set _xlabels($comp) 395 395 } 396 396 set _comp2hist($comp) [list $_xvalues($comp) $_yvalues($comp)] … … 399 399 itcl::body Rappture::Histogram::Clear { {comp ""} } { 400 400 if { $comp == "" } { 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 401 foreach name [array names _widths] { 402 blt::vector destroy $_widths($name) 403 } 404 array unset _widths 405 foreach name [array names _yvalues] { 406 blt::vector destroy $_yvalues($name) 407 } 408 array unset _yvalues 409 foreach name [array names _xvalues] { 410 blt::vector destroy $_xvalues($name) 411 } 412 array unset _xvalues 413 array unset _xlabels 414 array unset _comp2hist 415 return 416 416 } 417 417 if { [info exists _widths($comp)] } { 418 418 blt::vector destroy $_widths($comp) 419 419 } 420 420 if { [info exists _yvalues($comp)] } { 421 421 blt::vector destroy $_yvalues($comp) 422 422 } 423 423 if { [info exists _xvalues($comp)] } { 424 424 blt::vector destroy $_xvalues($comp) 425 425 } 426 426 array unset _xvalues $comp -
branches/blt4/gui/scripts/histogramresult.tcl
r2560 r2745 363 363 foreach obj $_dlist { 364 364 if {[info exists _dataobj2raise($obj)] && $_dataobj2raise($obj)} { 365 366 367 368 365 lappend top $obj 366 } else { 367 lappend bottom $obj 368 } 369 369 } 370 370 set _dlist [concat $bottom $top] … … 689 689 foreach {mapx mapy} [GetAxes $dataobj] break 690 690 foreach comp [$dataobj components] { 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 691 set xv [$dataobj mesh $comp] 692 set yv [$dataobj values $comp] 693 set zv [$dataobj widths $comp] 694 if {$xv eq "" || $yv eq "" || $zv eq ""} { 695 continue 696 } 697 if {[info exists _dataobj2color($dataobj)]} { 698 set color $_dataobj2color($dataobj) 699 } else { 700 set color [$dataobj hints color] 701 if {"" == $color} { 702 set color black 703 } 704 } 705 if {[info exists _dataobj2width($dataobj)]} { 706 set lwidth $_dataobj2width($dataobj) 707 } else { 708 set lwidth 2 709 } 710 if {[info exists _dataobj2dashes($dataobj)]} { 711 set dashes $_dataobj2dashes($dataobj) 712 } else { 713 set dashes "" 714 } 715 if {([$xv length] <= 1) || ($lwidth == 0)} { 716 set sym square 717 set pixels 2 718 } else { 719 set sym "" 720 set pixels 6 721 } 722 # Compute default bar width for histogram elements. 723 if { [$zv length] == [$xv length] } { 724 foreach x [$xv values] y [$yv values] z [$zv values] { 725 set elem "elem[incr count]" 726 set _elem2dataobj($elem) $dataobj 727 $g element create $elem -x $x -y $y -barwidth $z \ 728 -label $label -foreground $color \ 729 -mapx $mapx -mapy $mapy 730 } 731 } else { 732 set r [blt::vector expr {max($xv) - min($xv)}] 733 set z [expr {$r / ([$xv length]-1) * 0.8}] 734 set elem "elem[incr count]" 735 set _elem2dataobj($elem) $dataobj 736 $g element create $elem -x $xv -y $yv -barwidth $z \ 737 737 -label $label -foreground $color \ 738 738 -mapx $mapx -mapy $mapy 739 740 741 742 743 744 745 746 747 748 739 } 740 set index 0 741 foreach label [$dataobj xlabels $comp] { 742 if { [string length $label] > 3 } { 743 set invert 1 744 } 745 set _xlabels($index) $label 746 incr index 747 } 748 } 749 749 } 750 750 foreach dataobj $_dlist { 751 752 753 754 755 756 751 set xmin -Inf 752 set ymin -Inf 753 set xmax Inf 754 set ymax Inf 755 # 756 # Create text/line markers for each *axis.marker specified. 757 757 # 758 758 foreach m [$dataobj xmarkers] { … … 799 799 set stepsize 1.0 800 800 if { [array size _xlabels] > 0 } { 801 801 set command [itcl::code $this FormatLabels] 802 802 if { [array size _xlabels] > 20 } { 803 803 set stepsize 0.0 804 804 } 805 805 } else { 806 806 set command "" 807 807 } 808 808 $g axis configure x -command $command -stepsize $stepsize … … 820 820 set g $itk_component(plot) 821 821 foreach axis [$g axis names] { 822 822 $g axis configure $axis -min "" -max "" 823 823 } 824 824 } … … 876 876 set results [$g element closest $x $y -interpolate no] 877 877 if { $results != "" } { 878 878 array set info $results 879 879 880 880 set x [$g axis transform $mapx $info(x)] … … 895 895 append tip " @ $xval" 896 896 set tip [string trim $tip] 897 897 set index $info(index) 898 898 } 899 899 set state 1 … … 915 915 set x [$g axis transform $mapx $info(x)] 916 916 set y [$g axis transform $mapy $info(y)] 917 918 919 920 921 917 if { [$g cget -invertxy] } { 918 set tmp $x 919 set x $y 920 set y $tmp 921 } 922 922 if {[info exists _elem2dataobj($elem)]} { 923 923 set dataobj $_elem2dataobj($elem) … … 934 934 append tip " @ $xval" 935 935 set tip [string trim $tip] 936 936 set index $info(index) 937 937 set state 1 938 938 } else { … … 954 954 Rappture::Tooltip::tooltip cancel 955 955 } 956 957 958 959 956 if { $index != "" } { 957 $g element activate $elem $index 958 set _hilite(index) $index 959 } 960 960 set _hilite(elem) $elem 961 961 … … 1111 1111 foreach { axis x y } $args break 1112 1112 set g $itk_component(plot) 1113 1114 1115 1116 1117 1113 if { [$g cget -invertxy] } { 1114 set tmp $x 1115 set x $y 1116 set y $tmp 1117 } 1118 1118 1119 1119 set _axis(moved) 0 … … 1134 1134 foreach { axis x y } $args break 1135 1135 set g $itk_component(plot) 1136 1137 1138 1139 1140 1136 if { [$g cget -invertxy] } { 1137 set tmp $x 1138 set x $y 1139 set y $tmp 1140 } 1141 1141 1142 1142 if {[info exists _axis(click-x)] && [info exists _axis(click-y)]} { … … 1195 1195 foreach { axis x y } $args break 1196 1196 set g $itk_component(plot) 1197 1198 1199 1200 1201 1197 if { [$g cget -invertxy] } { 1198 set tmp $x 1199 set x $y 1200 set y $tmp 1201 } 1202 1202 1203 1203 if {!$_axis(moved)} { … … 1407 1407 set axis [lindex $args 0] 1408 1408 set value [lindex $args 2] 1409 1410 1411 1409 if { $axis == "x" } { 1410 return [FormatLabels $itk_component(plot) $value] 1411 } 1412 1412 if {[$itk_component(plot) axis cget $axis -logscale]} { 1413 1413 set fmt "%.6g" … … 1585 1585 set index [expr round($value)] 1586 1586 if { [info exists _xlabels($index)] } { 1587 1587 return $_xlabels($index) 1588 1588 } 1589 1589 return " " -
branches/blt4/gui/scripts/icons.tcl
r1923 r2745 87 87 return "" 88 88 } 89 } 89 } 90 90 return $bytes 91 91 } -
branches/blt4/gui/scripts/imageentry.tcl
r1932 r2745 176 176 set fmt [$_owner xml get $_path.convert] 177 177 if {"" != $fmt && "" != $_imh} { 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 178 switch -- $fmt { 179 "pgm" - "ppm" { 180 $_imh export pbm -data bytes 181 } 182 "jpeg" { 183 $_imh export jpg -data bytes 184 } 185 "tiff" { 186 $_imh export tif -data bytes 187 } 188 "bmp" - "png" - "xbm" - "xpm" { 189 $_imh export $fmt -data bytes 190 } 191 default { 192 error "unknown image format \"$fmt\"" 193 } 194 } 195 195 } 196 196 return $bytes -
branches/blt4/gui/scripts/imageresult.tcl
r2048 r2745 43 43 private method AddImageControls { frame widget } 44 44 private method SetWaitVariable { value } { 45 45 set _getimage $value 46 46 } 47 47 private method GetWaitVariable {} { 48 48 return $_getimage 49 49 } 50 50 private method WaitForImage {} { 51 52 51 tkwait variable [itcl::scope _getimage] 52 return $_getimage 53 53 } 54 54 … … 84 84 } 85 85 array set _downloadPopup { 86 87 86 format image 87 image_controls "" 88 88 } 89 89 … … 330 330 label $inner.summary -text "" -anchor w 331 331 pack $inner.summary -side top 332 333 334 335 336 337 332 radiobutton $inner.image -text "Image (PNG/JPEG/GIF)" \ 333 -variable \ 334 ::Rappture::ImageResult::_downloadPopup(format) \ 335 -font "Arial 10 " \ 336 -value image 337 Rappture::Tooltip::for $inner.image "Save as image." 338 338 pack $inner.image -anchor w 339 339 button $inner.go -text [Rappture::filexfer::label download] \ 340 340 -command [lindex $args 0] 341 341 pack $inner.go -side bottom -pady 4 342 342 $inner.image select 343 343 } else { 344 344 set inner [$popup component inner] … … 348 348 set word [Rappture::filexfer::label downloadWord] 349 349 $inner.summary configure -text "$word $num in the following format:" 350 update idletasks ; 350 update idletasks ; # Fix initial sizes 351 351 return $popup 352 352 } … … 358 358 switch -- $_downloadPopup(format) { 359 359 "image" { 360 361 362 363 364 360 set top [_top image] 361 set top [_top image] 362 if {$top == ""} { 363 return "" 364 } 365 365 set popup .imageresultimage 366 366 if { ![winfo exists $popup] } { … … 368 368 # dialog widget to it. 369 369 Rappture::Balloon $popup -title "Save as image..." \ 370 371 370 -deactivatecommand \ 371 [itcl::code $this SetWaitVariable 0] 372 372 set inner [$popup component inner] 373 373 AddImageControls $inner [lindex $args 0] 374 374 } else { 375 375 set inner [$popup component inner] 376 } 377 376 } 377 set _downloadPopup(image_controls) $inner 378 378 update 379 379 # Activate the popup and call for the output. 380 380 foreach { widget toolName plotName } $args break 381 381 SetWaitVariable 0 382 382 $popup activate $widget left 383 383 set bool [WaitForImage] 384 384 $popup deactivate 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 } 406 385 if { $bool } { 386 set inner $_downloadPopup(image_controls) 387 set fmt [$inner.format translate [$inner.format value]] 388 switch $fmt { 389 "jpg" { 390 $top export jpg -quality 100 -data bytes 391 } 392 "png" { 393 $top export png -data bytes 394 } 395 "gif" { 396 $top export gif -data bytes 397 } 398 default { 399 return "" 400 } 401 } 402 return [list .$fmt $bytes] 403 } 404 } 405 } 406 return "" 407 407 } 408 408 default { -
branches/blt4/gui/scripts/isomarker.tcl
r2173 r2745 18 18 19 19 itcl::class Rappture::IsoMarker { 20 private variable _value 0.0;# Absolute value of marker.21 private variable _label 22 private variable _tick 23 private variable _canvas 24 private variable _nvobj "";# Parent nanovis object.25 private variable _tf "";# Transfer function that this marker is20 private variable _value 0.0; # Absolute value of marker. 21 private variable _label "" 22 private variable _tick "" 23 private variable _canvas "" 24 private variable _nvobj ""; # Parent nanovis object. 25 private variable _tf ""; # Transfer function that this marker is 26 26 # associated with. 27 27 private variable _activeMotion 0 … … 118 118 set limits(max) 1.0 119 119 } 120 121 122 }120 if { [catch {expr $limits(vmax) - $limits(vmin)} r] != 0 } { 121 return 0.0 122 } 123 123 absval [expr {($x * $r) + $limits(vmin)}] 124 124 } -
branches/blt4/gui/scripts/loader.tcl
r2242 r2745 243 243 set str [$_owner xml get $path.default] 244 244 if { $str != "" } { 245 245 bind $itk_component(hull) <Map> [itcl::code $this SetDefaultValue $str] 246 246 } 247 247 } … … 323 323 # SetDefaultValue -- 324 324 # 325 # 326 # 327 # 328 # 329 # 330 # 331 # 332 # 325 # Sets the designated default value for the loader. This must be done 326 # after the entire application is assembled, otherwise the default 327 # values set up by the loader will be overwritten by the various widgets 328 # themselves when they try to set their default values. 329 # 330 # This is called from a <Map> event to the loader (combobox). This 331 # will get trigger the first time the loader is displayed. The binding 332 # is then removed. 333 333 # 334 334 itcl::body Rappture::Loader::SetDefaultValue { value } { -
branches/blt4/gui/scripts/main.tcl
r2535 r2745 299 299 300 300 if { $style != "wizard" } { 301 302 303 304 305 306 301 # If only two windows and they're small enough, put them up 302 # side-by-side 303 if {$w0+$w1 < $screenw } { 304 $win.pager configure -arrangement side-by-side 305 $f.analyze configure -holdwindow [$win.pager page @0] 306 } 307 307 } 308 308 set type [$tool xml get tool.control] 309 309 if {$type == ""} { 310 310 set type [$tool xml get tool.control.type] 311 311 } 312 312 set arrangement [$win.pager cget -arrangement] … … 317 317 } 318 318 if { $arrangement != "side-by-side" && 319 320 321 319 ($type == "manual" || $type == "auto" || $style == "wizard") } { 320 # in "auto" mode, we don't need a simulate button 321 $f.analyze configure -simcontrol off 322 322 } else { 323 324 323 # not in "auto" mode but side-by-side, we always need the button 324 $f.analyze configure -simcontrol on 325 325 } 326 326 } elseif {[llength [$win.pager page]] > 2} { -
branches/blt4/gui/scripts/molvisviewer.tcl
r2742 r2745 43 43 private variable _icon 0 44 44 private variable _getimage 0 45 private variable _mevent; 46 private variable _rocker; 47 private variable _dlist ""; 48 private variable _dataobjs; 45 private variable _mevent; # info used for mouse event operations 46 private variable _rocker; # info used for rock operations 47 private variable _dlist ""; # list of dataobj objects 48 private variable _dataobjs; # data objects on server 49 49 private variable _dobj2transparency;# maps dataobj => transparency 50 private variable _dobj2raise; 51 52 private variable _active; 53 private variable _obj2models; 50 private variable _dobj2raise; # maps dataobj => raise flag 0/1 51 52 private variable _active; # array of active models. 53 private variable _obj2models; # array containing list of models 54 54 # for each data object. 55 55 private variable _view … … 66 66 private variable _cacheimage "" 67 67 68 private common _settings ; 68 private common _settings ; # Array of settings for all known 69 69 # widgets 70 70 private variable _initialized 71 71 72 private common _downloadPopup; 73 private variable _pdbdata; 72 private common _downloadPopup; # Download options from popup 73 private variable _pdbdata; # PDB data from run file sent to pymol 74 74 private common _hardcopy 75 75 private variable _nextToken 0 … … 81 81 private variable _width 82 82 private variable _height 83 private variable _reset 1; 84 private variable _cell 0; 83 private variable _reset 1; # Restore camera settings 84 private variable _cell 0; # Restore camera settings 85 85 private variable _flush 1 86 86 … … 108 108 private method AddImageControls { frame widget } 109 109 private method SetWaitVariable { value } { 110 110 set _getimage $value 111 111 } 112 112 private method WaitForResponse {} { 113 114 113 tkwait variable [itcl::scope _getimage] 114 return $_getimage 115 115 } 116 116 protected method Map {} … … 212 212 phi 45 213 213 psi 0 214 vx 215 vy 216 vz 217 zoom 218 mx 219 my 220 mz 221 x 222 y 223 z 224 width 214 vx 0 215 vy 0 216 vz 0 217 zoom 0 218 mx 0 219 my 0 220 mz 0 221 x 0 222 y 0 223 z 0 224 width 0 225 225 height 0 226 226 } … … 237 237 $this-rock no 238 238 $this-showlabels no 239 $this-showcell 239 $this-showcell yes 240 240 $this-showlabels-initialized no 241 241 }] … … 573 573 set inner [$popup component inner] 574 574 label $inner.summary -text "" -anchor w 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 575 radiobutton $inner.pdb \ 576 -text "PDB Protein Data Bank Format File" \ 577 -variable [itcl::scope _downloadPopup(format)] \ 578 -font "Arial 10 " \ 579 -value pdb 580 Rappture::Tooltip::for $inner.pdb \ 581 "Save as PDB Protein Data Bank format file." 582 radiobutton $inner.image -text "Image (PNG/JPEG/GIF)" \ 583 -variable [itcl::scope _downloadPopup(format)] \ 584 -font "Arial 10 " \ 585 -value image 586 Rappture::Tooltip::for $inner.image \ 587 "Save as image." 588 set f [frame $inner.frame] 589 button $f.ok -text "Save" \ 590 -highlightthickness 0 -pady 3 -padx 3 \ 591 591 -command [lindex $args 0] \ 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 592 -compound left \ 593 -image [Rappture::icon download] 594 button $f.cancel -text "Cancel" \ 595 -highlightthickness 0 -pady 3 -padx 3 \ 596 -command [list $popup deactivate] \ 597 -compound left \ 598 -image [Rappture::icon cancel] 599 blt::table $f \ 600 0,0 $f.ok \ 601 0,1 $f.cancel 602 blt::table $inner \ 603 0,0 $inner.summary -anchor w \ 604 1,0 $inner.pdb -anchor w \ 605 2,0 $inner.image -anchor w \ 606 3,0 $f -fill x -pady 4 607 $inner.pdb select 608 608 } else { 609 609 set inner [$popup component inner] … … 613 613 set word [Rappture::filexfer::label downloadWord] 614 614 $inner.summary configure -text "$word $num in the following format:" 615 update idletasks ; 615 update idletasks ; # Fix initial sizes 616 616 return $popup 617 617 } … … 624 624 "pdb" { 625 625 return [list .pdb $_pdbdata] 626 626 } 627 627 "image" { 628 628 set popup .molvisviewerimage … … 631 631 # dialog widget to it. 632 632 Rappture::Balloon $popup -title "Save as image..." \ 633 634 633 -deactivatecommand \ 634 [itcl::code $this SetWaitVariable 0] 635 635 set inner [$popup component inner] 636 636 # Add image controls to the ballon popup 637 637 AddImageControls $inner [lindex $args 0] 638 638 } else { 639 639 set inner [$popup component inner] 640 } 640 } 641 641 update 642 642 # Activate the popup and call for the output. 643 643 foreach { widget toolName plotName } $args break 644 644 SetWaitVariable 0 645 645 $popup activate $widget left 646 646 set bool [WaitForResponse] 647 647 $popup deactivate 648 649 650 651 652 648 if { $bool } { 649 return [GetImage $widget] 650 } 651 return "" 652 } 653 653 } 654 654 } … … 789 789 -window $tab.ss.frame 790 790 pack $tab.ss -fill both -expand yes 791 blt::tk::scrollbar $tab.ss.xs 792 blt::tk::scrollbar $tab.ss.ys 791 blt::tk::scrollbar $tab.ss.xs 792 blt::tk::scrollbar $tab.ss.ys 793 793 set inner [blt::tk::frame $tab.ss.frame] 794 794 … … 799 799 800 800 itk_component add representation { 801 801 Rappture::Combobox $inner.rep -width 20 -editable no 802 802 } 803 803 $inner.rep choices insert end \ 804 804 "ballnstick" "ball and stick" \ 805 805 "spheres" "spheres" \ 806 "sticks" "sticks" 807 "lines" "lines" 808 "cartoon" "cartoon" 806 "sticks" "sticks" \ 807 "lines" "lines" \ 808 "cartoon" "cartoon" 809 809 810 810 bind $inner.rep <<Value>> [itcl::code $this Representation] … … 858 858 859 859 checkbutton $inner.cell -text "Parallelepiped" \ 860 860 -command [itcl::code $this Cell toggle] \ 861 861 -font "Arial 9" 862 862 $inner.cell select … … 868 868 2,0 $inner.ortho -anchor w -pady {1 0} \ 869 869 3,0 $inner.cartoontrace -anchor w -pady {1 0} \ 870 870 4,0 $inner.cell -anchor w -pady {1 0} \ 871 871 5,0 $inner.rep_l -anchor w -pady { 2 0 } \ 872 872 6,0 $inner.rep -anchor w \ … … 917 917 if { ![info exists _mlist($model)] } { # new, turn on 918 918 set _mlist($model) 2 919 } elseif { $_mlist($model) == 1 } { 919 } elseif { $_mlist($model) == 1 } { # on, leave on 920 920 set _mlist($model) 3 921 } elseif { $_mlist($model) == 0 } { 921 } elseif { $_mlist($model) == 0 } { # off, turn on 922 922 set _mlist($model) 2 923 923 } … … 1020 1020 } 1021 1021 set _dataobjs($model-$state) 1 1022 1022 } 1023 1023 } 1024 1024 if { ![info exists _model($model-transparency)] } { … … 1038 1038 } 1039 1039 set vector [$dataobj get components.parallelepiped.vector] 1040 1041 1042 1043 1044 1045 1046 1047 } 1048 1040 if { $vector != "" } { 1041 set vertices [ComputeParallelepipedVertices $dataobj] 1042 SendCmd "raw -defer {verts = \[$vertices\]\n}" 1043 SendCmd "raw -defer {run \$PYMOL_SITE_PATH/rappture/box.py\n}" 1044 SendCmd "raw -defer {draw_box(verts)\n}" 1045 set _cell 1 1046 } 1047 } 1048 1049 1049 # enable/disable models as required (0=off->off, 1=on->off, 2=off->on, 1050 1050 # 3=on->on) … … 1135 1135 set inner $tab.ss.frame 1136 1136 if { $_cell } { 1137 1137 $inner.cell configure -state normal 1138 1138 } else { 1139 1139 $inner.cell configure -state disabled 1140 1140 } 1141 1141 if { $flush } { 1142 1142 global readyForNextFrame 1143 set readyForNextFrame 0; 1143 set readyForNextFrame 0; # Don't advance to the next frame 1144 1144 # until we get an image. 1145 #SendCmd "ppm"; 1146 1147 } 1148 set _buffering 0; 1145 #SendCmd "ppm"; # Flush the results. 1146 set _flush 0 1147 } 1148 set _buffering 0; # Turn off buffering. 1149 1149 1150 1150 blt::busy hold $itk_component(hull) … … 1152 1152 # Actually write the commands to the server socket. 1153 1153 # If it fails, we don't care. We're finished here. 1154 SendBytes $_outbuf; 1155 set _outbuf ""; # Clear the buffer.1154 SendBytes $_outbuf; 1155 set _outbuf ""; # Clear the buffer. 1156 1156 blt::busy release $itk_component(hull) 1157 1157 … … 1244 1244 set _view(x) [expr $_view(x) + $dx] 1245 1245 set _view(y) [expr $_view(y) + $dy] 1246 1246 array unset _imagecache 1247 1247 SendCmd "pan $dx $dy" 1248 1248 return … … 1259 1259 set _view(x) [expr $_view(x) + $dx] 1260 1260 set _view(y) [expr $_view(y) + $dy] 1261 1261 array unset _imagecache 1262 1262 SendCmd "pan $dx $dy" 1263 1263 } … … 1425 1425 set _view(mz) [expr {$_view(mz) + $mz}] 1426 1426 #SendCmd "rotate $mx $my $mz" 1427 1427 EventuallyRotate $mx $my $mz 1428 1428 debug "_vmmouse: rotate $_view(mx) $_view(my) $_view(mz)" 1429 1429 } … … 1521 1521 vz $vz 1522 1522 }] 1523 1523 EventuallyRotate $a $b $c 1524 1524 #SendCmd "rotate $a $b $c" 1525 1525 debug "Rotate $x $y: rotate $_view(vx) $_view(vy) $_view(vz)" … … 1548 1548 itcl::body Rappture::MolvisViewer::Representation { { option "" } } { 1549 1549 if { $option == "" } { 1550 1551 1550 set value [$itk_component(representation) value] 1551 set option [$itk_component(representation) translate $value] 1552 1552 } 1553 1553 if { $option == $_mrep } { … … 1643 1643 "on" - "off" { 1644 1644 set cell $option 1645 1645 } 1646 1646 "toggle" { 1647 1647 set cell [expr {$_settings($this-showcell) == 0}] … … 1855 1855 # ---------------------------------------------------------------------- 1856 1856 # USAGE: StickRadius radius ?models? 1857 # 1857 # StickRadius update ?models? 1858 1858 # 1859 1859 # Used internally to change the stick radius used to render … … 1891 1891 # ---------------------------------------------------------------------- 1892 1892 # USAGE: Opacity value ?models? 1893 # 1893 # Opacity update ?models? 1894 1894 # 1895 1895 # Used internally to change the opacity (transparency) used to render … … 1922 1922 SendCmd "transparency -model all $overridetransparency" 1923 1923 foreach model $models { 1924 1924 SendCmd "transparency -model $model $transparency" 1925 1925 } 1926 1926 } … … 2018 2018 set f [frame $inner.frame] 2019 2019 button $f.ok -text "Save" \ 2020 2021 2022 2023 2020 -highlightthickness 0 -pady 3 -padx 3 \ 2021 -command [itcl::code $this SetWaitVariable 1] \ 2022 -compound left \ 2023 -image [Rappture::icon download 2024 2024 ] 2025 2025 button $f.cancel -text "Cancel" \ 2026 2027 2028 2029 2026 -highlightthickness 0 -pady 3 -padx 3 \ 2027 -command [itcl::code $this SetWaitVariable 0] \ 2028 -compound left \ 2029 -image [Rappture::icon cancel] 2030 2030 blt::table $f \ 2031 2032 2031 0,0 $f.ok \ 2032 0,1 $f.cancel 2033 2033 2034 2034 blt::table $inner \ … … 2073 2073 # Create a vector for every 3D point 2074 2074 blt::vector point0(3) point1(3) point2(3) point3(3) point4(3) point5(3) \ 2075 2075 point6(3) point7(3) origin(3) scale(3) 2076 2076 2077 2077 set count 0 2078 2078 set parent [$dataobj element -as object "components.parallelepiped"] 2079 2079 foreach child [$parent children] { 2080 2081 2082 2083 2084 2085 2086 2080 if { ![string match "vector*" $child] } { 2081 continue 2082 } 2083 incr count 2084 set values [$parent get $child] 2085 regexp -all {,} $values { } values 2086 point$count set $values 2087 2087 } 2088 2088 itcl::delete object $parent 2089 2089 if { $count < 1 || $count > 3 } { 2090 2090 error "bad number of vectors supplied to parallelepiped" 2091 2091 } 2092 2092 point0 set { 0.0 0.0 0.0 } … … 2100 2100 scale set { 1.0 1.0 1.0 } 2101 2101 if { $n == 1 } { 2102 2102 set scale(0:2) [lindex $values 0] 2103 2103 } elseif { $n == 2 } { 2104 2104 set scale(0:1) [lindex $values 0] 2105 2105 } elseif { $n == 3 } { 2106 2106 scale set $values 2107 2107 } 2108 2108 set values [$dataobj get components.parallelepiped.origin] … … 2110 2110 origin set { 0.0 0.0 0.0 } 2111 2111 if { $n == 1 } { 2112 2112 set origin(0) [lindex $values 0] 2113 2113 } elseif { $n == 2 } { 2114 2115 2114 set origin(0) [lindex $values 0] 2115 set origin(1) [lindex $values 1] 2116 2116 } elseif { $n == 3 } { 2117 2117 origin set $values 2118 2118 } 2119 2119 2120 2120 # Scale and translate points 2121 2121 for { set i 0 } { $i < 8 } { incr i } { 2122 2122 point${i} expr "(point${i} * scale) + origin" 2123 2123 } 2124 2124 … … 2126 2126 set vertices "" 2127 2127 foreach n { 0 1 0 2 0 3 1 4 2 4 2 6 1 7 3 7 5 7 4 5 3 6 5 } { 2128 2129 2128 set values [point${n} values] 2129 append vertices "\[ [join $values {, }] \], \\\n" 2130 2130 } 2131 2131 set values [point6 values] 2132 2132 append vertices "\[ [join $values {, }] \] \\\n" 2133 2133 blt::vector destroy point0 point1 point2 point3 point4 point5 point6 \ 2134 2134 point7 origin scale 2135 2135 return $vertices 2136 2136 } -
branches/blt4/gui/scripts/nanovisviewer.tcl
r2742 r2745 19 19 # 20 20 # FIXME: 21 # 22 # 23 # 24 # 21 # Need to Add DX readers this client to examine the data before 22 # it's sent to the server. This will eliminate 90% of the insanity in 23 # computing the limits of all the volumes. I can rip out all the 24 # "receive data" "send transfer function" event crap. 25 25 # 26 26 # This means we can compute the transfer function (relative values) and 27 # 28 # 29 # 30 # 31 # 27 # draw the legend min/max values without waiting for the information to 28 # come from the server. This will also prevent the flashing that occurs 29 # when a new volume is drawn (using the default transfer function) and 30 # then when the correct transfer function has been sent and linked to 31 # the volume. 32 32 # 33 33 option add *NanovisViewer.width 4i widgetDefault … … 121 121 private method AddImageControls { frame widget } 122 122 private method SetWaitVariable { value } { 123 123 set _getimage $value 124 124 } 125 125 private method GetWaitVariable {} { 126 126 return $_getimage 127 127 } 128 128 private method WaitForImage {} { 129 130 129 tkwait variable [itcl::scope _getimage] 130 return $_getimage 131 131 } 132 132 … … 215 215 psi 0 216 216 zoom 1.0 217 pan-x 218 pan-y 217 pan-x 0 218 pan-y 0 219 219 } 220 220 set _limits(vmin) 0.0 … … 222 222 223 223 array set _settings [subst { 224 $this-pan-x 225 $this-pan-y 226 $this-phi 227 $this-psi 228 $this-theta 229 $this-volume 230 $this-xcutplane 231 $this-xcutposition 232 $this-ycutplane 233 $this-ycutposition 234 $this-zcutplane 235 $this-zcutposition 236 $this-zoom 224 $this-pan-x $_view(pan-x) 225 $this-pan-y $_view(pan-y) 226 $this-phi $_view(phi) 227 $this-psi $_view(psi) 228 $this-theta $_view(theta) 229 $this-volume 1 230 $this-xcutplane 0 231 $this-xcutposition 0 232 $this-ycutplane 0 233 $this-ycutposition 0 234 $this-zcutplane 0 235 $this-zcutposition 0 236 $this-zoom $_view(zoom) 237 237 }] 238 238 … … 572 572 label $inner.summary -text "" -anchor w 573 573 pack $inner.summary -side top 574 575 576 577 578 579 574 radiobutton $inner.image -text "Image (PNG/JPEG/GIF)" \ 575 -variable \ 576 ::Rappture::NanovisViewer::_downloadPopup(format) \ 577 -font "Arial 10 " \ 578 -value image 579 Rappture::Tooltip::for $inner.image "Save as image." 580 580 pack $inner.image -anchor w 581 581 button $inner.go -text [Rappture::filexfer::label download] \ 582 582 -command [lindex $args 0] 583 583 pack $inner.go -side bottom -pady 4 584 584 $inner.image select 585 585 } else { 586 586 set inner [$popup component inner] … … 590 590 set word [Rappture::filexfer::label downloadWord] 591 591 $inner.summary configure -text "$word $num in the following format:" 592 update idletasks ; 592 update idletasks ; # Fix initial sizes 593 593 return $popup 594 594 } … … 605 605 # dialog widget to it. 606 606 Rappture::Balloon $popup -title "Save as image..." \ 607 608 607 -deactivatecommand \ 608 [itcl::code $this SetWaitVariable 0] 609 609 set inner [$popup component inner] 610 610 AddImageControls $inner [lindex $args 0] 611 611 } else { 612 612 set inner [$popup component inner] 613 } 614 613 } 614 set _downloadPopup(image_controls) $inner 615 615 update 616 616 # Activate the popup and call for the output. 617 617 foreach { widget toolName plotName } $args break 618 618 SetWaitVariable 0 619 619 $popup activate $widget left 620 620 set bool [WaitForImage] 621 621 $popup deactivate 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 } 644 622 if { $bool } { 623 set inner $_downloadPopup(image_controls) 624 set fmt [$inner.format translate [$inner.format value]] 625 switch $fmt { 626 "jpg" { 627 $_image(download) export jpg -quality 100 \ 628 -data bytes 629 } 630 "png" { 631 $_image(download) export png -data bytes 632 } 633 "gif" { 634 $_image(download) export gif -data bytes 635 } 636 default { 637 return "" 638 } 639 } 640 return [list .$fmt $bytes] 641 } 642 } 643 } 644 return "" 645 645 } 646 646 default { … … 757 757 ComputeTransferFunc $tf 758 758 # FIXME: Need to the send information as to what transfer functions 759 # 760 # 761 # 759 # to update so that we only update the transfer function 760 # as necessary. Right now, all transfer functions are 761 # updated. This makes moving the isomarker slider chunky. 762 762 if { ![info exists _activeTfs($tf)] || !$_activeTfs($tf) } { 763 763 set _activeTfs($tf) 1 … … 785 785 ReceiveEcho <<line "<read $info(-bytes) bytes" 786 786 if { $info(-type) == "image" } { 787 ReceiveEcho "for [image width $_image(plot)]x[image height $_image(plot)] image>" 787 ReceiveEcho "for [image width $_image(plot)]x[image height $_image(plot)] image>" 788 788 $_image(plot) configure -data $bytes 789 789 } elseif { $info(type) == "print" } { … … 853 853 set vol [lindex $vols 0] 854 854 foreach axis {x y z} { 855 856 857 858 859 860 861 862 855 # Turn off cutplanes for all volumes 856 SendCmd "cutplane state 0 $axis" 857 if { $_settings($this-${axis}cutplane) } { 858 # Turn on cutplane for this particular volume and set the position 859 SendCmd "cutplane state 1 $axis $vol" 860 set pos [expr {0.01*$_settings($this-${axis}cutposition)}] 861 SendCmd "cutplane position $pos $axis $vol" 862 } 863 863 } 864 864 } … … 1005 1005 } 1006 1006 foreach axis {x y z} { 1007 1008 1007 # Turn off cutplanes for all volumes 1008 SendCmd "cutplane state 0 $axis" 1009 1009 } 1010 1010 set _buffering 0; # Turn off buffering. … … 1067 1067 phi 45 1068 1068 psi 0 1069 zoom 1070 pan-x 1071 pan-y 1069 zoom 1.0 1070 pan-x 0 1071 pan-y 0 1072 1072 } 1073 1073 if { $_first != "" } { … … 1314 1314 if { [isconnected] } { 1315 1315 set vols [CurrentVolumes -cutplanes] 1316 1316 set vol [lindex $vols 0] 1317 1317 SendCmd "cutplane state $bool $axis $vol" 1318 1318 } … … 1688 1688 itcl::body Rappture::NanovisViewer::BuildViewTab {} { 1689 1689 foreach { key value } { 1690 grid 1691 axes 1692 outline 1693 volume 1694 legend 1695 particles 1696 lic 1690 grid 0 1691 axes 1 1692 outline 1 1693 volume 1 1694 legend 1 1695 particles 1 1696 lic 1 1697 1697 } { 1698 1698 set _settings($this-$key) $value … … 1710 1710 -window $tab.ss.frame 1711 1711 pack $tab.ss -fill both -expand yes 1712 blt::tk::scrollbar $tab.ss.xs 1713 blt::tk::scrollbar $tab.ss.ys 1712 blt::tk::scrollbar $tab.ss.xs 1713 blt::tk::scrollbar $tab.ss.ys 1714 1714 set inner [blt::tk::frame $tab.ss.frame] 1715 1715 $inner configure -borderwidth 4 … … 1768 1768 itcl::body Rappture::NanovisViewer::BuildVolumeTab {} { 1769 1769 foreach { key value } { 1770 light 1771 transp 1772 opacity 1773 thickness 1770 light 40 1771 transp 50 1772 opacity 100 1773 thickness 350 1774 1774 } { 1775 1775 set _settings($this-$key) $value … … 1784 1784 -window $tab.ss.frame 1785 1785 pack $tab.ss -fill both -expand yes 1786 blt::tk::scrollbar $tab.ss.xs 1787 blt::tk::scrollbar $tab.ss.ys 1786 blt::tk::scrollbar $tab.ss.xs 1787 blt::tk::scrollbar $tab.ss.ys 1788 1788 set inner [blt::tk::frame $tab.ss.frame] 1789 1789 $inner configure -borderwidth 4 … … 1854 1854 -window $tab.ss.frame 1855 1855 pack $tab.ss -fill both -expand yes 1856 blt::tk::scrollbar $tab.ss.xs 1857 blt::tk::scrollbar $tab.ss.ys 1856 blt::tk::scrollbar $tab.ss.xs 1857 blt::tk::scrollbar $tab.ss.ys 1858 1858 set inner [blt::tk::frame $tab.ss.frame] 1859 1859 $inner configure -borderwidth 4 … … 1962 1962 -yscrollbar $tab.ss.ys \ 1963 1963 -window $tab.ss.frame 1964 blt::tk::scrollbar $tab.ss.xs 1965 blt::tk::scrollbar $tab.ss.ys 1964 blt::tk::scrollbar $tab.ss.xs 1965 blt::tk::scrollbar $tab.ss.ys 1966 1966 pack $tab.ss -fill both -expand yes 1967 1967 set inner [blt::tk::frame $tab.ss.frame] … … 2007 2007 set newpos [expr {0.01*$newval}] 2008 2008 set vols [CurrentVolumes -cutplanes] 2009 2009 set vol [lindex $vols 0] 2010 2010 SendCmd "cutplane position $newpos $axis $vol" 2011 2011 } -
branches/blt4/gui/scripts/note.tcl
r2098 r2745 182 182 ^xhtml:// { 183 183 set html [string range $info 7 end] 184 184 puts stderr "html html=$html" 185 185 $itk_component(html) load $html 186 186 } 187 187 default { 188 188 puts stderr "info=$info" 189 189 set html "<html><body><p>[_revEscapeChars $info]</p></body></html>" 190 190 puts stderr "default html=$html" 191 191 $itk_component(html) load $html 192 192 } -
branches/blt4/gui/scripts/numberresult.tcl
r2742 r2745 74 74 75 75 constructor {args} { 76 76 # defined below 77 77 } 78 78 destructor { 79 79 # defined below 80 80 } 81 81 public method add {dataobj {settings ""}} … … 547 547 # if we haven't created the popup yet, do it now 548 548 Rappture::Balloon $popup \ 549 549 -title "[Rappture::filexfer::label downloadWord] as..." 550 550 set inner [$popup component inner] 551 551 label $inner.summary -text "" -anchor w … … 577 577 } 578 578 switch -- $_downloadPopup(format) { 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 579 csv { 580 # March through the values in order and report 581 # all data points 582 set csvdata "" 583 set xtitle [$itk_component(plot) xaxis cget -title] 584 set ytitle [$itk_component(plot) yaxis cget -title] 585 586 set desc "" 587 set dataobj [lindex [get] end] 588 589 # the "Simulation" axis shows all values 590 # -- no need for assumptions 591 if {$xtitle != "Simulation" 592 && [info exists _dataobj2desc($dataobj)]} { 593 foreach line [split $_dataobj2desc($dataobj) \n] { 594 # skip the current axis and the Simulation axis 595 # Other values show assumptions about values reported 596 if {[string match "$xtitle =*" $line] 597 || [string match "Simulation =*" $line]} { 598 continue 599 } 600 set indent [expr {("" == $desc) ? "for:" : " "}] 601 append desc " $indent $line\n" 602 } 603 } 604 if {[string length $desc] > 0} { 605 append csvdata "[string repeat - 60]\n" 606 append csvdata $desc 607 append csvdata "[string repeat - 60]\n" 608 } 609 610 append csvdata "$xtitle, $ytitle\n" 611 foreach xval [lsort -real [array names _xval2label]] { 612 set dataobj "" 613 set param [list $_xval2label($xval) $xval] 614 foreach obj $_dlist { 615 if {[info exists _dataobj2param($obj)] 616 && [string equal $_dataobj2param($obj) $param]} { 617 set dataobj $obj 618 break 619 } 620 } 621 if {"" != $dataobj} { 622 set yval [$dataobj get current] 623 append csvdata "$_xval2label($xval), $yval\n" 624 } 625 } 626 return [list .txt $csvdata] 627 } 628 628 image { 629 629 set popup .numberresultprintdownload … … 904 904 905 905 if { [info exists info(name)] && $info(name) == $elem } { 906 906 set found 1 907 907 908 908 set x [$g axis transform $mapx $info(x)] 909 909 set y [$g axis transform $mapy $info(y)] 910 910 911 911 set tip "" 912 912 if {[info exists _elem2dataobj($elem)]} { 913 913 set dataobj $_elem2dataobj($elem) … … 929 929 set results [$g element closest $x $y -interpolate no] 930 930 if { $results != "" } { 931 931 set found 1 932 932 933 933 array unset info … … 975 975 # 976 976 977 978 979 977 $g element deactivate $_hilite(elem) 978 $g crosshairs configure -hide yes 979 Rappture::Tooltip::tooltip cancel 980 980 981 981 $g element activate $elem … … 1053 1053 # - take down tooltip 1054 1054 # 1055 1055 $g element deactivate $_hilite(elem) 1056 1056 1057 1057 set allx [$g x2axis use] -
branches/blt4/gui/scripts/pager.tcl
r2534 r2745 640 640 # busy -- 641 641 # 642 # 643 # 644 # 645 # 642 # If true (this indicates a simulation is occurring), the widget 643 # should prevent the user from 644 # 1) clicking an item previous in the breadcrumbs, and 645 # 2) using the "back" button. 646 646 # 647 647 itcl::body Rappture::Pager::busy { bool } { -
branches/blt4/gui/scripts/panes.tcl
r1923 r2745 49 49 private variable _counter 0 ;# counter for auto-generated names 50 50 private variable _frac 0.0 ;# list of fractions 51 public variable orientation 51 public variable orientation "vertical" 52 52 } 53 53 … … 409 409 set x [expr {$x + $pw}] 410 410 } 411 } 411 } 412 412 } 413 413 -
branches/blt4/gui/scripts/periodicelement.tcl
r1923 r2745 2 2 # ---------------------------------------------------------------------- 3 3 # COMPONENT: PeriodicElement - entry widget with a drop-down periodic 4 # 4 # table. 5 5 # 6 6 # This widget is a typical periodicelement, an entry widget with a drop-down -
branches/blt4/gui/scripts/periodicelemententry.tcl
r1923 r2745 68 68 if { [llength $active] > 0 } { 69 69 $itk_component(element) element active $active 70 } 70 } 71 71 if { $defval != "" } { 72 72 $itk_component(element) value $defval -
branches/blt4/gui/scripts/periodictable.tcl
r1923 r2745 46 46 private common _colors 47 47 array set _colors { 48 actinoid-activebackground 49 actinoid-activeforeground 50 actinoid-disabledbackground 51 actinoid-disabledforeground 52 actinoid-background 53 actinoid-foreground 54 alkali-metal-activebackground 55 alkali-metal-activeforeground 56 alkali-metal-disabledbackground 57 alkali-metal-disabledforeground 58 alkali-metal-background 59 alkali-metal-foreground 60 alkaline-earth-metal-activebackground 61 alkaline-earth-metal-activeforeground 62 alkaline-earth-metal-disabledbackground 63 alkaline-earth-metal-disabledforeground 64 alkaline-earth-metal-background 65 alkaline-earth-metal-foreground 66 halogen-activebackground 67 halogen-activeforeground 68 halogen-disabledbackground 69 halogen-disabledforeground 70 halogen-background 71 halogen-foreground 72 lanthanoid-activebackground 73 lanthanoid-activeforeground 74 lanthanoid-disabledbackground 75 lanthanoid-disabledforeground 76 lanthanoid-background 77 lanthanoid-foreground 78 metalloid-activebackground 79 metalloid-activeforeground 80 metalloid-disabledbackground 81 metalloid-disabledforeground 82 metalloid-background 83 metalloid-foreground 84 noble-gas-activebackground 85 noble-gas-activeforeground 86 noble-gas-disabledbackground 87 noble-gas-disabledforeground 88 noble-gas-background 89 noble-gas-foreground 90 other-non-metal-activebackground 91 other-non-metal-activeforeground 92 other-non-metal-disabledbackground 93 other-non-metal-disabledforeground 94 other-non-metal-background 95 other-non-metal-foreground 96 post-transition-metal-activebackground \#9a9a9a97 post-transition-metal-activeforeground 98 post-transition-metal-disabledbackground 99 post-transition-metal-disabledforeground 100 post-transition-metal-background 101 post-transition-metal-foreground 102 transition-metal-activebackground 103 transition-metal-activeforeground 104 transition-metal-disabledbackground 105 transition-metal-disabledforeground 106 transition-metal-background 107 transition-metal-foreground 108 unknown-activebackground 109 unknown-activeforeground 110 unknown-disabledbackground 111 unknown-disabledforeground 112 unknown-background 113 unknown-foreground 48 actinoid-activebackground \#cd679a 49 actinoid-activeforeground white 50 actinoid-disabledbackground \#ff99cc 51 actinoid-disabledforeground \#D97DAB 52 actinoid-background \#ff99cc 53 actinoid-foreground black 54 alkali-metal-activebackground \#cd3434 55 alkali-metal-activeforeground white 56 alkali-metal-disabledbackground \#ff6666 57 alkali-metal-disabledforeground \#D04747 58 alkali-metal-background \#ff6666 59 alkali-metal-foreground black 60 alkaline-earth-metal-activebackground \#cdac7b 61 alkaline-earth-metal-activeforeground white 62 alkaline-earth-metal-disabledbackground \#ffdead 63 alkaline-earth-metal-disabledforeground \#C19A64 64 alkaline-earth-metal-background \#ffdead 65 alkaline-earth-metal-foreground black 66 halogen-activebackground \#cdcd67 67 halogen-activeforeground white 68 halogen-disabledbackground \#ffff99 69 halogen-disabledforeground \#D5D562 70 halogen-background \#ffff99 71 halogen-foreground black 72 lanthanoid-activebackground \#cd8dcd 73 lanthanoid-activeforeground white 74 lanthanoid-disabledbackground \#ffbfff 75 lanthanoid-disabledforeground \#D884D8 76 lanthanoid-background \#ffbfff 77 lanthanoid-foreground black 78 metalloid-activebackground \#9a9a67 79 metalloid-activeforeground white 80 metalloid-disabledbackground \#cccc99 81 metalloid-disabledforeground \#92922C 82 metalloid-background \#cccc99 83 metalloid-foreground black 84 noble-gas-activebackground \#8ecdcd 85 noble-gas-activeforeground white 86 noble-gas-disabledbackground \#c0ffff 87 noble-gas-disabledforeground \#7FC1C1 88 noble-gas-background \#c0ffff 89 noble-gas-foreground black 90 other-non-metal-activebackground \#6ecd6e 91 other-non-metal-activeforeground white 92 other-non-metal-disabledbackground \#a0ffa0 93 other-non-metal-disabledforeground \#6ACD6A 94 other-non-metal-background \#a0ffa0 95 other-non-metal-foreground black 96 post-transition-metal-activebackground \#9a9a9a 97 post-transition-metal-activeforeground white 98 post-transition-metal-disabledbackground \#cccccc 99 post-transition-metal-disabledforeground \#999999 100 post-transition-metal-background \#cccccc 101 post-transition-metal-foreground black 102 transition-metal-activebackground \#cd8e8e 103 transition-metal-activeforeground white 104 transition-metal-disabledbackground \#ffc0c0 105 transition-metal-disabledforeground \#C77E7E 106 transition-metal-background \#ffc0c0 107 transition-metal-foreground black 108 unknown-activebackground \#cdcdcd 109 unknown-activeforeground white 110 unknown-disabledbackground \#ffffff 111 unknown-disabledforeground \#B9B9B9 112 unknown-background \#ffffff 113 unknown-foreground black 114 114 } 115 115 private common _tableData { 116 Hydrogen 1 H 1.0079 1 1other-non-metal117 Helium 2 He 4.0026 1 18noble-gas118 Lithium 3 Li 6.941(2) 2 1alkali-metal119 Beryllium 4 Be 9.0122 2 2alkaline-earth-metal120 Boron 5 B 10.811(7) 2 13metalloid121 Carbon 6 C 12.011 2 14other-non-metal122 Nitrogen 7 N 14.007 2 15other-non-metal123 Oxygen 8 O 15.999 2 16other-non-metal124 Fluorine 9 F 18.998 2 17halogen125 Neon 10 Ne 20.180 2 18noble-gas116 Hydrogen 1 H 1.0079 1 1 other-non-metal 117 Helium 2 He 4.0026 1 18 noble-gas 118 Lithium 3 Li 6.941(2) 2 1 alkali-metal 119 Beryllium 4 Be 9.0122 2 2 alkaline-earth-metal 120 Boron 5 B 10.811(7) 2 13 metalloid 121 Carbon 6 C 12.011 2 14 other-non-metal 122 Nitrogen 7 N 14.007 2 15 other-non-metal 123 Oxygen 8 O 15.999 2 16 other-non-metal 124 Fluorine 9 F 18.998 2 17 halogen 125 Neon 10 Ne 20.180 2 18 noble-gas 126 126 127 Sodium 11 Na 22.990 3 1alkali-metal128 Magnesium 12 Mg 24.305 3 2alkaline-earth-metal129 Aluminium 13 Al 26.982 3 13post-transition-metal130 Silicon 14 Si 28.086 3 14metalloid131 Phosphorus 15 P 30.974 3 15other-non-metal132 Sulfur 16 S 32.066(6) 3 16other-non-metal133 Chlorine 17 Cl 35.453 3 17halogen134 Argon 18 Ar 39.948(1) 3 18noble-gas127 Sodium 11 Na 22.990 3 1 alkali-metal 128 Magnesium 12 Mg 24.305 3 2 alkaline-earth-metal 129 Aluminium 13 Al 26.982 3 13 post-transition-metal 130 Silicon 14 Si 28.086 3 14 metalloid 131 Phosphorus 15 P 30.974 3 15 other-non-metal 132 Sulfur 16 S 32.066(6) 3 16 other-non-metal 133 Chlorine 17 Cl 35.453 3 17 halogen 134 Argon 18 Ar 39.948(1) 3 18 noble-gas 135 135 136 Potassium 19 K 39.098 4 1alkali-metal137 Calcium 20 Ca 40.078(4) 4 2alkaline-earth-metal138 Scandium 21 Sc 44.956 4 3transition-metal139 Titanium 22 Ti 47.867(1) 4 4transition-metal140 Vanadium 23 V 50.942(1) 4 5transition-metal141 Chromium 24 Cr 51.996 4 6transition-metal142 Manganese 25 Mn 54.938 4 7transition-metal143 Iron 26 Fe 55.845(2) 4 8transition-metal144 Cobalt 27 Co 58.933 4 9transition-metal145 Nickel 28 Ni 58.693 4 10transition-metal146 Copper 29 Cu 63.546(3) 4 11transition-metal147 Zinc 30 Zn 65.39(2) 4 12transition-metal148 Gallium 31 Ga 69.723(1) 4 13post-transition-metal149 Germanium 32 Ge 72.61(2) 4 14metalloid150 Arsenic 33 As 74.922 4 15metalloid151 Selenium 34 Se 78.96(3) 4 16other-non-metal152 Bromine 35 Br 79.904(1) 4 17halogen153 Krypton 36 Kr 83.80(1) 4 18noble-gas136 Potassium 19 K 39.098 4 1 alkali-metal 137 Calcium 20 Ca 40.078(4) 4 2 alkaline-earth-metal 138 Scandium 21 Sc 44.956 4 3 transition-metal 139 Titanium 22 Ti 47.867(1) 4 4 transition-metal 140 Vanadium 23 V 50.942(1) 4 5 transition-metal 141 Chromium 24 Cr 51.996 4 6 transition-metal 142 Manganese 25 Mn 54.938 4 7 transition-metal 143 Iron 26 Fe 55.845(2) 4 8 transition-metal 144 Cobalt 27 Co 58.933 4 9 transition-metal 145 Nickel 28 Ni 58.693 4 10 transition-metal 146 Copper 29 Cu 63.546(3) 4 11 transition-metal 147 Zinc 30 Zn 65.39(2) 4 12 transition-metal 148 Gallium 31 Ga 69.723(1) 4 13 post-transition-metal 149 Germanium 32 Ge 72.61(2) 4 14 metalloid 150 Arsenic 33 As 74.922 4 15 metalloid 151 Selenium 34 Se 78.96(3) 4 16 other-non-metal 152 Bromine 35 Br 79.904(1) 4 17 halogen 153 Krypton 36 Kr 83.80(1) 4 18 noble-gas 154 154 155 Rubidium 37 Rb 85.468 5 1alkali-metal156 Strontium 38 Sr 87.62(1) 5 2alkaline-earth-metal157 Yttrium 39 Y 88.906 5 3transition-metal158 Zirconium 40 Zr 91.224(2) 5 4transition-metal159 Niobium 41 Nb 92.906 5 5transition-metal160 Molybdenum 42 Mo 95.94(1) 5 6transition-metal161 Technetium 43 Tc [97.907] 5 7transition-metal162 Ruthenium 44 Ru 101.07(2) 5 8transition-metal163 Rhodium 45 Rh 102.906 5 9transition-metal164 Palladium 46 Pd 106.42(1) 5 10transition-metal165 Silver 47 Ag 107.868 5 11transition-metal166 Cadmium 48 Cd 112.411(8) 5 12transition-metal167 Indium 49 In 114.818(3) 5 13post-transition-metal168 Tin 50 Sn 118.710(7) 5 14post-transition-metal169 Antimony 51 Sb 121.760(1) 5 15metalloid170 Tellurium 52 Te 127.60(3) 5 16metalloid171 Iodine 53 I 126.904 5 17halogen172 Xenon 54 Xe 131.29(2) 5 18noble-gas155 Rubidium 37 Rb 85.468 5 1 alkali-metal 156 Strontium 38 Sr 87.62(1) 5 2 alkaline-earth-metal 157 Yttrium 39 Y 88.906 5 3 transition-metal 158 Zirconium 40 Zr 91.224(2) 5 4 transition-metal 159 Niobium 41 Nb 92.906 5 5 transition-metal 160 Molybdenum 42 Mo 95.94(1) 5 6 transition-metal 161 Technetium 43 Tc [97.907] 5 7 transition-metal 162 Ruthenium 44 Ru 101.07(2) 5 8 transition-metal 163 Rhodium 45 Rh 102.906 5 9 transition-metal 164 Palladium 46 Pd 106.42(1) 5 10 transition-metal 165 Silver 47 Ag 107.868 5 11 transition-metal 166 Cadmium 48 Cd 112.411(8) 5 12 transition-metal 167 Indium 49 In 114.818(3) 5 13 post-transition-metal 168 Tin 50 Sn 118.710(7) 5 14 post-transition-metal 169 Antimony 51 Sb 121.760(1) 5 15 metalloid 170 Tellurium 52 Te 127.60(3) 5 16 metalloid 171 Iodine 53 I 126.904 5 17 halogen 172 Xenon 54 Xe 131.29(2) 5 18 noble-gas 173 173 174 Cesium 55 Cs 132.905 6 1alkali-metal175 Barium 56 Ba 137.327(7) 6 2alkaline-earth-metal176 Lanthanides 57-71 * * 6 3lanthanoid177 Hafnium 72 Hf 178.49(2) 6 4transition-metal178 Tantalum 73 Ta 180.948 6 5transition-metal179 Tungsten 74 W 183.84(1) 6 6transition-metal180 Rhenium 75 Re 186.207(1) 6 7transition-metal181 Osmium 76 Os 190.23(3) 6 8transition-metal182 Iridium 77 Ir 192.217(3) 6 9transition-metal183 Platinum 78 Pt 195.084(9) 6 10transition-metal184 Gold 79 Au 196.967 6 11transition-metal185 Mercury 80 Hg 200.59(2) 6 12transition-metal186 Thallium 81 Tl 204.383 6 13post-transition-metal187 Lead 82 Pb 207.2(1) 6 14post-transition-metal188 Bismuth 83 Bi 208.980 6 15post-transition-metal189 Polonium 84 Po [208.982] 6 16metalloid190 Astatine 85 At [209.987] 6 17halogen191 Radon 86 Rn [222.018] 6 18noble-gas174 Cesium 55 Cs 132.905 6 1 alkali-metal 175 Barium 56 Ba 137.327(7) 6 2 alkaline-earth-metal 176 Lanthanides 57-71 * * 6 3 lanthanoid 177 Hafnium 72 Hf 178.49(2) 6 4 transition-metal 178 Tantalum 73 Ta 180.948 6 5 transition-metal 179 Tungsten 74 W 183.84(1) 6 6 transition-metal 180 Rhenium 75 Re 186.207(1) 6 7 transition-metal 181 Osmium 76 Os 190.23(3) 6 8 transition-metal 182 Iridium 77 Ir 192.217(3) 6 9 transition-metal 183 Platinum 78 Pt 195.084(9) 6 10 transition-metal 184 Gold 79 Au 196.967 6 11 transition-metal 185 Mercury 80 Hg 200.59(2) 6 12 transition-metal 186 Thallium 81 Tl 204.383 6 13 post-transition-metal 187 Lead 82 Pb 207.2(1) 6 14 post-transition-metal 188 Bismuth 83 Bi 208.980 6 15 post-transition-metal 189 Polonium 84 Po [208.982] 6 16 metalloid 190 Astatine 85 At [209.987] 6 17 halogen 191 Radon 86 Rn [222.018] 6 18 noble-gas 192 192 193 Francium 87 Fr [223.020] 7 1alkali-metal194 Radium 88 Ra [226.0254] 7 2alkaline-earth-metal195 Actinides 89-103 * * 7 3actinoid196 Rutherfordium 104 Rf [263.113] 7 4transition-metal197 Dubnium 105 Db [262.114] 7 5transition-metal198 Seaborgium 106 Sg [266.122] 7 6transition-metal199 Bohrium 107 Bh [264.1247] 7 7transition-metal200 Hassium 108 Hs [269.134] 7 8transition-metal201 Meitnerium 109 Mt [268.139] 7 9transition-metal202 Darmstadtium 110 Ds [272.146] 7 10transition-metal203 Roentgenium 111 Rg [272.154] 7 11transition-metal204 Ununbium 112 Uub [277] 7 12transition-metal205 Ununtrium 113 Uut [284] 7 13post-transition-metal206 Ununquadium 114 Uuq [289] 7 14post-transition-metal207 Ununpentium 115 Uup [288] 7 15post-transition-metal208 Ununhexium 116 Uuh [292] 7 16post-transition-metal209 Ununseptium 117 Uus ? 7 17unknown210 Ununoctium 118 Uuo [294] 7 18unknown193 Francium 87 Fr [223.020] 7 1 alkali-metal 194 Radium 88 Ra [226.0254] 7 2 alkaline-earth-metal 195 Actinides 89-103 * * 7 3 actinoid 196 Rutherfordium 104 Rf [263.113] 7 4 transition-metal 197 Dubnium 105 Db [262.114] 7 5 transition-metal 198 Seaborgium 106 Sg [266.122] 7 6 transition-metal 199 Bohrium 107 Bh [264.1247] 7 7 transition-metal 200 Hassium 108 Hs [269.134] 7 8 transition-metal 201 Meitnerium 109 Mt [268.139] 7 9 transition-metal 202 Darmstadtium 110 Ds [272.146] 7 10 transition-metal 203 Roentgenium 111 Rg [272.154] 7 11 transition-metal 204 Ununbium 112 Uub [277] 7 12 transition-metal 205 Ununtrium 113 Uut [284] 7 13 post-transition-metal 206 Ununquadium 114 Uuq [289] 7 14 post-transition-metal 207 Ununpentium 115 Uup [288] 7 15 post-transition-metal 208 Ununhexium 116 Uuh [292] 7 16 post-transition-metal 209 Ununseptium 117 Uus ? 7 17 unknown 210 Ununoctium 118 Uuo [294] 7 18 unknown 211 211 212 Lanthanum 57 La 138.905 8 3lanthanoid213 Cerium 58 Ce 140.116(1) 8 4lanthanoid214 Praseodymium 215 Neodymium 60 Nd 144.242(3) 8 6lanthanoid216 Promethium 61 Pm [144.913] 8 7lanthanoid217 Samarium 62 Sm 150.36(2) 8 8lanthanoid218 Europium 63 Eu 151.964(1) 8 9lanthanoid219 Gadolinium 64 Gd 157.25(3) 8 10lanthanoid220 Terbium 65 Tb 158.925 8 11lanthanoid221 Dysprosium 66 Dy 162.500(1) 8 12lanthanoid222 Holmium 67 Ho 164.930 8 13lanthanoid223 Erbium 68 Er 167.259(3) 8 14lanthanoid224 Thulium 69 Tm 168.934 8 15lanthanoid225 Ytterbium 70 Yb 173.04(3) 8 16lanthanoid226 Lutetium 71 Lu 174.967(1) 8 17lanthanoid212 Lanthanum 57 La 138.905 8 3 lanthanoid 213 Cerium 58 Ce 140.116(1) 8 4 lanthanoid 214 Praseodymium 59 Pr 140.908 8 5 lanthanoid 215 Neodymium 60 Nd 144.242(3) 8 6 lanthanoid 216 Promethium 61 Pm [144.913] 8 7 lanthanoid 217 Samarium 62 Sm 150.36(2) 8 8 lanthanoid 218 Europium 63 Eu 151.964(1) 8 9 lanthanoid 219 Gadolinium 64 Gd 157.25(3) 8 10 lanthanoid 220 Terbium 65 Tb 158.925 8 11 lanthanoid 221 Dysprosium 66 Dy 162.500(1) 8 12 lanthanoid 222 Holmium 67 Ho 164.930 8 13 lanthanoid 223 Erbium 68 Er 167.259(3) 8 14 lanthanoid 224 Thulium 69 Tm 168.934 8 15 lanthanoid 225 Ytterbium 70 Yb 173.04(3) 8 16 lanthanoid 226 Lutetium 71 Lu 174.967(1) 8 17 lanthanoid 227 227 228 Actinium 89 Ac [227.027] 9 3actinoid229 Thorium 90 Th 232.038 9 4actinoid230 Protactinium 91 Pa 231.036 9 5actinoid231 Uranium 92 U 238.029 9 6actinoid232 Neptunium 93 Np [237.048] 9 7actinoid233 Plutonium 94 Pu [244.064] 9 8actinoid234 Americium 95 Am [243.061] 9 9actinoid235 Curium 96 Cm [247.070] 9 10actinoid236 Berkelium 97 Bk [247.070] 9 11actinoid237 Californium 98 Cf [251.080] 9 12actinoid238 Einsteinium 99 Es [252.083] 9 13actinoid239 Fermium 100 Fm [257.095] 9 14actinoid240 Mendelevium 241 Nobelium 102 No [259.101] 9 16actinoid242 Lawrencium 103 Lr [262.110] 9 17actinoid228 Actinium 89 Ac [227.027] 9 3 actinoid 229 Thorium 90 Th 232.038 9 4 actinoid 230 Protactinium 91 Pa 231.036 9 5 actinoid 231 Uranium 92 U 238.029 9 6 actinoid 232 Neptunium 93 Np [237.048] 9 7 actinoid 233 Plutonium 94 Pu [244.064] 9 8 actinoid 234 Americium 95 Am [243.061] 9 9 actinoid 235 Curium 96 Cm [247.070] 9 10 actinoid 236 Berkelium 97 Bk [247.070] 9 11 actinoid 237 Californium 98 Cf [251.080] 9 12 actinoid 238 Einsteinium 99 Es [252.083] 9 13 actinoid 239 Fermium 100 Fm [257.095] 9 14 actinoid 240 Mendelevium 101 Md [258.098] 9 15 actinoid 241 Nobelium 102 No [259.101] 9 16 actinoid 242 Lawrencium 103 Lr [262.110] 9 17 actinoid 243 243 } 244 244 private common _types … … 247 247 Actinides Actinium Americium Berkelium Californium Curium 248 248 Einsteinium Fermium Mendelevium Neptunium Plutonium Protactinium 249 Thorium Uranium Lawrencium Nobelium 249 Thorium Uranium Lawrencium Nobelium 250 250 } 251 251 alkali-metal { 252 Cesium Francium Lithium Potassium Rubidium Sodium 252 Cesium Francium Lithium Potassium Rubidium Sodium 253 253 } 254 254 alkaline-earth-metal { 255 Barium Beryllium Calcium Magnesium Radium Strontium 255 Barium Beryllium Calcium Magnesium Radium Strontium 256 256 } 257 257 halogen { 258 Astatine Bromine Chlorine Fluorine Iodine 258 Astatine Bromine Chlorine Fluorine Iodine 259 259 } 260 260 lanthanoid { 261 Cerium Erbium Europium Gadolinium Holmium Lanthanides Lanthanum 261 Cerium Erbium Europium Gadolinium Holmium Lanthanides Lanthanum 262 262 Lutetium Neodymium Praseodymium Promethium Samarium Terbium 263 Thulium Ytterbium Dysprosium 263 Thulium Ytterbium Dysprosium 264 264 } 265 265 metalloid { 266 Arsenic Boron Germanium Polonium Silicon Tellurium Antimony 266 Arsenic Boron Germanium Polonium Silicon Tellurium Antimony 267 267 } 268 268 noble-gas { … … 270 270 } 271 271 other-non-metal { 272 Carbon Hydrogen Nitrogen Sulfur Oxygen Phosphorus Selenium 272 Carbon Hydrogen Nitrogen Sulfur Oxygen Phosphorus Selenium 273 273 } 274 274 post-transition-metal { 275 275 Aluminium Bismuth Gallium Indium Lead Thallium Tin Ununhexium 276 Ununpentium Ununquadium Ununtrium 276 Ununpentium Ununquadium Ununtrium 277 277 } 278 278 transition-metal { 279 Chromium Cobalt Copper Dubnium Gold Hafnium Hassium Iridium 280 Iron Manganese Meitnerium Mercury Molybdenum Nickel Niobium 279 Chromium Cobalt Copper Dubnium Gold Hafnium Hassium Iridium 280 Iron Manganese Meitnerium Mercury Molybdenum Nickel Niobium 281 281 Osmium Palladium Rhenium Rhodium Roentgenium Ruthenium 282 282 Rutherfordium Scandium Seaborgium Silver Tantalum Technetium 283 283 Titanium Tungsten Ununbium Vanadium Yttrium Zinc Zirconium 284 Bohrium Cadmium Darmstadtium Platinum 284 Bohrium Cadmium Darmstadtium Platinum 285 285 } 286 286 unknown { 287 Ununoctium 288 Ununseptium 287 Ununoctium 288 Ununseptium 289 289 } 290 290 } … … 346 346 # active <list of elements> 347 347 # 348 # 349 # 350 # 351 # 352 # 353 # 354 # 355 # 348 # Enables zero or more elements in the periodic table so that 349 # they can be selected. All elements are first disabled. Each 350 # argument can one of the following forms: 351 # 1. element name. 352 # 2. element symbol. 353 # 3. element number. 354 # 4. type of element. The argument is expanded into all 355 # elements of that type. 356 356 # 357 357 itcl::body Rappture::PeriodicTable::active { list } { … … 390 390 # inactive <list of elements> 391 391 # 392 # 393 # 394 # 395 # 396 # 397 # 398 # 399 # 392 # Disables zero or more elements in the periodic table so that 393 # they can't be selected. All elements are first enabled. Each 394 # argument can one of the following forms: 395 # 1. element name. 396 # 2. element symbol. 397 # 3. element number. 398 # 4. type of element. The argument is expanded into all 399 # elements of that type. 400 400 # 401 401 itcl::body Rappture::PeriodicTable::inactive { list } { -
branches/blt4/gui/scripts/resultset.tcl
r2742 r2745 228 228 } 229 229 pack $itk_component(options) -expand yes -fill both 230 blt::tk::scrollbar $inner.scrl.xs 231 blt::tk::scrollbar $inner.scrl.ys 230 blt::tk::scrollbar $inner.scrl.xs 231 blt::tk::scrollbar $inner.scrl.ys 232 232 itk_component add popup { 233 233 frame $inner.scrl.frame … … 1095 1095 } 1096 1096 if { $_active == "" } { 1097 return;# Nothing active. Don't do anything.1097 return; # Nothing active. Don't do anything. 1098 1098 } 1099 1099 eval lappend params [_getValues $_active all] … … 1528 1528 set val "#[expr {$which+1}]" 1529 1529 } else { 1530 1531 1532 1530 # Be careful giving singleton elements as the "columns" 1531 # argument to "Tuples::get". It is expecting a list. 1532 set val [lindex [$_results get -format [list $col] $which] 0] 1533 1533 } 1534 1534 if {[info exists label2val($val)]} { … … 1622 1622 foreach col $_cntlInfo($this-all) { 1623 1623 set quantity $_cntlInfo($this-$col-label) 1624 1625 1624 # Be careful giving singleton elements as the "columns" 1625 # argument to "Tuples::get". It is expecting a list. 1626 1626 set val [lindex [$_results get -format [list $col] $index] 0] 1627 1627 if {$col == "xmlobj"} { -
branches/blt4/gui/scripts/resultviewer.tcl
r2742 r2745 218 218 set mode "vtkviewer" 219 219 if {![info exists _mode2widget($mode)]} { 220 220 set servers [Rappture::VisViewer::GetServerList "vtkvis"] 221 221 set w $itk_interior.vtkviewer 222 222 Rappture::VtkViewer $w $servers 223 223 set _mode2widget($mode) $w 224 224 } … … 264 264 if {![info exists _mode2widget($mode)]} { 265 265 if { [$dataobj isunirect2d] } { 266 267 268 269 270 271 272 266 if { [$dataobj hints type] == "contour" } { 267 set resultMode "vtkcontour" 268 } elseif { [info exists env(VTKHEIGHTMAP)] } { 269 set resultMode "vtkheightmap" 270 } else { 271 set resultMode "heightmap" 272 } 273 273 } else { 274 274 set resultMode "vtk" … … 289 289 if {![info exists _mode2widget($mode)]} { 290 290 switch -- [$dataobj type] { 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 291 "vtk" { 292 set fmt "vtk" 293 } 294 "opendx" - "dx" - "points-on-mesh" { 295 set fmt "nanovis" 296 set extents [$dataobj extents] 297 if { $extents > 1 } { 298 set fmt "flowvis" 299 } 300 } 301 "vtkvolume" { 302 set fmt "vtkvolume" 303 } 304 "vtkstreamlines" { 305 set fmt "vtkstreamlines" 306 } 307 } 308 308 set w $itk_interior.field3D 309 309 Rappture::Field3DResult $w -mode $fmt -
branches/blt4/gui/scripts/sequenceresult.tcl
r2742 r2745 29 29 30 30 constructor {args} { 31 31 # defined below 32 32 } 33 33 destructor { 34 34 # defined below 35 35 } 36 36 public method add {dataobj {settings ""}} … … 39 39 public method scale {args} 40 40 public method parameters {title args} { 41 41 # do nothing 42 42 } 43 43 public method download {option args} … … 55 55 private method BuildViewer { viewer } 56 56 private method AnimationPopup { popup info } 57 private variable _dispatcher "" ; 58 private variable _dlist "" ; 59 private variable _topmost "" ; 60 private variable _indices "" ; 61 private variable _pos 0 ; 62 private variable _afterId "" ; 63 64 private variable _viewerclass ""; 65 private variable _animate 0 ;# Indicates if the sequence can be66 67 68 private variable _popup ""; 69 private common _play ; 70 71 private variable _class ""; 72 private variable _dim 0; 73 private variable _mode ""; 57 private variable _dispatcher "" ; # dispatcher for !events 58 private variable _dlist "" ; # list of data objects 59 private variable _topmost "" ; # topmost data object in _dlist 60 private variable _indices "" ; # list of active indices 61 private variable _pos 0 ; # current position in the animation 62 private variable _afterId "" ; # current "after" event for play op 63 64 private variable _viewerclass ""; # Class of viewer. 65 private variable _animate 0 ; # Indicates if the sequence can be 66 # animated (i.e. produce an animated 67 # gif or mpeg video). 68 private variable _popup ""; # Popup window for dialog. 69 private common _play ; # options for "play" operation 70 71 private variable _class ""; # Class of element in sequence. 72 private variable _dim 0; # Dimension elements in sequence. 73 private variable _mode ""; # Mode of viewer. 74 74 75 75 set _play(speed) 60 … … 310 310 itcl::body Rappture::SequenceResult::download {option args} { 311 311 if { ![winfo exists $itk_component(area).viewer] } { 312 return ""; 312 return ""; # No data, no viewer, no download. 313 313 } 314 314 switch $option { … … 318 318 controls { 319 319 set _popup \ 320 321 322 320 [eval $itk_component(area).viewer download controls $args] 321 if { $_animate } { 322 # Add the animation button to the download dialog 323 323 set inner [$_popup component inner] 324 325 326 327 328 329 330 331 332 324 if { ![winfo exists $inner.animation] } { 325 radiobutton $inner.animation -text "Animation (GIF/MPEG)" \ 326 -variable ${_viewerclass}::_downloadPopup(format) \ 327 -value animation 328 pack $inner.animation -anchor w 329 update 330 } 331 } 332 return $_popup 333 333 } 334 334 now { 335 336 337 338 339 340 341 342 343 344 345 346 347 348 335 if { $_animate } { 336 # Examine the radiobutton variable to see if an animated GIF 337 # of MPEG movie was selected for download. 338 set fmt [set ${_viewerclass}::_downloadPopup(format)] 339 if { $fmt == "animation" } { 340 if { [winfo exists $_popup] } { 341 $_popup deactivate 342 } 343 set popup .sequenceanimationdownload 344 return [AnimationPopup $popup $args] 345 } 346 } 347 # Otherwise, return download of single frame 348 return [eval $itk_component(area).viewer download now $args] 349 349 } 350 350 default { … … 362 362 itcl::body Rappture::SequenceResult::play {} { 363 363 if { [llength $_indices] == 0 } { 364 return; 364 return; # No frames (i.e. no data). 365 365 } 366 366 # Stop any existing animation. … … 378 378 379 379 global readyForNextFrame 380 set readyForNextFrame 1; 380 set readyForNextFrame 1; # By default, always ready 381 381 # Schedule the first frame 382 382 set delay [expr {int(ceil(pow($_play(speed)/10.0+2,2.0)*15))}] … … 396 396 } 397 397 global readyForNextFrame 398 set readyForNextFrame 1; 399 398 set readyForNextFrame 1; # By default, always ready 399 400 400 # Check if the play button still exists. We may be in the process 401 401 # of destroying the widget. 402 402 if { [info exists itk_component(play)] } { 403 404 405 406 403 # toggle the button to "play" mode 404 $itk_component(play) configure \ 405 -bitmap [Rappture::icon play] \ 406 -command [itcl::code $this play] 407 407 } 408 408 } … … 446 446 return 447 447 } 448 449 448 pack $viewer -expand yes -fill both 449 pack $itk_component(player) -side bottom -fill x 450 450 } else { 451 451 if { "" == $_topmost } { 452 452 return 453 453 } 454 454 BuildViewer $viewer 455 455 } 456 456 … … 502 502 set delay [expr {int(ceil(pow($_play(speed)/10.0+2,2.0)*15))}] 503 503 } else { 504 set delay 50; 504 set delay 50; # Poll for completion 505 505 } 506 506 set _afterId [after $delay [itcl::code $this _playFrame]] … … 596 596 } 597 597 set save $_pos 598 $viewer delete 598 $viewer delete ;# Delete all objects from the viewer 599 599 for { set i 0 } { $i < [llength $_indices] } { incr i } { 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 600 set dataobj [$_topmost value $i] 601 set val [$itk_component(dial) get -format label @$i] 602 set _pos [lsearch -glob $_indices $val*] 603 set settings "-color autoreset -width 2" 604 if {[catch {$dataobj hints style} style] == 0} { 605 eval lappend settings $style 606 } 607 if { [catch {$dataobj hints type} type] == 0} { 608 if {"" != $type} { 609 lappend settings -type $type 610 } 611 } 612 $viewer add $dataobj $settings 613 set img [$viewer snap $x $y] 614 # add caption to frame. 615 615 if { $val != "" } { 616 616 $img draw text "$label $val" 10 10 \ 617 617 -font "Arial 10" -color white -shadow 1 618 618 } 619 619 $viewer delete 620 620 lappend imageList $img 621 621 } … … 624 624 set settings "-color autoreset -width 2" 625 625 if {[catch {$dataobj hints style} style] == 0} { 626 626 eval lappend settings $style 627 627 } 628 628 if { [catch {$dataobj hints type} type] == 0} { 629 630 631 629 if {"" != $type} { 630 lappend settings -type $type 631 } 632 632 } 633 633 $viewer add $dataobj $settings … … 645 645 # VerifySequence -- 646 646 # 647 # 648 # 649 # 650 # 647 # Verifies the correctness of the sequence. The sequence must 648 # contain a homogenous set of elements. If the element is a 649 # "field", then also the dimensions of every component must be 650 # the same. 651 651 # 652 652 itcl::body Rappture::SequenceResult::VerifySequence {} { 653 653 654 # Step 1: 655 # 654 # Step 1: Use the topmost object as the standard. Check whether it 655 # can be sequenced. 656 656 set dataobj [lindex [$_topmost value 0] 0] 657 657 set _class [$dataobj info class] … … 659 659 set mode "" 660 660 switch -- $_class { 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 661 ::Rappture::Curve - 662 ::Rappture::DataTable - 663 ::Rappture::Image { 664 # empty 665 } 666 ::Rappture::Field { 667 set _dim [lindex [$dataobj components -dimensions] 0] 668 switch $_dim { 669 2D { 670 if { [$dataobj isunirect2d] } { 671 if { [$dataobj hints type] == "contour" } { 672 set mode "vtkcontour" 673 } else { 674 set mode "heightmap" 675 } 676 } else { 677 set mode "vtk" 678 } 679 Rappture::Field2DResult $viewer -mode $mode 680 } 681 "3D" { 682 # empty 683 } 684 default { 685 error "Found field element $_class with $_dim dimensions" 686 } 687 } 688 } 689 ::Rappture::LibraryObj { 690 set type [$dataobj element -as type] 691 if { $type != "structure" } { 692 error "Don't know how to view sequences of $type" 693 } 694 } 695 default { 696 puts stderr "Don't know how to view sequences of type \"$_class\"" 697 puts stderr "Is the sequence empty?" 698 return 0 699 } 700 700 } 701 701 702 # Step 2: 703 # 704 # 702 # Step 2: Review all the data objects. They must be all of the same 703 # class (e.g. can't mix curves with images). Also check that 704 # fields are all the same dimension. 705 705 foreach dataobj $_dlist { 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 706 set dataobj [lindex [$dataobj value 0] 0] 707 set class [$dataobj info class] 708 if { $_class != $class } { 709 puts stderr "Found element \"$class\" in sequence of \"$_class\"" 710 continue 711 } 712 if { $class == "::Rappture::Field" } { 713 # check to see if the dimensions are the same for all components 714 # in the elements of the field. I dont think we can display fields 715 # of differing dimensions within the same field object. 716 foreach dim [$dataobj components -dimensions] { 717 if { $_dim != $dim } { 718 error "Found field element of dimension \"$dim\" in sequence of $_dim dimension elements" 719 } 720 } 721 continue 722 } 723 723 } 724 724 if { $_class == "" } { 725 726 727 725 puts stderr "Don't know how to view sequences of class \"$_class\"" 726 puts stderr "Is the sequence empty?" 727 return 0 728 728 } 729 729 } … … 731 731 itcl::body Rappture::SequenceResult::AnimationPopup { popup info } { 732 732 if { ![winfo exists $popup] } { 733 734 735 736 737 738 739 740 733 # Create a popup for the print dialog 734 Rappture::Balloon $popup -title "Save as animation..." 735 set inner [$popup component inner] 736 737 # Create the print dialog widget and add it to the the balloon popup. 738 Rappture::SequenceAnimation $inner.print $this 739 $popup configure -deactivatecommand [list $inner.print reset] 740 blt::table $inner 0,0 $inner.print -fill both 741 741 } 742 742 update … … 753 753 itcl::body Rappture::SequenceResult::BuildViewer { viewer } { 754 754 switch -- $_class { 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 755 ::Rappture::Curve { 756 Rappture::XyResult $viewer 757 set _viewerclass ::Rappture::XyResult 758 set _animate 1 759 } 760 ::Rappture::DataTable { 761 Rappture::DataTable $viewer 762 set _viewerclass ::Rappture::DataTable 763 } 764 ::Rappture::Image { 765 Rappture::ImageResult $viewer 766 set _viewerclass ::Rappture::ImageResult 767 set _animate 1 768 } 769 ::Rappture::Field { 770 switch -- $_dim { 771 2D { 772 Rappture::Field2DResult $viewer -mode $mode 773 if { $_mode == "heightmap" } { 774 set _viewerclass ::Rappture::HeightmapViewer 775 set _animate 1 776 } 777 } 778 3D { 779 Rappture::Field3DResult $viewer 780 set _viewerclass ::Rappture::NanovisViewer 781 set _animate 1 782 } 783 } 784 } 785 ::Rappture::LibraryObj { 786 Rappture::DeviceResult $viewer 787 set _viewerclass ::Rappture::MolvisViewer 788 set _animate 1 789 } 790 790 } 791 791 pack $viewer -expand yes -fill both -
branches/blt4/gui/scripts/sidebarframe.tcl
r2742 r2745 48 48 public method pop {what} 49 49 public method width { size } { 50 50 set _width $size 51 51 } 52 52 public method enable { which } … … 198 198 # 199 199 # Note: Bugs in BLT 2.4 tabset/VNC server crashes the server 200 # 200 # when -outerpad is set to 0. 201 201 # 202 202 itk_component add tabs { … … 214 214 } 215 215 pack $itk_component(tabs) -side top -expand yes -anchor e -padx {4 0} \ 216 216 -fill y 217 217 218 218 eval itk_initialize $args -
branches/blt4/gui/scripts/textentry.tcl
r2534 r2745 87 87 set icon [$_owner xml get $path.about.icon] 88 88 if {[string length $icon] > 0} { 89 89 set _icon [image create photo -data $icon] 90 90 } 91 91 if {[string length $hints] > 0} { … … 362 362 frame $itk_interior.bin 363 363 } 364 365 366 367 364 set icon $_icon 365 if { $icon == "" } { 366 set icon [Rappture::icon binary] 367 } 368 368 itk_component add binicon { 369 369 ::label $itk_component(binary).binicon \ -
branches/blt4/gui/scripts/tool.tcl
r2742 r2745 205 205 -error ::Rappture::Tool::job(error) $cmd} result] 206 206 207 208 209 210 211 212 213 214 207 if { $status != 0 } { 208 foreach {code pid mesg} $::Rappture::Tool::job(control) break 209 if { $code != "EXITED" } { 210 set result "Abnormal program termination \"$code\": $mesg" 211 return [list $status $result] 212 } 213 } 214 } 215 215 # ...job is finished 216 216 array set times [Rappture::rusage measure] -
branches/blt4/gui/scripts/unirect2d.tcl
r2534 r2745 32 32 private method GetSize { obj path varName } 33 33 34 private variable _axisOrder 35 private variable _xMax 36 private variable _xMin 37 private variable _xNum 38 private variable _yMax 39 private variable _yMin 40 private variable _yNum 41 private variable _compNum 42 private variable _values "";# BLT vector containing the z-values34 private variable _axisOrder "x y" 35 private variable _xMax 0 36 private variable _xMin 0 37 private variable _xNum 0 38 private variable _yMax 0 39 private variable _yMin 0 40 private variable _yNum 0 41 private variable _compNum 1 42 private variable _values ""; # BLT vector containing the z-values 43 43 private variable _hints 44 44 } … … 79 79 ymin yaxis.min 80 80 ymax yaxis.max 81 typeabout.type81 type about.type 82 82 } { 83 83 set str [$m get $path] … … 117 117 # ---------------------------------------------------------------------- 118 118 # method blob 119 # 120 # 121 # 119 # Returns a base64 encoded, gzipped Tcl list that represents the 120 # Tcl command and data to recreate the uniform rectangular grid 121 # on the nanovis server. 122 122 # ---------------------------------------------------------------------- 123 123 itcl::body Rappture::Unirect2d::blob {} { … … 140 140 # ---------------------------------------------------------------------- 141 141 # method mesh.old 142 # 143 # 144 # 142 # Returns a base64 encoded, gzipped Tcl list that represents the 143 # Tcl command and data to recreate the uniform rectangular grid 144 # on the nanovis server. 145 145 # ---------------------------------------------------------------------- 146 146 itcl::body Rappture::Unirect2d::mesh.old {} { … … 160 160 # ---------------------------------------------------------------------- 161 161 # method mesh 162 # 163 # 164 # 162 # Returns a base64 encoded, gzipped Tcl list that represents the 163 # Tcl command and data to recreate the uniform rectangular grid 164 # on the nanovis server. 165 165 # ---------------------------------------------------------------------- 166 166 itcl::body Rappture::Unirect2d::mesh {} { … … 171 171 # ---------------------------------------------------------------------- 172 172 # method values 173 # 174 # 175 # 173 # Returns a base64 encoded, gzipped Tcl list that represents the 174 # Tcl command and data to recreate the uniform rectangular grid 175 # on the nanovis server. 176 176 # ---------------------------------------------------------------------- 177 177 itcl::body Rappture::Unirect2d::values {} { … … 184 184 # ---------------------------------------------------------------------- 185 185 # method limits <axis> 186 # 187 # 186 # Returns a list {min max} representing the limits for the 187 # specified axis. 188 188 # ---------------------------------------------------------------------- 189 189 itcl::body Rappture::Unirect2d::limits {which} { -
branches/blt4/gui/scripts/unirect3d.tcl
r1923 r2745 34 34 private method GetSize { obj path varName } 35 35 36 private variable _axisOrder 37 private variable _xMax 38 private variable _xMin 39 private variable _xNum 0;# Number of points along x-axis.40 private variable _yMax 41 private variable _yMin 42 private variable _yNum 0;# Number of points along y-axis.43 private variable _zMax 44 private variable _zMin 45 private variable _zNum 0;# Number of points along z-axis.46 private variable _compNum 1;# Number of components in values.47 private variable _values "";# BLT vector containing the z-values36 private variable _axisOrder "x y z" 37 private variable _xMax 0 38 private variable _xMin 0 39 private variable _xNum 0; # Number of points along x-axis. 40 private variable _yMax 0 41 private variable _yMin 0 42 private variable _yNum 0; # Number of points along y-axis. 43 private variable _zMax 0 44 private variable _zMin 0 45 private variable _zNum 0; # Number of points along z-axis. 46 private variable _compNum 1; # Number of components in values. 47 private variable _values ""; # BLT vector containing the z-values 48 48 private variable _hints 49 49 } … … 89 89 # ---------------------------------------------------------------------- 90 90 # method blob 91 # 92 # 93 # 91 # Returns a base64 encoded, gzipped Tcl list that represents the 92 # Tcl command and data to recreate the uniform rectangular grid 93 # on the nanovis server. 94 94 # ---------------------------------------------------------------------- 95 95 itcl::body Rappture::Unirect3d::blob {} { … … 107 107 # ---------------------------------------------------------------------- 108 108 # method mesh 109 # 110 # 111 # 109 # Returns a base64 encoded, gzipped Tcl list that represents the 110 # Tcl command and data to recreate the uniform rectangular grid 111 # on the nanovis server. 112 112 # ---------------------------------------------------------------------- 113 113 itcl::body Rappture::Unirect3d::mesh {} { … … 131 131 # ---------------------------------------------------------------------- 132 132 # method values 133 # 134 # 135 # 133 # Returns a base64 encoded, gzipped Tcl list that represents the 134 # Tcl command and data to recreate the uniform rectangular grid 135 # on the nanovis server. 136 136 # ---------------------------------------------------------------------- 137 137 itcl::body Rappture::Unirect3d::values {} { … … 144 144 # ---------------------------------------------------------------------- 145 145 # method limits <axis> 146 # 147 # 146 # Returns a list {min max} representing the limits for the 147 # specified axis. 148 148 # ---------------------------------------------------------------------- 149 149 itcl::body Rappture::Unirect3d::limits {which} { -
branches/blt4/gui/scripts/visviewer.tcl
r2742 r2745 26 26 27 27 protected variable _serverType "???";# Type of server. 28 protected variable _sid "" ;# socket connection to server29 private common _done ; 30 private variable _buffer ; 28 protected variable _sid "" ; # socket connection to server 29 private common _done ; # Used to indicate status of send. 30 private variable _buffer ; # buffer for incoming/outgoing commands 31 31 private variable _initialized 32 32 private variable _isOpen 0 … … 41 41 #private variable _idleTimeout 0; # No timeout 42 42 43 protected variable _dispatcher ""; 44 protected variable _hosts "" ; 45 protected variable _parser "" ; 43 protected variable _dispatcher ""; # dispatcher for !events 44 protected variable _hosts "" ; # list of hosts for server 45 protected variable _parser "" ; # interpreter for incoming commands 46 46 protected variable _image 47 47 protected variable _hostname … … 89 89 } 90 90 public proc SetServerList { type namelist } { 91 92 91 # Convert the comma separated list into a Tcl list. OGRE also adds 92 # a trailing comma that we want to ignore. 93 93 regsub -all "," $namelist " " namelist 94 94 CheckNameList $namelist … … 96 96 } 97 97 public proc RemoveServerFromList { type server } { 98 99 100 101 102 103 104 105 98 if { ![info exists _servers($type)] } { 99 error "unknown server type \"$type\"" 100 } 101 set i [lsearch $_servers($type) $server] 102 if { $i < 0 } { 103 return 104 } 105 set _servers($type) [lreplace $_servers($type) $i $i] 106 106 } 107 107 public proc SetPymolServerList { namelist } { … … 228 228 foreach server [Shuffle $hostlist] { 229 229 puts stderr "connecting to $server..." 230 230 foreach {hostname port} [split $server ":"] break 231 231 if { [catch {socket $hostname $port} _sid] != 0 } { 232 233 234 235 236 232 set _sid "" 233 RemoveServerFromList $_serverType $server 234 continue 235 } 236 set _hostname $server 237 237 fconfigure $_sid -translation binary -encoding binary 238 238 239 239 # Read back the server identification string. 240 240 if { [gets $_sid data] <= 0 } { 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 241 set _sid "" 242 puts stderr "reading from server" 243 RemoveServerFromList $_serverType $server 244 continue 245 } 246 puts stderr "render server is $data" 247 # We're connected. Cancel any pending serverDown events and 248 # release the busy window over the hull. 249 $_dispatcher cancel !serverDown 250 if { $_idleTimeout > 0 } { 251 $_dispatcher event -after $_idleTimeout !timeout 252 } 253 blt::busy release $itk_component(hull) 254 fconfigure $_sid -buffering line 255 fileevent $_sid readable [itcl::code $this ReceiveHelper] 256 return 1 257 257 } 258 258 blt::busy release $itk_component(hull) … … 284 284 itcl::body Rappture::VisViewer::IsConnected {} { 285 285 if { $_sid == "" } { 286 286 return 0 287 287 } 288 288 if { [eof $_sid] } { 289 290 289 set _sid "" 290 return 0 291 291 } 292 292 return 1 … … 304 304 $_dispatcher cancel !timeout 305 305 if { $_idleTimeout > 0 } { 306 306 $_dispatcher event -after $_idleTimeout !timeout 307 307 } 308 308 if { [IsConnected] } { 309 309 return 1 310 310 } 311 311 if { $_sid != "" } { 312 312 fileevent $_sid writable "" 313 313 } 314 314 # If we aren't connected, assume it's because the connection to the … … 355 355 puts -nonewline $_sid $_buffer(out) 356 356 flush $_sid 357 set _done($this) 1; 357 set _done($this) 1; # Success 358 358 } 359 359 … … 569 569 set _afterId -1 570 570 if { $state } { 571 572 573 574 575 576 577 578 579 580 581 582 583 571 if { [winfo exists $itk_component(plotarea).view.splash] } { 572 return 573 } 574 set inner [frame $itk_component(plotarea).view.splash] 575 $inner configure -relief raised -bd 2 576 label $inner.text1 -text "Rendering, please wait." \ 577 -font "Arial 10" 578 label $inner.icon 579 pack $inner -expand yes -anchor c 580 blt::table $inner \ 581 0,0 $inner.text1 -anchor w \ 582 0,1 $inner.icon 583 Waiting start $inner.icon 584 584 } else { 585 586 587 588 589 585 if { ![winfo exists $itk_component(plotarea).view.splash] } { 586 return 587 } 588 Waiting stop $itk_component(plotarea).view.splash 589 destroy $itk_component(plotarea).view.splash 590 590 } 591 591 } -
branches/blt4/gui/scripts/vtkcontourviewer.tcl
r2742 r2745 168 168 169 169 array set _outline { 170 171 172 173 174 175 170 id -1 171 afterId -1 172 x1 -1 173 y1 -1 174 x2 -1 175 y2 -1 176 176 } 177 177 178 178 # Initialize the view to some default parameters. 179 179 array set _view { 180 qx0181 qy0182 qz0183 qw1184 zoom 185 pan-x 186 pan-y 180 qx 0 181 qy 0 182 qz 0 183 qw 1 184 zoom 1.0 185 pan-x 0 186 pan-y 0 187 187 ortho-x 0.0 188 188 ortho-y 0.0 189 ortho-w-1.0190 ortho-h-1.0189 ortho-w -1.0 190 ortho-h -1.0 191 191 } 192 192 set _arcball [blt::arcball create 100 100] … … 198 198 199 199 array set _settings [subst { 200 $this-axes 201 $this-edges 202 $this-lighting 203 $this-opacity 204 $this-volume 205 $this-isolines 206 $this-wireframe 207 $this-legend 208 $this-colormap 200 $this-axes 1 201 $this-edges 0 202 $this-lighting 1 203 $this-opacity 100 204 $this-volume 1 205 $this-isolines 1 206 $this-wireframe 0 207 $this-legend 1 208 $this-colormap 1 209 209 }] 210 210 … … 374 374 itcl::body Rappture::VtkContourViewer::DoResize {} { 375 375 if { $_width < 2 } { 376 376 set _width 500 377 377 } 378 378 if { $_height < 2 } { 379 379 set _height 500 380 380 } 381 381 SendCmd "screen size $_width $_height" 382 382 if { $_settings($this-legend) } { 383 383 EventuallyResizeLegend 384 384 } 385 385 set _resizePending 0 … … 419 419 -description "" 420 420 -param "" 421 421 -type "" 422 422 } 423 423 foreach {opt val} $settings { … … 589 589 set word [Rappture::filexfer::label downloadWord] 590 590 $inner.summary configure -text "$word $num in the following format:" 591 update idletasks 591 update idletasks ;# Fix initial sizes 592 592 return $popup 593 593 } … … 731 731 if {$w > 0 && $h > 0 && $_first != "" } { 732 732 set tag [lindex [CurrentDatasets] 0] 733 733 puts stderr "tag=$tag [info exists _dataset2style($tag)]" 734 734 if { [info exists _dataset2style($tag)] } { 735 735 SendCmd "legend $_dataset2style($tag) scalar {} $w $h 0" … … 743 743 # DrawLegend -- 744 744 # 745 # 746 # 745 # Draws the legend in it's own canvas which resides to the right 746 # of the contour plot area. 747 747 # 748 748 itcl::body Rappture::VtkContourViewer::DrawLegend {} { … … 754 754 755 755 if { $_settings($this-legend) } { 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 756 if { [$c find withtag "legend"] == "" } { 757 $c create image [expr {$w-2}] [expr {$lineht+2}] -anchor ne \ 758 -image $_image(legend) -tags "transfunc legend" 759 $c create text [expr {$w-2}] 2 -anchor ne \ 760 -fill $itk_option(-plotforeground) -tags "vmax legend" \ 761 -font "Arial 6" 762 $c create text [expr {$w-2}] [expr {$h-2}] -anchor se \ 763 -fill $itk_option(-plotforeground) -tags "vmin legend" \ 764 -font "Arial 6" 765 } 766 # Reset the item coordinates according the current size of the plot. 767 $c coords transfunc [expr {$w-2}] [expr {$lineht+2}] 768 if { $_limits(vmin) != "" } { 769 $c itemconfigure vmin -text [format %g $_limits(vmin)] 770 } 771 if { $_limits(vmax) != "" } { 772 $c itemconfigure vmax -text [format %g $_limits(vmax)] 773 } 774 $c coords vmin [expr {$w-2}] [expr {$h-2}] 775 $c coords vmax [expr {$w-2}] 2 776 776 } 777 777 } … … 793 793 $_image(legend) configure -data $bytes 794 794 puts stderr "read $size bytes for [image width $_image(legend)]x[image height $_image(legend)] legend>" 795 795 DrawLegend 796 796 } 797 797 } … … 806 806 set option [lindex $args 0] 807 807 switch -- $option { 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 808 "scalar" { 809 set option [lindex $args 1] 810 switch -- $option { 811 "world" { 812 foreach { x y z value tag } [lrange $args 2 end] break 813 puts stderr "world x=$x y=$y z=$z value=$value tag=$tag" 814 } 815 "pixel" { 816 foreach { x y value tag } [lrange $args 2 end] break 817 puts stderr "pixel x=$x y=$y value=$value tag=$tag" 818 } 819 } 820 } 821 "vector" { 822 set option [lindex $args 1] 823 switch -- $option { 824 "world" { 825 foreach { x y z vx vy vz tag } [lrange $args 2 end] break 826 826 puts stderr "world x=$x y=$y z=$z value=$vx $xy $vz tag=$tag" 827 828 829 827 } 828 "pixel" { 829 foreach { x y vx vy vz tag } [lrange $args 2 end] break 830 830 puts stderr "pixel x=$x y=$y value=$vx $xy $vz tag=$tag" 831 832 833 834 831 } 832 } 833 } 834 "names" { 835 835 foreach { name } [lindex $args 1] { 836 836 puts stderr "Dataset: $name" 837 837 } 838 839 840 841 838 } 839 default { 840 error "unknown dataset option \"$option\" from server" 841 } 842 842 } 843 843 } … … 875 875 append _outbuf "dataset add $tag data follows $length\n" 876 876 append _outbuf $bytes 877 878 877 append _outbuf "heightmap add numcontours [expr {$style(-levels)+1}] 0 $tag\n" 878 SetStyles $dataobj $comp 879 879 set _datasets($tag) 1 880 881 882 883 884 885 886 887 880 foreach {min max} [$dataobj limits v] break 881 if { ($_limits(vmin) == "") || ($min < $_limits(vmin)) } { 882 set _limits(vmin) $min 883 } 884 if { ($_limits(vmax) == "") || ($max < $_limits(vmax)) } { 885 set _limits(vmax) $max 886 } 887 } 888 888 } 889 889 } … … 913 913 # Nothing to send -- activate the proper ivol 914 914 foreach tag [CurrentDatasets] { 915 915 SendCmd "dataset visible 0 $tag" 916 916 } 917 917 set _first [lindex [get] 0] … … 954 954 set tag $_first-$comp 955 955 if { [info exists _datasets($tag)] && $_datasets($tag) } { 956 956 lappend rlist $tag 957 957 } 958 958 } … … 972 972 "in" { 973 973 set _view(zoom) [expr {$_view(zoom)*1.25}] 974 974 SendCmd "camera zoom $_view(zoom)" 975 975 } 976 976 "out" { 977 977 set _view(zoom) [expr {$_view(zoom)*0.8}] 978 978 SendCmd "camera zoom $_view(zoom)" 979 979 } 980 980 "reset" { 981 981 array set _view { 982 qx 982 qx 0 983 983 qy 0 984 984 qz 0 … … 996 996 } 997 997 set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)] 998 998 $_arcball quaternion $q 999 999 } 1000 1000 } … … 1041 1041 } 1042 1042 set q [$_arcball rotate $x $y $_click(x) $_click(y)] 1043 1043 foreach { _view(qw) _view(qx) _view(qy) _view(qz) } $q break 1044 1044 SendCmd "camera orient $q" 1045 1045 set _click(x) $x … … 1074 1074 itcl::body Rappture::VtkContourViewer::Pan {option x y} { 1075 1075 switch -- $option { 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1076 "set" { 1077 set w [winfo width $itk_component(view)] 1078 set h [winfo height $itk_component(view)] 1079 set x [expr $x / double($w)] 1080 set y [expr $y / double($h)] 1081 set _view(pan-x) [expr $_view(pan-x) + $x] 1082 set _view(pan-y) [expr $_view(pan-y) + $y] 1083 PanCamera 1084 return 1085 } 1086 "click" { 1087 set _click(x) $x 1088 set _click(y) $y 1089 $itk_component(view) configure -cursor hand1 1090 } 1091 "drag" { 1092 set w [winfo width $itk_component(view)] 1093 set h [winfo height $itk_component(view)] 1094 set dx [expr ($_click(x) - $x)/double($w)] 1095 set dy [expr ($_click(y) - $y)/double($h)] 1096 set _click(x) $x 1097 set _click(y) $y 1098 set _view(pan-x) [expr $_view(pan-x) - $dx] 1099 set _view(pan-y) [expr $_view(pan-y) - $dy] 1100 PanCamera 1101 } 1102 "release" { 1103 Pan drag $x $y 1104 $itk_component(view) configure -cursor "" 1105 } 1106 default { 1107 error "unknown option \"$option\": should set, click, drag, or release" 1108 } 1109 1109 } 1110 1110 } … … 1123 1123 set val $_settings($this-opacity) 1124 1124 set sval [expr { 0.01 * double($val) }] 1125 1126 1127 1125 foreach dataset [CurrentDatasets] { 1126 SendCmd "heightmap opacity $sval $dataset" 1127 } 1128 1128 } 1129 1129 } 1130 1130 "wireframe" { 1131 1131 if {[isconnected]} { 1132 1133 1134 1135 1132 set bool $_settings($this-wireframe) 1133 foreach dataset [CurrentDatasets] { 1134 SendCmd "heightmap wireframe $bool $dataset" 1135 } 1136 1136 } 1137 1137 } 1138 1138 "colormap" { 1139 1139 if {[isconnected]} { 1140 1141 1142 1143 1140 set bool $_settings($this-colormap) 1141 foreach dataset [CurrentDatasets] { 1142 SendCmd "heightmap surface $bool $dataset" 1143 } 1144 1144 } 1145 1145 } 1146 1146 "isolines" { 1147 1147 if {[isconnected]} { 1148 1149 1150 1151 1148 set bool $_settings($this-isolines) 1149 foreach dataset [CurrentDatasets] { 1150 SendCmd "heightmap isolines $bool $dataset" 1151 } 1152 1152 } 1153 1153 } 1154 1154 "edges" { 1155 1155 if {[isconnected]} { 1156 1157 1158 1159 1156 set bool $_settings($this-edges) 1157 foreach dataset [CurrentDatasets] { 1158 SendCmd "heightmap edges $bool $dataset" 1159 } 1160 1160 } 1161 1161 } 1162 1162 "lighting" { 1163 1163 if {[isconnected]} { 1164 1165 1166 1167 1164 set bool $_settings($this-lighting) 1165 foreach dataset [CurrentDatasets] { 1166 SendCmd "heightmap lighting $bool $dataset" 1167 } 1168 1168 } 1169 1169 } 1170 1170 "axes" { 1171 1171 if { [isconnected] } { 1172 1172 set bool $_settings($this-axes) 1173 1173 SendCmd "axis visible all $bool" 1174 1174 } … … 1204 1204 set colormap "$style(-color):$style(-levels):$style(-opacity)" 1205 1205 if { [info exists _colormaps($colormap)] } { 1206 1206 puts stderr "Colormap $colormap already built" 1207 1207 } 1208 1208 if { ![info exists _dataset2style($tag)] } { 1209 1210 1209 set _dataset2style($tag) $colormap 1210 lappend _style2datasets($colormap) $tag 1211 1211 } 1212 1212 if { ![info exists _colormaps($colormap)] } { 1213 1214 1215 1213 # Build the pseudo colormap if it doesn't exist. 1214 BuildColormap $colormap $dataobj $comp 1215 set _colormaps($colormap) 1 1216 1216 } 1217 1217 #SendCmd "heightmap numcontours $style(-levels) $tag\n" … … 1243 1243 } 1244 1244 if { [llength $cmap] == 0 } { 1245 1245 set cmap "0.0 0.0 0.0 0.0 1.0 1.0 1.0 1.0" 1246 1246 } 1247 1247 set tag $this-$colormap … … 1429 1429 "qx" - "qy" - "qz" - "qw" { 1430 1430 set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)] 1431 1431 $_arcball quaternion $q 1432 1432 #SendCmd "camera orient $q" 1433 1433 } … … 1524 1524 # MarchingAnts -- 1525 1525 # 1526 # 1527 # 1528 # 1526 # Called from "after" timer events. This routine is changes 1527 # the dash offset of the selection outline rectangle to simulate 1528 # marching ants. 1529 1529 # 1530 1530 itcl::body Rappture::VtkContourViewer::MarchingAnts {} { 1531 1531 set c $itk_component(view) 1532 1532 if { [winfo exists $c] && ![winfo viewable $c] } { 1533 1534 1533 KillSelectionRectangle 1534 return 1535 1535 } 1536 1536 $c itemconfigure $_outline(id) -dashoffset $_outline(offset) … … 1542 1542 # BeginSelectionRectangle -- 1543 1543 # 1544 # 1545 # 1546 # 1544 # Called from ButtonPress-1 events. This routine creates the 1545 # the selection outline rectangle. It also clears the selection 1546 # in the sensor tree. 1547 1547 # 1548 1548 itcl::body Rappture::VtkContourViewer::BeginSelectionRectangle { x y } { … … 1551 1551 set y [$c canvasy $y] 1552 1552 if { $_outline(id) >= 0 } { 1553 1554 1555 1556 1553 after cancel $_outline(afterId) 1554 set _outline(afterId) -1 1555 $c delete $_outline(id) 1556 set _outline(id) -1 1557 1557 } 1558 1558 set _outline(offset) 0 … … 1560 1560 set _outline(y1) $y 1561 1561 set _outline(id) \ 1562 1562 [$c create line $x $y $x $y -dash "4 4" -width 2 -fill black] 1563 1563 MarchingAnts 1564 1564 } … … 1567 1567 # AdjustSelectionRectangle -- 1568 1568 # 1569 # 1570 # 1571 # 1569 # Called from B1-Motion events. This routine redraws the selection 1570 # outline rectangle and redraws the sensors using the "selected" 1571 # icon. 1572 1572 # 1573 1573 itcl::body Rappture::VtkContourViewer::AdjustSelectionRectangle { x y } { … … 1576 1576 set y [$c canvasy $y] 1577 1577 $c coords $_outline(id) $_outline(x1) $_outline(y1) $_outline(x1) $y \ 1578 1578 $x $y $x $_outline(y1) $_outline(x1) $_outline(y1) 1579 1579 set _outline(x2) $x 1580 1580 set _outline(y2) $y … … 1584 1584 # KillSelectionRectangle -- 1585 1585 # 1586 # 1587 # 1586 # Removes the outline rectangle and adjusts the sensor icon 1587 # according to the sensor's selected/deselected status. 1588 1588 # 1589 1589 itcl::body Rappture::VtkContourViewer::KillSelectionRectangle { } { … … 1598 1598 # EndSelectionRectangle -- 1599 1599 # 1600 # 1601 # 1602 # 1603 # 1604 # 1600 # Called from the ButtonRelease event to finish the outline of the 1601 # selection rectangle. If the outline is too small (less than 10 1602 # pixels in length or width) the outline is removed and the selection 1603 # is ignored. Otherwise a popup menu is automatically generated and 1604 # displayed. 1605 1605 # 1606 1606 itcl::body Rappture::VtkContourViewer::EndSelectionRectangle { x y } { … … 1612 1612 set ch [winfo height $c] 1613 1613 if { abs($_outline(x1) - $cx) < 10 && abs($_outline(y1) - $cy) < 10 } { 1614 1614 KillSelectionRectangle 1615 1615 } else { 1616 1616 # Need x,y coordinates to be in the bottom left for camera ortho … … 1629 1629 set h [expr int($_outline(y1) - $_outline(y2))] 1630 1630 } 1631 1632 1631 SendCmd "camera ortho pixel $ox $oy $w $h" 1632 KillSelectionRectangle 1633 1633 } 1634 1634 } … … 1639 1639 foreach comp [$dataobj components] { 1640 1640 set tag $dataobj-$comp 1641 1642 1641 set contents [ConvertToVtkData $dataobj $comp] 1642 append bytes "$contents\n\n" 1643 1643 } 1644 1644 } … … 1648 1648 itcl::body Rappture::VtkContourViewer::GetImage { args } { 1649 1649 if { [image width $_image(download)] > 0 && 1650 1651 1652 1653 1650 [image height $_image(download)] > 0 } { 1651 set bytes [$_image(download) data -format "jpeg -quality 100"] 1652 set bytes [Rappture::encoding::decode -as b64 $bytes] 1653 return [list .jpg $bytes] 1654 1654 } 1655 1655 return "" … … 1673 1673 1674 1674 button $inner.ok -text "Save" \ 1675 1675 -highlightthickness 0 -pady 2 -padx 3 \ 1676 1676 -command $command \ 1677 1678 1677 -compound left \ 1678 -image [Rappture::icon download] 1679 1679 1680 1680 button $inner.cancel -text "Cancel" \ 1681 1682 1683 1684 1681 -highlightthickness 0 -pady 2 -padx 3 \ 1682 -command [list $popup deactivate] \ 1683 -compound left \ 1684 -image [Rappture::icon cancel] 1685 1685 1686 1686 blt::table $inner \ -
branches/blt4/gui/scripts/vtkstreamlinesviewer.tcl
r2742 r2745 114 114 115 115 private variable _arcball "" 116 private variable _outbuf ; 117 118 private variable _dlist "" ; 116 private variable _outbuf ; # buffer for outgoing commands 117 118 private variable _dlist "" ; # list of data objects 119 119 private variable _obj2datasets 120 private variable _obj2ovride ; 121 private variable _datasets ; 122 ; 123 private variable _colormaps ; 124 ; 120 private variable _obj2ovride ; # maps dataobj => style override 121 private variable _datasets ; # contains all the dataobj-component 122 ; # datasets in the server 123 private variable _colormaps ; # contains all the colormaps 124 ; # in the server. 125 125 private variable _dataset2style ;# maps dataobj-component to transfunc 126 126 127 private variable _click ; 128 private variable _limits ; 129 private variable _view ; 127 private variable _click ; # info used for rotate operations 128 private variable _limits ; # autoscale min/max for all axes 129 private variable _view ; # view params for 3D view 130 130 private variable _settings 131 private variable _style; 132 private variable _initialStyle; 133 private variable _reset 1; 134 135 136 private variable _first "" ; 131 private variable _style; # Array of current component styles. 132 private variable _initialStyle; # Array of initial component styles. 133 private variable _reset 1; # indicates if camera needs to be reset 134 # to starting position. 135 136 private variable _first "" ; # This is the topmost dataset. 137 137 private variable _start 0 138 138 private variable _buffering 0 … … 140 140 private variable _seeds 141 141 142 common _downloadPopup; 142 common _downloadPopup; # download options from popup 143 143 private common _hardcopy 144 144 private variable _width 0 … … 154 154 private variable _fields 155 155 private variable _currentField "" 156 private variable _field 156 private variable _field "" 157 157 private variable _numSeeds 200 158 158 private variable _colorMode "vmag";# Mode of colormap (vmag or scalar) … … 194 194 $_dispatcher register !xcutplane 195 195 $_dispatcher dispatch $this !xcutplane \ 196 196 "[itcl::code $this AdjustSetting cutplane-xposition]; list" 197 197 198 198 # Y-Cutplane event 199 199 $_dispatcher register !ycutplane 200 200 $_dispatcher dispatch $this !ycutplane \ 201 201 "[itcl::code $this AdjustSetting cutplane-yposition]; list" 202 202 203 203 # Z-Cutplane event 204 204 $_dispatcher register !zcutplane 205 205 $_dispatcher dispatch $this !zcutplane \ 206 206 "[itcl::code $this AdjustSetting cutplane-zposition]; list" 207 207 208 208 # … … 214 214 215 215 array set _outline { 216 217 218 219 220 221 216 id -1 217 afterId -1 218 x1 -1 219 y1 -1 220 x2 -1 221 y2 -1 222 222 } 223 223 # Initialize the view to some default parameters. 224 224 array set _view { 225 qw1226 qx0227 qy0228 qz0229 zoom 230 xpan 231 ypan 232 ortho 225 qw 1 226 qx 0 227 qy 0 228 qz 0 229 zoom 1.0 230 xpan 0 231 ypan 0 232 ortho 0 233 233 } 234 234 set _arcball [blt::arcball create 100 100] … … 240 240 241 241 array set _settings [subst { 242 axis-xgrid 243 axis-ygrid 244 axis-zgrid 245 axis-xcutplane 246 axis-ycutplane 247 axis-zcutplane 248 axis-xposition 249 axis-yposition 250 axis-zposition 251 axis-visible 252 axis-labels1253 cutplane-edges 254 cutplane-xvisible 255 cutplane-yvisible 256 cutplane-zvisible 257 cutplane-xposition 258 cutplane-yposition 259 cutplane-zposition 260 cutplane-visible 261 cutplane-wireframe 262 cutplane-opacity100263 volume-edges 264 volume-lighting 265 volume-opacity 266 volume-visible 267 volume-wireframe 268 streamlines-seeds 269 streamlines-visible 270 streamlines-opacity 271 streamlines-numpoints 272 streamlines-lighting 273 streamlines-scale 274 legend-visible 242 axis-xgrid 0 243 axis-ygrid 0 244 axis-zgrid 0 245 axis-xcutplane 0 246 axis-ycutplane 0 247 axis-zcutplane 0 248 axis-xposition 0 249 axis-yposition 0 250 axis-zposition 0 251 axis-visible 1 252 axis-labels 1 253 cutplane-edges 0 254 cutplane-xvisible 0 255 cutplane-yvisible 0 256 cutplane-zvisible 0 257 cutplane-xposition 50 258 cutplane-yposition 50 259 cutplane-zposition 50 260 cutplane-visible 1 261 cutplane-wireframe 0 262 cutplane-opacity 100 263 volume-edges 0 264 volume-lighting 1 265 volume-opacity 40 266 volume-visible 1 267 volume-wireframe 0 268 streamlines-seeds 0 269 streamlines-visible 1 270 streamlines-opacity 100 271 streamlines-numpoints 200 272 streamlines-lighting 1 273 streamlines-scale 1 274 legend-visible 1 275 275 }] 276 276 … … 285 285 itk_component add fieldmenu { 286 286 menu $itk_component(plotarea).menu -bg black -fg white -relief flat \ 287 287 -tearoff no 288 288 } { 289 290 289 usual 290 ignore -background -foreground -relief -tearoff 291 291 } 292 292 set c $itk_component(view) … … 350 350 -onimage [Rappture::icon volume-on] \ 351 351 -offimage [Rappture::icon volume-off] \ 352 353 352 -variable [itcl::scope _settings(volume-visible)] \ 353 -command [itcl::code $this AdjustSetting volume-visible] 354 354 } 355 355 $itk_component(volume) select … … 362 362 -onimage [Rappture::icon streamlines-on] \ 363 363 -offimage [Rappture::icon streamlines-off] \ 364 365 364 -variable [itcl::scope _settings(streamlines-visible)] \ 365 -command [itcl::code $this AdjustSetting streamlines-visible] \ 366 366 } 367 367 $itk_component(streamlines) select … … 374 374 -onimage [Rappture::icon cutbutton] \ 375 375 -offimage [Rappture::icon cutbutton] \ 376 377 376 -variable [itcl::scope _settings(cutplane-visible)] \ 377 -command [itcl::code $this AdjustSetting cutplane-visible] 378 378 } 379 379 $itk_component(cutplane) select … … 384 384 385 385 if { [catch { 386 387 388 389 390 386 BuildVolumeTab 387 BuildStreamsTab 388 BuildCutplaneTab 389 BuildAxisTab 390 BuildCameraTab 391 391 } errs] != 0 } { 392 392 puts stderr errs=$errs 393 393 } 394 394 # Legend … … 488 488 itcl::body Rappture::VtkStreamlinesViewer::DoResize {} { 489 489 if { $_width < 2 } { 490 490 set _width 500 491 491 } 492 492 if { $_height < 2 } { 493 493 set _height 500 494 494 } 495 495 set _start [clock clicks -milliseconds] … … 513 513 itcl::body Rappture::VtkStreamlinesViewer::DoReseed {} { 514 514 foreach dataset [CurrentDatasets -visible] { 515 516 517 515 foreach {dataobj comp} [split $dataset -] break 516 # This command works for either random or fmesh seeds 517 SendCmd "streamlines seed numpts $_numSeeds $dataset" 518 518 } 519 519 set _reseedPending 0 … … 544 544 if { !$_rotatePending } { 545 545 set _rotatePending 1 546 546 global rotate_delay 547 547 $_dispatcher event -after $rotate_delay !rotate 548 548 } … … 572 572 -description "" 573 573 -param "" 574 574 -type "" 575 575 } 576 576 array set params $settings … … 589 589 set pos [lsearch -exact $dataobj $_dlist] 590 590 if {$pos < 0} { 591 591 lappend _dlist $dataobj 592 592 } 593 593 set _obj2ovride($dataobj-color) $params(-color) … … 614 614 foreach dataobj $args { 615 615 set pos [lsearch -exact $_dlist $dataobj] 616 617 continue;# Don't know anything about it.618 619 620 621 622 623 624 625 626 616 if { $pos < 0 } { 617 continue; # Don't know anything about it. 618 } 619 # Remove it from the dataobj list. 620 set _dlist [lreplace $_dlist $pos $pos] 621 SendCmd "dataset visible 0" 622 array unset _obj2ovride $dataobj-* 623 array unset _settings $dataobj-* 624 # Append to the end of the dataobj list. 625 lappend _dlist $dataobj 626 set changed 1 627 627 } 628 628 # If anything changed, then rebuild the plot … … 648 648 set op [lindex $args 0] 649 649 switch -- $op { 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 }686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 650 "-objects" { 651 # put the dataobj list in order according to -raise options 652 set dlist {} 653 foreach dataobj $_dlist { 654 if { ![IsValidObject $dataobj] } { 655 continue 656 } 657 if {[info exists _obj2ovride($dataobj-raise)] && 658 $_obj2ovride($dataobj-raise)} { 659 set dlist [linsert $dlist 0 $dataobj] 660 } else { 661 lappend dlist $dataobj 662 } 663 } 664 return $dlist 665 } 666 "-visible" { 667 set dlist {} 668 foreach dataobj $_dlist { 669 if { ![IsValidObject $dataobj] } { 670 continue 671 } 672 if { ![info exists _obj2ovride($dataobj-raise)] } { 673 # No setting indicates that the object isn't visible. 674 continue 675 } 676 # Otherwise use the -raise parameter to put the object to 677 # the front of the list. 678 if { $_obj2ovride($dataobj-raise) } { 679 set dlist [linsert $dlist 0 $dataobj] 680 } else { 681 lappend dlist $dataobj 682 } 683 } 684 return $dlist 685 } 686 -image { 687 if {[llength $args] != 2} { 688 error "wrong # args: should be \"get -image view\"" 689 } 690 switch -- [lindex $args end] { 691 view { 692 return $_image(plot) 693 } 694 default { 695 error "bad image name \"[lindex $args end]\": should be view" 696 } 697 } 698 } 699 default { 700 error "bad option \"$op\": should be -objects or -image" 701 } 702 702 } 703 703 } … … 715 715 array unset _limits 716 716 foreach dataobj $args { 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 717 set string [limits $dataobj] 718 if { $string == "" } { 719 continue 720 } 721 array set bounds $string 722 if {![info exists _limits(xmin)] || $_limits(xmin) > $bounds(xmin)} { 723 set _limits(xmin) $bounds(xmin) 724 } 725 if {![info exists _limits(xmax)] || $_limits(xmax) < $bounds(xmax)} { 726 set _limits(xmax) $bounds(xmax) 727 } 728 729 if {![info exists _limits(ymin)] || $_limits(ymin) > $bounds(ymin)} { 730 set _limits(ymin) $bounds(ymin) 731 } 732 if {![info exists _limits(ymax)] || $_limits(ymax) < $bounds(ymax)} { 733 set _limits(ymax) $bounds(ymax) 734 } 735 736 if {![info exists _limits(zmin)] || $_limits(zmin) > $bounds(zmin)} { 737 set _limits(zmin) $bounds(zmin) 738 } 739 if {![info exists _limits(zmax)] || $_limits(zmax) < $bounds(zmax)} { 740 set _limits(zmax) $bounds(zmax) 741 } 742 742 } 743 743 } … … 775 775 set word [Rappture::filexfer::label downloadWord] 776 776 $inner.summary configure -text "$word $num in the following format:" 777 update idletasks 777 update idletasks ;# Fix initial sizes 778 778 return $popup 779 779 } … … 884 884 } else { 885 885 SendBytes "$string\n" 886 886 StartWaiting 887 887 } 888 888 } … … 920 920 StopWaiting 921 921 if { $info(-type) == "image" } { 922 923 924 925 926 922 if 0 { 923 set f [open "last.ppm" "w"] 924 puts $f $bytes 925 close $f 926 } 927 927 $_image(plot) configure -data $bytes 928 929 928 set time [clock seconds] 929 set date [clock format $time] 930 930 #puts stderr "$date: received image [image width $_image(plot)]x[image height $_image(plot)] image>" 931 932 933 934 935 931 if { $_start > 0 } { 932 set finish [clock clicks -milliseconds] 933 #puts stderr "round trip time [expr $finish -$_start] milliseconds" 934 set _start 0 935 } 936 936 } elseif { $info(type) == "print" } { 937 937 set tag $this-print-$info(-token) … … 939 939 } 940 940 if { $_legendPending } { 941 941 RequestLegend 942 942 } 943 943 } … … 952 952 set option [lindex $args 0] 953 953 switch -- $option { 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 954 "scalar" { 955 set option [lindex $args 1] 956 switch -- $option { 957 "world" { 958 foreach { x y z value tag } [lrange $args 2 end] break 959 } 960 "pixel" { 961 foreach { x y value tag } [lrange $args 2 end] break 962 } 963 } 964 } 965 "vector" { 966 set option [lindex $args 1] 967 switch -- $option { 968 "world" { 969 foreach { x y z vx vy vz tag } [lrange $args 2 end] break 970 } 971 "pixel" { 972 foreach { x y vx vy vz tag } [lrange $args 2 end] break 973 } 974 } 975 } 976 "names" { 977 977 foreach { name } [lindex $args 1] { 978 978 #puts stderr "Dataset: $name" 979 979 } 980 981 982 983 980 } 981 default { 982 error "unknown dataset option \"$option\" from server" 983 } 984 984 } 985 985 } … … 997 997 set h [winfo height $itk_component(view)] 998 998 if { $w < 2 || $h < 2 } { 999 1000 999 $_dispatcher event -idle !rebuild 1000 return 1001 1001 } 1002 1002 … … 1024 1024 set _first "" 1025 1025 InitSettings axis-xgrid axis-ygrid axis-zgrid axis-mode \ 1026 1027 1028 1026 axis-visible axis-labels cutplane-visible \ 1027 cutplane-xposition cutplane-yposition cutplane-zposition \ 1028 cutplane-xvisible cutplane-yvisible cutplane-zvisible 1029 1029 1030 1030 SendCmd "imgflush" … … 1034 1034 set _first "" 1035 1035 foreach dataobj [get -objects] { 1036 1037 1038 1039 1036 if { [info exists _obj2ovride($dataobj-raise)] && $_first == "" } { 1037 set _first $dataobj 1038 } 1039 set _obj2datasets($dataobj) "" 1040 1040 foreach comp [$dataobj components] { 1041 1041 set tag $dataobj-$comp … … 1046 1046 append _outbuf $bytes 1047 1047 set _datasets($tag) 1 1048 1049 1050 1051 1052 1053 1054 1055 1048 SetObjectStyle $dataobj $comp 1049 } 1050 lappend _obj2datasets($dataobj) $tag 1051 if { [info exists _obj2ovride($dataobj-raise)] } { 1052 SendCmd "dataset visible 1 $tag" 1053 } else { 1054 SendCmd "dataset visible 0 $tag" 1055 } 1056 1056 } 1057 1057 } … … 1062 1062 } 1063 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1064 if 0 { 1065 # Tell the server the name of the tool, the version, and dataset 1066 # that we are rendering. Have to do it here because we don't know 1067 # what data objects are using the renderer until be get here. 1068 set args "" 1069 lappend args tool [$_first hints toolId] 1070 lappend args version [$_first hints toolRevision] 1071 lappend args dataset [$_first hints label] 1072 SendCmd "clientinfo $args" 1073 } 1074 1075 foreach axis { x y z } { 1076 set label [$_first hints ${axis}label] 1077 if { $label != "" } { 1078 SendCmd "axis name $axis $label" 1079 } 1080 set units [$_first hints ${axis}units] 1081 if { $units != "" } { 1082 SendCmd "axis units $axis $units" 1083 } 1084 } 1085 array unset _scalarFields 1086 array unset _vectorFields 1087 set _currentField [$_first hints default] 1088 $itk_component(field) choices delete 0 end 1089 $itk_component(fieldmenu) delete 0 end 1090 array unset _fields 1091 foreach { name title units } [$_first hints vectors] { 1092 set _vectorFields($title) $name 1093 $itk_component(field) choices insert end "$name" "$title" 1094 $itk_component(fieldmenu) add radiobutton -label "$title" \ 1095 -value $title -variable [itcl::scope _currentField] \ 1096 -selectcolor red \ 1097 -activebackground black \ 1098 -activeforeground white \ 1099 -font "Arial 8" \ 1100 -command [itcl::code $this Combo invoke] 1101 set _fields($name) [list $title $units] 1102 } 1103 foreach { name title units } [$_first hints scalars] { 1104 set _scalarFields($title) $name 1105 $itk_component(field) choices insert end "$name" "$title" 1106 $itk_component(fieldmenu) add radiobutton -label "$title" \ 1107 -value $title -variable [itcl::scope _currentField] \ 1108 -selectcolor red \ 1109 -activebackground black \ 1110 -activeforeground white \ 1111 -font "Arial 8" \ 1112 -command [itcl::code $this Combo invoke] 1113 set _fields($name) [list $title $units] 1114 } 1115 $itk_component(field) value $_currentField 1116 1116 } 1117 1117 … … 1119 1119 1120 1120 if { $_reset } { 1121 1122 1123 1124 1125 1126 1121 InitSettings streamlines-seeds streamlines-opacity \ 1122 streamlines-numpoints streamlines-lighting \ 1123 streamlines-palette streamlines-field \ 1124 volume-edges volume-lighting volume-opacity volume-wireframe 1125 Zoom reset 1126 set _reset 0 1127 1127 } 1128 1128 set _buffering 0; # Turn off buffering. … … 1146 1146 set flag [lindex $args 0] 1147 1147 switch -- $flag { 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 }1167 1168 1169 1148 "-all" { 1149 if { [llength $args] > 1 } { 1150 error "CurrentDatasets: can't specify dataobj after \"-all\"" 1151 } 1152 set dlist [get -objects] 1153 } 1154 "-visible" { 1155 if { [llength $args] > 1 } { 1156 set dlist {} 1157 set args [lrange $args 1 end] 1158 foreach dataobj $args { 1159 if { [info exists _obj2ovride($dataobj-raise)] } { 1160 lappend dlist $dataobj 1161 } 1162 } 1163 } else { 1164 set dlist [get -visible] 1165 } 1166 } 1167 default { 1168 set dlist $args 1169 } 1170 1170 } 1171 1171 set rlist "" 1172 1172 foreach dataobj $dlist { 1173 1174 1175 1176 1177 1178 1173 foreach comp [$dataobj components] { 1174 set tag $dataobj-$comp 1175 if { [info exists _datasets($tag)] && $_datasets($tag) } { 1176 lappend rlist $tag 1177 } 1178 } 1179 1179 } 1180 1180 return $rlist … … 1193 1193 "in" { 1194 1194 set _view(zoom) [expr {$_view(zoom)*1.25}] 1195 1195 SendCmd "camera zoom $_view(zoom)" 1196 1196 } 1197 1197 "out" { 1198 1198 set _view(zoom) [expr {$_view(zoom)*0.8}] 1199 1199 SendCmd "camera zoom $_view(zoom)" 1200 1200 } 1201 1201 "reset" { 1202 1202 array set _view { 1203 qw11204 qx01205 qy01206 qz01203 qw 1 1204 qx 0 1205 qy 0 1206 qz 0 1207 1207 zoom 1.0 1208 1208 xpan 0 … … 1216 1216 } 1217 1217 } 1218 1219 1220 1218 set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)] 1219 $_arcball quaternion $q 1220 DoRotate 1221 1221 } 1222 1222 } … … 1262 1262 return 1263 1263 } 1264 1265 1266 1267 1268 1264 if { $dx == 0 && $dy == 0 } { 1265 return 1266 } 1267 set q [$_arcball rotate $x $y $_click(x) $_click(y)] 1268 EventuallyRotate $q 1269 1269 set _click(x) $x 1270 1270 set _click(y) $y … … 1298 1298 itcl::body Rappture::VtkStreamlinesViewer::Pan {option x y} { 1299 1299 switch -- $option { 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1300 "set" { 1301 set w [winfo width $itk_component(view)] 1302 set h [winfo height $itk_component(view)] 1303 set x [expr $x / double($w)] 1304 set y [expr $y / double($h)] 1305 set _view(xpan) [expr $_view(xpan) + $x] 1306 set _view(ypan) [expr $_view(ypan) + $y] 1307 PanCamera 1308 return 1309 } 1310 "click" { 1311 set _click(x) $x 1312 set _click(y) $y 1313 $itk_component(view) configure -cursor hand1 1314 } 1315 "drag" { 1316 if { ![info exists _click(x)] } { 1317 set _click(x) $x 1318 } 1319 if { ![info exists _click(y)] } { 1320 set _click(y) $y 1321 } 1322 set w [winfo width $itk_component(view)] 1323 set h [winfo height $itk_component(view)] 1324 set dx [expr ($_click(x) - $x)/double($w)] 1325 set dy [expr ($_click(y) - $y)/double($h)] 1326 set _click(x) $x 1327 set _click(y) $y 1328 set _view(xpan) [expr $_view(xpan) - $dx] 1329 set _view(ypan) [expr $_view(ypan) - $dy] 1330 PanCamera 1331 } 1332 "release" { 1333 Pan drag $x $y 1334 $itk_component(view) configure -cursor "" 1335 } 1336 default { 1337 error "unknown option \"$option\": should set, click, drag, or release" 1338 } 1339 1339 } 1340 1340 } … … 1349 1349 itcl::body Rappture::VtkStreamlinesViewer::InitSettings { args } { 1350 1350 foreach spec $args { 1351 1352 1353 1354 1355 1351 if { [info exists _settings($_first-$spec)] } { 1352 # Reset global setting with dataobj specific setting 1353 set _settings($spec) $_settings($_first-$spec) 1354 } 1355 AdjustSetting $spec 1356 1356 } 1357 1357 } … … 1360 1360 # AdjustSetting -- 1361 1361 # 1362 # 1363 # 1364 # 1362 # Changes/updates a specific setting in the widget. There are 1363 # usually user-setable option. Commands are sent to the render 1364 # server. 1365 1365 # 1366 1366 itcl::body Rappture::VtkStreamlinesViewer::AdjustSetting {what {value ""}} { 1367 1367 if { ![isconnected] } { 1368 1368 return 1369 1369 } 1370 1370 switch -- $what { 1371 1371 "volume-opacity" { 1372 1373 1374 1375 1376 1372 set val $_settings(volume-opacity) 1373 set sval [expr { 0.01 * double($val) }] 1374 foreach dataset [CurrentDatasets -visible] { 1375 SendCmd "polydata opacity $sval $dataset" 1376 } 1377 1377 } 1378 1378 "volume-wireframe" { 1379 1380 1381 1379 set bool $_settings(volume-wireframe) 1380 foreach dataset [CurrentDatasets -visible] { 1381 SendCmd "polydata wireframe $bool $dataset" 1382 1382 } 1383 1383 } 1384 1384 "volume-visible" { 1385 1386 1387 1388 } 1389 1390 1391 1392 1393 1394 1395 1385 set bool $_settings(volume-visible) 1386 foreach dataset [CurrentDatasets -visible] { 1387 SendCmd "polydata visible $bool $dataset" 1388 } 1389 if { $bool } { 1390 Rappture::Tooltip::for $itk_component(volume) \ 1391 "Hide the volume" 1392 } else { 1393 Rappture::Tooltip::for $itk_component(volume) \ 1394 "Show the volume" 1395 } 1396 1396 } 1397 1397 "volume-lighting" { 1398 1399 1400 1398 set bool $_settings(volume-lighting) 1399 foreach dataset [CurrentDatasets -visible] { 1400 SendCmd "polydata lighting $bool $dataset" 1401 1401 } 1402 1402 } 1403 1403 "volume-edges" { 1404 1405 1406 1404 set bool $_settings(volume-edges) 1405 foreach dataset [CurrentDatasets -visible] { 1406 SendCmd "polydata edges $bool $dataset" 1407 1407 } 1408 1408 } 1409 1409 "axis-visible" { 1410 1411 1410 set bool $_settings(axis-visible) 1411 SendCmd "axis visible all $bool" 1412 1412 } 1413 1413 "axis-labels" { 1414 1415 1414 set bool $_settings(axis-labels) 1415 SendCmd "axis labels all $bool" 1416 1416 } 1417 1417 "axis-xgrid" - "axis-ygrid" - "axis-zgrid" { 1418 1419 1420 1418 set axis [string range $what 5 5] 1419 set bool $_settings($what) 1420 SendCmd "axis grid $axis $bool" 1421 1421 } 1422 1422 "axis-mode" { 1423 1424 1425 1426 1423 set mode [$itk_component(axismode) value] 1424 set mode [$itk_component(axismode) translate $mode] 1425 set _settings($what) $mode 1426 SendCmd "axis flymode $mode" 1427 1427 } 1428 1428 "cutplane-edges" { 1429 1430 1431 1429 set bool $_settings($what) 1430 foreach dataset [CurrentDatasets -visible] { 1431 SendCmd "cutplane edges $bool $dataset" 1432 1432 } 1433 1433 } 1434 1434 "cutplane-visible" { 1435 1436 1437 1435 set bool $_settings($what) 1436 foreach dataset [CurrentDatasets -visible] { 1437 SendCmd "cutplane visible $bool $dataset" 1438 1438 } 1439 1439 } 1440 1440 "cutplane-wireframe" { 1441 1442 1443 1441 set bool $_settings($what) 1442 foreach dataset [CurrentDatasets -visible] { 1443 SendCmd "cutplane wireframe $bool $dataset" 1444 1444 } 1445 1445 } 1446 1446 "cutplane-lighting" { 1447 1448 1449 1447 set bool $_settings($what) 1448 foreach dataset [CurrentDatasets -visible] { 1449 SendCmd "cutplane lighting $bool $dataset" 1450 1450 } 1451 1451 } 1452 1452 "cutplane-opacity" { 1453 1454 1455 1456 1457 1458 } 1459 1460 1461 1453 set val $_settings($what) 1454 set sval [expr { 0.01 * double($val) }] 1455 foreach dataset [CurrentDatasets -visible] { 1456 SendCmd "cutplane opacity $sval $dataset" 1457 } 1458 } 1459 "cutplane-xvisible" - "cutplane-yvisible" - "cutplane-zvisible" { 1460 set axis [string range $what 9 9] 1461 set bool $_settings($what) 1462 1462 if { $bool } { 1463 1463 $itk_component(${axis}CutScale) configure -state normal \ … … 1467 1467 -troughcolor grey82 1468 1468 } 1469 1470 1471 1472 1473 1474 1475 1476 1469 SendCmd "cutplane axis $axis $bool" 1470 } 1471 "cutplane-xposition" - "cutplane-yposition" - "cutplane-zposition" { 1472 set axis [string range $what 9 9] 1473 set pos [expr $_settings($what) * 0.01] 1474 SendCmd "cutplane slice ${axis} ${pos}" 1475 set _cutplanePending 0 1476 } 1477 1477 "streamlines-seeds" { 1478 1479 1480 1481 1478 set bool $_settings($what) 1479 foreach dataset [CurrentDatasets -visible] { 1480 SendCmd "streamlines seed visible $bool $dataset" 1481 } 1482 1482 } 1483 1483 "streamlines-numpoints" { 1484 1485 1484 set density $_settings($what) 1485 EventuallyReseed $density 1486 1486 } 1487 1487 "streamlines-visible" { 1488 1489 1490 1491 } 1492 1493 1494 1495 1496 1497 1498 1488 set bool $_settings($what) 1489 foreach dataset [CurrentDatasets -visible] { 1490 SendCmd "streamlines visible $bool $dataset" 1491 } 1492 if { $bool } { 1493 Rappture::Tooltip::for $itk_component(streamlines) \ 1494 "Hide the streamlines" 1495 } else { 1496 Rappture::Tooltip::for $itk_component(streamlines) \ 1497 "Show the streamlines" 1498 } 1499 1499 } 1500 1500 "streamlines-mode" { 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1501 set mode [$itk_component(streammode) value] 1502 set _settings(streamlines-mode) $mode 1503 foreach dataset [CurrentDatasets -visible] { 1504 switch -- $mode { 1505 "lines" { 1506 SendCmd "streamlines lines $dataset" 1507 } 1508 "ribbons" { 1509 SendCmd "streamlines ribbons 3 0 $dataset" 1510 } 1511 "tubes" { 1512 SendCmd "streamlines tubes 5 3 $dataset" 1513 } 1514 } 1515 1515 } 1516 1516 } 1517 1517 "streamlines-palette" { 1518 1519 1520 1521 1522 1523 } 1524 1518 set palette [$itk_component(palette) value] 1519 set _settings(streamlines-palette) $palette 1520 foreach dataset [CurrentDatasets -visible $_first] { 1521 foreach {dataobj comp} [split $dataset -] break 1522 ChangeColormap $dataobj $comp $palette 1523 } 1524 set _legendPending 1 1525 1525 } 1526 1526 "streamlines-opacity" { 1527 1528 1529 1530 1531 1527 set val $_settings(streamlines-opacity) 1528 set sval [expr { 0.01 * double($val) }] 1529 foreach dataset [CurrentDatasets -visible $_first] { 1530 SendCmd "streamlines opacity $sval $dataset" 1531 } 1532 1532 } 1533 1533 "streamlines-scale" { 1534 1535 1536 1537 1538 1534 set val $_settings(streamlines-scale) 1535 set sval [expr { 0.01 * double($val) }] 1536 foreach dataset [CurrentDatasets -visible $_first] { 1537 SendCmd "streamlines scale $sval $sval $sval $dataset" 1538 } 1539 1539 } 1540 1540 "streamlines-lighting" { 1541 1542 1543 1541 set bool $_settings(streamlines-lighting) 1542 foreach dataset [CurrentDatasets -visible $_first] { 1543 SendCmd "streamlines lighting $bool $dataset" 1544 1544 } 1545 1545 } 1546 1546 "streamlines-field" { 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 } 1568 1547 set new [$itk_component(field) value] 1548 set value [$itk_component(field) translate $new] 1549 set _settings(streamlines-field) $value 1550 if { [info exists _scalarFields($new)] } { 1551 set name $_scalarFields($new) 1552 set _colorMode scalar 1553 set _currentField $new 1554 } elseif { [info exists _vectorFields($new)] } { 1555 set name $_vectorFields($new) 1556 set _colorMode vmag 1557 set _currentField $new 1558 } else { 1559 puts stderr "unknown field \"$new\"" 1560 return 1561 } 1562 foreach dataset [CurrentDatasets -visible] { 1563 puts stderr "streamlines colormode $_colorMode ${name} $dataset" 1564 puts stderr "cutplane colormode $_colorMode ${name} $dataset" 1565 SendCmd "streamlines colormode $_colorMode ${name} $dataset" 1566 SendCmd "cutplane colormode $_colorMode ${name} $dataset" 1567 } 1568 set _legendPending 1 1569 1569 } 1570 1570 default { … … 1577 1577 # RequestLegend -- 1578 1578 # 1579 # 1580 # 1581 # 1579 # Request a new legend from the server. The size of the legend 1580 # is determined from the height of the canvas. It will be rotated 1581 # to be vertical when drawn. 1582 1582 # 1583 1583 itcl::body Rappture::VtkStreamlinesViewer::RequestLegend {} { … … 1588 1588 set h [expr {$_height - 3 * ($lineht + 2)}] 1589 1589 if { $h < 1} { 1590 1590 return 1591 1591 } 1592 1592 if { [info exists _scalarFields($_currentField)] } { 1593 1593 set name $_scalarFields($_currentField) 1594 1594 } elseif { [info exists _vectorFields($_currentField)] } { 1595 1595 set name $_vectorFields($_currentField) 1596 1596 } else { 1597 1597 return 1598 1598 } 1599 1599 # Set the legend on the first streamlines dataset. 1600 1600 foreach dataset [CurrentDatasets -visible $_first] { 1601 1602 1601 foreach {dataobj comp} [split $dataset -] break 1602 if { [info exists _dataset2style($dataset)] } { 1603 1603 SendCmdNoWait \ 1604 1605 1604 "legend $_dataset2style($dataset) $_colorMode $name {} $w $h 0" 1605 break; 1606 1606 } 1607 1607 } … … 1614 1614 set tag $dataobj-$comp 1615 1615 if { ![info exist _style($tag)] } { 1616 1616 error "no initial colormap" 1617 1617 } 1618 1618 array set style $_style($tag) … … 1633 1633 set tag $dataobj-$comp 1634 1634 if { ![info exists _initialStyle($tag)] } { 1635 1636 1635 # Save the initial component style. 1636 set _initialStyle($tag) [$dataobj style $comp] 1637 1637 } 1638 1638 … … 1641 1641 1642 1642 if { ![info exists _style($tag)] } { 1643 1643 set _style($tag) [array get style] 1644 1644 } 1645 1645 # Override initial style with current style. … … 1648 1648 set name "$style(-color):$style(-levels):$style(-opacity)" 1649 1649 if { ![info exists _colormaps($name)] } { 1650 1651 1650 BuildColormap $name [array get style] 1651 set _colormaps($name) 1 1652 1652 } 1653 1653 if { ![info exists _dataset2style($tag)] || 1654 1655 1656 1657 1654 $_dataset2style($tag) != $name } { 1655 SendCmd "streamlines colormap $name $tag" 1656 SendCmd "cutplane colormap $name $tag" 1657 set _dataset2style($tag) $name 1658 1658 } 1659 1659 } … … 1661 1661 itcl::body Rappture::VtkStreamlinesViewer::ColorsToColormap { colors } { 1662 1662 switch -- $colors { 1663 1664 1665 0.00.200 0.200 0.2001666 0.142857142857142850.400 0.400 0.4001667 0.28571428571428570.600 0.600 0.6001668 0.428571428571428550.900 0.900 0.9001669 0.57142857142857140.800 1.000 1.0001670 0.71428571428571430.600 1.000 1.0001671 0.85714285714285710.400 0.900 1.0001672 1.00.000 0.600 0.8001673 1674 1675 1676 1677 0.00.000 0.600 0.8001678 0.142857142857142850.400 0.900 1.0001679 0.28571428571428570.600 1.000 1.0001680 0.428571428571428550.800 1.000 1.0001681 0.57142857142857140.900 0.900 0.9001682 0.71428571428571430.600 0.600 0.6001683 0.85714285714285710.400 0.400 0.4001684 1.00.200 0.200 0.2001685 1686 1687 1688 1689 0.00.900 1.000 1.0001690 0.11111111111111110.800 0.983 1.0001691 0.22222222222222220.700 0.950 1.0001692 0.33333333333333330.600 0.900 1.0001693 0.44444444444444440.500 0.833 1.0001694 0.55555555555555560.400 0.750 1.0001695 0.66666666666666660.300 0.650 1.0001696 0.77777777777777780.200 0.533 1.0001697 0.88888888888888880.100 0.400 1.0001698 1.00.000 0.250 1.0001699 1700 1701 1702 1703 0.00.200 0.100 0.0001704 0.090909090909090910.400 0.187 0.0001705 0.181818181818181820.600 0.379 0.2101706 0.27272727272727270.800 0.608 0.4801707 0.363636363636363650.850 0.688 0.5951708 0.454545454545454530.950 0.855 0.8081709 0.54545454545454540.800 0.993 1.0001710 0.63636363636363640.600 0.973 1.0001711 0.72727272727272730.400 0.940 1.0001712 0.81818181818181820.200 0.893 1.0001713 0.90909090909090910.000 0.667 0.8001714 1.00.000 0.480 0.6001715 1716 1717 1718 1719 0.00.000 0.480 0.6001720 0.090909090909090910.000 0.667 0.8001721 0.181818181818181820.200 0.893 1.0001722 0.27272727272727270.400 0.940 1.0001723 0.363636363636363650.600 0.973 1.0001724 0.454545454545454530.800 0.993 1.0001725 0.54545454545454540.950 0.855 0.8081726 0.63636363636363640.850 0.688 0.5951727 0.72727272727272730.800 0.608 0.4801728 0.81818181818181820.600 0.379 0.2101729 0.90909090909090910.400 0.187 0.0001730 1.00.200 0.100 0.0001731 1732 1733 1734 1735 0.00.000 0.167 1.0001736 0.090909090909090910.100 0.400 1.0001737 0.181818181818181820.200 0.600 1.0001738 0.27272727272727270.400 0.800 1.0001739 0.363636363636363650.600 0.933 1.0001740 0.454545454545454530.800 1.000 1.0001741 0.54545454545454541.000 1.000 0.8001742 0.63636363636363641.000 0.933 0.6001743 0.72727272727272731.000 0.800 0.4001744 0.81818181818181821.000 0.600 0.2001745 0.90909090909090911.000 0.400 0.1001746 1.01.000 0.167 0.0001747 1748 1749 1750 1751 0.01.000 0.167 0.0001752 0.090909090909090911.000 0.400 0.1001753 0.181818181818181821.000 0.600 0.2001754 0.27272727272727271.000 0.800 0.4001755 0.363636363636363651.000 0.933 0.6001756 0.454545454545454531.000 1.000 0.8001757 0.54545454545454540.800 1.000 1.0001758 0.63636363636363640.600 0.933 1.0001759 0.72727272727272730.400 0.800 1.0001760 0.81818181818181820.200 0.600 1.0001761 0.90909090909090910.100 0.400 1.0001762 1.00.000 0.167 1.0001763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1663 "grey-to-blue" { 1664 return { 1665 0.0 0.200 0.200 0.200 1666 0.14285714285714285 0.400 0.400 0.400 1667 0.2857142857142857 0.600 0.600 0.600 1668 0.42857142857142855 0.900 0.900 0.900 1669 0.5714285714285714 0.800 1.000 1.000 1670 0.7142857142857143 0.600 1.000 1.000 1671 0.8571428571428571 0.400 0.900 1.000 1672 1.0 0.000 0.600 0.800 1673 } 1674 } 1675 "blue-to-grey" { 1676 return { 1677 0.0 0.000 0.600 0.800 1678 0.14285714285714285 0.400 0.900 1.000 1679 0.2857142857142857 0.600 1.000 1.000 1680 0.42857142857142855 0.800 1.000 1.000 1681 0.5714285714285714 0.900 0.900 0.900 1682 0.7142857142857143 0.600 0.600 0.600 1683 0.8571428571428571 0.400 0.400 0.400 1684 1.0 0.200 0.200 0.200 1685 } 1686 } 1687 "blue" { 1688 return { 1689 0.0 0.900 1.000 1.000 1690 0.1111111111111111 0.800 0.983 1.000 1691 0.2222222222222222 0.700 0.950 1.000 1692 0.3333333333333333 0.600 0.900 1.000 1693 0.4444444444444444 0.500 0.833 1.000 1694 0.5555555555555556 0.400 0.750 1.000 1695 0.6666666666666666 0.300 0.650 1.000 1696 0.7777777777777778 0.200 0.533 1.000 1697 0.8888888888888888 0.100 0.400 1.000 1698 1.0 0.000 0.250 1.000 1699 } 1700 } 1701 "brown-to-blue" { 1702 return { 1703 0.0 0.200 0.100 0.000 1704 0.09090909090909091 0.400 0.187 0.000 1705 0.18181818181818182 0.600 0.379 0.210 1706 0.2727272727272727 0.800 0.608 0.480 1707 0.36363636363636365 0.850 0.688 0.595 1708 0.45454545454545453 0.950 0.855 0.808 1709 0.5454545454545454 0.800 0.993 1.000 1710 0.6363636363636364 0.600 0.973 1.000 1711 0.7272727272727273 0.400 0.940 1.000 1712 0.8181818181818182 0.200 0.893 1.000 1713 0.9090909090909091 0.000 0.667 0.800 1714 1.0 0.000 0.480 0.600 1715 } 1716 } 1717 "blue-to-brown" { 1718 return { 1719 0.0 0.000 0.480 0.600 1720 0.09090909090909091 0.000 0.667 0.800 1721 0.18181818181818182 0.200 0.893 1.000 1722 0.2727272727272727 0.400 0.940 1.000 1723 0.36363636363636365 0.600 0.973 1.000 1724 0.45454545454545453 0.800 0.993 1.000 1725 0.5454545454545454 0.950 0.855 0.808 1726 0.6363636363636364 0.850 0.688 0.595 1727 0.7272727272727273 0.800 0.608 0.480 1728 0.8181818181818182 0.600 0.379 0.210 1729 0.9090909090909091 0.400 0.187 0.000 1730 1.0 0.200 0.100 0.000 1731 } 1732 } 1733 "blue-to-orange" { 1734 return { 1735 0.0 0.000 0.167 1.000 1736 0.09090909090909091 0.100 0.400 1.000 1737 0.18181818181818182 0.200 0.600 1.000 1738 0.2727272727272727 0.400 0.800 1.000 1739 0.36363636363636365 0.600 0.933 1.000 1740 0.45454545454545453 0.800 1.000 1.000 1741 0.5454545454545454 1.000 1.000 0.800 1742 0.6363636363636364 1.000 0.933 0.600 1743 0.7272727272727273 1.000 0.800 0.400 1744 0.8181818181818182 1.000 0.600 0.200 1745 0.9090909090909091 1.000 0.400 0.100 1746 1.0 1.000 0.167 0.000 1747 } 1748 } 1749 "orange-to-blue" { 1750 return { 1751 0.0 1.000 0.167 0.000 1752 0.09090909090909091 1.000 0.400 0.100 1753 0.18181818181818182 1.000 0.600 0.200 1754 0.2727272727272727 1.000 0.800 0.400 1755 0.36363636363636365 1.000 0.933 0.600 1756 0.45454545454545453 1.000 1.000 0.800 1757 0.5454545454545454 0.800 1.000 1.000 1758 0.6363636363636364 0.600 0.933 1.000 1759 0.7272727272727273 0.400 0.800 1.000 1760 0.8181818181818182 0.200 0.600 1.000 1761 0.9090909090909091 0.100 0.400 1.000 1762 1.0 0.000 0.167 1.000 1763 } 1764 } 1765 "rainbow" { 1766 set clist { 1767 "#EE82EE" 1768 "#4B0082" 1769 "blue" 1770 "#008000" 1771 "yellow" 1772 "#FFA500" 1773 "red" 1774 } 1775 } 1776 "BGYOR" { 1777 set clist { 1778 "blue" 1779 "#008000" 1780 "yellow" 1781 "#FFA500" 1782 "red" 1783 } 1784 } 1785 "ROYGB" { 1786 set clist { 1787 "red" 1788 "#FFA500" 1789 "yellow" 1790 "#008000" 1791 "blue" 1792 } 1793 } 1794 "RYGCB" { 1795 set clist { 1796 "red" 1797 "yellow" 1798 "green" 1799 "cyan" 1800 "blue" 1801 } 1802 } 1803 "BCGYR" { 1804 set clist { 1805 "blue" 1806 "cyan" 1807 "green" 1808 "yellow" 1809 "red" 1810 } 1811 } 1812 "spectral" { 1813 return { 1814 0.0 0.150 0.300 1.000 1815 0.1 0.250 0.630 1.000 1816 0.2 0.450 0.850 1.000 1817 0.3 0.670 0.970 1.000 1818 0.4 0.880 1.000 1.000 1819 0.5 1.000 1.000 0.750 1820 0.6 1.000 0.880 0.600 1821 0.7 1.000 0.680 0.450 1822 0.8 0.970 0.430 0.370 1823 0.9 0.850 0.150 0.196 1824 1.0 0.650 0.000 0.130 1825 } 1826 } 1827 "green-to-magenta" { 1828 return { 1829 0.0 0.000 0.316 0.000 1830 0.06666666666666667 0.000 0.526 0.000 1831 0.13333333333333333 0.000 0.737 0.000 1832 0.2 0.000 0.947 0.000 1833 0.26666666666666666 0.316 1.000 0.316 1834 0.3333333333333333 0.526 1.000 0.526 1835 0.4 0.737 1.000 0.737 1836 0.4666666666666667 1.000 1.000 1.000 1837 0.5333333333333333 1.000 0.947 1.000 1838 0.6 1.000 0.737 1.000 1839 0.6666666666666666 1.000 0.526 1.000 1840 0.7333333333333333 1.000 0.316 1.000 1841 0.8 0.947 0.000 0.947 1842 0.8666666666666667 0.737 0.000 0.737 1843 0.9333333333333333 0.526 0.000 0.526 1844 1.0 0.316 0.000 0.316 1845 } 1846 } 1847 "greyscale" { 1848 return { 1849 0.0 0.0 0.0 0.0 1.0 1.0 1.0 1.0 1850 } 1851 } 1852 "nanohub" { 1853 set clist "white yellow green cyan blue magenta" 1854 } 1855 default { 1856 set clist $colors 1857 } 1858 1858 } 1859 1859 set cmap {} … … 1873 1873 set cmap [ColorsToColormap $style(-color)] 1874 1874 if { [llength $cmap] == 0 } { 1875 1875 set cmap "0.0 0.0 0.0 0.0 1.0 1.0 1.0 1.0" 1876 1876 } 1877 1877 if { ![info exists _settings(volume-opacity)] } { … … 1909 1909 array unset _limits $dataobj-* 1910 1910 foreach comp [$dataobj components] { 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1911 set tag $dataobj-$comp 1912 if { ![info exists _limits($tag)] } { 1913 set data [$dataobj blob $comp] 1914 set tmpfile file[pid].vtk 1915 set f [open "$tmpfile" "w"] 1916 fconfigure $f -translation binary -encoding binary 1917 puts $f $data 1918 close $f 1919 set reader [vtkDataSetReader $tag-xvtkDataSetReader] 1920 $reader SetFileName $tmpfile 1921 $reader ReadAllScalarsOn 1922 $reader ReadAllVectorsOn 1923 $reader ReadAllFieldsOn 1924 $reader Update 1925 set output [$reader GetOutput] 1926 set _limits($tag) [$output GetBounds] 1927 set pointData [$output GetPointData] 1928 puts stderr "\#scalars=[$reader GetNumberOfScalarsInFile]" 1929 puts stderr "\#fielddata=[$reader GetNumberOfFieldDataInFile]" 1930 puts stderr "fielddataname=[$reader GetFieldDataNameInFile 0]" 1931 set fieldData [$output GetFieldData] 1932 set pointData [$output GetPointData] 1933 puts stderr "field \#arrays=[$fieldData GetNumberOfArrays]" 1934 for { set i 0 } { $i < [$fieldData GetNumberOfArrays] } { incr i } { 1935 puts stderr [$fieldData GetArrayName $i] 1936 } 1937 puts stderr "point \#arrays=[$pointData GetNumberOfArrays]" 1938 for { set i 0 } { $i < [$pointData GetNumberOfArrays] } { incr i } { 1939 set name [$pointData GetArrayName $i] 1940 if { ![info exists _fields($name)] } { 1941 $itk_component(field) choices insert end "$name" "$name" 1942 set _fields($name) 1 1943 } 1944 } 1945 puts stderr "field \#components=[$fieldData GetNumberOfComponents]" 1946 puts stderr "point \#components=[$pointData GetNumberOfComponents]" 1947 puts stderr "field \#tuples=[$fieldData GetNumberOfTuples]" 1948 puts stderr "point \#tuples=[$pointData GetNumberOfTuples]" 1949 puts stderr "point \#scalars=[$pointData GetScalars]" 1950 puts stderr vectors=[$pointData GetVectors] 1951 rename $output "" 1952 rename $reader "" 1953 file delete $tmpfile 1954 } 1955 1955 foreach { xMin xMax yMin yMax zMin zMax} $_limits($tag) break 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1956 if {![info exists limits(xmin)] || $limits(xmin) > $xMin} { 1957 set limits(xmin) $xMin 1958 } 1959 if {![info exists limits(xmax)] || $limits(xmax) < $xMax} { 1960 set limits(xmax) $xMax 1961 } 1962 if {![info exists limits(ymin)] || $limits(ymin) > $yMin} { 1963 set limits(ymin) $xMin 1964 } 1965 if {![info exists limits(ymax)] || $limits(ymax) < $yMax} { 1966 set limits(ymax) $yMax 1967 } 1968 if {![info exists limits(zmin)] || $limits(zmin) > $zMin} { 1969 set limits(zmin) $zMin 1970 } 1971 if {![info exists limits(zmax)] || $limits(zmax) < $zMax} { 1972 set limits(zmax) $zMax 1973 } 1974 1974 } 1975 1975 return [array get limits] … … 2015 2015 -width 10 \ 2016 2016 -showvalue off \ 2017 2017 -command [itcl::code $this AdjustSetting volume-opacity] 2018 2018 2019 2019 blt::table $inner \ … … 2060 2060 label $inner.mode_l -text "Mode" -font "Arial 9" 2061 2061 itk_component add streammode { 2062 2062 Rappture::Combobox $inner.mode -width 10 -editable no 2063 2063 } 2064 2064 $inner.mode choices insert end \ … … 2074 2074 -width 10 \ 2075 2075 -showvalue off \ 2076 2076 -command [itcl::code $this AdjustSetting streamlines-opacity] 2077 2077 2078 2078 label $inner.density_l -text "Number of Seeds" -font "Arial 9" … … 2081 2081 -width 10 \ 2082 2082 -showvalue on \ 2083 2083 -command [itcl::code $this AdjustSetting streamlines-numpoints] 2084 2084 2085 2085 label $inner.scale_l -text "Scale" -font "Arial 9" … … 2088 2088 -width 10 \ 2089 2089 -showvalue off \ 2090 2090 -command [itcl::code $this AdjustSetting streamlines-scale] 2091 2091 2092 2092 label $inner.field_l -text "Field" -font "Arial 9" 2093 2093 itk_component add field { 2094 2094 Rappture::Combobox $inner.field -width 10 -editable no 2095 2095 } 2096 2096 bind $inner.field <<Value>> \ 2097 2097 [itcl::code $this AdjustSetting streamlines-field] 2098 2098 2099 2099 label $inner.palette_l -text "Palette" -font "Arial 9" 2100 2100 itk_component add palette { 2101 2101 Rappture::Combobox $inner.palette -width 10 -editable no 2102 2102 } 2103 2103 $inner.palette choices insert end \ 2104 "BCGYR" "BCGYR"\2105 "BGYOR" "BGYOR"\2106 "blue" "blue"\2107 2108 2109 "blue-to-grey" "blue-to-grey"\2110 "green-to-magenta" "green-to-magenta"\2111 "greyscale" "greyscale"\2112 2113 "rainbow" "rainbow"\2114 "spectral" "spectral"\2115 "ROYGB" "ROYGB"\2116 "RYGCB" "RYGCB"\2117 2118 "grey-to-blue" "grey-to-blue"\2119 2104 "BCGYR" "BCGYR" \ 2105 "BGYOR" "BGYOR" \ 2106 "blue" "blue" \ 2107 "blue-to-brown" "blue-to-brown" \ 2108 "blue-to-orange" "blue-to-orange" \ 2109 "blue-to-grey" "blue-to-grey" \ 2110 "green-to-magenta" "green-to-magenta" \ 2111 "greyscale" "greyscale" \ 2112 "nanohub" "nanohub" \ 2113 "rainbow" "rainbow" \ 2114 "spectral" "spectral" \ 2115 "ROYGB" "ROYGB" \ 2116 "RYGCB" "RYGCB" \ 2117 "brown-to-blue" "brown-to-blue" \ 2118 "grey-to-blue" "grey-to-blue" \ 2119 "orange-to-blue" "orange-to-blue" 2120 2120 2121 2121 $itk_component(palette) value "BCGYR" 2122 2122 bind $inner.palette <<Value>> \ 2123 2123 [itcl::code $this AdjustSetting streamlines-palette] 2124 2124 2125 2125 blt::table $inner \ … … 2137 2137 9,0 $inner.palette_l -anchor w -pady 2 \ 2138 2138 9,1 $inner.palette -anchor w -pady 2 \ 2139 2139 2140 2140 2141 2141 blt::table configure $inner r* c* -resize none … … 2184 2184 2185 2185 itk_component add axismode { 2186 2186 Rappture::Combobox $inner.mode -width 10 -editable no 2187 2187 } 2188 2188 $inner.mode choices insert end \ … … 2249 2249 set inner [$itk_component(main) insert end \ 2250 2250 -title "Cutplane Settings" \ 2251 2251 -icon [Rappture::icon cutbutton]] 2252 2252 2253 2253 $inner configure -borderwidth 4 … … 2282 2282 -width 10 \ 2283 2283 -showvalue off \ 2284 2284 -command [itcl::code $this AdjustSetting cutplane-opacity] 2285 2285 $inner.opacity set $_settings(cutplane-opacity) 2286 2286 … … 2367 2367 2368 2368 blt::table $inner \ 2369 0,0 $inner.visible 2370 1,0 $inner.lighting 2371 2,0 $inner.wireframe 2372 3,0 $inner.edges 2373 4,0 $inner.opacity_l 2374 5,0 $inner.opacity 2369 0,0 $inner.visible -anchor w -pady 2 -cspan 4 \ 2370 1,0 $inner.lighting -anchor w -pady 2 -cspan 4 \ 2371 2,0 $inner.wireframe -anchor w -pady 2 -cspan 4 \ 2372 3,0 $inner.edges -anchor w -pady 2 -cspan 4 \ 2373 4,0 $inner.opacity_l -anchor w -pady 2 -cspan 3 \ 2374 5,0 $inner.opacity -fill x -pady 2 -cspan 3 \ 2375 2375 6,0 $itk_component(xCutButton) -anchor e -padx 2 -pady 2 \ 2376 2376 7,0 $itk_component(xCutScale) -fill y \ … … 2414 2414 "qx" - "qy" - "qz" - "qw" { 2415 2415 set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)] 2416 2417 2416 $_arcball quaternion $q 2417 EventuallyRotate $q 2418 2418 } 2419 2419 "zoom" { … … 2449 2449 foreach comp [$dataobj components] { 2450 2450 set tag $dataobj-$comp 2451 2452 2453 2451 #set contents [ConvertToVtkData $dataobj $comp] 2452 set contents [$dataobj blob $comp] 2453 append bytes "$contents\n\n" 2454 2454 } 2455 2455 } … … 2459 2459 itcl::body Rappture::VtkStreamlinesViewer::GetImage { args } { 2460 2460 if { [image width $_image(download)] > 0 && 2461 2462 2463 2464 2461 [image height $_image(download)] > 0 } { 2462 set bytes [$_image(download) data -format "jpeg -quality 100"] 2463 set bytes [Rappture::encoding::decode -as b64 $bytes] 2464 return [list .jpg $bytes] 2465 2465 } 2466 2466 return "" … … 2484 2484 2485 2485 button $inner.ok -text "Save" \ 2486 2486 -highlightthickness 0 -pady 2 -padx 3 \ 2487 2487 -command $command \ 2488 2489 2488 -compound left \ 2489 -image [Rappture::icon download] 2490 2490 2491 2491 button $inner.cancel -text "Cancel" \ 2492 2493 2494 2495 2492 -highlightthickness 0 -pady 2 -padx 3 \ 2493 -command [list $popup deactivate] \ 2494 -compound left \ 2495 -image [Rappture::icon cancel] 2496 2496 2497 2497 blt::table $inner \ … … 2513 2513 set style [$dataobj style $comp] 2514 2514 array set settings { 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2515 -color \#808080 2516 -edges 0 2517 -edgecolor black 2518 -linewidth 1.0 2519 -opacity 0.4 2520 -wireframe 0 2521 -lighting 1 2522 -seeds 1 2523 -seedcolor white 2524 -visible 1 2525 2525 } 2526 2526 if { $dataobj != $_first } { 2527 2527 set settings(-opacity) 1 2528 2528 } 2529 2529 array set settings $style … … 2532 2532 set seeds [$dataobj hints seeds] 2533 2533 if { $seeds != "" && ![info exists _seeds($dataobj)] } { 2534 2535 2536 2537 2534 set length [string length $seeds] 2535 SendCmd "streamlines seed fmesh 200 data follows $length $tag" 2536 SendCmd "$seeds" 2537 set _seeds($dataobj) 1 2538 2538 } 2539 2539 SendCmd "cutplane add $tag" … … 2545 2545 #SendCmd "cutplane visible $tag" 2546 2546 foreach axis { x y z } { 2547 2548 2547 SendCmd "cutplane slice $axis 1.0 $tag" 2548 SendCmd "cutplane axis $axis 0 $tag" 2549 2549 } 2550 2550 … … 2567 2567 itcl::body Rappture::VtkStreamlinesViewer::IsValidObject { dataobj } { 2568 2568 if {[catch {$dataobj isa Rappture::Field} valid] != 0 || !$valid} { 2569 2569 return 0 2570 2570 } 2571 2571 return 1 … … 2593 2593 $_image(legend) configure -data $bytes 2594 2594 #puts stderr "read $size bytes for [image width $_image(legend)]x[image height $_image(legend)] legend>" 2595 2596 2597 2595 if { [catch {DrawLegend $_title} errs] != 0 } { 2596 puts stderr errs=$errs 2597 } 2598 2598 } 2599 2599 } … … 2602 2602 # DrawLegend -- 2603 2603 # 2604 # 2605 # 2604 # Draws the legend in it's own canvas which resides to the right 2605 # of the contour plot area. 2606 2606 # 2607 2607 itcl::body Rappture::VtkStreamlinesViewer::DrawLegend { name } { … … 2613 2613 2614 2614 if { [info exists _fields($name)] } { 2615 2616 2617 2618 2615 foreach { title units } $_fields($name) break 2616 if { $units != "" } { 2617 set title [format "%s (%s)" $title $units] 2618 } 2619 2619 } else { 2620 2620 set title $name 2621 2621 } 2622 2622 if { $_settings(legend-visible) } { 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2623 set x [expr $w - 2] 2624 if { [$c find withtag "legend"] == "" } { 2625 set y 2 2626 $c create text $x $y \ 2627 -anchor ne \ 2628 -fill $itk_option(-plotforeground) -tags "title legend" \ 2629 -font $font 2630 incr y $lineht 2631 $c create text $x $y \ 2632 -anchor ne \ 2633 -fill $itk_option(-plotforeground) -tags "vmax legend" \ 2634 -font $font 2635 incr y $lineht 2636 $c create image $x $y \ 2637 -anchor ne \ 2638 -image $_image(legend) -tags "colormap legend" 2639 $c create text $x [expr {$h-2}] \ 2640 -anchor se \ 2641 -fill $itk_option(-plotforeground) -tags "vmin legend" \ 2642 -font $font 2643 #$c bind colormap <Enter> [itcl::code $this EnterLegend %x %y] 2644 $c bind colormap <Leave> [itcl::code $this LeaveLegend] 2645 $c bind colormap <Motion> [itcl::code $this MotionLegend %x %y] 2646 } 2647 $c bind title <ButtonPress> [itcl::code $this Combo post] 2648 $c bind title <Enter> [itcl::code $this Combo activate] 2649 $c bind title <Leave> [itcl::code $this Combo deactivate] 2650 # Reset the item coordinates according the current size of the plot. 2651 $c itemconfigure title -text $title 2652 if { $_limits(vmin) != "" } { 2653 $c itemconfigure vmin -text [format %g $_limits(vmin)] 2654 } 2655 if { $_limits(vmax) != "" } { 2656 $c itemconfigure vmax -text [format %g $_limits(vmax)] 2657 } 2658 set y 2 2659 $c coords title $x $y 2660 incr y $lineht 2661 $c coords vmax $x $y 2662 incr y $lineht 2663 $c coords colormap $x $y 2664 $c coords vmin $x [expr {$h - 2}] 2665 2665 } 2666 2666 } … … 2706 2706 2707 2707 if { [info exists _fields($_title)] } { 2708 2709 2710 2711 2708 foreach { title units } $_fields($_title) break 2709 if { $units != "" } { 2710 set title [format "%s (%s)" $title $units] 2711 } 2712 2712 } else { 2713 2713 set title $_title 2714 2714 } 2715 2715 # Make a swatch of the selected color 2716 2716 if { [catch { $_image(legend) get 10 $imgY } pixel] != 0 } { 2717 2718 2717 #puts stderr "out of range: $imgY" 2718 return 2719 2719 } 2720 2720 if { ![info exists _image(swatch)] } { 2721 2721 set _image(swatch) [image create photo -width 24 -height 24] 2722 2722 } 2723 2723 set color [eval format "\#%02x%02x%02x" $pixel] … … 2728 2728 # Compute the value of the point 2729 2729 if { [info exists _limits(vmax)] && [info exists _limits(vmin)] } { 2730 2731 2730 set t [expr 1.0 - (double($imgY) / double($imgHeight-1))] 2731 set value [expr $t * ($_limits(vmax) - $_limits(vmin)) + $_limits(vmin)] 2732 2732 } else { 2733 2733 set value 0.0 2734 2734 } 2735 2735 set tipx [expr $x + 15] … … 2760 2760 SendCmd "cutplane slice $axis $newpos" 2761 2761 } 2762 2763 2764 2765 2766 2762 "tooltip" { 2763 set axis [lindex $args 0] 2764 set val [$itk_component(${axis}CutScale) get] 2765 return "Move the [string toupper $axis] cut plane.\nCurrently: $axis = $val%" 2766 } 2767 2767 default { 2768 2768 error "bad option \"$option\": should be axis, move, or tooltip" … … 2787 2787 switch -- $option { 2788 2788 post { 2789 2790 2791 2792 2793 2794 2789 foreach { x1 y1 x2 y2 } [$c bbox title] break 2790 set x1 [expr [winfo width $itk_component(view)] - [winfo reqwidth $itk_component(fieldmenu)]] 2791 set x [expr $x1 + [winfo rootx $itk_component(view)]] 2792 set y [expr $y2 + [winfo rooty $itk_component(view)]] 2793 puts stderr "combo x=$x y=$y" 2794 tk_popup $itk_component(fieldmenu) $x $y 2795 2795 } 2796 2796 activate { 2797 2797 $c itemconfigure title -fill red 2798 2798 } 2799 2799 deactivate { 2800 2801 } 2802 2803 2804 2805 2800 $c itemconfigure title -fill white 2801 } 2802 invoke { 2803 $itk_component(field) value $_currentField 2804 AdjustSetting streamlines-field 2805 } 2806 2806 default { 2807 2807 error "bad option \"$option\": should be post, unpost, select" -
branches/blt4/gui/scripts/vtkviewer-obsolete.tcl
r2538 r2745 108 108 109 109 array set _limits { 110 xMin 111 xMax 112 yMin 113 yMax 114 zMin 115 zMax 116 vMin 117 vMax 110 xMin 0 111 xMax 1 112 yMin 0 113 yMax 1 114 zMin 0 115 zMax 1 116 vMin 0 117 vMax 1 118 118 } 119 119 120 120 121 121 foreach { key value } { 122 edges 123 axes 124 smallaxes 125 wireframe 122 edges 1 123 axes 1 124 smallaxes 0 125 wireframe 0 126 126 } { 127 127 set _settings($this-$key) $value … … 161 161 pack $itk_component(reset) -padx 4 -pady 4 162 162 Rappture::Tooltip::for $itk_component(reset) \ 163 163 "Reset the view to the default zoom level" 164 164 165 165 itk_component add zoomin { … … 172 172 ignore -borderwidth 173 173 rename -highlightbackground -controlbackground controlBackground \ 174 174 Background 175 175 } 176 176 pack $itk_component(zoomin) -padx 4 -pady 4 … … 186 186 ignore -borderwidth 187 187 rename -highlightbackground -controlbackground controlBackground \ 188 188 Background 189 189 } 190 190 pack $itk_component(zoomout) -padx 4 -pady 4 … … 205 205 -width 1 -height 1 206 206 } { 207 207 # empty 208 208 } 209 209 pack $itk_component(plot) -expand yes -fill both … … 299 299 set _obj2width($dataobj) $params(-width) 300 300 set _obj2raise($dataobj) $params(-raise) 301 301 302 302 after cancel [itcl::code $this Rebuild] 303 303 after idle [itcl::code $this Rebuild] … … 346 346 catch {unset _obj2width($dataobj)} 347 347 catch {unset _obj2raise($dataobj)} 348 349 350 351 352 348 foreach actor $_actors($dataobj) { 349 $_renderer RemoveActor $actor 350 } 351 array unset _actors $dataobj 352 array unset _dataobj2vtk $dataobj-* 353 353 set changed 1 354 354 } … … 413 413 FixSettings smallaxes 414 414 415 415 set img [image create photo -file junk.jpg] 416 416 set bytes [$img data -format "jpeg -quality 100"] 417 417 set bytes [Rappture::encoding::decode -as b64 $bytes] 418 418 image delete $img 419 419 return [list .jpg $bytes] 420 420 } … … 442 442 } 443 443 foreach dataobj $_dlist { 444 445 446 444 foreach actor $_actors($dataobj) { 445 $_renderer RemoveActor $actor 446 } 447 447 } 448 448 array unset _actors … … 474 474 $_renderer ResetCamera 475 475 _3dView 90 -90 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 476 array set camera { 477 xpos 1.73477e-06 ypos 74.7518 zpos -1.73477e-06 478 xviewup 5.38569e-16 yviewup 2.32071e-08 zviewup 1.0 479 xfocal 0.0 yfocal 0.0 zfocal 0.0 480 angle 30 481 } 482 set dataobj [lindex $_dlist end] 483 if { $dataobj != "" } { 484 array set camera [$dataobj hints camera] 485 } 486 if { [info exists camera(clipmin)] } { 487 $cam SetClippingRange $camera(clipmin) $camera(clipmax) 488 } 489 if { [info exists camera(parallelscale)] } { 490 $cam SetParallelScale $camera(parallelscale) 491 } 492 $cam SetViewAngle $camera(angle) 493 $cam SetFocalPoint $camera(xfocal) $camera(yfocal) $camera(zfocal) 494 $cam SetPosition $camera(xpos) $camera(ypos) $camera(zpos) 495 $cam SetViewUp $camera(xviewup) $camera(yviewup) $camera(zviewup) 496 foreach key [array names camera] { 497 set _settings($this-$key) $camera($key) 498 } 499 $cam ComputeViewPlaneNormal 500 500 $_window Render 501 501 } … … 535 535 # Shift the contour plot in 2D 536 536 # 537 538 539 540 541 542 543 537 foreach dataobj $_dlist { 538 foreach actor $_actors($dataobj) { 539 foreach {ax ay az} [$actor GetPosition] break 540 $actor SetPosition [expr {$ax+$dx}] \ 541 [expr {$ay-$dy}] 0 542 } 543 } 544 544 $_window Render 545 545 } elseif {$_dims == "3D"} { … … 551 551 if {$theta > 178} { set theta 178 } 552 552 set phi [expr {$_view(phi) - $dx*360}] 553 553 554 554 _3dView $theta $phi 555 555 $_window Render … … 618 618 $_window Render 619 619 if 0 { 620 620 $this-vtkRenderWindow2 Render 621 621 } 622 622 } … … 644 644 $_window Render 645 645 if 0 { 646 647 646 $this-vtkRenderer2 SetBackground $r $g $b 647 $this-vtkRenderWindow2 Render 648 648 } 649 649 } … … 704 704 705 705 if 1 { 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 } 706 # 707 # LOOKUP TABLE FOR COLOR CONTOURS 708 # 709 # Use vmin/vmax if possible, otherwise get from data 710 if {$_limits(vMin) == "" || $_limits(vMax) == ""} { 711 set v0 0 712 set v1 1 713 if { [info exists _dataobj2vtk($dataobj)] } { 714 set pd [lindex $_dataobj2vtk($dataobj) 0] 715 if {"" != $pd} { 716 foreach {v0 v1} [$pd GetScalarRange] break 717 } 718 } 719 } else { 720 set v0 $_limits(vMin) 721 set v1 $_limits(vMax) 722 } 723 } 724 724 # scan through all data objects and build the contours 725 725 set firstobj 1 726 726 foreach dataobj $_dlist { 727 728 729 730 731 732 733 734 735 736 737 738 739 727 foreach comp [$dataobj components] { 728 set tag $dataobj-$comp 729 if { ![info exists _dataobj2vtk($tag)] } { 730 set actor [$dataobj values $comp] 731 set style [$dataobj style $comp] 732 set _dataobj2vtk($tag) $actor 733 lappend _actors($dataobj) $actor 734 $_renderer AddActor $actor 735 SetActorProperties $actor $style 736 incr id 737 } 738 } 739 set firstobj 0 740 740 } 741 741 set top [lindex [get] end] 742 742 if { $top != "" } { 743 744 745 746 747 748 749 750 }751 752 743 foreach axis { x y z } { 744 set title [$top hints ${axis}label] 745 set units [$top hints ${axis}units] 746 set method Set[string toupper $axis]Title 747 set label "$title" 748 if { $units != "" } { 749 append label " ($units)" 750 } 751 $_cubeAxesActor $method $label 752 } 753 753 } 754 754 if 1 { 755 756 755 _fixLimits 756 Zoom reset 757 757 758 758 } … … 796 796 -window $tab.ss.frame 797 797 pack $tab.ss -fill both -expand yes 798 blt::tk::scrollbar $tab.ss.xs 799 blt::tk::scrollbar $tab.ss.ys 798 blt::tk::scrollbar $tab.ss.xs 799 blt::tk::scrollbar $tab.ss.ys 800 800 set inner [blt::tk::frame $tab.ss.frame] 801 801 $inner configure -borderwidth 4 … … 844 844 itcl::body Rappture::VtkViewerObsolete::BuildVolumeTab {} { 845 845 foreach { key value } { 846 light 847 transp 848 opacity 846 light 40 847 transp 50 848 opacity 1000 849 849 } { 850 850 set _settings($this-$key) $value … … 861 861 -window $tab.ss.frame 862 862 pack $tab.ss -fill both -expand yes 863 blt::tk::scrollbar $tab.ss.xs 864 blt::tk::scrollbar $tab.ss.ys 863 blt::tk::scrollbar $tab.ss.xs 864 blt::tk::scrollbar $tab.ss.ys 865 865 set inner [blt::tk::frame $tab.ss.frame] 866 866 $inner configure -borderwidth 4 … … 917 917 pt [$cam GetFocalPoint] \ 918 918 up [$cam GetViewUp] \ 919 920 921 922 919 pos [$cam GetPosition] { 920 set _settings($this-${key}focal) $pt 921 set _settings($this-${key}up) $up 922 set _settings($this-${key}pos) $pos 923 923 } 924 924 foreach {min max} [$cam GetClippingRange] break … … 928 928 set _settings($this-angle) [$cam GetViewAngle] 929 929 foreach key { xpos ypos zpos xviewup yviewup zviewup 930 930 xfocal yfocal zfocal angle clipmin clipmax parallelscale 931 931 } { 932 932 set out($key) $_settings($this-$key) 933 933 } 934 934 puts \"[array get out]\" … … 944 944 label $inner.xposl -text "Position" 945 945 entry $inner.xpos -bg white \ 946 946 -textvariable [itcl::scope _settings($this-xpos)] 947 947 entry $inner.ypos -bg white \ 948 948 -textvariable [itcl::scope _settings($this-ypos)] 949 949 entry $inner.zpos -bg white \ 950 950 -textvariable [itcl::scope _settings($this-zpos)] 951 951 label $inner.xviewupl -text "View Up" 952 952 entry $inner.xviewup -bg white \ 953 953 -textvariable [itcl::scope _settings($this-xviewup)] 954 954 entry $inner.yviewup -bg white \ 955 955 -textvariable [itcl::scope _settings($this-yviewup)] 956 956 entry $inner.zviewup -bg white \ 957 957 -textvariable [itcl::scope _settings($this-zviewup)] 958 958 label $inner.xfocall -text "Focal Point" 959 959 entry $inner.xfocal -bg white \ 960 960 -textvariable [itcl::scope _settings($this-xfocal)] 961 961 entry $inner.yfocal -bg white \ 962 962 -textvariable [itcl::scope _settings($this-yfocal)] 963 963 entry $inner.zfocal -bg white \ 964 964 -textvariable [itcl::scope _settings($this-zfocal)] 965 965 label $inner.anglel -text "View Angle" 966 966 entry $inner.angle -bg white \ 967 967 -textvariable [itcl::scope _settings($this-angle)] 968 968 label $inner.clipl -text "Clipping Range" 969 969 entry $inner.clipmin -bg white \ 970 970 -textvariable [itcl::scope _settings($this-clipmin)] 971 971 entry $inner.clipmax -bg white \ 972 972 -textvariable [itcl::scope _settings($this-clipmax)] 973 973 label $inner.pscalel -text "Parallel Scale" 974 974 entry $inner.pscale -bg white \ 975 975 -textvariable [itcl::scope _settings($this-parallelscale)] 976 976 977 977 button $inner.refresh -text "Refresh" \ 978 978 -command [itcl::code $this UpdateCameraInfo] 979 979 blt::table $inner \ 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 980 0,0 $inner.xposl -anchor w -pady 2 \ 981 1,0 $inner.xpos -pady 2 -fill x\ 982 2,0 $inner.ypos -pady 2 -fill x\ 983 3,0 $inner.zpos -pady 2 -fill x\ 984 4,0 $inner.xviewupl -anchor w -pady 2 \ 985 5,0 $inner.xviewup -pady 2 -fill x \ 986 6,0 $inner.yviewup -pady 2 -fill x \ 987 7,0 $inner.zviewup -pady 2 -fill x \ 988 8,0 $inner.xfocall -anchor w -pady 2 \ 989 9,0 $inner.xfocal -pady 2 -fill x \ 990 10,0 $inner.yfocal -pady 2 -fill x \ 991 11,0 $inner.zfocal -pady 2 -fill x \ 992 16,0 $inner.anglel -anchor w -pady 2 \ 993 17,0 $inner.angle -pady 2 -fill x \ 994 18,0 $inner.clipl -anchor w -pady 2 \ 995 19,0 $inner.clipmin -pady 2 -fill x \ 996 20,0 $inner.clipmax -pady 2 -fill x \ 997 21,0 $inner.pscalel -anchor w -pady 2 \ 998 22,0 $inner.pscale -pady 2 -fill x \ 999 23,0 $inner.refresh 1000 1000 1001 1001 blt::table configure $inner r* c* -resize none -
branches/blt4/gui/scripts/vtkviewer.tcl
r2742 r2745 126 126 private variable _volume 127 127 private variable _axis 128 private variable _reset 1 128 private variable _reset 1 ;# indicates if camera needs to be reset 129 129 # to starting position. 130 130 private variable _haveSpheres 0 … … 178 178 179 179 array set _outline { 180 181 182 183 184 185 180 id -1 181 afterId -1 182 x1 -1 183 y1 -1 184 x2 -1 185 y2 -1 186 186 } 187 187 # Initialize the view to some default parameters. 188 188 array set _view { 189 qw1190 qx0191 qy0192 qz0193 zoom 194 xpan 195 ypan 196 ortho 189 qw 1 190 qx 0 191 qy 0 192 qz 0 193 zoom 1.0 194 xpan 0 195 ypan 0 196 ortho 0 197 197 } 198 198 set _arcball [blt::arcball create 100 100] … … 204 204 205 205 array set _axis [subst { 206 xgrid 207 ygrid 208 zgrid 209 xcutaway 210 ycutaway 211 zcutaway 212 xposition 213 yposition 214 zposition 215 xdirection 216 ydirection 217 zdirection 218 visible 219 labels1206 xgrid 0 207 ygrid 0 208 zgrid 0 209 xcutaway 0 210 ycutaway 0 211 zcutaway 0 212 xposition 0 213 yposition 0 214 zposition 0 215 xdirection -1 216 ydirection -1 217 zdirection -1 218 visible 1 219 labels 1 220 220 }] 221 221 array set _volume [subst { 222 edges 223 lighting 224 opacity 225 visible 226 wireframe 222 edges 1 223 lighting 1 224 opacity 40 225 visible 1 226 wireframe 0 227 227 }] 228 228 array set _settings [subst { 229 legend 229 legend 1 230 230 }] 231 231 … … 300 300 BuildCameraTab 301 301 } errs] != 0 } { 302 302 puts stderr errs=$errs 303 303 } 304 304 # Legend … … 400 400 itcl::body Rappture::VtkViewer::DoResize {} { 401 401 if { $_width < 2 } { 402 402 set _width 500 403 403 } 404 404 if { $_height < 2 } { 405 405 set _height 500 406 406 } 407 407 #puts stderr "DoResize screen size $_width $_height" … … 441 441 if { !$_rotatePending } { 442 442 set _rotatePending 1 443 443 global rotate_delay 444 444 $_dispatcher event -after $rotate_delay !rotate 445 445 } … … 462 462 -description "" 463 463 -param "" 464 464 -type "" 465 465 } 466 466 array set params $settings … … 479 479 set pos [lsearch -exact $dataobj $_dlist] 480 480 if {$pos < 0} { 481 481 lappend _dlist $dataobj 482 482 } 483 483 set _allDataObjs($dataobj) 1 … … 505 505 foreach dataobj $args { 506 506 set pos [lsearch -exact $_dlist $dataobj] 507 508 continue;# Don't know anything about it.509 510 511 512 513 514 515 516 517 518 507 if { $pos < 0 } { 508 continue; # Don't know anything about it. 509 } 510 # Remove it from the dataobj list. 511 set _dlist [lreplace $_dlist $pos $pos] 512 foreach comp [$dataobj components] { 513 SendCmd "dataset visible 0 $dataobj-$comp" 514 } 515 array unset _obj2ovride $dataobj-* 516 # Append to the end of the dataobj list. 517 lappend _dlist $dataobj 518 set changed 1 519 519 } 520 520 # If anything changed, then rebuild the plot … … 540 540 set op [lindex $args 0] 541 541 switch -- $op { 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 }578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 542 "-objects" { 543 # put the dataobj list in order according to -raise options 544 set dlist {} 545 foreach dataobj $_dlist { 546 if { ![IsValidObject $dataobj] } { 547 continue 548 } 549 if {[info exists _obj2ovride($dataobj-raise)] && 550 $_obj2ovride($dataobj-raise)} { 551 set dlist [linsert $dlist 0 $dataobj] 552 } else { 553 lappend dlist $dataobj 554 } 555 } 556 return $dlist 557 } 558 "-visible" { 559 set dlist {} 560 foreach dataobj $_dlist { 561 if { ![IsValidObject $dataobj] } { 562 continue 563 } 564 if { ![info exists _obj2ovride($dataobj-raise)] } { 565 # No setting indicates that the object isn't invisible. 566 continue 567 } 568 # Otherwise use the -raise parameter to put the object to 569 # the front of the list. 570 if { $_obj2ovride($dataobj-raise) } { 571 set dlist [linsert $dlist 0 $dataobj] 572 } else { 573 lappend dlist $dataobj 574 } 575 } 576 return $dlist 577 } 578 -image { 579 if {[llength $args] != 2} { 580 error "wrong # args: should be \"get -image view\"" 581 } 582 switch -- [lindex $args end] { 583 view { 584 return $_image(plot) 585 } 586 default { 587 error "bad image name \"[lindex $args end]\": should be view" 588 } 589 } 590 } 591 default { 592 error "bad option \"$op\": should be -objects or -image" 593 } 594 594 } 595 595 } … … 608 608 foreach dataobj $args { 609 609 array set bounds [limits $dataobj] 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 610 if {![info exists _limits(xmin)] || $_limits(xmin) > $bounds(xmin)} { 611 set _limits(xmin) $bounds(xmin) 612 } 613 if {![info exists _limits(xmax)] || $_limits(xmax) < $bounds(xmax)} { 614 set _limits(xmax) $bounds(xmax) 615 } 616 617 if {![info exists _limits(ymin)] || $_limits(ymin) > $bounds(ymin)} { 618 set _limits(ymin) $bounds(ymin) 619 } 620 if {![info exists _limits(ymax)] || $_limits(ymax) < $bounds(ymax)} { 621 set _limits(ymax) $bounds(ymax) 622 } 623 624 if {![info exists _limits(zmin)] || $_limits(zmin) > $bounds(zmin)} { 625 set _limits(zmin) $bounds(zmin) 626 } 627 if {![info exists _limits(zmax)] || $_limits(zmax) < $bounds(zmax)} { 628 set _limits(zmax) $bounds(zmax) 629 } 630 630 } 631 631 } … … 663 663 set word [Rappture::filexfer::label downloadWord] 664 664 $inner.summary configure -text "$word $num in the following format:" 665 update idletasks 665 update idletasks ;# Fix initial sizes 666 666 return $popup 667 667 } … … 702 702 set result [VisViewer::Connect $_hosts] 703 703 if { $result } { 704 704 #puts stderr "Connected to $_hostname sid=$_sid" 705 705 set w [winfo width $itk_component(view)] 706 706 set h [winfo height $itk_component(view)] … … 781 781 set bytes [ReceiveBytes $info(-bytes)] 782 782 if { $info(-type) == "image" } { 783 784 785 786 787 783 if 0 { 784 set f [open "last.ppm" "w"] 785 puts $f $bytes 786 close $f 787 } 788 788 $_image(plot) configure -data $bytes 789 790 789 set time [clock seconds] 790 set date [clock format $time] 791 791 #puts stderr "$date: received image [image width $_image(plot)]x[image height $_image(plot)] image>" 792 793 794 795 796 792 if { $_start > 0 } { 793 set finish [clock clicks -milliseconds] 794 #puts stderr "round trip time [expr $finish -$_start] milliseconds" 795 set _start 0 796 } 797 797 } elseif { $info(type) == "print" } { 798 798 set tag $this-print-$info(-token) … … 810 810 set option [lindex $args 0] 811 811 switch -- $option { 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 812 "scalar" { 813 set option [lindex $args 1] 814 switch -- $option { 815 "world" { 816 foreach { x y z value tag } [lrange $args 2 end] break 817 } 818 "pixel" { 819 foreach { x y value tag } [lrange $args 2 end] break 820 } 821 } 822 } 823 "vector" { 824 set option [lindex $args 1] 825 switch -- $option { 826 "world" { 827 foreach { x y z vx vy vz tag } [lrange $args 2 end] break 828 } 829 "pixel" { 830 foreach { x y vx vy vz tag } [lrange $args 2 end] break 831 } 832 } 833 } 834 "names" { 835 835 foreach { name } [lindex $args 1] { 836 836 #puts stderr "Dataset: $name" 837 837 } 838 839 840 841 838 } 839 default { 840 error "unknown dataset option \"$option\" from server" 841 } 842 842 } 843 843 } … … 855 855 set h [winfo height $itk_component(view)] 856 856 if { $w < 2 || $h < 2 } { 857 858 857 $_dispatcher event -idle !rebuild 858 return 859 859 } 860 860 … … 882 882 set _first [lindex [get -objects] 0] 883 883 if { $_reset || $_first == "" } { 884 885 884 Zoom reset 885 set _reset 0 886 886 } 887 887 FixSettings axis-xgrid axis-ygrid axis-zgrid axis-mode \ 888 889 890 888 axis-visible axis-labels \ 889 volume-edges volume-lighting volume-opacity volume-visible \ 890 volume-wireframe 891 891 892 892 #SendCmd "imgflush" … … 896 896 set _first "" 897 897 foreach dataobj [get -objects] { 898 899 900 901 898 if { [info exists _obj2ovride($dataobj-raise)] && $_first == "" } { 899 set _first $dataobj 900 } 901 set _obj2datasets($dataobj) "" 902 902 foreach comp [$dataobj components] { 903 903 set tag $dataobj-$comp … … 907 907 append _outbuf "dataset add $tag data follows $length\n" 908 908 append _outbuf $bytes 909 910 909 if { [$dataobj type $comp] != "spheres" } { 910 } 911 911 set _datasets($tag) 1 912 913 914 915 916 917 918 919 912 } 913 lappend _obj2datasets($dataobj) $tag 914 if { [info exists _obj2ovride($dataobj-raise)] } { 915 SendCmd "dataset visible 1 $tag" 916 } else { 917 SendCmd "dataset visible 0 $tag" 918 } 919 SetObjectStyle $dataobj $comp 920 920 } 921 921 } … … 927 927 } 928 928 foreach axis { x y z } { 929 930 931 932 933 934 935 936 937 } 938 929 set label [$_first hints ${axis}label] 930 if { $label != "" } { 931 SendCmd "axis name $axis $label" 932 } 933 set units [$_first hints ${axis}units] 934 if { $units != "" } { 935 SendCmd "axis units $axis $units" 936 } 937 } 938 939 939 set _buffering 0; # Turn off buffering. 940 940 … … 957 957 set flag [lindex $args 0] 958 958 switch -- $flag { 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 }978 979 980 959 "-all" { 960 if { [llength $args] > 1 } { 961 error "CurrentDatasets: can't specify dataobj after \"-all\"" 962 } 963 set dlist [get -objects] 964 } 965 "-visible" { 966 if { [llength $args] > 1 } { 967 set dlist {} 968 set args [lrange $args 1 end] 969 foreach dataobj $args { 970 if { [info exists _obj2ovride($dataobj-raise)] } { 971 lappend dlist $dataobj 972 } 973 } 974 } else { 975 set dlist [get -visible] 976 } 977 } 978 default { 979 set dlist $args 980 } 981 981 } 982 982 set rlist "" 983 983 foreach dataobj $dlist { 984 985 986 987 988 989 984 foreach comp [$dataobj components] { 985 set tag $dataobj-$comp 986 if { [info exists _datasets($tag)] && $_datasets($tag) } { 987 lappend rlist $tag 988 } 989 } 990 990 } 991 991 return $rlist … … 1004 1004 "in" { 1005 1005 set _view(zoom) [expr {$_view(zoom)*1.25}] 1006 1006 SendCmd "camera zoom $_view(zoom)" 1007 1007 } 1008 1008 "out" { 1009 1009 set _view(zoom) [expr {$_view(zoom)*0.8}] 1010 1010 SendCmd "camera zoom $_view(zoom)" 1011 1011 } 1012 1012 "reset" { 1013 1013 array set _view { 1014 qw11015 qx01016 qy01017 qz01014 qw 1 1015 qx 0 1016 qy 0 1017 qz 0 1018 1018 zoom 1.0 1019 1019 xpan 0 … … 1027 1027 } 1028 1028 } 1029 1030 1031 1029 set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)] 1030 $_arcball quaternion $q 1031 DoRotate 1032 1032 } 1033 1033 } … … 1073 1073 return 1074 1074 } 1075 1076 1077 1078 1079 1075 if { $dx == 0 && $dy == 0 } { 1076 return 1077 } 1078 set q [$_arcball rotate $x $y $_click(x) $_click(y)] 1079 EventuallyRotate $q 1080 1080 set _click(x) $x 1081 1081 set _click(y) $y … … 1109 1109 itcl::body Rappture::VtkViewer::Pan {option x y} { 1110 1110 switch -- $option { 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1111 "set" { 1112 set w [winfo width $itk_component(view)] 1113 set h [winfo height $itk_component(view)] 1114 set x [expr $x / double($w)] 1115 set y [expr $y / double($h)] 1116 set _view(xpan) [expr $_view(xpan) + $x] 1117 set _view(ypan) [expr $_view(ypan) + $y] 1118 PanCamera 1119 return 1120 } 1121 "click" { 1122 set _click(x) $x 1123 set _click(y) $y 1124 $itk_component(view) configure -cursor hand1 1125 } 1126 "drag" { 1127 if { ![info exists _click(x)] } { 1128 set _click(x) $x 1129 } 1130 if { ![info exists _click(y)] } { 1131 set _click(y) $y 1132 } 1133 set w [winfo width $itk_component(view)] 1134 set h [winfo height $itk_component(view)] 1135 set dx [expr ($_click(x) - $x)/double($w)] 1136 set dy [expr ($_click(y) - $y)/double($h)] 1137 set _click(x) $x 1138 set _click(y) $y 1139 set _view(xpan) [expr $_view(xpan) - $dx] 1140 set _view(ypan) [expr $_view(ypan) - $dy] 1141 PanCamera 1142 } 1143 "release" { 1144 Pan drag $x $y 1145 $itk_component(view) configure -cursor "" 1146 } 1147 default { 1148 error "unknown option \"$option\": should set, click, drag, or release" 1149 } 1150 1150 } 1151 1151 } … … 1160 1160 itcl::body Rappture::VtkViewer::FixSettings { args } { 1161 1161 foreach setting $args { 1162 1162 AdjustSetting $setting 1163 1163 } 1164 1164 } … … 1167 1167 # AdjustSetting -- 1168 1168 # 1169 # 1170 # 1171 # 1169 # Changes/updates a specific setting in the widget. There are 1170 # usually user-setable option. Commands are sent to the render 1171 # server. 1172 1172 # 1173 1173 itcl::body Rappture::VtkViewer::AdjustSetting {what {value ""}} { 1174 1174 if { ![isconnected] } { 1175 1175 return 1176 1176 } 1177 1177 switch -- $what { 1178 1178 "volume-opacity" { 1179 1180 1181 1182 1183 1179 set val $_volume(opacity) 1180 set sval [expr { 0.01 * double($val) }] 1181 foreach dataset [CurrentDatasets -visible $_first] { 1182 SendCmd "polydata opacity $sval $dataset" 1183 } 1184 1184 } 1185 1185 "volume-wireframe" { 1186 1187 1188 1186 set bool $_volume(wireframe) 1187 foreach dataset [CurrentDatasets -visible $_first] { 1188 SendCmd "polydata wireframe $bool $dataset" 1189 1189 } 1190 1190 } 1191 1191 "volume-visible" { 1192 1193 1194 1192 set bool $_volume(visible) 1193 foreach dataset [CurrentDatasets -visible $_first] { 1194 SendCmd "polydata visible $bool $dataset" 1195 1195 } 1196 1196 } 1197 1197 "volume-lighting" { 1198 1199 1200 1198 set bool $_volume(lighting) 1199 foreach dataset [CurrentDatasets -visible $_first] { 1200 SendCmd "polydata lighting $bool $dataset" 1201 1201 } 1202 1202 } 1203 1203 "volume-edges" { 1204 1205 1206 1204 set bool $_volume(edges) 1205 foreach dataset [CurrentDatasets -visible $_first] { 1206 SendCmd "polydata edges $bool $dataset" 1207 1207 } 1208 1208 } 1209 1209 "axis-visible" { 1210 1211 1210 set bool $_axis(visible) 1211 SendCmd "axis visible all $bool" 1212 1212 } 1213 1213 "axis-labels" { 1214 1215 1214 set bool $_axis(labels) 1215 SendCmd "axis labels all $bool" 1216 1216 } 1217 1217 "axis-xgrid" { 1218 1219 1218 set bool $_axis(xgrid) 1219 SendCmd "axis grid x $bool" 1220 1220 } 1221 1221 "axis-ygrid" { 1222 1223 1222 set bool $_axis(ygrid) 1223 SendCmd "axis grid y $bool" 1224 1224 } 1225 1225 "axis-zgrid" { 1226 1227 1226 set bool $_axis(zgrid) 1227 SendCmd "axis grid z $bool" 1228 1228 } 1229 1229 "axis-mode" { 1230 1231 1232 1233 } 1234 1235 1236 1230 set mode [$itk_component(axismode) value] 1231 set mode [$itk_component(axismode) translate $mode] 1232 SendCmd "axis flymode $mode" 1233 } 1234 "axis-xcutaway" - "axis-ycutaway" - "axis-zcutaway" { 1235 set axis [string range $what 5 5] 1236 set bool $_axis(${axis}cutaway) 1237 1237 if { $bool } { 1238 1239 1238 set pos [expr $_axis(${axis}position) * 0.01] 1239 set dir $_axis(${axis}direction) 1240 1240 $itk_component(${axis}CutScale) configure -state normal \ 1241 1241 -troughcolor white 1242 1242 SendCmd "renderer clipplane $axis $pos $dir" 1243 1243 } else { 1244 1244 $itk_component(${axis}CutScale) configure -state disabled \ 1245 1245 -troughcolor grey82 1246 1247 } 1248 1249 1250 1251 1252 1253 1254 1255 1246 SendCmd "renderer clipplane $axis 1 -1" 1247 } 1248 } 1249 "axis-xposition" - "axis-yposition" - "axis-zposition" - 1250 "axis-xdirection" - "axis-ydirection" - "axis-zdirection" { 1251 set axis [string range $what 5 5] 1252 #set dir $_axis(${axis}direction) 1253 set pos [expr $_axis(${axis}position) * 0.01] 1254 SendCmd "renderer clipplane ${axis} $pos -1" 1255 } 1256 1256 default { 1257 1257 error "don't know how to fix $what" … … 1263 1263 # RequestLegend -- 1264 1264 # 1265 # 1266 # 1267 # 1265 # Request a new legend from the server. The size of the legend 1266 # is determined from the height of the canvas. It will be rotated 1267 # to be vertical when drawn. 1268 1268 # 1269 1269 itcl::body Rappture::VtkViewer::RequestLegend {} { … … 1276 1276 set h [expr {$_height - 2 * ($lineht + 2)}] 1277 1277 if { $h < 1} { 1278 1278 return 1279 1279 } 1280 1280 # Set the legend on the first dataset. 1281 1281 foreach dataset [CurrentDatasets -visible] { 1282 1283 1284 1282 foreach {dataobj comp} [split $dataset -] break 1283 if { [info exists _dataset2style($dataset)] } { 1284 #puts stderr "RequestLegend w=$w h=$h" 1285 1285 SendCmd "legend $_dataset2style($dataset) vmag {} $w $h 0" 1286 1286 break; 1287 1287 } 1288 1288 } … … 1302 1302 set colormap "$style(-color):$style(-levels):$style(-opacity)" 1303 1303 if { [info exists _colormaps($colormap)] } { 1304 1305 1304 puts stderr "Colormap $colormap already built" 1305 return $colormap 1306 1306 } 1307 1307 if { ![info exists _dataset2style($tag)] } { 1308 1309 1308 set _dataset2style($tag) $colormap 1309 lappend _style2datasets($colormap) $tag 1310 1310 } 1311 1311 if { ![info exists _colormaps($colormap)] } { 1312 1313 1314 1312 # Build the pseudo colormap if it doesn't exist. 1313 BuildColormap $colormap $dataobj $comp 1314 set _colormaps($colormap) 1 1315 1315 } 1316 1316 switch -- [$dataobj type $comp] { 1317 1318 1319 1320 1321 1322 1317 "polygon" { 1318 SendCmd "pseudocolor colormap $colormap $tag" 1319 } 1320 "spheres" { 1321 #SendCmd "glyphs colormap $colormap $tag" 1322 } 1323 1323 } 1324 1324 return $colormap … … 1346 1346 } 1347 1347 if { [llength $cmap] == 0 } { 1348 1348 set cmap "0.0 0.0 0.0 0.0 1.0 1.0 1.0 1.0" 1349 1349 } 1350 1350 if { ![info exists _volume(opacity)] } { … … 1382 1382 array unset _limits $dataobj-* 1383 1383 foreach comp [$dataobj components] { 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1384 set tag $dataobj-$comp 1385 if { ![info exists _limits($tag)] } { 1386 set data [$dataobj data $comp] 1387 set tmpfile file[pid].vtk 1388 set f [open "$tmpfile" "w"] 1389 fconfigure $f -translation binary -encoding binary 1390 puts $f $data 1391 close $f 1392 set reader [vtkDataSetReader $tag-xvtkDataSetReader] 1393 $reader SetFileName $tmpfile 1394 $reader ReadAllNormalsOn 1395 $reader ReadAllScalarsOn 1396 $reader ReadAllVectorsOn 1397 $reader ReadAllFieldsOn 1398 $reader Update 1399 set output [$reader GetOutput] 1400 set _limits($tag) [$output GetBounds] 1401 set pointData [$output GetPointData] 1402 puts stderr "\#scalars=[$reader GetNumberOfScalarsInFile]" 1403 puts stderr "\#vectors=[$reader GetNumberOfVectorsInFile]" 1404 puts stderr "\#tensors=[$reader GetNumberOfTensorsInFile]" 1405 puts stderr "\#normals=[$reader GetNumberOfNormalsInFile]" 1406 puts stderr "\#fielddata=[$reader GetNumberOfFieldDataInFile]" 1407 puts stderr "fielddataname=[$reader GetFieldDataNameInFile 0]" 1408 set fieldData [$output GetFieldData] 1409 set pointData [$output GetPointData] 1410 puts stderr "field \#arrays=[$fieldData GetNumberOfArrays]" 1411 puts stderr "point \#arrays=[$pointData GetNumberOfArrays]" 1412 puts stderr "field \#components=[$fieldData GetNumberOfComponents]" 1413 puts stderr "point \#components=[$pointData GetNumberOfComponents]" 1414 puts stderr "field \#tuples=[$fieldData GetNumberOfTuples]" 1415 puts stderr "point \#tuples=[$pointData GetNumberOfTuples]" 1416 puts stderr "point \#scalars=[$pointData GetScalars]" 1417 puts stderr vectors=[$pointData GetVectors] 1418 rename $output "" 1419 rename $reader "" 1420 file delete $tmpfile 1421 } 1422 1422 foreach { xMin xMax yMin yMax zMin zMax} $_limits($tag) break 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1423 if {![info exists limits(xmin)] || $limits(xmin) > $xMin} { 1424 set limits(xmin) $xMin 1425 } 1426 if {![info exists limits(xmax)] || $limits(xmax) < $xMax} { 1427 set limits(xmax) $xMax 1428 } 1429 if {![info exists limits(ymin)] || $limits(ymin) > $yMin} { 1430 set limits(ymin) $xMin 1431 } 1432 if {![info exists limits(ymax)] || $limits(ymax) < $yMax} { 1433 set limits(ymax) $yMax 1434 } 1435 if {![info exists limits(zmin)] || $limits(zmin) > $zMin} { 1436 set limits(zmin) $zMin 1437 } 1438 if {![info exists limits(zmax)] || $limits(zmax) < $zMax} { 1439 set limits(zmax) $zMax 1440 } 1441 1441 } 1442 1442 return [array get limits] … … 1482 1482 -width 10 \ 1483 1483 -showvalue off \ 1484 1484 -command [itcl::code $this AdjustSetting volume-opacity] 1485 1485 1486 1486 blt::table $inner \ … … 1537 1537 1538 1538 itk_component add axismode { 1539 1539 Rappture::Combobox $inner.mode -width 10 -editable no 1540 1540 } 1541 1541 $inner.mode choices insert end \ … … 1602 1602 set inner [$itk_component(main) insert end \ 1603 1603 -title "Cutaway Along Axis" \ 1604 1604 -icon [Rappture::icon cutbutton]] 1605 1605 1606 1606 $inner configure -borderwidth 4 … … 1636 1636 Rappture::PushButton $inner.xdir \ 1637 1637 -onimage [Rappture::icon arrow-down] \ 1638 1638 -onvalue -1 \ 1639 1639 -offimage [Rappture::icon arrow-up] \ 1640 1640 -offvalue 1 \ 1641 1641 -command [itcl::code $this AdjustSetting axis-xdirection] \ 1642 1642 -variable [itcl::scope _axis(xdirection)] … … 1676 1676 Rappture::PushButton $inner.ydir \ 1677 1677 -onimage [Rappture::icon arrow-down] \ 1678 1678 -onvalue -1 \ 1679 1679 -offimage [Rappture::icon arrow-up] \ 1680 1680 -offvalue 1 \ 1681 1681 -command [itcl::code $this AdjustSetting axis-ydirection] \ 1682 1682 -variable [itcl::scope _axis(ydirection)] … … 1716 1716 Rappture::PushButton $inner.zdir \ 1717 1717 -onimage [Rappture::icon arrow-down] \ 1718 1718 -onvalue -1 \ 1719 1719 -offimage [Rappture::icon arrow-up] \ 1720 1720 -offvalue 1 \ 1721 1721 -command [itcl::code $this AdjustSetting axis-zdirection] \ 1722 1722 -variable [itcl::scope _axis(zdirection)] … … 1768 1768 "qx" - "qy" - "qz" - "qw" { 1769 1769 set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)] 1770 1771 1770 $_arcball quaternion $q 1771 EventuallyRotate $q 1772 1772 } 1773 1773 "zoom" { … … 1803 1803 foreach comp [$dataobj components] { 1804 1804 set tag $dataobj-$comp 1805 1806 1805 set contents [ConvertToVtkData $dataobj $comp] 1806 append bytes "$contents\n\n" 1807 1807 } 1808 1808 } … … 1812 1812 itcl::body Rappture::VtkViewer::GetImage { args } { 1813 1813 if { [image width $_image(download)] > 0 && 1814 1815 1816 1814 [image height $_image(download)] > 0 } { 1815 $_image(download) export jpg -quality 100 -data bytes 1816 return [list .jpg $bytes] 1817 1817 } 1818 1818 return "" … … 1836 1836 1837 1837 button $inner.ok -text "Save" \ 1838 1838 -highlightthickness 0 -pady 2 -padx 3 \ 1839 1839 -command $command \ 1840 1841 1840 -compound left \ 1841 -image [Rappture::icon download] 1842 1842 1843 1843 button $inner.cancel -text "Cancel" \ 1844 1845 1846 1847 1844 -highlightthickness 0 -pady 2 -padx 3 \ 1845 -command [list $popup deactivate] \ 1846 -compound left \ 1847 -image [Rappture::icon cancel] 1848 1848 1849 1849 blt::table $inner \ … … 1866 1866 set style [$dataobj style $comp] 1867 1867 if { $dataobj != $_first } { 1868 1868 set settings(-wireframe) 1 1869 1869 } 1870 1870 if { $type == "spheres" } { 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1871 array set settings { 1872 -color \#808080 1873 -gscale 1 1874 -edges 0 1875 -edgecolor black 1876 -linewidth 1.0 1877 -opacity 1.0 1878 -wireframe 0 1879 -lighting 1 1880 -visible 1 1881 } 1882 array set settings $style 1883 SendCmd "glyphs add sphere $tag" 1884 SendCmd "glyphs normscale 0 $tag" 1885 SendCmd "glyphs gscale $settings(-gscale) $tag" 1886 SendCmd "glyphs wireframe $settings(-wireframe) $tag" 1887 #SendCmd "glyphs ccolor [Color2RGB $settings(-color)] $tag" 1888 #SendCmd "glyphs colormode ccolor {} $tag" 1889 SendCmd "glyphs smode vcomp {} $tag" 1890 SendCmd "glyphs opacity $settings(-opacity) $tag" 1891 SendCmd "glyphs visible $settings(-visible) $tag" 1892 set _haveSpheres 1 1893 1893 } else { 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1894 array set settings { 1895 -color \#6666FF 1896 -edges 1 1897 -edgecolor black 1898 -linewidth 1.0 1899 -opacity 1.0 1900 -wireframe 0 1901 -lighting 1 1902 -visible 1 1903 } 1904 array set settings $style 1905 SendCmd "polydata add $tag" 1906 SendCmd "polydata visible $settings(-visible) $tag" 1907 set _volume(visible) $settings(-visible) 1908 1908 } 1909 1909 if { $type != "spheres" } { 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1910 SendCmd "polydata edges $settings(-edges) $tag" 1911 set _volume(edges) $settings(-edges) 1912 SendCmd "polydata color [Color2RGB $settings(-color)] $tag" 1913 SendCmd "polydata lighting $settings(-lighting) $tag" 1914 set _volume(lighting) $settings(-lighting) 1915 SendCmd "polydata linecolor [Color2RGB $settings(-edgecolor)] $tag" 1916 SendCmd "polydata linewidth $settings(-linewidth) $tag" 1917 SendCmd "polydata opacity $settings(-opacity) $tag" 1918 set _volume(opacity) $settings(-opacity) 1919 SendCmd "polydata wireframe $settings(-wireframe) $tag" 1920 set _volume(wireframe) $settings(-wireframe) 1921 1921 } 1922 1922 set _volume(opacity) [expr $settings(-opacity) * 100.0] … … 1926 1926 itcl::body Rappture::VtkViewer::IsValidObject { dataobj } { 1927 1927 if {[catch {$dataobj isa Rappture::Drawing} valid] != 0 || !$valid} { 1928 1928 return 0 1929 1929 } 1930 1930 return 1 … … 1950 1950 $_image(legend) configure -data $bytes 1951 1951 #puts stderr "read $size bytes for [image width $_image(legend)]x[image height $_image(legend)] legend>" 1952 1952 DrawLegend 1953 1953 } 1954 1954 } … … 1957 1957 # DrawLegend -- 1958 1958 # 1959 # 1960 # 1959 # Draws the legend in it's own canvas which resides to the right 1960 # of the contour plot area. 1961 1961 # 1962 1962 itcl::body Rappture::VtkViewer::DrawLegend {} { … … 1968 1968 1969 1969 if { $_settings(legend) } { 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1970 set x [expr $w - 2] 1971 if { [$c find withtag "legend"] == "" } { 1972 $c create image $x [expr {$lineht+2}] \ 1973 -anchor ne \ 1974 -image $_image(legend) -tags "colormap legend" 1975 $c create text $x 2 \ 1976 -anchor ne \ 1977 -fill $itk_option(-plotforeground) -tags "vmax legend" \ 1978 -font $font 1979 $c create text $x [expr {$h-2}] \ 1980 -anchor se \ 1981 -fill $itk_option(-plotforeground) -tags "vmin legend" \ 1982 -font $font 1983 #$c bind colormap <Enter> [itcl::code $this EnterLegend %x %y] 1984 $c bind colormap <Leave> [itcl::code $this LeaveLegend] 1985 $c bind colormap <Motion> [itcl::code $this MotionLegend %x %y] 1986 } 1987 # Reset the item coordinates according the current size of the plot. 1988 $c coords colormap $x [expr {$lineht+2}] 1989 if { $_limits(vmin) != "" } { 1990 $c itemconfigure vmin -text [format %g $_limits(vmin)] 1991 } 1992 if { $_limits(vmax) != "" } { 1993 $c itemconfigure vmax -text [format %g $_limits(vmax)] 1994 } 1995 $c coords vmin $x [expr {$h-2}] 1996 $c coords vmax $x 2 1997 1997 } 1998 1998 } … … 2039 2039 # Make a swatch of the selected color 2040 2040 if { [catch { $_image(legend) get 10 $imgY } pixel] != 0 } { 2041 2042 2041 #puts stderr "out of range: $imgY" 2042 return 2043 2043 } 2044 2044 if { ![info exists _image(swatch)] } { 2045 2045 set _image(swatch) [image create picture -width 24 -height 24] 2046 2046 } 2047 2047 set color [eval format "\#%02x%02x%02x" $pixel] … … 2082 2082 SendCmd "renderer clipplane $axis $newpos -1" 2083 2083 } 2084 2085 2086 2087 2088 2084 "tooltip" { 2085 set axis [lindex $args 0] 2086 set val [$itk_component(${axis}CutScale) get] 2087 return "Move the [string toupper $axis] cut plane.\nCurrently: $axis = $val%" 2088 } 2089 2089 default { 2090 2090 error "bad option \"$option\": should be axis, move, or tooltip" -
branches/blt4/gui/scripts/xylegend.tcl
r2742 r2745 61 61 private variable _lastColorIndex "" 62 62 private variable _dispatcher "" ;# dispatcher for !events 63 private variable _graph 64 private variable _tree 65 private variable _diff "";# Polygon marker used for difference.66 private variable _rename "";# Node selected to be renamed.63 private variable _graph "" 64 private variable _tree "" 65 private variable _diff ""; # Polygon marker used for difference. 66 private variable _rename ""; # Node selected to be renamed. 67 67 private variable _diffelements 68 68 private variable _unmapHidden 0 … … 455 455 update 456 456 # Step 1. Get the x-values for each curve, then sort them to get the 457 # 457 # unique values. 458 458 459 459 set labels {} … … 469 469 470 470 # Step 2. Now for each curve, generate a cubic spline of that curve 471 # 472 # 473 # 471 # and interpolate to get the corresponding y-values for each 472 # abscissa. Normally the abscissa are the same, so we're 473 # interpolation the knots. 474 474 475 475 set x [blt::vector create \#auto -command ""] … … 492 492 493 493 # Step 3. Create a new curve which is the average. Append it to the 494 # 494 # the end. 495 495 496 496 set count 0 … … 528 528 if { [info exists _diffelements($elem1)] && 529 529 [info exists _diffelements($elem2)] } { 530 array unset _diffelements; 531 return; 530 array unset _diffelements; # Toggle the difference. 531 return; 532 532 } 533 533 array unset _diffelements … … 672 672 # PopupMenu -- 673 673 # 674 # 675 # 676 # 677 # 674 # Builds the popup associated with the sensor map. The menu 675 # is first destroyed if one exists. This is because the menu 676 # bindings callbacks are specific to the current map. Destroying 677 # the menu automatically removes the bindings and callbacks. 678 678 # 679 679 itcl::body Rappture::XyLegend::PopupMenu { x y } { -
branches/blt4/gui/scripts/xyprint.tcl
r2742 r2745 34 34 destructor {} 35 35 36 private variable _graph ""; 37 private variable _clone ""; 38 private variable _preview ""; 39 private variable _savedSettings; 36 private variable _graph ""; # Original graph. 37 private variable _clone ""; # Cloned graph. 38 private variable _preview ""; # Preview image. 39 private variable _savedSettings; # Array of settings. 40 40 41 41 private common _oldSettingsFile "~/.rpsettings" … … 297 297 # Axis component 298 298 foreach axis [$orig axis names] { 299 300 301 299 if { $axis == "z" } { 300 continue 301 } 302 302 if { [$orig axis cget $axis -hide] } { 303 303 continue … … 386 386 set _settings($this-axis-title-fontslant) roman 387 387 foreach axis [$_clone axis names] { 388 389 390 388 if { $axis == "z" } { 389 continue 390 } 391 391 if { [$_clone axis cget $axis -hide] } { 392 392 continue 393 393 } 394 395 396 397 398 399 400 401 402 403 394 set _settings($this-$axis-ticks-fontfamily) helvetica 395 set _settings($this-$axis-ticks-fontsize) 10 396 set _settings($this-$axis-ticks-fontweight) normal 397 set _settings($this-$axis-ticks-fontslant) roman 398 set _settings($this-$axis-title-fontfamily) helvetica 399 set _settings($this-$axis-title-fontsize) 10 400 set _settings($this-$axis-title-fontweight) normal 401 set _settings($this-$axis-title-fontslant) roman 402 set tickfont "helvetica 10 normal roman" 403 set titlefont "helvetica 10 normal roman" 404 404 $_clone axis configure $axis -ticklength 5 \ 405 405 -majorticks {} -minorticks {} … … 413 413 continue 414 414 } 415 415 incr count 416 416 if { [$_clone element cget $elem -linewidth] > 1 } { 417 417 $_clone element configure $elem -linewidth 1 -pixels 3 … … 419 419 } 420 420 if { $count == 0 } { 421 422 423 424 425 426 427 428 429 430 421 # There are no "line" elements in the graph. 422 # Remove the symbol and dashes controls. 423 set page $itk_component(legend_page) 424 # May have already been forgotten. 425 catch { 426 blt::table forget $page.symbol_l 427 blt::table forget $page.symbol 428 blt::table forget $page.dashes_l 429 blt::table forget $page.dashes 430 } 431 431 } 432 432 } … … 486 486 set maxheight $rh 487 487 if { $maxwidth > $cw } { 488 488 set maxwidth $cw 489 489 } 490 490 if { $maxheight > $ch } { 491 491 set maxheight $ch 492 492 } 493 493 set sx [expr double($maxwidth)/$w] … … 545 545 } 546 546 foreach attr { fontfamily fontsize fontweight fontslant } { 547 548 549 550 551 552 547 set specific $this-$axis-ticks 548 set general $this-axis-ticks 549 set _settings(${general}-${attr}) $_settings(${specific}-${attr}) 550 set specific $this-$axis-title 551 set general $this-axis-title 552 set _settings(${general}-${attr}) $_settings(${specific}-${attr}) 553 553 } 554 554 set type [GetAxisType $axis] … … 748 748 set _settings($this-legend-anchor) [$page.anchor current] 749 749 if { $_clone != "" } { 750 751 752 753 750 lappend font $_settings($this-legend-fontfamily) 751 lappend font $_settings($this-legend-fontsize) 752 lappend font $_settings($this-legend-fontweight) 753 lappend font $_settings($this-legend-fontslant) 754 754 foreach option { -hide -position -anchor -borderwidth } { 755 755 SetComponentOption legend $option … … 1291 1291 1292 1292 foreach attr { fontfamily fontsize fontweight fontslant } { 1293 1294 1295 1296 1297 1298 1299 1300 1293 set specific $this-$axis-ticks 1294 set general $this-axis-ticks 1295 set _settings(${specific}-${attr}) $_settings(${general}-${attr}) 1296 lappend tickfont $_settings(${general}-${attr}) 1297 set specific $this-$axis-title 1298 set general $this-axis-title 1299 set _settings(${specific}-${attr}) $_settings(${general}-${attr}) 1300 lappend titlefont $_settings(${general}-${attr}) 1301 1301 } 1302 1302 $_clone axis configure $axis -tickfont $tickfont -titlefont $titlefont … … 1402 1402 $itk_component(axis_menu) delete all 1403 1403 foreach axis $names { 1404 1405 1406 1404 if { $axis == "z" } { 1405 continue 1406 } 1407 1407 if { ![$_clone axis cget $axis -hide] } { 1408 1408 $itk_component(axis_menu) add -text $axis -value $axis \ … … 1443 1443 itcl::body Rappture::XyPrint::RestoreSettings { toolName plotName } { 1444 1444 if { ![file readable $_settingsFile] } { 1445 return; 1445 return; # No file or not readable 1446 1446 } 1447 1447 if { [file exists $_oldSettingsFile] } { … … 1510 1510 append out " array set settings {\n" 1511 1511 foreach item [array names _settings ${this}-*] { 1512 1513 1514 1515 1516 1517 1512 set field [string range $item $length end] 1513 if { [regexp {^element-[0-9]+$} $field] } { 1514 continue 1515 } 1516 set value $_settings($item) 1517 append out " [list $field] [list $value]\n" 1518 1518 } 1519 1519 append out " }\n" … … 1588 1588 append out " preview marker configure \"${axis}-zero\" -hide $hide\n" 1589 1589 append out " \}\n" 1590 } 1590 } 1591 1591 return $out 1592 1592 } -
branches/blt4/gui/scripts/xyresult.tcl
r2742 r2745 299 299 set _autoColorI 0 300 300 } 301 301 set color [lindex $itk_option(-autocolors) $_autoColorI] 302 302 if { "" == $color} { 303 304 303 set color black 304 } 305 305 set params(-color) $color 306 306 # set up for next auto color … … 357 357 foreach obj $_dlist { 358 358 if {[info exists _dataobj2raise($obj)] && $_dataobj2raise($obj)} { 359 360 361 362 359 lappend top $obj 360 } else { 361 lappend bottom $obj 362 } 363 363 } 364 364 set _dlist [concat $bottom $top] … … 439 439 set id $map($axis)$type 440 440 foreach {min max} [$dataobj limits $axis$type] break 441 442 443 444 445 446 447 448 441 set amin [$dataobj hints ${axis}min] 442 set amax [$dataobj hints ${axis}max] 443 if { $amin != "" } { 444 set min $amin 445 } 446 if { $amax != "" } { 447 set max $amax 448 } 449 449 if {"" != $min && "" != $max} { 450 450 if {![info exists _limits($id-min)]} { … … 521 521 csv { 522 522 # generate the comma-separated value data for these objects 523 523 return [ExportCsv] 524 524 } 525 525 image { … … 1470 1470 itcl::body Rappture::XyResult::GetTextMarkerOptions {style} { 1471 1471 array set textOptions { 1472 "-color" 1473 "-textcolor" 1474 "-font" 1475 "-xoffset" 1476 "-yoffset" 1477 "-anchor" 1478 "-rotate" 1472 "-color" "-outline" 1473 "-textcolor" "-outline" 1474 "-font" "-font" 1475 "-xoffset" "-xoffset" 1476 "-yoffset" "-yoffset" 1477 "-anchor" "-anchor" 1478 "-rotate" "-rotate" 1479 1479 } 1480 1480 set options {} … … 1497 1497 # rebuild if needed, so we know about the axes 1498 1498 if 0 { 1499 1500 1501 1502 1503 1504 1505 1499 # Don't do this. Given dataobj may be deleted in the rebuild 1500 1501 # rebuild if needed, so we know about the axes 1502 if {[$_dispatcher ispending !rebuild]} { 1503 $_dispatcher cancel !rebuild 1504 $_dispatcher event -now !rebuild 1505 } 1506 1506 } 1507 1507 # what is the x axis? x? x2? x3? ... … … 1591 1591 # objects themselves) or derived (computed from other data points). 1592 1592 set dlist {} 1593 set derived {} 1593 set derived {} 1594 1594 foreach e [$g element show] { 1595 1596 continue;# Hidden or not a line element.1597 1598 1599 1600 continue;# Derived data.1601 1602 1603 1604 continue;# Already found the data object.1605 1606 1607 1595 if { [$g element cget $e -hide] || [$g element type $e] != "line" } { 1596 continue; # Hidden or not a line element. 1597 } 1598 if { ![info exists _elem2dataobj($e)] } { 1599 lappend derived $e 1600 continue; # Derived data. 1601 } 1602 set dataobj $_elem2dataobj($e) 1603 if { [info exists dtable($dataobj)] } { 1604 continue; # Already found the data object. 1605 } 1606 set dtable($dataobj) $e 1607 lappend dlist $dataobj 1608 1608 } 1609 1609 1610 1610 # Handle original data points (data objects from the user) 1611 1611 foreach dataobj $dlist { 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1612 set label [$dataobj hints label] 1613 set xlabel [$dataobj hints xlabel] 1614 set ylabel [$dataobj hints ylabel] 1615 set xcol "$xlabel ($label)" 1616 set ycol "$ylabel ($label)" 1617 foreach comp [$dataobj components] { 1618 set row [expr [$table row length] + 1] 1619 if { [$table column exists $xcol] } { 1620 set row [expr [$table row length] + 1] 1621 $table row set $row $xcol NaN $ycol NaN 1622 $table row unset $row 1623 } 1624 set xv [$dataobj mesh $comp] 1625 set yv [$dataobj values $comp] 1626 $table import vector $xv $xcol $yv $ycol 1627 } 1628 1628 } 1629 1629 … … 1632 1632 set yv [blt::vector create \#auto] 1633 1633 foreach e $derived { 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1634 set label [$g element cget $e -label] 1635 set xlabel [$g axis cget [$g element cget $e -mapx] -title] 1636 set ylabel [$g axis cget [$g element cget $e -mapy] -title] 1637 set xcol "$xlabel ($label)" 1638 set ycol "$ylabel ($label)" 1639 set row [expr [$table row length] + 1] 1640 if { [$table column exists $xcol] } { 1641 set row [expr [$table row length] + 1] 1642 $table row set $row $xcol NaN $ycol NaN 1643 $table row unset $row 1644 } 1645 $xv set [$g element cget $e -x] 1646 $yv set [$g element cget $e -y] 1647 $table import vector $xv $xcol $yv $ycol 1648 1648 } 1649 1649 blt::vector destroy $xv $yv
Note: See TracChangeset
for help on using the changeset viewer.