source: trunk/SRC/ToBeReviewed/PLOTS/DIVERS/placedessin.pro @ 244

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

replace some print by some report in some .pro (continuation) + improvements/corrections of some *.pro headers

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 9.9 KB
Line 
1;+
2;
3; @file_comments
4; Putting into place of the drawing/ opening of the window or of the PS
5;
6; @categories
7; Utilities
8;
9; @param TYPEDESSIN {type=string}
10; It specify what procedure is called by <pro>PLACEDESSIN</pro> :
11; 'plt', 'pltz' or 'pltt'
12;
13; @keyword LANDSCAPE
14; Force the page or the window on the screen to be in lengthened position.
15;
16; @keyword LCT {type=integer}
17; It designate the number of the palette of color we want to use for the plot.
18;       
19; @keyword MAP
20; We use it when we want to do a projection.
21; This keyword can be of two types:
22;     MAP=[P0lat,P0lon,Rot]. For the description of these 3 values (see the online help of MAP_SET).
23;     /MAP: In this case, map is automatically calculated have the value:
24;          map = [0, (lon1+lon2)/2., 0]
25; Comment 1: A good way to choose the type of the projection we want to do is to have a look at IDL demo:
26; IDL> demo
27; Then choose earth sciences and  mapping.
28; Comment 2: By default it is a cylindrical projection which is effectuated (with or without the keyword map).
29; If we want an other projection, MAP must be activated and we have to add the keyword: /nom_projection.
30; For example, for a polar projection centered on the south pole:
31; IDL> domdef,-180,180,-90,-45
32; IDL> plt, tab, /stereo,map=[-90,0,0]
33;       
34; @keyword NOCOLORBAR
35; We active it if we do not want the colorbar.
36
37; @keyword NOFILL
38; We active it if we only want contours in black and white with a white background.
39;
40; @keyword NOERASE
41; We active it to make a drawing without creating a new frame.
42;
43; @keyword SMALL
44; Vector composed of 3 or 4 elements, applied to make a drawing on a
45; small portion of a page or screen. It delimit the zone where the drawing will be done.
46;     If there is 4 elements:
47; then is constituted of coordinates (expressed in cm located from the up and
48; left corner of the page or the window (in portrait like in landscape) of the bottom
49; and left corner and of the up and right corner of the drawing zone.
50;     If there is 3 elements:
51; in this case, we divide the page or the screen in small[0] columns and in small[1] lines
52; the drawing made in the box numbered small[2]. The numerotation starting up and left by
53; the number 1 and then, following the writing direction.
54; By default, we make the largest drawing we can do, conserving the aspect rapport
55; (except when REMPLI is activated).
56;
57; @keyword PORTRAIT
58; Force the page or the window to be in standing position.
59;
60; @keyword POST
61; Make a postscript. Only works if we made one drawing on the page.
62; If we make several drawing, use \@<pro>ps</pro>.
63;
64; @keyword REMPLI
65; Force the drawing to occupy the whole space defined by small.
66;
67; @keyword WINDOW
68; Number of the window on which we want to do the graph (Allow to open several windows).
69; By default, we open 'IDL0'
70;
71; @keyword CB_TITLE
72; The colorbar's title
73;
74; @keyword CONTOUR
75; If we want to trace contours of a different field than the one
76; whose we have the colored drawing (by example E-P in color and QSR in contours).
77; It must be a field respecting same characteristics than the argument number
78; one of <pro>plt</pro>.
79;
80; @keyword ENDPOINTS
81; keyword specifying that we want to make a vertical cut in diagonal. Then coordinated of extremities
82; of these one are defined by the 4 elements of the vector ENDPOINTS: [x1,y1,x2,y2] which are
83; coordinates.
84;
85; @keyword VECTEUR {type=vector}
86; It is a structure composed by 2 elements containing the 2 fields U
87; and V of values of the zonal and meridian component of the vector of the fields
88; to draw. These fields can be an array or a structure.
89;       For example: vecteur={matriceu:lec('unsurface'),matricev:lec('vnsurface')}
90;       Comment: name of elements of vectors are inconsequential.
91;       vecteur={u:lec('unsurface'),v:lec('vnsurface')} is also appropriated.
92;
93; @keyword DIREC
94; 't' 'x' 'y' 'z' 'xys' 'xz' 'yz' 'xyz' 'xt' 'yt' 'zt' 'xyt'
95;       'xzt' 'yzt' 'xyzt' Direction on which do averages
96;
97; @keyword _EXTRA
98; Used to pass keywords
99;
100; @keyword COLOR_C
101; To draw the contour in color instead of in black
102; with filling in color
103;
104; @param POSFENETRE {out}{type=vector}
105; It is a vector composed by 4 elements containing the position of the frame
106; containing captions and the graph in normalized coordinates.
107; Comment: To position the drawing; we have to do !p.position=posfenetre
108; after the call of the caliber
109;
110; @param POSBAR {out}{type=vector}
111; Like POSFENETRE but for the color bar.
112; Same comment to position the color bar, !p.position=posbar
113;
114; @uses
115; common.pro
116;
117; @history
118; Sebastien Masson (smasson\@lodyc.jussieu.fr)
119;                       26/4/1999
120;
121; @version
122; $Id$
123;
124;-
125;
126PRO placedessin, typedessin, posfenetre, posbar, BARMARGES = barmarges $
127                 , NOCOLORBAR = nocolorbar, NOFILL = nofill, COLOR_c = color_c $
128                 , CONTOUR = contour $
129                 , VECTEUR = vecteur, PORTRAIT = portrait, LANDSCAPE = landscape $
130                 , SMALL = small, MARGES = marges, MAP = map $
131                 , REMPLI = REMPLI, POST = post, WINDOW = window $
132                 , ENDPOINTS = endpoints, TYPE = type, BASICMARGES = basicmarges $
133                 , NOERASE = noerase, LCT = lct, DIREC = direc, CB_TITLE = cb_title, _EXTRA = ex
134;
135  compile_opt idl2, strictarrsubs
136;
137@cm_4ps
138@cm_4mesh
139  IF NOT keyword_set(key_forgetold) THEN BEGIN
140@updatekwd
141  ENDIF
142;-------------------------------------------------------------
143; 1) Determination of the size of margins (unity=number of lines or columns)
144; to the left, to the right, up and down.
145; BEWARE in margebar, the last element is the right up corner
146; instead of the up margin
147;-------------------------------------------------------------
148  if n_elements(typedessin) EQ 0 then typedessin = 'autre'
149  if keyword_set(basicmarges) then begin
150    marge = 1.*[6, 2, 4, 3]
151    if keyword_set(marges) THEN marge = marge+marges
152    margebar = 1.*[marge[0]+1, marge[1]+1,  marge[2]-8,  marge[2]-6]
153    if keyword_set(barmarges) then margebar = margebar+barmarges
154  ENDIF ELSE BEGIN
155    nocolorbar = keyword_set(nocolorbar) + keyword_set(nofill) + keyword_set(color_c)
156    case typedessin of
157      'plt':marge = 1.*[6, 2, 4, 3]
158      'pltt':marge = 1.*[6+4*(type EQ 'xt'), 2, 4, 4]
159      'pltz':marge = 1.*[6, 2, 4, 3]
160      else:marge = 1.*[6, 2, 4, 3]
161    ENDCASE
162    if keyword_set(marges) THEN marge = marge+marges
163    if NOT keyword_set(barmarges) then barmarges = replicate(0, 4)
164    barmarges[3] = -barmarges[3]
165    margebar = 1.*[marge[0]+1, marge[1]+1, 2, 4]+barmarges
166    marge = marge+[0, 0, 4, 0]*keyword_set(cb_title)
167    IF keyword_set(direc) THEN $
168      marge = marge+[0, 0, 2, 0]*(strlowcase(direc) NE 't')
169    marge = marge+[0, 0, 2, 0]*keyword_set(contour)
170    marge = marge+[0, 0, 2, 0]*keyword_set(vecteur)
171    if n_elements(lon1) NE 0 and n_elements(lon2) NE 0 $
172      and n_elements(lat1) NE 0 and n_elements(lat2) NE 0 then begin
173      if keyword_set(type) then $
174        marge = marge+[0, 3*(type EQ 'yt' AND lon1 NE lon2), 0 $
175                       , 2*(type NE 'yt' AND lat1 NE lat2)]*keyword_set(endpoints) $
176      ELSE marge = marge+[0, 0, 0, 2*(lat1 NE lat2)]*keyword_set(endpoints)
177    endif
178    marge = marge+[0, 0, 2+margebar[3], 0]*(1-keyword_set(nocolorbar))
179  ENDELSE
180;--------------------------------------------------------------
181; Portrait or landscape
182;--------------------------------------------------------------
183  IF NOT keyword_set(noerase) THEN BEGIN
184    CASE 1 OF
185      n_elements(portrait) NE 0:key_portrait = portrait
186      n_elements(landscape) NE 0:key_portrait = 1-landscape
187      ELSE:
188    ENDCASE
189  ENDIF
190;--------------------------------------------------------------
191; What type of aspect rapport (it will be crushed if YXASPECT exist)
192;--------------------------------------------------------------
193  case typedessin of
194    'plt':yaspect = 1.*(lat2-lat1)/(lon2-lon1)
195    'pltt':yaspect = 1.
196    'pltz':yaspect = .5
197    ELSE:yaspect = 1.
198  endcase
199;-------------------------------------------------------------
200; 2) calculation of !p.position
201; see calibre.pro.
202;------------------------------------------------------------
203;
204  IF NOT keyword_set(small) then small = [1, 1, 1]
205;
206  if keyword_set(map) then rempli = 1
207;
208  calibre, yaspect, marge, margebar, small, posfenetre, posbar, REMPLI = rempli, _extra = ex
209;
210  !p.position = posfenetre
211;------------------------------------------------------------
212; 3) opening of the graphic window or of the postscript
213;------------------------------------------------------------
214  case 1 of
215; case of the first drawing on a postscript
216    keyword_set(post) AND !d.name ne 'PS':openps, _extra = ex
217; case of the first drawing on a screen
218    keyword_set(post) EQ 0 AND keyword_set(noerase) EQ 0 $
219      AND !d.name ne 'PS' AND !d.name ne 'Z':BEGIN
220      if not keyword_set(window) then window = 0
221; For the using of \@ps,\@oups et de \@vzoom
222      if lmgr(/demo) EQ 0 then BEGIN ; Are we in the demo mode??
223        if !journal NE 0 then journal ; We close the journal if it is open
224        homedir = isadirectory(io = homedir, title = 'Bad definition of homedir')
225        def_myuniquetmpdir
226        journal, myuniquetmpdir+'idlsave.pro' ; We open a new one
227        help, /recall_commands, output = listecommande ; We recuperate the last command
228        listecommande = strmid(strcompress(listecommande[1]), 2)
229        journal, listecommande ; We write it in the journal
230      ENDIF
231      windsize = givewindowsize()
232      window, window, xsize = windsize[0], ysize = windsize[1],  retain = 2, _extra = ex
233; When we used colors which are coded on 24bit, we can not stipulate the background color
234; of a window thanks to !p.background, so we have to to this:
235;          if !d.n_colors gt 256 then begin
236;             device, decomposed=1
237;             !p.background='ffffff'x
238;             plot,[0],[0], /nodata, xstyle = 4, ystyle = 4
239;             device, decomposed=0
240;          endif
241    END
242    ELSE:
243  endcase
244;------------------------------------------------------------
245  if n_elements(lct) NE 0 then lct, lct, _extra = ex
246;------------------------------------------------------------
247
248  return
249end
Note: See TracBrowser for help on using the repository browser.