function draw(this,varargin)
%DRAW  (Re)draws @waveform object.
%
%  DRAW(WF) draws the waveform WF and all its dependencies.

%  Author(s): Bora Eryilmaz, P. Gahinet
%  Copyright 1986-2004 The MathWorks, Inc.
%  $Revision: 1.1.6.1 $ $Date: 2004/12/26 21:52:50 $

% RE: first argument = NoCheckFlag
hPlot = this.Parent;
NormalRefresh = strcmp(this.RefreshMode,'normal');

% Update the response data
if ~isempty(this.DataFcn)
   % RE: For optimal performance, DataFcn should only recompute 
   %     MIMO responses that are visible and have been cleared. 
   feval(this.DataFcn{:});
end

% Set data exception boolean to flag invalid data
this.Data.Exception = any(getsize(this.Data)~=[1 1]);

% Draw HSV chart
if this.Data.Exception
   % Invalid data: clear graphics
   set(double(ghandles(this.View)),'XData',NaN,'YData',NaN)
else
   % Valid data: proceed with draw
   this.View.draw(this.Data,NormalRefresh)
end

% Limit management
if NormalRefresh
   % Issue ViewChanged event to trigger limit picker
   % RE: Ignored when @axesgrid's LimitManager is off, e.g., during @waveplot/draw
   hPlot.AxesGrid.send('ViewChanged')
   if this.Data.Exception && ...
         strcmp(hPlot.DataExceptionWarning,'on')
      warning('Could not compute Hankel singular values for this model.')
   end
else
   % Redraw g-objects whose updating is normally tied to the 'PostLimitChanged' event
   adjustview(this,'postlim')
end
