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