164 lines
3.9 KiB
C++
164 lines
3.9 KiB
C++
#include "stdafx.h"
|
|
#include "AddPoolCellDlg.h"
|
|
#include "afxdialogex.h"
|
|
#include "CoreTools.h"
|
|
#include "AecDbPoolCell.h"
|
|
#include "KTEntityDragMgr.h"
|
|
|
|
IMPLEMENT_DYNAMIC(CAddPoolCellDlg, CDialog)
|
|
|
|
CAddPoolCellDlg::CAddPoolCellDlg(bool bCircle, bool bArray, CWnd* pParent /*=nullptr*/)
|
|
: CDialog(IDD_DLG_ADD_POOLCELL, pParent)
|
|
, m_bCircle(bCircle)
|
|
, m_bArray(bArray)
|
|
, m_dH(0)
|
|
, m_dL(0)
|
|
, m_dW(0)
|
|
, m_dA(0)
|
|
, m_dR(0)
|
|
, m_sTStyle(_T(""))
|
|
, m_dTH(3)
|
|
, m_iHorCount(1)
|
|
, m_iVerCount(1)
|
|
, m_sName(_T("Ë®³Ø"))
|
|
{
|
|
GET_CACHE(CAddPoolCellDlg
|
|
, %f%f%f%f%f%s%f%d%d%s
|
|
, &m_dH, &m_dL, &m_dW, &m_dA, &m_dR, &m_sTStyle, &m_dTH, &m_iHorCount, &m_iVerCount, &m_sName);
|
|
}
|
|
|
|
CAddPoolCellDlg::~CAddPoolCellDlg() { }
|
|
|
|
void CAddPoolCellDlg::DoDataExchange(CDataExchange* pDX)
|
|
{
|
|
CDialog::DoDataExchange(pDX);
|
|
DDX_Text(pDX, IDC_EDIT1, m_dH);
|
|
DDV_MinMaxDouble(pDX, m_dH, 0.01, 99999999);
|
|
DDX_Text(pDX, IDC_EDIT3, m_dL);
|
|
DDV_MinMaxDouble(pDX, m_dL, 0.01, 99999999);
|
|
DDX_Text(pDX, IDC_EDIT12, m_dW);
|
|
DDV_MinMaxDouble(pDX, m_dW, 0.01, 99999999);
|
|
DDX_Text(pDX, IDC_EDIT13, m_dA);
|
|
DDV_MinMaxDouble(pDX, m_dA, .0, 360.);
|
|
DDX_Text(pDX, IDC_EDIT14, m_dR);
|
|
DDX_Text(pDX, IDC_COMBO1, m_sTStyle);
|
|
DDX_Text(pDX, IDC_EDIT16, m_dTH);
|
|
DDV_MinMaxDouble(pDX, m_dTH, 0.1, 10000);
|
|
DDX_Control(pDX, IDC_COMBO1, m_cmbTStyle);
|
|
DDX_Text(pDX, IDC_EDIT17, m_iHorCount);
|
|
DDV_MinMaxInt(pDX, m_iHorCount, 1, 9999);
|
|
DDX_Text(pDX, IDC_EDIT21, m_iVerCount);
|
|
DDV_MinMaxInt(pDX, m_iVerCount, 1, 9999);
|
|
DDX_Text(pDX, IDC_EDIT15, m_sName);
|
|
}
|
|
|
|
BOOL CAddPoolCellDlg::OnInitDialog()
|
|
{
|
|
CDialog::OnInitDialog();
|
|
m_cmbTStyle.init();
|
|
UpdateData(FALSE);
|
|
RefreshUI();
|
|
return TRUE;
|
|
}
|
|
|
|
BEGIN_MESSAGE_MAP(CAddPoolCellDlg, CDialog)
|
|
ON_BN_CLICKED(IDOK, &CAddPoolCellDlg::OnBnClickedOk)
|
|
END_MESSAGE_MAP()
|
|
|
|
|
|
void CAddPoolCellDlg::OnBnClickedOk()
|
|
{
|
|
UpdateData(TRUE);
|
|
SET_CACHE(CAddPoolCellDlg
|
|
, %f%f%f%f%f%s%f%d%d%s
|
|
, m_dH, m_dL, m_dW, m_dA, m_dR, m_sTStyle, m_dTH, m_iHorCount, m_iVerCount, m_sName);
|
|
CDialog::OnOK();
|
|
}
|
|
|
|
void CAddPoolCellDlg::RefreshUI()
|
|
{
|
|
CWnd *pWnd(NULL);
|
|
if (m_bCircle)
|
|
{
|
|
pWnd = GetDlgItem(IDC_EDIT3);
|
|
if (pWnd) pWnd->EnableWindow(false);
|
|
pWnd = GetDlgItem(IDC_EDIT12);
|
|
if (pWnd) pWnd->EnableWindow(false);
|
|
pWnd = GetDlgItem(IDC_EDIT13);
|
|
if (pWnd) pWnd->EnableWindow(false);
|
|
pWnd = GetDlgItem(IDC_EDIT14);
|
|
if (pWnd) pWnd->EnableWindow(true);
|
|
}
|
|
else
|
|
{
|
|
pWnd = GetDlgItem(IDC_EDIT3);
|
|
if (pWnd) pWnd->EnableWindow(true);
|
|
pWnd = GetDlgItem(IDC_EDIT12);
|
|
if (pWnd) pWnd->EnableWindow(true);
|
|
pWnd = GetDlgItem(IDC_EDIT13);
|
|
if (pWnd) pWnd->EnableWindow(true);
|
|
pWnd = GetDlgItem(IDC_EDIT14);
|
|
if (pWnd) pWnd->EnableWindow(false);
|
|
}
|
|
|
|
if (m_bArray)
|
|
{
|
|
pWnd = GetDlgItem(IDC_EDIT17);
|
|
if (pWnd) pWnd->EnableWindow(true);
|
|
pWnd = GetDlgItem(IDC_EDIT21);
|
|
if (pWnd) pWnd->EnableWindow(true);
|
|
pWnd = GetDlgItem(IDC_EDIT13);
|
|
if (pWnd) pWnd->EnableWindow(true);
|
|
}
|
|
else
|
|
{
|
|
pWnd = GetDlgItem(IDC_EDIT17);
|
|
if (pWnd) pWnd->EnableWindow(false);
|
|
pWnd = GetDlgItem(IDC_EDIT21);
|
|
if (pWnd) pWnd->EnableWindow(false);
|
|
}
|
|
}
|
|
|
|
AcGeVector3d CAddPoolCellDlg::GetDir() const
|
|
{
|
|
AcGeVector3d vt(AcGeVector3d::kXAxis);
|
|
vt.rotateBy(CoreTools::A2R(m_dA), AcGeVector3d::kZAxis);
|
|
vt.normalize();
|
|
return vt;
|
|
}
|
|
|
|
AcGeVector3d CAddPoolCellDlg::GetNormal() const
|
|
{
|
|
AcGeVector3d vtN(GetDir());
|
|
vtN.rotateBy(PI * .5, AcGeVector3d::kZAxis);
|
|
vtN.normalize();
|
|
return vtN;
|
|
}
|
|
|
|
AcGePoint3d CAddPoolCellDlg::Center2LeftTop(const AcGePoint3d & ptCenter) const
|
|
{
|
|
AcGeVector3d vt(GetDir()), vtN(GetNormal());
|
|
AcGePoint3d pt(ptCenter);
|
|
|
|
double deltaL(m_bCircle ? m_dR : m_dL * .5);
|
|
double deltaW(m_bCircle ? m_dR : m_dW * .5);
|
|
|
|
pt -= vt * deltaL;
|
|
pt += vtN * deltaW;
|
|
return pt;
|
|
}
|
|
|
|
AcGePoint3d CAddPoolCellDlg::LeftTop2Center(const AcGePoint3d & ptLT) const
|
|
{
|
|
AcGeVector3d vt(GetDir()), vtN(GetNormal());
|
|
AcGePoint3d pt(ptLT);
|
|
|
|
double deltaL(m_bCircle ? m_dR : m_dL * .5);
|
|
double deltaW(m_bCircle ? m_dR : m_dW * .5);
|
|
|
|
pt += vt * deltaL;
|
|
pt -= vtN * deltaW;
|
|
return pt;
|
|
}
|
|
|