diff options
author | William Joye <wjoye@cfa.harvard.edu> | 2018-08-30 20:18:20 (GMT) |
---|---|---|
committer | William Joye <wjoye@cfa.harvard.edu> | 2018-08-30 20:18:20 (GMT) |
commit | 9e48640f65728710421af5f7b6ea48552a9cf9bd (patch) | |
tree | 0843afbff55dc9b417ef4e269673b02507acce4a | |
parent | e829293f8e00aaf4119b8f5b6d8cdf40cc58aeb8 (diff) | |
download | blt-9e48640f65728710421af5f7b6ea48552a9cf9bd.zip blt-9e48640f65728710421af5f7b6ea48552a9cf9bd.tar.gz blt-9e48640f65728710421af5f7b6ea48552a9cf9bd.tar.bz2 |
handle non equatorial wcs 3d correctly
-rw-r--r-- | ds9/library/catdialog.tcl | 2 | ||||
-rw-r--r-- | ds9/library/crop.tcl | 4 | ||||
-rw-r--r-- | ds9/library/cube.tcl | 7 | ||||
-rw-r--r-- | ds9/library/menu.tcl | 116 | ||||
-rw-r--r-- | ds9/library/mwcs.tcl | 4 | ||||
-rw-r--r-- | ds9/library/siadialog.tcl | 2 | ||||
-rw-r--r-- | ds9/library/wcs.tcl | 4 |
7 files changed, 108 insertions, 31 deletions
diff --git a/ds9/library/catdialog.tcl b/ds9/library/catdialog.tcl index 5228e65..09acc5f 100644 --- a/ds9/library/catdialog.tcl +++ b/ds9/library/catdialog.tcl @@ -314,7 +314,7 @@ proc CATDialog {varname format catalog title action} { CoordMenuButton $f.coord $varname system 0 sky skyformat \ [list CATWCSMenuUpdate $varname] - CoordMenuEnable $f.coord.menu $varname system 0 sky skyformat + CoordMenuEnable $f.coord.menu $varname system {} sky skyformat ttk::button $f.update -text [msgcat::mc {Update}] \ -command [list CATUpdate $varname] diff --git a/ds9/library/crop.tcl b/ds9/library/crop.tcl index a5c81a1..3fd9277 100644 --- a/ds9/library/crop.tcl +++ b/ds9/library/crop.tcl @@ -222,7 +222,7 @@ proc UpdateCropDialog {} { DistMenuButtonCmd crop dcoord dformat {} AdjustCoordSystem3d crop rcoord - CoordMenuEnable $dcrop(rb).menu crop rcoord 2 {} {} + CoordMenuEnable3d $dcrop(rb).menu crop rcoord {} {} CoordMenuButtonCmd crop rcoord {} {} set rr [$current(frame) get crop center \ @@ -255,7 +255,7 @@ proc UpdateCropDialog {} { CoordMenuReset $dcrop(cb).menu crop system 1 sky skyformat DistMenuReset $dcrop(db).menu crop dcoord 1 dformat - CoordMenuReset $dcrop(rb).menu crop rcoord 2 {} {} + CoordMenuReset3d $dcrop(rb).menu crop rcoord {} {} set dcrop(x) {} set dcrop(y) {} diff --git a/ds9/library/cube.tcl b/ds9/library/cube.tcl index 2e8424a..ca05e05 100644 --- a/ds9/library/cube.tcl +++ b/ds9/library/cube.tcl @@ -334,6 +334,9 @@ proc CubeDialog {} { Toplevel $w $mb 6 [msgcat::mc {Cube}] CubeDestroyDialog + # for CoordMenuButton + set cube(frame) $current(frame) + $mb add cascade -label [msgcat::mc {File}] -menu $mb.file $mb add cascade -label [msgcat::mc {Edit}] -menu $mb.edit $mb add cascade -label [msgcat::mc {Interval}] -menu $mb.blink @@ -488,7 +491,7 @@ proc UpdateCubeDialog {} { # now make sure we have the coord systems AdjustCoordSystem3d cube system - CoordMenuEnable $mb.coord cube system 2 {} {} + CoordMenuEnable3d $mb.coord cube system sky {} # get number of axes set naxes [$current(frame) get fits naxes] @@ -563,7 +566,7 @@ proc UpdateCubeDialogNoImage {} { set mb $icube(mb) # reset coord menu - CoordMenuReset $mb.coord cube system 2 {} {} + CoordMenuReset3d $mb.coord cube system {} {} # disable Axes Reorder $mb entryconfig [msgcat::mc {Axes Order}] -state disabled diff --git a/ds9/library/menu.tcl b/ds9/library/menu.tcl index 8226ec2..bb9d869 100644 --- a/ds9/library/menu.tcl +++ b/ds9/library/menu.tcl @@ -152,7 +152,7 @@ proc CoordMenuButtonCmd {varname system sky cmd} { } } -proc CoordMenuEnable {w varname system other sky skyformat} { +proc CoordMenuEnable {w varname system image sky skyformat} { upvar #0 $varname var global $varname @@ -180,20 +180,72 @@ proc CoordMenuEnable {w varname system other sky skyformat} { } } - switch -- $other { - 1 { - $w entryconfig [msgcat::mc {Image}] -state normal - $w entryconfig [msgcat::mc {Physical}] -state normal - $w entryconfig [msgcat::mc {Amplifier}] -state normal - $w entryconfig [msgcat::mc {Detector}] -state normal + if ($image != {}} { + $w entryconfig [msgcat::mc {Image}] -state normal + $w entryconfig [msgcat::mc {Physical}] -state normal + $w entryconfig [msgcat::mc {Amplifier}] -state normal + $w entryconfig [msgcat::mc {Detector}] -state normal + } + + if {$sky != {}} { + if {[$var(frame) has wcs equatorial $var($system)]} { + $w entryconfig [msgcat::mc {FK4}] -state normal + $w entryconfig [msgcat::mc {FK5}] -state normal + $w entryconfig [msgcat::mc {ICRS}] -state normal + $w entryconfig [msgcat::mc {Galactic}] -state normal + $w entryconfig [msgcat::mc {Ecliptic}] -state normal + } else { + $w entryconfig [msgcat::mc {FK4}] -state disabled + $w entryconfig [msgcat::mc {FK5}] -state disabled + $w entryconfig [msgcat::mc {ICRS}] -state disabled + $w entryconfig [msgcat::mc {Galactic}] -state disabled + $w entryconfig [msgcat::mc {Ecliptic}] -state disabled } - 2 { - $w entryconfig [msgcat::mc {Image}] -state normal + } + + if {$skyformat != {}} { + if {[$var(frame) has wcs celestial $var($system)]} { + $w entryconfig [msgcat::mc {Degrees}] -state normal + $w entryconfig {Sexagesimal} -state normal + } else { + $w entryconfig [msgcat::mc {Degrees}] -state disabled + $w entryconfig {Sexagesimal} -state disabled + } + } +} + +proc CoordMenuEnable3d {w varname system sky skyformat} { + upvar #0 $varname var + global $varname + + if {![info exists var(frame)]} { + return + } + + if {$var(frame) == {}} { + return + } + + if {[$var(frame) has wcs 3d wcs]} { + $w entryconfig [msgcat::mc {WCS}] -state normal + } else { + $w entryconfig [msgcat::mc {WCS}] -state disabled + } + + $w entryconfig [msgcat::mc {Multiple WCS}] -state normal + + 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 {[$var(frame) has wcs 3d "wcs${ll}"]} { + $w.wcs entryconfig "[msgcat::mc {WCS}] $ll" -state normal + } else { + $w.wcs entryconfig "[msgcat::mc {WCS}] $ll" -state disabled } } + $w entryconfig [msgcat::mc {Image}] -state normal + if {$sky != {}} { - if {[$var(frame) has wcs celestial $var($system)]} { + if {[$var(frame) has wcs equatorial $var($system)]} { $w entryconfig [msgcat::mc {FK4}] -state normal $w entryconfig [msgcat::mc {FK5}] -state normal $w entryconfig [msgcat::mc {ICRS}] -state normal @@ -219,7 +271,7 @@ proc CoordMenuEnable {w varname system other sky skyformat} { } } -proc CoordMenuReset {w varname system other sky skyformat} { +proc CoordMenuReset {w varname system image sky skyformat} { upvar #0 $varname var global $varname @@ -230,18 +282,40 @@ proc CoordMenuReset {w varname system other sky skyformat} { $w.wcs entryconfig "[msgcat::mc {WCS}] $l" -state normal } - switch -- $other { - 1 { - $w entryconfig [msgcat::mc {Image}] -state normal - $w entryconfig [msgcat::mc {Physical}] -state normal - $w entryconfig [msgcat::mc {Amplifier}] -state normal - $w entryconfig [msgcat::mc {Detector}] -state normal - } - 2 { - $w entryconfig [msgcat::mc {Image}] -state normal - } + if {$image != {}} { + $w entryconfig [msgcat::mc {Image}] -state normal + $w entryconfig [msgcat::mc {Physical}] -state normal + $w entryconfig [msgcat::mc {Amplifier}] -state normal + $w entryconfig [msgcat::mc {Detector}] -state normal + } + + if {$sky != {}} { + $w entryconfig [msgcat::mc {FK4}] -state normal + $w entryconfig [msgcat::mc {FK5}] -state normal + $w entryconfig [msgcat::mc {ICRS}] -state normal + $w entryconfig [msgcat::mc {Galactic}] -state normal + $w entryconfig [msgcat::mc {Ecliptic}] -state normal } + if {$skyformat != {}} { + $w entryconfig [msgcat::mc {Degrees}] -state normal + $w entryconfig {Sexagesimal} -state normal + } +} + +proc CoordMenuReset3d {w varname system sky skyformat} { + upvar #0 $varname var + global $varname + + $w entryconfig [msgcat::mc {WCS}] -state normal + $w entryconfig [msgcat::mc {Multiple WCS}] -state normal + + foreach l {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} { + $w.wcs entryconfig "[msgcat::mc {WCS}] $l" -state normal + } + + $w entryconfig [msgcat::mc {Image}] -state normal + if {$sky != {}} { $w entryconfig [msgcat::mc {FK4}] -state normal $w entryconfig [msgcat::mc {FK5}] -state normal diff --git a/ds9/library/mwcs.tcl b/ds9/library/mwcs.tcl index cb7a21f..b9c6755 100644 --- a/ds9/library/mwcs.tcl +++ b/ds9/library/mwcs.tcl @@ -37,9 +37,9 @@ proc UpdateWCSMenu {} { set wcs(frame) $current(frame) if {[$current(frame) has fits]} { - CoordMenuEnable $ds9(mb).wcs wcs system 0 sky skyformat + CoordMenuEnable $ds9(mb).wcs wcs system {} sky skyformat } else { - CoordMenuReset $ds9(mb).wcs wcs system 0 sky skyformat + CoordMenuReset $ds9(mb).wcs wcs system {} sky skyformat } LayoutWCSInfoBox $current(frame) } else { diff --git a/ds9/library/siadialog.tcl b/ds9/library/siadialog.tcl index 51ae927..3947a78 100644 --- a/ds9/library/siadialog.tcl +++ b/ds9/library/siadialog.tcl @@ -144,7 +144,7 @@ proc SIADialog {varname title url opts method action} { CoordMenuButton $f.coord $varname system 0 sky skyformat \ [list SIAWCSMenuUpdate $varname] - CoordMenuEnable $f.coord.menu $varname system 0 sky skyformat + CoordMenuEnable $f.coord.menu $varname system {} sky skyformat ttk::label $f.rtitle -text [msgcat::mc {Radius}] ttk::entry $f.r -textvariable ${varname}(radius) -width 14 diff --git a/ds9/library/wcs.tcl b/ds9/library/wcs.tcl index 5356897..101e280 100644 --- a/ds9/library/wcs.tcl +++ b/ds9/library/wcs.tcl @@ -39,9 +39,9 @@ proc UpdateWCS {} { AlignWCSFrame set wcs(frame) $current(frame) if {[$current(frame) has fits]} { - CoordMenuEnable $ds9(mb).wcs wcs system 0 sky skyformat + CoordMenuEnable $ds9(mb).wcs wcs system {} sky skyformat } else { - CoordMenuReset $ds9(mb).wcs wcs system 0 sky skyformat + CoordMenuReset $ds9(mb).wcs wcs system {} sky skyformat } LayoutWCSInfoBox $current(frame) } |