Global Index (all files) (short | long) | Local Index (files in subdir) (short | long)
hh = drawmapm(colr)
drawmapm This function draws a map on the current map axis. It gets the current frame and plots a map within the limits of the current map axis.
| This function calls | |
|---|---|
function hh = drawmapm(colr)
next_ax = get(gca, 'NextPlot');
set(gca, 'NextPlot', 'add');
if ~ismap(gca);
error('The current axes is not a map');
end
if (nargin<1); colr = 0*[1 1 1]; end;
global FRAME
frme = FRAME;
s = worldhi(frme(3:4), frme(1:2));
y_coasts = NaN;
x_coasts = NaN;
% For coastlines only
for i = 1:length(s);
y_coasts = [y_coasts; getfield(s(i), 'lat')];
x_coasts = [x_coasts; getfield(s(i), 'long')];
end
y_coasts = [y_coasts; NaN];
x_coasts = [x_coasts; NaN];
% For USA states only
%load usahi; [tem1, tem2] = extractm(stateline);
%y_coasts = [y_coasts; tem1; NaN];
%x_coasts = [x_coasts; tem2; NaN];
ylim = getm(gca, 'maplatlimit');
xlim = getm(gca, 'maplonlimit');
if ~isempty(find(xlim > 180));
xlim(find(xlim > 180)) = xlim(find(xlim > 180)) - 360;
keep = find(((x_coasts >= xlim(1)) | (x_coasts <= xlim(2))) & ...
((y_coasts >= ylim(1)) & (y_coasts <= ylim(2))));
else
keep = find(((x_coasts >= xlim(1)) & (x_coasts <= xlim(2))) & ...
((y_coasts >= ylim(1)) & (y_coasts <= ylim(2))));
end
xcnew = NaN*ones(size(x_coasts));
ycnew = NaN*ones(size(y_coasts));
xcnew(keep) = x_coasts(keep);
ycnew(keep) = y_coasts(keep);
zcnew = ycnew;
zcnew(~isnan(zcnew)) = 1;
[b] = plot3m(ycnew,xcnew,zcnew,'-k');
set(b,'linewidth',0.5, 'color', colr);
set(gca, 'NextPlot', next_ax);
if nargout
hh = b;
end