Changeset 5120
- Timestamp:
- Mar 11, 2015, 3:13:19 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gui/scripts/mapviewer.tcl
r5106 r5120 94 94 private method DoRotate {} 95 95 private method DoSelect {} 96 private method DrawLegend { colormap min max } 96 97 private method EarthFile {} 97 98 private method EnablePanningMouseBindings {} … … 115 116 private method ReceiveMapInfo { args } 116 117 private method ReceiveScreenInfo { args } 118 private method RequestLegend { colormap w h } 117 119 private method Rotate {option x y} 118 120 private method Select {option x y} … … 614 616 } 615 617 618 itcl::body Rappture::MapViewer::DrawLegend { colormap min max } { 619 if { [info exists itk_component(legend-$colormap) ] } { 620 $itk_component(legend-$colormap-min) configure -text $min 621 $itk_component(legend-$colormap-max) configure -text $max 622 $itk_component(legend-$colormap) configure -image $_image(legend-$colormap) 623 } 624 } 625 626 itcl::body Rappture::MapViewer::RequestLegend { colormap w h } { 627 SendCmd "legend $colormap $w $h 0 [Color2RGB #d9d9d9]" 628 } 629 616 630 # ---------------------------------------------------------------------- 617 631 # USAGE: add <dataobj> ?<settings>? … … 1031 1045 set bytes [ReceiveBytes $size] 1032 1046 if { ![info exists _image(legend)] } { 1033 set _image(legend) [image create photo] 1034 } 1035 $_image(legend) configure -data $bytes 1036 puts stderr "read $size bytes for [image width $_image(legend)]x[image height $_image(legend)] legend>" 1037 #if { [catch {DrawLegend} errs] != 0 } { 1038 # global errorInfo 1039 # puts stderr "errs=$errs errorInfo=$errorInfo" 1040 #} 1047 set _image(legend-$colormap) [image create photo] 1048 } 1049 if 0 { 1050 set f [open "/tmp/legend-${colormap}.ppm" "w"] 1051 fconfigure $f -translation binary -encoding binary 1052 puts $f $bytes 1053 close $f 1054 } 1055 $_image(legend-$colormap) configure -data $bytes 1056 puts stderr "read $size bytes for [image width $_image(legend-$colormap)]x[image height $_image(legend-$colormap)] legend>" 1057 if { [catch {DrawLegend $colormap $min $max} errs] != 0 } { 1058 global errorInfo 1059 puts stderr "errs=$errs errorInfo=$errorInfo" 1060 } 1041 1061 } 1042 1062 } … … 2478 2498 if { $info(type) == "image" } { 2479 2499 incr imgIdx 2500 if { $info(driver) == "colorramp" } { 2501 set colormap $layer 2502 if { ![info exists _image(legend-$colormap)] } { 2503 set _image(legend-$colormap) [image create photo] 2504 } 2505 itk_component add legend-$colormap-min { 2506 label $f.${layer}_legend-$colormap-min -text 0 2507 } 2508 itk_component add legend-$colormap-max { 2509 label $f.${layer}_legend-$colormap-max -text 1 2510 } 2511 itk_component add legend-$colormap { 2512 label $f.${layer}_legend-$colormap -image $_image(legend-$colormap) 2513 } 2514 blt::table $f $row,0 $f.${layer}_legend-$colormap-min -anchor w -pady 0 2515 blt::table $f $row,1 $f.${layer}_legend-$colormap-max -anchor e -pady 0 2516 incr row 2517 blt::table $f $row,0 $f.${layer}_legend-$colormap -anchor w -pady 2 -cspan 2 2518 incr row 2519 RequestLegend $colormap 256 16 2520 } 2480 2521 } 2481 2522 if { $info(type) != "elevation" && ($info(type) != "image" || $imgIdx > 1) } {
Note: See TracChangeset
for help on using the changeset viewer.