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

Last change on this file since 114 was 114, checked in by smasson, 18 years ago

new compilation options (compile_opt idl2, strictarrsubs) in each routine

  • Property svn:executable set to *
File size: 4.0 KB
Line 
1;------------------------------------------------------------
2;------------------------------------------------------------
3;------------------------------------------------------------
4;+
5; NAME: FILLCORNERMASK
6;
7; PURPOSE: pour colorier proprement les continents! (c''est une longue
8; histoire...)
9;
10; CATEGORY: pour plt
11;
12; CALLING SEQUENCE: completecointerre
13;
14; INPUTS: non
15;
16; KEYWORD PARAMETERS:  _EXTRA
17;
18;        CONT_COLOR: the color of the continent. defaut value is
19;        (!d.n_colors - 1) < 255 => white
20;
21; OUTPUTS: non
22;
23; COMMON BLOCKS: common.pro
24;
25; SIDE EFFECTS:
26;
27; RESTRICTIONS:
28;
29; EXAMPLE:
30;
31; MODIFICATION HISTORY:Sebastien Masson (smasson@lodyc.jussieu.fr)
32;                      8/8/2002
33;-
34;------------------------------------------------------------
35;------------------------------------------------------------
36;------------------------------------------------------------
37PRO fillcornermask, xin, yin, COINMONTE = coinmonte, COINDESCEND = coindescend $           
38                    , CONT_COLOR = cont_color, INDICEZOOM = indicezoom $
39                    , _extra = ex
40;
41  compile_opt idl2, strictarrsubs
42;
43@common
44;------------------------------------------------------------
45  if NOT keyword_set(coinmonte) AND NOT keyword_set(coindescend) then return
46;
47  tempsun = systime(1)          ; pour key_performance
48;
49  IF NOT keyword_set(cont_color) THEN cont_color = (!d.n_colors-1) <  255   
50;------------------------------------------------------------
51; definition descoordonnees des points numerotes 1,2,3,4,5,6 cf. les
52; schemas en dessous!
53;------------------------------------------------------------
54;
55  x1 = reform(xin)
56  y1 = reform(yin)
57  IF (size(x1))[0] EQ 2 THEN x1 = x1 [*, 0]
58  IF (size(y1))[0] EQ 2 THEN y1 = y1 [0, *]
59  x2 = .5*(x1+shift(x1, -1))
60  y2 = .5*(y1+shift(y1, -1))
61  nx = n_elements(x1)
62  ny = n_elements(y1)
63;
64;
65;
66; cas coin terre en montee:
67;      2 points terre en diagonale montante avec 2 points mer sur
68;      la diagonale descendante.
69;
70;                     3   
71;     t(i+nx)=1    u(i+nx)       t(i+nx+1)=0
72;                     |      \
73;                     |         \
74;         1           |            \   4
75;       v(i)---------f(i)------------v(i+1)
76;           \         |
77;              \      |
78;                 \   |
79;      t(i)=0       2 u(i)          t(i+1)=1
80;
81;
82  if keyword_set(coinmonte) then BEGIN
83    if coinmonte[0] NE -1 then BEGIN
84      iup = coinmonte MOD nx
85      jup = coinmonte/nx
86      for id = 0, n_elements(coinmonte)-1 do BEGIN
87        i = iup[id]
88        j = jup[id]
89        IF i NE nx-1 AND j NE ny-1 THEN BEGIN
90          polyfill, [x1[i], x2[i], x2[i], x1[i+1], x1[i]] $
91            , [y2[j], y1[j], y1[j+1], y2[j], y2[j]] $
92            , color = cont_color, _extra = ex
93        ENDIF
94      endfor
95    endif
96  endif
97;------------------------------------------------------------
98; cas coin terre en descendante.:
99;      2 points terre en diagonale descendante avec 2 points mer sur
100;      la diagonale montante
101;
102;                     4
103;     t(i+nx)=1    u(i+nx)       t(i+nx+1)=0
104;                /    |       
105;             /       |         
106;          /        3 |                5
107;       v(i)---------f(i)------------v(i+1)
108;         1           |            /
109;                     |        /
110;                     |    /
111;      t(i)=0      2 u(i)          t(i+1)=1
112;
113  if keyword_set(coindescend) then BEGIN
114    if coindescend[0] NE -1 then begin
115      idw = coindescend MOD nx
116      jdw = coindescend/nx
117      for id = 0, n_elements(coindescend)-1 do BEGIN
118        i = idw[id]
119        j = jdw[id]
120        IF i NE nx-1 AND j NE ny-1 THEN BEGIN
121          polyfill, [x1[i], x2[i], x2[i], x1[i+1], x1[i]] $
122            , [y2[j], y1[j+1], y1[j], y2[j], y2[j]] $
123            , color = cont_color, _extra = ex
124        ENDIF
125      endfor
126    endif
127  endif
128
129;------------------------------------------------------------
130  IF keyword_set(key_performance) THEN print, 'temps fillcornermask', systime(1)-tempsun
131;------------------------------------------------------------
132  return
133end
Note: See TracBrowser for help on using the repository browser.