source: issm/trunk/src/m/exp/manipulation/closeprofile.m@ 13395

Last change on this file since 13395 was 13395, checked in by Mathieu Morlighem, 12 years ago

merged trunk-jpl and trunk for revision 13393

File size: 1.9 KB
Line 
1function [A,numprofiles,numpoints,closed]=closeprofile(A,numprofiles,numpoints,closed,prevplot,root,options);
2%CLOSEPROFILE - close one or several 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]=closeprofile(A,numprofiles,numpoints,closed,prevplot,root,options)
9
10 %some checks
11 if numprofiles==0
12 disp('no profile to be closed')
13 return
14 end
15
16 title('click on the profiles to be closed, RETURN to exit','FontSize',14)
17 hold on
18
19 loop=1;
20 selection=[];
21
22 while loop
23
24 %some checks,
25 if numprofiles==0
26 disp('no profile present, exiting...')
27 return
28 end
29 if ~any(~closed),
30 disp('All the profiles are closed, exiting...')
31 return
32 end
33
34 [xi,yi] = ginput(1);
35
36 if ~isempty(xi)
37
38 %get closest profile
39 [profsel indsel]=closestpoint(A,numprofiles,xi,yi);
40
41 if ismember(profsel,selection)
42 %profile was in selection, remove it from the selection
43 selection(find(selection==profsel))=[];
44 %back to regular color
45 plot(A(profsel).x,A(profsel).y,...
46 'color',getfieldvalue(options,'color'),'LineStyle',getfieldvalue(options,'LineStyle'),'LineWidth',getfieldvalue(options,'LineWidth'));
47 elseif closed(profsel),
48 %profile already closed, do nothing
49 disp('selected profile aready closed, make another selection'),
50 else
51 %add the profile to the list to be closed
52 selection(end+1)=profsel;
53 %in selectioncolor
54 plot(A(profsel).x,A(profsel).y,...
55 'color',getfieldvalue(options,'selectioncolor'),'LineStyle',getfieldvalue(options,'LineStyle'),'LineWidth',getfieldvalue(options,'LineWidth'));
56 end
57 else
58 %close the profiles
59 for i=1:length(selection),
60 A(selection(i)).x(end+1)=A(selection(i)).x(1);
61 A(selection(i)).y(end+1)=A(selection(i)).y(1);
62 numpoints=numpoints+1;
63 closed(selection(i))=1;
64 end
65 loop=0;
66 end
67 end
68end
Note: See TracBrowser for help on using the repository browser.