function handles = drawicon(ahndl,icon)
%DRAWICON Icon library for the SB2SL.
%
%  DRAWICON(ICON) draws the selected shape ICON into the current
%  axes object in the region [0 1 0 1].
%  Options include: supblk, subsys, sb2sl, error, querry
%
%  See also TREEICON, TOOLICON.

% Initial coding by A S Bozin, 5-7-97.
% Copyright 1997-2000 The MathWorks, Inc.
% $Revision: 1.5 $ $Date: 2000/06/14 16:11:50 $

   %
   % Handle input arguments
   %
   error(nargchk(2,2,nargin));
   %
   % Everithing depends on ICON
   %
   black = [0 0 0];
   gray1 = [0.6 0.6 0.6];
   gray2 = [0.8 0.8 0.8];
   switch (icon)
      case 'supblk'
	 handles = zeros(2,1);
	 x = [0.0765  0.9218  0.9218  0.0765  0.0765];
	 y = [0.1816  0.1816  0.8184  0.8184  0.1816];
         handles(1) = patch(...
	       'Parent',ahndl,...
	       'XData',x,...
	       'YData',y,...
	       'EdgeColor',black,...
	       'FaceColor',gray1);
	 x = [0.7133  0.7826  0.7826  0.8531  0.7826  0.7826  0.7133 ...
	      0.7133     NaN  0.8531  0.8531  0.9235     NaN  0.2890 ...
	      0.1481  0.1481  0.2890  0.2890     NaN  0.2906  0.7133 ...
	      0.7133  0.2906  0.2906];
         y = [0.5327  0.5327  0.5676  0.4972  0.4267  0.4622  0.4622 ...
	      0.5327     NaN  0.8145  0.7440  0.7440     NaN  0.4622 ...
	      0.4622  0.5327  0.5327  0.4622     NaN  0.3225  0.3225 ...
	      0.6719  0.6719  0.3225];
         handles(2) = line(...
	       'Parent',ahndl,...
	       'XData',x,...
	       'YData',y,...
	       'Color',black);
      case 'subsys'
	 handles = zeros(2,1);
	 x = [0.1471  0.8529  0.8529  0.1471  0.1471];
	 y = [0.0295  0.0295  0.9705  0.9705  0.0295];
         handles(1) = patch(...
	       'Parent',ahndl,...
	       'XData',x,...
	       'YData',y,...
	       'EdgeColor',black,...
	       'FaceColor',gray1);
	 x = [0.6765  0.6753  0.6720  0.6665  0.6592  0.6503  0.6401 ...
	      0.6291  0.6176  0.6062  0.5951  0.5850  0.5760  0.5687 ...
	      0.5633  0.5599  0.5588  0.5599  0.5633  0.5687  0.5760 ...
	      0.5850  0.5951  0.6062  0.6176  0.6291  0.6401  0.6503 ...
	      0.6592  0.6665  0.6720  0.6753  0.6765     NaN  0.4412 ...
	      0.6176  0.6176     NaN  0.6765  0.8529     NaN  0.1471 ...
	      0.6176  0.6176     NaN  0.1471  0.2647  0.2647  0.4412 ...
	      0.2647  0.2647];
         y = [0.5000  0.5115  0.5225  0.5327  0.5416  0.5489  0.5543 ...
	      0.5577  0.5588  0.5577  0.5543  0.5489  0.5416  0.5327 ...
	      0.5225  0.5115  0.5000  0.4885  0.4775  0.4673  0.4584 ...
	      0.4511  0.4457  0.4423  0.4412  0.4423  0.4457  0.4511 ...
	      0.4584  0.4673  0.4775  0.4885  0.5000     NaN  0.7353 ...
	      0.7353  0.5588     NaN  0.5000  0.5000     NaN  0.2647 ...
	      0.2647  0.4412     NaN  0.7353  0.7353  0.8529  0.7353 ...
	      0.6176  0.7353];
         handles(2) = line(...
	       'Parent',ahndl,...
	       'XData',x,...
	       'YData',y,...
	       'Color',black);
      case 'sb2sl'
	 handles = zeros(6,1);
	 x = [0.0246  0.5442  0.5442  0.0246  0.0246];
	 y = [0.5491  0.5491  0.9388  0.9388  0.5491];
         handles(1) = patch(...
	       'Parent',ahndl,...
	       'XData',x,...
	       'YData',y,...
	       'EdgeColor',black,...
	       'FaceColor',gray1);
	 x = [0.1545  0.4143  0.4143  0.1545  0.1545     NaN  0.4140 ...
	      0.4574  0.4574  0.5005  0.4574  0.4574  0.4140  0.4140 ...
	      0.4140     NaN  0.1542  0.0677  0.0677  0.1542     NaN ...
	      0.5005  0.5005  0.5439];
         y = [0.6374  0.6374  0.8531  0.8531  0.6374     NaN  0.7663 ...
	      0.7663  0.7879  0.7445  0.7014  0.7229  0.7229  0.7663 ...
	      0.7663     NaN  0.7229  0.7229  0.7663  0.7663     NaN ...
	      0.9393  0.8962  0.8962];
         handles(2) = line(...
	       'Parent',ahndl,...
	       'XData',x,...
	       'YData',y,...
	       'Color',black);
         x = [0.5857  0.9754  0.9754  0.5857  0.5857];
	 y = [0.0607  0.0607  0.5803  0.5803  0.0607];
         handles(3) = patch(...
	       'Parent',ahndl,...
	       'XData',x,...
	       'YData',y,...
	       'EdgeColor',black,...
	       'FaceColor',gray1);
	 x = [0.8775  0.8769  0.8750  0.8720  0.8680  0.8631  0.8575 ...
	      0.8514  0.8450  0.8387  0.8326  0.8270  0.8221  0.8180 ...
	      0.8150  0.8132  0.8125  0.8132  0.8150  0.8180  0.8221 ...
	      0.8270  0.8326  0.8387  0.8450  0.8514  0.8575  0.8631 ...
	      0.8680  0.8720  0.8750  0.8769  0.8775     NaN  0.8775 ...
	      0.9749     NaN  0.5852  0.8450  0.8450     NaN  0.7476 ...
	      0.8450  0.8450     NaN  0.5852  0.6502  0.6502  0.7476 ...
	      0.6502  0.6502];
         y = [0.3192  0.3255  0.3316  0.3372  0.3421  0.3462  0.3492 ...
	      0.3510  0.3516  0.3510  0.3492  0.3462  0.3421  0.3372 ...
	      0.3316  0.3255  0.3192  0.3128  0.3067  0.3011  0.2962 ...
	      0.2922  0.2892  0.2873  0.2867  0.2873  0.2892  0.2922 ...
	      0.2962  0.3011  0.3067  0.3128  0.3192     NaN  0.3192 ...
	      0.3192     NaN  0.1893  0.1893  0.2867     NaN  0.4491 ...
	      0.4491  0.3516     NaN  0.4491  0.4491  0.5140  0.4491 ...
	      0.3841  0.4491];
         handles(4) = line(...
	       'Parent',ahndl,...
	       'XData',x,...
	       'YData',y,...
	       'Color',black);
         x = [0.4878  0.4878  0.4982  0.5104  0.5226  0.5348  0.5468 ...
	      0.5588  0.5706  0.5822  0.5936  0.6048  0.6158  0.6264 ...
	      0.6367  0.6468  0.6564  0.6657  0.6745  0.6830  0.6910 ...
	      0.6985  0.7056  0.7121  0.7181  0.7237  0.7286  0.7330 ...
	      0.7369  0.7401  0.7428  0.7449  0.7464  0.7473  0.7476 ...
	      0.7476  0.7151  0.7801  0.8450  0.8125  0.8125  0.8122 ...
	      0.8110  0.8090  0.8063  0.8028  0.7986  0.7936  0.7878 ...
	      0.7814  0.7742  0.7663  0.7578  0.7486  0.7388  0.7284 ...
	      0.7174  0.7059  0.6938  0.6812  0.6682  0.6547  0.6409 ...
	      0.6266  0.6121  0.5972  0.5821  0.5667  0.5511  0.5354 ...
	      0.5196  0.5037  0.4878];
         y = [0.8688  0.8038  0.8038  0.8035  0.8026  0.8011  0.7990 ...
	      0.7964  0.7931  0.7893  0.7849  0.7799  0.7744  0.7684 ...
	      0.7618  0.7548  0.7472  0.7392  0.7308  0.7219  0.7126 ...
	      0.7030  0.6930  0.6826  0.6720  0.6611  0.6499  0.6384 ...
	      0.6268  0.6150  0.6031  0.5910  0.5789  0.5667  0.5544 ...
	      0.5440  0.5440  0.4791  0.5440  0.5440  0.5440  0.5600 ...
	      0.5759  0.5917  0.6074  0.6229  0.6383  0.6534  0.6683 ...
	      0.6829  0.6971  0.7110  0.7245  0.7375  0.7501  0.7621 ...
	      0.7737  0.7847  0.7951  0.8049  0.8141  0.8226  0.8304 ...
	      0.8376  0.8441  0.8498  0.8548  0.8591  0.8625  0.8653 ...
	      0.8672  0.8684  0.8688];
         handles(5) = patch(...
	       'Parent',ahndl,...
	       'XData',x,...
	       'YData',y,...
	       'EdgeColor',black,...
	       'FaceColor',gray2);
	 x = [0.0985    0.1041    0.1041    0.0985    0.0871    0.0701    0.0530 ...
	      0.0360    0.0246    0.0246    0.0303    0.0360    0.0473    0.0814 ...
	      0.0928    0.1041       NaN    0.0246    0.0360    0.0473    0.0814 ...
	      0.0928    0.0985    0.1041    0.1041    0.0928    0.0757    0.0587 ...
	      0.0416    0.0303    0.0246    0.0246    0.0303       NaN    0.1411 ...
	      0.1411       NaN    0.1468    0.1468       NaN    0.1240    0.1922 ...
	      0.2093    0.2149    0.2206    0.2206    0.2149    0.2093    0.1922 ...
	         NaN    0.1922    0.2036    0.2093    0.2149    0.2149    0.2093 ...
	      0.2036    0.1922       NaN    0.1468    0.1922    0.2093    0.2149 ...
	      0.2206    0.2206    0.2149    0.2093    0.1922    0.1240       NaN ...
	      0.1922    0.2036    0.2093    0.2149    0.2149    0.2093    0.2036 ...
	      0.1922       NaN    0.2462    0.2519    0.2462    0.2405    0.2405 ...
	      0.2462    0.2519    0.2689    0.2916    0.3087    0.3144    0.3201 ...
	      0.3201    0.3144    0.2973    0.2689    0.2576    0.2462    0.2405 ...
	      0.2405       NaN    0.2916    0.3030    0.3087    0.3144    0.3144 ...
	      0.3087    0.2916    0.2689       NaN    0.2405    0.2462    0.2576 ...
	      0.2860    0.3030    0.3144    0.3201       NaN    0.2576    0.2860 ...
	      0.3087    0.3144    0.3201    0.3201       NaN    0.4138    0.4195 ...
	      0.4195    0.4138    0.4024    0.3854    0.3684    0.3513    0.3399 ...
	      0.3399    0.3456    0.3513    0.3627    0.3968    0.4081    0.4195 ...
	         NaN    0.3399    0.3513    0.3627    0.3968    0.4081    0.4138 ...
	      0.4195    0.4195    0.4081    0.3911    0.3740    0.3570    0.3456 ...
	      0.3399    0.3399    0.3456       NaN    0.4564    0.4564       NaN ...
	      0.4621    0.4621       NaN    0.4394    0.4791       NaN    0.4394 ...
	      0.5246    0.5246    0.5189];
         y = [0.1630    0.1800    0.1459    0.1630    0.1743    0.1800    0.1800 ...
	      0.1743    0.1630    0.1516    0.1402    0.1346    0.1289    0.1175 ...
	      0.1118    0.1005       NaN    0.1516    0.1402    0.1346    0.1232 ...
	      0.1175    0.1118    0.1005    0.0777    0.0664    0.0607    0.0607 ...
	      0.0664    0.0777    0.0948    0.0607    0.0777       NaN    0.1800 ...
	      0.0607       NaN    0.1800    0.0607       NaN    0.1800    0.1800 ...
	      0.1743    0.1687    0.1573    0.1459    0.1346    0.1289    0.1232 ...
	         NaN    0.1800    0.1743    0.1687    0.1573    0.1459    0.1346...
	      0.1289    0.1232       NaN    0.1232    0.1232    0.1175    0.1118 ...
	      0.1005    0.0834    0.0721    0.0664    0.0607    0.0607       NaN ...
	      0.1232    0.1175    0.1118    0.1005    0.0834    0.0721    0.0664 ...
	      0.0607       NaN    0.1573    0.1516    0.1459    0.1516    0.1573 ...
	      0.1687    0.1743    0.1800    0.1800    0.1743    0.1687    0.1573 ...
	      0.1459    0.1346    0.1232    0.1118    0.1062    0.0948    0.0777 ...
	      0.0607       NaN    0.1800    0.1743    0.1687    0.1573    0.1459 ...
	      0.1346    0.1232    0.1118       NaN    0.0721    0.0777    0.0777 ...
	      0.0664    0.0664    0.0721    0.0777       NaN    0.0777    0.0607 ...
	      0.0607    0.0664    0.0777    0.0891       NaN    0.1630    0.1800 ...
	      0.1459    0.1630    0.1743    0.1800    0.1800    0.1743    0.1630 ...
	      0.1516    0.1402    0.1346    0.1289    0.1175    0.1118    0.1005 ...
	         NaN    0.1516    0.1402    0.1346    0.1232    0.1175    0.1118...
	      0.1005    0.0777    0.0664    0.0607    0.0607    0.0664    0.0777 ...
	      0.0948    0.0607    0.0777       NaN    0.1800    0.0607       NaN ...
	      0.1800    0.0607       NaN    0.1800    0.1800       NaN    0.0607 ...
	      0.0607    0.0948    0.0607];
         handles(6) = line(...
	       'Parent',ahndl,...
	       'XData',x,...
	       'YData',y,...
	       'Color',black);
      case 'error'
	 handles = zeros(2,1);
	 x = [0.0000  0.6059  0.7576  0.9695  0.9695  0.0000  0.0000 ...
		 NaN  0.5000  0.5388  0.5000  0.4612  0.5000  0.5000 ...
		 NaN  0.5000  0.4612  0.5388  0.5000     NaN  0.5000 ...
	      0.4612  0.3837  0.4224  0.5000  0.5776  0.6163  0.5388 ...
	      0.5000     NaN  0.5000  0.4224  0.5000  0.5776  0.5000 ...
	         NaN  0.0305  0.0305  1.0000  1.0000  0.9695  0.9695 ...
	      0.0305];
         y = [1.0000  1.0000  0.9025  0.8049  0.0242  0.0242  1.0000 ...
		 NaN  0.6711  0.7023  0.7335  0.7023  0.6711  0.3277 ...
		 NaN  0.1717  0.1405  0.1405  0.1717     NaN  0.7647 ...
	      0.7335  0.7023  0.6711  0.3277  0.6711  0.7023  0.7335 ...
	      0.7647     NaN  0.2029  0.1405  0.1092  0.1405  0.2029 ...
	         NaN  0.0242  0.0000  0.0000  0.7803  0.8049  0.0242 ...
	      0.0242];
         handles(1) = line(...
	       'Parent',ahndl,...
	       'XData',x,...
	       'YData',y,...
	       'Color',black);
	 x = [0.9695  0.9569  0.9443  0.9210  0.8992  0.8793  0.8604 ...
	      0.8429  0.8270  0.8124  0.7988  0.7862  0.7635  0.7441 ...
	      0.7271  0.7043  0.6898  0.6738  0.6544  0.6321  0.6195 ...
	      0.6059  0.5914  0.5759  0.5904  0.6025  0.6127  0.6209 ...
	      0.6268  0.6316  0.6365  0.6360  0.6345  0.6316  0.6272 ...
	      0.6219  0.6146  0.6059  0.7576  0.9695];
         y = [0.8049  0.8030  0.8014  0.7979  0.7952  0.7924  0.7901 ...
	      0.7881  0.7862  0.7846  0.7835  0.7823  0.7807  0.7803 ...
	      0.7803  0.7819  0.7838  0.7862  0.7897  0.7936  0.7959 ...
	      0.7987  0.8014  0.8049  0.8229  0.8389  0.8529  0.8650 ...
	      0.8755  0.8853  0.9025  0.9185  0.9278  0.9384  0.9504 ...
	      0.9649  0.9809  1.0000  0.9025  0.8049];
         handles(2) = patch(...
	       'Parent',ahndl,...
	       'XData',x,...
	       'YData',y,...
	       'EdgeColor','none',...
	       'FaceColor',black);
      case 'query'
	 handles = zeros(2,1);
	 x = [0.0000  0.6059  0.7576  0.9695  0.9695  0.0000  0.0000 ...
	         NaN  0.0305  0.0305  1.0000  1.0000  0.9695  0.9695 ...
	      0.0305     NaN  0.4612  0.3837  0.3449  0.3449  0.2673 ...
	      0.3061  0.3449  0.4612  0.5388  0.6551  0.6939  0.7327 ...
	      0.7327  0.6939  0.6163  0.5388  0.5000  0.4612  0.5388 ...
	      0.6163  0.6551  0.6551  0.6163  0.5388     NaN  0.5000 ...
	      0.4224  0.5000  0.5776  0.5000     NaN  0.6551  0.6939 ...
	      0.6939  0.6551     NaN  0.3061  0.3449     NaN  0.5000 ...
	      0.5000     NaN  0.5000  0.4612  0.5388  0.5000];
         y = [1.0000  1.0000  0.9025  0.8049  0.0242  0.0242  1.0000 ...
		 NaN  0.0242  0.0000  0.0000  0.7803  0.8049  0.0242 ...
	      0.0242     NaN  0.7647  0.7335  0.6711  0.6087  0.6399 ...
	      0.7023  0.7335  0.7647  0.7647  0.7335  0.7023  0.6399 ...
	      0.5774  0.5150  0.4526  0.4214  0.3277  0.4214  0.4214 ...
	      0.4838  0.5462  0.6711  0.7335  0.7647     NaN  0.2029 ...
	      0.1405  0.1092  0.1405  0.2029     NaN  0.7023  0.6711 ...
	      0.5462  0.5150     NaN  0.6399  0.7023     NaN  0.4214 ...
	      0.3277     NaN  0.1717  0.1405  0.1405  0.1717];
         handles(1) = line(...
	       'Parent',ahndl,...
	       'XData',x,...
	       'YData',y,...
	       'Color',black);
	 x = [0.9695  0.9569  0.9443  0.9210  0.8992  0.8793  0.8604 ...
	      0.8429  0.8270  0.8124  0.7988  0.7862  0.7635  0.7441 ...
	      0.7271  0.7043  0.6898  0.6738  0.6544  0.6321  0.6195 ...
	      0.6059  0.5914  0.5759  0.5904  0.6025  0.6127  0.6209 ...
	      0.6268  0.6316  0.6365  0.6360  0.6345  0.6316  0.6272 ...
	      0.6219  0.6146  0.6059  0.7576  0.9695];
         y = [0.8049  0.8030  0.8014  0.7979  0.7952  0.7924  0.7901 ...
	      0.7881  0.7862  0.7846  0.7835  0.7823  0.7807  0.7803 ...
	      0.7803  0.7819  0.7838  0.7862  0.7897  0.7936  0.7959 ...
	      0.7987  0.8014  0.8049  0.8229  0.8389  0.8529  0.8650 ...
	      0.8755  0.8853  0.9025  0.9185  0.9278  0.9384  0.9504 ...
	      0.9649  0.9809  1.0000  0.9025  0.8049];
         handles(2) = patch(...
	       'Parent',ahndl,...
	       'XData',x,...
	       'YData',y,...
	       'EdgeColor','none',...
	       'FaceColor',black);
      otherwise
	 handles = text(...
	       'Parent',ahndl,...
	       'String','???',...
	       'Position',[0.5 0.5],...
	       'Color','k',...
	       'HorizontalAlignment','center',...
	       'VerticalAlignment','middle');
   end
   return					   % Last card of DRAWICON
