⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 page1.cpp

📁 机器人运动学动力学及控制的一个小程序,供有兴趣的人参考
💻 CPP
字号:
// Page1.cpp : implementation file
//

#include "stdafx.h"
#include "MySDOpenGL.h"
#include "Page1.h"
#include "MySDOpenGLView.h"

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

/////////////////////////////////////////////////////////////////////////////
// CPage1 dialog
extern  CMySDOpenGLView *ptView;

CPage1::CPage1(CWnd* pParent /*=NULL*/)
	: CDialog(CPage1::IDD, pParent)
{
	//{{AFX_DATA_INIT(CPage1)
	m_inputAngle1 = 0.0;
	m_inputAngle2 = 0.0;
	m_inputAngle3 = 0.0;
	m_inputAngle4 = 0.0;
	m_strgMatrix = _T("");
	//}}AFX_DATA_INIT
}


void CPage1::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CPage1)
	DDX_Text(pDX, IDC_EDIT1, m_inputAngle1);
	DDX_Text(pDX, IDC_EDIT2, m_inputAngle2);
	DDX_Text(pDX, IDC_EDIT3, m_inputAngle3);
	DDX_Text(pDX, IDC_EDIT4, m_inputAngle4);
	DDX_Text(pDX, IDC_EDIT5, m_strgMatrix);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CPage1, CDialog)
	//{{AFX_MSG_MAP(CPage1)
	ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
	ON_WM_SHOWWINDOW()
	ON_WM_PAINT()
	ON_BN_CLICKED(IDC_BUTTON2, OnButton2)
	ON_WM_TIMER()
	ON_WM_CREATE()
	ON_BN_CLICKED(IDC_BUTTON3, OnButton3)
	ON_BN_CLICKED(IDC_BUTTON4, OnButton4)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CPage1 message handlers

void CPage1::OnButton1() 
{   CMySDOpenGLDoc *temp=(CMySDOpenGLDoc *)pDoc;
	// TODO: Add your control notification handler code here
//	ptView->inputAngle1=m_inputAngle1;
	UpdateData(TRUE);
temp->inputAngle1=m_inputAngle1;
temp->inputAngle2=m_inputAngle2;
temp->inputAngle3=m_inputAngle3;
temp->inputAngle4=m_inputAngle4;

temp->F=true;


//temp->UpdateAllViews(ptView,0 ,NULL);
}

void CPage1::OnShowWindow(BOOL bShow, UINT nStatus) 
{
	CDialog::OnShowWindow(bShow, nStatus);
	
	// TODO: Add your message handler code here
//CMySDOpenGLDoc *temp=(CMySDOpenGLDoc *)pDoc;
//	m_strgMatrix=temp->m_strgMatrix;
}

void CPage1::OnPaint() 
{
	CPaintDC dc(this); // device context for painting
	
	// TODO: Add your message handler code here
//CMySDOpenGLDoc *temp=(CMySDOpenGLDoc *)pDoc;
//	m_strgMatrix=temp->m_strgMatrix;
//	UpdateData(FALSE);
	// Do not call CDialog::OnPaint() for painting messages
}

void CPage1::OnButton2() 
{
	// TODO: Add your control notification handler code here
	CMySDOpenGLDoc *temp=(CMySDOpenGLDoc *)pDoc;
   		 
	UpdateData(TRUE);
    temp->m_strgMatrix= m_strgMatrix; 
	temp->IKStart=true;
}

void CPage1::OnTimer(UINT nIDEvent) 
{
	// TODO: Add your message handler code here and/or call default
CMySDOpenGLDoc *temp=(CMySDOpenGLDoc *)pDoc;
if(m_inputAngle1!=temp->inputAngle1||m_inputAngle2!=temp->inputAngle2||
	m_inputAngle3!=temp->inputAngle3||m_inputAngle4!=temp->inputAngle4||
    m_strgMatrix!=temp->m_strgMatrix)
{
	m_inputAngle1=temp->inputAngle1;
	m_inputAngle2=temp->inputAngle2;
	m_inputAngle3=temp->inputAngle3;
	m_inputAngle4=temp->inputAngle4;
	m_strgMatrix=temp->m_strgMatrix;

UpdateData(FALSE);

}

	CDialog::OnTimer(nIDEvent);
}

int CPage1::OnCreate(LPCREATESTRUCT lpCreateStruct) 
{
	if (CDialog::OnCreate(lpCreateStruct) == -1)
		return -1;
	
	// TODO: Add your specialized creation code here
	SetTimer(1,20,NULL);
	return 0;
}

void CPage1::OnButton3() 
{
	// TODO: Add your control notification handler code here
CMySDOpenGLDoc *temp=(CMySDOpenGLDoc *)pDoc;
     temp->inputAngle1=0;
    temp->inputAngle2=0;
    temp->inputAngle3=0;
    temp->inputAngle4=0;
//UpdateData(FALSE);

}

void CPage1::OnButton4() 
{
	// TODO: Add your control notification handler code here
//	ptView->OnProperties();
}

⌨️ 快捷键说明

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