source: trunk/ToBeReviewed/WIDGET/AUTOUR_de_XXX/singleclickaction.pro @ 69

Last change on this file since 69 was 69, checked in by smasson, 18 years ago

debug + new xxx

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