comparison m-toolbox/classes/@ltpda_uoh/setPlotinfo.m @ 0:f0afece42f48

Import.
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Wed, 23 Nov 2011 19:22:13 +0100
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:f0afece42f48
1 % SETPLOTINFO sets the 'plotinfo' property of a ltpda_uoh object.
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 %
4 % DESCRIPTION: SETPLOTINFO sets the 'plotinfo' property of a ltpda_uoh object.
5 %
6 % CALL: objs.setPlotinfo(val);
7 % objs.setPlotinfo(val1, val2);
8 % objs.setPlotinfo(plist('plotinfo', val));
9 % objs = objs.setPlotinfo(val);
10 %
11 % INPUTS: objs: Any shape of ltpda_uoh objects
12 % val:
13 % 1. Single PLIST e.g.
14 % Each object in objs get this value.
15 % 2. Single PLIST in a cell-array
16 % Each objects in objs get this value.
17 % 3. cell-array with the same number of PLISTSs as in objs
18 % e.g. {pl1, pl2, pl3} and 3 objects in objs
19 % Each object in objs get its corresponding value from the
20 % cell-array
21 %
22 % <a href="matlab:utils.helper.displayMethodInfo('ltpda_uoh', 'setPlotinfo')">Parameter Sets</a>
23 %
24 % VERSION: $Id: setPlotinfo.m,v 1.15 2011/09/16 05:02:22 hewitson Exp $
25 %
26 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
27
28 function varargout = setPlotinfo(varargin)
29
30 % Check if this is a call from a class method
31 callerIsMethod = utils.helper.callerIsMethod;
32
33 if callerIsMethod
34 in_names = {};
35 else
36 % Collect input variable names
37 in_names = cell(size(varargin));
38 for ii = 1:nargin,in_names{ii} = inputname(ii);end
39 end
40
41 objects = setPropertyValue(...
42 varargin{:}, ...
43 in_names, ...
44 callerIsMethod, ...
45 'plotinfo', ...
46 @setterFcn, ...
47 nargout, ...
48 @getInfo);
49
50 % set outputs
51 varargout = utils.helper.setoutputs(nargout, objects);
52
53 end
54
55 % Setter function to set the plotinfo
56 function value = setterFcn(varargin)
57
58 obj = varargin{1};
59 pls = varargin{2};
60 if nargin == 2
61 % copy this before we remove the supported keys. We want to remove the
62 % keys otherwise applyDefaults complains because these are not
63 % supported keys of the plist.
64 value = copy(pls,1);
65 % remove supported keys: 'linestyle', 'linewidth', 'color', 'marker', 'legend_on'
66 if pls.isparam('linestyle')
67 pls.removeKeys('linestyle');
68 end
69 if pls.isparam('linewidth')
70 pls.removeKeys('linewidth');
71 end
72 if pls.isparam('color')
73 pls.removeKeys('color');
74 end
75 if pls.isparam('marker')
76 pls.removeKeys('marker');
77 end
78 if pls.isparam('legend_on')
79 pls.removeKeys('legend_on');
80 end
81 end
82 if nargin == 3
83 value = varargin{3};
84 end
85
86 obj.plotinfo = value;
87
88 end
89
90
91 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
92 % Local Functions %
93 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
94 %--------------------------------------------------------------------------
95 % Get Info Object
96 %--------------------------------------------------------------------------
97 function ii = getInfo(varargin)
98
99 if nargin == 1 && strcmpi(varargin{1}, 'None')
100 sets = {};
101 pl = [];
102 else
103 sets = {'Default'};
104 pl = getDefaultPlist;
105 end
106 % Build info object
107 ii = minfo(mfilename, mfilename('class'), 'ltpda', utils.const.categories.helper, '$Id: setPlotinfo.m,v 1.15 2011/09/16 05:02:22 hewitson Exp $', sets, pl);
108 end
109
110 %--------------------------------------------------------------------------
111 % Get Default Plist
112 %--------------------------------------------------------------------------
113 function plout = getDefaultPlist()
114 persistent pl;
115 if ~exist('pl', 'var') || isempty(pl)
116 pl = buildplist();
117 end
118 plout = pl;
119 end
120
121 function pl = buildplist()
122 pl = plist({'plotinfo', 'A plist to set to the plot info.'}, {1, {plist}, paramValue.OPTIONAL});
123 end