function handles = treeicon(haxes,icon,xc,yc)
%TREEICON Icon library for the SB2SL.
%
%  TREEICON(ICON,XC,YC) draws the selected shape ICON into the current
%  axes object in the region [XC-0.5 YC-0.5 XC+0.5 YC+0.5].
%  Options include: supblk, stdblk, subsys, folder
%
%  See also DRAWICON, TOOLICON.

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

   %
   % Everithing depends on ICON
   %
   switch (icon)
      case 'supblk'
	 handles = zeros(3,1);
	 x = [-0.3259  0.4842  0.4842 -0.3259 -0.3259];
	 y = [-0.2251 -0.2251  0.3851  0.3851 -0.2251];
	 handles(1) = patch(...
	       'Parent',haxes,...
	       'XData',x+xc,...
	       'YData',y+yc,...
	       'EdgeColor',[0 0 0],...
	       'FaceColor',[0.4 0.4 0.4]);
	 x = [-0.4059  0.4042  0.4042 -0.4059 -0.4059];
	 y = [-0.3051 -0.3051  0.3051  0.3051 -0.3051];
	 handles(2) = patch(...
	       'Parent',haxes,...
	       'XData',x+xc,...
	       'YData',y+yc,...
	       'EdgeColor',[0 0 0],...
	       'FaceColor',[0.7 0.7 0.7]);
	 x = [ 0.2044  0.2708  0.2708  0.3383  0.2708  0.2708  0.2044 ...
	       0.2044     NaN  0.3383  0.3383  0.4059     NaN -0.2023 ...
	      -0.3373 -0.3373 -0.2023 -0.2023     NaN -0.2006  0.2044 ...
	       0.2044 -0.2006 -0.2006];
         y = [ 0.0313  0.0313  0.0648 -0.0027 -0.0702 -0.0362 -0.0362 ...
	       0.0313     NaN  0.3014  0.2338  0.2338     NaN -0.0362 ...
	      -0.0362  0.0313  0.0313 -0.0362     NaN -0.1701 -0.1701 ...
	       0.1647  0.1647 -0.1701];
         handles(3) = line(...
	       'Parent',haxes,...
	       'XData',x+xc,...
	       'YData',y+yc,...
	       'Color',[0 0 0]);
      case 'cndblk'
	 handles = zeros(3,1);
	 x = [-0.3690  0.4410  0.4410 -0.3690 -0.3690];
	 y = [-0.2690 -0.2690  0.3412  0.3412 -0.2690];
	 handles(1) = patch(...
	       'Parent',haxes,...
	       'XData',x+xc,...
	       'YData',y+yc,...
	       'EdgeColor',[0 0 0],...
	       'FaceColor',[0.4 0.4 0.4]);
	 x = [-0.4500  0.3600  0.3600 -0.4500 -0.4500];
	 y = [-0.3500 -0.3500  0.2602  0.2602 -0.3500];
	 handles(2) = patch(...
	       'Parent',haxes,...
	       'XData',x+xc,...
	       'YData',y+yc,...
	       'EdgeColor',[0 0 0],...
	       'FaceColor',[0.7 0.7 0.7]);
	 x = [ 0.2941  0.2941  0.3616     NaN -0.2502  0.1548  0.1548 ...
	      -0.2502 -0.2502     NaN -0.3539 -0.0504 -0.0504     NaN ...
	      -0.3539 -0.2529     NaN -0.2502  0.1548  0.1548 -0.2502 ...
	      -0.2502     NaN -0.3539 -0.2529     NaN  0.1521  0.2196 ...
	       0.2196  0.2871  0.2196  0.2196  0.1521];
	 y = [ 0.2564  0.1889  0.1889     NaN -0.0044 -0.0044  0.0982 ...
	       0.0982 -0.0044     NaN  0.1619  0.1619  0.0944     NaN ...
	      -0.1588 -0.1588     NaN -0.2096 -0.2096 -0.1070 -0.1070 ...
	      -0.2096     NaN  0.0437  0.0437     NaN  0.0437  0.0437 ...
	      -0.0573 -0.0573 -0.0573 -0.1588 -0.1588];
         handles(3) = line(...
	       'Parent',haxes,...
	       'XData',x+xc,...
	       'YData',y+yc,...
	       'Color',[0 0 0]);
      case 'dstblk'
	 handles = zeros(4,1);
	 x = [-0.3690  0.4410  0.4410 -0.3690 -0.3690];
	 y = [-0.2690 -0.2690  0.3412  0.3412 -0.2690];
	 handles(1) = patch(...
	       'Parent',haxes,...
	       'XData',x+xc,...
	       'YData',y+yc,...
	       'EdgeColor',[0 0 0],...
	       'FaceColor',[0.4 0.4 0.4]);
	 x = [-0.4500  0.3600  0.3600 -0.4500 -0.4500];
	 y = [-0.3500 -0.3500  0.2602  0.2602 -0.3500];
	 handles(2) = patch(...
	       'Parent',haxes,...
	       'XData',x+xc,...
	       'YData',y+yc,...
	       'EdgeColor',[0 0 0],...
	       'FaceColor',[0.7 0.7 0.7]);
	 x = [-0.3204 -0.3204  0.2196  0.2196 -0.3204;-0.3204 -0.3204 ...
	       0.2196  0.2196 -0.3204]';
	 y = [ 0.1279  0.0944  0.0944  0.1279  0.1279;-0.1756 -0.2096 ...
	      -0.2096 -0.1756 -0.1756]';
	 handles(3) = patch(...
	       'Parent',haxes,...
	       'XData',x+xc,...
	       'YData',y+yc,...
	       'EdgeColor',[0 0 0],...
	       'FaceColor',[0 0 0]);
	 x = [ 0.2941  0.2941  0.3616     NaN -0.1648 -0.1648     NaN ...
	      -0.1648 -0.1368 -0.1248 -0.1168 -0.1128 -0.1088 -0.1088 ...
	      -0.1128 -0.1168 -0.1248 -0.1368 -0.1648     NaN -0.0628 ...
	      -0.0948     NaN -0.0628 -0.0308     NaN -0.0828 -0.0428 ...
	          NaN  0.0112  0.0112     NaN -0.0168  0.0392     NaN ...
	       0.0852  0.0532     NaN  0.0852  0.1172     NaN  0.0652 ...
	       0.1052     NaN -0.1378 -0.1458 -0.1578 -0.1738 -0.1858 ...
	      -0.1938 -0.1938 -0.1898 -0.1858 -0.1778 -0.1538 -0.1458 ...
	      -0.1418 -0.1378 -0.1378 -0.1458 -0.1578 -0.1738 -0.1858 ...
	      -0.1938     NaN -0.0958 -0.0958     NaN -0.1238 -0.0678 ...
	          NaN -0.0298 -0.0378 -0.0458 -0.0498 -0.0538 -0.0538 ...
	      -0.0498 -0.0458 -0.0378 -0.0298 -0.0138 -0.0058  0.0022 ...
	       0.0062  0.0102  0.0102  0.0062  0.0022 -0.0058 -0.0138 ...
	      -0.0298     NaN  0.0242  0.0242     NaN  0.0242  0.0602 ...
	       0.0722  0.0762  0.0802  0.0802  0.0762  0.0722  0.0602 ...
	       0.0242     NaN  0.0522  0.0802     NaN  0.0942  0.0942 ...
	          NaN  0.0942  0.1462     NaN  0.0942  0.1262     NaN ...
	       0.0942  0.1462];
	 y = [ 0.2564  0.1889  0.1889     NaN  0.0540 -0.0300     NaN ...
	       0.0540  0.0540  0.0500  0.0420  0.0340  0.0220  0.0020 ...
	      -0.0100 -0.0180 -0.0260 -0.0300 -0.0300     NaN  0.0540 ...
	      -0.0300     NaN  0.0540 -0.0300     NaN -0.0020 -0.0020 ...
	          NaN  0.0540 -0.0300     NaN  0.0540  0.0540     NaN ...
	       0.0540 -0.0300     NaN  0.0540 -0.0300     NaN -0.0020 ...
	      -0.0020     NaN -0.0820 -0.0740 -0.0700 -0.0700 -0.0740 ...
	      -0.0820 -0.0900 -0.0980 -0.1020 -0.1060 -0.1140 -0.1180 ...
	      -0.1220 -0.1300 -0.1420 -0.1500 -0.1540 -0.1540 -0.1500 ...
	      -0.1420     NaN -0.0700 -0.1540     NaN -0.0700 -0.0700 ...
	          NaN -0.0700 -0.0740 -0.0820 -0.0900 -0.1020 -0.1220 ...
	      -0.1340 -0.1420 -0.1500 -0.1540 -0.1540 -0.1500 -0.1420 ...
	      -0.1340 -0.1220 -0.1020 -0.0900 -0.0820 -0.0740 -0.0700 ...
	      -0.0700     NaN -0.0700 -0.1540     NaN -0.0700 -0.0700 ...
	      -0.0740 -0.0780 -0.0860 -0.0940 -0.1020 -0.1060 -0.1100 ...
	      -0.1100     NaN -0.1100 -0.1540     NaN -0.0700 -0.1540 ...
	          NaN -0.0700 -0.0700     NaN -0.1100 -0.1100     NaN ...
	      -0.1540 -0.1540];
         handles(4) = line(...
	       'Parent',haxes,...
	       'XData',x+xc,...
	       'YData',y+yc,...
	       'Color',[0 0 0]);
      case 'stdblk'
	 handles = zeros(3,1);
	 x = [-0.3249  0.4851  0.4851 -0.3249 -0.3249];
	 y = [-0.2241 -0.2241  0.3861  0.3861 -0.2241];
	 handles(1) = patch(...
	       'Parent',haxes,...
	       'XData',x+xc,...
	       'YData',y+yc,...
	       'EdgeColor',[0 0 0],...
	       'FaceColor',[0.4 0.4 0.4]);
	 x = [-0.4059  0.4041  0.4041 -0.4059 -0.4059];
	 y = [-0.3051 -0.3051  0.3051  0.3051 -0.3051];
	 handles(2) = patch(...
	       'Parent',haxes,...
	       'XData',x+xc,...
	       'YData',y+yc,...
	       'EdgeColor',[0 0 0],...
	       'FaceColor',[0.7 0.7 0.7]);
	 x = [ 0.3382  0.3382  0.4057     NaN -0.2201 -0.2153 -0.2110 ...
              -0.2045 -0.1975 -0.1931 -0.1840 -0.1705 -0.1456 -0.1235 ...
	      -0.1030 -0.0738 -0.0398 -0.1051 -0.1030 -0.0425     NaN ...
	       0.0974  0.1222  0.1400  0.1600  0.1784  0.1962  0.2119 ...
	       0.2232  0.2367  0.2432  0.2480  0.2502  0.2459  0.2389 ...
	       0.2324  0.2594  0.2345  0.2345     NaN  0.1714  0.1444 ...
	       0.1039  0.0790  0.0590  0.0455  0.0320  0.0320  0.0320 ...
	       0.0342  0.0185  0.0455  0.0342     NaN  0.1714  0.1465 ...
	       0.1109  0.0747  0.0407  0.0142 -0.0268 -0.0673 -0.1030 ...
	      -0.1256 -0.1796 -0.1121 -0.1208 -0.1748     NaN  0.0995 ...
	       0.1265  0.1498  0.1697  0.1865  0.2129  0.2324     NaN ...
	       0.1670  0.1433  0.1228  0.1049  0.0904  0.0666  0.0499 ...
	          NaN  0.1714  0.1541  0.1373  0.1222  0.1082  0.0823 ...
	       0.0601  0.0407  0.0234  0.0077 -0.0063     NaN -0.2201 ...
	      -0.2180 -0.2158 -0.2137 -0.2115 -0.2066 -0.2007 -0.1942 ...
	      -0.1867 -0.1683     NaN  0.0952  0.0940  0.0904  0.0845 ...
	       0.0766  0.0669  0.0558  0.0436  0.0309  0.0181  0.0056 ...
	      -0.0060 -0.0165 -0.0253 -0.0323 -0.0370 -0.0395 -0.0395 ...
	      -0.0370 -0.0323 -0.0253 -0.0165 -0.0060  0.0056  0.0181 ...
	       0.0309  0.0436  0.0558  0.0669  0.0766  0.0845  0.0904 ...
	       0.0940  0.0952     NaN -0.1748 -0.1760 -0.1796 -0.1855 ...
	      -0.1934 -0.2031 -0.2142 -0.2264 -0.2391 -0.2519 -0.2644 ...
	      -0.2760 -0.2865 -0.2953 -0.3023 -0.3070 -0.3095 -0.3095 ...
	      -0.3070 -0.3023 -0.2953 -0.2865 -0.2760 -0.2644 -0.2519 ...
	      -0.2391 -0.2264 -0.2142 -0.2031 -0.1934 -0.1855 -0.1796 ...
	      -0.1760 -0.1748     NaN  0.2977  0.2965  0.2929  0.2870 ...
	       0.2791  0.2694  0.2583  0.2461  0.2334  0.2206  0.2081 ...
	       0.1965  0.1860  0.1772  0.1702  0.1655  0.1630  0.1630 ...
	       0.1655  0.1702  0.1772  0.1860  0.1965  0.2081  0.2206 ...
	       0.2334  0.2461  0.2583  0.2694  0.2791  0.2870  0.2929 ...
	       0.2965  0.2977];
         y = [ 0.3013  0.2338  0.2338     NaN -0.0702 -0.0297  0.0043 ...
	       0.0313  0.0513  0.0691  0.0826  0.0988  0.1145  0.1210 ...
	       0.1253  0.1280  0.1280  0.1323  0.1053  0.1280     NaN ...
	       0.1210  0.1231  0.1253  0.1231  0.1210  0.1188  0.1118 ...
	       0.1031  0.0896  0.0761  0.0626  0.0421  0.0265  0.0016 ...
	      -0.0254  0.0313  0.0378 -0.0184     NaN -0.0659 -0.0632 ...
	      -0.0589 -0.0524 -0.0432 -0.0319 -0.0097  0.0108  0.0313 ...
	       0.0670  0.0065  0.0065  0.0648     NaN -0.1307 -0.1469 ...
	      -0.1604 -0.1804 -0.1917 -0.2009 -0.2009 -0.1982 -0.1874 ...
	      -0.1782 -0.1625 -0.1669 -0.1960 -0.1647     NaN  0.1231 ...
	       0.1247  0.1253  0.1237  0.1215  0.1112  0.0940     NaN ...
	      -0.0632 -0.0632 -0.0616 -0.0594 -0.0567 -0.0475 -0.0340 ...
	          NaN -0.1307 -0.1404 -0.1485 -0.1566 -0.1636 -0.1755 ...
	      -0.1852 -0.1928 -0.1976 -0.2014 -0.2030     NaN -0.0659 ...
	      -0.0486 -0.0324 -0.0173 -0.0038  0.0205  0.0416  0.0589 ...
	       0.0734  0.0961     NaN  0.1393  0.1521  0.1644  0.1758 ...
	       0.1859  0.1943  0.2007  0.2049  0.2067  0.2061  0.2031 ...
	       0.1978  0.1903  0.1810  0.1703  0.1583  0.1457  0.1329 ...
	       0.1203  0.1084  0.0976  0.0883  0.0809  0.0755  0.0725 ...
	       0.0719  0.0737  0.0779  0.0843  0.0927  0.1028  0.1142 ...
	       0.1265  0.1393     NaN -0.1307 -0.1179 -0.1056 -0.0942 ...
	      -0.0841 -0.0757 -0.0693 -0.0651 -0.0633 -0.0639 -0.0669 ...
	      -0.0722 -0.0797 -0.0890 -0.0997 -0.1117 -0.1243 -0.1371 ...
	      -0.1497 -0.1616 -0.1724 -0.1817 -0.1891 -0.1945 -0.1975 ...
	      -0.1981 -0.1963 -0.1921 -0.1857 -0.1773 -0.1672 -0.1558 ...
	      -0.1435 -0.1307     NaN -0.0972 -0.0844 -0.0721 -0.0607 ...
	      -0.0506 -0.0422 -0.0358 -0.0316 -0.0298 -0.0304 -0.0334 ...
	      -0.0387 -0.0462 -0.0555 -0.0663 -0.0782 -0.0908 -0.1036 ...
	      -0.1162 -0.1281 -0.1389 -0.1482 -0.1557 -0.1610 -0.1640 ...
	      -0.1646 -0.1628 -0.1586 -0.1522 -0.1438 -0.1337 -0.1223 ...
	      -0.1100 -0.0972];
         handles(3) = line(...
	       'Parent',haxes,...
	       'XData',x+xc,...
	       'YData',y+yc,...
	       'Color',[0 0 0]);
      case 'subsys'
	 handles = zeros(3,1);
	 x = [-0.2306  0.3906  0.3906 -0.2306 -0.2306];
	 y = [-0.3341 -0.3341  0.4941  0.4941 -0.3341];
	 handles(1) = patch(...
	       'Parent',haxes,...
	       'XData',x+xc,...
	       'YData',y+yc,...
	       'EdgeColor',[0 0 0],...
	       'FaceColor',[0.4 0.4 0.4]);
	 x = [-0.3106  0.3106  0.3106 -0.3106 -0.3106];
	 y = [-0.4141 -0.4141  0.4141  0.4141 -0.4141];
	 handles(2) = patch(...
	       'Parent',haxes,...
	       'XData',x+xc,...
	       'YData',y+yc,...
	       'EdgeColor',[0 0 0],...
	       'FaceColor',[0.7 0.7 0.7]);
	 x = [ 0.1553  0.1543  0.1513  0.1466  0.1401  0.1323  0.1233 ...
	       0.1136  0.1035  0.0934  0.0837  0.0748  0.0669  0.0605 ...
	       0.0557  0.0528  0.0518  0.0528  0.0557  0.0605  0.0669 ...
	       0.0748  0.0837  0.0934  0.1035  0.1136  0.1233  0.1323 ...
	       0.1401  0.1466  0.1513  0.1543  0.1553     NaN -0.0518 ...
	       0.1035  0.1035     NaN  0.1553  0.3106     NaN -0.3106 ...
	       0.1035  0.1035     NaN -0.3106 -0.2070 -0.2070 -0.0518 ...
	      -0.2070 -0.2070];
         y = [      0  0.0101  0.0198  0.0288  0.0366  0.0430  0.0478 ...
	       0.0508  0.0518  0.0508  0.0478  0.0430  0.0366  0.0288 ...
	       0.0198  0.0101       0 -0.0101 -0.0198 -0.0288 -0.0366 ...
	      -0.0430 -0.0478 -0.0508 -0.0518 -0.0508 -0.0478 -0.0430 ...
	      -0.0366 -0.0288 -0.0198 -0.0101       0     NaN  0.2070 ...
	       0.2070  0.0518     NaN       0       0     NaN -0.2070 ...
	      -0.2070 -0.0518     NaN  0.2070  0.2070  0.3106  0.2070 ...
	       0.1035  0.2070];
         handles(3) = line(...
	       'Parent',haxes,...
	       'XData',x+xc,...
	       'YData',y+yc,...
	       'Color',[0 0 0]);
      case 'folder'
	 handles = zeros(5,1);
	 x = [-0.4268  0.5000  0.5000 -0.4268 -0.4268];
	 y = [ 0.3293  0.3293 -0.2805 -0.2805  0.3293];
	 handles(1) = patch(...
	       'Parent',haxes,...
	       'XData',x+xc,...
	       'YData',y+yc,...
	       'EdgeColor',[0 0 0],...
	       'FaceColor',[0.6 0.6 0.6]);
	 x = [-0.3902 -0.2927 -0.0732  0.0244 -0.3902];
	 y = [ 0.3293  0.4634  0.4634  0.3293  0.3293];
	 handles(2) = patch(...
	       'Parent',haxes,...
	       'XData',x+xc,...
	       'YData',y+yc,...
	       'EdgeColor',[0 0 0],...
	       'FaceColor',[0.5 0.5 0.5]);
	 x = [-0.5000  0.4268  0.4268 -0.5000 -0.5000];
	 y = [ 0.2561  0.2561 -0.3537 -0.3537  0.2561];
	 handles(3) = patch(...
	       'Parent',haxes,...
	       'XData',x+xc,...
	       'YData',y+yc,...
	       'EdgeColor',[0 0 0],...
	       'FaceColor',[0.8 0.8 0.8]);
	 x = [-0.4634 -0.3659 -0.1463 -0.0488 -0.4634];
	 y = [ 0.2561  0.3902  0.3902  0.2561  0.2561];
	 handles(4) = patch(...
	       'Parent',haxes,...
	       'XData',x+xc,...
	       'YData',y+yc,...
	       'EdgeColor',[0 0 0],...
	       'FaceColor',[0.7 0.7 0.7]);
	 x = [ 0.4268  0.3732  0.3732  0.3488  0.3488  0.2415  0.0317 ...
	      -0.3561  0.4268  0.4268];
	 y = [ 0.2390  0.0537 -0.0976 -0.2146 -0.2878 -0.2805 -0.3146 ...
	      -0.3537 -0.3537  0.2390];
	 handles(5) = patch(...
	       'Parent',haxes,...
	       'XData',x+xc,...
	       'YData',y+yc,...
	       'EdgeColor',[0 0 0],...
	       'FaceColor',[0.6 0.6 0.6]);
      otherwise
	 handles = text(...
	       'Parent',haxes,...
	       'String','???',...
	       'Position',[0.0 0.0],...
	       'Color','k',...
	       'HorizontalAlignment','center',...
	       'VerticalAlignment','middle');
   end
   return					   % Last card of TREEICON
