source: trunk/SRC/ToBeReviewed/PLOTS/DIVERS/checktypeminmax.pro @ 163

Last change on this file since 163 was 163, checked in by navarro, 18 years ago

header improvements : type of parameters and keywords, default values, spell checking + idldoc assistant (IDL online_help)

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 4.5 KB
Line 
1;+
2; @file_comments
3;
4;
5; @categories
6;
7;
8; @param PROCEDURE
9;
10;
11; @keyword TYPE
12;
13;
14; @keyword MIN
15;
16;
17; @keyword MAX
18;
19;
20; @keyword XY
21;
22;
23; @keyword XZ
24;
25;
26; @keyword YZ
27;
28;
29; @keyword XT
30;
31;
32; @keyword YT
33;
34;
35; @keyword ZT
36;
37;
38; @keyword TT
39;
40;
41; @keyword XX
42;
43;
44; @keyword YY
45;
46;
47; @keyword ZZ
48;
49;
50; @keyword XINDEX
51;
52;
53; @keyword YINDEX
54;
55;
56; @keyword ENDPOINTS
57;
58;
59; @keyword _EXTRA
60; Used to pass your keywords
61;
62; @returns
63;
64;
65; @uses
66; common.pro
67;
68; @restrictions
69;
70;
71; @examples
72;
73;
74; @history
75; Sebastien Masson (smasson\@lodyc.jussieu.fr)
76;
77; @version
78; $Id$
79;
80; @todo seb
81;-
82;
83;
84PRO checktypeminmax, procedure, TYPE = type, MIN = min, MAX = max, XY = xy $
85                     , XZ = xz, YZ = yz, XT = XT, YT = YT, ZT = zt $
86                     , TT = tt, XX = xx, YY = yy, ZZ = zz $
87                     , XINDEX = xindex, YINDEX = yindex $
88                     , ENDPOINTS = endpoints, _extra = ex
89  compile_opt idl2, strictarrsubs
90;
91@common
92;--------------------------------------------------------------
93   case size(type, /type) of
94      0:
95      7:
96      ELSE:BEGIN
97         vraimin = type
98         case size(min, /type) of
99            0:BEGIN
100               min = vraimin
101               type = 0
102            END
103            7:BEGIN
104               type = min
105               min = vraimin
106            end
107            ELSE:BEGIN
108               case size(max, /type) of
109                  0:BEGIN
110                     max = min
111                     min = vraimin
112                     type = 0
113                  END
114                  7:BEGIN
115                     type = max
116                     max = min
117                     min = vraimin
118                  end
119                  ELSE:BEGIN
120                     rien = report('Probleme dans la definition des arguments en entree de ' $
121                                   +procedure, /chkwidget)
122                     return
123                  end
124               endcase
125            end
126         endcase
127      end
128   endcase
129;
130   if keyword_set(xy) then type = 'xy'
131   if keyword_set(xz) then type = 'xz'
132   if keyword_set(yz) then type = 'yz'
133   if keyword_set(xt) then type = 'xt'
134   if keyword_set(yt) then type = 'yt'
135   if keyword_set(zt) then type = 'zt'
136   if keyword_set(tt) then type = 't'
137   if keyword_set(xx) then type = 'x'
138   if keyword_set(yy) then type = 'y'
139   if keyword_set(zz) then type = 'z'
140;
141   if keyword_set(type) then begin
142     if type EQ 'plt' then type = ''
143     if type EQ 'pltz' then type = ''
144     if type EQ 'pltt' then type = ''
145     if type EQ 'plt1d' then type = ''
146   endif
147;--------------------------------------------------------------
148; determination du type de plot que l''on veut faire
149;--------------------------------------------------------------
150   if NOT keyword_set(type) then BEGIN
151      case procedure of
152        'plt':type = 'xy'
153        'pltz':BEGIN
154          if keyword_set(endpoints) then BEGIN
155            lon1 = min([endpoints[0], endpoints[2]], max = lon2)
156            lat1 = min([endpoints[1], endpoints[3]], max = lat2)
157            if (lon2-lon1) gt (lat2-lat1) then type = 'xz' else type = 'yz'
158          ENDIF ELSE type = 'z'
159        END
160        'pltt':BEGIN
161          if keyword_set(endpoints) then BEGIN
162            lon1 = min([endpoints[0], endpoints[2]], max = lon2)
163            lat1 = min([endpoints[1], endpoints[3]], max = lat2)
164            lat2 = max([endpoints[1], endpoints[3]])
165            if (lon2-lon1) gt (lat2-lat1) then type = 'xt' else type = 'yt'
166          ENDIF ELSE type = 'unkownpltt'
167        END
168        'plt1d':BEGIN
169          if keyword_set(endpoints) then BEGIN
170            lon1 = min([endpoints[0], endpoints[2]], max = lon2)
171            lat1 = min([endpoints[1], endpoints[3]], max = lat2)
172            if (lon2-lon1) gt (lat2-lat1) then type = 'x' else type = 'y'
173          ENDIF ELSE BEGIN
174            type = ''
175            WHILE type NE 'x' AND type NE 'y' AND type NE 'z' DO BEGIN
176              type = xquestion('Quel type de plot 1D voulez-vous faire? x,y,z ou t ?' $
177                               , /chkwidget)
178              type = strlowcase(type)
179            endwhile
180          ENDELSE
181        END
182      endcase
183    ENDIF
184    WHILE type NE 'xy' AND type NE 'xz' AND type NE 'yz' $
185      AND type NE 'xt' AND type NE 'yt' AND type NE 'zt' $
186      AND type NE 't' AND type NE 'x' AND type NE 'y' $
187      AND type NE 'z' AND type NE 'unkownpltt' DO BEGIN
188      type = xquestion('What kind of plot do you want to do? xy,xz,yz,xt,yt,zt,t,x,y,z ? ' $
189                       , /chkwidget)
190      type = strlowcase(type)
191    ENDWHILE
192;
193;
194   
195    return
196  end
Note: See TracBrowser for help on using the repository browser.