#ifndef  __CUTARC_DLL_H_INCLUDE__
#define  __CUTARC_DLL_H_INCLUDE__
 
#include "cncobj.h"


//控制点数量
#define CA_MAX_CP_CNT   3

// This class is exported from the CutArc.dll
class CNCCLS_API CCutArc : public CCncObj{


public:
	CCutArc(void);
	virtual ~CCutArc(void);
	
	
	//像素坐标@1
	RvPoint_f   GetCenter(/*int& x, int& y*/);
	void   SetCenter(float x, float y, BOOL bUpdateMap =FALSE );
	
	float    GetRadius();
	void   SetRadius(float val, BOOL bUpdateMap =FALSE );
	
	//单位：度
	float   GetStartAngle();
	 void   SetStartAngle(float val, BOOL bUpdateMap =FALSE );
	//单位：度
	 float   GetEndAngle();
	 void   SetEndAngle(float val, BOOL bUpdateMap =FALSE );

	 //virtual RvPoint GetCounterCamPos(int index);

	//end of @1

	

	 //@2 机械坐标
	virtual double GetMacLength();
//	virtual RvPoint_f64 GetStartMacPos() ; 
//	virtual RvPoint_f64 GetEndMacPos();
	//virtual RvPoint_f64 GetReferMacPos();

	virtual int GetMacPosCount();
	virtual RvPoint_f64 GetMacPosAt(int index) ;
	virtual RvPoint_f64* GetMacPosArray() ;
	virtual void SetMacPosAt(int index, RvPoint_f64 pos) ;
	

	RvPoint_f64 GetMacCenter();
	double GetMacRadius();
	double GetMacStartAngle();
	double GetMacEndAngle();
//end of @2
	virtual RvPoint_f  GetCamPosAt(int index) ;
	virtual void     SetCamPosAt(int index, RvPoint_f pos);

	
	virtual void UpdateCamPos();
	virtual void UpdateMacPos();

	 
	 
public:
	virtual void ShowExtender(CDelegate* pDelegate,CLeadMark* pMark);
	virtual void  ShowGrabber(CDelegate* pDelegate, CLeadMark* pMark);	

	virtual CUCObj* Clone( CUCObj* twin);
	
	virtual BOOL Serialize(HANDLE device, BOOL bIn );	
    void Show(CDelegate* pDelegate, int mode,BOOL bForce);

	virtual void OnEndTrack(CDelegate* pDelegate,HGPD hCur,  GPoint point, int nHitTest);
	
	//图像坐标缩放和旋转
	virtual void Scale(double scale);
    virtual void Scale(double scaleX, double scaleY);
    virtual void Rotate(double cx, double cy, double angle);


private:

	void ResetExtender();
	void UpdateRect();

	//BOOL m_bAntiClockwise;
	//控制点,机械坐标
	RvPoint_f64  m_cps[CA_MAX_CP_CNT];
	
	double CalcRadius(RvPoint_f64 pt, RvPoint_f64 center);
	
	double CalcAngle(RvPoint_f64 pt, RvPoint_f64 center);
	
	//BOOL CalcArcCenter(RvPoint_f64 &p1,RvPoint_f64 &p2,RvPoint_f64 &p3, RvPoint_f64* pCenter);

	RV_HANDLE DrawCutter(CDelegate* pDelegate,    float radius, RV_HANDLE hStroke);

	void GetExtenderPoint(CDelegate* pDelegate,double &x, double &y ,int index);
	
	RV_HANDLE DrawArcPath(HGDC dc,  double cx, double cy, double r, double sAngle, double eAngle, double offset, RV_HANDLE hStroke);
 

//	BOOL UpdateCurve(void);
};


#endif


