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

Last change on this file since 367 was 325, checked in by pinsard, 16 years ago

modification of some headers (+some corrections) to prepare usage of the new idldoc

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