function schema

% Defines properties for @bodegain class

%   Copyright 1986-2002 The MathWorks, Inc. 
%   $Revision: 1.1.6.1 $ $Date: 2004/12/10 19:33:13 $

pk = findpackage('plotconstr');

% Register class 
c = schema.class(pk,'timeresponse',findclass(pk,'polygonconstr'));

% Editor data
p = schema.prop(c,'Time','mxArray');            % Time coordinates
p.SetFunction = {@localSet 'X'};                % Map time to x-axis
p.GetFunction = {@localGet 'X'};
p = schema.prop(c,'TimeUnits','string');        % Time units
p.SetFunction = {@localSetUnits 'X'};           % Map time to x-axis
p.GetFunction = {@localGetUnits 'X'};
p.FactoryValue = 'sec';
p = schema.prop(c,'Magnitude','mxArray');       % Magnitude coordinates
p.SetFunction = {@localSet 'Y'};                % Map magnitude to y-axis
p.GetFunction = {@localGet 'Y'};
p = schema.prop(c,'MagnitudeUnits','string');   % Magnitude units
p.SetFunction = {@localSetUnits 'Y'};           % Map time to y-axis
p.GetFunction = {@localGetUnits 'Y'};
p.FactoryValue = 'abs';

%--------------------------------------------------------------------------
function valueStored = localSet(this, Value, Coord)

if ~all(size(Value)==size(this.(['get',Coord])))
   errmsg = ['Cannot change number of vertices from the command line, use ',...
      'addVertex method.'];
   error(errmsg);
end
valueStored = [];
this.(['set',Coord])(Value);

%--------------------------------------------------------------------------
function valueReturned = localGet(this, Value, Coord)

valueReturned = this.(['get',Coord]);

%--------------------------------------------------------------------------
function valueStored = localSetUnits(this, Value, Coord)

valueStored = '';
this.(['set',Coord,'Units'])(Value);

%--------------------------------------------------------------------------
function valueReturned = localGetUnits(this, Value, Coord)

valueReturned = this.(['get',Coord,'Units']);
