[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 | ;------------------------------------------------------------ |
---|
| 48 | PRO placedessin, typedessin,posfenetre, posbar, BARMARGES = barmarges, NOCOLORBAR = nocolorbar, CONTOUR = contour $ |
---|
| 49 | , VECTEUR = vecteur, PORTRAIT = portrait, LANDSCAPE = landscape $ |
---|
| 50 | , YSURX = ysurx, PETITDESSIN = petitdessin, MARGES = marges, MAP = map $ |
---|
| 51 | , REMPLI = REMPLI, POST = post, WINDOW = window $ |
---|
| 52 | , ENDPOINTS = endpoints, TYPE = type, Basicmarges = basicmarges $ |
---|
| 53 | , NOERASE = noerase, LCT = lct, DIREC = direc, CB_TITLE = cb_title, _extra = ex |
---|
| 54 | @common |
---|
| 55 | ;------------------------------------------------------------- |
---|
| 56 | ; 1) determination de la taille des marges (unite=nbre de lignes ou colonnes) |
---|
| 57 | ; a gauche, a droite, en bas, en haut |
---|
| 58 | ; ATTENTION ds margebar le dernier element est le coint en haut a droite au |
---|
| 59 | ; lieu de la marge en haut |
---|
| 60 | ;------------------------------------------------------------- |
---|
| 61 | if n_elements(typedessin) EQ 0 then typedessin = 'autre' |
---|
| 62 | if keyword_set(basicmarges) then begin |
---|
| 63 | marge=1.*[6,2,4,3] |
---|
| 64 | margebar= replicate(0, 4) |
---|
| 65 | if keyword_set(marges) THEN marge = marge+marges |
---|
| 66 | ENDIF ELSE BEGIN |
---|
| 67 | if n_elements(ex) NE 0 then $ |
---|
| 68 | if (where(tag_names(ex) EQ 'NOCOULEUR'))[0] NE -1 then IF ex.NOCOULEUR EQ 1 THEN nocolorbar=1 |
---|
| 69 | case typedessin of |
---|
| 70 | 'plt':marge=1.*[6,2,4,3] |
---|
| 71 | 'pltt':marge=1.*[6+4*(type EQ 'xt'),2,4,4] |
---|
| 72 | 'pltz':marge=1.*[6,2,4,3] |
---|
| 73 | else:marge=1.*[6,2,4,3] |
---|
| 74 | ENDCASE |
---|
| 75 | if keyword_set(marges) THEN marge = marge+marges |
---|
| 76 | if NOT keyword_set(barmarges) then barmarges = replicate(0, 4) |
---|
| 77 | barmarges[3] = -barmarges[3] |
---|
| 78 | margebar=1.*[marge[0]+1,marge[1]+1,2,4]+barmarges |
---|
| 79 | marge=marge+[0,0,4,0]*keyword_set(cb_title) |
---|
| 80 | marge=marge+[0,0,2,0]*keyword_set(direc) |
---|
| 81 | marge=marge+[0,0,2,0]*keyword_set(contour) |
---|
| 82 | marge=marge+[0,0,2,0]*keyword_set(vecteur) |
---|
| 83 | if n_elements(lon1) NE 0 and n_elements(lon2) NE 0 $ |
---|
| 84 | and n_elements(lat1) NE 0 and n_elements(lat2) NE 0 then begin |
---|
| 85 | if keyword_set(type) then $ |
---|
| 86 | marge=marge+[0, 3*(type EQ 'yt' AND lon1 NE lon2),0 $ |
---|
| 87 | ,2*(type NE 'yt' AND lat1 NE lat2)]*keyword_set(endpoints) $ |
---|
| 88 | ELSE marge=marge+[0,0,0,2*(lat1 NE lat2)]*keyword_set(endpoints) |
---|
| 89 | endif |
---|
| 90 | marge=marge+[0,0,2+margebar[3],0]*(1-keyword_set(nocolorbar)) |
---|
| 91 | ENDELSE |
---|
| 92 | ;-------------------------------------------------------------- |
---|
| 93 | ; portrair ou landscape |
---|
| 94 | ;-------------------------------------------------------------- |
---|
| 95 | if n_elements(portrait) NE 0 then key_portrait=portrait $ |
---|
| 96 | else if key_portrait ne 1 then key_portrait=0 |
---|
| 97 | if n_elements(landscape) then key_portrait=1-landscape |
---|
| 98 | ;-------------------------------------------------------------- |
---|
| 99 | ; Quel type de rapport d''aspect (sera ecrase si YSURX existe) |
---|
| 100 | ;-------------------------------------------------------------- |
---|
| 101 | case typedessin of |
---|
| 102 | 'plt':yaspect=1.*(lat2-lat1)/(lon2-lon1) |
---|
| 103 | 'pltt':yaspect= 1. |
---|
| 104 | 'pltz':yaspect=.5 |
---|
| 105 | ELSE:yaspect= 1. |
---|
| 106 | endcase |
---|
| 107 | ;------------------------------------------------------------- |
---|
| 108 | ; 2) calcul de !p.position |
---|
| 109 | ; cf calibre.pro. |
---|
| 110 | ;------------------------------------------------------------ |
---|
| 111 | ; |
---|
| 112 | IF NOT keyword_set(petitdessin) then petitdessin = [1, 1, 1] |
---|
| 113 | ; |
---|
| 114 | if keyword_set(map) then rempli = 1 |
---|
| 115 | ; |
---|
| 116 | calibre,yaspect,marge,margebar,petitdessin,posfenetre, posbar,YSURX=ysurx,REMPLI=rempli, _extra = xe |
---|
| 117 | ; |
---|
| 118 | !p.position=posfenetre |
---|
| 119 | ;------------------------------------------------------------ |
---|
| 120 | ; 3) ouverture de la fenetre graphique ou du postscript |
---|
| 121 | ;------------------------------------------------------------ |
---|
| 122 | case 1 of |
---|
| 123 | ; cas du premier dessin sur un postcript |
---|
| 124 | keyword_set(post) AND !d.name ne 'PS':openps, _extra = ex |
---|
| 125 | ; cas du premier dessin sur un ecran |
---|
| 126 | keyword_set(post) EQ 0 AND keyword_set(noerase) EQ 0 $ |
---|
| 127 | AND !d.name ne 'PS' AND !d.name ne 'Z':BEGIN |
---|
| 128 | if not keyword_set(window) then window=0 |
---|
| 129 | ; pour l''utilisation de @ps, @oups et de @vzoom |
---|
| 130 | if lmgr(/demo) EQ 0 then BEGIN ; on est en mode demo?? |
---|
| 131 | if !journal NE 0 then journal ; on ferme le journal s''il est ouvert |
---|
| 132 | homedir = isadirectory(io = homedir, title = 'Bad definition of homedir') |
---|
| 133 | journal, homedir+'idlsave.pro' ; on en ouvre un nouveau |
---|
| 134 | help, /recall_commands, output = listecommande ; on recupere la derniere commande |
---|
| 135 | listecommande = strmid(strcompress(listecommande[1]), 2) |
---|
| 136 | printf, !journal, listecommande ; on l''ecrit dans le journal |
---|
| 137 | ENDIF |
---|
| 138 | windsize = givewindowsize() |
---|
| 139 | window, window, xsize = windsize[0], ysize = windsize[1], retain = 2, _extra = ex |
---|
| 140 | ; qd on utilise des couleurs codees sur 24 bit, je n''arrive pas a stipuler la couleur du |
---|
| 141 | ; fond d''une fenetre a l'aide de !p.background, je suis oblige de faire cette bidouille!!! |
---|
| 142 | ; if !d.n_colors gt 256 then begin |
---|
| 143 | ; device, decomposed=1 |
---|
| 144 | ; !p.background='ffffff'x |
---|
| 145 | ; plot,[0],[0], /nodata, xstyle = 4, ystyle = 4 |
---|
| 146 | ; device, decomposed=0 |
---|
| 147 | ; endif |
---|
| 148 | END |
---|
| 149 | ELSE: |
---|
| 150 | endcase |
---|
| 151 | ;------------------------------------------------------------ |
---|
| 152 | if n_elements(lct) NE 0 then lct, lct |
---|
| 153 | ;------------------------------------------------------------ |
---|
| 154 | |
---|
| 155 | return |
---|
| 156 | end |
---|