www.pudn.com > PressMonitor_q.zip > Manipulator1View.cpp


// Manipulator1View.cpp : implementation file 
// 
 
#include "stdafx.h" 
#include "Monitor.h" 
#include "Manipulator1View.h" 
#include "MonitorDoc.h" 
#include "Hint.h" 
 
#ifdef _DEBUG 
#define new DEBUG_NEW 
#undef THIS_FILE 
static char THIS_FILE[] = __FILE__; 
#endif 
 
static COLORREF tmpColor[]= 
{ 
    RGB(0,0,0), RGB(0,0,160),RGB(128,0,128), RGB(26,166,57), 
    RGB(0,128,0),RGB(0,0,128),RGB(220,0,0),RGB(128,128,0) 
}; 
///////////////////////////////////////////////////////////////////////////// 
// CManipulator1View 
 
IMPLEMENT_DYNCREATE(CManipulator1View, CFormView) 
 
CManipulator1View::CManipulator1View() 
	: CFormView(CManipulator1View::IDD) 
{ 
	//{{AFX_DATA_INIT(CManipulator1View) 
		// NOTE: the ClassWizard will add member initialization here 
	//}}AFX_DATA_INIT 
} 
 
CManipulator1View::~CManipulator1View() 
{ 
} 
 
void CManipulator1View::DoDataExchange(CDataExchange* pDX) 
{ 
	CFormView::DoDataExchange(pDX); 
	//{{AFX_DATA_MAP(CManipulator1View) 
	DDX_Control(pDX, IDC_CHECK3, m_btn3); 
	DDX_Control(pDX, IDC_CHECK2, m_btn2); 
	DDX_Control(pDX, IDC_CHECK1, m_btn1); 
	DDX_Control(pDX, IDC_CHECK0, m_btn0); 
	DDX_Control(pDX, IDC_TREND, m_3DTrend); 
	//}}AFX_DATA_MAP 
} 
 
 
BEGIN_MESSAGE_MAP(CManipulator1View, CFormView) 
	//{{AFX_MSG_MAP(CManipulator1View) 
	ON_BN_CLICKED(IDC_CHECK0, OnCheck0) 
	ON_BN_CLICKED(IDC_CHECK1, OnCheck1) 
	ON_BN_CLICKED(IDC_CHECK2, OnCheck2) 
	ON_BN_CLICKED(IDC_CHECK3, OnCheck3) 
	//}}AFX_MSG_MAP 
END_MESSAGE_MAP() 
 
///////////////////////////////////////////////////////////////////////////// 
// CManipulator1View diagnostics 
 
#ifdef _DEBUG 
void CManipulator1View::AssertValid() const 
{ 
	CFormView::AssertValid(); 
} 
 
void CManipulator1View::Dump(CDumpContext& dc) const 
{ 
	CFormView::Dump(dc); 
} 
#endif //_DEBUG 
 
///////////////////////////////////////////////////////////////////////////// 
// CManipulator1View message handlers 
 
void CManipulator1View::OnInitialUpdate()  
{ 
	CFormView::OnInitialUpdate(); 
 
	CMonitorDoc	*pDoc = (CMonitorDoc*) GetDocument(); 
	pDoc->m_bUpdateView=true; 
 
	m_btn0.SetShade(SHS_DIAGSHADE,8,10,5,RGB(255,55,55)); 
	m_btn1.SetShade(SHS_DIAGSHADE,8,10,5,RGB(255,55,55)); 
	m_btn2.SetShade(SHS_DIAGSHADE,8,10,5,RGB(255,55,55)); 
	m_btn3.SetShade(SHS_DIAGSHADE,8,10,5,RGB(255,55,55)); 
 
	m_btn0.SetTextColor(tmpColor[0]); 
	m_btn1.SetTextColor(tmpColor[1]); 
	m_btn2.SetTextColor(tmpColor[2]); 
	m_btn3.SetTextColor(tmpColor[3]); 
 
	Scale scale[3]; 
	scale[0].MaxiValue=360; 
	scale[0].MiniValue=-360; 
	scale[0].nStyle=SCALE_LEFT; 
	scale[0].strUnit=CURVE_UNIT_C; 
	scale[0].clr=RGB(255,0,0); 
 
	scale[1].MaxiValue=1000; 
	scale[1].MiniValue=-1000; 
	scale[1].nStyle=SCALE_CENTER; 
	scale[1].strUnit=CURVE_UNIT_MM; 
	scale[1].clr=RGB(128,0,64); 
 
	scale[2].MaxiValue=10; 
	scale[2].MiniValue=-10; 
	scale[2].nStyle=SCALE_RIGHT; 
	scale[2].strUnit=CURVE_UNIT_V; 
	scale[2].clr=RGB(128,0,255); 
 
 
	if(!m_3DTrend.Initialize(scale)) 
        return ; 
	m_3DTrend.AddCurve("大车Ⅰ行走位移",tmpColor[0],CURVE_UNIT_MM); 
	m_3DTrend.AddCurve("夹钳Ⅰ旋转角度",tmpColor[1],CURVE_UNIT_C); 
	m_3DTrend.AddCurve("旋转控制C_Ya9",tmpColor[2],CURVE_UNIT_V); 
	m_3DTrend.AddCurve("行走控制C_Ya10",tmpColor[3],CURVE_UNIT_V); 
 
 
	CTime time; 
	time=time.GetCurrentTime(); 
	for(int i=0;im_DataReal; 
	CTime time; 
	time=time.GetCurrentTime(); 
 
	m_3DTrend.m_curveArray.GetAt(0)->ShiftData(pDataReal->Data_Real[ROBOT_MOVE_POS],time); 
	m_3DTrend.m_curveArray.GetAt(1)->ShiftData(pDataReal->Data_Real[ROBOT_ROTATE_POS],time); 
	m_3DTrend.m_curveArray.GetAt(2)->ShiftData(pDataReal->AOut.C_Ya9,time); 
	m_3DTrend.m_curveArray.GetAt(3)->ShiftData(pDataReal->AOut.C_Ya10,time); 
	m_3DTrend.RefreshWindow(); 
} 
 
void CManipulator1View::OnCheck0()  
{ 
	if(!m_3DTrend.GetCurveDispState(0)) 
	{ 
		m_3DTrend.HideCurve(0); 
	} 
	else 
	{ 
		m_3DTrend.ShowCurve(0); 
	} 
	m_3DTrend.RefreshWindow();	 
} 
 
void CManipulator1View::OnCheck1()  
{ 
	if(!m_3DTrend.GetCurveDispState(1)) 
	{ 
		m_3DTrend.HideCurve(1); 
	} 
	else 
	{ 
		m_3DTrend.ShowCurve(1); 
	} 
	m_3DTrend.RefreshWindow();	 
} 
 
void CManipulator1View::OnCheck2()  
{ 
	if(!m_3DTrend.GetCurveDispState(2)) 
	{ 
		m_3DTrend.HideCurve(2); 
	} 
	else 
	{ 
		m_3DTrend.ShowCurve(2); 
	} 
	m_3DTrend.RefreshWindow();	 
} 
 
void CManipulator1View::OnCheck3()  
{ 
	if(!m_3DTrend.GetCurveDispState(3)) 
	{ 
		m_3DTrend.HideCurve(3); 
	} 
	else 
	{ 
		m_3DTrend.ShowCurve(3); 
	} 
	m_3DTrend.RefreshWindow();	 
}