// DlgSuctionchamberfor.cpp : implementation file
//
#include "stdafx.h"
#include "jetpump.h"
#include "DlgSuctionchamberfor.h"
#include "DlgFlangefor.h"
#include "DlgScforwhorlEx.h"
#include "DlgScforwhorlIn.h"
#include "roMdl.h"
#include "roUtil.h"
#include "roDimension.h"
#include "math.h"
#include "prowindows.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/*--------------------------------------------------------------------*\
Functions declaration
\*--------------------------------------------------------------------*/
int GetDimensionInf();
ProError DimValueUpdate();
void DimFree();
/*--------------------------------------------------------------------*\
Application global variables
\*--------------------------------------------------------------------*/
extern double d[200];
/////////////////////////////////////////////////////////////////////////////
// CDlgSuctionchamberfor dialog
CDlgSuctionchamberfor::CDlgSuctionchamberfor(CWnd* pParent /*=NULL*/)
: CDialog(CDlgSuctionchamberfor::IDD, pParent)
{
//{{AFX_DATA_INIT(CDlgSuctionchamberfor)
m_d1 = 0.0;
m_d2 = 0.0;
m_d3 = 0.0;
m_d4 = 0.0;
m_l1 = 0.0;
m_l2 = 0.0;
m_l3 = 0.0;
m_l4 = 0.0;
m_r = 0.0;
m_scfinf = _T("设计水平吸入室");
//}}AFX_DATA_INIT
}
void CDlgSuctionchamberfor:oDataExchange(CDataExchange* pDX)
{
CDialog:oDataExchange(pDX);
//{{AFX_DATA_MAP(CDlgSuctionchamberfor)
DDX_Text(pDX, IDC_EDIT_D1, m_d1);
DDX_Text(pDX, IDC_EDIT_D2, m_d2);
DDX_Text(pDX, IDC_EDIT_D3, m_d3);
DDX_Text(pDX, IDC_EDIT_D4, m_d4);
DDX_Text(pDX, IDC_EDIT_L1, m_l1);
DDX_Text(pDX, IDC_EDIT_L2, m_l2);
DDX_Text(pDX, IDC_EDIT_L3, m_l3);
DDX_Text(pDX, IDC_EDIT_L4, m_l4);
DDX_Text(pDX, IDC_EDIT_R, m_r);
DDX_Text(pDX, IDC_STATIC_Inf, m_scfinf);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CDlgSuctionchamberfor, CDialog)
//{{AFX_MSG_MAP(CDlgSuctionchamberfor)
ON_WM_MOVE()
ON_BN_CLICKED(IDC_Update, OnUpdate)
ON_BN_CLICKED(IDC_BUTTON_Flange, OnBUTTONFlange)
ON_BN_CLICKED(IDC_BUTTON_WhorlEx, OnBUTTONWhorlEx)
ON_BN_CLICKED(IDC_BUTTON_WhorlIn, OnBUTTONWhorlIn)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CDlgSuctionchamberfor message handlers
BOOL CDlgSuctionchamberfor::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
//调用自定义函数获得模型尺寸(地址及值)
int GetDimInfRult;
GetDimInfRult=GetDimensionInf();
//若调用成功则获得模型各参数
if (GetDimInfRult)
{
m_d1 = d[66];
m_d2 = d[59];
m_d3 = d[60];
m_d4 = d[49];
m_l1 = d[149];
m_l2 = d[152];
m_l3 = d[150];
m_l4 = d[151];
m_r = d[54];
m_scfinf = _T("设计水平吸入室");
UpdateData(false);
}
else
{
AfxMessageBox("无法获得当前模型尺寸或当前模型不存在!");
return false;
}
return true; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CDlgSuctionchamberfor::OnMove(int x, int y)
{
// TODO: Add your message handler code here
ProWindowRepaint(PRO_VALUE_UNUSED); //刷新
}
void CDlgSuctionchamberfor::OnUpdate()
{
// TODO: Add your control notification handler code here
ProError status;
UpdateData(true);
//更新尺寸
d[66] = m_d1;
d[59] = m_d2;
d[60] = m_d3;
d[49] = m_d4;
d[149] = m_l1;
d[152] = m_l2;
d[150] = m_l3;
d[151] = m_l4;
d[54] = m_r;
//非驱动尺寸和其他尺寸的关系
d[0] =360;
d[64] =d[59];
d[87] =d[88];
//调用自定义函数更新模型
status=DimValueUpdate();
if(status==PRO_TK_NO_ERROR)
{
m_scfinf = _T("模型更新成功!");
}
else
{
AfxMessageBox("模型更新失败,请更改参数!");
m_scfinf = _T("模型更新失败,请更改参数!");
}
UpdateData(false);
}
void CDlgSuctionchamberfor::OnCancel()
{
// TODO: Add extra cleanup here
//调用自定义函数释放尺寸对象指针数组
DimFree();
//各变量清零
m_d1 = 0.0;
m_d2 = 0.0;
m_d3 = 0.0;
m_d4 = 0.0;
m_l1 = 0.0;
m_l2 = 0.0;
m_l3 = 0.0;
m_l4 = 0.0;
m_r = 0.0;
m_scfinf = _T("设计水平吸入室");
//关闭当前窗口
CDialog:estroyWindow();
}
void CDlgSuctionchamberfor::OnBUTTONFlange()
{
// TODO: Add your control notification handler code here
AFX_MANAGE_STATE(AfxGetStaticModuleState());
int status;
CDlgFlangefor dlgflangefor;
status=dlgflangefor.DoModal();//创建对话框
if(status==0)
{
AfxMessageBox("对话框创建失败.");
}
}
void CDlgSuctionchamberfor::OnBUTTONWhorlEx()
{
// TODO: Add your control notification handler code here
AFX_MANAGE_STATE(AfxGetStaticModuleState());
int status;
CDlgScforwhorlEx dlgscforwhorlex;
status=dlgscforwhorlex.DoModal();//创建对话框
if(status==0)
{
AfxMessageBox("对话框创建失败.");
}
}
void CDlgSuctionchamberfor::OnBUTTONWhorlIn()
{
// TODO: Add your control notification handler code here
AFX_MANAGE_STATE(AfxGetStaticModuleState());
int status;
CDlgScforwhorlIn dlgscforwhorlin;
status=dlgscforwhorlin.DoModal();//创建对话框
if(status==0)
{
AfxMessageBox("对话框创建失败.");
}
} |