- Timestamp:
- Jun 2, 2016, 8:19:06 AM (8 years ago)
- Location:
- branches/multichoice
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/multichoice
- Property svn:mergeinfo changed
-
branches/multichoice/gui/scripts/vtkstreamlinesviewer.tcl
r6236 r6371 72 72 private method BuildSurfaceTab {} 73 73 private method DrawLegend {} 74 private method Combo { option }75 74 private method Connect {} 76 75 private method CurrentDatasets {args} … … 91 90 private method IsValidObject { dataobj } 92 91 private method LeaveLegend {} 92 private method LegendTitleAction { option } 93 93 private method MotionLegend { x y } 94 94 private method Pan {option x y} … … 101 101 private method ReceiveDataset { args } 102 102 private method ReceiveImage { args } 103 private method ReceiveLegend { colormap title vmin vmax size }103 private method ReceiveLegend { colormap title min max size } 104 104 private method RequestLegend {} 105 105 private method Rotate {option x y} 106 106 private method SetCurrentColormap { color } 107 private method SetCurrentFieldName { dataobj } 107 108 private method SetLegendTip { x y } 108 109 private method SetObjectStyle { dataobj comp } … … 145 146 private variable _curFldName "" 146 147 private variable _curFldLabel "" 147 private variable _ field ""148 private variable _colorMode "vmag"; # Mode of colormap (vmag or scalar) 148 149 private variable _streamlinesLength 0 149 150 private variable _numSeeds 200 150 private variable _colorMode "vmag"; # Mode of colormap (vmag or scalar)151 151 152 152 private common _downloadPopup; # download options from popup … … 301 301 } 302 302 pack $itk_component(reset) -side top -padx 2 -pady 2 303 Rappture::Tooltip::for $itk_component(reset) "Reset the view to the default zoom level" 303 Rappture::Tooltip::for $itk_component(reset) \ 304 "Reset the view to the default zoom level" 304 305 305 306 itk_component add zoomin { … … 552 553 } 553 554 array set params $settings 554 set params(-description) ""555 set params(-param) ""556 array set params $settings557 555 558 556 if {$params(-color) == "auto" || $params(-color) == "autoreset"} { … … 592 590 set _dlist [lreplace $_dlist $pos $pos] 593 591 array unset _obj2ovride $dataobj-* 594 array unset _settings $dataobj-*595 592 set changed 1 596 593 } … … 653 650 return $dlist 654 651 } 655 -image{652 "-image" { 656 653 if {[llength $args] != 2} { 657 654 error "wrong # args: should be \"get -image view\"" … … 667 664 } 668 665 default { 669 error "bad option \"$op\": should be -objects or -image"666 error "bad option \"$op\": should be -objects, -visible or -image" 670 667 } 671 668 } … … 982 979 if { [info exists _obj2ovride($dataobj-raise)] && $_first == "" } { 983 980 set _first $dataobj 981 SetCurrentFieldName $dataobj 984 982 } 985 983 foreach comp [$dataobj components] { … … 1027 1025 } 1028 1026 } 1029 $itk_component(field) choices delete 0 end1030 $itk_component(fieldmenu) delete 0 end1031 array unset _fields1032 set _curFldName ""1033 set _curFldLabel ""1034 foreach cname [$_first components] {1035 foreach fname [$_first fieldnames $cname] {1036 if { [info exists _fields($fname)] } {1037 continue1038 }1039 foreach { label units components } \1040 [$_first fieldinfo $fname] break1041 $itk_component(field) choices insert end "$fname" "$label"1042 $itk_component(fieldmenu) add radiobutton -label "$label" \1043 -value $label -variable [itcl::scope _curFldLabel] \1044 -selectcolor red \1045 -activebackground $itk_option(-plotbackground) \1046 -activeforeground $itk_option(-plotforeground) \1047 -font "Arial 8" \1048 -command [itcl::code $this Combo invoke]1049 set _fields($fname) [list $label $units $components]1050 if { $_curFldName == "" && $components == 3 } {1051 set _curFldName $fname1052 set _curFldLabel $label1053 }1054 }1055 }1056 $itk_component(field) value $_curFldLabel1057 1027 } 1058 1028 … … 1299 1269 itcl::body Rappture::VtkStreamlinesViewer::InitSettings { args } { 1300 1270 foreach spec $args { 1301 if { [info exists _settings($_first${spec})] } {1302 # Reset global setting with dataobj specific setting1303 set _settings($spec) $_settings($_first${spec})1304 }1305 1271 AdjustSetting $spec 1306 1272 } … … 2068 2034 radiobutton $inner.vtk_button -text "VTK data file" \ 2069 2035 -variable [itcl::scope _downloadPopup(format)] \ 2070 -font " Helvetica 9" \2036 -font "Arial 9" \ 2071 2037 -value vtk 2072 2038 Rappture::Tooltip::for $inner.vtk_button "Save as VTK data file." … … 2185 2151 2186 2152 # ---------------------------------------------------------------------- 2187 # USAGE: ReceiveLegend <colormap> <title> < vmin> <vmax> <size>2153 # USAGE: ReceiveLegend <colormap> <title> <min> <max> <size> 2188 2154 # 2189 2155 # Invoked automatically whenever the "legend" command comes in from … … 2191 2157 # specified <size> will follow. 2192 2158 # ---------------------------------------------------------------------- 2193 itcl::body Rappture::VtkStreamlinesViewer::ReceiveLegend { colormap title vmin vmax size } {2159 itcl::body Rappture::VtkStreamlinesViewer::ReceiveLegend { colormap title min max size } { 2194 2160 set _legendPending 0 2195 2161 set _title $title … … 2255 2221 $c bind colormap <Motion> [itcl::code $this MotionLegend %x %y] 2256 2222 } 2257 $c bind title <ButtonPress> [itcl::code $this Combopost]2258 $c bind title <Enter> [itcl::code $this Combo activate]2259 $c bind title <Leave> [itcl::code $this Combo deactivate]2223 $c bind title <ButtonPress> [itcl::code $this LegendTitleAction post] 2224 $c bind title <Enter> [itcl::code $this LegendTitleAction enter] 2225 $c bind title <Leave> [itcl::code $this LegendTitleAction leave] 2260 2226 # Reset the item coordinates according the current size of the plot. 2261 2227 $c itemconfigure title -text $title … … 2380 2346 2381 2347 # ---------------------------------------------------------------------- 2382 # USAGE: _dropdown post 2383 # USAGE: _dropdown unpost 2384 # USAGE: _dropdown select 2385 # 2386 # Used internally to handle the dropdown list for this combobox. The 2387 # post/unpost options are invoked when the list is posted or unposted 2388 # to manage the relief of the controlling button. The select option 2389 # is invoked whenever there is a selection from the list, to assign 2390 # the value back to the gauge. 2391 # ---------------------------------------------------------------------- 2392 itcl::body Rappture::VtkStreamlinesViewer::Combo {option} { 2348 # USAGE: LegendTitleAction post 2349 # USAGE: LegendTitleAction enter 2350 # USAGE: LegendTitleAction leave 2351 # USAGE: LegendTitleAction save 2352 # 2353 # Used internally to handle the dropdown list for the fields menu combobox. 2354 # The post option is invoked when the field title is pressed to launch the 2355 # dropdown. The enter option is invoked when the user mouses over the field 2356 # title. The leave option is invoked when the user moves the mouse away 2357 # from the field title. The save option is invoked whenever there is a 2358 # selection from the list, to alert the visualization server. 2359 # ---------------------------------------------------------------------- 2360 itcl::body Rappture::VtkStreamlinesViewer::LegendTitleAction {option} { 2393 2361 set c $itk_component(view) 2394 2362 switch -- $option { … … 2400 2368 tk_popup $itk_component(fieldmenu) $x $y 2401 2369 } 2402 activate{2370 enter { 2403 2371 $c itemconfigure title -fill red 2404 2372 } 2405 deactivate {2373 leave { 2406 2374 $c itemconfigure title -fill white 2407 2375 } 2408 invoke {2376 save { 2409 2377 $itk_component(field) value $_curFldLabel 2410 2378 AdjustSetting -field 2411 2379 } 2412 2380 default { 2413 error "bad option \"$option\": should be post, unpost, select"2381 error "bad option \"$option\": should be post, enter, leave or save" 2414 2382 } 2415 2383 } … … 2436 2404 set _view(-zoom) 1.0 2437 2405 } 2406 2407 itcl::body Rappture::VtkStreamlinesViewer::SetCurrentFieldName { dataobj } { 2408 set _first $dataobj 2409 $itk_component(field) choices delete 0 end 2410 $itk_component(fieldmenu) delete 0 end 2411 array unset _fields 2412 set _curFldName "" 2413 set _curFldLabel "" 2414 foreach cname [$_first components] { 2415 foreach fname [$_first fieldnames $cname] { 2416 if { [info exists _fields($fname)] } { 2417 continue 2418 } 2419 foreach { label units components } \ 2420 [$_first fieldinfo $fname] break 2421 $itk_component(field) choices insert end "$fname" "$label" 2422 $itk_component(fieldmenu) add radiobutton -label "$label" \ 2423 -value $label -variable [itcl::scope _curFldLabel] \ 2424 -selectcolor red \ 2425 -activebackground $itk_option(-plotbackground) \ 2426 -activeforeground $itk_option(-plotforeground) \ 2427 -font "Arial 8" \ 2428 -command [itcl::code $this LegendTitleAction save] 2429 set _fields($fname) [list $label $units $components] 2430 if { $_curFldName == "" && $components == 3 } { 2431 set _curFldName $fname 2432 set _curFldLabel $label 2433 } 2434 } 2435 } 2436 $itk_component(field) value $_curFldLabel 2437 }
Note: See TracChangeset
for help on using the changeset viewer.