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

Last change on this file since 157 was 157, checked in by navarro, 18 years ago

header improvements + xxx doc

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