-
Notifications
You must be signed in to change notification settings - Fork 61
/
Copy pathm_line.m
54 lines (45 loc) · 1.39 KB
/
m_line.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
function h=m_line(long,lat,varargin);
% M_LINE Create a line on a map
% M_LINE(LONG,LAT) adds the line in vectors LONG and LAT to the
% current axes. If LONG and LAT are matrices the same size, one
% line per column is added.
%
% LINE returns a column vector of handles to LINE objects,
% one handle per line. LINEs are children of AXES objects.
%
% The LONG,LAT pair can be followed by
% parameter/value pairs to specify additional properties of the lines.
% These are standard 'line' properties.
%
% See also LINE, M_LL2XY
% Rich Pawlowicz (rich@ocgy.ubc.ca) 17/Jan/1998
% 8/Dec/98 - changed switch test to only 3 letters (thus letting
% "tag" properties through).
% 18/july/00 - Fixed m_line so you could do clipping through it.
% 6/Nov/00 - eliminate returned stuff if ';' neglected (thx to D Byrne)
%
% This software is provided "as is" without warranty of any kind. But
% it's mine, so you can't sell it.
clp='on';
k=1;
while k<length(varargin),
switch lower(varargin{k}(1:3)),
case 'cli',
clp=varargin{k+1}
if isempty(findstr(clp,'on')),
varargin{k+1}='off';
else
varargin{k+1}='on';
% varargin([k k+1])=[];
end;
k=k+2;
otherwise
k=k+2;
end;
end;
[X,Y]=m_ll2xy(long,lat,'clipping',clp);
if nargout>0,
h=line(X,Y,'tag','m_line',varargin{:});
else
line(X,Y,'tag','m_line',varargin{:});
end;