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

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

  public ASTCircle(drawphase3 p, int id) {
    super(p, id);
  }

  public String getType()
  {
    return "Circle";
  }

  /*----------------------------------------------*/
  /*  Returns Circle in an Ellipse form           */
  /*----------------------------------------------*/
  public String getString()
  {
    String colour = getColour();
    int offsetX = getOffsetX();
    int offsetY = getOffsetY();
    int scaleX = getScaleX();
    int scaleY = getScaleY();
    int brush = getBrush(); 
    int repeatX = getRepeatX();
    int repeatY = getRepeatY();

    int origionalRadius = ((ASTInt) jjtGetChild(2)).val - ((ASTInt) jjtGetChild(0)).val; 
    int xLeft = ((ASTInt) jjtGetChild(0)).val * scaleX;
    int yTop = ((ASTInt) jjtGetChild(1)).val * scaleY;
    int xRight = ((ASTInt) jjtGetChild(2)).val * scaleX;
    int yBottom = (yTop + (origionalRadius)) * scaleY;
    
    int width = xRight - xLeft;
    int height = yBottom - yTop; 
    int vRadius = height/2;
    int hRadius = width/2;

    /*----------------------------------------------*/
    /* Ensures the radius is a positive value       */
    /*----------------------------------------------*/
    if (vRadius < 0)
    {
      vRadius = vRadius * -1;
    }
    if (hRadius < 0)
    {
      hRadius = hRadius * -1;
    }
    
    return "  <ellipse cx=\"" + (xLeft + (width/2) + offsetX + repeatX) +
                   "\" cy=\"" + (yTop + (height/2) + offsetY + repeatY) + 
                   "\" rx=\"" + hRadius + 
                   "\" ry=\"" + vRadius + 
                   "\" fill=\"none\" stroke=\"" +  colour + 
                   "\" stroke-width=\"" +  brush + "\"/>";
  }
}
