addinsideprofile

PURPOSE ^

ADDINSIDEPROFILE - add apoint inside a profile

SYNOPSIS ^

function [A,numprofiles,numpoints,closed]=addinsideprofile(A,numprofiles,numpoints,closed,prevplot,root);

DESCRIPTION ^

ADDINSIDEPROFILE - add apoint inside a profile

   this script is used by expmaster as an elementary operation
   on an ARGUS profile

   Usage:
      [A,numprofiles,numpoints,closed]=addinsideprofile(A,numprofiles,numpoints,closed,prevplot,root)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [A,numprofiles,numpoints,closed]=addinsideprofile(A,numprofiles,numpoints,closed,prevplot,root);
0002 %ADDINSIDEPROFILE - add apoint inside a profile
0003 %
0004 %   this script is used by expmaster as an elementary operation
0005 %   on an ARGUS profile
0006 %
0007 %   Usage:
0008 %      [A,numprofiles,numpoints,closed]=addinsideprofile(A,numprofiles,numpoints,closed,prevplot,root)
0009         
0010     %some checks
0011     if numprofiles==0
0012         disp('no profile present')
0013         return
0014     end       
0015     if numpoints<2
0016         disp('at least two points are required')
0017         return
0018     end       
0019     hold on
0020     loop=1;
0021 
0022     %plot squares
0023     for i=1:numprofiles
0024         plot(A(i).x,A(i).y,'-rs','MarkerSize',10);
0025     end
0026 
0027     while loop
0028 
0029         %first step, select a segment
0030         title('click on a segment, RETURN to exit','FontSize',14)
0031         [xi,yi] = ginput(1);
0032 
0033         %first click
0034         if ~isempty(xi)
0035 
0036             %get the closest segment
0037             [profsel indsel]=closestsegment(A,numprofiles,xi,yi);
0038 
0039             %check that at least one segment exists
0040             if indsel==0
0041                 disp('at least two points in one profile are required')
0042                 return
0043             end
0044 
0045             %highlight selected segment
0046             plot([A(profsel).x(indsel) A(profsel).x(indsel+1)],[A(profsel).y(indsel) A(profsel).y(indsel+1)],'b-','MarkerSize',10);
0047 
0048             %next click
0049             title('click on the new point''s location, RETURN to exit','FontSize',14)
0050             [xi,yi,but] = ginput(1);
0051 
0052             %second click
0053             if ~isempty(xi)
0054 
0055                 %add point to A
0056                 A(profsel).x=[A(profsel).x(1:indsel,1); xi; A(profsel).x(indsel+1:end,1)];
0057                 A(profsel).y=[A(profsel).y(1:indsel,1); yi; A(profsel).y(indsel+1:end,1)];
0058                 numpoints=numpoints+1;
0059 
0060                 %plot new profile
0061                 undoplots(prevplot);
0062                 for i=1:numprofiles
0063                     plot(A(i).x,A(i).y,'-rs','MarkerSize',10);
0064                 end
0065 
0066             else
0067                 %RETURN->exit
0068                 return
0069             end
0070         else
0071             %RETURN-> exit
0072             return
0073         end
0074     end
0075 end

Generated on Sun 29-Mar-2009 20:22:55 by m2html © 2003