Changeset 3439 for trunk/gui/scripts
- Timestamp:
- Mar 4, 2013, 6:37:47 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gui/scripts/vtkheightmapviewer.tcl
r3435 r3439 139 139 private variable _start 0 140 140 private variable _title "" 141 private variable _isolines 141 142 142 143 common _downloadPopup; # download options from popup … … 2248 2249 -anchor ne \ 2249 2250 -image $_image(legend) -tags "colormap legend" 2251 $c create rectangle $x $y 1 1 \ 2252 -fill "" -outline "" -tags "sensor legend" 2250 2253 $c create text $x [expr {$h-2}] \ 2251 2254 -anchor se \ 2252 2255 -fill $itk_option(-plotforeground) -tags "vmin legend" \ 2253 2256 -font $font 2254 #$c bind colormap <Enter> [itcl::code $this EnterLegend %x %y]2255 $c bind colormap<Leave> [itcl::code $this LeaveLegend]2256 $c bind colormap <Motion> [itcl::code $this MotionLegend %x %y]2257 $c bind sensor <B1-Enter> [itcl::code $this EnterLegend %x %y] 2258 $c bind sensor <Leave> [itcl::code $this LeaveLegend] 2259 $c bind sensor <B1-Motion> [itcl::code $this MotionLegend %x %y] 2257 2260 } 2258 2261 $c delete isoline … … 2282 2285 $values seq $vmin $vmax $_settings(numIsolines) 2283 2286 set tags "isoline legend" 2287 array unset _isolines 2284 2288 foreach pos [$pixels range 0 end] value [$values range end 0] { 2285 2289 set y1 [expr int($pos)] 2290 for { set off 0 } { $off < 3 } { incr off } { 2291 set _isolines([expr $y1 + $off]) $value 2292 set _isolines([expr $y1 - $off]) $value 2293 } 2286 2294 set id [$c create line $x1 $y1 $x2 $y1 -fill $color -tags $tags] 2287 $c bind $id <Enter> [itcl::code $this EnterIsoline %x %y $value]2288 $c bind $id <Leave> [itcl::code $this LeaveIsoline]2295 #$c bind $id <B1-Enter> [itcl::code $this EnterIsoline %x %y $value] 2296 #$c bind $id <Leave> [itcl::code $this LeaveIsoline] 2289 2297 } 2290 2298 blt::vector destroy $pixels $values … … 2310 2318 incr y $lineht 2311 2319 $c coords colormap $x $y 2320 set ix [image width $_image(legend)] 2321 set ih [image height $_image(legend)] 2322 $c coords sensor [expr $x - $iw] $y $x [expr $y + $ih] 2323 $c raise sensor 2312 2324 $c coords vmin $x [expr {$h - 2}] 2313 2325 } … … 2356 2368 Rappture::Tooltip::tooltip cancel 2357 2369 set c $itk_component(view) 2358 SetLegendTip $x $y 2370 set cw [winfo width $c] 2371 set ch [winfo height $c] 2372 if { $x >= 0 && $x < $cw && $y >= 0 && $y < $ch } { 2373 SetLegendTip $x $y 2374 } 2359 2375 } 2360 2376 … … 2390 2406 # If there's a legend title, increase the offset by the line height. 2391 2407 if { $title != "" } { 2392 incr iy $lineht2408 incr iy -$lineht 2393 2409 } 2394 2410 … … 2404 2420 $_image(swatch) put black -to 0 0 23 23 2405 2421 $_image(swatch) put $color -to 1 1 22 22 2406 .rappturetooltip configure -icon $_image(swatch)2407 2422 2408 2423 # Compute the value of the point … … 2416 2431 set tipx [expr $x + 15] 2417 2432 set tipy [expr $y - 5] 2418 Rappture::Tooltip::text $c "$title $value" 2433 .rappturetooltip configure -icon $_image(swatch) 2434 if { [info exists _isolines($iy)] } { 2435 Rappture::Tooltip::text $c [format "$title (isoline) %g" $_isolines($iy)] 2436 } else { 2437 Rappture::Tooltip::text $c [format "$title %g" $value] 2438 } 2419 2439 Rappture::Tooltip::tooltip show $c +$tipx,+$tipy 2420 2440 }
Note: See TracChangeset
for help on using the changeset viewer.