/**
 * 
 */
package com.roiron.spaceproject.graphic;

import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;

/**
 * @author Yohann Roiron
 *
 */
public class RectangleShape extends GraphicShape {

	//Size of the rectangle, here posX, posY corresponds to the center of the rectangle
	private double height;
	private double width;
	
	/** Complete Template with parameters
	 * @param posX position of the center of the rectangle
	 * @param posY  
	 * @param veloX velocity of the center of the rectangle
	 * @param veloY
	 * @param accX acceleration of the center of the rectangle
	 * @param accY 
	 * @param theta angle of the rectangle, 0 is the Horrizontale line
	 * @param vtheta angle velocity
	 * @param atheta angle acceleration
	 * @param color color of the rectangle
	 * @param width size of the rectangle
	 * @param height
	 * @param mass mass of the system
	 */
	public RectangleShape(double posX, double posY, double veloX, double veloY, double theta,
			double vtheta, Color color, double width, double height,double mass) {
		super(posX, posY, veloX, veloY,  theta, vtheta, color,mass);
		this.height=height;
		this.width=width;
	}

	/**
	 * first constructor with usefull parameters
	 * @param posX center  
	 * @param posY center 
	 * @param theta
	 * @param color
	 * @param mass mass of the system
	 */
	public RectangleShape(double posX, double posY, double theta, Color color, double width, double height,double mass) {
		super(posX, posY, theta, color,mass);
		this.height=height;
		this.width=width;
	}

	/**
	 * draw the rectangle in the template
	 */
	public void draw(Graphics g) {
		
		Graphics2D gg = (Graphics2D) g.create();
		//rotate the screen to draw a easier rectangle
		gg.rotate(getTheta(), getPosX(), getPosY());
		gg.setColor(getColor());
		gg.fillRect((int) (getPosX()-getWidth()/2.), (int) (getPosY()-getHeight()/2.),
				(int) getWidth() , (int)getHeight());
	    gg.dispose();//back to the normal Position
	}

	
	
	
	
	/**
	 * @return the height
	 */
	public double getHeight() {
		return height;
	}

	/**
	 * @return the width
	 */
	public double getWidth() {
		return width;
	}


}

@@ -156,17 +156,44 @@
 oiron%0A *
+ Enable to draw a rectangle
 %0A
-
  */%0Apubl
@@ -372,16 +372,52 @@
  width;%0A
+%09private boolean inContact = true; %0A
 %09%0A%09/** C
@@ -1261,17 +1261,16 @@
 h useful
-l
  paramet
@@ -2035,24 +2035,60 @@
 %0A%09%0A%09%0A%09%0A%09/**%0A
+%09 * Set the height of the rectangle%0A
 %09 * @return 
@@ -2154,24 +2154,59 @@
 t;%0A%09%7D%0A%0A%09/**%0A
+%09 * set the width of the rectangle%0A
 %09 * @return 
@@ -2244,24 +2244,24 @@
 etWidth() %7B%0A
-
 %09%09return wid
@@ -2268,11 +2268,332 @@
 th;%0A%09%7D%0A%0A
+%09/**%0A%09 * Is the rectangle in contact with something?%0A%09 * @return the inContact%0A%09 */%0A%09public boolean isInContact() %7B%0A%09%09return inContact;%0A%09%7D%0A%0A%09/**%0A%09 * Set the rectangle in contact with something%0A%09 * @param inContact the inContact to set%0A%09 */%0A%09public void setInContact(boolean inContact) %7B%0A%09%09this.inContact = inContact;%0A%09%7D%0A%0A
 %0A%7D%0A

add the incontact boolean