source: trunk/SRC/ToBeReviewed/TRIANGULATION/fillcornermask.pro @ 232

Last change on this file since 232 was 232, checked in by pinsard, 17 years ago

improvements/corrections of some *.pro headers

  • Property svn:keywords set to Id
File size: 3.4 KB
Line 
1;+
2;
3; @file_comments
4; To color cleanly continents
5;
6; @categories
7; Graphics
8;
9; @keyword _EXTRA
10; Used to pass keywords
11;
12; @keyword CONT_COLOR {default=(!d.n_colors - 1) < 255 => white}
13; The color of the continent.
14;
15; @uses
16; common.pro
17;
18; @history
19; Sebastien Masson (smasson\@lodyc.jussieu.fr)
20;                      8/8/2002
21;
22; @version
23; $Id$
24;
25;-
26;
27PRO fillcornermask, xin, yin, COINMONTE = coinmonte, COINDESCEND = coindescend $
28                    , CONT_COLOR = cont_color, INDICEZOOM = indicezoom $
29                    , _EXTRA = ex
30;
31  compile_opt idl2, strictarrsubs
32;
33@common
34;------------------------------------------------------------
35  if NOT keyword_set(coinmonte) AND NOT keyword_set(coindescend) then return
36;
37  tempsun = systime(1)          ; For key_performance
38;
39  IF NOT keyword_set(cont_color) THEN cont_color = (!d.n_colors-1) <  255
40;------------------------------------------------------------
41; definition of coordinates of points numbered 1,2,3,4,5,6 (see figures below)
42;------------------------------------------------------------
43;
44  x1 = reform(xin)
45  y1 = reform(yin)
46  IF (size(x1))[0] EQ 2 THEN x1 = x1 [*, 0]
47  IF (size(y1))[0] EQ 2 THEN y1 = y1 [0, *]
48  x2 = .5*(x1+shift(x1, -1))
49  y2 = .5*(y1+shift(y1, -1))
50  nx = n_elements(x1)
51  ny = n_elements(y1)
52;
53;
54;
55; Case land corner in ascent:
56;      2 land points in diagonal ascending with 2 ocean points on the descendant diagonal.
57;
58;                     3
59;     t(i+nx)=1    u(i+nx)       t(i+nx+1)=0
60;                     |      \
61;                     |         \
62;         1           |            \   4
63;       v(i)---------f(i)------------v(i+1)
64;           \         |
65;              \      |
66;                 \   |
67;      t(i)=0       2 u(i)          t(i+1)=1
68;
69;
70  if keyword_set(coinmonte) then BEGIN
71    if coinmonte[0] NE -1 then BEGIN
72      iup = coinmonte MOD nx
73      jup = coinmonte/nx
74      for id = 0, n_elements(coinmonte)-1 do BEGIN
75        i = iup[id]
76        j = jup[id]
77        IF i NE nx-1 AND j NE ny-1 THEN BEGIN
78          polyfill, [x1[i], x2[i], x2[i], x1[i+1], x1[i]] $
79            , [y2[j], y1[j], y1[j+1], y2[j], y2[j]] $
80            , color = cont_color, _extra = ex
81        ENDIF
82      endfor
83    endif
84  endif
85;------------------------------------------------------------
86; Case land corner in descent:
87;      2 land points in diagonal descending with 2 ocean points on the ascendant diagonal.
88;
89;                     4
90;     t(i+nx)=1    u(i+nx)       t(i+nx+1)=0
91;                /    |
92;             /       |
93;          /        3 |                5
94;       v(i)---------f(i)------------v(i+1)
95;         1           |            /
96;                     |        /
97;                     |    /
98;      t(i)=0      2 u(i)          t(i+1)=1
99;
100  if keyword_set(coindescend) then BEGIN
101    if coindescend[0] NE -1 then begin
102      idw = coindescend MOD nx
103      jdw = coindescend/nx
104      for id = 0, n_elements(coindescend)-1 do BEGIN
105        i = idw[id]
106        j = jdw[id]
107        IF i NE nx-1 AND j NE ny-1 THEN BEGIN
108          polyfill, [x1[i], x2[i], x2[i], x1[i+1], x1[i]] $
109            , [y2[j], y1[j+1], y1[j], y2[j], y2[j]] $
110            , color = cont_color, _extra = ex
111        ENDIF
112      endfor
113    endif
114  endif
115
116;------------------------------------------------------------
117  IF keyword_set(key_performance) THEN print, 'temps fillcornermask', systime(1)-tempsun
118;------------------------------------------------------------
119  return
120end
Note: See TracBrowser for help on using the repository browser.