source: trunk/SRC/ToBeReviewed/WIDGET/AUTOUR_de_XXX/singleclickaction.pro @ 231

Last change on this file since 231 was 231, checked in by pinsard, 17 years ago

improvements/corrections of some *.pro headers

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