octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

New Plotting Functions: findall.m and allchild.m


From: Bill Denney
Subject: New Plotting Functions: findall.m and allchild.m
Date: Tue, 04 Mar 2008 22:39:17 -0500
User-agent: Thunderbird 2.0.0.12 (Windows/20080213)

Hello,

Attached are two new functions, findall.m and allchild.m.

Also, I was trying to write hgsave and hgload, but I could not find a way to create a handle without using the plotting functions. Is there a way to generate handle objects without going through the plotting functions?

Have a good day,

Bill
# HG changeset patch
# User address@hidden
# Date 1204687881 18000
# Node ID beac65fd64317821f75484094b88511b165e7bd2
# Parent  8625e205e8d5672ad875ccbc6ef9f210ad65a107
allchild.m, findall.m: new functions

diff -r 8625e205e8d5 -r beac65fd6431 scripts/ChangeLog
--- a/scripts/ChangeLog Sun Mar 02 23:43:55 2008 -0500
+++ b/scripts/ChangeLog Tue Mar 04 22:31:21 2008 -0500
@@ -1,3 +1,7 @@ 2008-03-02  Bill Denney  <address@hidden
+2008-03-04  Bill Denney  <address@hidden>
+
+       * plot/allchild.m, plot/findall.m: New functions.
+
 2008-03-02  Bill Denney  <address@hidden>
 
        * geometry/rectint.m: New function.
diff -r 8625e205e8d5 -r beac65fd6431 scripts/plot/allchild.m
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/allchild.m   Tue Mar 04 22:31:21 2008 -0500
@@ -0,0 +1,49 @@
+## Copyright (C) 2008 Bill Denney
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} address@hidden =} allchild (handles)
+## Find all children including hidden children of an object.
+##
+## This function is similar to get(h, "Children"), but including hidden
+## objects. If @var{handles} is a scalar, @var{h} will be an output
+## vector, and if not, @var{h} will be a cell matrix with the same size
+## as @var{handles} and each cell will contain a vector of handles.
+## @seealso{get, set, findall, findobj}
+## @end deftypefn
+
+## Author: Bill Denney <address@hidden>
+
+function h = allchild (ha)
+
+  unwind_protect
+    shh = get (0, "ShowHiddenHandles");
+    set(0, "ShowHiddenHandles", "on");
+    if isscalar (ha)
+      h = get (ha, "Children");
+    else
+      h = cell (size (ha));
+      for i = 1:numel (ha)
+        h{i} = get (ha, "Children");
+      endfor
+    endif
+  unwind_protect_cleanup
+    set(0, "ShowHiddenHandles", shh);
+  end_unwind_protect
+
+endfunction
diff -r 8625e205e8d5 -r beac65fd6431 scripts/plot/findall.m
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/findall.m    Tue Mar 04 22:31:21 2008 -0500
@@ -0,0 +1,44 @@
+## Copyright (C) 2008 Bill Denney
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} address@hidden =} findall ()
+## @deftypefnx {Function File} address@hidden =} findall (@var{propName}, 
@var{propValue})
+## @deftypefnx {Function File} address@hidden =} findall (@var{h}, @dots{})
+## @deftypefnx {Function File} address@hidden =} findall (@var{h}, '-depth', 
@var{d}, @dots{})
+## Find object with specified property values including hidden handles.
+##
+## This function performs the same function as findobj, but it includes
+## hidden objects in its search.  For full documentation, see
+## @code{findobj}.
+## @seealso{get, set, findobj, allchild}
+## @end deftypefn
+
+## Author: Bill Denney <address@hidden>
+
+function h = findall (varargin)
+
+  unwind_protect
+    shh = get (0, "ShowHiddenHandles");
+    set(0, "ShowHiddenHandles", "on");
+    h = findobj (varargin{:});
+  unwind_protect_cleanup
+    set(0, "ShowHiddenHandles", shh);
+  end_unwind_protect
+
+endfunction

reply via email to

[Prev in Thread] Current Thread [Next in Thread]