- Timestamp:
- Mar 19, 2013, 10:00:11 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gui/scripts/vtkisosurfaceviewer.tcl
r3536 r3538 106 106 private method SetCurrentColormap { color } 107 107 private method SetOrientation { side } 108 private method UpdateContourList {} 108 109 109 110 private variable _arcball "" … … 119 120 # heightmaps displayed. 120 121 private variable _currentColormap "" ; 121 private variable _currentNumContours "";122 private variable _currentNumContours -1; 122 123 private variable _currentOpacity "" ; 123 124 … … 138 139 private variable _title "" 139 140 private variable _isolines 141 private variable _contourList "" 140 142 141 143 common _downloadPopup; # download options from popup … … 1047 1049 cutplaneXPosition cutplaneYPosition cutplaneZPosition \ 1048 1050 cutplaneXVisible cutplaneYVisible cutplaneZVisible \ 1049 cutplanePreinterp 1051 cutplanePreinterp numContours 1050 1052 1051 1053 Zoom reset … … 1410 1412 } 1411 1413 "numContours" { 1412 set _changed(numContours) 11413 1414 set _settings(numContours) [$itk_component(numcontours) value] 1414 1415 set _currentNumContours $_settings(numContours) 1415 SendCmd "contour3d numcontours $_settings(numContours)" 1416 UpdateContourList 1417 set _changed(numContours) 1 1418 SendCmd "contour3d contourlist [list $_contourList]" 1416 1419 DrawLegend 1417 1420 } … … 1475 1478 SendCmd "cutplane colormode $_colorMode $_curFldName" 1476 1479 SendCmd "camera reset" 1480 UpdateContourList 1477 1481 DrawLegend 1478 1482 } … … 1702 1706 itk_component add numcontours { 1703 1707 Rappture::Spinint $inner.numcontours \ 1704 -min 2-max 50 -font "arial 9"1708 -min 1 -max 50 -font "arial 9" 1705 1709 } 1706 1710 $itk_component(numcontours) value $_settings(numContours) … … 2168 2172 set _settings(numContours) $_currentNumContours 2169 2173 $itk_component(numcontours) value $_currentNumContours 2174 UpdateContourList 2170 2175 DrawLegend 2171 2176 } 2172 SendCmd "contour3d add numcontours $_currentNumContours $tag"2177 SendCmd [list contour3d add contourlist $_contourList $tag] 2173 2178 SendCmd "contour3d edges $style(-edges) $tag" 2174 2179 SendCmd "dataset outline $style(-outline) $tag" … … 2411 2416 if { $color != "none" && [info exists _limits($_curFldName)] && 2412 2417 $_settings(numContours) > 0 } { 2413 set pixels [blt::vector create \#auto] 2414 set values [blt::vector create \#auto] 2415 set range [image height $_image(legend)] 2416 # Order of pixels is max to min (max is at top of legend). 2417 $pixels seq $ih 0 $_settings(numContours) 2418 2419 foreach { vmin vmax } $_limits($_curFldName) break 2420 set range [expr double($vmax - $vmin)] 2421 if { $range <= 0.0 } { 2422 set range 1.0; # Min is greater or equal to max. 2423 } 2424 set tags "isoline legend" 2418 2425 set offset [expr 2 + $lineht] 2419 # If there's a legend title, increase the offset by the line height.2420 2426 if { $title != "" } { 2421 2427 incr offset $lineht 2422 2428 } 2423 # Order of values is min to max. 2424 $pixels expr {round($pixels + $offset)} 2425 foreach { vmin vmax } $_limits($_curFldName) break 2426 $values seq $vmin $vmax $_settings(numContours) 2427 set tags "isoline legend" 2428 foreach pos [$pixels range 0 end] value [$values range end 0] { 2429 set y1 [expr int($pos)] 2429 foreach value $_contourList { 2430 set norm [expr ($value - $vmin) / $range] 2431 set y1 [expr int(round(($norm * $ih) + $offset))] 2430 2432 for { set off 0 } { $off < 3 } { incr off } { 2431 2433 set _isolines([expr $y1 + $off]) $value 2432 2434 set _isolines([expr $y1 - $off]) $value 2433 2435 } 2434 set id [$c create line $x1 $y1 $x2 $y1 -fill $color -tags $tags] 2435 } 2436 blt::vector destroy $pixels $values 2436 $c create line $x1 $y1 $x2 $y1 -fill $color -tags $tags 2437 } 2437 2438 } 2438 2439 … … 2547 2548 set _view(zoom) 1.0 2548 2549 } 2550 2551 itcl::body Rappture::VtkIsosurfaceViewer::UpdateContourList {} { 2552 if { ![info exists _limits($_curFldName)] } { 2553 return 2554 } 2555 foreach { vmin vmax } $_limits($_curFldName) break 2556 set v [blt::vector create \#auto] 2557 $v seq $vmin $vmax [expr $_currentNumContours+2] 2558 $v delete end 0 2559 set _contourList [$v range 0 end] 2560 blt::vector destroy $v 2561 }
Note: See TracChangeset
for help on using the changeset viewer.