%%% land_mask.m to fill land polygons for the region from ca.
%%% Cape Hatteras to Nova Scotia

load land_mask.mat

% Index for segments
idx=find(isnan(coast(:,1))==1);

%-- Define colors for polygon fills
% fillcolor=[0 .3 .1];  % Dark Green
% fillcolor=[1 1 1];  	% White
% fillcolor=[.5 .5 .5];  	% Gray 
fillcolor=[.8 .8 .8];  	% Light Gray 

bgc = get(gcf,'color');
if sum(bgc) < 1
 coastcolor=['w'];
else
 coastcolor=['k'];
end

%-- Define lat / lon boundaries for plot
% p=[-76 -68 35 42]; 

%--Region fills:

%-- North American land mass 
h=find(NAcoast(:,1) > p(1) & NAcoast(:,1) < p(2) & NAcoast(:,2) > p(3) & NAcoast(:,2) < p(4));
tfil=NAcoast(h,:);
[m n]=size(tfil);
%   Add top left,bottom left coordinates for fill
tfil((m+1),1) = p(1); tfil((m+1),2) = p(4);
tfil((m+2),1) = p(1); tfil((m+2),2) = p(3);  
fill(tfil(:,1),tfil(:,2),fillcolor);
hold on
plot(NAcoast(h,1),NAcoast(h,2),coastcolor);

%-- Long Island
fill(LongI(:,1),LongI(:,2),fillcolor);
plot(LongI(:,1),LongI(:,2),coastcolor);

%-- Vineyard + 
fill(Marthas_b(:,1),Marthas_b(:,2),fillcolor);	% big island
plot(Marthas_b(:,1),Marthas_b(:,2),coastcolor)
fill(Marthas_l(:,1),Marthas_l(:,2),fillcolor);	% little island
plot(Marthas_l(:,1),Marthas_l(:,2),coastcolor)
fill(SCCC(:,1),SCCC(:,2),fillcolor);		% South of Cape Cod Canal 
plot(SCCC(:,1),SCCC(:,2),coastcolor)

%-- Nantucket
fill(Nantucket(:,1),Nantucket(:,2),fillcolor);
plot(Nantucket(:,1),Nantucket(:,2),coastcolor)

%-- Narragansett Bay Islands
fill(NBIsl1(:,1),NBIsl1(:,2),fillcolor);
plot(NBIsl1(:,1),NBIsl1(:,2),coastcolor)
fill(NBIsl2(:,1),NBIsl2(:,2),fillcolor);
plot(NBIsl2(:,1),NBIsl2(:,2),coastcolor)
fill(NBIsl3(:,1),NBIsl3(:,2),fillcolor);
plot(NBIsl3(:,1),NBIsl3(:,2),coastcolor)


%-- Overlay other parts of coastline : up to idx(9)
%-- would include diamond shoals
t=[idx(3):idx(4)];
plot(coast(t,1),coast(t,2),coastcolor)
t=[idx(4):idx(5)];
plot(coast(t,1),coast(t,2),coastcolor)

axis(p);

%-- Re-establish axes
% set(gca,'box','on')
% set(gca,'linewidth',2);
% set(gca, 'YTick',[],'YTickLabels',[' '],'XTick',[],'XTickLabels',[' ']);
