CanadianMachines / MachineLib / Shape.h
Shape.h
Raw
/**
 * @file Shape.h
 * @author sriram
 *
 *
 */

#ifndef CANADIANEXPERIENCE_MACHINELIB_SHAPE_H
#define CANADIANEXPERIENCE_MACHINELIB_SHAPE_H

#include "Component.h"
#include "Polygon.h"

/**
 * class definition for shape
 */
class Shape: public Component
{
private:

	///polygon
	cse335::Polygon mPolygon;

public:
	Shape();

	///destructor
	virtual ~Shape() {};

	/**
	 * add point to polygon
	 * @param x
	 * @param y
	 */
	void AddPoint(double x, double y){mPolygon.AddPoint(x,y);}

	/**
	 * set color
	 * @param color
	 */
	void SetColor(wxColour color){mPolygon.SetColor(color);}

	/**
	 * setter for image
	 * @param filename
	 */
	void SetImage(std::wstring filename){mPolygon.SetImage(filename);}

	/**
	 * draw
	 * @param graphics
	 * @param x
	 * @param y
	 */
	virtual void Draw(std::shared_ptr<wxGraphicsContext> graphics,double x, double y);

	/**
	 * create rectangle
	 * @param x
	 * @param y
	 * @param width
	 * @param height
	 */
	void Rectangle(int x, int y, int width = 0, int height = 0);
	/**
	 * Set the rotation of the polygon
	 * @param rotation Rotation in turns, where 0-1 is one revolution.
	 */
	virtual void SetRotation(double rotation){mPolygon.SetRotation(rotation);}

	/**
	 * getter for rotation
	 * @return
	 */
	virtual double GetRotation()  {return mPolygon.GetRotation();}

	/**
	 * get image width
	 * @return
	 */
	double GetImageWidth(){return mPolygon.GetImageWidth();}

};

#endif //CANADIANEXPERIENCE_MACHINELIB_SHAPE_H