annotate scripts/plot/private/__getlegenddata__.m @ 17475:fd01c78caa0b

Added tag ss-3-7-7 for changeset cc13924a4266
author John W. Eaton <jwe@octave.org>
date Mon, 23 Sep 2013 13:31:11 -0400
parents 1c89599167a6
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
14138
72c96de7a403 maint: update copyright notices for 2012
John W. Eaton <jwe@octave.org>
parents: 13232
diff changeset
1 ## Copyright (C) 2010-2012 David Bateman
12339
eda5eabd5d0b Fix for inline legends (#32022, #32343)
David Bateman <dbateman@free.fr>
parents:
diff changeset
2 ##
eda5eabd5d0b Fix for inline legends (#32022, #32343)
David Bateman <dbateman@free.fr>
parents:
diff changeset
3 ## This file is part of Octave.
eda5eabd5d0b Fix for inline legends (#32022, #32343)
David Bateman <dbateman@free.fr>
parents:
diff changeset
4 ##
eda5eabd5d0b Fix for inline legends (#32022, #32343)
David Bateman <dbateman@free.fr>
parents:
diff changeset
5 ## Octave is free software; you can redistribute it and/or modify it
eda5eabd5d0b Fix for inline legends (#32022, #32343)
David Bateman <dbateman@free.fr>
parents:
diff changeset
6 ## under the terms of the GNU General Public License as published by
eda5eabd5d0b Fix for inline legends (#32022, #32343)
David Bateman <dbateman@free.fr>
parents:
diff changeset
7 ## the Free Software Foundation; either version 3 of the License, or (at
eda5eabd5d0b Fix for inline legends (#32022, #32343)
David Bateman <dbateman@free.fr>
parents:
diff changeset
8 ## your option) any later version.
eda5eabd5d0b Fix for inline legends (#32022, #32343)
David Bateman <dbateman@free.fr>
parents:
diff changeset
9 ##
eda5eabd5d0b Fix for inline legends (#32022, #32343)
David Bateman <dbateman@free.fr>
parents:
diff changeset
10 ## Octave is distributed in the hope that it will be useful, but
eda5eabd5d0b Fix for inline legends (#32022, #32343)
David Bateman <dbateman@free.fr>
parents:
diff changeset
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of
eda5eabd5d0b Fix for inline legends (#32022, #32343)
David Bateman <dbateman@free.fr>
parents:
diff changeset
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
eda5eabd5d0b Fix for inline legends (#32022, #32343)
David Bateman <dbateman@free.fr>
parents:
diff changeset
13 ## General Public License for more details.
eda5eabd5d0b Fix for inline legends (#32022, #32343)
David Bateman <dbateman@free.fr>
parents:
diff changeset
14 ##
eda5eabd5d0b Fix for inline legends (#32022, #32343)
David Bateman <dbateman@free.fr>
parents:
diff changeset
15 ## You should have received a copy of the GNU General Public License
eda5eabd5d0b Fix for inline legends (#32022, #32343)
David Bateman <dbateman@free.fr>
parents:
diff changeset
16 ## along with Octave; see the file COPYING. If not, see
eda5eabd5d0b Fix for inline legends (#32022, #32343)
David Bateman <dbateman@free.fr>
parents:
diff changeset
17 ## <http://www.gnu.org/licenses/>.
eda5eabd5d0b Fix for inline legends (#32022, #32343)
David Bateman <dbateman@free.fr>
parents:
diff changeset
18
eda5eabd5d0b Fix for inline legends (#32022, #32343)
David Bateman <dbateman@free.fr>
parents:
diff changeset
19 ## -*- texinfo -*-
eda5eabd5d0b Fix for inline legends (#32022, #32343)
David Bateman <dbateman@free.fr>
parents:
diff changeset
20 ## @deftypefn {Function File} {[@var{hplots}, @var{strings}]} = __getlegenddata__ (@var{h})
eda5eabd5d0b Fix for inline legends (#32022, #32343)
David Bateman <dbateman@free.fr>
parents:
diff changeset
21 ## Undocumented internal function.
eda5eabd5d0b Fix for inline legends (#32022, #32343)
David Bateman <dbateman@free.fr>
parents:
diff changeset
22 ## @end deftypefn
eda5eabd5d0b Fix for inline legends (#32022, #32343)
David Bateman <dbateman@free.fr>
parents:
diff changeset
23
eda5eabd5d0b Fix for inline legends (#32022, #32343)
David Bateman <dbateman@free.fr>
parents:
diff changeset
24 function [hplots, text_strings] = __getlegenddata__ (hlegend)
eda5eabd5d0b Fix for inline legends (#32022, #32343)
David Bateman <dbateman@free.fr>
parents:
diff changeset
25 hplots = [];
eda5eabd5d0b Fix for inline legends (#32022, #32343)
David Bateman <dbateman@free.fr>
parents:
diff changeset
26 text_strings = {};
eda5eabd5d0b Fix for inline legends (#32022, #32343)
David Bateman <dbateman@free.fr>
parents:
diff changeset
27 ca = getfield (get (hlegend, "userdata"), "handle");
eda5eabd5d0b Fix for inline legends (#32022, #32343)
David Bateman <dbateman@free.fr>
parents:
diff changeset
28 kids = [];
13232
9b98affe52b9 __getlegenddata__.m: Fix bad subscript index error (Bug #33774).
Rik <octave@nomad.inbox5.com>
parents: 12764
diff changeset
29 for i = 1:numel (ca)
9b98affe52b9 __getlegenddata__.m: Fix bad subscript index error (Bug #33774).
Rik <octave@nomad.inbox5.com>
parents: 12764
diff changeset
30 kids = [kids; get(ca(i), "children")];
12339
eda5eabd5d0b Fix for inline legends (#32022, #32343)
David Bateman <dbateman@free.fr>
parents:
diff changeset
31 endfor
13232
9b98affe52b9 __getlegenddata__.m: Fix bad subscript index error (Bug #33774).
Rik <octave@nomad.inbox5.com>
parents: 12764
diff changeset
32
9b98affe52b9 __getlegenddata__.m: Fix bad subscript index error (Bug #33774).
Rik <octave@nomad.inbox5.com>
parents: 12764
diff changeset
33 for i = numel (kids):-1:1
9b98affe52b9 __getlegenddata__.m: Fix bad subscript index error (Bug #33774).
Rik <octave@nomad.inbox5.com>
parents: 12764
diff changeset
34 typ = get (kids(i), "type");
9b98affe52b9 __getlegenddata__.m: Fix bad subscript index error (Bug #33774).
Rik <octave@nomad.inbox5.com>
parents: 12764
diff changeset
35 if (strcmp (typ, "line") || strcmp (typ, "surface")
9b98affe52b9 __getlegenddata__.m: Fix bad subscript index error (Bug #33774).
Rik <octave@nomad.inbox5.com>
parents: 12764
diff changeset
36 || strcmp (typ, "patch") || strcmp (typ, "hggroup"))
9b98affe52b9 __getlegenddata__.m: Fix bad subscript index error (Bug #33774).
Rik <octave@nomad.inbox5.com>
parents: 12764
diff changeset
37
9b98affe52b9 __getlegenddata__.m: Fix bad subscript index error (Bug #33774).
Rik <octave@nomad.inbox5.com>
parents: 12764
diff changeset
38 if (strcmp (typ, "hggroup"))
9b98affe52b9 __getlegenddata__.m: Fix bad subscript index error (Bug #33774).
Rik <octave@nomad.inbox5.com>
parents: 12764
diff changeset
39 hgkids = get (kids(i), "children");
12339
eda5eabd5d0b Fix for inline legends (#32022, #32343)
David Bateman <dbateman@free.fr>
parents:
diff changeset
40 for j = 1 : length (hgkids)
eda5eabd5d0b Fix for inline legends (#32022, #32343)
David Bateman <dbateman@free.fr>
parents:
diff changeset
41 hgobj = get (hgkids (j));
13232
9b98affe52b9 __getlegenddata__.m: Fix bad subscript index error (Bug #33774).
Rik <octave@nomad.inbox5.com>
parents: 12764
diff changeset
42 if (isfield (hgobj, "displayname") && ! isempty (hgobj.displayname))
12339
eda5eabd5d0b Fix for inline legends (#32022, #32343)
David Bateman <dbateman@free.fr>
parents:
diff changeset
43 hplots = [hplots, hgkids(j)];
12764
3347ccb91708 fix typo in __getlegenddata__
John W. Eaton <jwe@octave.org>
parents: 12339
diff changeset
44 text_strings = {text_strings{:}, hgobj.displayname};
12339
eda5eabd5d0b Fix for inline legends (#32022, #32343)
David Bateman <dbateman@free.fr>
parents:
diff changeset
45 break;
eda5eabd5d0b Fix for inline legends (#32022, #32343)
David Bateman <dbateman@free.fr>
parents:
diff changeset
46 endif
eda5eabd5d0b Fix for inline legends (#32022, #32343)
David Bateman <dbateman@free.fr>
parents:
diff changeset
47 endfor
eda5eabd5d0b Fix for inline legends (#32022, #32343)
David Bateman <dbateman@free.fr>
parents:
diff changeset
48 else
13232
9b98affe52b9 __getlegenddata__.m: Fix bad subscript index error (Bug #33774).
Rik <octave@nomad.inbox5.com>
parents: 12764
diff changeset
49 if (! isempty (get (kids (i), "displayname")))
9b98affe52b9 __getlegenddata__.m: Fix bad subscript index error (Bug #33774).
Rik <octave@nomad.inbox5.com>
parents: 12764
diff changeset
50 hplots = [hplots, kids(i)];
9b98affe52b9 __getlegenddata__.m: Fix bad subscript index error (Bug #33774).
Rik <octave@nomad.inbox5.com>
parents: 12764
diff changeset
51 text_strings = {text_strings{:}, get(kids (i), "displayname")};
12339
eda5eabd5d0b Fix for inline legends (#32022, #32343)
David Bateman <dbateman@free.fr>
parents:
diff changeset
52 endif
eda5eabd5d0b Fix for inline legends (#32022, #32343)
David Bateman <dbateman@free.fr>
parents:
diff changeset
53 endif
13232
9b98affe52b9 __getlegenddata__.m: Fix bad subscript index error (Bug #33774).
Rik <octave@nomad.inbox5.com>
parents: 12764
diff changeset
54
12339
eda5eabd5d0b Fix for inline legends (#32022, #32343)
David Bateman <dbateman@free.fr>
parents:
diff changeset
55 endif
13232
9b98affe52b9 __getlegenddata__.m: Fix bad subscript index error (Bug #33774).
Rik <octave@nomad.inbox5.com>
parents: 12764
diff changeset
56 endfor
9b98affe52b9 __getlegenddata__.m: Fix bad subscript index error (Bug #33774).
Rik <octave@nomad.inbox5.com>
parents: 12764
diff changeset
57
12339
eda5eabd5d0b Fix for inline legends (#32022, #32343)
David Bateman <dbateman@free.fr>
parents:
diff changeset
58 endfunction
17346
1c89599167a6 maint: End m-files with 1 blank line.
Rik <rik@octave.org>
parents: 14138
diff changeset
59