modifyposition

PURPOSE ^

MODIFYPOSITION - modify the prosition of a point of a profile

SYNOPSIS ^

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

DESCRIPTION ^

MODIFYPOSITION - modify the prosition of a point of a profile

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

   Usage:
      [A,numprofiles,numpoints,closed]=modifyposition(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]=modifyposition(A,numprofiles,numpoints,closed,prevplot,root);
0002 %MODIFYPOSITION - modify the prosition of a point of 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]=modifyposition(A,numprofiles,numpoints,closed,prevplot,root)
0009         
0010     %some checks
0011     if numprofiles==0
0012         disp('no profile present')
0013         return
0014     end
0015 
0016     hold on
0017     loop=1;
0018 
0019     %plot squares
0020     for i=1:numprofiles
0021         plot(A(i).x,A(i).y,'-rs','MarkerSize',10);
0022     end
0023 
0024     while loop
0025 
0026         %select a point to be modified
0027         title('click on the point to be modified, RETURN to exit','FontSize',14)
0028         [xi,yi] = ginput(1);
0029 
0030         if ~isempty(xi)
0031 
0032             %get the closest point
0033             [profsel indsel]=closestpoint(A,numprofiles,xi,yi);
0034 
0035             %plot the point in blue
0036             plot(A(profsel).x(indsel),A(profsel).y(indsel),'bs','MarkerSize',10);
0037 
0038             %select new location
0039             title('click on the new location, RETURN to exit','FontSize',14)
0040             [xi,yi] = ginput(1);
0041 
0042             if ~isempty(xi)
0043 
0044                 %modification of its coordinates
0045                 A(profsel).x(indsel)=xi;
0046                 A(profsel).y(indsel)=yi;
0047 
0048                 %modify the last point if the profile is closed and indsel=end or 1
0049                 if closed(profsel)
0050                     if indsel==1 
0051                         A(profsel).x(end)=xi;
0052                         A(profsel).y(end)=yi;
0053                     elseif indsel==length(A(profsel).x)
0054                         A(profsel).x(1)=xi;
0055                         A(profsel).y(1)=yi;
0056                     end
0057                 end
0058 
0059                 %plot new profile
0060                 undoplots(prevplot);
0061                 for i=1:numprofiles
0062                     plot(A(i).x,A(i).y,'-rs','MarkerSize',10);
0063                 end
0064             else
0065                 %RETURN-> exit
0066                 loop=0;
0067             end
0068         else
0069             %RETURN-> exit
0070             loop=0;
0071         end
0072     end
0073 end

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