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

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

  public ASTEllipse(drawphase3 p, int id) {
    super(p, id);
  }
  
  public String getType()
  {
    return "Ellipse";
  }

  /*----------------------------------------------*/
  /*  Returns Ellipse                             */
  /*----------------------------------------------*/
  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 xLeft = ((ASTInt) jjtGetChild(0)).val * scaleX;
    int yTop = ((ASTInt) jjtGetChild(1)).val * scaleY;
    int xRight = ((ASTInt) jjtGetChild(2)).val * scaleX;
    int yBottom = ((ASTInt) jjtGetChild(3)).val * 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 + "\"/>";
  }
}
