function basema2(colors, isobaths, gnome)
%
% the function basema2(colors, isobaths, gnome) is used by the ARPRO
% software as an interface used to input the desired map limits
% the subroutine basemap that will create a map to be overlayed 
% by float tracks.
% The input strings colors and isobaths, determine what kind of
% map will be plotted: If
%   colors = 'yes',    the map will have yellow land and cyan sea
%                      and blue isobaths (if required).
%   colors = 'no ',    the map will have white land and black sea
%                      and yellow isobaths (if required). However,
%                      in printing, land and sea will exchange colors.
%   isobaths = 'yes',  there will be bathymetry included.
%   isobaths = 'no ',  there won't be bathymetry included.
%
%   gnome = 'big',      normal map.
%   gnome = 'wee',      smaller map for summary plot
%
%  Also, it allows the setting of the step for which there will be
%  a (+) put on the floats to be overlaid.
% -------------------------------------------------------------
%  Written by Vassilis Zervakis, in February 1996,
%  modified by Mike Sparrow in June 1997,
%             for AINCO - Interocean, Madrid, Spain
%                              Jan. '98
%--------------------------------------------------------------
%
global minlat maxlat minlon maxlon mapset
global flstep linecolor startsymbol startcolor
global stepsymbol stepcolor
global COASTPATH BATHYPATH 
%
COASTPATH
BATHYPATH
h1 = figure('Name','Selecting Map Limits',...
            'NumberTitle','off',...
            'Menubar','none',...
            'Units','normalized',...
            'Position',[0.05 0.1 0.9 0.8],...
            'Color',[0.45 0.45 0.45]);
if mapset == [],
 minlat = 0
 maxlat = 0
 minlon = 0
 maxlon = 0
end
pos = [ .1, .69, .20, .05 ];
uimm(1) = uicontrol('style','text',...
                    'string','Minimum Latitude',...
                    'enable','off',...
                    'horizontalalignment','left',...
                    'backgroundcolor',[1 1 1],...
                    'Units','normalized',...
                    'Position',pos);
uimm(2) = uicontrol('style','edit',...
                    'enable','on',...
                    'string',num2str(minlat),...
                    'BackgroundColor',[.75 .75 .75],...
                    'Callback',['global minlat,',...
                    'minlat = str2num(get(gco,''string''));'],...
                    'Units','normalized',...
                    'Position',[pos(1)+pos(3),pos(2),.08,pos(4)]);
pos = [ .4, .69, .20, .05 ];
uimm(3) = uicontrol('style','text',...
                    'string','Maximum Latitude',...
                    'enable','off',...
                    'horizontalalignment','left',...
                    'backgroundcolor',[1 1 1],...
                    'Units','normalized',...
                    'Position',pos);
uimm(4) = uicontrol('style','edit',...
                    'enable','on',...
                    'string',num2str(maxlat),...
                    'BackgroundColor',[.75 .75 .75],...
                    'Callback',['global maxlat,',...
                    'maxlat = str2num(get(gco,''string''));'],...
                    'Units','normalized',...
                    'Position',[pos(1)+pos(3),pos(2),.08,pos(4)]);
pos = [ .1, .60, .20, .05 ];
uimm(5) = uicontrol('style','text',...
                    'string','Minimum Longitude',...
                    'enable','off',...
                    'horizontalalignment','left',...
                    'backgroundcolor',[1 1 1],...
                    'Units','normalized',...
                    'Position',pos);
uimm(6) = uicontrol('style','edit',...
                    'enable','on',...
                    'string',num2str(minlon),...
                    'BackgroundColor',[.75 .75 .75],...
                    'Callback',['global minlon,',...
                    'minlon = str2num(get(gco,''string''));'],...
                    'Units','normalized',...
                    'Position',[pos(1)+pos(3),pos(2),.08,pos(4)]);
pos = [ .4, .60, .20, .05 ];
uimm(7) = uicontrol('style','text',...
                    'string','Maximum Longitude',...
                    'enable','off',...
                    'horizontalalignment','left',...
                    'backgroundcolor',[1 1 1],...
                    'Units','normalized',...
                    'Position',pos);
