Mercurial > hg > octave-lyh
annotate scripts/plot/hidden.m @ 14138:72c96de7a403 stable
maint: update copyright notices for 2012
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Mon, 02 Jan 2012 14:25:41 -0500 |
parents | fd0a3ac60b0e |
children | 7277fe922e99 |
rev | line source |
---|---|
14138
72c96de7a403
maint: update copyright notices for 2012
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
1 ## Copyright (C) 2007-2012 Michael Goffioul |
7149 | 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 -*- | |
10793
be55736a0783
Grammarcheck the documentation from m-files.
Rik <octave@nomad.inbox5.com>
parents:
10549
diff
changeset
|
20 ## @deftypefn {Function File} {} hidden (@var{mode}) |
7149 | 21 ## @deftypefnx {Function File} {} hidden () |
9040
dbd0c77e575e
Cleanup documentation file plot.texi
Rik <rdrider0-list@yahoo.com>
parents:
8920
diff
changeset
|
22 ## Manipulation the mesh hidden line removal. Called with no argument |
dbd0c77e575e
Cleanup documentation file plot.texi
Rik <rdrider0-list@yahoo.com>
parents:
8920
diff
changeset
|
23 ## the hidden line removal is toggled. The argument @var{mode} can be either |
7149 | 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 function retval = hidden (mode) | |
29 | |
30 if (nargin == 0) | |
31 mode = "swap"; | |
32 elseif (nargin == 1); | |
33 if (ischar (mode)) | |
34 mode = tolower (mode); | |
35 if (! strcmp (mode, "on") && ! strcmp (mode, "off")) | |
11472
1740012184f9
Use uppercase for variable names in error() strings to match Info documentation. Only m-files done.
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
36 error ("hidden: MODE expected to be 'on' or 'off'"); |
7149 | 37 endif |
38 else | |
11472
1740012184f9
Use uppercase for variable names in error() strings to match Info documentation. Only m-files done.
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
39 error ("hidden: expecting MODE to be a string"); |
7149 | 40 endif |
41 else | |
42 print_usage (); | |
43 endif | |
44 | |
45 for h = get (gca (), "children"); | |
46 htype = lower (get (h, "type")); | |
47 if (strcmp (htype, "surface")) | |
48 fc = get (h, "facecolor"); | |
49 if ((! ischar (fc) && is_white (fc)) | |
10549 | 50 || (ischar (fc) && strcmpi (fc, "none"))) |
7149 | 51 switch (mode) |
52 case "on" | |
53 set (h, "facecolor", "w"); | |
54 case "off" | |
55 set (h, "facecolor", "none"); | |
56 case "swap" | |
57 if (ischar (fc)) | |
58 set (h, "facecolor", "w"); | |
10549 | 59 mode = "on"; |
7149 | 60 else |
61 set (h, "facecolor", "none"); | |
10549 | 62 mode = "off"; |
7149 | 63 endif |
64 endswitch | |
65 endif | |
66 endif | |
67 endfor | |
68 | |
69 if (nargout > 0) | |
70 retval = mode; | |
71 endif | |
72 | |
73 endfunction | |
74 | |
75 function retval = is_white (color) | |
76 retval = all (color == 1); | |
77 endfunction |