% CIRCLE_REPLAY
%
%    B. A. Moran, 18-May-1998

%    Copyright (C) 1995-1998
%    Massachussetts Institute of Technology
%    Sea Grant AUV Laboratory
%    $Id $

if exist( 'm_lbl_sr1' )
    					% use slants directly
    chn = [m_lbl_sr1 m_lbl_sr2 m_lbl_sr3 m_lbl_sr4];
    ind = find( any(data(:,chn)' > 0)' );
    slnt = data(ind,chn);
    if exist( 'xpn' ) ~= 1
	xpn = o2_xpndr( start );
    end

elseif exist( 'm_lbl_1t' ) == 1
					% calc slant from tt's
    chn = [m_lbl_1t m_lbl_2t m_lbl_3t m_lbl_4t];
    ind = find( any(data(:,chn)' > 0)' );
    if exist( 'xpn' ) ~= 1
	xpn = o2_xpndr( start );
    end
    slnt = 1520*(data(ind,chn) - ...
	ones(length(ind),length(chn))*diag(xpn(:,4)))/2;
    slnt( find(slnt<0) ) = NaN;

else
    errmsg( 'No LBL channels parsed' );
end

clrs = get( gca, 'colororder' );

for ii = 1:length(ind)

    circle( xpn(1,2), xpn(1,1), slnt(ii,1), clrs(1,:) );
    hold on
    circle( xpn(2,2), xpn(2,1), slnt(ii,2), clrs(2,:) );
    circle( xpn(3,2), xpn(3,1), slnt(ii,3), clrs(3,:) );
    circle( xpn(4,2), xpn(4,1), slnt(ii,4), clrs(4,:) );
    hold off

    set( gca, 'dataaspectratio', [1 1 1] );
    set( gca, 'xlim', [4400 5200], 'ylim', [4100 4900] );
    o2_xpndr( xpn );

    disp( sprintf('% 8.2f, LBL %3d: press any key ...', time(ind(ii)), ii) )
    pause
end
