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

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

  public ASTrectangle(S p, int id) {
    super(p, id);
  }

  /*same as phase one but with added stroke-width, stroke commands and offsets added*/
  
  public void getSVG()
  {
    int linewidth = jjtGetParent().getLineWidth();
    String col = jjtGetParent().getColour();
    int xOff = jjtGetParent().getXOff();
    int yOff = jjtGetParent().getYOff();
    int xleft = xOff + jjtGetChild(0).getParam();
    int ytop = yOff + jjtGetChild(1).getParam();
    int xright = xOff + jjtGetChild(2).getParam();
    int ybottom = yOff + jjtGetChild(3).getParam();

    /* Float halflinewidth stores the line width divided by two (float as could include a half). 
    This is to resolve the issue of lines not joining correctly at corners. By extending them
    by half their line width they meet correctly */

    float halflinewidth = (float)(jjtGetParent().jjtGetParent().getLineWidth())/2;
           
    System.out.println("<line stroke-width=\"" + linewidth + "\" stroke=\"" + col +"\" x1=\"" + (xleft-halflinewidth)
       + "\" y1=\"" + (ytop-halflinewidth) + "\" x2=\"" + (xright+halflinewidth) + "\" y2=\"" + (ytop-halflinewidth) + "\"/>");
    System.out.println("<line stroke-width=\"" + linewidth + "\" stroke=\"" + col +"\" x1=\"" + (xright+halflinewidth)
       + "\" y1=\"" + (ybottom+halflinewidth) + "\" x2=\"" + (xleft-halflinewidth) + "\" y2=\"" + (ybottom+halflinewidth) + "\"/>");
    System.out.println("<line stroke-width=\"" + linewidth + "\" stroke=\"" + col +"\" x1=\"" + (xleft-halflinewidth)
       + "\" y1=\"" + (ybottom+halflinewidth) + "\" x2=\"" + (xleft-halflinewidth) + "\" y2=\"" + (ytop-halflinewidth) + "\"/>");
    System.out.println("<line stroke-width=\"" + linewidth + "\" stroke=\"" + col +"\" x1=\"" + (xright+halflinewidth)
       + "\" y1=\"" + (ytop-halflinewidth) + "\" x2=\"" + (xright+halflinewidth) + "\" y2=\"" + (ybottom+halflinewidth) + "\"/>");

     
  }

}
