1138 lines
32 KiB
C++
1138 lines
32 KiB
C++
#include "StdAfx.h"
|
|
#include "scissorsstairdlg.h"
|
|
|
|
|
|
|
|
CString CScissorsStairDlg::m_strSpaceWidth=_T("2600");
|
|
CString CScissorsStairDlg::m_strStairWidth=_T("1200");
|
|
CString CScissorsStairDlg::m_strRailDistToSide=_T("0");
|
|
CString CScissorsStairDlg::m_strRailHeight=_T("900");
|
|
CString CScissorsStairDlg::m_strRailWidth=_T("60");
|
|
CString CScissorsStairDlg::m_strStepWidth=_T("270");
|
|
int CScissorsStairDlg::m_iStepNum1=10;
|
|
int CScissorsStairDlg::m_iStepNum2=10;
|
|
int CScissorsStairDlg::m_iSelectFloor=1;//选择楼层
|
|
int CScissorsStairDlg::m_iStepAlign=0;//踏步取齐
|
|
BOOL CScissorsStairDlg::m_bLeftBeam=FALSE;
|
|
BOOL CScissorsStairDlg::m_bRightBeam=FALSE;
|
|
BOOL CScissorsStairDlg::m_bUpPostion=TRUE;//上楼方法
|
|
int CScissorsStairDlg::m_iSlab=0;//休息平台
|
|
CString CScissorsStairDlg::m_strSlabWidth=_T("1200");//平台宽度;
|
|
int CScissorsStairDlg::m_iSectStepNum=5;//剖切步数
|
|
BOOL CScissorsStairDlg::m_bAutoRail=FALSE;
|
|
BOOL CScissorsStairDlg::m_bHasOutRail=FALSE;
|
|
CString CScissorsStairDlg::m_strRailOutDis=_T("60");
|
|
CString CScissorsStairDlg::m_strRailOutDisMid=_T("60");
|
|
BOOL CScissorsStairDlg::m_bInsideRail=TRUE;//内侧栏杆
|
|
BOOL CScissorsStairDlg::m_bHasInsideHandRail=TRUE;//内侧扶手
|
|
//保留数据
|
|
int CScissorsStairDlg::m_isaveStepNum=20;
|
|
CString CScissorsStairDlg::m_strsaveStepHeight=_T("150");
|
|
CString CScissorsStairDlg::m_strsaveStairHeight=_T("3000");
|
|
IMPLEMENT_DYNAMIC(CScissorsStairDlg,CBaseStairDlg)
|
|
CScissorsStairDlg::CScissorsStairDlg(CWnd*pParent/* =NULL */):CBaseStairDlg(CScissorsStairDlg::IDD,pParent),m_group1(0)
|
|
{
|
|
m_nStepNum=m_iStepNum1+m_iStepNum2;
|
|
m_bHasArrow=TRUE;
|
|
m_bGroupStatus=FALSE;//组合窗的状态
|
|
Exchange(m_nStepNum,m_isaveStepNum);
|
|
Exchange(m_strStepHeight,m_strsaveStepHeight);
|
|
Exchange(m_strStairHeight,m_strsaveStairHeight);
|
|
//初始话
|
|
m_bEdit=FALSE;//处于非编辑状态
|
|
m_pBakObj=NULL;//为空状态
|
|
}
|
|
CScissorsStairDlg::CScissorsStairDlg(UINT idd,CWnd*pParent/*=NULL*/):CBaseStairDlg(idd,pParent),m_group1(0)
|
|
{
|
|
m_nStepNum=m_iStepNum1+m_iStepNum2;
|
|
m_bHasArrow=TRUE;
|
|
m_bGroupStatus=FALSE;//组合窗的状态
|
|
Exchange(m_nStepNum,m_isaveStepNum);
|
|
Exchange(m_strStepHeight,m_strsaveStepHeight);
|
|
Exchange(m_strStairHeight,m_strsaveStairHeight);
|
|
//初始话
|
|
m_bEdit=FALSE;//处于非编辑状态
|
|
m_pBakObj=NULL;//为空状态
|
|
}
|
|
CScissorsStairDlg::~CScissorsStairDlg()
|
|
{
|
|
Exchange(m_nStepNum,m_isaveStepNum);
|
|
Exchange(m_strStepHeight,m_strsaveStepHeight);
|
|
Exchange(m_strStairHeight,m_strsaveStairHeight);
|
|
if (m_bEdit)
|
|
delete m_pBakObj;
|
|
}
|
|
BOOL CScissorsStairDlg::OnInitDialog()
|
|
{
|
|
CBaseStairDlg::OnInitDialog();
|
|
stepNum1.SetRange(2,10000);
|
|
stepNum2.SetRange(2,10000);
|
|
stepNumSpin.SetRange(4,10000);
|
|
m_ctrlRectStepNumSpin.SetRange(1,m_nStepNum);
|
|
AddTip(IDC_NEED3D);
|
|
AddTip(IDC_NEED2D);
|
|
AddTip(IDC_STAIR_HEIGHT_STATIC,_T("楼梯高度始终等于所有踏步的高度总和,改变楼梯高度将使踏步数变化,同时可能微调踏步高度"));
|
|
AddTip(IDC_STEP_NUM_STATIC,_T("改变踏步数将使踏步高度反向变化"));
|
|
AddTip(IDC_STEP_HEIGHT_STATIC,_T("输入一个大概的近似踏步高度,系统将自动设置正确值;改变踏步高度将引起踏步数反向变化"));
|
|
UpdateSel();
|
|
UpdateImage();
|
|
return TRUE;
|
|
}
|
|
BEGIN_MESSAGE_MAP(CScissorsStairDlg,CBaseStairDlg)
|
|
//消息映射过程
|
|
ON_EN_CHANGE(IDC_STAIR_WIDTH,OnChangeStairWidth)
|
|
ON_EN_CHANGE(IDC_RAIL_HEIGHT,OnChangeRailHeight)
|
|
ON_EN_CHANGE(IDC_RAIL_WIDTH,OnChangeRailWidth)
|
|
ON_EN_CHANGE(IDC_STEP_HEIGHT,OnChangeStepHeight)
|
|
ON_EN_CHANGE(IDC_STEP_WIDTH,OnChangeStepWidth)
|
|
ON_EN_CHANGE(IDC_STEP_NUM1,OnChangeStepNum1)
|
|
ON_EN_CHANGE(IDC_STEP_NUM2,OnChangeStepNum2)
|
|
ON_EN_CHANGE(IDC_RAIL_DISTTOSIDE,OnChangeRailDistToSide)
|
|
ON_EN_CHANGE(IDC_FLATFORM_WIDTH,OnChangeSlabWidth)
|
|
ON_EN_CHANGE(IDC_STEP_NUM,OnChangeStepNum)
|
|
ON_EN_CHANGE(IDC_SPACE_WIDTH,OnChangeSpaceWidth)
|
|
ON_EN_CHANGE(IDC_OUTRAIL1_DIST,OnChangeRailOutDist)
|
|
ON_EN_CHANGE(IDC_OUTRAIL1_DISTMID,OnChangeRailOutDistMid)
|
|
ON_EN_CHANGE(IDC_POUQIR_NUM,OnChangeSectStepNum)
|
|
ON_CBN_EDITCHANGE(IDC_STAIR_HEIGHTCOMBOX,OnChangeStairHeight)
|
|
ON_CBN_SELCHANGE(IDC_STAIR_HEIGHTCOMBOX,OnSelChangeStairHeight)
|
|
ON_CBN_KILLFOCUS(IDC_STAIR_HEIGHTCOMBOX,OnKFStairHeight)
|
|
ON_BN_CLICKED(IDC_INSIDERAIL,UpdateSel)
|
|
//休息平台
|
|
ON_BN_CLICKED(IDC_RECT_PLATFORM,UpdateSel)
|
|
ON_BN_CLICKED(IDC_ARC_PLATFORM,UpdateSel)
|
|
ON_BN_CLICKED(IDC_NO_PLATFORM,UpdateSel)
|
|
|
|
//左右边梁
|
|
ON_BN_CLICKED(IDC_LEFT_BEAM,UpdateSel)
|
|
ON_BN_CLICKED(IDC_RIGHT_BEAM,UpdateSel)
|
|
//楼层设置
|
|
ON_BN_CLICKED(IDC_RADIO_FIRST,UpdateSel)
|
|
ON_BN_CLICKED(IDC_RADIO_MID,UpdateSel)
|
|
ON_BN_CLICKED(IDC_RADIO_TOP,UpdateSel)
|
|
//踏步取齐
|
|
ON_BN_CLICKED(IDC_ALIGN_SLAB,UpdateSel)
|
|
ON_BN_CLICKED(IDC_ALIGN_FLOOR,UpdateSel)
|
|
ON_BN_CLICKED(IDC_ALIGN_MID,UpdateSel)
|
|
//上楼位置
|
|
ON_BN_CLICKED(IDC_SIDE_UP,UpdateSel)
|
|
ON_BN_CLICKED(IDC_MID_UP,UpdateSel)
|
|
ON_BN_CLICKED(IDC_SET2_ARROW,UpdateSel)
|
|
//梯段宽按钮的处理
|
|
ON_BN_CLICKED(IDC_BN_STAIRWIDTH,OnClickStairWidth)
|
|
ON_BN_CLICKED(IDC_BN_SPACEWIDTH,OnClickSpaceWidth)
|
|
//作为坡道
|
|
ON_BN_CLICKED(IDC_AS_ASCENT,UpdateSel)
|
|
ON_BN_CLICKED(IDC_HAS_SLANT,UpdateSel)
|
|
ON_BN_CLICKED(IDC_ON_GROUND,UpdateSel)
|
|
//扶手处理
|
|
ON_BN_CLICKED(IDC_AUTORAIL,UpdateSel)
|
|
ON_BN_CLICKED(IDC_HAS_OUTRAIL,UpdateSel)
|
|
ON_BN_CLICKED(IDC_CHECK_HASINSIDERAIL,UpdateSel)//内侧扶手
|
|
|
|
//处理失去焦点的情况
|
|
ON_EN_KILLFOCUS(IDC_STEP_HEIGHT,OnStepHeightKillFocus)
|
|
ON_EN_KILLFOCUS(IDC_STAIR_WIDTH,OnKFStairWidth)
|
|
ON_EN_KILLFOCUS(IDC_RAIL_HEIGHT,OnKFRailHeight)
|
|
ON_EN_KILLFOCUS(IDC_RAIL_WIDTH,OnKFRailWidth)
|
|
ON_EN_KILLFOCUS(IDC_STEP_WIDTH,OnKFStepWidth)
|
|
ON_EN_KILLFOCUS(IDC_STEP_NUM1,OnKFStepNum1)
|
|
ON_EN_KILLFOCUS(IDC_STEP_NUM2,OnKFStepNum2)
|
|
ON_EN_KILLFOCUS(IDC_RAIL_DISTTOSIDE,OnKFRailDistToSide)
|
|
ON_EN_KILLFOCUS(IDC_FLATFORM_WIDTH,OnKFSlabWidth)
|
|
ON_EN_KILLFOCUS(IDC_STEP_NUM,OnKFStepNum)
|
|
ON_EN_KILLFOCUS(IDC_SPACE_WIDTH,OnKFSpaceWidth)
|
|
ON_EN_KILLFOCUS(IDC_OUTRAIL1_DIST,OnKFRailOutDist)
|
|
ON_EN_KILLFOCUS(IDC_OUTRAIL1_DISTMID,OnKFRailOutDistMid)
|
|
ON_EN_KILLFOCUS(IDC_POUQIR_NUM,OnKFSectStepNum)
|
|
|
|
ON_WM_CLOSE()
|
|
END_MESSAGE_MAP()
|
|
void CScissorsStairDlg::DoDataExchange(CDataExchange* pDX)
|
|
{ //变量映射
|
|
CBaseStairDlg::DoDataExchange(pDX);
|
|
DDX_Text(pDX,IDC_STAIR_WIDTH,m_strStairWidth);
|
|
DDX_Text(pDX,IDC_SPACE_WIDTH,m_strSpaceWidth);
|
|
DDX_Text(pDX,IDC_STEP_NUM1,m_iStepNum1);
|
|
DDX_Text(pDX,IDC_STEP_NUM2,m_iStepNum2);
|
|
DDX_Text(pDX,IDC_STEP_WIDTH,m_strStepWidth);
|
|
DDX_CBString(pDX,IDC_STAIR_HEIGHTCOMBOX,m_strStairHeight);
|
|
//扶手处理
|
|
DDX_Text(pDX,IDC_RAIL_HEIGHT,m_strRailHeight);
|
|
DDX_Text(pDX,IDC_RAIL_WIDTH,m_strRailWidth);
|
|
DDX_Text(pDX,IDC_RAIL_DISTTOSIDE,m_strRailDistToSide);
|
|
DDX_Check(pDX,IDC_AUTORAIL,m_bAutoRail);
|
|
DDX_Check(pDX,IDC_HAS_OUTRAIL,m_bHasOutRail);
|
|
DDX_Text(pDX,IDC_OUTRAIL1_DIST,m_strRailOutDis);//层伸出距离
|
|
DDX_Text(pDX,IDC_OUTRAIL1_DISTMID,m_strRailOutDisMid);//转角伸出距离
|
|
DDX_Check(pDX,IDC_INSIDERAIL,m_bInsideRail);//内侧栏杆
|
|
DDX_Check(pDX,IDC_CHECK_HASINSIDERAIL,m_bHasInsideHandRail);//内侧扶手
|
|
//踏步取齐
|
|
DDX_Radio(pDX,IDC_ALIGN_SLAB,m_iStepAlign);
|
|
//楼层映射
|
|
DDX_Radio(pDX,IDC_RADIO_FIRST,m_iSelectFloor);
|
|
//左右边梁
|
|
DDX_Check(pDX,IDC_LEFT_BEAM,m_bLeftBeam);
|
|
DDX_Check(pDX,IDC_RIGHT_BEAM,m_bRightBeam);
|
|
//上楼位置
|
|
DDX_Radio(pDX,IDC_SIDE_UP,m_bUpPostion);
|
|
DDX_Check(pDX,IDC_SET2_ARROW,m_bHasArrow);
|
|
//组合窗
|
|
DDX_Control(pDX,IDC_GROUP1,m_group1);
|
|
DDX_GroupStatus(pDX,IDC_GROUP1,m_bGroupStatus);
|
|
//休息平台
|
|
DDX_Radio(pDX,IDC_RECT_PLATFORM,m_iSlab);
|
|
DDX_Text(pDX,IDC_FLATFORM_WIDTH,m_strSlabWidth);
|
|
//剖切步数
|
|
DDX_Text(pDX,IDC_POUQIR_NUM,m_iSectStepNum);
|
|
//梯井宽
|
|
DDX_Text(pDX,IDC_STATIC_WELLWID,m_strStairWell);
|
|
|
|
DDX_Control(pDX,IDC_STEP_NUM1_SPIN,stepNum1);
|
|
DDX_Control(pDX,IDC_STEP_NUM2_SPIN,stepNum2);
|
|
DDX_Control(pDX,IDC_SECTSTEP1_SPIN,m_ctrlRectStepNumSpin);
|
|
DDX_Control(pDX,IDC_STAIR_HEIGHTCOMBOX,m_ctrlStairHeight);
|
|
}
|
|
AcDbEntity* CScissorsStairDlg::NewObject()
|
|
{
|
|
TDbScissorsStair *pEnt;
|
|
if (m_pBakObj==NULL)
|
|
{
|
|
pEnt=new TDbScissorsStair;
|
|
pEnt->setLayer(InitLayer(LAY_STAIR));
|
|
pEnt->SetLayerHand3d(InitLayer(LAY_HANDRAIL));
|
|
pEnt->SetLayerRail3d(InitLayer(LAY_RAIL));
|
|
pEnt->SetLayerText(InitLayer(LAY_TEXT));
|
|
pEnt->SetTextStyle(InitTextStyle(TS_DIM));
|
|
pEnt->SetLayerArrow(InitLayer(LAY_OTHER_DIM));
|
|
|
|
//add by xlc on 090205 解决用户坐标系下预览文字倾斜的问题
|
|
pEnt->SetLayoutRotation(0);
|
|
|
|
return pEnt;
|
|
}
|
|
else
|
|
{
|
|
return (AcDbEntity*)(m_pBakObj->clone());
|
|
}
|
|
}
|
|
void CScissorsStairDlg::UpdateSel()
|
|
{
|
|
CBaseStairDlg::UpdateSel();
|
|
UpdateData(TRUE);
|
|
if (((CButton*)this->GetDlgItem(IDC_RECT_PLATFORM))->GetCheck())
|
|
{
|
|
m_iSlab=0;
|
|
this->GetDlgItem(IDC_FLATFORM_WIDTH)->EnableWindow(TRUE);
|
|
}
|
|
|
|
else if (((CButton*)this->GetDlgItem(IDC_ARC_PLATFORM))->GetCheck())
|
|
{
|
|
m_iSlab=1;
|
|
this->GetDlgItem(IDC_FLATFORM_WIDTH)->EnableWindow(TRUE);
|
|
}
|
|
else
|
|
{
|
|
this->GetDlgItem(IDC_FLATFORM_WIDTH)->EnableWindow(FALSE);
|
|
}
|
|
//楼层设置
|
|
if (((CButton*)this->GetDlgItem(IDC_RADIO_FIRST))->GetCheck())
|
|
m_iSelectFloor=0;
|
|
else if (((CButton*)this->GetDlgItem(IDC_RADIO_MID))->GetCheck())
|
|
m_iSelectFloor=1;
|
|
else
|
|
m_iSelectFloor=2;
|
|
//踏步取齐
|
|
if (((CButton*)this->GetDlgItem(IDC_ALIGN_SLAB))->GetCheck())
|
|
m_iStepAlign=0;
|
|
else if (((CButton*)this->GetDlgItem(IDC_ALIGN_MID))->GetCheck())
|
|
m_iStepAlign=1;
|
|
else
|
|
m_iStepAlign=2;
|
|
//以下对2D or 3D的显示
|
|
if (m_bNeed2D && m_bNeed3D) m_iViewCtrl=0;
|
|
else if (!m_bNeed2D && m_bNeed3D) m_iViewCtrl=2;
|
|
else if (m_bNeed2D && !m_bNeed3D) m_iViewCtrl=1;
|
|
else m_iViewCtrl=0;
|
|
|
|
// 修改描述:各种楼梯对话框中的“标注上楼方向”一项
|
|
// 应在“需要2D”一项勾选后才变成可选择状态。(2097)
|
|
// 修改人,修改时间:Zyu modify on 100325
|
|
GetDlgItem(IDC_SET2_ARROW)->EnableWindow(m_bNeed2D);
|
|
|
|
//扶手栏杆关系
|
|
this->GetDlgItem(IDC_AUTORAIL)->EnableWindow(m_bHasOutRail);
|
|
//this->GetDlgItem(IDC_INSIDERAIL)->EnableWindow(m_bHasInsideHandRail);
|
|
//梯井宽度的计算
|
|
m_strStairWell=Dist2Str(::_tstof(m_strSpaceWidth)-2*::_tstof(m_strStairWidth));
|
|
UpdateData(FALSE);
|
|
UpdateImage();
|
|
return;
|
|
}
|
|
bool CScissorsStairDlg::UpdateEdit(UINT ctrlID,bool bReportError/* =false */)
|
|
{//这个函数有些问题
|
|
CWnd *pImageBox=GetDlgItem(IDC_PREVIEW);
|
|
if (!pImageBox)
|
|
return false;
|
|
if (GetSafeHwnd()==NULL)
|
|
return false;
|
|
CEdit *pEdit=(CEdit*)GetDlgItem(ctrlID);
|
|
if (pEdit==NULL)
|
|
return false;
|
|
|
|
static bool bUpdating=false;
|
|
if (bUpdating)
|
|
return false;
|
|
bUpdating=true;
|
|
|
|
CDataExchange dxOut(this,false);
|
|
CString temp;
|
|
pEdit->GetWindowText(temp);
|
|
switch(ctrlID)
|
|
{
|
|
case IDC_STAIR_HEIGHTCOMBOX:
|
|
{
|
|
if (_tstof(temp)>=4*_tstof(m_strStepHeight)-_DIST_SNAP && ::_tstof(temp)<=10000) {//最少当前四踏步高
|
|
m_strStairHeight=temp;
|
|
m_nStepNum=(int)(_tstof(m_strStairHeight)/_tstof(m_strStepHeight)+0.5);
|
|
m_strStepHeight.Format(_T("%.2f"),(_tstof(m_strStairHeight)/m_nStepNum));
|
|
DDX_Text(&dxOut,IDC_STEP_HEIGHT,m_strStepHeight);
|
|
DDX_Text(&dxOut,IDC_STEP_NUM,m_nStepNum);
|
|
stepNum1.SetRange(2,m_nStepNum-2);
|
|
stepNum2.SetRange(2,m_nStepNum-2);
|
|
DDX_Text(&dxOut,IDC_STEP_NUM1,m_iStepNum1=m_nStepNum/2);
|
|
DDX_Text(&dxOut,IDC_STEP_NUM2,m_iStepNum2=m_nStepNum-m_iStepNum1);
|
|
UpdateImage();
|
|
}
|
|
else
|
|
{
|
|
if (bReportError)
|
|
{
|
|
AfxMessageBox(_T("梯段高度不正确!"));;
|
|
m_strStairHeight.Format(_T("%.2f"),(_tstof(m_strStepHeight)*m_nStepNum));
|
|
DDX_Text(&dxOut,IDC_STAIR_HEIGHTCOMBOX,m_strStairHeight);//还原
|
|
pEdit->SetFocus();
|
|
pEdit->SetSel(0,-1);
|
|
}
|
|
bUpdating=false;
|
|
return false;
|
|
}
|
|
}
|
|
break;
|
|
case IDC_STAIR_WIDTH:
|
|
{//梯段总宽
|
|
if (::_tstof(temp)<_DIST_SNAP||::_tstof(temp)*2>::_tstof(m_strSpaceWidth))
|
|
{
|
|
bUpdating=false;
|
|
if (bReportError)
|
|
{
|
|
AfxMessageBox(_T("梯段宽度不正确!"));;
|
|
DDX_Text(&dxOut,IDC_STAIR_WIDTH,m_strStairWidth);//还原
|
|
pEdit->SetFocus();
|
|
}
|
|
return false;
|
|
}
|
|
m_strStairWidth=temp;
|
|
DDX_Text(&dxOut,IDC_STAIR_WIDTH,m_strStairWidth);
|
|
m_strStairWell=Dist2Str(::_tstof(m_strSpaceWidth)-2.0*::_tstof(m_strStairWidth));
|
|
DDX_Text(&dxOut,IDC_STATIC_WELLWID,m_strStairWell);
|
|
}
|
|
break;
|
|
case IDC_STEP_NUM:
|
|
{
|
|
if (_ttoi(temp)>3)
|
|
{
|
|
m_nStepNum=_ttoi(temp);
|
|
stepNum1.SetRange(2,m_nStepNum-2);
|
|
stepNum2.SetRange(2,m_nStepNum-2);
|
|
m_strStepHeight.Format(_T("%.2f"),_tstof(m_strStairHeight)/m_nStepNum);
|
|
if (m_iSectStepNum>m_nStepNum)
|
|
{
|
|
m_iSectStepNum=m_nStepNum/2 +1;
|
|
DDX_Text(&dxOut,IDC_POUQIR_NUM,m_iSectStepNum);
|
|
}
|
|
DDX_Text(&dxOut,IDC_STEP_HEIGHT,m_strStepHeight);
|
|
DDX_Text(&dxOut,IDC_STEP_NUM,m_nStepNum);
|
|
DDX_Text(&dxOut,IDC_STEP_NUM1,m_iStepNum1=m_nStepNum/2);
|
|
DDX_Text(&dxOut,IDC_STEP_NUM2,m_iStepNum2=m_nStepNum-m_iStepNum1);
|
|
m_ctrlRectStepNumSpin.SetRange(1,m_nStepNum);
|
|
UpdateImage();
|
|
}
|
|
else
|
|
{
|
|
if (bReportError)
|
|
{
|
|
AfxMessageBox(_T("总踏步数至少为4!"));
|
|
DDX_Text(&dxOut,IDC_STEP_NUM,m_nStepNum);
|
|
pEdit->SetFocus();
|
|
pEdit->SetSel(0,-1);
|
|
}
|
|
bUpdating=false;
|
|
return false;
|
|
}
|
|
}
|
|
break;
|
|
case IDC_STEP_NUM1:
|
|
{
|
|
stepNum1.SetRange(2,m_nStepNum-2);
|
|
if (_ttoi(temp)>1&&_ttoi(temp)<m_nStepNum-1) {
|
|
m_iStepNum1=_ttoi(temp);
|
|
m_iStepNum2=m_nStepNum-m_iStepNum1;
|
|
DDX_Text(&dxOut,IDC_STEP_NUM1,m_iStepNum1);
|
|
DDX_Text(&dxOut,IDC_STEP_NUM2,m_iStepNum2);
|
|
UpdateImage();
|
|
}
|
|
else
|
|
{
|
|
if (bReportError)
|
|
{
|
|
if (_ttoi(temp)<2)
|
|
AfxMessageBox(_T("第一跑踏步数太少!"));
|
|
else
|
|
AfxMessageBox(_T("第一跑踏步数太多!,请重新输入或先增大总踏步数。"));
|
|
DDX_Text(&dxOut,IDC_STEP_NUM1,m_iStepNum1);
|
|
pEdit->SetFocus();
|
|
pEdit->SetSel(0,-1);
|
|
}
|
|
bUpdating=false;
|
|
return false;
|
|
}
|
|
}
|
|
break;
|
|
case IDC_STEP_NUM2:
|
|
{
|
|
stepNum2.SetRange(2,m_nStepNum-2);
|
|
if (_ttoi(temp)>1&&_ttoi(temp)<m_nStepNum-1) {
|
|
m_iStepNum2=_ttoi(temp);
|
|
m_iStepNum1=m_nStepNum-m_iStepNum2;
|
|
DDX_Text(&dxOut,IDC_STEP_NUM1,m_iStepNum1);
|
|
DDX_Text(&dxOut,IDC_STEP_NUM2,m_iStepNum2);
|
|
UpdateImage();
|
|
}
|
|
else
|
|
{
|
|
if (bReportError)
|
|
{
|
|
if (_ttoi(temp)<2)
|
|
AfxMessageBox(_T("第二跑踏步数太少!"));
|
|
else
|
|
AfxMessageBox(_T("第二跑踏步数太多!,请重新输入或先增大总踏步数。"));
|
|
DDX_Text(&dxOut,IDC_STEP_NUM2,m_iStepNum2);
|
|
pEdit->SetFocus();
|
|
pEdit->SetSel(0,-1);
|
|
}
|
|
bUpdating=false;
|
|
return false;
|
|
|
|
}
|
|
}
|
|
break;
|
|
case IDC_STEP_WIDTH:
|
|
{
|
|
if (::_tstof(temp)>_DIST_SNAP && temp!=_T(""))
|
|
{
|
|
m_strStepWidth=temp;
|
|
DDX_Text(&dxOut,IDC_STEP_WIDTH,m_strStepWidth);
|
|
}
|
|
else
|
|
{
|
|
if (bReportError)
|
|
{
|
|
::AfxMessageBox(_T("踏步宽度不正确!"));
|
|
DDX_Text(&dxOut,IDC_STEP_WIDTH,m_strStepWidth);
|
|
pEdit->SetFocus();
|
|
}
|
|
|
|
bUpdating=false;
|
|
return false;
|
|
}
|
|
}
|
|
break;
|
|
case IDC_STEP_HEIGHT:
|
|
{
|
|
int num(1);
|
|
if (fabs(_tstof(temp))>_DIST_SNAP)
|
|
{
|
|
num=(int)(_tstof(m_strStairHeight)/_tstof(temp)+0.5);
|
|
}
|
|
if (num>3) {
|
|
CBaseStairDlg::UpdateEdit(ctrlID,bReportError);
|
|
m_nStepNum = num;
|
|
stepNum1.SetRange(2,m_nStepNum-2);
|
|
stepNum2.SetRange(2,m_nStepNum-2);
|
|
DDX_Text(&dxOut,IDC_STEP_NUM1,m_iStepNum1=m_nStepNum/2);
|
|
DDX_Text(&dxOut,IDC_STEP_NUM2,m_iStepNum2=m_nStepNum-m_iStepNum1);
|
|
|
|
DDX_Text(&dxOut,IDC_STEP_NUM,m_nStepNum);
|
|
m_strStepHeight.Format(_T("%.2f"),(_tstof(m_strStairHeight)/m_nStepNum));
|
|
DDX_Text(&dxOut,IDC_STEP_HEIGHT,m_strStepHeight);
|
|
|
|
UpdateImage();
|
|
}
|
|
else
|
|
{
|
|
if (bReportError)
|
|
{
|
|
AfxMessageBox(_T("新踏步高度将造成踏步数小于4,请重新输入或先增大梯段高度!"));
|
|
DDX_Text(&dxOut,IDC_STEP_HEIGHT,m_strStepHeight);
|
|
pEdit->SetFocus();
|
|
pEdit->SetSel(0,-1);
|
|
}
|
|
|
|
bUpdating=false;
|
|
return false;
|
|
}
|
|
}
|
|
break;
|
|
case IDC_RAIL_DISTTOSIDE:
|
|
{
|
|
if ((-::_tstof(temp)*2>::_tstof(m_strSpaceWidth)-2.0*::_tstof(m_strStairWidth)
|
|
||::_tstof(temp)*2>::_tstof(m_strStairWidth)))
|
|
{
|
|
bUpdating=false;
|
|
if (bReportError)
|
|
{
|
|
::AfxMessageBox(_T("扶手距边不正确!"));
|
|
DDX_Text(&dxOut,IDC_RAIL_DISTTOSIDE,m_strRailDistToSide);
|
|
pEdit->SetFocus();
|
|
}
|
|
return false;
|
|
}
|
|
m_strRailDistToSide=temp;
|
|
DDX_Text(&dxOut,IDC_RAIL_DISTTOSIDE,m_strRailDistToSide);
|
|
}
|
|
break;
|
|
case IDC_OUTRAIL1_DISTMID:
|
|
{//转角伸出距离
|
|
if (::_tstof(temp)<-(_tstof(m_strStepWidth)*(m_iStepNum1>m_iStepNum2?m_iStepNum1:m_iStepNum2-1)*0.5))
|
|
{
|
|
bUpdating=false;
|
|
if (bReportError)
|
|
{
|
|
::AfxMessageBox(_T("转角扶手伸出距离不正确!"));
|
|
DDX_Text(&dxOut,IDC_OUTRAIL1_DISTMID,m_strRailOutDisMid);
|
|
pEdit->SetFocus();
|
|
}
|
|
return false;
|
|
}
|
|
m_strRailOutDisMid=temp;
|
|
DDX_Text(&dxOut,IDC_OUTRAIL1_DISTMID,m_strRailOutDisMid);
|
|
}
|
|
break;
|
|
case IDC_OUTRAIL1_DIST:
|
|
{//层伸出距离
|
|
if (::_tstof(temp)<-(_tstof(m_strStepWidth)*(m_iStepNum1>m_iStepNum2?m_iStepNum1:m_iStepNum2-1)*0.5))
|
|
{
|
|
bUpdating=false;
|
|
if (bReportError)
|
|
{
|
|
::AfxMessageBox(_T("层间扶手伸出距离不正确!"));
|
|
DDX_Text(&dxOut,IDC_OUTRAIL1_DIST,m_strRailOutDis);
|
|
pEdit->SetFocus();
|
|
}
|
|
return false;
|
|
}
|
|
m_strRailOutDis=temp;
|
|
DDX_Text(&dxOut,IDC_OUTRAIL1_DIST,m_strRailOutDis);
|
|
}
|
|
break;
|
|
case IDC_POUQIR_NUM:
|
|
{
|
|
if (::_ttoi(temp)<1)
|
|
{
|
|
bUpdating=false;
|
|
if (bReportError)
|
|
{
|
|
::AfxMessageBox(_T("剖切步数不正确!"));
|
|
DDX_Text(&dxOut,IDC_POUQIR_NUM,m_iSectStepNum);
|
|
pEdit->SetFocus();
|
|
}
|
|
return false;
|
|
}
|
|
m_ctrlRectStepNumSpin.SetRange(1,m_nStepNum);
|
|
m_iSectStepNum=::_ttoi(temp);
|
|
DDX_Text(&dxOut,IDC_POUQIR_NUM,m_iSectStepNum);
|
|
}
|
|
break;
|
|
case IDC_RAIL_WIDTH:
|
|
{
|
|
if (::_tstof(temp)<_DIST_SNAP)
|
|
{
|
|
if (bReportError)
|
|
{
|
|
::AfxMessageBox(_T("扶手宽度不正确!"));
|
|
DDX_Text(&dxOut,IDC_RAIL_WIDTH,m_strRailWidth);
|
|
pEdit->SetFocus();
|
|
}
|
|
bUpdating=false;
|
|
return false;
|
|
}
|
|
|
|
m_strRailWidth=temp;
|
|
DDX_Text(&dxOut,IDC_RAIL_WIDTH,m_strRailWidth);
|
|
}
|
|
break;
|
|
case IDC_RAIL_HEIGHT:
|
|
{
|
|
if (::_tstof(temp)<_DIST_SNAP)
|
|
{
|
|
if (bReportError)
|
|
{
|
|
::AfxMessageBox(_T("扶手高度不正确!"));
|
|
DDX_Text(&dxOut,IDC_RAIL_HEIGHT,m_strRailHeight);
|
|
pEdit->SetFocus();
|
|
}
|
|
bUpdating=false;
|
|
return false;
|
|
}
|
|
|
|
m_strRailHeight=temp;
|
|
DDX_Text(&dxOut,IDC_RAIL_HEIGHT,m_strRailHeight);
|
|
}
|
|
break;
|
|
case IDC_SPACE_WIDTH:
|
|
{//梯间宽
|
|
if (::_tstof(temp)<2.0*_MIN_STAIRWIDTH)
|
|
{
|
|
if (bReportError)
|
|
{
|
|
::AfxMessageBox(_T("梯间宽度不正确!"));
|
|
DDX_Text(&dxOut,IDC_SPACE_WIDTH,m_strSpaceWidth);
|
|
pEdit->SetFocus();
|
|
}
|
|
bUpdating=false;
|
|
return false;
|
|
}
|
|
|
|
m_strSpaceWidth=temp;
|
|
DDX_Text(&dxOut,IDC_SPACE_WIDTH,m_strSpaceWidth);
|
|
if (_tstof(m_strSpaceWidth)<_tstof(m_strStairWidth)*2)
|
|
{
|
|
m_strStairWidth.Format(_T("%.2f"),_tstof(m_strSpaceWidth)/2);
|
|
DDX_Text(&dxOut,IDC_STAIR_WIDTH,m_strStairWidth);
|
|
}
|
|
m_strStairWell=Dist2Str(::_tstof(m_strSpaceWidth)-2.0*::_tstof(m_strStairWidth));
|
|
DDX_Text(&dxOut,IDC_STATIC_WELLWID,m_strStairWell);
|
|
}
|
|
break;
|
|
case IDC_FLATFORM_WIDTH:
|
|
{
|
|
if (::_tstof(temp)<0.0)
|
|
{
|
|
if (bReportError)
|
|
{
|
|
::AfxMessageBox(_T("平台宽度不正确!"));
|
|
DDX_Text(&dxOut,IDC_FLATFORM_WIDTH,m_strSlabWidth);
|
|
pEdit->SetFocus();
|
|
}
|
|
|
|
bUpdating=false;
|
|
return false;
|
|
}
|
|
m_strSlabWidth=temp;
|
|
DDX_Text(&dxOut,IDC_FLATFORM_WIDTH,m_strSlabWidth);
|
|
}
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
bUpdating=FALSE;
|
|
UpdateImage();
|
|
return false;
|
|
}
|
|
void CScissorsStairDlg::Obj2Dlg(const AcDbEntity *pStep)
|
|
{
|
|
TDbScissorsStair *pStair=TDbScissorsStair::cast(pStep);
|
|
// [8/14/2008 nsh]
|
|
//--------------------------------
|
|
m_bEdit=TRUE;
|
|
m_pBakObj=(TDbScissorsStair*)(pStair->clone());//专递值
|
|
//--------------------------------
|
|
VERIFY(pStair);
|
|
m_strStairHeight=Dist2Str(pStair->GetStairHeight());
|
|
m_strStairWidth=Dist2Str(pStair->GetStairWidth());//梯段宽
|
|
//m_strSpaceWidth=Dist2Str(pStair->GetSpaceWidth());
|
|
m_strSpaceWidth.Format(_T("%.2f"),pStair->GetSpaceWidth());//测试
|
|
m_strStepHeight.Format(_T("%.2f"),pStair->GetStepHeight());
|
|
m_strStepWidth=Dist2Str(pStair->GetStepWidth());
|
|
m_iStepNum1=pStair->GetStepNum1();
|
|
m_iStepNum2=pStair->GetStepNum2();
|
|
m_nStepNum=m_iStepNum2+m_iStepNum1;
|
|
m_strRailHeight.Format(_T("%.2f"),pStair->GetRailHeight());
|
|
m_strRailWidth=Dist2Str(pStair->GetRailWidth());
|
|
m_strRailDistToSide=Dist2Str(pStair->GetRailDistToSide());
|
|
m_iStepAlign=pStair->GetAlignment();
|
|
m_iSelectFloor=pStair->GetStairFlag();
|
|
m_bAsAscent=pStair->IsAscent();
|
|
m_bHasSlant=pStair->HasSlant();
|
|
m_iViewCtrl=pStair->GetViewCtrl();
|
|
m_bOnGround=pStair->IsOnGround();
|
|
m_bUpPostion=pStair->GetStartSide();
|
|
if (pStair->IsArcPlatform())
|
|
m_iSlab=1;
|
|
else if (!pStair->IsArcPlatform())
|
|
m_iSlab=0;
|
|
m_strSlabWidth=(m_iSlab==0 || m_iSlab==1)? Dist2Str(pStair->GetSlabSize()) : _T("0.0");
|
|
m_bAutoRail=pStair->IsAutoOutRail();
|
|
m_bHasOutRail=pStair->IsOutRail();
|
|
/*m_bLeftBeam=pStair->HasSideBeam(0);
|
|
m_bRightBeam=pStair->HasSideBeam(1);*/
|
|
m_bLeftBeam=pStair->IsInSideBeam();
|
|
m_bRightBeam=pStair->IsOutSideBeam();
|
|
m_bHasArrow=pStair->IsArrow();
|
|
m_strRailOutDis=Dist2Str(pStair->GetRailDist());
|
|
m_strRailOutDisMid=Dist2Str(pStair->GetRailDistMid());
|
|
m_iSectStepNum=pStair->GetSectStepNum();
|
|
m_bInsideRail=pStair->IsAutoRail();
|
|
//内侧扶手
|
|
//m_bHasInsideHandRail=pStair->IsInRail();
|
|
return;
|
|
}
|
|
void CScissorsStairDlg::Dlg2Obj(AcDbEntity *pStep)
|
|
{
|
|
TDbScissorsStair *pStair=TDbScissorsStair::cast(pStep);
|
|
//VERIFY(cs);
|
|
|
|
pStair->SetStairWidth(::_tstof(m_strStairWidth));
|
|
pStair->SetSpaceWidth(::_tstof(m_strSpaceWidth));
|
|
pStair->SetStepNum1(m_iStepNum1);
|
|
pStair->SetStepNum2(m_iStepNum2);
|
|
pStair->SetArrow(m_bHasArrow);
|
|
pStair->SetStepWidth(::_tstof(m_strStepWidth));
|
|
pStair->SetStepHeight(::_tstof(m_strStepHeight));
|
|
pStair->SetRailHeight(::_tstof(m_strRailHeight));
|
|
pStair->SetRailWidth(::_tstof(m_strRailWidth));
|
|
pStair->SetRailDistToSide(::_tstof(m_strRailDistToSide));
|
|
pStair->SetSectStepNum(m_iSectStepNum);
|
|
pStair->SetRailDistMid(::_tstof(m_strRailOutDisMid));
|
|
pStair->SetRailDist(::_tstof(m_strRailOutDis));
|
|
pStair->SetAlignment(m_iStepAlign);
|
|
pStair->SetStairFlag(m_iSelectFloor);
|
|
/*pStair->SetSideBeam(0,m_bLeftBeam);
|
|
pStair->SetSideBeam(1,m_bRightBeam);*/
|
|
pStair->SetInSideBeam(m_bLeftBeam);
|
|
pStair->SetOutSideBeam(m_bRightBeam);
|
|
pStair->SetStartSide(m_bUpPostion);
|
|
pStair->SetAscent(m_bAsAscent);//作为坡道
|
|
pStair->SetSlant(m_bHasSlant);
|
|
pStair->SetOnGround(m_bOnGround);
|
|
pStair->SetViewCtrl(m_iViewCtrl);
|
|
pStair->SetSlabSize(::_tstof(m_strSlabWidth));
|
|
pStair->SetAutoOutRail(m_bHasOutRail?m_bAutoRail:FALSE);
|
|
pStair->SetOutRail(m_bHasOutRail);
|
|
pStair->SetAutoRail(m_bInsideRail);//测试,内测栏杆
|
|
//pStair->SetInsideRail(m_bHasInsideHandRail);内侧扶手
|
|
//------------------------
|
|
if (m_bEdit)
|
|
{
|
|
delete m_pBakObj;
|
|
m_pBakObj=(TDbScissorsStair*)(pStair->clone());
|
|
}
|
|
//------------------------
|
|
return;
|
|
}
|
|
//以下为事件处理
|
|
void CScissorsStairDlg::OnChangeStepNum()
|
|
{
|
|
CString temp;
|
|
this->GetDlgItem(IDC_STEP_NUM)->GetWindowText(temp);
|
|
if (temp!=_T(""))
|
|
{
|
|
UpdateEdit(IDC_STEP_NUM);//踏步总数
|
|
}
|
|
}
|
|
void CScissorsStairDlg::OnChangeStepNum1()
|
|
{
|
|
CString temp;
|
|
this->GetDlgItem(IDC_STEP_NUM1)->GetWindowText(temp);
|
|
if (temp!=_T(""))
|
|
{
|
|
UpdateEdit(IDC_STEP_NUM1);
|
|
}
|
|
}
|
|
void CScissorsStairDlg::OnChangeStepNum2()
|
|
{
|
|
CString temp;
|
|
this->GetDlgItem(IDC_STEP_NUM2)->GetWindowText(temp);
|
|
if (temp!=_T(""))
|
|
{
|
|
UpdateEdit(IDC_STEP_NUM2);
|
|
}
|
|
}
|
|
void CScissorsStairDlg::OnChangeStepHeight()
|
|
{
|
|
// UpdateEdit(IDC_STEP_HEIGHT);
|
|
}
|
|
void CScissorsStairDlg::OnChangeStepWidth()
|
|
{
|
|
CString temp;
|
|
this->GetDlgItem(IDC_STEP_WIDTH)->GetWindowText(temp);
|
|
if (temp!=_T(""))
|
|
{
|
|
UpdateEdit(IDC_STEP_WIDTH);
|
|
}
|
|
}
|
|
void CScissorsStairDlg::OnChangeRailDistToSide()
|
|
{
|
|
CString temp;
|
|
this->GetDlgItem(IDC_RAIL_DISTTOSIDE)->GetWindowText(temp);
|
|
if (temp!=_T(""))
|
|
{
|
|
UpdateEdit(IDC_RAIL_DISTTOSIDE);
|
|
}
|
|
|
|
}
|
|
void CScissorsStairDlg::OnChangeRailHeight()
|
|
{
|
|
CString temp;
|
|
this->GetDlgItem(IDC_RAIL_HEIGHT)->GetWindowText(temp);
|
|
if (temp!=_T(""))
|
|
{
|
|
UpdateEdit(IDC_RAIL_HEIGHT);
|
|
}
|
|
}
|
|
void CScissorsStairDlg::OnChangeRailWidth()
|
|
{
|
|
CString temp;
|
|
this->GetDlgItem(IDC_RAIL_WIDTH)->GetWindowText(temp);
|
|
if (temp!=_T(""))
|
|
{
|
|
UpdateEdit(IDC_RAIL_WIDTH);
|
|
}
|
|
}
|
|
void CScissorsStairDlg::OnChangeSpaceWidth()
|
|
{
|
|
CString temp;
|
|
this->GetDlgItem(IDC_SPACE_WIDTH)->GetWindowText(temp);
|
|
if (temp!=_T(""))
|
|
{
|
|
UpdateEdit(IDC_SPACE_WIDTH);
|
|
}
|
|
}
|
|
void CScissorsStairDlg::OnChangeStairHeight()
|
|
{
|
|
CString temp;
|
|
this->GetDlgItem(IDC_STAIR_HEIGHTCOMBOX)->GetWindowText(temp);
|
|
if (temp!=_T(""))
|
|
{
|
|
UpdateEdit(IDC_STAIR_HEIGHTCOMBOX);
|
|
}
|
|
}
|
|
void CScissorsStairDlg::OnChangeStairWidth()
|
|
{
|
|
CString temp;
|
|
this->GetDlgItem(IDC_STAIR_WIDTH)->GetWindowText(temp);
|
|
if (temp!=_T(""))
|
|
{
|
|
UpdateEdit(IDC_STAIR_WIDTH);
|
|
}
|
|
}
|
|
void CScissorsStairDlg::OnChangeSlabWidth()
|
|
{
|
|
CString temp;
|
|
this->GetDlgItem(IDC_FLATFORM_WIDTH)->GetWindowText(temp);
|
|
if (temp!=_T(""))
|
|
{
|
|
UpdateEdit(IDC_FLATFORM_WIDTH);
|
|
}
|
|
}
|
|
void CScissorsStairDlg::OnChangeRailOutDistMid()
|
|
{//转角伸出距离
|
|
CString temp;
|
|
this->GetDlgItem(IDC_OUTRAIL1_DISTMID)->GetWindowText(temp);
|
|
if (temp!=_T(""))
|
|
{
|
|
UpdateEdit(IDC_OUTRAIL1_DISTMID);
|
|
}
|
|
}
|
|
void CScissorsStairDlg::OnChangeRailOutDist()
|
|
{//层伸出距离
|
|
CString temp;
|
|
this->GetDlgItem(IDC_OUTRAIL1_DIST)->GetWindowText(temp);
|
|
if (temp!=_T(""))
|
|
{
|
|
UpdateEdit(IDC_OUTRAIL1_DIST);
|
|
}
|
|
}
|
|
void CScissorsStairDlg::OnChangeSectStepNum()
|
|
{//剖切步数
|
|
CString temp;
|
|
this->GetDlgItem(IDC_POUQIR_NUM)->GetWindowText(temp);
|
|
if (temp!=_T(""))
|
|
{
|
|
UpdateEdit(IDC_POUQIR_NUM);
|
|
}
|
|
}
|
|
void CScissorsStairDlg::OnKFStairHeight()
|
|
{
|
|
if (GetFocus()!=GetDlgItem(IDCANCEL))
|
|
{
|
|
//modiby by xlc on 090317
|
|
CString strText;
|
|
GetDlgItem(IDC_STAIR_HEIGHTCOMBOX)->GetWindowText(strText);
|
|
if (fabs(_tstof(strText)-_tstof(m_strStairHeight))<_DIST_SNAP)
|
|
return;
|
|
|
|
UpdateEdit(IDC_STAIR_HEIGHTCOMBOX,true);
|
|
}
|
|
}
|
|
void CScissorsStairDlg::OnClickStairWidth()
|
|
{
|
|
double dDist=::_tstof(m_strStairWidth);
|
|
BeginEditorCommand();
|
|
int nRet=GetDist(_T("\n梯段宽度"), dDist, RSG_NOZERO|RSG_NONEG|RSG_2D);
|
|
CompleteEditorCommand();
|
|
if (nRet==RTNORM)
|
|
{
|
|
if (dDist>(::_tstof(m_strSpaceWidth)/2))
|
|
{
|
|
::AfxMessageBox(_T("梯段宽度过大,请重新输入"));
|
|
return;
|
|
}
|
|
m_strStairWidth.Format(_T("%.2f"),dDist);
|
|
m_strStairWell=Dist2Str(::_tstof(m_strSpaceWidth)-2.0*::_tstof(m_strStairWidth));
|
|
UpdateData(FALSE);
|
|
UpdateImage();
|
|
}
|
|
return;
|
|
}
|
|
void CScissorsStairDlg::OnClickSpaceWidth()
|
|
{
|
|
double dDist=::_tstof(m_strSpaceWidth);
|
|
BeginEditorCommand();
|
|
int nRet=GetDist(_T("\n楼梯间宽度"), dDist, RSG_NOZERO|RSG_NONEG|RSG_2D);
|
|
CompleteEditorCommand();
|
|
if (nRet==RTNORM)
|
|
{
|
|
if (dDist<(2.0*_MIN_STAIRWIDTH))
|
|
{
|
|
::AfxMessageBox(_T("梯间宽度过小,请重新输入"));
|
|
return;
|
|
}
|
|
m_strSpaceWidth.Format(_T("%.2f"),dDist);
|
|
if (dDist<::_tstof(m_strStairWidth)*2)
|
|
{
|
|
m_strStairWidth.Format(_T("%.2f"),_tstof(m_strSpaceWidth)/2.0);
|
|
}
|
|
m_strStairWell.Format(_T("%.2f"),::_tstof(m_strSpaceWidth)-2.0*::_tstof(m_strStairWidth));
|
|
UpdateData(FALSE);
|
|
UpdateImage();
|
|
}
|
|
return;
|
|
}
|
|
|
|
void CScissorsStairDlg::OnStepHeightKillFocus()
|
|
{
|
|
if (GetFocus()!=GetDlgItem(IDCANCEL))
|
|
{
|
|
//modiby by xlc on 090317
|
|
CString strText;
|
|
GetDlgItem(IDC_STEP_HEIGHT)->GetWindowText(strText);
|
|
if (fabs(_tstof(strText)-_tstof(m_strStepHeight))<_DIST_SNAP)
|
|
return;
|
|
|
|
UpdateEdit(IDC_STEP_HEIGHT,true);
|
|
}
|
|
}
|
|
void CScissorsStairDlg::OnSelChangeStairHeight()
|
|
{//楼梯高度
|
|
CString temp;
|
|
CDataExchange dxIn(this,TRUE);
|
|
DDX_CBString(&dxIn,IDC_STAIR_HEIGHTCOMBOX,m_strStairHeight);
|
|
m_ctrlStairHeight.GetLBText(m_ctrlStairHeight.GetCurSel(),temp);
|
|
if (_tstof(temp)>=4*_tstof(m_strStepHeight)-_DIST_SNAP) {//最少当前四踏步高
|
|
CDataExchange dxOut(this,false);
|
|
m_strStairHeight=temp;
|
|
DDX_Text(&dxOut,IDC_STAIR_HEIGHTCOMBOX,m_strStairHeight);
|
|
m_nStepNum=(int)(_tstof(m_strStairHeight)/_tstof(m_strStepHeight)+0.5);
|
|
DDX_Text(&dxOut,IDC_STEP_NUM,m_nStepNum);
|
|
m_strStepHeight.Format(_T("%.2f"),(_tstof(m_strStairHeight)/m_nStepNum));
|
|
DDX_Text(&dxOut,IDC_STEP_HEIGHT,m_strStepHeight);
|
|
stepNum1.SetRange(2,m_nStepNum-2);
|
|
stepNum2.SetRange(2,m_nStepNum-2);
|
|
DDX_Text(&dxOut,IDC_STEP_NUM1,m_iStepNum1=m_nStepNum/2);
|
|
DDX_Text(&dxOut,IDC_STEP_NUM2,m_iStepNum2=m_nStepNum-m_iStepNum1);
|
|
|
|
UpdateImage();
|
|
}
|
|
return;
|
|
}
|
|
|
|
void CScissorsStairDlg::OnClose()
|
|
{
|
|
GetDlgItem(IDCANCEL)->SetFocus();
|
|
CBaseStairDlg::OnClose();
|
|
}
|
|
|
|
void CScissorsStairDlg::OnKFStepNum()//踏步总数
|
|
{
|
|
if (GetFocus()!=GetDlgItem(IDCANCEL))
|
|
{
|
|
//modiby by xlc on 090317
|
|
CString strText;
|
|
GetDlgItem(IDC_STEP_NUM)->GetWindowText(strText);
|
|
if (fabs(_tstof(strText)-m_nStepNum)<_DIST_SNAP)
|
|
return;
|
|
|
|
UpdateEdit(IDC_STEP_NUM,true);
|
|
}
|
|
}
|
|
void CScissorsStairDlg::OnKFStepNum1()
|
|
{
|
|
if (GetFocus()!=GetDlgItem(IDCANCEL))
|
|
{
|
|
//modiby by xlc on 090317
|
|
CString strText;
|
|
GetDlgItem(IDC_STEP_NUM1)->GetWindowText(strText);
|
|
if (fabs(_tstof(strText)-m_iStepNum1)<_DIST_SNAP)
|
|
return;
|
|
|
|
UpdateEdit(IDC_STEP_NUM1,true);
|
|
}
|
|
}
|
|
void CScissorsStairDlg::OnKFStepNum2()
|
|
{
|
|
if (GetFocus()!=GetDlgItem(IDCANCEL))
|
|
{
|
|
//modiby by xlc on 090317
|
|
CString strText;
|
|
GetDlgItem(IDC_STEP_NUM2)->GetWindowText(strText);
|
|
if (fabs(_tstof(strText)-m_iStepNum2)<_DIST_SNAP)
|
|
return;
|
|
|
|
UpdateEdit(IDC_STEP_NUM2,true);
|
|
}
|
|
}
|
|
|
|
void CScissorsStairDlg::OnKFStepWidth()
|
|
{
|
|
if (GetFocus()!=GetDlgItem(IDCANCEL))
|
|
{
|
|
//modiby by xlc on 090317
|
|
CString strText;
|
|
GetDlgItem(IDC_STEP_WIDTH)->GetWindowText(strText);
|
|
if (fabs(_tstof(strText)-_tstof(m_strStepWidth))<_DIST_SNAP)
|
|
return;
|
|
|
|
UpdateEdit(IDC_STEP_WIDTH,true);
|
|
}
|
|
}
|
|
void CScissorsStairDlg::OnKFRailDistToSide()
|
|
{
|
|
if (GetFocus()!=GetDlgItem(IDCANCEL))
|
|
{
|
|
//modiby by xlc on 090317
|
|
CString strText;
|
|
GetDlgItem(IDC_RAIL_DISTTOSIDE)->GetWindowText(strText);
|
|
if (fabs(_tstof(strText)-_tstof(m_strRailDistToSide))<_DIST_SNAP)
|
|
return;
|
|
|
|
UpdateEdit(IDC_RAIL_DISTTOSIDE,true);
|
|
}
|
|
|
|
}
|
|
void CScissorsStairDlg::OnKFRailHeight()
|
|
{
|
|
if (GetFocus()!=GetDlgItem(IDCANCEL))
|
|
{
|
|
//modiby by xlc on 090317
|
|
CString strText;
|
|
GetDlgItem(IDC_RAIL_HEIGHT)->GetWindowText(strText);
|
|
if (fabs(_tstof(strText)-_tstof(m_strRailHeight))<_DIST_SNAP)
|
|
return;
|
|
|
|
UpdateEdit(IDC_RAIL_HEIGHT,true);
|
|
}
|
|
}
|
|
void CScissorsStairDlg::OnKFRailWidth()
|
|
{
|
|
if (GetFocus()!=GetDlgItem(IDCANCEL))
|
|
{
|
|
//modiby by xlc on 090317
|
|
CString strText;
|
|
GetDlgItem(IDC_RAIL_WIDTH)->GetWindowText(strText);
|
|
if (fabs(_tstof(strText)-_tstof(m_strRailWidth))<_DIST_SNAP)
|
|
return;
|
|
|
|
UpdateEdit(IDC_RAIL_WIDTH,true);
|
|
}
|
|
}
|
|
void CScissorsStairDlg::OnKFSpaceWidth()
|
|
{
|
|
if (GetFocus()!=GetDlgItem(IDCANCEL))
|
|
{
|
|
//modiby by xlc on 090317
|
|
CString strText;
|
|
GetDlgItem(IDC_SPACE_WIDTH)->GetWindowText(strText);
|
|
if (fabs(_tstof(strText)-_tstof(m_strSpaceWidth))<_DIST_SNAP)
|
|
return;
|
|
|
|
UpdateEdit(IDC_SPACE_WIDTH,true);
|
|
}
|
|
}
|
|
|
|
void CScissorsStairDlg::OnKFStairWidth()
|
|
{
|
|
if (GetFocus()!=GetDlgItem(IDCANCEL))
|
|
{
|
|
//modiby by xlc on 090317
|
|
CString strText;
|
|
GetDlgItem(IDC_STAIR_WIDTH)->GetWindowText(strText);
|
|
if (fabs(_tstof(strText)-_tstof(m_strStairWidth))<_DIST_SNAP)
|
|
return;
|
|
|
|
UpdateEdit(IDC_STAIR_WIDTH,true);
|
|
}
|
|
}
|
|
void CScissorsStairDlg::OnKFSlabWidth()
|
|
{
|
|
if (GetFocus()!=GetDlgItem(IDCANCEL))
|
|
{
|
|
//modiby by xlc on 090317
|
|
CString strText;
|
|
GetDlgItem(IDC_FLATFORM_WIDTH)->GetWindowText(strText);
|
|
if (fabs(_tstof(strText)-_tstof(m_strSlabWidth))<_DIST_SNAP)
|
|
return;
|
|
|
|
UpdateEdit(IDC_FLATFORM_WIDTH,true);
|
|
}
|
|
}
|
|
void CScissorsStairDlg::OnKFRailOutDistMid()
|
|
{//转角伸出距离
|
|
if (GetFocus()!=GetDlgItem(IDCANCEL))
|
|
{
|
|
//modiby by xlc on 090317
|
|
CString strText;
|
|
GetDlgItem(IDC_OUTRAIL1_DISTMID)->GetWindowText(strText);
|
|
if (fabs(_tstof(strText)-_tstof(m_strRailOutDisMid))<_DIST_SNAP)
|
|
return;
|
|
|
|
UpdateEdit(IDC_OUTRAIL1_DISTMID,true);
|
|
}
|
|
}
|
|
void CScissorsStairDlg::OnKFRailOutDist()
|
|
{//层伸出距离
|
|
if (GetFocus()!=GetDlgItem(IDCANCEL))
|
|
{
|
|
//modiby by xlc on 090317
|
|
CString strText;
|
|
GetDlgItem(IDC_OUTRAIL1_DIST)->GetWindowText(strText);
|
|
if (fabs(_tstof(strText)-_tstof(m_strRailOutDis))<_DIST_SNAP)
|
|
return;
|
|
|
|
UpdateEdit(IDC_OUTRAIL1_DIST,true);
|
|
}
|
|
}
|
|
void CScissorsStairDlg::OnKFSectStepNum()
|
|
{//剖切步数
|
|
if (GetFocus()!=GetDlgItem(IDCANCEL))
|
|
{
|
|
//modiby by xlc on 090317
|
|
CString strText;
|
|
GetDlgItem(IDC_POUQIR_NUM)->GetWindowText(strText);
|
|
if (fabs(_tstof(strText)-m_iSectStepNum)<_DIST_SNAP)
|
|
return;
|
|
|
|
UpdateEdit(IDC_POUQIR_NUM,true);
|
|
}
|
|
} |