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