function bwmap1( X1, X2, Y1, Y2, filename, gnome)
%
%  The function bwmap1(X1,X2,Y1,Y2,filenames,gnome) reads the file
%  whose name is contained in the vector 'filename' and plots
%  a map contained in the coordinates X1<x<X1 and Y1<y<Y2, where
%  all the coordinates are in decimal degrees.
%  The format of the data contained in the file 'filename' can
%  be the same as the one contained in the SURFER's *.BLN files
%  For a nice plot of the sea too, I suggest using the subroutine
%  map2, which actually calls the present map1.
%  The bwmap1 PRODUCES A BLACK AND WHITE MAP, while the map1 a
%  colored map.
%
%  See also bwmap2, map1, map2, seamap
%
% ------------------------------------------------------------------
%  Written by Vassilis Zervakis (1995),
%  modified by Mike Sparrow (1997) whilst at
%             AINCO-Interocean, Madrid.
%-------------------------------------------------------------------
%
filenm = num2str(filename);
n = findstr('.',filenm);
dirs = findstr('\',filenm);
nn = length(dirs);
m = dirs(nn);
filebody = filenm(m+1:n-1);
eval(['load ' filenm]);
data = eval(filebody);
% --------read the file-------------------
[nn, mm] = size(data);
x = data(:,1);
y = data(:,2);
clear data;  
% --------find if the format is surfer-like------
i = 1;
surfer = 'no ';
while i <= nn-1,
   if (y(i)==0) | (y(i)==1) | (y(i)==2) | (y(i)==3) | (y(i)==4),
% ------- format is surfer-like-------------------
      surfer = 'yes';
      mpoints = x(i);
      if (y(i) == 2) | (y(i) == 4),
          fill(x(i+1:i+mpoints),y(i+1:i+mpoints),'k'); 
        else,
          fill(x(i+1:i+mpoints),y(i+1:i+mpoints),'w'); 
      end
      hold on
      i = i + mpoints;
    else
      i = i + 1;
   end
end
% ------- format is NOT surfer-like------------------- 
if (surfer == 'no '),
     fill(x,y,'w');
end

