summaryrefslogtreecommitdiffstats
path: root/ds9/library/template.tcl
diff options
context:
space:
mode:
authorWilliam Joye <wjoye@cfa.harvard.edu>2016-10-27 19:01:15 (GMT)
committerWilliam Joye <wjoye@cfa.harvard.edu>2016-10-27 19:01:15 (GMT)
commit12166aa342f7c8d905097e43a1f50e0775503069 (patch)
tree73a6e7296fbf9898633a02c2503a3e959789d8c3 /ds9/library/template.tcl
parentd4d595fa7fb12903db9227d33d48b2b00120dbd1 (diff)
downloadblt-12166aa342f7c8d905097e43a1f50e0775503069.zip
blt-12166aa342f7c8d905097e43a1f50e0775503069.tar.gz
blt-12166aa342f7c8d905097e43a1f50e0775503069.tar.bz2
Initial commit
Diffstat (limited to 'ds9/library/template.tcl')
-rw-r--r--ds9/library/template.tcl130
1 files changed, 130 insertions, 0 deletions
diff --git a/ds9/library/template.tcl b/ds9/library/template.tcl
new file mode 100644
index 0000000..107dcbf
--- /dev/null
+++ b/ds9/library/template.tcl
@@ -0,0 +1,130 @@
+# Copyright (C) 1999-2016
+# Smithsonian Astrophysical Observatory, Cambridge, MA, USA
+# For conditions of distribution and use, see copyright notice in "copyright"
+
+package provide DS9 1.0
+
+proc TemplateDef {} {
+ global itemplate
+
+ # chandra
+ set itemplate(chandra,acis,acis-i) {chandra/acis/acis-i.tpl}
+ set itemplate(chandra,acis,acis-s) {chandra/acis/acis-s.tpl}
+ set itemplate(chandra,acis,acis-is) {chandra/acis/acis-is.tpl}
+ set itemplate(chandra,acis,acis-si) {chandra/acis/acis-si.tpl}
+ set itemplate(chandra,hrc,hrc-i) {chandra/hrc/hrc-i.tpl}
+ set itemplate(chandra,hrc,hrc-s) {chandra/hrc/hrc-s.tpl}
+
+ # xmm
+ set itemplate(xmm,epicmos1) {xmm/epicmos1.tpl}
+ set itemplate(xmm,epicmos2) {xmm/epicmos2.tpl}
+ set itemplate(xmm,epicpn) {xmm/epicpn.tpl}
+
+ # heasarc
+ # suzaku
+ set itemplate(heasarc,suzaku,hxd) {heasarc/suzaku/hxd.tpl}
+ set itemplate(heasarc,suzaku,xis) {heasarc/suzaku/xis.tpl}
+ set itemplate(heasarc,suzaku,xrs) {heasarc/suzaku/xrs.tpl}
+
+ # mmt
+ # megacam
+ set itemplate(mmt,megacam,megacam-amp) {mmt/megacam/megacam-amp.tpl}
+ set itemplate(mmt,megacam,megacam-amp-guide) {mmt/megacam/megacam-amp-guide.tpl}
+ set itemplate(mmt,megacam,megacam-chip) {mmt/megacam/megacam-chip.tpl}
+ set itemplate(mmt,megacam,megacam-chip-guide) {mmt/megacam/megacam-chip-guide.tpl}
+ # hecto
+ set itemplate(mmt,hecto,hectospec) {mmt/hecto/hectospec.tpl}
+ set itemplate(mmt,hecto,hectochelle) {mmt/hecto/hectochelle.tpl}
+ # mmirs
+ set itemplate(mmt,mmirs,image) {mmt/mmirs/image.tpl}
+ set itemplate(mmt,mmirs,longslit) {mmt/mmirs/longslit.tpl}
+ set itemplate(mmt,mmirs,mask) {mmt/mmirs/mask.tpl}
+ # others
+ set itemplate(mmt,swirc) {mmt/swirc.tpl}
+ set itemplate(mmt,binospec) {mmt/binospec.tpl}
+}
+
+proc CreateFOVMenu {} {
+ global ds9
+ global itemplate
+ global marker
+
+ set mm $ds9(mb).region.fov
+ menu $mm
+
+ set l0 {}
+ set l1 {}
+ set l2 {}
+
+ foreach t [lsort [array names itemplate]] {
+ set tt [split $t ","]
+ set t0 [lindex $tt 0]
+ set t1 [lindex $tt 1]
+ set t2 [lindex $tt 2]
+
+ if {$l0 != $t0} {
+ menu $mm.$t0
+ $mm add cascade -label [string toupper $t0] -menu $mm.$t0
+ set l0 $t0
+ set l1 {}
+ set l2 {}
+ }
+
+ if {$l1 != $t1} {
+ if {$t2 != {}} {
+ menu $mm.$t0.$t1
+ $mm.$t0 add cascade -label [string toupper $t1] \
+ -menu $mm.$t0.$t1
+ set l1 $t1
+ set l2 {}
+ } else {
+ $mm.$t0 add radiobutton \
+ -label [string toupper $t1] -variable marker(shape) \
+ -value $t
+ continue
+ }
+ }
+
+ $mm.$t0.$t1 add radiobutton -label [string toupper $t2] \
+ -variable marker(shape) -value $t
+ }
+}
+
+proc OpenTemplateMarker {} {
+ LoadTemplateMarker [OpenFileDialog templatefbox]
+}
+
+proc LoadTemplateMarker {fn} {
+ global ds9
+ global current
+
+ if {$current(frame) != {} && $fn != {}} {
+ set cc [$ds9(canvas) coords $current(frame)]
+ set ww [lindex [$current(frame) configure -width] 4]
+ set hh [lindex [$current(frame) configure -height] 4]
+ set xx [expr [lindex $cc 0]+$ww/2.0]
+ set yy [expr [lindex $cc 1]+$hh/2.0]
+
+ catch {$current(frame) marker create template "\{$fn\}" $xx $yy}
+ }
+}
+
+proc LoadTemplateMarkerAt {fn ra dec sys sky} {
+ global current
+
+ if {$current(frame) != {} && $fn != {}} {
+ catch {$current(frame) marker create template "\{$fn\}" $sys $sky $ra $dec}
+ }
+}
+
+proc SaveAsTemplateMarker {} {
+ global current
+
+ if {$current(frame) != {}} {
+ set fn [SaveFileDialog templatefbox]
+
+ if {$fn != {}} {
+ $current(frame) marker save template "\{$fn\}"
+ }
+ }
+}