Mercurial > hg > octave-nkf
comparison scripts/plot/findobj.m @ 11587:c792872f8942
all script files: untabify and strip trailing whitespace
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Thu, 20 Jan 2011 17:35:29 -0500 |
parents | fd0a3ac60b0e |
children | 5553412c6614 |
comparison
equal
deleted
inserted
replaced
11586:12df7854fa7c | 11587:c792872f8942 |
---|---|
29 ## @example | 29 ## @example |
30 ## findobj (@var{prop_name}, @var{prop_Value}) | 30 ## findobj (@var{prop_name}, @var{prop_Value}) |
31 ## @end example | 31 ## @end example |
32 ## | 32 ## |
33 ## @noindent | 33 ## @noindent |
34 ## which returns all of the handles to the objects with the name | 34 ## which returns all of the handles to the objects with the name |
35 ## @var{prop_name} and the name @var{prop_Value}. The search can be limited | 35 ## @var{prop_name} and the name @var{prop_Value}. The search can be limited |
36 ## to a particular object or set of objects and their descendants by | 36 ## to a particular object or set of objects and their descendants by |
37 ## passing a handle or set of handles @var{h} as the first argument to | 37 ## passing a handle or set of handles @var{h} as the first argument to |
38 ## @code{findobj}. | 38 ## @code{findobj}. |
39 ## | 39 ## |
40 ## The depth of hierarchy of objects to which to search to can be limited | 40 ## The depth of hierarchy of objects to which to search to can be limited |
41 ## with the '-depth' argument. To limit the number depth of the hierarchy | 41 ## with the '-depth' argument. To limit the number depth of the hierarchy |
42 ## to search to @var{d} generations of children, and example is | 42 ## to search to @var{d} generations of children, and example is |
45 ## findobj (@var{h}, '-depth', @var{d}, @var{prop_Name}, @var{prop_Value}) | 45 ## findobj (@var{h}, '-depth', @var{d}, @var{prop_Name}, @var{prop_Value}) |
46 ## @end example | 46 ## @end example |
47 ## | 47 ## |
48 ## Specifying a depth @var{d} of 0, limits the search to the set of object | 48 ## Specifying a depth @var{d} of 0, limits the search to the set of object |
49 ## passed in @var{h}. A depth @var{d} of 0 is equivalent to the '-flat' | 49 ## passed in @var{h}. A depth @var{d} of 0 is equivalent to the '-flat' |
50 ## argument. | 50 ## argument. |
51 ## | 51 ## |
52 ## A specified logical operator may be applied to the pairs of @var{prop_Name} | 52 ## A specified logical operator may be applied to the pairs of @var{prop_Name} |
53 ## and @var{prop_Value}. The supported logical operators are '-and', '-or', | 53 ## and @var{prop_Value}. The supported logical operators are '-and', '-or', |
54 ## '-xor', '-not'. | 54 ## '-xor', '-not'. |
55 ## | 55 ## |
56 ## The objects may also be matched by comparing a regular expression to the | 56 ## The objects may also be matched by comparing a regular expression to the |
57 ## property values, where property values that match @code{regexp | 57 ## property values, where property values that match @code{regexp |
58 ## (@var{prop_Value}, @var{pattern})} are returned. Finally, objects may be | 58 ## (@var{prop_Value}, @var{pattern})} are returned. Finally, objects may be |
59 ## matched by property name only, using the '-property' option. | 59 ## matched by property name only, using the '-property' option. |
60 ## @seealso{get, set} | 60 ## @seealso{get, set} |
61 ## @end deftypefn | 61 ## @end deftypefn |
62 | 62 |
63 ## Author: Ben Abbott <bpabbott@mac.com> | 63 ## Author: Ben Abbott <bpabbott@mac.com> |
183 error ("findobj: properties and options must be strings"); | 183 error ("findobj: properties and options must be strings"); |
184 endif | 184 endif |
185 endwhile | 185 endwhile |
186 | 186 |
187 numpairs = np - 1; | 187 numpairs = np - 1; |
188 | 188 |
189 ## Load all objects which qualify for being searched. | 189 ## Load all objects which qualify for being searched. |
190 idepth = 0; | 190 idepth = 0; |
191 h = handles; | 191 h = handles; |
192 while (numel (handles) && ! (idepth >= depth)) | 192 while (numel (handles) && ! (idepth >= depth)) |
193 children = []; | 193 children = []; |
194 for n = 1 : numel (handles) | 194 for n = 1 : numel (handles) |
195 children = union (children, get(handles(n), "children")); | 195 children = union (children, get(handles(n), "children")); |
196 endfor | 196 endfor |
197 handles = children; | 197 handles = children; |
198 h = union (h, children); | 198 h = union (h, children); |
199 idepth = idepth + 1; | 199 idepth = idepth + 1; |
200 endwhile | 200 endwhile |
201 | 201 |