control.cpp

来自「这是用VC编程实现模糊控制来控制机器人的运动」· C++ 代码 · 共 119 行

CPP
119
字号
// Control.cpp : implementation file
//

#include "stdafx.h"
#include "模糊控制仿真.h"
#include "Control.h"
#include "SomeOption.h"
#include "模糊控制仿真Doc.h"



extern RobotInformation Robot;

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CControl


IMPLEMENT_DYNCREATE(CControl, CFormView)

CControl::CControl()
	: CFormView(CControl::IDD)
{
	//{{AFX_DATA_INIT(CControl)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
}

CControl::~CControl()
{
}

void CControl::DoDataExchange(CDataExchange* pDX)
{
	CFormView::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CControl)
		// NOTE: the ClassWizard will add DDX and DDV calls here
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CControl, CFormView)
	//{{AFX_MSG_MAP(CControl)
	ON_BN_CLICKED(IDC_INITIAL, OnInitial)
	ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
	ON_BN_CLICKED(IDC_PORTRAIT, OnPortrait)
	ON_BN_CLICKED(IDC_STOP, OnStop)
	ON_BN_CLICKED(IDC_ACCROSS, OnAccross)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CControl diagnostics

#ifdef _DEBUG
void CControl::AssertValid() const
{
	CFormView::AssertValid();
}

void CControl::Dump(CDumpContext& dc) const
{
	CFormView::Dump(dc);
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CControl message handlers

void CControl::OnInitial() 
{
	// TODO: Add your control notification handler code here
	CMyDoc* pDoc=(CMyDoc*)GetDocument();
	ASSERT_VALID(pDoc);

	Robot.Theta=350;
	Robot.nCenter.x=10;
	Robot.nCenter.y=110;

	Robot.RobotVL=0.0;
	Robot.RobotVR=0.0;
	
	pDoc->UpdateAllViews(this);
}

void CControl::OnButton1()   //start button
{
	// TODO: Add your control notification handler code here
	CMyDoc* pDoc=(CMyDoc*)GetDocument();
	ASSERT_VALID(pDoc);
	pDoc->UpdateAllViews(this,1);
}

void CControl::OnPortrait() 
{
	// TODO: Add your control notification handler code here
	
}

void CControl::OnAccross() 
{
	// TODO: Add your control notification handler code here
	
}

void CControl::OnStop() 
{
	// TODO: Add your control notification handler code here
	CMyDoc* pDoc=(CMyDoc*)GetDocument();
	ASSERT_VALID(pDoc);
	pDoc->UpdateAllViews(this,2);
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?