#ifndef _GAGERR_H_
#define _GAGERR_H_

class  CGageRR
{
private:
	char m_strUnit[20];
	char m_strCaption[32];
private:
	int m_nFillColor;
	int m_nLineColor;
	int m_nPublicTextColor;
private:
	int m_nPeoples;
	int m_nTimes;
	int m_nSamples;
	int m_nRowHeight;
	int m_nTextWidth;
	int m_nEx;
private:
	float m_fTolerance;
	float m_fBase;
	BOOL  m_bTolerance;

private:
	float m_fRp;
	float m_fR;
	float m_fXp;
	float m_fDiffX;

	float m_fEV; //重复性-设备变差
	float m_fAV; //再现性-评价人变差
	float m_fR_R;//重复性和再现性
	float m_fPV; //零件变差
	float m_fTV; //总变差
	float m_fNDC; //有效分辨率

	float m_fEV_P;
	float m_fAV_P;
	float m_fR_R_P;
	float m_fPV_P;
	
//	float m_fGageRR_P;
private:
	float *m_pfData;
private:
	int   m_nMethod;
public:
	void  SetMethod(int nMethod){m_nMethod = nMethod;}
	int   GetMethod(){return(m_nMethod);}
	void  SetUnit(char *pStr){_fstrcpy(m_strUnit,pStr);}
	void  SetCaption(char *pStr){_fstrcpy(m_strCaption,pStr);}

	float GetRp(){return(m_fRp);}
	float GetR(){return(m_fR);}
	float GetXp(){return(m_fXp);}
	float GetDiffX(){return(m_fDiffX);}

	float GetEV(){return(m_fEV);}
	float GetAV(){return(m_fAV);}
	float GetR_R(){return(m_fR_R);}
	float GetPV(){return(m_fPV);}
	float GetTV(){return(m_fTV);}
	float GetNDC(){return(m_fNDC);}

	float GetEV_P(){return(m_fEV_P);}
	float GetAV_P(){return(m_fAV_P);}
	float GetR_R_P(){return(m_fR_R_P);}
	float GetPV_P(){return(m_fPV_P);}	
	//float GetGageRR_P(){return(m_fGageRR_P);}
public:
	void  SetToleranceAttrib(float fBase,float fTolerance,BOOL bTolerance){m_fBase = fBase,m_fTolerance = fTolerance,m_bTolerance = bTolerance;}
	void SetPeoples(int nPeoples){m_nPeoples = nPeoples;}
	void SetTimes(int nTimes)    {m_nTimes   = nTimes;}
	void SetSamples(int nSamples){m_nSamples = nSamples;}
	void SetRowHeight(int nRowHeight){m_nRowHeight = nRowHeight;}
	void SetTextWidth(int nTextWidth){m_nTextWidth = nTextWidth;}
	void SetEx(int nEx){m_nEx = nEx;}
public:
	void SetData(float *pfData,int nPeoples,int nTimes,int nSamples, int nMethod);

	int  DrawGageRR(int nLeft,int nTop,int nPageWidth,int nPageHeight,int nPageOrder,BOOL bPrint);
	int  PrintGageRR(BOOL bPrint);
	int  DrawHistogram(int nLeft,int nTop,int nWidth,int nHeight);
public:
	CGageRR();
	~CGageRR();
};


#endif