function drawshls(Shells,Nodes,labflg,ax,rgb,style,nfontsz)
%
%  Name: drawshls
% 
%  Usage: drawshls(Shells,Nodes,labflg,ax,rgb,style,nfontsz)
% 
%   Description:
%      Draws lines to represent
%      the shell connectivity in 'Shells'
%      'Nodes' is the node list
%      'ax' is axis handle
%      'rgb' is color vector
%      'labflg' flag controls display of labels
%      'style' is linestyle string

%  Version SWD970405
%
%  Copyright (c) 1997 by Scott W. Doebling
%	Los Alamos National Laboratory
%	ESA-EA, doebling@lanl.gov
%

if ~exist('nfontsz'), nfontsz=14; end

axes(ax)

for i = 1:size(Shells,1),

   n1 = Shells(i,2);
   n2 = Shells(i,3);
   n3 = Shells(i,4);
   n4 = Shells(i,5);

%  Find locations of end-nodes in Node list

   in1 = find(Nodes(:,1) == n1);
   in2 = find(Nodes(:,1) == n2);
   in3 = find(Nodes(:,1) == n3);
   in4 = find(Nodes(:,1) == n4);

   if isempty(in1) | isempty(in2) | isempty(in3) | isempty(in4), 
      errordlg('ERROR: DRAWSHLS -- A Node Label is in Shells but not in Nodes'), 
   end
   
   %  Draw the Shell
   
   X = [Nodes(in1,2) Nodes(in2,2) Nodes(in3,2) Nodes(in4,2)];
   Y = [Nodes(in1,3) Nodes(in2,3) Nodes(in3,3) Nodes(in4,3)];
   Z = [Nodes(in1,4) Nodes(in2,4) Nodes(in3,4) Nodes(in4,4)];

   h = line([X X(1)],[Y Y(1)],[Z Z(1)]);
   
   %  Add Shell Numeric Label if appropriate
   
   if labflg,
      ht = text(mean(X),mean(Y),mean(Z),num2str(Shells(i,1)));
      set(ht,'FontSize',nfontsz)
      set(ht,'FontWeight','bold')
      set(ht,'VerticalAlignment','bottom')
      set(ht,'Color',rgb)
   end
end

return
