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

public class ASTLine extends SimpleNode {
  String name = "line";
  public ASTLine(int id) {
    super(id);
  }

  public ASTLine(drawphase2 p, int id) {
    super(p, id);
  }

  public String generate(String colour, int brushSize, int offsetX, int offsetY)
  {    
    //Makes the line from a single line [X Y X Y] command.
    String temp;     
    temp = makeLine(((ASTInt) jjtGetChild(0)).val, ((ASTInt) jjtGetChild(1)).val, ((ASTInt) jjtGetChild(2)).val, ((ASTInt) jjtGetChild(3)).val, colour, brushSize, offsetX, offsetY);
    return temp;
  }
  
  public static String makeLine(int x1, int y1, int x2, int y2, String colour, int brushSize, int offsetX, int offsetY)
  {
  	//This method is used by all polygons to create their lines. Coordinates
  	//offsets, colours etc are all passed in and a line is returned. Also
  	//all offsets are calculated here, not in the polygon method.
  	String temp;
  	x1 += offsetX;
  	x2 += offsetX;
  	y1 = y1 + offsetY;
  	y2 = y2 + offsetY;
    temp = ("<line x1=\"" + x1 +
        "\" y1=\"" + y1 +
        "\" x2=\"" + x2 +
        "\" y2=\"" + y2 +
        "\" stroke=\"" + colour + "\" stroke-width=\"" + brushSize + "\"/>");
        
    System.out.println(temp);
    return temp;
  }
  
  public String getName()
  {
     return name;
  }

}
