1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
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\}"
}
}
}
|