From 617eb28f415b4ba0df09acd61e4c32c48ef02445 Mon Sep 17 00:00:00 2001 From: William Joye Date: Fri, 3 May 2019 13:50:57 -0400 Subject: display 3d coordinates in infobox --- ds9/library/colorbar.tcl | 4 +- ds9/library/info.tcl | 127 +++++++++++++++++++++++++++++++---------------- ds9/library/wcs.tcl | 6 +++ 3 files changed, 93 insertions(+), 44 deletions(-) diff --git a/ds9/library/colorbar.tcl b/ds9/library/colorbar.tcl index ed9ec83..f774e63 100644 --- a/ds9/library/colorbar.tcl +++ b/ds9/library/colorbar.tcl @@ -218,8 +218,8 @@ proc ColorbarEnter {x y} { $ds9(canvas) focus $current(colorbar) switch -- $current(colorbar) { - colorbar {LayoutFrameInfoBox base} - colorbarrgb {LayoutFrameInfoBox rgb} + colorbar {LayoutFrameInfoBox $current(frame) base} + colorbarrgb {LayoutFrameInfoBox $current(frame) rgb} } } diff --git a/ds9/library/info.tcl b/ds9/library/info.tcl index c5785ea..931d8d3 100644 --- a/ds9/library/info.tcl +++ b/ds9/library/info.tcl @@ -115,9 +115,6 @@ proc CreateInfoPanel {} { ttk::label $ds9(info).physicalYLabel -text {y} ttk::label $ds9(info).physicalYValue -relief groove \ -textvariable infobox(physical,y) -anchor center - ttk::label $ds9(info).physicalZLabel -text {z} - ttk::label $ds9(info).physicalZValue -relief groove \ - -textvariable infobox(physical,z) -anchor center ttk::label $ds9(info).imageTitle -text [msgcat::mc {Image}] ttk::label $ds9(info).imageXLabel -text {x} @@ -142,16 +139,16 @@ proc CreateInfoPanel {} { -textvariable infobox(angle) -anchor center } -proc LayoutFrameInfoBox {which} { +proc LayoutFrameInfoBox {which type} { global ds9 global view global debug if {$debug(tcl,events)} { - puts stderr "LayoutFrameInfoBox" + puts stderr "LayoutFrameInfoBox $which $type" } - switch -- $which { + switch -- $type { base { grid forget $ds9(info).valueRTitle $ds9(info).valueR \ $ds9(info).valueGTitle $ds9(info).valueG \ @@ -162,20 +159,87 @@ proc LayoutFrameInfoBox {which} { grid $ds9(info).value \ -row $ds9(info,row,value) \ -column 1 -padx 2 -sticky w + + foreach ll {{} a b c d e f g h i j k l m n o p q r s t u v w x y z} { + if {$which != {} && $view(info,wcs$ll)} { + if {[$which has wcs 3d wcs$ll]} { + grid $ds9(info).wcsZLabel$ll \ + -row $ds9(info,row,wcs$ll) \ + -column 0 -sticky w + grid $ds9(info).wcsZValue$ll \ + -row $ds9(info,row,wcs$ll) \ + -column 1 -padx 2 + incr row + } else { + grid forget $ds9(info).wcsZLabel$ll + grid forget $ds9(info).wcsZValue$ll + } + } else { + grid forget $ds9(info).wcsZLabel$ll + grid forget $ds9(info).wcsZValue$ll + } + } + + if {$which != {} && $view(info,image)} { + if {[$which has fits cube]} { + grid $ds9(info).imageZLabel \ + -row $ds9(info,row,image) \ + -column 0 -sticky w + grid $ds9(info).imageZValue \ + -row $ds9(info,row,image) \ + -column 1 -padx 2 + } else { + grid forget $ds9(info).imageZLabel \ + $ds9(info).imageZValue + } + } else { + grid forget $ds9(info).imageZLabel \ + $ds9(info).imageZValue + } } horizontal { grid $ds9(info).value \ -row $ds9(info,row,value) \ -column 2 -padx 2 -sticky w - } - } - foreach ll {{} a b c d e f g h i j k l m n o p q r s t u v w x y z} { - grid forget $ds9(info).wcsZLabel$ll - grid forget $ds9(info).wcsZValue$ll + foreach ll {{} a b c d e f g h i j k l m n o p q r s t u v w x y z} { + if {$which != {} && $view(info,wcs$ll)} { + if {[$which has wcs 3d wcs$ll]} { + grid $ds9(info).wcsZLabel$ll \ + -row $ds9(info,row,wcs$ll) \ + -column 5 -sticky w + grid $ds9(info).wcsZValue$ll \ + -row $ds9(info,row,wcs$ll) \ + -column 6 -padx 2 + incr row + } else { + grid forget $ds9(info).wcsZLabel$ll + grid forget $ds9(info).wcsZValue$ll + } + } else { + grid forget $ds9(info).wcsZLabel$ll + grid forget $ds9(info).wcsZValue$ll + } + } + + if {$which != {} && $view(info,image)} { + if {[$which has fits cube]} { + grid $ds9(info).imageZLabel \ + -row $ds9(info,row,image) \ + -column 5 -sticky w + grid $ds9(info).imageZValue \ + -row $ds9(info,row,image) \ + -column 6 -padx 2 + } else { + grid forget $ds9(info).imageZLabel \ + $ds9(info).imageZValue + } + } else { + grid forget $ds9(info).imageZLabel \ + $ds9(info).imageZValue + } + } } - grid forget $ds9(info).physicalZLabel $ds9(info).physicalZValue - grid forget $ds9(info).imageZLabel $ds9(info).imageZValue } rgb { grid forget $ds9(info).value @@ -224,7 +288,6 @@ proc LayoutFrameInfoBox {which} { grid forget $ds9(info).wcsZLabel$ll grid forget $ds9(info).wcsZValue$ll } - grid forget $ds9(info).physicalZLabel $ds9(info).physicalZValue grid forget $ds9(info).imageZLabel $ds9(info).imageZValue } 3d { @@ -253,17 +316,6 @@ proc LayoutFrameInfoBox {which} { } } - if {$view(info,physical)} { - grid $ds9(info).physicalZLabel \ - -row $ds9(info,row,physical) \ - -column 0 -sticky w - grid $ds9(info).physicalZValue \ - -row $ds9(info,row,physical) \ - -column 1 -padx 2 - } else { - grid forget $ds9(info).physicalZLabel \ - $ds9(info).physicalZValue - } if {$view(info,image)} { grid $ds9(info).imageZLabel \ -row $ds9(info,row,image) \ @@ -296,17 +348,6 @@ proc LayoutFrameInfoBox {which} { } } - if {$view(info,physical)} { - grid $ds9(info).physicalZLabel \ - -row $ds9(info,row,physical) \ - -column 5 -sticky w - grid $ds9(info).physicalZValue \ - -row $ds9(info,row,physical) \ - -column 6 -padx 2 - } else { - grid forget $ds9(info).physicalZLabel \ - $ds9(info).physicalZValue - } if {$view(info,image)} { grid $ds9(info).imageZLabel \ -row $ds9(info,row,image) \ @@ -332,7 +373,7 @@ proc EnterInfoBox {which} { puts stderr "EnterInfoBox $which" } - LayoutFrameInfoBox [$which get type] + LayoutFrameInfoBox $which [$which get type] LayoutWCSInfoBox $which set infobox(frame) "[msgcat::mc {Frame}] [string range $which 5 end]" @@ -565,6 +606,7 @@ proc LayoutInfoPanel {} { proc LayoutInfoPanelHorz {} { global ds9 global view + global current set ww 12 set row 0 @@ -685,7 +727,6 @@ proc LayoutInfoPanelHorz {} { set ds9(info,row,value,green) $row set ds9(info,row,value,blue) $row incr row - LayoutFrameInfoBox base # unit if {$view(info,bunit)} { @@ -767,7 +808,6 @@ proc LayoutInfoPanelHorz {} { if {$view(info,physical)} { $ds9(info).physicalXValue configure -width $ww $ds9(info).physicalYValue configure -width $ww - $ds9(info).physicalZValue configure -width $ww grid $ds9(info).physicalTitle -row $row -column 0 -sticky w grid $ds9(info).physicalXLabel -row $row -column 1 -sticky w @@ -805,6 +845,8 @@ proc LayoutInfoPanelHorz {} { grid forget $ds9(info).imageYValue } + LayoutFrameInfoBox $current(frame) base + # frame, zoom, angle if {$view(info,frame)} { $ds9(info).zoomValue configure -width $ww @@ -831,6 +873,7 @@ proc LayoutInfoPanelHorz {} { proc LayoutInfoPanelVert {} { global ds9 global view + global current set ww 13 set row 0 @@ -950,8 +993,7 @@ proc LayoutInfoPanelVert {} { incr row set ds9(info,row,value,blue) $row incr row - LayoutFrameInfoBox base - + # units if {$view(info,bunit)} { $ds9(info).bunitValue configure -width $ww @@ -1042,7 +1084,6 @@ proc LayoutInfoPanelVert {} { if {$view(info,physical)} { $ds9(info).physicalXValue configure -width $ww $ds9(info).physicalYValue configure -width $ww - $ds9(info).physicalZValue configure -width $ww grid $ds9(info).physicalTitle -row $row -column 1 -sticky ew incr row @@ -1086,6 +1127,8 @@ proc LayoutInfoPanelVert {} { grid forget $ds9(info).imageYValue } + LayoutFrameInfoBox $current(frame) base + # frame, zoom, angle if {$view(info,frame)} { $ds9(info).zoomValue configure -width $ww diff --git a/ds9/library/wcs.tcl b/ds9/library/wcs.tcl index b7ed3d5..2f29154 100644 --- a/ds9/library/wcs.tcl +++ b/ds9/library/wcs.tcl @@ -96,6 +96,11 @@ proc LayoutWCSInfoBox {which} { global wcs global view + global debug + if {$debug(tcl,events)} { + puts stderr "LayoutWCSInfoBox $which" + } + # if one wcs coord system is visible, change it set cnt 0 set vv {} @@ -105,6 +110,7 @@ proc LayoutWCSInfoBox {which} { set vv wcs$ll } } + if {$cnt == 1} { set ww [lindex [$which get wcs] 0] if {$view(info,$vv) != $view(info,$ww)} { -- cgit v0.12