uimm(8) = uicontrol('style','edit',...
                    'enable','on',...
                    'string',num2str(maxlon),...
                    'BackgroundColor',[.75 .75 .75],...
                    'Callback',['global maxlon,',...
                    'maxlon = str2num(get(gco,''string''));'],...
                    'Units','normalized',...
                    'Position',[pos(1)+pos(3),pos(2),.08,pos(4)]);
pos = [0.71,0.75,0.1,0.05];
uimm(50) = uicontrol('style','pushbutton',...
                     'string','NE.Atlantic',...
                     'units','normalized',...
                     'Callback',['minlat = 20,',...
                                 'maxlat = 50,',...
                                 'minlon = -30,',...
                                 'maxlon = 0,',...
                                 'mapset = 1,',...
                                 'basema2(''',colors,''',''',isobaths,''',''',gnome,''')'],...
                     'Position',pos);
pos = [0.73,0.68,0.1,0.05];
uimm(51) = uicontrol('style','pushbutton',...
                     'string','NW.Atlantic',...
                     'units','normalized',...
                     'Callback',['minlat = 0,',...
                                 'maxlat = 60,',...
                                 'minlon = -100,',...
                                 'maxlon = -30,',...
                                 'mapset = 1,',...
                                 'basema2(''',colors,''',''',isobaths,''',''',gnome,''')'],...
                     'Position',pos);
pos = [0.75,0.61,0.1,0.05];
uimm(52) = uicontrol('style','pushbutton',...
                     'string','S.Atlantic',...
                     'units','normalized',...
                     'Callback',['minlat = -60,',...
                                 'maxlat = 0,',...
                                 'minlon = -70,',...
                                 'maxlon = 20,',...
                                 'mapset = 1,',...
                                 'basema2(''',colors,''',''',isobaths,''',''',gnome,''')'],...
                     'Position',pos);
pos = [0.77,0.54,0.1,0.05];
uimm(53) = uicontrol('style','pushbutton',...
                     'string','Mediterr.',...
                     'units','normalized',...
                     'Callback',['minlat = 30,',...
                                 'maxlat = 50,',...
                                 'minlon = -10,',...
                                 'maxlon = 40,',...
                                 'mapset = 1,',...
                                 'basema2(''',colors,''',''',isobaths,''',''',gnome,''')'],...
                     'Position',pos);

%
% ---- Determine the color of the float track ----------------
pos = [ .1, .37, .5, .04 ];
uimm(9) = uicontrol('style','text',...
                    'string','Color of the Float track : ',...
                    'enable','off',...
                    'horizontalalignment','left',...
                    'backgroundcolor',[1 1 1],...
                    'Units','normalized',...
                    'Position',pos);
% ----Determine the color of the float track--------------------------
pos(1) = pos(1) + pos(3);
pos(3) = 0.1;
if (gnome == 'wee'),
linecolor = 'w';
else,
linecolor = 'r';
end
uimm(10) = uicontrol('style','popup',...
                    'enable','on',...
                    'string','white|yellow|magenta|red|green|blue|black',...
                    'BackgroundColor',[.75 .75 .75],...
                    'Callback',['valu = get(gco,''Value''),',...
                                'global linecolor,',...
                                'linecolor = setcolor(valu)'],...
                    'Units','normalized',...
                    'Position',pos);
% ---- Determine the characteristics of plotting the ----------------
% ----   step on which we'll put symbols on the float tracks --------
flstep = 50;
pos = [ .1, .3, .03, .04 ];
uimm(11) = uicontrol('style','text',...
                    'string','A ',...
                    'enable','off',...
                    'horizontalalignment','left',...
                    'backgroundcolor',[1 1 1],...
                    'Units','normalized',...
                    'Position',pos);
% ----Determine the color of the symbol ------------------------------
pos(1) = pos(1) + pos(3);
pos(3) = 0.1;
if (gnome == 'wee'),
stepcolor = 'w';
else,
stepcolor = 'r';
end
uimm(12) = uicontrol('style','popup',...
                    'enable','on',...
                    'string','white|yellow|magenta|red|green|blue|black',...
                    'BackgroundColor',[.75 .75 .75],...
                    'Callback',['val = get(gco,''Value''),',...
                                'global stepcolor,',...
                                'stepcolor = setcolor(val)'],...
                    'Units','normalized',...
                    'Position',pos);
% ----Determine the symbol ------------------------------
pos(1) = pos(1) + pos(3);
pos(3) = 0.05;
stepsymbol = '+';
uimm(13)  = uicontrol('style','popup',...
                    'enable','on',...
                    'string','+|o|*|x',...
                    'BackgroundColor',[.75 .75 .75],...
                    'Callback',['val = get(gco,''Value''),',...
                                'global stepsymbol,',...
                                'stepsymbol = setsymbo(val)'],...
                    'Units','normalized',...
                    'Position',pos);
pos(1) = pos(1) + pos(3);
pos(3) = 0.4;
uimm(14) = uicontrol('style','text',...
                    'string',' symbol to be added on float tracks every',...
                    'enable','off',...
                    'horizontalalignment','left',...
                    'backgroundcolor',[1 1 1],...
                    'Units','normalized',...
                    'Position',pos);
% ----Determine the step --------------------------------------------
pos(1) = pos(1) + pos(3);
pos(3) = 0.05;
uimm(15) = uicontrol('style','edit',...
                    'enable','on',...
                    'string',num2str(flstep),...
                    'BackgroundColor',[.75 .75 .75],...
                    'Callback',['global flstep,',...
                    'flstep = str2num(get(gco,''string''))'],...
                    'Units','normalized',...
                    'Position',pos);
pos(1) = pos(1) + pos(3);
pos(3) = 0.1;
uimm(16) = uicontrol('style','text',...
                    'string',' days',...
                    'enable','off',...
                    'horizontalalignment','left',...
                    'backgroundcolor',[1 1 1],...
                    'Units','normalized',...
                    'Position',pos);
%
% ---- Determine the characteristics of plotting the ----------------
% ----   start point as well as the float track itself --------------
pos = [ .1, .23, .03, .04 ];
uimm(17) = uicontrol('style','text',...
                    'string','A ',...
                    'enable','off',...
                    'horizontalalignment','left',...
                    'backgroundcolor',[1 1 1],...
                    'Units','normalized',...
                    'Position',pos);
% ----Determine the color of the symbol ------------------------------
startsymbol = 'o';
pos(1) = pos(1) + pos(3);
pos(3) = 0.1;
uimm(18) = uicontrol('style','popup',...
                    'enable','on',...
                    'string','white|yellow|magenta|red|green|blue|black',...
                    'BackgroundColor',[.75 .75 .75],...
                    'Callback',['val = get(gco,''Value''),',...
                                'global startcolor,',...
                                'startcolor = setcolor(val)'],...
                    'Units','normalized',...
                    'Position',pos);
% ----Determine the symbol ------------------------------
if (gnome == 'wee'),
startcolor = 'w';
else,
startcolor = 'r';
end

pos(1) = pos(1) + pos(3);
pos(3) = 0.05;
uimm(19)  = uicontrol('style','popup',...
                    'enable','on',...
                    'string','+|o|*|x',...
                    'BackgroundColor',[.75 .75 .75],...
                    'Callback',['val = get(gco,''Value''),',...
                                'global startsymbol,',...
                                'startsymbol = setsymbo(val)'],...
                    'Units','normalized',...
                    'Position',pos);
pos(1) = pos(1) + pos(3);
pos(3) = 0.4;
uimm(20) = uicontrol('style','text',...
                    'string',' symbol should define the launching site.',...
                    'enable','off',...
                    'horizontalalignment','left',...
                    'backgroundcolor',[1 1 1],...
                    'Units','normalized',...
                    'Position',pos);
%
%----------READY TO PLOT ...------------------------------
%
figure(h1);
pos = [ 0.1, 0.1, 0.2, 0.05 ];
uimm(21) = uicontrol('style','pushbutton',...
                    'string','Plot',...
                    'Units','normalized',...
                    'Position',pos,...
                    'Callback',['global isobathy isolines,',...
                     'if isolines ~= [],',...
                     '    isobath2,',...
                     'end,',...
                     'basemap(''',colors,''',''',isobaths,''',''',gnome,''')']);
pos = [ 0.4, 0.1, 0.2, 0.05 ];
uimm(22) = uicontrol('style','pushbutton',...
                    'string','Quit',...
                    'Units','normalized',...
                    'Position',pos,...
                    'Callback','close');
if isobaths == 'yes',
  global isolines,
  setisoba ;
end
