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

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

  public ASTPolygon(drawphase2 p, int id) {
    super(p, id);
  }
  
  public String getType()
  {
    return "Polygon";
  }

  /*----------------------------------------------*/
  /*  Returns polygon as n lines     	        */
  /*----------------------------------------------*/
  public String getString()
  {
    String polygon = "{";
    int brush = getBrush(); 
    String colour = getColour();
    int offsetX = getOffsetX();
    int offsetY = getOffsetY();

    int noChilds = jjtGetNumChildren();

    /*---------------------------------------------*/
    /* Draws a line in between each pair of points */
    /*---------------------------------------------*/
    for (int i=0; i < noChilds-2; i++) 
    {
      polygon = polygon + "\n" +
      formatLine(((ASTInt) jjtGetChild(i)).val,((ASTInt) jjtGetChild(i+1)).val,((ASTInt) jjtGetChild(i+2)).val,((ASTInt) jjtGetChild(i+3)).val,colour,brush,offsetX,offsetY);
      i = i + 1;
    }

    /*-----------------------------------------*/
    /* Joins the last point to the first point */
    /*-----------------------------------------*/
    polygon = polygon + "\n" +
    formatLine(((ASTInt) jjtGetChild(noChilds-2)).val,((ASTInt) jjtGetChild(noChilds-1)).val,((ASTInt) jjtGetChild(0)).val,((ASTInt) jjtGetChild(1)).val,colour,brush,offsetX,offsetY) + 
    "\n}";
    
    return polygon; 
  }

}
