
#pragma once

#define FILLMINDIS  0.00001

typedef struct baseHatch
{
	baseHatch()
	{
		::memset(this, 0, sizeof(baseHatch));
		dbSpace = 0.01;
		nLoopNum = 1;
		dbLoopDist = 0.01;
		nFillNum = 1;
		bFillSameSideFirst = FALSE;
	}
	BOOL Equal(const baseHatch & src)
	{
		if( &src == this )	
		{
			return TRUE;
		}
		if( bEnable == src.bEnable 
			&& bEquaDist == src.bEquaDist
			&& bKeepAngle == src.bKeepAngle
			&& nFillStyle == src.nFillStyle		//填充类型
			&& dbSpace == src.dbSpace		//填充间距
			&& dbAngle == src.dbAngle		//填充角度
			&& dbBeamComp == src.dbBeamComp		//光栅大小
			&& dbLineReduce == src.dbLineReduce   //线首点缩进量
			&& dbStartOffset == src.dbStartOffset  //起始缩进量
			&& dbEndOffset == src.dbEndOffset    //末尾缩进量
			&& dbMinJump == src.dbMinJump      //最小跳转间距
			&& bLoop == src.bLoop			//缩扩使能
			&& nLoopNum == src.nLoopNum		//缩扩圈数
			&& dbLoopDist == src.dbLoopDist		//缩扩间距
			&& bRemoveLine == src.bRemoveLine//缩扩后去掉填充线
			&& bRemoveOrg == src.bRemoveOrg		//缩扩后去掉原始轮廓
		    && nFillNum == src.nFillNum		//填充次数
			&& ProAngle == src.ProAngle		//累进角度
			&& AddDis == src.AddDis			//累进间距
		    && bSaveCountour == src.bSaveCountour	//填充后保留外框
			&& dbLineReduceEnd == src.dbLineReduceEnd	// 线尾点缩进量
			&& nLoopFillOuter == src.nLoopFillOuter   /// 环形填充方向
			&& nLoopRandFirst == src.nLoopRandFirst   /// 环形填充打乱散点
			&& bFillSameSideFirst == src.bFillSameSideFirst
			)
			return TRUE;
		else
			return FALSE;
	}
	
public:
	BOOL	bEnable;		//填充使能
	BOOL	bEquaDist;		//等间距使能
	BOOL	bKeepAngle;		//填充线绕轮廓旋转
	int		nFillStyle;		//填充类型
	double	dbSpace;		//填充间距
	double	dbAngle;		//填充角度
	double	dbBeamComp;		//光栅大小
	double	dbLineReduce;   //线首点缩进量
	double	dbStartOffset;  //起始缩进量
	double	dbEndOffset;    //末尾缩进量
	double	dbMinJump;      //最小跳转间距
	
	BOOL	bLoop;			//缩扩使能
	int		nLoopNum;		//缩扩圈数
	double	dbLoopDist;		//缩扩间距
	BOOL	bRemoveLine;	//缩扩后去掉填充线
	BOOL	bRemoveOrg;		//缩扩后去掉原始轮廓
	
	int    nFillNum;		//填充次数
	double ProAngle;		//累进角度
	double AddDis;			//累进间距
	BOOL   bSaveCountour;	//填充后保留外框
	double dbLineReduceEnd;	// 线尾点缩进量

	////// add by zhq,20190823填充新增
	int nLoopFillOuter; //// 环形填充向外标志,0为向内填,1为向外填
	int nLoopRandFirst; //// 环形填充首点打乱标志,0为不打乱,1需要打乱

	//add by hzj, 20200707填充新增
	BOOL bFillSameSideFirst;	//先填充同一边

}BaseHatch;

typedef struct HATCH_PARA 
{
	HATCH_PARA()
	{
		::memset(this, 0, sizeof(HATCH_PARA));
		
		newFileData1.dbSpace = 0.01;
		newFileData1.dbLoopDist = 0.01;
		newFileData1.nLoopNum = 1;
		newFileData1.dbAngle  = 0;
		newFileData1.nFillNum = 1;
		
		newFileData2.dbSpace = 0.01;
		newFileData2.dbLoopDist = 0.01;
		newFileData2.nLoopNum = 1;
		newFileData2.dbAngle = 90;
		newFileData2.nFillNum = 1;

		newFileData3.dbSpace = 0.01;
		newFileData3.dbLoopDist = 0.01;
		newFileData3.nLoopNum = 1;
		newFileData3.dbAngle = 90;
		newFileData3.nFillNum = 1;
		
		bFillFirst = TRUE;
	}
	BOOL Equal(const HATCH_PARA & src)
	{
		if( &src == this )	
		{
			return TRUE;
		}

		if( bFillFirst == src.bFillFirst 
			&& bFillAlign == src.bFillAlign 
			&& newFileData1.Equal(src.newFileData1)
			&& newFileData2.Equal(src.newFileData2)
			&& newFileData3.Equal(src.newFileData3)
			)
			return TRUE;
		else
			return FALSE;
	}
	
public:
	BaseHatch  newFileData1;
	BaseHatch  newFileData2;
	BaseHatch  newFileData3;
	BOOL 	   bFillFirst;          //先打填充
	BOOL      bFillAlign;          //打标时填充线对齐

}HATCHPARA0,*LP_HATCHPARA0;

