101 lines
2.0 KiB
C++
101 lines
2.0 KiB
C++
#include "stdafx.h"
|
|
#include "RadioDlg.h"
|
|
|
|
IMPLEMENT_DYNAMIC(CRadioDlg, CDialog)
|
|
|
|
CRadioDlg::CRadioDlg(CWnd* pParent /*=NULL*/)
|
|
: CDialog(CRadioDlg::IDD, pParent)
|
|
{
|
|
m_pPipeParam = NULL;
|
|
m_pDb = NULL;
|
|
}
|
|
|
|
CRadioDlg::~CRadioDlg()
|
|
{
|
|
}
|
|
|
|
void CRadioDlg::DoDataExchange(CDataExchange* pDX)
|
|
{
|
|
CDialog::DoDataExchange(pDX);
|
|
DDX_Control(pDX, IDC_LISTELBOWRAD, m_wndElbowradList);
|
|
}
|
|
|
|
BEGIN_MESSAGE_MAP(CRadioDlg, CDialog)
|
|
ON_BN_CLICKED(IDOK, &CRadioDlg::OnBnClickedOk)
|
|
END_MESSAGE_MAP()
|
|
|
|
void CRadioDlg::SetDbServer(CUIISQLiteServer* pDb)
|
|
{
|
|
m_pDb = pDb;
|
|
}
|
|
|
|
BOOL CRadioDlg::OnInitDialog()
|
|
{
|
|
CDialog::OnInitDialog();
|
|
|
|
if (m_pDb != NULL && m_pPipeParam != NULL)
|
|
{
|
|
//曲率半径
|
|
CString sSQL;
|
|
sSQL = _T("select [曲率半径] from AecElbowradius order by [曲率半径]");
|
|
|
|
CString sRat;
|
|
CStringArray arVals;
|
|
m_pDb->GetSelData(sSQL,arVals);
|
|
|
|
for (int i = 0;i < arVals.GetSize();i++)
|
|
{
|
|
m_wndElbowradList.InsertString(i,arVals.GetAt(i));
|
|
sRat = arVals.GetAt(i);
|
|
if ( fabs(_ttof(sRat) - m_pPipeParam->m_dRRatio) < 1.e-6)
|
|
{
|
|
m_wndElbowradList.SetCurSel(i);
|
|
}
|
|
}
|
|
}
|
|
return TRUE;
|
|
}
|
|
|
|
void CRadioDlg::SetShowParam(WPipe::PipeParam* pParam)
|
|
{
|
|
m_pPipeParam = pParam;
|
|
}
|
|
|
|
void CRadioDlg::OnBnClickedOk()
|
|
{
|
|
int nSel = m_wndElbowradList.GetCurSel();
|
|
if (nSel < 0 )
|
|
{
|
|
AfxMessageBox( _T("请选择率半径!") );
|
|
return;
|
|
}
|
|
|
|
//必须曲率半径至少大与=2
|
|
if (m_pPipeParam->m_nConnectType > 0 && nSel == 0)
|
|
{
|
|
//尺寸按国标2025-12-22,不提示
|
|
|
|
/*if ( IDNO == AfxMessageBox( _T("承插,螺纹,曲率半径建议不小于2,以避免弯头两套间隙过小.\n是否确认此曲率半径?") ) )
|
|
{
|
|
return;
|
|
}*/
|
|
}
|
|
|
|
if (m_pPipeParam->m_nConnectType == 3 && nSel < 2)
|
|
{
|
|
//尺寸按国标2025-12-22,不提示
|
|
/*if (IDNO == AfxMessageBox(_T("法兰管子,曲率半径建议不小于3,以避免弯头两法兰间隙过小.\n是否确认此曲率半径?")))
|
|
{
|
|
return;
|
|
}*/
|
|
}
|
|
|
|
CString sText;
|
|
m_wndElbowradList.GetText(nSel,sText);
|
|
|
|
if (m_pPipeParam != NULL)
|
|
m_pPipeParam->m_dRRatio = _ttof(sText);
|
|
|
|
OnOK();
|
|
}
|