source: trunk/SRC/ToBeReviewed/TRIANGULATION/drawcoast_c.pro @ 495

Last change on this file since 495 was 495, checked in by pinsard, 10 years ago

fix thanks to coding rules; typo; dupe empty lines; trailing blanks

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