Changeset 3236
- Timestamp:
- Jan 4, 2013, 12:07:59 PM (12 years ago)
- Location:
- branches/Rappture 1.2/gui/scripts
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/Rappture 1.2/gui/scripts/mesh.tcl
r3226 r3236 74 74 private variable _zv "" 75 75 private variable _bltmesh "" 76 private variable _xValues ""; # For the blt contour only 77 private variable _yValues ""; # For the blt contour only 76 78 77 79 private method ReadCloud { xmlobj path } -
branches/Rappture 1.2/gui/scripts/vtkheightmapviewer.tcl
r3227 r3236 88 88 private method BuildColormap { name colors } 89 89 private method BuildContourTab {} 90 private method BuildCutplaneTab {}91 90 private method BuildDownloadPopup { widget command } 92 91 private method BuildViewTab {} … … 100 99 private method EventuallyResize { w h } 101 100 private method EventuallyRotate { q } 102 private method EventuallySetCutplane { axis args }103 101 private method GetImage { args } 104 102 private method GetVtkData { args } … … 111 109 private method SetLegendTip { x y } 112 110 private method SetObjectStyle { dataobj comp } 113 private method Slice {option args}114 111 private method GetHeightmapScale {} 115 112 private method EnterIsoline { x y value } … … 157 154 private variable _contourPending 0 158 155 private variable _rotatePending 0 159 private variable _cutplanePending 0160 156 private variable _legendPending 0 161 157 private variable _outline … … 200 196 $_dispatcher register !legend 201 197 $_dispatcher dispatch $this !legend "[itcl::code $this RequestLegend]; list" 202 203 # X-Cutplane event204 $_dispatcher register !xcutplane205 $_dispatcher dispatch $this !xcutplane \206 "[itcl::code $this AdjustSetting cutplane-xposition]; list"207 208 # Y-Cutplane event209 $_dispatcher register !ycutplane210 $_dispatcher dispatch $this !ycutplane \211 "[itcl::code $this AdjustSetting cutplane-yposition]; list"212 213 # Z-Cutplane event214 $_dispatcher register !zcutplane215 $_dispatcher dispatch $this !zcutplane \216 "[itcl::code $this AdjustSetting cutplane-zposition]; list"217 198 218 199 # … … 250 231 axis-labels 1 251 232 axis-visible 1 252 axis-xcutplane 0253 233 axis-xgrid 0 254 234 axis-xposition 0 255 axis-ycutplane 0256 235 axis-ygrid 0 257 236 axis-yposition 0 258 axis-zcutplane 0259 237 axis-zgrid 0 260 238 axis-zposition 0 … … 266 244 contour-visible 1 267 245 contour-wireframe 0 268 cutplane-edges 0269 cutplane-opacity 100270 cutplane-visible 1271 cutplane-wireframe 0272 cutplane-xposition 50273 cutplane-xvisible 0274 cutplane-yposition 50275 cutplane-yvisible 0276 cutplane-zposition 50277 cutplane-zvisible 0278 246 heightmap-mode 0 279 heightmap-scale 0247 heightmap-scale 50 280 248 legend-visible 1 281 249 }] … … 353 321 Rappture::Tooltip::for $itk_component(zoomout) "Zoom out" 354 322 355 itk_component add surface {356 Rappture::PushButton $f.surface \357 -onimage [Rappture::icon volume-on] \358 -offimage [Rappture::icon volume-off] \359 -variable [itcl::scope _settings(contour-visible)] \360 -command [itcl::code $this AdjustSetting contour-visible]361 }362 $itk_component(surface) select363 Rappture::Tooltip::for $itk_component(surface) \364 "Don't display the surface"365 pack $itk_component(surface) -padx 2 -pady 2366 367 323 itk_component add mode { 368 324 Rappture::PushButton $f.mode \ … … 379 335 BuildViewTab 380 336 BuildContourTab 381 BuildCutplaneTab382 337 BuildAxisTab 383 338 BuildCameraTab … … 512 467 } 513 468 514 itcl::body Rappture::VtkHeightmapViewer::EventuallySetCutplane { axis args } {515 if { !$_cutplanePending } {516 set _cutplanePending 1517 $_dispatcher event -after 100 !${axis}cutplane518 }519 }520 521 469 # ---------------------------------------------------------------------- 522 470 # USAGE: add <dataobj> ?<settings>? … … 811 759 $_dispatcher cancel !contour 812 760 $_dispatcher cancel !rotate 813 $_dispatcher cancel !xcutplane814 $_dispatcher cancel !ycutplane815 $_dispatcher cancel !zcutplane816 761 $_dispatcher cancel !legend 817 762 # disconnected -- no more data sitting on server … … 829 774 itcl::body Rappture::VtkHeightmapViewer::sendto { bytes } { 830 775 SendBytes "$bytes\n" 831 StartWaiting832 776 } 833 777 … … 844 788 } else { 845 789 SendBytes "$string\n" 846 StartWaiting847 790 } 848 791 } … … 878 821 array set info $args 879 822 set bytes [ReceiveBytes $info(-bytes)] 880 StopWaiting881 823 if { $info(-type) == "image" } { 882 824 if 0 { … … 977 919 # 978 920 SendCmd "axis color [Color2RGB $itk_option(-plotforeground)]" 979 #SendCmd "dataset maprange 0"921 SendCmd "dataset maprange all" 980 922 set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)] 981 923 $_arcball quaternion $q 982 924 if {$_settings(heightmap-mode) } { 925 SendCmd "camera reset all" 983 926 if { $_view(ortho)} { 984 927 SendCmd "camera mode ortho" … … 1096 1039 1097 1040 if { $_reset } { 1041 SendCmd "axis tickpos outside" 1042 foreach axis { x y z } { 1043 SendCmd "axis lformat $axis %g" 1044 } 1098 1045 foreach axis { x y } { 1099 1046 set label [$_first hints ${axis}label] 1100 1047 if { $label != "" } { 1101 SendCmd "axis name $axis $label" 1048 # May be a space in the axis label. 1049 SendCmd [list axis name $axis $label] 1102 1050 } 1103 1051 set units [$_first hints ${axis}units] 1104 1052 if { $units != "" } { 1105 SendCmd "axis units $axis $units" 1053 # May be a space in the axis units. 1054 SendCmd [list axis units $axis $units] 1106 1055 } 1107 1056 } 1057 # 1058 # Reset the camera and other view parameters 1059 # 1060 SendCmd "axis color [Color2RGB $itk_option(-plotforeground)]" 1061 SendCmd "dataset maprange all" 1062 set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)] 1063 $_arcball quaternion $q 1064 if {$_settings(heightmap-mode) } { 1065 SendCmd "camera reset all" 1066 if { $_view(ortho)} { 1067 SendCmd "camera mode ortho" 1068 } else { 1069 SendCmd "camera mode persp" 1070 } 1071 } 1072 DoRotate 1073 PanCamera 1108 1074 InitSettings axis-xgrid axis-ygrid axis-zgrid axis-mode \ 1109 1075 axis-visible axis-labels 1110 1111 1076 InitSettings contour-opacity \ 1112 1077 heightmap-scale contour-lighting \ … … 1414 1379 set _settings($what) $mode 1415 1380 SendCmd "axis flymode $mode" 1416 }1417 "cutplane-edges" {1418 set bool $_settings($what)1419 foreach dataset [CurrentDatasets -visible] {1420 #SendCmd "cutplane edges $bool $dataset"1421 }1422 }1423 "cutplane-visible" {1424 set bool $_settings($what)1425 foreach dataset [CurrentDatasets -visible] {1426 #SendCmd "cutplane visible $bool $dataset"1427 }1428 }1429 "cutplane-wireframe" {1430 set bool $_settings($what)1431 foreach dataset [CurrentDatasets -visible] {1432 #SendCmd "cutplane wireframe $bool $dataset"1433 }1434 }1435 "cutplane-lighting" {1436 set bool $_settings($what)1437 foreach dataset [CurrentDatasets -visible] {1438 #SendCmd "cutplane lighting $bool $dataset"1439 }1440 }1441 "cutplane-opacity" {1442 set val $_settings($what)1443 set sval [expr { 0.01 * double($val) }]1444 foreach dataset [CurrentDatasets -visible] {1445 #SendCmd "cutplane opacity $sval $dataset"1446 }1447 }1448 "cutplane-xvisible" - "cutplane-yvisible" - "cutplane-zvisible" {1449 set axis [string range $what 9 9]1450 set bool $_settings($what)1451 if { $bool } {1452 $itk_component(${axis}CutScale) configure -state normal \1453 -troughcolor white1454 } else {1455 $itk_component(${axis}CutScale) configure -state disabled \1456 -troughcolor grey821457 }1458 #SendCmd "cutplane axis $axis $bool"1459 }1460 "cutplane-xposition" - "cutplane-yposition" - "cutplane-zposition" {1461 set axis [string range $what 9 9]1462 set pos [expr $_settings($what) * 0.01]1463 SendCmd "heightmap slice ${axis} ${pos}"1464 set _cutplanePending 01465 1381 } 1466 1382 "contour-isolines" { … … 1547 1463 return 1548 1464 } 1549 foreach dataset [CurrentDatasets -visible] {1550 #SendCmd "cutplane colormode $_colorMode ${name} $dataset"1551 }1552 1465 set _legendPending 1 1553 1466 } 1554 1467 "heightmap-mode" { 1555 1468 if {[isconnected]} { 1556 set c $itk_component(view)1557 1469 set bool $_settings(heightmap-mode) 1470 # Fix heightmap scale: 0 for contours, 1 for heightmaps. 1558 1471 if { $bool } { 1559 1472 set _settings(heightmap-scale) 50 1473 } else { 1474 set _settings(heightmap-scale) 50 1475 } 1476 set scale [GetHeightmapScale] 1477 foreach dataset [CurrentDatasets -all] { 1478 SendCmd "heightmap heightscale $scale $dataset" 1479 set _comp2scale($dataset) $scale 1480 } 1481 # Fix the mouse bindings for rotation/panning and the 1482 # camera mode. Ideally we'd create a bindtag for these. 1483 set c $itk_component(view) 1484 if { $bool } { 1560 1485 # Bindings for rotation via mouse 1561 1486 bind $c <ButtonPress-1> \ … … 1580 1505 SendCmd "camera mode image" 1581 1506 } 1582 set scale [GetHeightmapScale]1583 foreach dataset [CurrentDatasets -all] {1584 SendCmd "heightmap heightscale $scale $dataset"1585 set _comp2scale($dataset) $scale1586 }1587 1507 } 1588 1508 } … … 1981 1901 -font "Arial 9" 1982 1902 1983 checkbutton $inner.cutplane \1984 -text "Cutplanes" \1985 -variable [itcl::scope _settings(cutplane-visible)] \1986 -command [itcl::code $this AdjustSetting cutplane-visible] \1987 -font "Arial 9"1988 1989 1903 label $inner.background_l -text "Background" -font "Arial 9" 1990 1904 itk_component add background { … … 2009 1923 1,0 $inner.legend -anchor w -pady 2 -cspan 2 \ 2010 1924 2,0 $inner.axes -anchor w -pady 2 -cspan 2 \ 2011 3,0 $inner.cutplane -anchor w -pady 2 -cspan 2 \2012 1925 5,0 $inner.contour -anchor w -pady 2 -cspan 2 \ 2013 1926 6,0 $inner.heightmap -anchor w -pady 2 -cspan 2 \ … … 2240 2153 blt::table configure $inner r$row -resize expand 2241 2154 } 2242 2243 itcl::body Rappture::VtkHeightmapViewer::BuildCutplaneTab {} {2244 2245 set fg [option get $itk_component(hull) font Font]2246 2247 set inner [$itk_component(main) insert end \2248 -title "Cutplane Settings" \2249 -icon [Rappture::icon cutbutton]]2250 2251 $inner configure -borderwidth 42252 2253 checkbutton $inner.visible \2254 -text "Show Cutplanes" \2255 -variable [itcl::scope _settings(cutplane-visible)] \2256 -command [itcl::code $this AdjustSetting cutplane-visible] \2257 -font "Arial 9"2258 2259 checkbutton $inner.wireframe \2260 -text "Show Wireframe" \2261 -variable [itcl::scope _settings(cutplane-wireframe)] \2262 -command [itcl::code $this AdjustSetting cutplane-wireframe] \2263 -font "Arial 9"2264 2265 checkbutton $inner.lighting \2266 -text "Enable Lighting" \2267 -variable [itcl::scope _settings(cutplane-lighting)] \2268 -command [itcl::code $this AdjustSetting cutplane-lighting] \2269 -font "Arial 9"2270 2271 checkbutton $inner.edges \2272 -text "Show Edges" \2273 -variable [itcl::scope _settings(cutplane-edges)] \2274 -command [itcl::code $this AdjustSetting cutplane-edges] \2275 -font "Arial 9"2276 2277 label $inner.opacity_l -text "Opacity" -font "Arial 9"2278 ::scale $inner.opacity -from 0 -to 100 -orient horizontal \2279 -variable [itcl::scope _settings(cutplane-opacity)] \2280 -width 10 \2281 -showvalue off \2282 -command [itcl::code $this AdjustSetting cutplane-opacity]2283 $inner.opacity set $_settings(cutplane-opacity)2284 2285 # X-value slicer...2286 itk_component add xCutButton {2287 Rappture::PushButton $inner.xbutton \2288 -onimage [Rappture::icon x-cutplane] \2289 -offimage [Rappture::icon x-cutplane] \2290 -command [itcl::code $this AdjustSetting cutplane-xvisible] \2291 -variable [itcl::scope _settings(cutplane-xvisible)]2292 }2293 Rappture::Tooltip::for $itk_component(xCutButton) \2294 "Toggle the X-axis cutplane on/off"2295 2296 itk_component add xCutScale {2297 ::scale $inner.xval -from 100 -to 1 \2298 -width 10 -orient vertical -showvalue yes \2299 -borderwidth 1 -highlightthickness 0 \2300 -command [itcl::code $this EventuallySetCutplane x] \2301 -variable [itcl::scope _settings(cutplane-xposition)]2302 } {2303 usual2304 ignore -borderwidth -highlightthickness2305 }2306 # Set the default cutplane value before disabling the scale.2307 $itk_component(xCutScale) set 502308 $itk_component(xCutScale) configure -state disabled2309 Rappture::Tooltip::for $itk_component(xCutScale) \2310 "@[itcl::code $this Slice tooltip x]"2311 2312 # Y-value slicer...2313 itk_component add yCutButton {2314 Rappture::PushButton $inner.ybutton \2315 -onimage [Rappture::icon y-cutplane] \2316 -offimage [Rappture::icon y-cutplane] \2317 -command [itcl::code $this AdjustSetting cutplane-yvisible] \2318 -variable [itcl::scope _settings(cutplane-yvisible)]2319 }2320 Rappture::Tooltip::for $itk_component(yCutButton) \2321 "Toggle the Y-axis cutplane on/off"2322 2323 itk_component add yCutScale {2324 ::scale $inner.yval -from 100 -to 1 \2325 -width 10 -orient vertical -showvalue yes \2326 -borderwidth 1 -highlightthickness 0 \2327 -command [itcl::code $this EventuallySetCutplane y] \2328 -variable [itcl::scope _settings(cutplane-yposition)]2329 } {2330 usual2331 ignore -borderwidth -highlightthickness2332 }2333 Rappture::Tooltip::for $itk_component(yCutScale) \2334 "@[itcl::code $this Slice tooltip y]"2335 # Set the default cutplane value before disabling the scale.2336 $itk_component(yCutScale) set 502337 $itk_component(yCutScale) configure -state disabled2338 2339 # Z-value slicer...2340 itk_component add zCutButton {2341 Rappture::PushButton $inner.zbutton \2342 -onimage [Rappture::icon z-cutplane] \2343 -offimage [Rappture::icon z-cutplane] \2344 -command [itcl::code $this AdjustSetting cutplane-zvisible] \2345 -variable [itcl::scope _settings(cutplane-zvisible)]2346 }2347 Rappture::Tooltip::for $itk_component(zCutButton) \2348 "Toggle the Z-axis cutplane on/off"2349 2350 itk_component add zCutScale {2351 ::scale $inner.zval -from 100 -to 1 \2352 -width 10 -orient vertical -showvalue yes \2353 -borderwidth 1 -highlightthickness 0 \2354 -command [itcl::code $this EventuallySetCutplane z] \2355 -variable [itcl::scope _settings(cutplane-zposition)]2356 } {2357 usual2358 ignore -borderwidth -highlightthickness2359 }2360 $itk_component(zCutScale) set 502361 $itk_component(zCutScale) configure -state disabled2362 #$itk_component(zCutScale) configure -state disabled2363 Rappture::Tooltip::for $itk_component(zCutScale) \2364 "@[itcl::code $this Slice tooltip z]"2365 2366 blt::table $inner \2367 0,0 $inner.visible -anchor w -pady 2 -cspan 4 \2368 1,0 $inner.lighting -anchor w -pady 2 -cspan 4 \2369 2,0 $inner.wireframe -anchor w -pady 2 -cspan 4 \2370 3,0 $inner.edges -anchor w -pady 2 -cspan 4 \2371 4,0 $inner.opacity_l -anchor w -pady 2 -cspan 3 \2372 5,0 $inner.opacity -fill x -pady 2 -cspan 3 \2373 6,0 $itk_component(xCutButton) -anchor e -padx 2 -pady 2 \2374 7,0 $itk_component(xCutScale) -fill y \2375 6,1 $itk_component(yCutButton) -anchor e -padx 2 -pady 2 \2376 7,1 $itk_component(yCutScale) -fill y \2377 6,2 $itk_component(zCutButton) -anchor e -padx 2 -pady 2 \2378 7,2 $itk_component(zCutScale) -fill y \2379 2380 blt::table configure $inner r* c* -resize none2381 blt::table configure $inner r7 c3 -resize expand2382 }2383 2384 2385 2155 2386 2156 # … … 2515 2285 $itk_component(isolinecolor) value $settings(-isolinecolor) 2516 2286 set _numContours $settings(-levels) 2517 puts stderr "SetObjectStyle _numContours=$_numContours"2518 2287 set scale [GetHeightmapScale] 2519 2288 SendCmd "heightmap add numcontours $settings(-levels) $scale $tag" … … 2779 2548 } 2780 2549 2781 2782 # ----------------------------------------------------------------------2783 # USAGE: Slice move x|y|z <newval>2784 #2785 # Called automatically when the user drags the slider to move the2786 # cut plane that slices 3D data. Gets the current value from the2787 # slider and moves the cut plane to the appropriate point in the2788 # data set.2789 # ----------------------------------------------------------------------2790 itcl::body Rappture::VtkHeightmapViewer::Slice {option args} {2791 switch -- $option {2792 "move" {2793 set axis [lindex $args 0]2794 set oldval $_settings(axis-${axis}position)2795 set newval [lindex $args 1]2796 if {[llength $args] != 2} {2797 error "wrong # args: should be \"Slice move x|y|z newval\""2798 }2799 set newpos [expr {0.01*$newval}]2800 SendCmd "heightmap slice $axis $newpos"2801 }2802 "tooltip" {2803 set axis [lindex $args 0]2804 set val [$itk_component(${axis}CutScale) get]2805 return "Move the [string toupper $axis] cut plane.\nCurrently: $axis = $val%"2806 }2807 default {2808 error "bad option \"$option\": should be axis, move, or tooltip"2809 }2810 }2811 }2812 2813 2814 2550 # ---------------------------------------------------------------------- 2815 2551 # USAGE: _dropdown post -
branches/Rappture 1.2/gui/scripts/xyresult.tcl
r3186 r3236 433 433 catch {unset _limits} 434 434 foreach dataobj $args { 435 # find the axes for this dataobj (e.g., {x y2})435 # Find the axes for this dataobj (e.g., {x y2}) 436 436 foreach {map(x) map(y)} [GetAxes $dataobj] break 437 437 foreach axis {x y} { 438 # get defaults for both linear and log scales438 # Get defaults for both linear and log scales 439 439 foreach type {lin log} { 440 440 # store results -- ex: _limits(x2log-min)
Note: See TracChangeset
for help on using the changeset viewer.