www.pudn.com > roll.rar > CURVE2D.H
// Curve2D.h : header file
//
/////////////////////////////////////////////////////////////////////////////
// class OneCurve, CCurve2D
class OneCurve {
//
public:
DWORD nxy;
short mark;
double *x,*y;
BYTE bRed,bGreen,bBlue;
public:
OneCurve(double *xx=NULL,double *yy=NULL,DWORD nnxy=0)
{
x = xx;
y = yy;
nxy = nnxy;
mark=0;
bRed=bGreen=bBlue=0;
};
OneCurve(double *xx,DWORD nnxy)
{
if(xx) {
x = xx;
y = new double[nnxy];
nxy = nnxy;
}
else OneCurve(nnxy);
mark=0;
bRed=bGreen=bBlue=0;
};
OneCurve(DWORD nnxy)
{
x = new double[nnxy];
y = new double[nnxy];
nxy = nnxy;
mark=0;
bRed=bGreen=bBlue=0;
};
void FindMinMaxXY(double& xmin,double& xmax,double& ymin,double& ymax,BOOL bStart=TRUE);
void FindMinMaxX(double& xmin,double& xmax,BOOL bStart=TRUE);
void FindMinMaxY(double& ymin,double& ymax,BOOL bStart=TRUE);
};
class CCurve2D
{
BOOL bReadFromFile;
void CalcNumY(char *buf);
void DeleteAll();
BOOL AllocateCurve(DWORD ni,short OldNumCurve=0);
void ReadDataFromString(char *buf,DWORD index,short OldNumCurve=0);
BOOL ReadFileString(HANDLE hFile,char* Buffer,DWORD NumToRead,DWORD& NumReRead);
// Construction
public:
CString filename;
CCurve2D();
void SetCCurve2D(double *nx[],double *ny[],DWORD nnxy[],short ncurve);
void SetCCurve2D(double *nx,double *ny[],DWORD nnxy,short ncurve);
void SetCCurve2D(double *nx,double *ny,DWORD nnxy);
BOOL ReadDataFile(CString filename,BOOL bFormat=FALSE);
void DrawCurve(HWND hWnd);
// Attributes
public:
OneCurve *Curve;
short NumCurve;
double xmin,xmax;
double ymin,ymax;
// Operations
protected:
void MoveTo_f(HDC hdc,double x,double y);
void LineTo_f(HDC hdc,double x,double y);
// Implementation
public:
virtual ~CCurve2D();
};
/////////////////////////////////////////////////////////////////////////////