function delete(this)
% Delete polygonconstr object

%   Author: A. Stothert
%   Copyright 1986-2004 The MathWorks, Inc. 
%   $Revision: 1.1.6.1 $ $Date: 2004/12/10 19:32:03 $

%Find out what we want to delete
DeleteAll = false;
if numel(this) > 1 || ...
      strcmp(this.Selected,'off') || ...
      numel(this.SelectedEdge)==size(this.xCoords,1)
   DeleteAll = true;
end

%Now delete
if DeleteAll
   delete(double(this))
else
   this.removeEdge(this.SelectedEdge)
end