1 | ;+ |
---|
2 | ; @file_comments |
---|
3 | ; |
---|
4 | ; |
---|
5 | ; @categories |
---|
6 | ; |
---|
7 | ; |
---|
8 | ; @param EVENT |
---|
9 | ; |
---|
10 | ; |
---|
11 | ; @returns |
---|
12 | ; |
---|
13 | ; |
---|
14 | ; @uses |
---|
15 | ; |
---|
16 | ; |
---|
17 | ; @restrictions |
---|
18 | ; |
---|
19 | ; |
---|
20 | ; @examples |
---|
21 | ; |
---|
22 | ; |
---|
23 | ; @history |
---|
24 | ; |
---|
25 | ; |
---|
26 | ; @version |
---|
27 | ; $Id$ |
---|
28 | ; |
---|
29 | ; @todo |
---|
30 | ; seb |
---|
31 | ; |
---|
32 | ;- |
---|
33 | PRO singleclickaction, event |
---|
34 | ; |
---|
35 | compile_opt idl2, strictarrsubs |
---|
36 | ; |
---|
37 | @cm_4mesh |
---|
38 | @cm_4data |
---|
39 | |
---|
40 | return |
---|
41 | |
---|
42 | ;------------------------------------------------------------ |
---|
43 | widget_control, event.id, get_uvalue = uval |
---|
44 | widget_control, event.top, get_uvalue = top_uvalue |
---|
45 | actionid = widget_info(event.top, find_by_uname = 'action') |
---|
46 | type = widget_info(actionid, /combobox_gettext) |
---|
47 | IF type NE 'plt' THEN return |
---|
48 | ; We activate the right window |
---|
49 | widget_control, event.id, get_value = win |
---|
50 | wset, win |
---|
51 | ; choice of the type of action |
---|
52 | case uval.press of |
---|
53 | 1:BEGIN |
---|
54 | coor = (convert_coord(uval.x[0], uval.y[0], /device, /to_data)) |
---|
55 | x = coor[0] |
---|
56 | y = coor[1] |
---|
57 | help, x, y |
---|
58 | oldgrid = vargrid |
---|
59 | CASE strupcase(vargrid) OF |
---|
60 | 'T':vargrid = 'F' |
---|
61 | 'W':vargrid = 'F' |
---|
62 | 'U':vargrid = 'V' |
---|
63 | 'V':vargrid = 'U' |
---|
64 | 'F':vargrid = 'T' |
---|
65 | ENDCASE |
---|
66 | grille, -1, glam, gphi, -1, nx, ny, nz, firstx, firsty, firstz, lastx, lasty, lastz |
---|
67 | vargrid = oldgrid |
---|
68 | ; define the corner of the cells in the clockwise direction |
---|
69 | IF keyword_set(key_periodic) AND nx EQ jpi THEN BEGIN |
---|
70 | x1 = glam[*, 0:ny-2] |
---|
71 | y1 = gphi[*, 0:ny-2] |
---|
72 | x2 = glam[*, 1:ny-1] |
---|
73 | y2 = gphi[*, 1:ny-1] |
---|
74 | x3 = shift(glam[*, 1:ny-1], -1, 0) |
---|
75 | y3 = shift(gphi[*, 1:ny-1], -1, 0) |
---|
76 | x4 = shift(glam[*, 0:ny-2], -1, 0) |
---|
77 | y4 = shift(gphi[*, 0:ny-2], -1, 0) |
---|
78 | ENDIF ELSE BEGIN |
---|
79 | x1 = glam[0:nx-2, 0:ny-2] |
---|
80 | y1 = gphi[0:nx-2, 0:ny-2] |
---|
81 | x2 = glam[0:nx-2, 1:ny-1] |
---|
82 | y2 = gphi[0:nx-2, 1:ny-1] |
---|
83 | x3 = glam[1:nx-1, 1:ny-1] |
---|
84 | y3 = gphi[1:nx-1, 1:ny-1] |
---|
85 | x4 = glam[1:nx-1, 0:ny-2] |
---|
86 | y4 = gphi[1:nx-1, 0:ny-2] |
---|
87 | ENDELSE |
---|
88 | glam = -1 ; free memory |
---|
89 | gphi = -1 ; free memory |
---|
90 | ; |
---|
91 | ; What is the longitude? |
---|
92 | WHILE x GT !x.range[1] DO x = x-360 |
---|
93 | WHILE x LT !x.range[0] DO x = x+360 |
---|
94 | IF x GT !x.range[1] THEN RETURN |
---|
95 | IF y GT !y.range[1] THEN RETURN |
---|
96 | IF y LT !y.range[0] THEN RETURN |
---|
97 | ; |
---|
98 | cell = inquad(x, y, x1, y1, x2, y2, x3, y3, x4, y4 $ |
---|
99 | , onsphere = key_onearth) |
---|
100 | ; |
---|
101 | x1 = -1 ; free memory |
---|
102 | y1 = -1 ; free memory |
---|
103 | x2 = -1 ; free memory |
---|
104 | y2 = -1 ; free memory |
---|
105 | x3 = -1 ; free memory |
---|
106 | y3 = -1 ; free memory |
---|
107 | x4 = -1 ; free memory |
---|
108 | y4 = -1 ; free memory |
---|
109 | |
---|
110 | IF cell[0] EQ -1 OR n_elements(cell) GT 1 THEN RETURN |
---|
111 | ; |
---|
112 | yy = cell[0]/(nx-1+key_periodic*(nx EQ jpi)) |
---|
113 | xx = cell[0] MOD (nx-1+key_periodic*(nx EQ jpi)) |
---|
114 | ; |
---|
115 | CASE strupcase(vargrid) OF |
---|
116 | 'T':BEGIN |
---|
117 | xx = xx+firstx+1 |
---|
118 | yy = yy+firsty+1 |
---|
119 | END |
---|
120 | 'W':BEGIN |
---|
121 | xx = xx+firstx+1 |
---|
122 | yy = yy+firsty+1 |
---|
123 | END |
---|
124 | 'U':BEGIN |
---|
125 | xx = xx+firstx |
---|
126 | yy = yy+firsty+1 |
---|
127 | END |
---|
128 | 'V':BEGIN |
---|
129 | xx = xx+firstx+1 |
---|
130 | yy = yy+firsty |
---|
131 | END |
---|
132 | 'F':BEGIN |
---|
133 | xx = xx+firstx |
---|
134 | yy = yy+firsty |
---|
135 | END |
---|
136 | ENDCASE |
---|
137 | ; |
---|
138 | bad = where(xx GE jpi) |
---|
139 | IF bad[0] NE -1 THEN BEGIN |
---|
140 | xx[bad] = xx[bad]-jpi |
---|
141 | yy[bad] = yy[bad]+1 |
---|
142 | ENDIF |
---|
143 | bad = where(yy GE jpj) |
---|
144 | IF bad[0] NE -1 THEN stop |
---|
145 | ; |
---|
146 | print, glamt[xx, yy], gphit[xx, yy] |
---|
147 | ; |
---|
148 | cmd = buildcmd(event.top, boxzoom = boxzoom) |
---|
149 | ; |
---|
150 | END |
---|
151 | ELSE: |
---|
152 | endcase |
---|
153 | |
---|
154 | RETURN |
---|
155 | end |
---|