[2] | 1 | ;------------------------------------------------------------ |
---|
| 2 | ;------------------------------------------------------------ |
---|
| 3 | ;------------------------------------------------------------ |
---|
| 4 | ;+ |
---|
| 5 | ; NAME:placedessin |
---|
| 6 | ; |
---|
| 7 | ; PURPOSE: mise en place du dessin / ouverture de la fenetre ou du PS |
---|
| 8 | ; |
---|
| 9 | ; CATEGORY: pour alleger les programmes plt, pltz, pltt. |
---|
| 10 | ; |
---|
| 11 | ; CALLING SEQUENCE: placedessin, typedessin,posfenetre, posbar |
---|
| 12 | ; |
---|
| 13 | ; INPUTS: |
---|
| 14 | ; typedessin: une chaine de charactere specifiant quelle procedure |
---|
| 15 | ; appelle placedessin: 'plt', 'pltz', 'pltt' |
---|
| 16 | ; |
---|
| 17 | ; KEYWORD PARAMETERS: pleins (ce de CALIBRE de WINDOW ...) |
---|
| 18 | ; |
---|
| 19 | ; LCT: intier designant le numero de la palette de couleur que |
---|
| 20 | ; l''on veut utiliser pour les plot. |
---|
| 21 | ; |
---|
| 22 | ; OUTPUTS: |
---|
| 23 | ; |
---|
| 24 | ; posfenetre: un vecteur de 4 elements contenant la position de |
---|
| 25 | ; cadre contenant les legendes + le graphe en coordonnes |
---|
| 26 | ; normalises. Rq: pour positionner le dessin il faut apres |
---|
| 27 | ; l''appelle de calibre faire !p.position=posfenetre |
---|
| 28 | ; |
---|
| 29 | ; posbar: cf posfentre mais pour la barre de couleur. meme |
---|
| 30 | ; remarque pour positionner la barre de couleur, !p.position=posbar |
---|
| 31 | ; |
---|
| 32 | ; |
---|
| 33 | ; COMMON BLOCKS: |
---|
| 34 | ; common.pro |
---|
| 35 | ; |
---|
| 36 | ; SIDE EFFECTS: |
---|
| 37 | ; |
---|
| 38 | ; RESTRICTIONS: |
---|
| 39 | ; |
---|
| 40 | ; EXAMPLE: |
---|
| 41 | ; |
---|
| 42 | ; MODIFICATION HISTORY: Sebastien Masson (smasson@lodyc.jussieu.fr) |
---|
| 43 | ; 26/4/1999 |
---|
| 44 | ;- |
---|
| 45 | ;------------------------------------------------------------ |
---|
| 46 | ;------------------------------------------------------------ |
---|
| 47 | ;------------------------------------------------------------ |
---|
[37] | 48 | PRO placedessin, typedessin, posfenetre, posbar, BARMARGES = barmarges $ |
---|
| 49 | , NOCOLORBAR = nocolorbar, NOFILL = nofill, COLOR_c = color_c $ |
---|
| 50 | , CONTOUR = contour $ |
---|
[2] | 51 | , VECTEUR = vecteur, PORTRAIT = portrait, LANDSCAPE = landscape $ |
---|
[37] | 52 | , SMALL = small, MARGES = marges, MAP = map $ |
---|
[2] | 53 | , REMPLI = REMPLI, POST = post, WINDOW = window $ |
---|
[37] | 54 | , ENDPOINTS = endpoints, TYPE = type, BASICMARGES = basicmarges $ |
---|
[2] | 55 | , NOERASE = noerase, LCT = lct, DIREC = direc, CB_TITLE = cb_title, _extra = ex |
---|
[37] | 56 | ;--------------------------------------------------------- |
---|
| 57 | ; include common |
---|
| 58 | @cm_4ps |
---|
| 59 | @cm_4mesh |
---|
| 60 | IF NOT keyword_set(key_forgetold) THEN BEGIN |
---|
| 61 | @updatekwd |
---|
| 62 | ENDIF |
---|
[2] | 63 | ;------------------------------------------------------------- |
---|
| 64 | ; 1) determination de la taille des marges (unite=nbre de lignes ou colonnes) |
---|
| 65 | ; a gauche, a droite, en bas, en haut |
---|
| 66 | ; ATTENTION ds margebar le dernier element est le coint en haut a droite au |
---|
| 67 | ; lieu de la marge en haut |
---|
| 68 | ;------------------------------------------------------------- |
---|
[37] | 69 | if n_elements(typedessin) EQ 0 then typedessin = 'autre' |
---|
| 70 | if keyword_set(basicmarges) then begin |
---|
| 71 | marge = 1.*[6, 2, 4, 3] |
---|
| 72 | if keyword_set(marges) THEN marge = marge+marges |
---|
| 73 | margebar = 1.*[marge[0]+1, marge[1]+1, marge[2]-8, marge[2]-6] |
---|
| 74 | if keyword_set(barmarges) then margebar = margebar+barmarges |
---|
| 75 | ENDIF ELSE BEGIN |
---|
| 76 | nocolorbar = keyword_set(nocolorbar) + keyword_set(nofill) + keyword_set(color_c) |
---|
| 77 | case typedessin of |
---|
| 78 | 'plt':marge = 1.*[6, 2, 4, 3] |
---|
| 79 | 'pltt':marge = 1.*[6+4*(type EQ 'xt'), 2, 4, 4] |
---|
| 80 | 'pltz':marge = 1.*[6, 2, 4, 3] |
---|
| 81 | else:marge = 1.*[6, 2, 4, 3] |
---|
| 82 | ENDCASE |
---|
| 83 | if keyword_set(marges) THEN marge = marge+marges |
---|
| 84 | if NOT keyword_set(barmarges) then barmarges = replicate(0, 4) |
---|
| 85 | barmarges[3] = -barmarges[3] |
---|
| 86 | margebar = 1.*[marge[0]+1, marge[1]+1, 2, 4]+barmarges |
---|
| 87 | marge = marge+[0, 0, 4, 0]*keyword_set(cb_title) |
---|
| 88 | IF keyword_set(direc) THEN $ |
---|
| 89 | marge = marge+[0, 0, 2, 0]*(strlowcase(direc) NE 't') |
---|
| 90 | marge = marge+[0, 0, 2, 0]*keyword_set(contour) |
---|
| 91 | marge = marge+[0, 0, 2, 0]*keyword_set(vecteur) |
---|
| 92 | if n_elements(lon1) NE 0 and n_elements(lon2) NE 0 $ |
---|
| 93 | and n_elements(lat1) NE 0 and n_elements(lat2) NE 0 then begin |
---|
| 94 | if keyword_set(type) then $ |
---|
| 95 | marge = marge+[0, 3*(type EQ 'yt' AND lon1 NE lon2), 0 $ |
---|
| 96 | , 2*(type NE 'yt' AND lat1 NE lat2)]*keyword_set(endpoints) $ |
---|
| 97 | ELSE marge = marge+[0, 0, 0, 2*(lat1 NE lat2)]*keyword_set(endpoints) |
---|
| 98 | endif |
---|
| 99 | marge = marge+[0, 0, 2+margebar[3], 0]*(1-keyword_set(nocolorbar)) |
---|
| 100 | ENDELSE |
---|
[2] | 101 | ;-------------------------------------------------------------- |
---|
| 102 | ; portrair ou landscape |
---|
| 103 | ;-------------------------------------------------------------- |
---|
[69] | 104 | IF NOT keyword_set(noerase) THEN BEGIN |
---|
| 105 | CASE 1 OF |
---|
| 106 | n_elements(portrait) NE 0:key_portrait = portrait |
---|
| 107 | n_elements(landscape) NE 0:key_portrait = 1-landscape |
---|
| 108 | ELSE: |
---|
| 109 | ENDCASE |
---|
| 110 | ENDIF |
---|
[2] | 111 | ;-------------------------------------------------------------- |
---|
[37] | 112 | ; Quel type de rapport d''aspect (sera ecrase si YXASPECT existe) |
---|
[2] | 113 | ;-------------------------------------------------------------- |
---|
[37] | 114 | case typedessin of |
---|
| 115 | 'plt':yaspect = 1.*(lat2-lat1)/(lon2-lon1) |
---|
| 116 | 'pltt':yaspect = 1. |
---|
| 117 | 'pltz':yaspect = .5 |
---|
| 118 | ELSE:yaspect = 1. |
---|
| 119 | endcase |
---|
[2] | 120 | ;------------------------------------------------------------- |
---|
| 121 | ; 2) calcul de !p.position |
---|
| 122 | ; cf calibre.pro. |
---|
| 123 | ;------------------------------------------------------------ |
---|
| 124 | ; |
---|
[37] | 125 | IF NOT keyword_set(small) then small = [1, 1, 1] |
---|
[2] | 126 | ; |
---|
[37] | 127 | if keyword_set(map) then rempli = 1 |
---|
[2] | 128 | ; |
---|
[37] | 129 | calibre, yaspect, marge, margebar, small, posfenetre, posbar, REMPLI = rempli, _extra = ex |
---|
[2] | 130 | ; |
---|
[37] | 131 | !p.position = posfenetre |
---|
[2] | 132 | ;------------------------------------------------------------ |
---|
| 133 | ; 3) ouverture de la fenetre graphique ou du postscript |
---|
| 134 | ;------------------------------------------------------------ |
---|
[37] | 135 | case 1 of |
---|
[2] | 136 | ; cas du premier dessin sur un postcript |
---|
[37] | 137 | keyword_set(post) AND !d.name ne 'PS':openps, _extra = ex |
---|
[2] | 138 | ; cas du premier dessin sur un ecran |
---|
[37] | 139 | keyword_set(post) EQ 0 AND keyword_set(noerase) EQ 0 $ |
---|
| 140 | AND !d.name ne 'PS' AND !d.name ne 'Z':BEGIN |
---|
| 141 | if not keyword_set(window) then window = 0 |
---|
[2] | 142 | ; pour l''utilisation de @ps, @oups et de @vzoom |
---|
[37] | 143 | if lmgr(/demo) EQ 0 then BEGIN ; on est en mode demo?? |
---|
| 144 | if !journal NE 0 then journal ; on ferme le journal s''il est ouvert |
---|
| 145 | homedir = isadirectory(io = homedir, title = 'Bad definition of homedir') |
---|
| 146 | def_myuniquetmpdir |
---|
| 147 | journal, myuniquetmpdir+'idlsave.pro' ; on en ouvre un nouveau |
---|
| 148 | help, /recall_commands, output = listecommande ; on recupere la derniere commande |
---|
| 149 | listecommande = strmid(strcompress(listecommande[1]), 2) |
---|
| 150 | journal, listecommande ; on l''ecrit dans le journal |
---|
| 151 | ENDIF |
---|
| 152 | windsize = givewindowsize() |
---|
| 153 | window, window, xsize = windsize[0], ysize = windsize[1], retain = 2, _extra = ex |
---|
[2] | 154 | ; qd on utilise des couleurs codees sur 24 bit, je n''arrive pas a stipuler la couleur du |
---|
| 155 | ; fond d''une fenetre a l'aide de !p.background, je suis oblige de faire cette bidouille!!! |
---|
| 156 | ; if !d.n_colors gt 256 then begin |
---|
| 157 | ; device, decomposed=1 |
---|
| 158 | ; !p.background='ffffff'x |
---|
| 159 | ; plot,[0],[0], /nodata, xstyle = 4, ystyle = 4 |
---|
| 160 | ; device, decomposed=0 |
---|
| 161 | ; endif |
---|
[37] | 162 | END |
---|
| 163 | ELSE: |
---|
| 164 | endcase |
---|
[2] | 165 | ;------------------------------------------------------------ |
---|
[37] | 166 | if n_elements(lct) NE 0 then lct, lct, _extra = ex |
---|
[2] | 167 | ;------------------------------------------------------------ |
---|
| 168 | |
---|
[37] | 169 | return |
---|
[2] | 170 | end |
---|