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

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

  public ASTPolygon(drawphase1 p, int id) {
    super(p, id);
  }
  
   public void generate(String itemCol, int brushNo, int offsetX, int offsetY)
   {

    int numOfLines=jjtGetNumChildren();

    int [] lines=new int[numOfLines];

    for(int i=0; i<numOfLines; i++)
	lines[i]=((ASTInt) jjtGetChild(i)).val;

	drawPolygon(lines, itemCol, brushNo, offsetX, offsetY);
    }

   public void drawPolygon(int lines[], String itemCol, int brushNo, int offsetX, int offsetY)
   {
	int noOfLines=lines.length;
	for(int i=0; i<noOfLines; i++)
	{
	drawLine(lines[i], lines[i+1], lines[1+2], lines[i+3], itemCol, brushNo, offsetX, offsetY);
	}
	drawLine(lines[0], lines[1], lines[noOfLines-2], lines[noOfLines-1], itemCol, brushNo, offsetX, offsetY);

  }
}
