/* Generated By:JJTree: Do not edit this line. ASTPolygon.java */

/**************************************************************

File				: ASTPolygon.java
Auther				: M. Spiller
Registration #		: Y0259667
Date				: Thursday 13th november 2003
Unit				: CMP-2A25 Programming - Software Development Techniques
Description			: Polygon class holding draw method

**************************************************************/

import java.io.*;

public class ASTPolygon extends SimpleNode 
{
	public ASTPolygon(int id) 
	{
		super(id);
	}

	public ASTPolygon(DrawPhase3 p, int id) 
	{
		super(p, id);
	}

	public void generate(FileWriter SVGFile, int Xsc, int Ysc, int X, 
						int Y, String colour, int brush)
    {
		//gets number of points
        int x = jjtGetNumChildren();
		//loops through number of children creating a line each time
        for(int y = 2; y < x; y += 2)
		{
			//draws line
            DrawLine
				(SVGFile, Xsc, Ysc, X, Y, colour, brush,
				((ASTInt)jjtGetChild(y - 2)).val, 
				((ASTInt)jjtGetChild(y - 1)).val, 
				((ASTInt)jjtGetChild(y)).val, 
				((ASTInt)jjtGetChild(y + 1)).val);

			//draws end line linking first and last points
			DrawLine
				(SVGFile, Xsc, Ysc, X, Y, colour, brush,
				((ASTInt)jjtGetChild(x - 2)).val, 
				((ASTInt)jjtGetChild(x - 1)).val, 
				((ASTInt)jjtGetChild(0)).val, 
				((ASTInt)jjtGetChild(1)).val);
		}
	}
}
