comparison scripts/plot/util/rotate3d.m @ 18999:137d01e7c2d4

New scripts pan.m and rotate3d.m, update __add_default_menu__.m * pan.m: New script to control panning mode for GUI * rotate3d.m: New script to control panning mode for GUI * __add_default_menu__.m: Update uimenus and callbacks. The menubar items now sets properties on all axes except legends. It's now possible to set, for example, the grid for all plots in a subplot. * findall.m: Update test to reflect change of __add_default_menu__.m * __unimplemented__.m: remove added pan and rotate3d scripts
author Andreas Weber <andy.weber.aw@gmail.com>
date Mon, 28 Jul 2014 22:40:12 +0200
parents
children 8a6f87637c16
comparison
equal deleted inserted replaced
18998:a0c514c243f6 18999:137d01e7c2d4
1 ## Copyright (C) 2014 Andreas Weber
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 {Command} {} rotate3d
21 ## @deftypefnx {Command} {} rotate3d on
22 ## @deftypefnx {Command} {} rotate3d off
23 ## @deftypefnx {Function File} {} rotate3d (@var{hax}, @dots{})
24 ## Control 3D rotation mode of interactive graph in GUI.
25 ##
26 ## The function state input may be either @qcode{"on"} or @qcode{"off"}
27 ## and can only be set for 3D plots.
28 ##
29 ## If the first argument @var{hax} is an axes handle, then operate on
30 ## this axis rather than the current axes returned by @code{gca}.
31 ##
32 ## To query the current mode use the @code{get} function. For example:
33 ## @example
34 ## mode = get (gca, "rotate3d");
35 ## @end example
36 ## @seealso{pan}
37 ## @end deftypefn
38
39 function rotate3d (varargin)
40
41 if (numel (varargin) > 0 && isaxes (varargin{1}))
42 hax = varargin{1};
43 varargin(1) = [];
44 else
45 hax = gca ();
46 endif
47
48 toolkit = get (ancestor (hax, "figure"), "__graphics_toolkit__");
49 if (! strcmp (toolkit, "fltk"))
50 warning ("rotate3d: Only implemented for graphics_toolkit FLTK");
51 endif
52
53 ndims = __calc_dimensions__ (hax);
54 if (ndims == 2)
55 warning ("rotate3d: Only available for 3D plots");
56 else
57 if (numel (varargin) > 1)
58 print_usage ();
59 elseif (numel (varargin) == 0)
60 # toggle
61 m = get (hax, "pan");
62 if (strcmp (get (hax, "rotate3d"), "on"))
63 set (hax, "rotate3d", "off");
64 else
65 set (hax, "rotate3d", "on");
66 endif
67 elseif (numel (varargin) == 1)
68 set (hax, "rotate3d", varargin{1});
69 endif
70 endif
71
72 endfunction
73