typedef BaseHatch  NEW_FILL_DATA;
typedef HATCHPARA0  FILLDATA0;

typedef struct HATCH_PARA0_1
{
	HATCH_PARA0_1()
	{
		::memset(this, 0, sizeof(HATCH_PARA0_1));

		newFileData1.dbSpace = 0.01;
		newFileData1.dbLoopDist = 0.01;
		newFileData1.nLoopNum = 1;
		newFileData1.dbAngle  = 0;
		newFileData1.nFillNum = 1;

		newFileData2.dbSpace = 0.01;
		newFileData2.dbLoopDist = 0.01;
		newFileData2.nLoopNum = 1;
		newFileData2.dbAngle = 90;
		newFileData2.nFillNum = 1;

		newFileData3.dbSpace = 0.01;
		newFileData3.dbLoopDist = 0.01;
		newFileData3.nLoopNum = 1;
		newFileData3.dbAngle = 90;
		newFileData3.nFillNum = 1;

		bFillFirst = TRUE;
		bMarkFillOnly=FALSE;
	}
	BOOL Equal(const HATCH_PARA0_1 & src)
	{
		if( &src == this )	
		{
			return TRUE;
		}

		if( bMarkFillOnly==src.bMarkFillOnly
			&&bFillFirst == src.bFillFirst 
			&& bFillAlign == src.bFillAlign 
			&& newFileData1.Equal(src.newFileData1)
			&& newFileData2.Equal(src.newFileData2)
			&& newFileData3.Equal(src.newFileData3)
			)
			return TRUE;
		else
			return FALSE;
	}

public:
	BaseHatch  newFileData1;
	BaseHatch  newFileData2;
	BaseHatch  newFileData3;
	BOOL 	   bFillFirst;          //先打填充
	BOOL      bFillAlign;          //打标时填充线对齐
	BOOL      bMarkFillOnly;

}HATCHPARA0_1,*LP_HATCHPARA0_1;

typedef struct HATCH_PARA1 
{
	HATCH_PARA1()
	{
		::memset(this, 0, sizeof(HATCH_PARA1));

		newFileData1.dbSpace = 0.01;
		newFileData1.dbLoopDist = 0.01;
		newFileData1.nLoopNum = 1;
		newFileData1.dbAngle  = 0;
		newFileData1.nFillNum = 1;
		arrNLayer[0] = 0;
		arrCrossFill[0] = 0;

		newFileData2.dbSpace = 0.01;
		newFileData2.dbLoopDist = 0.01;
		newFileData2.nLoopNum = 1;
		newFileData2.dbAngle = 90;
		newFileData2.nFillNum = 1;
		arrNLayer[1] = 0;
		arrCrossFill[1] = 0;

		newFileData3.dbSpace = 0.01;
		newFileData3.dbLoopDist = 0.01;
		newFileData3.nLoopNum = 1;
		newFileData3.dbAngle = 90;
		newFileData3.nFillNum = 1;
		arrNLayer[2] = 0;
		arrCrossFill[2] = 0;

		bFillFirst = TRUE;
		bMarkFillOnly=FALSE;
	}
	BOOL Equal(const HATCH_PARA1 & src)
	{
		if( &src == this )	
		{
			return TRUE;
		}

		if( bMarkFillOnly==src.bMarkFillOnly
			&&bFillFirst == src.bFillFirst 
			&& bFillAlign == src.bFillAlign 
			&& newFileData1.Equal(src.newFileData1)
			&& newFileData2.Equal(src.newFileData2)
			&& newFileData3.Equal(src.newFileData3)
			&& arrNLayer[0] == src.arrNLayer[0]
		&& arrNLayer[1] == src.arrNLayer[1]
		&& arrNLayer[2] == src.arrNLayer[2]
		&& arrCrossFill[0] == src.arrCrossFill[0]
		&& arrCrossFill[1] == src.arrCrossFill[1]
		&& arrCrossFill[2] == src.arrCrossFill[2]
		)
			return TRUE;
		else
			return FALSE;
	}

public:
	BaseHatch  newFileData1;
	BaseHatch  newFileData2;
	BaseHatch  newFileData3;
	BOOL 	   bFillFirst;         // 先打填充
	BOOL      bFillAlign;          // 打标时填充线对齐
	BOOL      bMarkFillOnly;
	int		  arrNLayer[3];		   // 三个填充的层号
	int       arrCrossFill[3];     // by 2024/04/30 三个填充中交叉填充使能标志数组

}HATCHPARA,*LP_HATCHPARA;
typedef HATCHPARA  FILLDATA;