7149
|
1 ## Copyright (C) 2007 Michael Goffioul |
|
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} {} hidden (@var{mode}) |
|
21 ## @deftypefnx {Function File} {} hidden () |
|
22 ## Manipulation the mesh hidden line removal. Called with no argument |
|
23 ## the hidden line removal is toggled. The argument @var{mode} can be either |
|
24 ## 'on' or 'off' and the set of the hidden line removal is set accordingly. |
|
25 ## @seealso{mesh, meshc, surf} |
|
26 ## @end deftypefn |
|
27 |
|
28 ## PKG_ADD: mark_as_command hidden |
|
29 |
|
30 function retval = hidden (mode) |
|
31 |
|
32 if (nargin == 0) |
|
33 mode = "swap"; |
|
34 elseif (nargin == 1); |
|
35 if (ischar (mode)) |
|
36 mode = tolower (mode); |
|
37 if (! strcmp (mode, "on") && ! strcmp (mode, "off")) |
|
38 error ("hidden: mode expected to be 'on' or 'off'"); |
|
39 endif |
|
40 else |
|
41 error ("hidden: expecting mode to be a string"); |
|
42 endif |
|
43 else |
|
44 print_usage (); |
|
45 endif |
|
46 |
|
47 for h = get (gca (), "children"); |
|
48 htype = lower (get (h, "type")); |
|
49 if (strcmp (htype, "surface")) |
|
50 fc = get (h, "facecolor"); |
|
51 if ((! ischar (fc) && is_white (fc)) |
|
52 || (ischar (fc) && strcmp (fc, "none"))) |
|
53 switch (mode) |
|
54 case "on" |
|
55 set (h, "facecolor", "w"); |
|
56 case "off" |
|
57 set (h, "facecolor", "none"); |
|
58 case "swap" |
|
59 if (ischar (fc)) |
|
60 set (h, "facecolor", "w"); |
|
61 mode = "on"; |
|
62 else |
|
63 set (h, "facecolor", "none"); |
|
64 mode = "off"; |
|
65 endif |
|
66 endswitch |
|
67 endif |
|
68 endif |
|
69 endfor |
|
70 |
|
71 if (nargout > 0) |
|
72 retval = mode; |
|
73 endif |
|
74 |
|
75 endfunction |
|
76 |
|
77 function retval = is_white (color) |
|
78 retval = all (color == 1); |
|
79 endfunction |