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

public class ASTLine extends SimpleNode 
{
	/*************************************************
	
						Constructors
		
	*************************************************/
	
	public ASTLine(int id) 
	{
    	super(id);
  	}

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

  	/*************************************************
	
	Creates the SVG code for the Line and returns it in
	a string.
		
	*************************************************/
  
  	public String generateSVG()
  	{
  		String colour="black", temp;
  		int brushSize = 1, offsetX = 0, offsetY = 0;
  		
  		//Gathers the children into each variable
  		
  		int x1 = ((ASTInt) jjtGetChild(0)).val;
  		int y1 = ((ASTInt) jjtGetChild(1)).val;
  		int x2 = ((ASTInt) jjtGetChild(2)).val;
  		int y2 = ((ASTInt) jjtGetChild(3)).val;
  		
  		/*************************************************
	
		Checks to see if parent is null
		
		*************************************************/
  		
        if(!(jjtGetParent().getParentType() == null))
        {
        
  			if(jjtGetParent().getParentType().equals("brush"))
  			{
  				brushSize = jjtGetParent().getBrush();
  			}
  		
  			if(jjtGetParent().getParentType().equals("colour"))
  			{
  				colour = jjtGetParent().getColour();
  			}
  		
  			if(jjtGetParent().getParentType().equals("offset"))
  			{
  				offsetX = jjtGetParent().getOffsetX();
  				offsetY = jjtGetParent().getOffsetY();
  				
  				x1 = x1 + offsetX; y1 = y1 + offsetY;
				x2 = x2 + offsetX; y2 = y2 + offsetY;
  			}
  			
  			/*************************************************
	
			Checks if the parent of the parent is null
		
			*************************************************/
  			
  			if(!(jjtGetParent().jjtGetParent().getParentType() == null))
        	{
  		
  				if(jjtGetParent().jjtGetParent().getParentType().equals("brush"))
  				{
  					brushSize = jjtGetParent().jjtGetParent().getBrush();
  				}
  		
  				if(jjtGetParent().jjtGetParent().getParentType().equals("colour"))
  				{
  					colour = jjtGetParent().jjtGetParent().getColour();
  				}
  		
  				if(jjtGetParent().jjtGetParent().getParentType().equals("offset"))
  				{
  					offsetX = jjtGetParent().jjtGetParent().getOffsetX();
  					offsetY = jjtGetParent().jjtGetParent().getOffsetY();
  					
  					x1 = x1 + offsetX; y1 = y1 + offsetY;
  					x2 = x2 + offsetX; y2 = y2 + offsetY;
  				}
  				
  				/*************************************************
	
				Checks if the parent of the parent of the parent is null
		
				*************************************************/
  				
  				if(!(jjtGetParent().jjtGetParent().jjtGetParent().getParentType() == null))
  				{
  					if(jjtGetParent().jjtGetParent().jjtGetParent().getParentType().equals("brush"))
  					{
  						brushSize = jjtGetParent().jjtGetParent().jjtGetParent().getBrush();
  					}
  		
  					if(jjtGetParent().jjtGetParent().jjtGetParent().getParentType().equals("colour"))
  					{
  						colour = jjtGetParent().jjtGetParent().jjtGetParent().getColour();
  					}
  		
  					if(jjtGetParent().jjtGetParent().jjtGetParent().getParentType().equals("offset"))
  					{	
  						offsetX = jjtGetParent().jjtGetParent().jjtGetParent().getOffsetX();
  						offsetY = jjtGetParent().jjtGetParent().jjtGetParent().getOffsetY();
  						
  						x1 = x1 + offsetX; y1 = y1 + offsetY;
 	 					x2 = x2 + offsetX; y2 = y2 + offsetY;
  					}
  				}
  			}
  		}
  		
  		/*************************************************
	
		Enters the SVG code into the string before returning it
		uses the variable set up above as the co-ords of each
		point on the line
		
		*************************************************/
  		
  		temp = ("<line x1=\"" + x1 + "\" y1=\"" + y1 + "\" x2=\"" + x2 + 
  			"\" y2=\"" + y2 + "\" stroke=\""+ colour + "\" stroke-width=\""+brushSize+"\"/>");
  	
  		return temp;
  	}
  	
  	/*************************************************
	
	Methods required by Node interface
		
	*************************************************/
  	
  	public void generate()
  	{
  	}
  	
  	public int getBrush()
  	{
  		return 0;
  	}
  	
  	public String getColour()
  	{
  		return null;
  	}
  	
  	public String getParentType()
  	{
  		return null;
  	}
  	
  	public int getOffsetX()
  	{
  		return 0;
  	}
  
  	public int getOffsetY()
	{
  		return 0;
  	}

}
