Changeset 150 for trunk/SRC/ToBeReviewed/POSTSCRIPT
- Timestamp:
- 08/09/06 12:12:54 (18 years ago)
- Location:
- trunk/SRC/ToBeReviewed/POSTSCRIPT
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SRC/ToBeReviewed/POSTSCRIPT/calibre.pro
r134 r150 3 3 ;------------------------------------------------------------ 4 4 ;+ 5 ; NAME: calibre 6 ; 7 ; PURPOSE:a partir d''un rapport d''aspect et des valeurs (en ligne de 8 ; characteres) des differentes marges, calcul posfenetre et posbar qui 9 ; servent a placer le dessin et la barre de couleur grace a 10 ; !p.position sur une feuille ou 11 ; sur une sortie ecran dont la fenetre a les memes proportions 12 ; 13 ; CATEGORY: positionnement du graphe 14 ; 15 ; CALLING SEQUENCE: 16 ; calibre, rapportyx,marge,margebar, smalldraw,posfenetre, posbar 17 ; 18 ; INPUTS: 19 ; rapportyx: rapport d''echelle entre la longueur de l''axe des 20 ; y et celle des x. par ex pour une carte xy, 21 ; rapportyx=(lat2-lat1)/(lon2-lon1) 22 ; 23 ; marge: vecteur de 4 elements contenant la taille des marges a gauche, 24 ; a droite, en bas et en haut devant entourer le graphe. tout est 25 ; mesure en lignes de characteres 26 ; 27 ; margebar: vecteur de 4 elements contenant la taille des marges a gauche, 28 ; a droite, en bas et -ATTENTION- le dernier element est cette fois-ci 29 ; la position de coin en haut a droite, devant entourer la barre de 30 ; couleur. tout est mesure en lignes de characteres 31 ; 32 ; smalldraw: 2 possiblites 33 ; un vecteur de 4 elements donnant (en portrait ou 34 ; en landscape) la position de cadre ds lequel doit rentrer le 35 ; dessin. cette position est donne par les coordonnes des 2 coins du 36 ; cadre: en bas a gauche et en haut a droite. elle s''exprime tjs 37 ; (pour un postscript ou une sortie ecran) en cm, l''origine etant le 38 ; coin en bas a gauche. 39 ; un vecteur de 3 elements donnant le nombre de colonnes a 40 ; faire de le dessin, le nombre de lignes et enfin le numero de la 41 ; case que doit occuper le dessin (cf matlab). par ex pour faire 6 42 ; dessin en 2 colonnes et 3 lignes et occuper la 4 eme case, small=[2,3,4] 43 ; 44 ; KEYWORD PARAMETERS: 45 ; 46 ; /REMPLI:oblige le dessin a occuper l'espace maximum definit 47 ; par smalldraw sans resperter le rapport y sur x. 48 ; 49 ; YXASPECT: force le rapport y sur x a prendre la valeur 50 ; rapportyx*yxaspect. ce mot cle est utile ds deux cas: 51 ; 1) yxaspect=1 : oblige rapportyx a etre bien respecte sinon 52 ; calibre se reserve le droit de changer un peu celui-ci dans 53 ; le cas ou le rapport d''aspect de small dessin est trop 54 ; different de celui de smalldraw. 55 ; 2) yxaspect=n : multiplie par n le rapport d''aspect donne par 56 ; defaut.par ex ds plt, rapportyx est calcule pour que le 57 ; repere soit orthonorme, pour avoir un repere ou l''axe des y 58 ; est 2 fois plus dilate que celui des y YXASPECT=2 5 ; @file_comments 6 ; From a rapport of aspect and values (in line of character) of different margins, 7 ; it calculate POSFENETRE and POSBAR which serve to place the drawing and the color 8 ; bar thanks to !p.position on a leaf or a screen output whose the window has the same 9 ; proportion. 10 ; 11 ; @categories 12 ; graphics 13 ; 14 ; 15 ; @param RAPPORTYX {in}{required} 16 ; Scale rapport between the lenght of the y axis and the x one. For example, 17 ; for an xy map: RAPPORTYX=(lat2-lat1)/(lon2-lon1) 18 ; 19 ; @param MARGE {in}{required} 20 ; Vector made of 4 elements containing the size of the left, right, up and 21 ; bottom margin having to surround the graph. All is measured in lines of characters. 22 ; 23 ; @param MARGEBAR {in}{required} 24 ; Vector made of 4 elements containing the size of the left, right and bottom 25 ; margin and -BEWARE- the last element is this time the positio of the right up 26 ; corner, having to surround the color bar. All is measured in lines of characters. 27 ; 28 ; @param SMALLDRAW {in}{required} 29 ; 2 possibilities: 30 ; It is vector made of 4 elements giving (in portrait or landscape) the position 31 ; of the frame in which the drawing must go in. This position is given by coordinates 32 ; of the 2 corners of the frame: in the left bottom and the right up. It is always 33 ; (for a postscript or a screen output) express in cm, the origin being the 34 ; left bottom corner. 35 ; It is a vector made of 3 elements giving the number of column to be done in the 36 ; drawing, the number of line and the number of the case the number have to occupy 37 ; (see matlab). For example, to do 6 drawing in 3 columns and 2 lines and occupy 38 ; the 4th case, small=[2,3,4] 39 ; 40 ; @keyword REMPLI 41 ; Force the drawing to occupy the biggest possible place defined by 42 ; SMALLDRAW without respect the rapport y on x. 43 ; 44 ; @keyword YXASPECT 45 ; Force the rapport y on x to take the value RAPPORTYX*YXASPECT. 46 ; This keyword can be used in 2 cases: 47 ; 1) YXASPECT=1 : force RAPPORTYX to be respected otherwise, Calibre take the 48 ; initiative to change it a little inthe case of the aspect rapport of SMALL 49 ; is too different of the one of SMALLDRAW. 50 ; 2) YXASPECT=n : multiply by n the aspect rapport given by default. 51 ; For example in plt, RAPPORTYX is calculated to the reference be orthonormal, 52 ; to have a reference where the y axis is 2 time bigger than the x one, YXASPECT=2. 59 53 ; 60 ; PORTRAIT et LANDSCAPE: mots cles plus utilises mais tjs fonctionnels 61 ; 62 ; OUTPUTS: 63 ; posfenetre: un vecteur de 4 elements contenant la position de 64 ; cadre contenant les legendes + le graphe en coordonnes 65 ; normalises. Rq: pour positionner le dessin il faut apres 66 ; l''appelle de calibre faire !p.position=posfenetre 67 ; 68 ; posbar: cf posfentre mais pour la barre de couleur. meme 69 ; remarque pour positionner la barre de couleur, !p.position=posbar 70 ; 71 ; COMMON BLOCKS: 72 ; common.pro 73 ; 74 ; SIDE EFFECTS: 75 ; 76 ; RESTRICTIONS: 77 ; 78 ; EXAMPLE: 79 ; 80 ; MODIFICATION HISTORY: Sebastien Masson (smasson@lodyc.jussieu.fr) 54 ; @keyword PORTRAIT 55 ; Force the page or the window to be in standing position. 56 ; 57 ; @keyword LANDSCAPE 58 ; Force the page or the window on the screen to be in lenthened position. 59 ; 60 ; @keyword _EXTRA 61 ; Used to pass your keywords 62 ; 63 ; @param POSFENETRE 64 ; It is a vector made of 4 elements containing the position of the frame 65 ; containing captions + the graph in normalized coordinates. 66 ; Comment: to position the drawing, we have to do !p.position=POSFENETRE 67 ; after the call of calibre. 68 ; 69 ; @param POSBAR 70 ; See POSFENTRE but for the color bar. Same comment to position the color bar, !p.position=POSBAR 71 ; 72 ; @uses 73 ; common.pro 74 ; 75 ; @history 76 ; Sebastien Masson (smasson@lodyc.jussieu.fr) 81 77 ; 11/12/98 78 ; 79 ; @version 80 ; $Id$ 82 81 ;- 83 82 ;------------------------------------------------------------ … … 98 97 ;--------------------------------------------------------- 99 98 ;------------------------------------------------------------ 100 tempsun = systime(1) ; pour key_performance99 tempsun = systime(1) ; For key_performance 101 100 ;------------------------------------------------------------- 102 101 if keyword_set(portrait) then key_portrait=1 … … 112 111 mipgsz = min(page_size, max = mapgsz) 113 112 ;------------------------------------------------------------ 114 ; choi x de Landscape ouPortrait113 ; choice of Landscape or Portrait 115 114 ;------------------------------------------------------------ 116 115 if n_elements(key_portrait) eq 0 then begin … … 119 118 endif 120 119 ;------------------------------------------------------------- 121 ; si smalldraw est compte comme dsmatlab120 ; If smalldraw is count like in matlab 122 121 ;------------------------------------------------------------- 123 122 if n_elements(smalldraw) EQ 3 then begin … … 136 135 endif 137 136 ;------------------------------------------------------------ 138 ; determination de la taille des characteres (!p.charsize)137 ; determination of the size of characters (!p.charsize) 139 138 ;------------------------------------------------------------ 140 139 nombre_de_mots_ds_titre = 60. … … 143 142 if !p.charsize gt 1 then !p.charsize=1 144 143 ;------------------------------------------------------------ 145 ; transfert de marge en cm144 ; transfert of margin in cm 146 145 ;------------------------------------------------------------ 147 146 cm=1.*!d.x_px_cm … … 149 148 margebar=1.* margebar * !d.y_ch_size * !p.charsize / cm 150 149 ;------------------------------------------------------------ 151 ; definition de la portion de feuille ou on dessine150 ; definition of the part of the leaf where we draw 152 151 ;------------------------------------------------------------ 153 152 if key_portrait eq 0 then begin … … 162 161 else rapportmax=1.*(small-marge[2]-marge[0])/(big-marge[3]-marge[1]) 163 162 ;------------------------------------------------------------ 164 ; si yxaspect n'est pas specifie on modifie la valeur de rapportyx pour que165 ; ca colle un peu plus aux proportions de la feuille163 ; If YXASPECT is not specified, we modify the value of RAPPORTYX 164 ; to it match better with the leaf's proportions. 166 165 ;------------------------------------------------------------ 167 166 if rapportyx le rapportmax then begin … … 183 182 endelse 184 183 ;------------------------------------------------------------ 185 ; dans le cas ou on fait unLandscape:184 ; in the case where we do a Landscape: 186 185 ;------------------------------------------------------------ 187 186 if key_portrait eq 0 then begin … … 214 213 endif $ 215 214 ;------------------------------------------------------------ 216 ; dans le cas ou on fait unportrait:215 ; In the case where we do a portrait: 217 216 ;------------------------------------------------------------ 218 217 else begin -
trunk/SRC/ToBeReviewed/POSTSCRIPT/ps.pro
r134 r150 3 3 ;------------------------------------------------------------ 4 4 ;+ 5 ; NAME:ps 5 ; @file_comments 6 ; Redirect the content of the graphic window in a postscript, 7 ; by redoing commands in the postscript's environment. 6 8 ; 7 ; PURPOSE:redirige le contenu de la fenetre graphique ds un postcript, 8 ; en reeffectuant les commandes ds l''environnement postscript. 9 ; @categories 10 ; utilities 11 ; 12 ; @restrictions 13 ; We use journal which allows to stock commands we pass. 9 14 ; 10 ; CATEGORY:pour faire un ps 15 ; @restrictions 16 ; Can break down if some wierd commands are passed... 17 ; Comment: we erase Syntax error, Illegal characters, comapatible 18 ; with oups, text_box... 11 19 ; 12 ; CALLING SEQUENCE:@ps 13 ; 14 ; INPUTS: 15 ; 16 ; KEYWORD PARAMETERS: 17 ;; 18 ; OUTPUTS: 19 ; 20 ; COMMON BLOCKS: 21 ; 22 ; SIDE EFFECTS: on utilise journal qui perment de stoker les commandes 23 ; que l''on passe. 24 ; 25 ; RESTRICTIONS:peut planter si des commandes bizarres sont passees... 26 ; rq: on efface les Syntax error, les Illegal character, commapatible 27 ; avec oups, text_box... 28 ; 29 ; EXAMPLE: 30 ; 31 ; MODIFICATION HISTORY: Sebastien Masson (smasson@lodyc.jussieu.fr) 20 ; @history 21 ; Sebastien Masson (smasson@lodyc.jussieu.fr) 32 22 ; 5/3/1999 33 23 ;- … … 36 26 ;------------------------------------------------------------ 37 27 ;------------------------------------------------------------ 38 ; il faut fermer le journal!28 ; We have to close the journal! 39 29 ;------------------------------------------------------------ 40 ;if !journal EQ 0 then begin41 ;print, 'Il n''y a pas de journal ouvert !!'42 ;GOTO, sortie30 if !journal EQ 0 then begin 31 print, 'Il n''y a pas de journal ouvert !!' 32 GOTO, sortie 43 33 journal 44 34 ;------------------------------------------------------------ 45 ; on complete le journal ...35 ; we complete the journal ... 46 36 ;------------------------------------------------------------ 47 ; on recupere le journal sous la forme d''un vecteur de string:37 ; We recuperate the journal as a vector of string : 48 38 vectjournal = getfile(myuniquetmpdir+'idlsave.pro') 49 ;FOR i = 0,n_elements(vectjournal)-1 DO print, vectjournal[i]39 FOR i = 0,n_elements(vectjournal)-1 DO print, vectjournal[i] 50 40 ;------------------------------------------------------------ 51 ; on coupe la derniere ligne qui est@ps41 ; We cut the last line which is \@ps 52 42 ;------------------------------------------------------------ 53 43 IF strpos(vectjournal[n_elements(vectjournal)-1],'@ps') ne -1 then $ 54 44 vectjournal = vectjournal[0:n_elements(vectjournal)-2 ] 55 45 ;------------------------------------------------------------ 56 ; on le corrige si besoin est...46 ; We correct it if needed... 57 47 ;------------------------------------------------------------ 58 48 for i = 0, n_elements(vectjournal)-1 do $ 59 49 if strpos(vectjournal[i],'text_box' ) EQ -1 then $ 60 50 vectjournal[i] = strtrim(strcompress(vectjournal[i]), 2) 61 ;FOR i = 0,n_elements(vectjournal)-1 DO print, vectjournal[i]62 ;2 li gnes sont identiques??51 FOR i = 0,n_elements(vectjournal)-1 DO print, vectjournal[i] 52 ;2 lines are identical ?? 63 53 for i = 0, n_elements(vectjournal)-2 do $ 64 54 if vectjournal[i] EQ vectjournal[i+1] then vectjournal[i] = ' ' 65 ;FOR i = 0,n_elements(vectjournal)-1 DO print, vectjournal[i]66 55 FOR i = 0,n_elements(vectjournal)-1 DO print, vectjournal[i] 56 ; 67 57 for i = 0, n_elements(vectjournal)-1 do BEGIN & $ 68 58 if strpos(vectjournal[i],'oups' ) NE -1 $ … … 70 60 OR strpos(vectjournal[i],'Illegal character' ) NE -1 $ 71 61 then BEGIN vectjournal[i] = ' ' & vectjournal[i-1] = ' ' & endif & endfor 72 ;FOR i = 0,n_elements(vectjournal)-1 DO print, vectjournal[i]62 FOR i = 0,n_elements(vectjournal)-1 DO print, vectjournal[i] 73 63 for i = 0, n_elements(vectjournal)-1 do BEGIN & $ 74 64 if strpos(strtrim(vectjournal[i], 1),'retall' ) EQ 0 $ … … 79 69 OR strpos(vectjournal[i],'print' ) NE -1 $ 80 70 then vectjournal[i] = ' ' & endfor 81 ;FOR i = 0,n_elements(vectjournal)-1 DO print, vectjournal[i]71 FOR i = 0,n_elements(vectjournal)-1 DO print, vectjournal[i] 82 72 for i = 0, n_elements(vectjournal)-1 do BEGIN & $ 83 73 if strpos(strtrim(vectjournal[i], 1),'plt' ) NE -1 THEN BEGIN & $ … … 86 76 vectjournal[i] = vectjournal[i]+',/noerase' & $ 87 77 ENDIF & endfor 88 ;FOR i = 0,n_elements(vectjournal)-1 DO print, vectjournal[i]78 FOR i = 0,n_elements(vectjournal)-1 DO print, vectjournal[i] 89 79 for i = 0, n_elements(vectjournal)-1 do BEGIN & $ 90 80 if strpos(vectjournal[i],'text_box' ) NE -1 then $ … … 92 82 vectjournal[i] = vectjournal[i]+strmid(vectjournal[i+1], 1) & endfor 93 83 94 ; on le complete pour le transformer en une procedure equivalente aplein2dessin95 ;vectjournal = ['reinitplt, /z,/invert' $84 ; We complete it to transform it in a procedure equivalent to plein2dessin 85 vectjournal = ['reinitplt, /z,/invert' $ 96 86 vectjournal = ['openps, infowidget= infowidget' $ 97 87 , vectjournal $ 98 88 ,'closeps, infowidget= infowidget' $ 99 89 ,'printps' ] 100 ;FOR i = 0,n_elements(vectjournal)-1 DO print, vectjournal[i]101 ; on reecritidlsave.pro90 FOR i = 0,n_elements(vectjournal)-1 DO print, vectjournal[i] 91 ; We rewrite idlsave.pro 102 92 putfile, myuniquetmpdir+'idlsave.pro', vectjournal 103 ; appl iqueidlsave93 ; apply idlsave 104 94 cd, current = curdir 105 95 cd, myuniquetmpdir 106 96 @idlsave 107 97 cd, curdir 108 ; on reouvre le journal et on y met les elements de 109 ; vectjournal sauf les 2 premieres lignes et les 3 dernieres lignes 98 ; We reopen the journal and we put in it all elements of vectjournal but the 2 first and the 3 last line. 110 99 journal, myuniquetmpdir+'idlsave.pro' 111 100 for i = 2, n_elements(vectjournal)-3 DO $
Note: See TracChangeset
for help on using the changeset viewer.