NCCOOS Trac Projects: Top | Web | Platforms | Processing | Viz | Sprints | Sandbox | (Wind)

root/gliderproc/trunk/MATLAB/opnml/FCAST_1.2/matlab_cen/labcont.m

Revision 495 (checked in by cbc, 11 years ago)

Initial import of Stark code.

Line 
1 %
2 % LABCONT  -  label contours drawn with LCONTOUR2
3 %
4 %             LABCONT labels contours on the current axes that have been
5 %             previously drawn with LCONTOUR2.  Start up LABCONT by
6 %             typing "labcont" at the MATLAB prompt (>>).  Then,
7 %             click on the contour to label with the left mouse-button.
8 %             Continue clicking with the left mouse-button button until
9 %             all the labels have been added, then press the right
10 %             mouse-button in the current axes to stop LABCONT.  If
11 %             an output argument was supplied to LABCONT, the handles
12 %             to the text objects pointing to the labels is returned
13 %             to the MATLAB workspace.
14 %
15 % Written by : Brian O. Blanton, March 96
16 %
17 function h=labcont
18
19 if nargin~=0
20    error('LABCONT takes NO input arguments.')
21 elseif nargin~=0 & nargout~=1
22    error('LABCONT takes 0 or 1 output arguments.')
23 end
24
25 %
26 % save the current value of the current figure's WindowButtonDownFcn,
27 % WindowButtonMotionFcn, and WindowButtonUpFcn
28 %
29 WindowButtonDownFcn=get(gcf,'WindowButtonDownFcn');
30 WindowButtonMotionFcn=get(gcf,'WindowButtonMotionFcn');
31 WindowButtonUpFcn=get(gcf,'WindowButtonUpFcn');
32 set(gcf,'WindowButtonDownFcn','');
33 set(gcf,'WindowButtonMotionFcn','');
34 set(gcf,'WindowButtonUpFcn','');
35
36
37 npts=0;
38 disp('Click on contour with left mouse-button, right button to end')
39
40 while 1
41    waitforbuttonpress;
42    seltype=get(gcf,'SelectionType');
43    if ~strcmp(seltype,'normal')break,end
44
45    target=gco;
46    if ~strcmp(get(target,'Tag'),'contour')
47       disp('Target NOT a contour from LCONTOUR2 or ISOPHASE')
48    else
49       npts=npts+1;
50       val=get(target,'UserData');
51       pt=gcp;
52       ht(npts)=text(pt(2),pt(4),num2str(val),...
53                    'HorizontalAlignment','Center','FontSize',10);
54    end
55 end
56
57 if nargout==1
58    h=ht;
59 end
60
61 %
62 % return the saved values of the current figure's WindowButtonDownFcn,
63 % WindowButtonMotionFcn, and WindowButtonUpFcn to the current figure
64 %
65 set(gcf,'WindowButtonDownFcn',WindowButtonDownFcn);
66 set(gcf,'WindowButtonMotionFcn',WindowButtonMotionFcn);
67 set(gcf,'WindowButtonUpFcn',WindowButtonUpFcn);
68
69 %
70 %        Brian O. Blanton
71 %        Curr. in Marine Science
72 %        15-1A Venable Hall
73 %        CB# 3300
74 %        Uni. of North Carolina
75 %        Chapel Hill, NC
76 %                 27599-3300
77 %
78 %        919-962-4466
79 %        blanton@marine.unc.edu
80 %
81
Note: See TracBrowser for help on using the browser.