]> Creatis software - CreaPhase.git/blob - octave_packages/m/plot/private/__next_line_style__.m
update packages
[CreaPhase.git] / octave_packages / m / plot / private / __next_line_style__.m
1 ## Copyright (C) 2010-2012 David Bateman
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 3 of the License, or (at
8 ## your option) 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, see
17 ## <http://www.gnu.org/licenses/>.
18
19 ## -*- texinfo -*-
20 ## @deftypefn {Function File} {@var{style} =} __next_line_style__ (@var{reset})
21 ## Undocumented internal function.
22 ## @end deftypefn
23
24 ## Return the next line style in the rotation.
25
26
27 function [linestyle, marker] = __next_line_style__ (reset)
28
29   persistent style_rotation;
30   persistent num_styles;
31   persistent style_index;
32
33   if (nargin < 2)
34     if (nargin == 1)
35       if (ischar (reset) && strncmp (reset, "incr", 4))
36         if (isempty (style_rotation))
37           error ("__next_line_style__: style_rotation not initialized");
38         elseif (++style_index > num_styles)
39           style_index = 1;
40         endif
41       elseif (reset || isempty (style_rotation))
42         style_rotation = get (gca (), "linestyleorder");
43         if (ischar (style_rotation))
44           style_rotation = strsplit (style_rotation, "|");
45         endif
46         num_styles = length (style_rotation);
47         style_index = 1;
48       endif
49     elseif (! isempty (style_rotation))
50       options = __pltopt__ ("__next_line_style__",
51                             style_rotation (style_index));
52       linestyle = options.linestyle;
53       marker = options.marker;
54     else
55       error ("__next_line_style__: style_rotation not initialized");
56     endif
57   else
58     print_usage ();
59   endif
60
61 endfunction