[150] | 1 | ;+ |
---|
| 2 | ; @file_comments |
---|
| 3 | ; |
---|
| 4 | ; |
---|
| 5 | ; @categories |
---|
| 6 | ; |
---|
| 7 | ; |
---|
| 8 | ; @param MASK |
---|
| 9 | ; |
---|
| 10 | ; |
---|
| 11 | ; @param XF |
---|
| 12 | ; |
---|
| 13 | ; |
---|
| 14 | ; @param YF |
---|
| 15 | ; |
---|
| 16 | ; |
---|
| 17 | ; @param NX |
---|
| 18 | ; |
---|
| 19 | ; |
---|
| 20 | ; @param NY |
---|
| 21 | ; |
---|
| 22 | ; |
---|
[163] | 23 | ; @keyword COAST_COLOR {default=0} |
---|
[150] | 24 | ; The color of the coastline. |
---|
[163] | 25 | ; Default is black (0). |
---|
[150] | 26 | ; |
---|
[163] | 27 | ; @keyword COAST_THICK {default=1} |
---|
[150] | 28 | ; The thick of the trait to trace continents |
---|
| 29 | ; |
---|
[163] | 30 | ; @keyword XSEUIL {default=5} |
---|
[150] | 31 | ; To eliminate segments of coasts which are to big (which link points which can |
---|
| 32 | ; be close on the sphere but distant on the drawing). We delete all segments |
---|
[163] | 33 | ; whose the size surpass the size of the window following X/XSEUIL. |
---|
| 34 | ; But it can be to big if we do a big zoom or a little one for some |
---|
[150] | 35 | ; projections... We specify it the keyword thanks to this keyword! |
---|
| 36 | ; |
---|
| 37 | ; @keyword YSEUIL |
---|
| 38 | ; See XSEUIL |
---|
| 39 | ; |
---|
| 40 | ; @keyword _EXTRA |
---|
| 41 | ; Used to pass our keywords |
---|
| 42 | ; |
---|
| 43 | ; @returns |
---|
| 44 | ; |
---|
| 45 | ; |
---|
| 46 | ; @uses |
---|
| 47 | ; |
---|
| 48 | ; |
---|
| 49 | ; @restrictions |
---|
| 50 | ; |
---|
| 51 | ; |
---|
| 52 | ; @examples |
---|
| 53 | ; |
---|
| 54 | ; |
---|
| 55 | ; @history |
---|
| 56 | ; |
---|
| 57 | ; |
---|
| 58 | ; @version |
---|
| 59 | ; |
---|
| 60 | ; @todo |
---|
| 61 | ; Seb: remplir le header |
---|
| 62 | ; |
---|
| 63 | ;- |
---|
| 64 | ;--------------------------------------------------------- |
---|
[29] | 65 | PRO drawcoast_c, mask, xf, yf, nx, ny, COAST_COLOR = coast_color, COAST_THICK = coast_thick, YSEUIL = yseuil, XSEUIL = xseuil, _extra = ex |
---|
[114] | 66 | ; |
---|
| 67 | compile_opt idl2, strictarrsubs |
---|
| 68 | ; |
---|
[29] | 69 | @cm_4mesh |
---|
| 70 | IF NOT keyword_set(key_forgetold) THEN BEGIN |
---|
| 71 | @updatenew |
---|
| 72 | @updatekwd |
---|
| 73 | ENDIF |
---|
| 74 | ;--------------------------------------------------------- |
---|
[150] | 75 | tempsun = systime(1) ; For key_performance |
---|
[2] | 76 | ;--------------------------------------------------------- |
---|
| 77 | ; |
---|
[150] | 78 | ; We trace vertical segments: |
---|
[2] | 79 | ; |
---|
[29] | 80 | if NOT keyword_set(yseuil) then yseuil = 5. < (min([nx, ny])-2) |
---|
| 81 | distanceseuil = (!p.position[3]-!p.position[1])/yseuil |
---|
[150] | 82 | ; list: list of points i for which we will trace a segment between the point i,j-1 and i,j |
---|
| 83 | tempdeux = systime(1) ; For key_performance =2 |
---|
[29] | 84 | liste = where((mask+shift(mask, -1, 0)) EQ 1 $ |
---|
| 85 | AND ((xf-shift(xf, 0, 1))^2+(yf-shift(yf, 0, 1))^2) LE distanceseuil^2) |
---|
[2] | 86 | IF liste[0] NE -1 THEN BEGIN |
---|
[150] | 87 | ; We recuperate lx an dly which are indexes in a 2d array of points given by list |
---|
[2] | 88 | ly = liste/nx & lx = temporary(liste)-nx*ly |
---|
[150] | 89 | indice = where(ly NE 0) ; We do not take points concerning |
---|
[2] | 90 | if indice[0] NE -1 then begin |
---|
[150] | 91 | ; the first line because in this case, the point j-1 is undefined. |
---|
[2] | 92 | lx = lx[indice] & ly = ly[temporary(indice)] |
---|
[150] | 93 | ; Loop on concerned points and drawing of the segment. |
---|
| 94 | ; Comment: we use plots instead of plot because plots goes faster. |
---|
[2] | 95 | IF testvar(var = key_performance) EQ 2 THEN $ |
---|
| 96 | print, 'temps tracecote: determiner liste des points concernes par un trait vertical', systime(1)-tempdeux |
---|
[150] | 97 | tempdeux = systime(1) ; For key_performance =2 |
---|
[29] | 98 | for pt = 0L, n_elements(lx)-1 do BEGIN |
---|
[2] | 99 | i = lx[pt] & j = ly[pt] |
---|
| 100 | plots, [xf[i, j-1], xf[i, j]], [yf[i, j-1], yf[i, j]] $ |
---|
[29] | 101 | , color = coast_color, thick = coast_thick, /normal, _extra = ex |
---|
[2] | 102 | endfor |
---|
| 103 | IF testvar(var = key_performance) EQ 2 THEN $ |
---|
| 104 | print, 'temps tracecote: trace des traits verticaux', systime(1)-tempdeux |
---|
| 105 | endif |
---|
| 106 | ENDIF |
---|
| 107 | ; |
---|
[150] | 108 | ; For the drawing of horizontal segments , it is the same thing but we have to be careful if it is periodic. |
---|
[2] | 109 | ; |
---|
[150] | 110 | ; If it is periodic, we duplicate the first column and we put it at the end. |
---|
| 111 | ; (This is made not for the shift which is periodic by default but for the plots) |
---|
| 112 | tempdeux = systime(1) ; For key_performance =2 |
---|
[29] | 113 | if keyword_set(key_periodic) AND nx EQ jpi then begin |
---|
[2] | 114 | mask = [mask, mask[0, *]] |
---|
| 115 | xf = [xf, xf[0, *]] |
---|
| 116 | yf = [yf, yf[0, *]] |
---|
| 117 | nx = nx+1 |
---|
| 118 | ENDIF |
---|
[29] | 119 | if NOT keyword_set(xseuil) then xseuil = 5. < (min([nx, ny])-2) |
---|
| 120 | distanceseuil = (!p.position[2]-!p.position[0])/xseuil |
---|
| 121 | liste = where((mask+shift(mask, 0, -1)) EQ 1 $ |
---|
| 122 | AND ((xf-shift(xf, 1, 0))^2+(yf-shift(yf, 1, 0))^2) LE distanceseuil^2) |
---|
[2] | 123 | IF liste[0] NE -1 THEN BEGIN |
---|
| 124 | ly = liste/nx & lx = temporary(liste)-nx*ly |
---|
| 125 | indice = where(ly NE ny-1 AND lx NE 0) |
---|
| 126 | if indice[0] NE -1 then begin |
---|
[150] | 127 | ; We do not take points of the first column and of the last line (because we added artificially) |
---|
[2] | 128 | lx = lx[indice] & ly = ly[temporary(indice)] |
---|
| 129 | IF testvar(var = key_performance) EQ 2 THEN $ |
---|
| 130 | print, 'temps tracecote: determiner liste des points concernes par un trait horizontal', systime(1)-tempdeux |
---|
[150] | 131 | tempdeux = systime(1) ; For key_performance =2 |
---|
[29] | 132 | for pt = 0L, n_elements(lx)-1 do BEGIN |
---|
[2] | 133 | i = lx[pt] & j = ly[pt] |
---|
| 134 | plots, [xf[i-1, j], xf[i, j]], [yf[i-1, j], yf[i, j]] $ |
---|
[29] | 135 | , color = coast_color, thick = coast_thick, /normal, _extra = ex |
---|
[2] | 136 | endfor |
---|
| 137 | IF testvar(var = key_performance) EQ 2 THEN $ |
---|
| 138 | print, 'temps tracecote: trace des traits horizontaux', systime(1)-tempdeux |
---|
| 139 | endif |
---|
| 140 | endif |
---|
| 141 | ;--------------------------------------------------------- |
---|
| 142 | if keyword_set(key_performance) THEN print, 'temps drawcoast_c', systime(1)-tempsun |
---|
| 143 | return |
---|
| 144 | end |
---|