source: issm/trunk/src/m/exp/operation/modifyposition.m@ 24313

Last change on this file since 24313 was 24313, checked in by Mathieu Morlighem, 5 years ago

merged trunk-jpl and trunk for revision 24310

File size: 2.4 KB
Line 
1function [A,numprofiles,numpoints,closed]=modifyposition(A,numprofiles,numpoints,closed,prevplot,root,options)
2%MODIFYPOSITION - modify the prosition of a point of a profile
3%
4% this script is used by exptool as an elementary operation
5% on an ARGUS profile
6%
7% Usage:
8% [A,numprofiles,numpoints,closed]=modifyposition(A,numprofiles,numpoints,closed,prevplot,root,options)
9
10 %some checks
11 if numprofiles==0
12 disp('no profile present, exiting..')
13 return
14 end
15
16 hold on
17 loop=1;
18
19 %plot squares
20 for i=1:numprofiles
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'));
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)
29 [xi,yi] = exp_ginput(1,options);
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
37 plot(A(profsel).x(indsel),A(profsel).y(indsel),...
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'));
40
41 %select new location
42 title('click on the new location, RETURN to exit','FontSize',14)
43 [xi,yi] = exp_ginput(1,options);
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
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'));
67 end
68 else
69 %RETURN-> exit
70 loop=0;
71 end
72 else
73 %RETURN-> exit
74 loop=0;
75 end
76 end
77end
Note: See TracBrowser for help on using the repository browser.