aboutsummaryrefslogtreecommitdiff
path: root/vendor/x11iraf/ximtool/clients.old/doc/Notes
blob: da02130629bc7fef50381288ed586c0c94b73bd5 (plain) (blame)
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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199


define  MAX_WCSLINES	4

define  SZ_WPIX         6
define  WP_CPTR         Memi[$1  ]              # cache pointer
define  WP_PTABSZ       Memi[$1+1]              # pixel table size
define  WP_SYSTEMS      Memi[$1+2]              # WCS readout systems
define  WP_FORMATS      Memi[$1+3]              # WCS readout formats

define  SYSTEMS    Memi[WP_SYSTEMS($1)+$2-1]	# WCS systems per line
define  FORMATS    Memi[WP_FORMATS($1)+$2-1]	# WCS formats per line
define  OBJCACHE   Memi[WP_CPTR($1)+$2]		# object cache

# Element of an object cache.
define  SZ_CNODE        135                     # size of a cache node
define  SZ_OBJREF       128                     # size of a object reference

define  C_OBJID         Memi[$1]                # object id
define  C_REGID         Memi[$1+1]              # region id
define  C_CLASS         Memi[$1+2]              # object class
define  C_DATA          Memi[$1+3]              # object data ptr
define  C_REF           Memc[P2C($1+4)]         # object reference file

# Object class definitions.
define	IMAGE_CLASS	1			# generic image class
define	MEF_CLASS	2			# Mosaic MEF image class
define	MULTISPEC_CLASS	3			# multispec data class

# Class methods.
define	LEN_CL		6			# length of class table
define	MAX_CL		6			# max supported classes
define	SZ_CLNAME	16			# size of a class name

define	CL_INIT		cl_table[1,$1]		# class initializer
define	CL_CACHE	cl_table[2,$1]		# cache the object
define	CL_UNCACHE	cl_table[3,$1]		# uncache the object
define	CL_WCSTRAN	cl_table[4,$1]		# WCS tranformations
define	CL_WCSLIST	cl_table[5,$1]		# list available WCS
define	CL_GETDATA	cl_table[6,$1]		# get object data
define	CL_NAME		cl_names[1,$1]		# class name

# Class common.  
int     cl_nclasses                          	# number of defined functions
int     cl_table[LEN_CL,MAX_CL]         	# class table
char    cl_names[SZ_CLNAME,MAX_CL]      	# class names
common  /class_com/ cl_nclasses, cl_table, cl_names


# Image class data.
define  O_IM            Memi[$1+2]              # image pointer
define  O_MW            Memi[$1+3]              # image wcs pointer
define  O_CO            Memi[$1+3]              # skywcs transform pointer
define  O_CT            Memi[$1+4]              # mwcs transform pointer
define  O_ROT           Memr[$1+5]              # rotation angle
define  O_SCALE         Memr[$1+6]              # plate scale



--------------------------------------------------------------------------------
ISM Methods:
--------------------------------------------------------------------------------

    initialize
    cache <objid> <ref>
    uncache <objid>
    wcstran <objid> <x> <y> [[<region-name> <x> <y>] ["NDC" <x> <y>]]
    wcslist <objid>
    getheader <objid> <template-list>


procedure initialize
begin
	for (each object in the cache)
	    uncache object
	send startup req to GUI
end

procedure cache
begin
end

procedure uncache
begin
end

procedure wcstran
begin
end

procedure wcslist
begin
end

procedure getheader
begin
end


--------------------------------------------------------------------------------
GUI Callbacks
--------------------------------------------------------------------------------

proc ism_msg { param old new } {

    set target [lindex $new 0]		;# name of ism module

    switch [lindex $new 0] {
    source   { source [lindex $new 1] }		;# source Tcl code
    alert    { Wexec client [lindex $new 1] }	;# alert from ism client

    deliver  { set ism [lindex $new 0]		;# determine ISM name
	       set argv [lrange $new 1 end]	;# get args
	       set argc [llength $argv]
	       ${ism}_msg $argc $argv		;# call module
	     }
    }
} ; send ism_msg addCallback ism_msg


proc wpix_msg { argc argv } {

    switch [lindex $argv 0] {
    startup  { wpix_startup	}
    shutdown { wpix_shutdown	}
    cache    { .... save image name to GUI cache list
	     }
    uncache  { .... remove image name from GUI cache list
	     }
    wcstran  { .... parse argv for WCS field and update display
	     }
    pixtab   {
	     }
    wcslist  {
	     }
    wcstype  { set type [lindex $argv 1]		;# Set WCS for a line
     	       set line [lindex $argv 2]
     	       send sysWcs$line set label $type
	       if {$type == "None"} { 
		  send wpWcs$line set on False
	       } else {
		  send wpWcs$line set on True
	       }
	       setCoordPanelHeight
	     }
    wcsfmt   { set fmt  [lindex $argv 1]		;# Set fmt for a line
     	       set line [lindex $argv 2]
     	       send fmtWcs$line set label $fmt
	     }
    header   { set type [lindex $argv 1]		;# write header text
     	       set text [lindex $argv 2]
	       switch $type {
	       imghdr  {send hdrText   append $text}
	       wcshdr  {send hdrKGText append $text}
	       wcsinfo {send hdrIGText append $text}
	       }
	     }
    } ;# end switch
}

proc wpix_startup args {
    global ismEnabled frameCache 

    set ismEnabled 1				;# initialize buttons
    send ismToggle set on True
    send imageHeader setSensitive True
    setCoordPanelSensitivity

    resizeCoordsBox $up_todo			;# resize wcsbox marker
    updateCoordsBox

    foreach c [array names frameCache] { 	;# initialize local frame cache
        if {$c != "0"} { unset frameCache($c) }
    }

    catch { 					;# update ISM with GUI settings
        send wpix set psize $psize
        set wcsfmt [string tolower [send wcsFmtMenu get label]]
        send wpix set wcsfmt $wcsfmt
        if {[send wcsSysAltWCS get on]} {
            setAltSystem
        }
    }
}

proc wpix_shutdown args {
    global ismEnabled

    set ismEnabled 0
    send ismToggle set on False
    send imageHeader setSensitive False
    setCoordPanelSensitivity
    wcsFmtIValue ""
    wcsFmtImWCS  "" "" ""
    wcsFmtAltWCS "" "" ""
    resizeCoordsBox 0
}