% GUIeditmap
% Function for the MODIS GUI
% Copyright by Jasmine S Nahorniak, Oregon State University. 
% Mar 1 2000

function GUIeditmap(mapfig);

% north latitude
nlat=str2num(get(findobj('Tag','EditText8'),'String'));
% south latitude
slat=str2num(get(findobj('Tag','EditText9'),'String'));
% west longitude
wlon=str2num(get(findobj('Tag','EditText10'),'String'));
% east longitude
elon=str2num(get(findobj('Tag','EditText11'),'String'));
% center latitude
clat=str2num(get(findobj('Tag','EditText13'),'String'));
% center longitude
clon=str2num(get(findobj('Tag','EditText14'),'String'));

% title
maptitle=get(findobj('Tag','EditText2'),'String');


figure(mapfig)  

% find current map limits
currlats=getm(gca,'flatlimit');
currlons=getm(gca,'flonlimit');
currorigin=getm(gca,'origin');

if slat~=currlats(1) | nlat~=currlats(2) | wlon~=currlons(1) |     elon~=currlons(2),
    setm(gca,'flatlimit',[slat nlat],'maplatlimit',[slat nlat], ...
         'flonlimit',[wlon elon],'maplonlimit',[wlon elon]);
end

projectype=getm(gca,'mapprojection');
if projectype(1:3)=='glo',
    view(clon+90,clat)
else
    if currorigin(1)~=clat | currorigin(2)~=clon,
      setm(gca,'origin',[clat clon 0])
    end
end

hh=title(maptitle,'Color','k');
set(hh,'Tag','Maptitle');

