
#if !defined(__RV_PART_SPACE_H_INCLUDED_)
#define __RV_PART_SPACE_H_INCLUDED_

#pragma once
 
#include "gauge.h"
 
#include <cali\CurveCal.h>
#include <cali\AreaCal.h>

#define PS_MAX_PART_COUNT     (128*4)

#define PS_MAX_SEG_COUNT   7

class GAUGE_API CPartSpace :	public CAreaCal
{
public:
	CPartSpace(void);
	virtual ~CPartSpace(void);

 
 	virtual void Show(CDelegate* pDelegate, int mode, BOOL bForce);	 
	virtual CUCObj* Clone( CUCObj* twin) ;
	virtual BOOL Serialize(HANDLE device, BOOL bIn );
	 
	virtual RV_BOOL Inspect(int* pErrCode );
	 
	virtual void Reset();
	 
 
 
	//方形， 圆， 圆弧（目前仅支持方形）
	virtual void SetShape(int shape);

	
	int    GetPartCount();            //灯珠总数
	RvPoint_f64 GetPartPosAt(int index);

	int    GetRowCount();             //排数
	int    GetPartsInRow(int index);  //每排的数量
	double GetSpaceAt(int index);   //距离总数: 排数-1  

public: 
	int  m_nPartsPerRow;   //每排多少零件,保留
	int  m_nMaxRows ;      //最多排数，保留
	int  m_nHaloSize ;    //光源宽度(发光体拍摄过程为产生光晕)
	BOOL m_bVertical;     //是否垂直方向
	int  m_nMinSpace;     //最小间隔
	//CCurveCal m_curveCal;

public:
	virtual void OnEndTrack(CDelegate* pDelegate,HGPD hCur,  GPoint point, int type)  ;

protected:
	RV_HANDLE   DrawMarks(HGDC dc, RvPoint_f64* pPosArray, int count, RV_HANDLE hStroke );
	//BOOL CheckPath(RvPath path,  float* pSpaceArray ,int& nSpaceSize , float* pPartArray, int& nPartSize,  RvPoint_f* pPosArray, int& nPosSize, int& nStartLevel);

private:

	void ReleaseArrays();
    
	int          m_nPosCount;
	RvPoint_f64* m_pPosArray;    //产品位置信息

	//int        m_nPartCount;
	int        m_nActualRows; 
	double*    m_pSpaceArray;  //相邻排距离
	int*       m_pPartCountArray;  //每排产品数量



};



#endif
