#pragma once

#include "Axis.h"
#include "Line.h"
#include "MemDC.h"

#define DRAWPOSTIMER 1002
//////////////////////////////////////////////////////////////////////////
//
// [11/15/2012 Administrator]:这个Class 继承CStatic类 ，用于实现实时绘图，
//                            具有较高的使用价值
//////////////////////////////////////////////////////////////////////////
class CDrawCtrl : public CStatic
{
public:
	CDrawCtrl();
	virtual ~CDrawCtrl();
protected:
	//{{AFX_MSG(CDrawCtrl)
	// NOTE - the ClassWizard will add and remove member functions here.
	afx_msg void OnTimer(UINT nIDEvent);
	afx_msg void OnPaint();
	afx_msg void OnSize(UINT nType, int cx, int cy);
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
public:
	void StartDraw(int nRunType);
	void StopDraw();

	void DrawAll(CDC* pDC);
	void DrawBackGround(CDC* pDC);
	void InitCtrlRect();
	void InitCtrlRectXY(BOOL &bIsXYPos);
 	void InitCtrlRectVT(BOOL &bIsVT);
	void SetRate(int nRate);
 	void SetBkColor(COLORREF clrBkColor);

	void AddLines(int nStyle, COLORREF cColor, int nThick = 1);
	CLine& GetLine(int nIndex);
	int  GetLinesCount();

	void AddVTLines(int nStyle, COLORREF cColor, int nThick = 1);
	CLine& GetVTLine(int nIndex);
	int GetVTLinesCount();

	void DrawCirticalAxis(CDC* pDC);
	void DrawBallAxis(CDC* pDC);
	void DrawLeacesAxis(CDC* pDC);
	void DrawSinAxis(CDC* pDC);
	void DrawVTAxis(CDC* pDC);

	void DrawVTLine(CDC* pDC);
	void DrawCirticalLine(CDC* pDC);
	void DrawBallLine(CDC* pDC);
	void DrawLeavesLine(CDC* pDC);
	void DrawSinLine(CDC* pDC);
		
	void AddHomeRoadsX(int nStyle, COLORREF cColor, int nThick = 1);
	CLine& GetHomeRoadX(int nIndex);
	int GetHomeRoadXCount();
	void AddHomeRoadsY(int nStyle, COLORREF cColor, int nThick = 1);
	CLine& GetHomeRoadY(int nIndex);
	int GetHomeRoadYCount();
	void DrawMoveHomeX(CDC* pDC);
	void DrawMoveHomeY(CDC* pDC);

	CRect m_rectCtrl;
	CRect m_rectCtrl1;        
	CRect m_rectCtrl2;

	CRect m_rectXYCtrl;
	CRect m_rectVTCtrl;
	CRect m_rectMoveHome;
	
	COLORREF m_clrBkColor;			
	int m_nRate;					
	int m_nRunType;
	
	CAxis m_Axis;

	vector<CLine> m_mhRoadsX;
	vector<CLine> m_mhRoadsY;
	vector<CLine> m_xyLine;
	vector<CLine> m_vtLine;

	int  m_nLeftHome;
	int  m_nRightHome;
	int  m_nTopHome;
	int  m_nBottomHome;

	int  m_nLeftPos;
	int  m_nRightPos;
	int  m_nTopPos;
	int  m_nBottomPos;

	int m_nLeftVT;
	int m_nRightVT;
	int m_nTopVT;
	int m_nBottmVT;

	BOOL m_bIsXYPos;
	BOOL m_bIsVT;		
};
