#pragma once

//#include "TabKits.h"


#include "cncobj.h"

#include <sst\ucb.h>

#define ET_MAX_VERTEX_COUNT    68

#define ET_OTHER    0
#define ET_POINT    1
#define ET_LINE     2
#define ET_ARC      3
#define ET_CIRCLE   4
#define ET_SHAPE_L  5
#define ET_SHAPE_U  6
#define ET_POLYLINE 7

class CNCCLS_API  CEasyTrace :	public CIndicater
{
public:
	CEasyTrace(void);
	virtual ~CEasyTrace(void);

	enum{
		ET_LEFT,
		ET_CENTER,
		ET_RIGHT,
	};

	virtual void Show(CDelegate* pDelegate, int mode,BOOL bForce);	

    BOOL AddVertex( int x, int y);
	BOOL TryVertex(int x, int y);

	BOOL RevokeLast();


	BOOL RecheckVertex(int x, int y);

	void SetTraceType(int type);


	int  GetVertexCount(){
	    return m_nVertexCount ;
	}

	int GetVertexWanted(){
	    return m_nTotalNeeded;
	}
	 
	void Reset() {
		m_nVertexCount =0; 
	    m_bTrace = FALSE; 

		memset(m_arrVertex, 0, sizeof(m_arrVertex));
	}
	 

	RvPoint_f/*GPoint*/ GetVertextAt(int index) {
		RvPoint_f pt={0.f, 0.f};

		if (index < 0 || index >= ET_MAX_VERTEX_COUNT) return pt/*GPOINT(-1,-1)*/;

		return m_arrVertex[index];
	}
	void SetVertextAt(int index, RvPoint_f/*GPoint*/ pos) {
		if (index < 0 || index >= ET_MAX_VERTEX_COUNT) return ;

		m_arrVertex[index] = pos;
	}
 
	//int  GetToolRadius();
	//void SetToolRadius(int radius);

public:
	BOOL m_bShowTool;
	int  m_nToolAlign;  //默认： ET_CENTER
	int  m_nToolRadius;  //刀具半径

private:
	RV_HANDLE DrawScale(HGDC dc, GPoint center, int distance,  RV_HANDLE hStroke);
	RV_HANDLE DrawControlPoints(HGDC dc,  int toolSize,  RV_HANDLE hStroke);
private:
	int     m_nTraceType;
	RvPoint_f/*GPoint*/  m_arrVertex[ET_MAX_VERTEX_COUNT];
	int     m_nVertexCount;
	int     m_nTotalNeeded;
	  
	//圆弧和圆弧相关@20250316
	float   m_nCenterX, m_nCenterY;
	float   m_nRadius;
	float   m_nStartAngle, m_nEndAngle;
	//End of @20250316

	BOOL   m_bTrace;	 
	

	
};

