diff m-toolbox/classes/@plotter/plot.m @ 0:f0afece42f48

Import.
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Wed, 23 Nov 2011 19:22:13 +0100
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/m-toolbox/classes/@plotter/plot.m	Wed Nov 23 19:22:13 2011 +0100
@@ -0,0 +1,80 @@
+% PLOT call plot on each data object.
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% DESCRIPTION: PLOT call plot on each data object.
+%
+% CALL:                   hfig = plotter.plot(pl);
+%
+% OUTPUTS:
+%             hfig - an array of figure handles
+%
+% <a href="matlab:utils.helper.displayMethodInfo('plotter', 'plot')">Parameters</a>
+%
+% VERSION:     $Id: plot.m,v 1.2 2011/03/28 12:45:39 hewitson Exp $
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+function plot(varargin)
+  
+  % Check if this is a call for parameters
+  if utils.helper.isinfocall(varargin{:})
+    varargout{1} = getInfo(varargin{3});
+    return
+  end
+  
+  % Collect input variable names
+  in_names = cell(size(varargin));
+  for ii = 1:nargin,in_names{ii} = inputname(ii);end
+  
+  % Get the plotter calling object
+  plotter = utils.helper.collect_objects(varargin(:), 'plotter');
+  
+  % Collect input plists
+  pl = utils.helper.collect_objects(varargin(:), 'plist');
+  pl = combine(pl, getDefaultPlist);
+  
+  hfig = [];
+  for kk=1:numel(plotter.data)
+    
+    d = plotter.data(kk);
+    
+    % Try to call the data class's plot method
+    try
+      d.plot;
+      
+      % Collect the handles
+      drawnow;
+      hfig = [hfig gcf];
+      
+    catch Me
+      warning('Class %s has no plot function', class(d));
+    end
+    
+  end
+  
+  
+end
+
+%--------------------------------------------------------------------------
+% Get Info Object
+%--------------------------------------------------------------------------
+function ii = getInfo(varargin)
+  if nargin == 1 && strcmpi(varargin{1}, 'None')
+    sets = {};
+    pl   = [];
+  else
+    sets = {'Default'};
+    pl   = getDefaultPlist;
+  end
+  % Build info object
+  ii = minfo(mfilename, 'plotter', 'ltpda', utils.const.categories.output, '$Id: plot.m,v 1.2 2011/03/28 12:45:39 hewitson Exp $', sets, pl);
+end
+
+%--------------------------------------------------------------------------
+% Get Default Plist
+%--------------------------------------------------------------------------
+function pl_default = getDefaultPlist()
+  pl_default = plist();
+  
+end
+
+% END