[13730] | 1 | function [A,numprofiles,numpoints,closed]=modifyposition(A,numprofiles,numpoints,closed,prevplot,root,options)
|
---|
[1] | 2 | %MODIFYPOSITION - modify the prosition of a point of a profile
|
---|
| 3 | %
|
---|
[8662] | 4 | % this script is used by exptool as an elementary operation
|
---|
[1] | 5 | % on an ARGUS profile
|
---|
| 6 | %
|
---|
| 7 | % Usage:
|
---|
[3018] | 8 | % [A,numprofiles,numpoints,closed]=modifyposition(A,numprofiles,numpoints,closed,prevplot,root,options)
|
---|
[13646] | 9 |
|
---|
[1] | 10 | %some checks
|
---|
| 11 | if numprofiles==0
|
---|
[33] | 12 | disp('no profile present, exiting..')
|
---|
[1] | 13 | return
|
---|
| 14 | end
|
---|
| 15 |
|
---|
| 16 | hold on
|
---|
| 17 | loop=1;
|
---|
| 18 |
|
---|
| 19 | %plot squares
|
---|
| 20 | for i=1:numprofiles
|
---|
[5088] | 21 | plot(A(i).x,A(i).y,'color',getfieldvalue(options,'color'),'LineStyle',getfieldvalue(options,'LineStyle'),'LineWidth',getfieldvalue(options,'LineWidth'),...
|
---|
| 22 | 'MarkerEdgeColor',getfieldvalue(options,'MarkerEdgeColor'),'MarkerSize',getfieldvalue(options,'MarkerSize'),'Marker',getfieldvalue(options,'Marker'));
|
---|
[1] | 23 | end
|
---|
| 24 |
|
---|
| 25 | while loop
|
---|
| 26 |
|
---|
| 27 | %select a point to be modified
|
---|
| 28 | title('click on the point to be modified, RETURN to exit','FontSize',14)
|
---|
[24313] | 29 | [xi,yi] = exp_ginput(1,options);
|
---|
[1] | 30 |
|
---|
| 31 | if ~isempty(xi)
|
---|
| 32 |
|
---|
| 33 | %get the closest point
|
---|
| 34 | [profsel indsel]=closestpoint(A,numprofiles,xi,yi);
|
---|
| 35 |
|
---|
| 36 | %plot the point in blue
|
---|
[3018] | 37 | plot(A(profsel).x(indsel),A(profsel).y(indsel),...
|
---|
[5088] | 38 | 'color',getfieldvalue(options,'color'),'LineStyle',getfieldvalue(options,'LineStyle'),'LineWidth',getfieldvalue(options,'LineWidth'),...
|
---|
| 39 | 'MarkerEdgeColor',getfieldvalue(options,'selectioncolor'),'MarkerSize',getfieldvalue(options,'MarkerSize'),'Marker',getfieldvalue(options,'Marker'));
|
---|
[1] | 40 |
|
---|
| 41 | %select new location
|
---|
| 42 | title('click on the new location, RETURN to exit','FontSize',14)
|
---|
[24313] | 43 | [xi,yi] = exp_ginput(1,options);
|
---|
[1] | 44 |
|
---|
| 45 | if ~isempty(xi)
|
---|
| 46 |
|
---|
| 47 | %modification of its coordinates
|
---|
| 48 | A(profsel).x(indsel)=xi;
|
---|
| 49 | A(profsel).y(indsel)=yi;
|
---|
| 50 |
|
---|
| 51 | %modify the last point if the profile is closed and indsel=end or 1
|
---|
| 52 | if closed(profsel)
|
---|
| 53 | if indsel==1
|
---|
| 54 | A(profsel).x(end)=xi;
|
---|
| 55 | A(profsel).y(end)=yi;
|
---|
| 56 | elseif indsel==length(A(profsel).x)
|
---|
| 57 | A(profsel).x(1)=xi;
|
---|
| 58 | A(profsel).y(1)=yi;
|
---|
| 59 | end
|
---|
| 60 | end
|
---|
| 61 |
|
---|
| 62 | %plot new profile
|
---|
| 63 | undoplots(prevplot);
|
---|
| 64 | for i=1:numprofiles
|
---|
[5088] | 65 | plot(A(i).x,A(i).y,'color',getfieldvalue(options,'color'),'LineStyle',getfieldvalue(options,'LineStyle'),'LineWidth',getfieldvalue(options,'LineWidth'),...
|
---|
| 66 | 'MarkerEdgeColor',getfieldvalue(options,'MarkerEdgeColor'),'MarkerSize',getfieldvalue(options,'MarkerSize'),'Marker',getfieldvalue(options,'Marker'));
|
---|
[1] | 67 | end
|
---|
| 68 | else
|
---|
| 69 | %RETURN-> exit
|
---|
| 70 | loop=0;
|
---|
| 71 | end
|
---|
| 72 | else
|
---|
| 73 | %RETURN-> exit
|
---|
| 74 | loop=0;
|
---|
| 75 | end
|
---|
| 76 | end
|
---|
| 77 | end
|
---|