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

Last change on this file since 370 was 327, checked in by pinsard, 16 years ago

modification of headers : mainly blanks around = sign for keywords in declaration of function and pro

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