;+ ; ; @file_comments ; To color cleanly continents ; ; @categories ; Graphics ; ; @keyword _EXTRA ; Used to pass keywords ; ; @keyword CONT_COLOR {default=(!d.n_colors - 1) < 255 => white} ; The color of the continent. ; ; @uses ; common ; ; @history ; Sebastien Masson (smasson\@lodyc.jussieu.fr) ; 8/8/2002 ; ; @version ; $Id$ ; ;- PRO fillcornermask, xin, yin, COINMONTE=coinmonte, COINDESCEND=coindescend $ , CONT_COLOR=cont_color, INDICEZOOM=indicezoom $ , _EXTRA=ex ; compile_opt idl2, strictarrsubs ; @common ;------------------------------------------------------------ if NOT keyword_set(coinmonte) AND NOT keyword_set(coindescend) then return ; tempsun = systime(1) ; For key_performance ; IF NOT keyword_set(cont_color) THEN cont_color = (!d.n_colors-1) < 255 ;------------------------------------------------------------ ; definition of coordinates of points numbered 1,2,3,4,5,6 (see figures below) ;------------------------------------------------------------ ; x1 = reform(xin) y1 = reform(yin) IF (size(x1))[0] EQ 2 THEN x1 = x1 [*, 0] IF (size(y1))[0] EQ 2 THEN y1 = y1 [0, *] x2 = .5*(x1+shift(x1, -1)) y2 = .5*(y1+shift(y1, -1)) nx = n_elements(x1) ny = n_elements(y1) ; ; ; ; Case land corner in ascent: ; 2 land points in diagonal ascending with 2 ocean points on the descendant diagonal. ; ; 3 ; t(i+nx)=1 u(i+nx) t(i+nx+1)=0 ; | \ ; | \ ; 1 | \ 4 ; v(i)---------f(i)------------v(i+1) ; \ | ; \ | ; \ | ; t(i)=0 2 u(i) t(i+1)=1 ; ; if keyword_set(coinmonte) then BEGIN if coinmonte[0] NE -1 then BEGIN iup = coinmonte MOD nx jup = coinmonte/nx for id = 0, n_elements(coinmonte)-1 do BEGIN i = iup[id] j = jup[id] IF i NE nx-1 AND j NE ny-1 THEN BEGIN polyfill, [x1[i], x2[i], x2[i], x1[i+1], x1[i]] $ , [y2[j], y1[j], y1[j+1], y2[j], y2[j]] $ , color = cont_color, _extra = ex ENDIF endfor endif endif ;------------------------------------------------------------ ; Case land corner in descent: ; 2 land points in diagonal descending with 2 ocean points on the ascendant diagonal. ; ; 4 ; t(i+nx)=1 u(i+nx) t(i+nx+1)=0 ; / | ; / | ; / 3 | 5 ; v(i)---------f(i)------------v(i+1) ; 1 | / ; | / ; | / ; t(i)=0 2 u(i) t(i+1)=1 ; if keyword_set(coindescend) then BEGIN if coindescend[0] NE -1 then begin idw = coindescend MOD nx jdw = coindescend/nx for id = 0, n_elements(coindescend)-1 do BEGIN i = idw[id] j = jdw[id] IF i NE nx-1 AND j NE ny-1 THEN BEGIN polyfill, [x1[i], x2[i], x2[i], x1[i+1], x1[i]] $ , [y2[j], y1[j+1], y1[j], y2[j], y2[j]] $ , color = cont_color, _extra = ex ENDIF endfor endif endif ;------------------------------------------------------------ IF keyword_set(key_performance) THEN print, 'temps fillcornermask', systime(1)-tempsun ;------------------------------------------------------------ return end