Global Index (all files) (short | long) | Local Index (files in subdir) (short | long)
hh = drawcoasts ( elev, colr ) ;
function hh = drawcoasts ( elev, colr ) ; script to overlay a rectangular continent map on the graphics window. INPUT ARGUMENTS: elev : elevation for land (over or under data) colr : color to fill the continents with
| This function calls | |
|---|---|
function hh = drawcoasts ( elev, colr ) ;
% lcst : linetype for coastlines (default is COASTTYPE,' ' = default)
% lgrd : linetype for gridlines (default is COASTGRID, ' ' = default)
% lbox : linetype for frame box (default: '-k', '' or 0 to skip)
% gridx : grid_spacing in x direction (default is GRDX_SPACING)
% gridy : grid_spacing in y direction (default is GRDY_SPACING)
%
% GLOBAL SETTINGS (most of which can be overridden by call arguments)
%
% FRAME : plotting boundaries (see also frame)
% COASTWIDTH : Coastline width
% COASTTYPE : coastline type, set to 0 or '' for no coast
% COASTGRID : grid line stype, set to 0 or '' for no gridline
% GRDX_SPACING: longitudinal grid spacing
% GRDY_SPACING: latitudinal grid spacing
%
% SEE ALSO : frame, polar_coasts
%---------------------------------------------- Alexis Lau (May 1991)
% major modification for version 4.X Alexis Lau (July 1993)
% rewritten Alexis Lau (Feb 1994)
%
% Added "sort" to the yticks definition in the grid lines specification.
% MATLAB 5 needs the ticks to increase monotonically.
% Todd Mitchell, July 1997
%
% Same is true for the xticks, added sort(xtickts)
% Christian Bantzer, 10/3/97
global FRAME COASTWIDTH COASTTYPE COASTGRID GRDX_SPACING GRDY_SPACING
global USE_LANDMASK
global x_coasts y_coasts
if USE_LANDMASK;
landmask;
% return;
end
% set parameters
lcst = ' '; end;
lgrd = ' '; end;
lbox = ' '; end
gridx = GRDX_SPACING; end
gridy = GRDY_SPACING; end
if strcmp(lcst,' '); lcst='-k'; end
if strcmp(lgrd,' '); lgrd=':k'; end
if strcmp(lbox,' '); lbox='-k'; end
%-------------------------------------------------------------------
% make sure plotting in the preset frame
% frame;
% map is superimposed, will not affect existing display
push_hold;
% frame box
xl=get(gca,'xlim'); yl=get(gca,'ylim');
% xl = FRAME(1:2); yl = FRAME(3:4);
x0=xl(1); x1=xl(2); y0=yl(1); y1=yl(2);
% if lbox; plot([x0 x0 x1 x1 x0],[y0 y1 y1 y0 y0],lbox); end;
% grid lines
if ~USE_LANDMASK
xticks = sort([ 0:-gridx:x0 gridx:gridx:x1 ]);
yticks = sort( [ 0:-gridy:y0 gridy:gridy:y1 ] );
manual_ticks('x',xticks,label_eastwest(xticks));
manual_ticks('y',yticks,label_northsouth(yticks));
end
if lgrd
vline(xticks,lgrd, FRAME(3:4));
hline(yticks,lgrd);
end;
% coastlines
if lcst;
ll = coast;
% x = []; y = [];
% nt1 = floor((x0+180)/360); nt2 = floor((x1+180-1.e-9)/360);
% for it = nt1:nt2;
xtmp=ll(:,2)'; ytmp=ll(:,1)';
% xtmp(xtmp < 0) = xtmp(xtmp<0)+360;
size(xtmp)
size(ytmp)
% xy = find ( ~(isinrange(xtmp,xl) & isinrange(ytmp,yl)) );
% xtmp(xy)=nan*ones(size(xy)); ytmp(xy)=nan*ones(size(xy));
% x = [ x nan xtmp ]; y = [ y nan ytmp ];
% end;
h=fill3(xtmp,ytmp,elev*ones(size(xtmp)),colr);
end;
pop_hold;
if nargout==1; hh=h; end