6405
|
1 ## Copyright (C) 2005 John W. Eaton |
|
2 ## |
|
3 ## This file is part of Octave. |
|
4 ## |
|
5 ## Octave is free software; you can redistribute it and/or modify it |
|
6 ## under the terms of the GNU General Public License as published by |
|
7 ## the Free Software Foundation; either version 2, or (at your option) |
|
8 ## any later version. |
|
9 ## |
|
10 ## Octave is distributed in the hope that it will be useful, but |
|
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
13 ## General Public License for more details. |
|
14 ## |
|
15 ## You should have received a copy of the GNU General Public License |
|
16 ## along with Octave; see the file COPYING. If not, write to the Free |
|
17 ## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
|
18 ## 02110-1301, USA. |
|
19 |
|
20 ## -*- texinfo -*- |
|
21 ## @deftypefn {Function File} {} __line__ (@var{p}, @var{x}, @var{y}) |
|
22 ## @deftypefnx {Function File} {} line (@var{p}, @var{x}, @var{y}, @var{z}) |
|
23 ## Create line object from @var{x} and @var{y} with parent @var{p}. |
|
24 ## Return handle to line object. |
|
25 ## @end deftypefn |
|
26 |
|
27 ## Author: jwe |
|
28 |
|
29 function h = __line__ (p, varargin) |
|
30 |
|
31 if (nargin < 1) |
|
32 print_usage (); |
|
33 endif |
|
34 |
|
35 nvargs = numel (varargin); |
|
36 |
|
37 if (nvargs > 1 && isnumeric (varargin{1}) && isnumeric (varargin{2})) |
|
38 if (nvargs > 2 && isnumeric (varargin{3})) |
|
39 num_data_args = 3; |
|
40 else |
|
41 num_data_args = 2; |
|
42 endif |
|
43 else |
|
44 num_data_args = 0; |
|
45 endif |
|
46 |
|
47 if (rem (nvargs - num_data_args, 2) == 0) |
|
48 else |
|
49 print_usage ("line"); |
|
50 endif |
|
51 |
|
52 h = __go_line__ (p); |
|
53 |
|
54 if (num_data_args > 1) |
|
55 set (h, "xdata", varargin{1}, "ydata", varargin{2}); |
|
56 if (num_data_args == 3) |
|
57 set (h, "zdata", varargin{3}); |
|
58 endif |
|
59 endif |
|
60 |
|
61 if (nvargs > num_data_args) |
|
62 set (h, varargin{num_data_args+1:end}); |
|
63 endif |
|
64 |
|
65 endfunction |