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

#ifndef CANADIANEXPERIENCE_MACHINELIB_CYLINDER_H
#define CANADIANEXPERIENCE_MACHINELIB_CYLINDER_H

#include "Shape.h"
#include "Polygon.h"
#include "AirSink.h"
#include "StruckInstrument.h"

/**
 * cylinder that strikes instruments
 */
class Cylinder: public Shape
{
private:
	///mount of cylinder
	cse335::Polygon mMount;

	/// cylinder body
	cse335::Polygon mCylinder;

	///cylinder RAM
	cse335::Polygon mRam;

	///max extension for RAM
	double mMaxExtent = 1;

	///check if ram needs to extend to struck instrument
	double mPressure =0;

	/// The air sink for this component
	AirSink mSink;

	///instrument this cylinder hits
	std::shared_ptr<StruckInstrument> mInstrument;

public:

	Cylinder(std::wstring resourcesDir);

	/// Default constructor
	Cylinder()=delete;

	/// Copy constructor (disabled)
	Cylinder(const Cylinder &) = delete;

	/// Assignment operator
	void operator=(const Cylinder &) = delete;

	virtual void Draw(std::shared_ptr<wxGraphicsContext> graphics,double x, double y) override;


	/**
	 * setter for rotation
	 * @param rotation
	 */
	void SetRotation(double rotation) override;

	/**
	 * getter for rotation
	 * @return
	 */
	double GetRotation() override {return mCylinder.GetRotation();}
	/**
	 * set max extent for cylinder ram
	 * @param max
	 */
	void SetMaxExtent(double max){mMaxExtent=max;}

	/**
	 * sets the sink for cylinder
	 * @param instrument
	 */
	void SetMotionSink(std::shared_ptr<StruckInstrument> instrument){mInstrument=instrument;}

	/**
	 * getter for sink
	 * @return
	 */
	AirSink *GetSink(){return &mSink;}

	void SendPressure(double pressure) override;

	wxPoint GetPosition() override;
};

#endif //CANADIANEXPERIENCE_MACHINELIB_CYLINDER_H