// RectStairDlg.cpp : implementation file // #include "stdafx.h" #include "Resource.h" #include "RectStairCreateDlg.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CRectStairCreateDlg dialog int CRectStairCreateDlg::m_nStairFlag = 1; int CRectStairCreateDlg::m_nStairSide = 0; int CRectStairCreateDlg::m_nAlignment = 2; int CRectStairCreateDlg::m_nStepNum1=10; int CRectStairCreateDlg::m_nStepNum2=0; CString CRectStairCreateDlg::m_strSpaceWidth = _T("2560"); CString CRectStairCreateDlg::m_strSlabWidth = _T("1200"); CString CRectStairCreateDlg::m_strSlabWidth2=_T("1200"); CString CRectStairCreateDlg::m_strRailHeight = _T("900"); CString CRectStairCreateDlg::m_strRailWidth = _T("60"); CString CRectStairCreateDlg::m_strRailDistToSide = _T("0"); int CRectStairCreateDlg::m_iSlabType = 0; BOOL CRectStairCreateDlg::m_bAutoRail=FALSE; BOOL CRectStairCreateDlg::m_bOutRail=FALSE; //对梯间宽与梯段宽函数的控制变量的初始化 BOOL CRectStairCreateDlg::m_bStepWidth=FALSE; BOOL CRectStairCreateDlg::m_bStairSpace=FALSE; //出现错误的处理判断 BOOL CRectStairCreateDlg::m_bError =FALSE; BOOL CRectStairCreateDlg::m_bUpdateEdit=FALSE; // [9/17/2007 nsh] CRectStairCreateDlg * CRectStairCreateDlg::m_pSelfRSC=NULL; int CRectStairCreateDlg::m_nStepNum3 = 20; CString CRectStairCreateDlg::m_strStepHeight1; CString CRectStairCreateDlg::m_strStairHeight1; CString CRectStairCreateDlg::m_strStairWidth3=_T("1230"); //对ESC键的处理过程 BOOL CRectStairCreateDlg::m_bESCStepWidth=FALSE; BOOL CRectStairCreateDlg::m_bESCStairWidth=FALSE; BOOL CRectStairCreateDlg::m_bgroup6Status=FALSE; // ------------- [9/26/2007 nsh] // [7/9/2008 nsh] CString CRectStairCreateDlg::m_strFloorRailDist=_T("60");//层间伸出距离 CString CRectStairCreateDlg::m_strRoationRailDist=_T("60");//转角伸出距离 double CRectStairCreateDlg::m_dSectStepNum=500;//剖切高度 BOOL CRectStairCreateDlg::m_bOutHandRail=TRUE;//有外侧栏杆 BOOL CRectStairCreateDlg::m_bUpDir=TRUE;//标注上楼方向 short CRectStairCreateDlg::m_iSectStepNum=5;//剖切步数 BOOL CRectStairCreateDlg::m_bEvaRadius = FALSE; //是否有疏散半径 int CRectStairCreateDlg::m_nEvaRadiusSingle = 0; //0:单侧疏散半径 1:双侧疏散半径 IMPLEMENT_DYNAMIC(CRectStairCreateDlg, CLineStairDlg) CRectStairCreateDlg::CRectStairCreateDlg(CWnd* pParent /*=NULL*/) : CLineStairDlg(CRectStairCreateDlg::IDD, pParent),m_group6(0) { m_csStairHeight = Dist2Str(DocGetLHeight()); //Swap In Exchange(m_strStairHeight,m_strStairHeight1); Exchange(m_strStepHeight,m_strStepHeight1); Exchange(m_nStepNum,m_nStepNum3); Exchange(m_strStairWidth,m_strStairWidth3); //m_groups.Append(&m_group5); m_bNeed2D0=m_bNeed2D; m_bNeed3D0=m_bNeed3D; m_bNeed2D=m_bNeed3D=TRUE; m_strStairHeight=Dist2Str(DocGetLHeight()); m_strStepHeight.Format(_T("%.2f"),DocGetLHeight()/m_nStepNum); m_strStairLength=Dist2Str(_tstof(m_strStepWidth)*(m_bAsAscent? m_nStepNum1 : (m_nStepNum1-1))); m_bRailCon=TRUE; //平台初始化 m_strSlabSize1=_T("1200"); m_strSlabSize2=_T("1200"); //初始话 m_bEdit=FALSE;//处于非编辑状态 m_pBakObj=NULL;//为空状态 m_bClickClose=FALSE;//是否关闭对话框退出 m_bSaveCurEvaRadius = FALSE; } CRectStairCreateDlg::~CRectStairCreateDlg() { //双跑楼梯对这些静态项不影响 m_bNeed2D=m_bNeed2D0; m_bNeed3D=m_bNeed3D0; //add by whl on 03/08/15 //Swap Out Exchange(m_strStairHeight,m_strStairHeight1); Exchange(m_strStepHeight,m_strStepHeight1); Exchange(m_nStepNum,m_nStepNum3); Exchange(m_strStairWidth,m_strStairWidth3); m_bRailCon=TRUE; //平台初始化 m_strSlabSize1=_T("1200"); m_strSlabSize2=_T("1200"); if (m_bEdit&&m_pBakObj) delete m_pBakObj; } void CRectStairCreateDlg::DoDataExchange(CDataExchange* pDX) { CLineStairDlg::DoDataExchange(pDX); DDX_Control(pDX, IDC_STAIR_HEIGHT_COMBO, m_stairHeightBox); DDX_Control(pDX,IDC_STEP_NUM1_SPIN,stepNum1Spin); DDX_Control(pDX,IDC_STEP_NUM2_SPIN,stepNum2Spin); DDX_Text(pDX, IDC_SLAB_WIDTH, m_strSlabWidth); DDX_Text(pDX,IDC_EDIT_SLABWIDTH2,m_strSlabWidth2);//平台二的宽度 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_CHECK_OUTRAIL,m_bOutHandRail);//有外侧扶手 DDX_Check(pDX, IDC_OUTRAIL, m_bOutRail); DDX_Radio(pDX, IDC_RADIO_FIRST, m_nStairFlag); DDX_Radio(pDX, IDC_SIDE_LEFT, m_nStairSide); DDX_Radio(pDX, IDC_ALIGN_SLAB, m_nAlignment); DDX_Radio(pDX, IDC_RECT_PLATFORM, m_iSlabType); DDX_CBString(pDX, IDC_STAIR_HEIGHT_COMBO, m_csStairHeight); //add by xlc on 090222 DDX_CBString(pDX, IDC_STAIR_HEIGHT, m_strStairHeight); DDX_Control(pDX,IDC_GROUP7,m_group6); DDX_GroupStatus(pDX,IDC_GROUP7,m_bgroup6Status); // [7/9/2008 nsh] DDX_Text(pDX,IDC_EDIT_ROATIONDIST,m_strRoationRailDist); DDX_Text(pDX,IDC_EDIT_FLOORDIST,m_strFloorRailDist); DDX_Text(pDX,IDC_EDIT_SECTNUM,m_dSectStepNum);//剖切高度 DDX_Text(pDX,IDC_EDIT_SECTNUM2,m_iSectStepNum);//剖切步数 DDX_Control(pDX,IDC_SPIN_SECTNUM,m_ctrlSectNum); DDX_Check(pDX,IDC_CHECK_CONNECTION,m_bRailCon);//扶手是否连接 DDX_Check(pDX,IDC_CHECK1,m_bUpDir);//标注上楼方向 if (pDX->m_bSaveAndValidate) m_bNeed2D=m_bNeed3D=TRUE; else { DDX_Text(pDX, IDC_SPACE_WIDTH, m_strSpaceWidth); DDX_Text(pDX, IDC_STAIR_WIDTH, m_strStairWidth); DDX_Text(pDX, IDC_STEP_NUM1, m_nStepNum1); DDX_Text(pDX, IDC_STEP_NUM2, m_nStepNum2); m_strStairWidth2.Format(_T("%.2f"),_tstof(m_strSpaceWidth)-2*_tstof(m_strStairWidth)); DDX_Text(pDX, IDC_STAIR_WIDTH2,m_strStairWidth2); } DDX_Check(pDX, IDC_CHECK_EVA_RADIUS, m_bEvaRadius); DDX_Radio(pDX, IDC_RADIO_EVA_SINGLE, m_nEvaRadiusSingle); } BEGIN_MESSAGE_MAP(CRectStairCreateDlg, CLineStairDlg) //{{AFX_MSG_MAP(CRectStairCreateDlg) ON_BN_CLICKED(IDC_RECTSTAIR_SPACE_WIDTH, OnPickSpaceWidth) ON_BN_CLICKED(IDC_PICK_STAIRWIDTH2, OnPickStairWidth2) //组合窗失去焦点 ON_CBN_KILLFOCUS(IDC_STAIR_HEIGHT_COMBO, OnKillfocusStairHeightCombo) ON_CBN_SELCHANGE(IDC_STAIR_HEIGHT_COMBO,OnEditchangeStairHeightCombo) //}}AFX_MSG_MAP // [9/17/2007 nsh] ON_WM_CLOSE() ON_WM_NCDESTROY() ON_BN_CLICKED(IDC_PICK_STAIRWIDTH, CRectStairCreateDlg::OnBnClickedPickStairwidth) ON_BN_CLICKED(IDC_AUTORAIL, CRectStairCreateDlg::OnBnClickedAutorail) ON_BN_CLICKED(IDC_LEFT_BEAM, CRectStairCreateDlg::OnBnClickedLeftBeam) ON_BN_CLICKED(IDC_RIGHT_BEAM, CRectStairCreateDlg::OnBnClickedRightBeam) ON_BN_CLICKED(IDC_AS_ASCENT, CRectStairCreateDlg::OnBnClickedAsAscent) ON_BN_CLICKED(IDC_SIDE_LEFT, CRectStairCreateDlg::OnBnClickedSideLeft) ON_BN_CLICKED(IDC_SIDE_RIGHT, CRectStairCreateDlg::OnBnClickedSideRight) ON_BN_CLICKED(IDC_ON_GROUND, CRectStairCreateDlg::OnBnClickedOnGround) ON_BN_CLICKED(IDC_HAS_SLANT, CRectStairCreateDlg::OnBnClickedHasSlant) ON_BN_CLICKED(IDC_RADIO_FIRST, CRectStairCreateDlg::OnBnClickedRadioFirst) ON_BN_CLICKED(IDC_RADIO_MID, CRectStairCreateDlg::OnBnClickedRadioMid) ON_BN_CLICKED(IDC_RADIO_TOP, CRectStairCreateDlg::OnBnClickedRadioTop) ON_BN_CLICKED(IDC_ALIGN_FLOOR, CRectStairCreateDlg::OnBnClickedAlignFloor) ON_BN_CLICKED(IDC_ALIGN_MID, CRectStairCreateDlg::OnBnClickedAlignMid) ON_BN_CLICKED(IDC_ALIGN_SLAB, CRectStairCreateDlg::OnBnClickedAlignSlab) ON_BN_CLICKED(IDC_RADIO_FREEDOM,OnBnClickedAnyIns)//自由插入 ON_BN_CLICKED(IDC_OUTRAIL,CRectStairCreateDlg::OnBnClickedOutrail) ON_BN_CLICKED(IDC_RECT_PLATFORM, CRectStairCreateDlg::OnBnClickedRectPlatform) ON_BN_CLICKED(IDC_ARC_PLATFORM, CRectStairCreateDlg::OnBnClickedArcPlatform) ON_BN_CLICKED(IDC_NO_PLATFORM, CRectStairCreateDlg::OnBnClickedNoPlatform) ON_BN_CLICKED(IDC_CHECK_CONNECTION,OnBnClickRailCon)//扶手连接 ON_EN_CHANGE(IDC_STEP_ELEV,OnChangeStepElev) ON_EN_CHANGE(IDC_STAIR_LENGTH,OnChangeStairLength) // [7/9/2008 nsh] ON_EN_CHANGE(IDC_EDIT_ROATIONDIST,OnChangeRoationRailDist) ON_EN_CHANGE(IDC_EDIT_FLOORDIST,OnChangeFloorRailDist) ON_EN_CHANGE(IDC_EDIT_SECTNUM,OnChangeSectNum) //add by xlc on 090222 ON_EN_CHANGE(IDC_EDIT_SECTNUM2,OnChangeSectNum2)//剖切步数 ON_EN_CHANGE(IDC_SPACE_WIDTH,OnChangeSpaceWidth) ON_EN_CHANGE(IDC_STAIR_WIDTH,OnChangeStairWidth) ON_EN_CHANGE(IDC_STAIR_WIDTH2,OnChangeStairWidth2) ON_EN_CHANGE(IDC_STEP_NUM1,OnChangeStepNum1) ON_EN_CHANGE(IDC_STEP_NUM2,OnChangeStepNum2) ON_EN_CHANGE(IDC_STEP_NUM,OnChangeStepNum) ON_EN_CHANGE(IDC_SLAB_WIDTH,OnChangeSlabWidth) ON_EN_CHANGE(IDC_RAIL_HEIGHT,OnChangeRailHeight) ON_EN_CHANGE(IDC_RAIL_WIDTH,OnChangeRailWidth) ON_EN_CHANGE(IDC_RAIL_DISTTOSIDE,OnChangeRailDisttoside) ON_EN_CHANGE(IDC_STAIR_HEIGHT,OnChangeStairHeight)//IDC_STAIR_HEIGHT ON_EN_CHANGE(IDC_STEP_HEIGHT,OnChangeStepHeight)//踏步高度的改变 ON_EN_CHANGE(IDC_STEP_WIDTH,OnChangeStepWidth)//踏步宽度的处理函数 ON_EN_KILLFOCUS(IDC_STEP_ELEV,OnKFStepELev) ON_EN_KILLFOCUS(IDC_STAIR_LENGTH,OnKFStairLength) ON_EN_KILLFOCUS(IDC_EDIT_ROATIONDIST,OnKFRoationRailDist) ON_EN_KILLFOCUS(IDC_EDIT_FLOORDIST,OnKFFloorRailDist) ON_EN_KILLFOCUS(IDC_EDIT_SECTNUM,OnKFSectNum) ON_EN_KILLFOCUS(IDC_EDIT_SECTNUM2,OnKFSectNum2) ON_EN_KILLFOCUS(IDC_SPACE_WIDTH, OnKFSpaceWidth) ON_EN_KILLFOCUS(IDC_STAIR_WIDTH, OnKFStairWidth) ON_EN_KILLFOCUS(IDC_STAIR_WIDTH2, OnKFStairWidth2) ON_EN_KILLFOCUS(IDC_STEP_NUM1, OnKFStepNum1) ON_EN_KILLFOCUS(IDC_STEP_NUM2, OnKFStepNum2) ON_EN_KILLFOCUS(IDC_STEP_NUM,OnKFStepNum) ON_EN_KILLFOCUS(IDC_SLAB_WIDTH, OnKFSlabWidth) ON_EN_KILLFOCUS(IDC_RAIL_HEIGHT,OnKFRailHeight) ON_EN_KILLFOCUS(IDC_RAIL_WIDTH,OnKFRailWidth) ON_EN_KILLFOCUS(IDC_RAIL_DISTTOSIDE,OnKFRailDisttoside) ON_EN_KILLFOCUS(IDC_STEP_WIDTH,OnKFStepWidth) ON_EN_KILLFOCUS(IDC_STEP_HEIGHT,OnKFStepHeight) ON_BN_CLICKED(IDC_CHECK1,OnClickUpdir) //外侧栏杆 ON_BN_CLICKED(IDC_CHECK_OUTRAIL,OnClickOutHandRail) //点取疏散半径 ON_BN_CLICKED(IDC_CHECK_EVA_RADIUS,OnBnClickEvaRadius) ON_BN_CLICKED(IDC_RADIO_EVA_SINGLE, &CRectStairCreateDlg::OnBnClickedRadioSingle) ON_BN_CLICKED(IDC_RADIO_EVA_DOUBLE, &CRectStairCreateDlg::OnBnClickedRadioDouble) END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CRectStairCreateDlg message handlers void CRectStairCreateDlg::OnChangeSpaceWidth() { return; //modify by xlc on 090319 CString temp; this->GetDlgItem(IDC_SPACE_WIDTH)->GetWindowText(temp); if (temp!=_T("")) { UpdateEdit(IDC_SPACE_WIDTH,false); } } void CRectStairCreateDlg::OnChangeStairWidth() { //modify by xlc on 090319 // CString temp; // this->GetDlgItem(IDC_STAIR_WIDTH)->GetWindowText(temp); // if (temp!=_T("")) // { // UpdateEdit(IDC_STAIR_WIDTH,false); // } } void CRectStairCreateDlg::OnChangeStairWidth2() { //modify by xlc on 090319 // CString temp; // this->GetDlgItem(IDC_STAIR_WIDTH2)->GetWindowText(temp); // if (temp!=_T("")) // { // UpdateEdit(IDC_STAIR_WIDTH2,false); // } } void CRectStairCreateDlg::OnChangeStepNum() { //modify by xlc on 090319 CString temp; this->GetDlgItem(IDC_STEP_NUM)->GetWindowText(temp); if (temp!=_T("")) { UpdateEdit(IDC_STEP_NUM,false); } } void CRectStairCreateDlg::OnChangeStepNum1() { //modify by xlc on 090319 CString temp; this->GetDlgItem(IDC_STEP_NUM1)->GetWindowText(temp); if (temp!=_T("")) { UpdateEdit(IDC_STEP_NUM1,false); } } void CRectStairCreateDlg::OnChangeStepNum2() { //modify by xlc on 090319 CString temp; this->GetDlgItem(IDC_STEP_NUM2)->GetWindowText(temp); if (temp!=_T("")) { UpdateEdit(IDC_STEP_NUM2,false); } } void CRectStairCreateDlg::OnChangeStepElev () { //modify by xlc on 090319 CString temp; this->GetDlgItem(IDC_STEP_ELEV)->GetWindowText(temp); if (temp!=_T("")) { UpdateEdit(IDC_STEP_ELEV,false); } } // [7/9/2008 nsh] void CRectStairCreateDlg::OnChangeFloorRailDist() {//层间伸出距离 //modify by xlc on 090319 CString temp; this->GetDlgItem(IDC_EDIT_FLOORDIST)->GetWindowText(temp); if (temp!=_T("")) { UpdateEdit(IDC_EDIT_FLOORDIST,false); } } void CRectStairCreateDlg::OnChangeRoationRailDist() {//转角伸出距离 //modify by xlc on 090319 CString temp; this->GetDlgItem(IDC_EDIT_ROATIONDIST)->GetWindowText(temp); if (temp!=_T("")) { UpdateEdit(IDC_EDIT_ROATIONDIST,false); } } void CRectStairCreateDlg::OnChangeSectNum() {//剖切步数 //modify by xlc on 090319 CString temp; this->GetDlgItem(IDC_EDIT_SECTNUM)->GetWindowText(temp); if (temp!=_T("")) { UpdateEdit(IDC_EDIT_SECTNUM,false); } } //add by xlc on 090222 void CRectStairCreateDlg::OnChangeSectNum2() { //modify by xlc on 090319 CString temp; this->GetDlgItem(IDC_EDIT_SECTNUM2)->GetWindowText(temp); if (temp!=_T("")) { UpdateEdit(IDC_EDIT_SECTNUM2,false); } } void CRectStairCreateDlg::OnChangeSlabWidth() { //modify by xlc on 090319 // CString temp; // this->GetDlgItem(IDC_SLAB_WIDTH)->GetWindowText(temp); // if (temp!=_T("")) // { // UpdateEdit(IDC_SLAB_WIDTH,false); // } } void CRectStairCreateDlg::OnEditchangeStairHeightCombo() { return; //modify by xlc on 090319 CString temp; this->GetDlgItem(IDC_STAIR_HEIGHT_COMBO)->GetWindowText(temp); if (temp!=_T("")) { UpdateEdit(IDC_STAIR_HEIGHT_COMBO,false); } } void CRectStairCreateDlg::OnChangeRailDisttoside() {//扶手边距 //modify by xlc on 090319 CString temp; this->GetDlgItem(IDC_RAIL_DISTTOSIDE)->GetWindowText(temp); if (temp!=_T("")) { UpdateEdit(IDC_RAIL_DISTTOSIDE,false); } } void CRectStairCreateDlg::OnChangeRailHeight() {//扶手高 //modify by xlc on 090319 // CString temp; // this->GetDlgItem(IDC_RAIL_HEIGHT)->GetWindowText(temp); // if (temp!=_T("")) // { // UpdateEdit(IDC_RAIL_HEIGHT,false); // } } void CRectStairCreateDlg::OnChangeRailWidth() {//扶手宽 //modify by xlc on 090319 // CString temp; // this->GetDlgItem(IDC_RAIL_WIDTH)->GetWindowText(temp); // if (temp!=_T("")) // { // UpdateEdit(IDC_RAIL_WIDTH,false); // } } void CRectStairCreateDlg::OnChangeStepHeight() {//踏步高 //modify by xlc on 090319 // CString temp; // this->GetDlgItem(IDC_STEP_HEIGHT)->GetWindowText(temp); // if (temp!=_T("")) { // UpdateEdit(IDC_STEP_HEIGHT,false); } } void CRectStairCreateDlg::OnChangeStepWidth() {//踏步宽 //modify by xlc on 090319 // CString temp; // this->GetDlgItem(IDC_STEP_WIDTH)->GetWindowText(temp); // if (temp!=_T("")) // { // UpdateEdit(IDC_STEP_WIDTH,false); // } } void CRectStairCreateDlg::OnChangeStairLength() {//单坡长度 return; //modify by xlc on 090319 CString temp; this->GetDlgItem(IDC_STAIR_LENGTH)->GetWindowText(temp); if (temp!=_T("")) { UpdateEdit(IDC_STAIR_LENGTH,false); } } void CRectStairCreateDlg::OnChangeStairHeight() { //modify by xlc on 090319 CString temp; this->GetDlgItem(IDC_STAIR_HEIGHT)->GetWindowText(temp); if (temp!=_T("")) { UpdateEdit(IDC_STAIR_HEIGHT,false); } } void CRectStairCreateDlg::OnKFFloorRailDist() { //modiby by xlc on 090319 if (m_bClickClose) return; if (GetFocus()!=GetDlgItem(IDCANCEL)) { CString strText; GetDlgItem(IDC_EDIT_FLOORDIST)->GetWindowText(strText); if (fabs(_tstof(strText)-_tstof(m_strFloorRailDist))<_DIST_SNAP) return; UpdateEdit(IDC_EDIT_FLOORDIST,true); } } void CRectStairCreateDlg::OnKFRoationRailDist() { //modiby by xlc on 090319 if (m_bClickClose) return; if (GetFocus()!=GetDlgItem(IDCANCEL)) { CString strText; GetDlgItem(IDC_EDIT_ROATIONDIST)->GetWindowText(strText); if (fabs(_tstof(strText)-_tstof(m_strRoationRailDist))<_DIST_SNAP) return; UpdateEdit(IDC_EDIT_ROATIONDIST,true); } } void CRectStairCreateDlg::OnKFSectNum() { //modiby by xlc on 090319 if (m_bClickClose) return; if (GetFocus()!=GetDlgItem(IDCANCEL)) { CString strText; GetDlgItem(IDC_EDIT_SECTNUM)->GetWindowText(strText); if (fabs(_tstof(strText)-m_dSectStepNum)<_DIST_SNAP) return; UpdateEdit(IDC_EDIT_SECTNUM,true); } } void CRectStairCreateDlg::OnKFSectNum2() { //modiby by xlc on 090319 if (m_bClickClose) return; if (GetFocus()!=GetDlgItem(IDCANCEL)) { CString strText; GetDlgItem(IDC_EDIT_SECTNUM2)->GetWindowText(strText); if (fabs(_tstof(strText)-m_iSectStepNum)<_DIST_SNAP)// return; UpdateEdit(IDC_EDIT_SECTNUM2,true); } } //------------------- void CRectStairCreateDlg::OnKFStepELev() { //modiby by xlc on 090319 // if (GetFocus()!=GetDlgItem(IDCANCEL)) // { // CString strText; // GetDlgItem(IDC_STEP_ELEV)->GetWindowText(strText); // if (fabs(_tstof(strText)-_tstof(m_strStairWidth))<_DIST_SNAP) // return; // // UpdateEdit(IDC_STEP_ELEV,true); // } } void CRectStairCreateDlg::OnKFSlabWidth() { //对休息平台的宽度的处理 // if (this->CheckENChange(IDC_SLAB_WIDTH,m_strSlabWidth)) // { // this->UpdateEdit(IDC_SLAB_WIDTH,true); // } //modiby by xlc on 090319 if (m_bClickClose) return; if (GetFocus()!=GetDlgItem(IDCANCEL)) { CString strText; GetDlgItem(IDC_SLAB_WIDTH)->GetWindowText(strText); if (fabs(_tstof(strText)-_tstof(m_strSlabWidth))<_DIST_SNAP) return; UpdateEdit(IDC_SLAB_WIDTH,true); } } void CRectStairCreateDlg::OnKFSpaceWidth() { // if (this->CheckENChange(IDC_SPACE_WIDTH,m_strSpaceWidth)) // { // UpdateEdit(IDC_SPACE_WIDTH,true); // } //modiby by xlc on 090319 if (m_bClickClose) return; if (GetFocus()!=GetDlgItem(IDCANCEL)) { CString strText; GetDlgItem(IDC_SPACE_WIDTH)->GetWindowText(strText); if (fabs(_tstof(strText)-_tstof(m_strSpaceWidth))<_DIST_SNAP) return; UpdateEdit(IDC_SPACE_WIDTH,true); } } void CRectStairCreateDlg::OnKFStairWidth() { // if (this->CheckENChange(IDC_STAIR_WIDTH,m_strStairWidth)) // { // UpdateEdit(IDC_STAIR_WIDTH,true); // } //modiby by xlc on 090319 if (m_bClickClose) return; if (GetFocus()!=GetDlgItem(IDCANCEL)) { CString strText; GetDlgItem(IDC_STAIR_WIDTH)->GetWindowText(strText); if (fabs(_tstof(strText)-_tstof(m_strStairWidth))<_DIST_SNAP) return; UpdateEdit(IDC_STAIR_WIDTH,true); } } void CRectStairCreateDlg::OnKFStairWidth2() { // if (this->CheckENChange(IDC_STAIR_WIDTH2,m_strStairWidth2)) // { // this->UpdateEdit(IDC_STAIR_WIDTH2,true); // } //modiby by xlc on 090319 if (m_bClickClose) return; if (GetFocus()!=GetDlgItem(IDCANCEL)) { CString strText; GetDlgItem(IDC_STAIR_WIDTH2)->GetWindowText(strText); if (fabs(_tstof(strText)-_tstof(m_strStairWidth2))<_DIST_SNAP) return; UpdateEdit(IDC_STAIR_WIDTH2,true); } } void CRectStairCreateDlg::OnKFStepNum1() {//要特殊处理 // int y; // BOOL bResult; // y=this->GetDlgItemInt(IDC_STEP_NUM1,&bResult,FALSE); // if (y!=m_nStepNum1) // { // this->UpdateEdit(IDC_STEP_NUM1,true); // } //modiby by xlc on 090319 if (m_bClickClose) return; if (GetFocus()!=GetDlgItem(IDCANCEL)) { CString strText; GetDlgItem(IDC_STEP_NUM1)->GetWindowText(strText); if (fabs(_tstof(strText)-m_nStepNum1)<_DIST_SNAP) return; UpdateEdit(IDC_STEP_NUM1,true); } } void CRectStairCreateDlg::OnKFStepNum2() {//要特殊处理 // int x; // BOOL bResult; // x=this->GetDlgItemInt(IDC_STEP_NUM2,&bResult,FALSE); // if (x!=m_nStepNum2) // { // this->UpdateEdit(IDC_STEP_NUM2,true); // } //modiby by xlc on 090319 if (m_bClickClose) return; if (GetFocus()!=GetDlgItem(IDCANCEL)) { CString strText; GetDlgItem(IDC_STEP_NUM2)->GetWindowText(strText); if (fabs(_tstof(strText)-m_nStepNum2)<_DIST_SNAP) return; UpdateEdit(IDC_STEP_NUM2,true); } } void CRectStairCreateDlg::OnKillfocusStairHeightCombo() { if (m_bClickClose) return; //if (this->CheckENChange(IDC_STAIR_HEIGHT_COMBO,m_csStairHeight)) { if (GetFocus() != GetDlgItem(IDCANCEL)) { CString strText; m_stairHeightBox.GetWindowText(strText); if (strText==_T("当前层高")&&strText==m_csStairHeight) return; if (fabs(_tstof(strText)-_tstof(m_csStairHeight))<_DIST_SNAP) return; UpdateEdit(IDC_STAIR_HEIGHT_COMBO,true); //GetDlgItem(IDC_STAIR_HEIGHT)->SetWindowText(m_csStairHeight); //UpdateEdit(IDC_STAIR_HEIGHT,true); //CString strEdit; //GetDlgItemText(IDC_STAIR_HEIGHT, strEdit); //if (strEdit != m_csStairHeight) // SetDlgItemText(IDC_STAIR_HEIGHT_COMBO, m_strStairHeight); } } } void CRectStairCreateDlg::OnKFStepNum() {//特殊处理 // int x; // BOOL bResult; // x=this->GetDlgItemInt(IDC_STEP_NUM,&bResult,FALSE); // if (x!=m_nStepNum) // { // this->UpdateEdit(IDC_STEP_NUM,true); // } //modiby by xlc on 090319 if (GetFocus()!=GetDlgItem(IDCANCEL)) { CString strText; GetDlgItem(IDC_STEP_NUM)->GetWindowText(strText); if (fabs(_tstof(strText)-m_nStepNum)<_DIST_SNAP) return; UpdateEdit(IDC_STEP_NUM,true); } } void CRectStairCreateDlg::OnKFStepHeight() {//踏步高-失去焦点处理 // if (this->CheckENChange(IDC_STEP_HEIGHT,m_strStepHeight)) // { // this->UpdateEdit(IDC_STEP_HEIGHT,true); // } //modiby by xlc on 090319 if (m_bClickClose) return; if (GetFocus()!=GetDlgItem(IDCANCEL)) { CString strText; GetDlgItem(IDC_STEP_HEIGHT)->GetWindowText(strText); if (fabs(_tstof(strText)-_tstof(m_strStepHeight))<_DIST_SNAP) return; UpdateEdit(IDC_STEP_HEIGHT,true); } } void CRectStairCreateDlg::OnKFRailHeight() {//扶手高度-失去焦点处理 // if (this->CheckENChange(IDC_RAIL_HEIGHT,m_strRailHeight)) // { // this->UpdateEdit(IDC_RAIL_HEIGHT,true); // } //modiby by xlc on 090319 if (m_bClickClose) return; if (GetFocus()!=GetDlgItem(IDCANCEL)) { CString strText; GetDlgItem(IDC_RAIL_HEIGHT)->GetWindowText(strText); if (fabs(_tstof(strText)-_tstof(m_strRailHeight))<_DIST_SNAP) return; UpdateEdit(IDC_RAIL_HEIGHT,true); } } void CRectStairCreateDlg::OnKFRailDisttoside() {//扶手边距-失去焦点处理 // if (this->CheckENChange(IDC_RAIL_DISTTOSIDE,m_strRailDistToSide)) // { // this->UpdateEdit(IDC_RAIL_DISTTOSIDE,true); // } //modiby by xlc on 090319 if (m_bClickClose) return; if (GetFocus()!=GetDlgItem(IDCANCEL)) { CString strText; GetDlgItem(IDC_RAIL_DISTTOSIDE)->GetWindowText(strText); if (fabs(_tstof(strText)-_tstof(m_strRailDistToSide))<_DIST_SNAP) return; UpdateEdit(IDC_RAIL_DISTTOSIDE,true); } } void CRectStairCreateDlg::OnKFStepWidth() {//踏步宽-失去焦点处理 // if (this->CheckENChange(IDC_STEP_WIDTH,m_strStepWidth)) // { // this->UpdateEdit(IDC_STEP_WIDTH,true); // } //modiby by xlc on 090319 if (m_bClickClose) return; if (GetFocus()!=GetDlgItem(IDCANCEL)) { CString strText; GetDlgItem(IDC_STEP_WIDTH)->GetWindowText(strText); if (fabs(_tstof(strText)-_tstof(m_strStepWidth))<_DIST_SNAP) return; UpdateEdit(IDC_STEP_WIDTH,true); } } void CRectStairCreateDlg::OnKFStairLength() {//单坡长度-失去焦点处理 // if (this->CheckENChange(IDC_STAIR_LENGTH,m_strStairLength)) // { // this->UpdateEdit(IDC_STAIR_LENGTH,true); // } //modiby by xlc on 090319 if (m_bClickClose) return; if (GetFocus()!=GetDlgItem(IDCANCEL)) { CString strText; GetDlgItem(IDC_STAIR_LENGTH)->GetWindowText(strText); if (fabs(_tstof(strText)-_tstof(m_strStairLength))<_DIST_SNAP) return; UpdateEdit(IDC_STAIR_LENGTH,true); } } void CRectStairCreateDlg::OnKFRailWidth() {//扶手宽-失去焦点处理 // if (this->CheckENChange(IDC_RAIL_WIDTH,m_strRailWidth)) // { // this->UpdateEdit(IDC_RAIL_WIDTH,true); // } //modiby by xlc on 090319 if (m_bClickClose) return; if (GetFocus()!=GetDlgItem(IDCANCEL)) { CString strText; GetDlgItem(IDC_RAIL_WIDTH)->GetWindowText(strText); if (fabs(_tstof(strText)-_tstof(m_strRailWidth))<_DIST_SNAP) return; UpdateEdit(IDC_RAIL_WIDTH,true); } } void CRectStairCreateDlg::OnKFStairHeight() { } AcDbEntity * CRectStairCreateDlg::NewObject() { if (m_pBakObj==NULL) { TDbRectStair *pEnt=new TDbRectStair; 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 (AcDbEntity*)pEnt; } return (AcDbEntity*)(m_pBakObj->clone()); } void CRectStairCreateDlg::Dlg2Obj(AcDbEntity *pObj) { TDbRectStair *pStep=TDbRectStair::cast(pObj); ASSERT(pStep); if (m_bEvaRadius) { pStep->SetSingleEvaRadius(!m_nEvaRadiusSingle); pStep->SetDoubleEvaRadius(m_nEvaRadiusSingle); } else { pStep->SetSingleEvaRadius(FALSE); pStep->SetDoubleEvaRadius(FALSE); } pStep->SetRailHeight(_tstof(m_strRailHeight)); pStep->SetRailWidth(_tstof(m_strRailWidth)); pStep->SetRailDistToSide(_tstof(m_strRailDistToSide)); pStep->SetSpaceWidth(_tstof(m_strSpaceWidth)); if (m_iSlabType==1) pStep->SetArcPlatform(TRUE); else pStep->SetArcPlatform(FALSE); if (m_iSlabType!=1 && m_iSlabType!=0) { pStep->SetShowSlab(FALSE); } else pStep->SetShowSlab(TRUE); pStep->SetStairWidth(_tstof(m_strStairWidth)); pStep->SetStartSide(m_nStairSide); pStep->SetAlignment(m_nAlignment); //这个地方要添加处理 //处理关于自由与其他情况 if (m_nAlignment!=3) { //moddify by xlc on 090601 平台设置为无时不显示 //pStep->SetSlabSize((m_iSlabType==0 || m_iSlabType==1)? _tstof(m_strSlabWidth) : 0.0); pStep->SetSlabSize(_tstof(m_strSlabWidth)); } else { double temp1=::_tstof(m_strSlabSize1); double temp2=::_tstof(m_strSlabSize2); double temp3=::_tstof(m_strSlabWidth); if (temp1==temp2) { pStep->SetSlabSize1(temp3); pStep->SetSlabSize2(temp3); pStep->SetSlabSize(temp3); } else if (temp1SetSlabSize1(temp3); pStep->SetSlabSize(temp3); pStep->SetSlabSize2(temp2); } else if (temp3>=temp2) { pStep->SetSlabSize1(temp3); pStep->SetSlabSize2(temp3); pStep->SetSlabSize(temp3); } } else if (temp1> temp2) { if (temp3SetSlabSize2(temp3); pStep->SetSlabSize(temp3); pStep->SetSlabSize1(temp1); } else if (temp3>=temp1) { pStep->SetSlabSize1(temp3); pStep->SetSlabSize2(temp3); pStep->SetSlabSize(temp3); } } } //-------------------------------------- pStep->SetStairFlag(m_nStairFlag); pStep->SetInSideBeam(m_bNeedLeft); pStep->SetOutSideBeam(m_bNeedRight); pStep->SetAscent(m_bAsAscent); //pStep->SetAscent(TRUE);//测试 pStep->SetSlant(m_bHasSlant); pStep->SetOnGround(m_bOnGround); pStep->SetAutoRail(m_bAutoRail); pStep->SetOutRail(m_bOutRail); pStep->SetArrow(m_bUpDir); pStep->SetStepWidth(_tstof(m_strStepWidth)); pStep->SetStepHeight(_tstof(m_strStepHeight)); pStep->SetStepNum1(m_nStepNum1); pStep->SetStepNum2(m_nStepNum2); // [7/9/2008 nsh] pStep->SetRailDist(::_tstof(m_strFloorRailDist)); pStep->SetRailDistMid(::_tstof(m_strRoationRailDist)); pStep->SetConnectRail(m_bRailCon);//扶手连接 if (m_bAsAscent) pStep->SetSectElev(m_dSectStepNum); else pStep->SetSectStepNum(m_iSectStepNum); pStep->SetAutoOutRail(m_bOutRail?m_bOutHandRail:FALSE); //----------------- if (m_bEdit) { if (m_pBakObj) delete m_pBakObj; m_pBakObj=(TDbRectStair*)(pStep->clone()); } return; } void CRectStairCreateDlg::Obj2Dlg(const AcDbEntity *pObj) { TDbRectStair *pStep=TDbRectStair::cast(pObj); ASSERT(pStep); m_bEdit=TRUE; m_pBakObj=(TDbRectStair*)(pObj->clone()); m_strRailWidth =Dist2Str(pStep->GetRailWidth()); m_strRailDistToSide=Dist2Str(pStep->GetRailDistToSide()); m_strRailHeight=Dist2Str(pStep->GetRailHeight()); m_strSpaceWidth=Dist2Str(pStep->GetSpaceWidth()); m_strStairWidth=Dist2Str(pStep->GetStairWidth()); m_strStepWidth=Dist2Str(pStep->GetStepWidth()); m_nStairSide=pStep->GetStartSide(); m_nAlignment=pStep->GetAlignment(); m_nStairFlag=pStep->GetStairFlag(); if (pStep->IsShowSlab()) { if (pStep->IsArcPlatform()) m_iSlabType=1; else m_iSlabType=0; m_strSlabWidth=Dist2Str(pStep->GetSlabSize()); } else m_iSlabType = 2; m_bNeedLeft=pStep->IsInSideBeam(); m_bNeedRight=pStep->IsOutSideBeam(); m_bAutoRail = pStep->IsAutoRail(); m_bOutRail=pStep->IsOutRail(); m_bAsAscent = pStep->IsAscent(); m_bHasSlant = pStep->HasSlant(); m_bOnGround = pStep->IsOnGround(); m_strSlabSize1=Dist2Str(pStep->GetSlabSize1());//得到平台一的宽度 m_strSlabSize2=Dist2Str(pStep->GetSlabSize2());//得到平台二的宽度 m_nStepNum1=pStep->GetStepNum1(); m_nStepNum2=pStep->GetStepNum2(); m_nStepNum=m_nStepNum1+m_nStepNum2; m_strStepHeight.Format(_T("%.2f"),pStep->GetStepHeight()); m_strStairLength=Dist2Str(_tstof(m_strStepWidth)*(m_bAsAscent? m_nStepNum1 : m_nStepNum1-1)); m_strStairHeight =Dist2Str(m_nStepNum * pStep->GetStepHeight()); m_csStairHeight=m_strStairHeight; m_strRoationRailDist=Dist2Str(pStep->GetRailDistMid()); m_strFloorRailDist=Dist2Str(pStep->GetRailDist()); m_bOutHandRail=pStep->IsAutoOutRail(); m_bUpDir=pStep->IsArrow(); m_bRailCon=pStep->IsConnectRail(); m_dSectStepNum=pStep->GetSectElev(); m_iSectStepNum=(int)pStep->GetSectStepNum(); if (pStep->IsEvaRadius()) { m_bEvaRadius = TRUE; if (pStep->IsDoubleEvaRadius()) { m_nEvaRadiusSingle = 1; } if (pStep->IsSingleEvaRadius()) { m_nEvaRadiusSingle = 0; } } else { m_bEvaRadius = FALSE; } } void CRectStairCreateDlg::UpdateSel() { int oldSlabType=m_iSlabType; CLineStairDlg::UpdateSel(); GetDlgItem(IDC_SLAB_WIDTH)->EnableWindow(m_iSlabType!=2); GetDlgItem(IDC_EDIT_SLABWIDTH2)->EnableWindow(m_iSlabType!=2);// [7/29/2008 nsh] //modify by xlc on 090601 // GetDlgItem(IDC_STAIR_LENGTH)->EnableWindow(m_bAsAscent? SW_SHOW : SW_HIDE); // GetDlgItem(IDC_STAIR_LENGTH_STATIC2)->EnableWindow(m_bAsAscent? SW_SHOW : SW_HIDE); CDataExchange dxOut(this,false); if (m_bAsAscent) { m_strStairLength=Dist2Str(::_tstof(m_strStepWidth)*m_nStepNum1); } else { m_strStairLength=Dist2Str(::_tstof(m_strStepWidth)*(m_nStepNum1-1)); } DDX_Text(&dxOut,IDC_STAIR_LENGTH,m_strStairLength); if (oldSlabType!=m_iSlabType) UpdateImage(); } //比较两个浮点数的大小,并返回较小的一个数 double GetMinDouble(const double& Num1,const double& Num2); //比较两个浮点数的大小,并返回较大的一个数 double GetMaxDouble(const double& Num1,const double& Num2); bool CRectStairCreateDlg::UpdateEdit(UINT ctrlID,bool bReportError) { 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; CString temp; pEdit->GetWindowText(temp); bool bContinue=false; CDataExchange dxOut(this,false); switch(ctrlID) { case IDC_SPACE_WIDTH: { if (_tstof(temp)>2.0*_MIN_STAIRWIDTH) { m_strSpaceWidth=temp; if (_tstof(temp)>_tstof(m_strStairWidth)*2) { m_strStairWidth2.Format(_T("%.2f"),(_tstof(temp)-_tstof(m_strStairWidth)*2)); } else { m_strStairWidth2 = _T("0"); m_strStairWidth.Format(_T("%.2f"),_tstof(m_strSpaceWidth)/2); GetDlgItem(IDC_STAIR_WIDTH)->SetWindowText(m_strStairWidth); } GetDlgItem(IDC_STAIR_WIDTH2)->SetWindowText(m_strStairWidth2); if (m_bEvaRadius) { //有疏散半径时,平台宽度最小为梯间宽的二分之一 double dSlabMinWidth = ::_tstof(m_strSpaceWidth)/2.0; if (_wtof(m_strSlabWidth) < dSlabMinWidth) m_strSlabWidth.Format(_T("%g"), dSlabMinWidth); UpdateEdit(IDC_SLAB_WIDTH, false); UpdateData(FALSE); } UpdateImage(); } else if (bReportError) { CRectStairCreateDlg::m_bError =TRUE; this->MessageBox(_T("梯间宽太小,请重新输入或先减小梯段宽!"),_T("AutoCAD"),MB_OK); DDX_Text(&dxOut,IDC_SPACE_WIDTH,m_strSpaceWidth); if (m_bEdit) pEdit->SetFocus(); } } break; case IDC_STAIR_WIDTH: { if (_tstof(temp)>0&&_tstof(temp)*2<=_tstof(m_strSpaceWidth)) { m_strStairWidth=temp; m_strStairWidth2.Format(_T("%.2f"),_tstof(m_strSpaceWidth)-2.0*_tstof(temp)); GetDlgItem(IDC_STAIR_WIDTH2)->SetWindowText(m_strStairWidth2); UpdateImage(); } else if (bReportError) { CRectStairCreateDlg::m_bError=TRUE; if (_tstof(temp)>0) this->MessageBox(_T("梯段宽度总和超过了梯间宽,请重新输入或先增大梯间宽!"),_T("AutoCAD"),MB_OK); else this->MessageBox(_T("梯段宽度太小!"),_T("AutoCAD"),MB_OK); DDX_Text(&dxOut,IDC_STAIR_WIDTH,m_strStairWidth); if (m_bEdit) pEdit->SetFocus(); } } break; case IDC_STAIR_WIDTH2: { if (_tstof(temp)>=0&&_tstof(temp)<_tstof(m_strSpaceWidth)) { m_strStairWidth2=temp; m_strStairWidth.Format(_T("%.2f"),(_tstof(m_strSpaceWidth)-_tstof(temp))/2); GetDlgItem(IDC_STAIR_WIDTH)->SetWindowText(m_strStairWidth); UpdateImage(); } else if (bReportError) { CRectStairCreateDlg::m_bError=TRUE; if (_tstof(temp)>0) this->MessageBox(_T("井宽必须小于梯间宽,请重新输入或先增大梯间宽!"),_T("AutoCAD"),MB_OK); else this->MessageBox(_T("井宽太小!"),_T("系统提示"),MB_OK); DDX_Text(&dxOut,IDC_STAIR_WIDTH2,m_strStairWidth2); if (m_bEdit) pEdit->SetFocus(); } } break; case IDC_STEP_NUM1: { if (_ttoi(temp)>1&&_ttoi(temp)m_nStepNum2) { m_strSlabWidth2=Dist2Str(temp1/2+temp3-temp2/2); DDX_Text(&dxOut,IDC_EDIT_SLABWIDTH2,m_strSlabWidth2); } else { m_strSlabWidth=Dist2Str(temp2/2+temp4-temp1/2); DDX_Text(&dxOut,IDC_SLAB_WIDTH,m_strSlabWidth); } } break; case 2: { double temp1=::_tstof(m_strSlabWidth)+::_tstof(m_strStepWidth)*(m_nStepNum1-1); double temp2=::_tstof(m_strSlabWidth2)+ ::_tstof(m_strStepWidth)*(m_nStepNum2-1); if (temp1MessageBox(_T("第一跑踏步数太少!"),_T("AutoCAD"),MB_OK); else this->MessageBox(_T("第一跑踏步数太多!,请重新输入或先增大总踏步数"),_T("AutoCAD"),MB_OK); DDX_Text(&dxOut,IDC_STEP_NUM1,m_nStepNum1); if (m_bEdit) pEdit->SetFocus(); } } break; case IDC_STEP_NUM2: { if (_ttoi(temp)>1&&_ttoi(temp)MessageBox(_T("第二跑踏步数太少!"),_T("AutoCAD"),MB_OK); else this->MessageBox(_T("第二跑踏步数太多!,请重新输入或先增大总踏步数!"),_T("AutoCAD"),MB_OK); DDX_Text(&dxOut,IDC_STEP_NUM2,m_nStepNum2); if (m_bEdit) pEdit->SetFocus(); } } break; case IDC_STEP_NUM: { static int x; x=_ttoi(temp); //if (_ttoi(temp)!=2&&_ttoi(temp)!=3 && _ttoi(temp)!=1&&temp!="") if (_ttoi(temp)>3) { CString strStairHeight=m_csStairHeight; if (strStairHeight == _T("当前层高")) { strStairHeight = Dist2Str(DocGetLHeight()); } //新添加的 m_nStepNum=_ttoi(temp); m_strStepHeight.Format(_T("%.2f"),_tstof(strStairHeight)/m_nStepNum); DDX_Text(&dxOut,IDC_STEP_HEIGHT,m_strStepHeight); stepNum1Spin.SetRange(2,x-2); stepNum2Spin.SetRange(2,x-2); m_ctrlSectNum.SetRange(1,m_nStepNum); DDX_Text(&dxOut,IDC_STEP_NUM1,m_nStepNum1=x/2); DDX_Text(&dxOut,IDC_STEP_NUM2,m_nStepNum2=x-m_nStepNum1); m_nStepNum=x; // [9/29/2007 nsh] if (m_bAsAscent) { m_strStepWidth=Dist2Str(_tstof(m_strStairLength)/(max(1,m_nStepNum1))); DDX_Text(&dxOut,IDC_STEP_WIDTH,m_strStepWidth); } else { m_strStairLength=Dist2Str(_tstof(m_strStepWidth)* (m_bAsAscent? m_nStepNum1 : (m_nStepNum1-1))); DDX_Text(&dxOut,IDC_STAIR_LENGTH,m_strStairLength); } UpdateImage(); } else if (bReportError) { CRectStairCreateDlg::m_bError=TRUE; this->MessageBox(_T("总踏步数至少为4!"),_T("AutoCAD"),MB_OK); DDX_Text(&dxOut,IDC_STEP_NUM,m_nStepNum); if (m_bEdit) pEdit->SetFocus(); } } break; case IDC_STAIR_HEIGHT:// ----------------------------------- [9/27/2007 nsh] { m_bUpdateEdit=TRUE; bUpdating=false; return true; break; if (temp == _T("当前层高")) { temp = Dist2Str(DocGetLHeight()); } if (_tstof(temp)>=4.0*_tstof(m_strStepHeight)-_DIST_SNAP) {//最少当前四踏步高 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); stepNum1Spin.SetRange(2,m_nStepNum-2); stepNum2Spin.SetRange(2,m_nStepNum-2); m_ctrlSectNum.SetRange(1,m_nStepNum);//剖切步数 DDX_Text(&dxOut,IDC_STEP_NUM1,m_nStepNum1=m_nStepNum/2); DDX_Text(&dxOut,IDC_STEP_NUM2,m_nStepNum2=m_nStepNum-m_nStepNum1); m_strStairLength=Dist2Str(_tstof(m_strStepWidth)* (m_bAsAscent? m_nStepNum1 : (m_nStepNum1-1))); DDX_Text(&dxOut,IDC_STAIR_LENGTH,m_strStairLength); UpdateImage(); } else if (bReportError) { CRectStairCreateDlg::m_bError=TRUE; AfxMessageBox(_T("梯段高度太小!")); if (!m_bAsAscent) m_strStairHeight.Format(_T("%.2f"),_tstof(m_strStepHeight)*m_nStepNum); DDX_Text(&dxOut,IDC_STAIR_HEIGHT,m_strStairHeight);//还原 if (m_bEdit) pEdit->SetFocus(); } } break; case IDC_STAIR_HEIGHT_COMBO: { if (temp==_T("当前层高")) { temp = Dist2Str(DocGetLHeight());; } if (_tstof(temp)>=4*_tstof(m_strStepHeight)-_DIST_SNAP) {//最少当前四踏步高 m_csStairHeight=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); stepNum1Spin.SetRange(2,m_nStepNum-2); stepNum2Spin.SetRange(2,m_nStepNum-2); DDX_Text(&dxOut,IDC_STEP_NUM1,m_nStepNum1=m_nStepNum/2); DDX_Text(&dxOut,IDC_STEP_NUM2,m_nStepNum2=m_nStepNum-m_nStepNum1); m_strStairLength=Dist2Str(_tstof(m_strStepWidth)* (m_bAsAscent? m_nStepNum1 : (m_nStepNum1-1))); DDX_Text(&dxOut,IDC_STAIR_LENGTH,m_strStairLength); UpdateImage(); } else if (bReportError) { CRectStairCreateDlg::m_bError=TRUE; this->MessageBox(_T("梯段高度太小!"),_T("AutoCAD"),MB_OK); DDX_Text(&dxOut,IDC_STAIR_HEIGHT_COMBO,m_csStairHeight);//还原 if (m_bEdit) pEdit->SetFocus(); } break; } case IDC_STEP_HEIGHT: { CString strStairHeight=m_csStairHeight; if (strStairHeight == _T("当前层高")) { strStairHeight = Dist2Str(DocGetLHeight()); } int num(1); if (fabs(_tstof(temp))>_DIST_SNAP) { num=(int)(_tstof(strStairHeight)/_tstof(temp)+0.5); } if (num>3) { m_nStepNum=num; m_strStepHeight.Format(_T("%.2f"),_tstof(strStairHeight)/m_nStepNum); DDX_Text(&dxOut,IDC_STEP_NUM,m_nStepNum); DDX_Text(&dxOut,IDC_STEP_HEIGHT,m_strStepHeight);//自动调整 stepNum1Spin.SetRange(2,m_nStepNum-2); stepNum2Spin.SetRange(2,m_nStepNum-2); DDX_Text(&dxOut,IDC_STEP_NUM1,m_nStepNum1=m_nStepNum/2); DDX_Text(&dxOut,IDC_STEP_NUM2,m_nStepNum2=m_nStepNum-m_nStepNum1); UpdateImage(); } else if (bReportError) { CRectStairCreateDlg::m_bError=TRUE; this->MessageBox(_T("新踏步高度将造成踏步数小于4,请重新输入或先增大梯段高度!"),_T("AutoCAD"),MB_OK); DDX_Text(&dxOut,IDC_STEP_HEIGHT,m_strStepHeight); if (m_bEdit) pEdit->SetFocus(); } } break; case IDC_STAIR_LENGTH: { if (m_bAsAscent) { if (_tstof(temp)>_DIST_SNAP&& temp!="") { CString ss=m_strStairLength; CString sy=m_strStepWidth; m_strStairLength=temp; m_strStepWidth=Dist2Str(_tstof(temp)/(m_bAsAscent? m_nStepNum1 : (m_nStepNum1-1))); TDbEntity *pStep =TDbEntity::cast(NewObject()); Dlg2Obj(pStep); BOOL x=pStep->IsValid(); if (!pStep->IsValid()) { MessageBox(_T("输入的单坡长度不符合要求"),_T("AutoCAD"),MB_OK); m_strStairLength=ss; m_strStepWidth=sy; DDX_Text(&dxOut,IDC_STAIR_LENGTH,m_strStairLength); DDX_Text(&dxOut,IDC_STEP_WIDTH,m_strStepWidth); delete pStep; return FALSE; } DDX_Text(&dxOut,IDC_STEP_WIDTH,m_strStepWidth); delete pStep; UpdateImage(); } else if (bReportError) { CRectStairCreateDlg::m_bError=TRUE; this->MessageBox(_T("梯段长度太小!"),_T("AutoCAD"),MB_OK); DDX_Text(&dxOut,IDC_STAIR_LENGTH,m_strStairLength); if (m_bEdit) pEdit->SetFocus(); } } } break; case IDC_STEP_WIDTH: { if (_tstof(temp)>_DIST_SNAP && temp!="") { m_strStepWidth=temp; m_strStairLength=Dist2Str(_tstof(temp)*(m_bAsAscent? m_nStepNum1 : (m_nStepNum1-1))); DDX_Text(&dxOut,IDC_STAIR_LENGTH,m_strStairLength); UpdateImage(); } else if (bReportError) { CRectStairCreateDlg::m_bError=TRUE; this->MessageBox(_T("踏步宽度太小!"),_T("AutoCAD"),MB_OK); DDX_Text(&dxOut,IDC_STEP_WIDTH,m_strStepWidth); if (m_bEdit) pEdit->SetFocus(); } } break; case IDC_RADIO_FIRST: {//对首层的处理 break; } case IDC_RADIO_MID: {//对中间层的处理 break; } case IDC_RADIO_TOP: {//对顶层的处理 break; } case IDC_AUTORAIL: {//自动生成边梁 break; } case IDC_RIGHT_BEAM: {//右边梁的处理 break; } case IDC_LEFT_BEAM: {//左边梁的处理 break; } case IDC_NO_PLATFORM: {//休息平台-无 break; } case IDC_RECT_PLATFORM: {//休息平台-矩形 break; } case IDC_ARC_PLATFORM: {//休息平台-圆弧 break; } case IDC_SLAB_WIDTH: {//休息平台的宽度的处理 if (::_tstof(temp)<0.0) { if (bReportError) { AfxMessageBox(_T("平台宽度不正确!")); DDX_Text(&dxOut,IDC_SLAB_WIDTH,m_strSlabWidth); pEdit->SetFocus(); } } else { m_strSlabWidth=temp; DDX_Text(&dxOut,IDC_SLAB_WIDTH,m_strSlabWidth); UpdateImage(); } break; } case IDC_RAIL_HEIGHT: {//扶手高度 必须填写容错处理 // static double x,y; // static CString nRailHeight,nSave; // nSave=m_strRailHeight; // x=_tcstod(m_strRailHeight,NULL); // this->GetDlgItemText(IDC_RAIL_HEIGHT,nRailHeight); // y=_tcstod(nRailHeight,NULL); // this->UpdateData(); // TDbEntity *pStep=TDbEntity::cast(NewObject()); // Dlg2Obj(pStep); // if (!pStep->IsValid()) // { // CRectStairCreateDlg::m_bError=TRUE; // this->MessageBox(_T("输入的扶手高度不正确,请正确填写!"),_T("AutoCAD"),MB_OK); // m_strRailHeight=nSave; // DDX_Text(&dxOut,IDC_RAIL_HEIGHT,m_strRailHeight); // } // else // { // this->UpdateImage(); // this->UpdateData(); // m_strRailHeight=nRailHeight; // this->UpdateData(FALSE); // } // pStep=NULL; if (::_tstof(temp)<_DIST_SNAP) { if (bReportError) { AfxMessageBox(_T("扶手高度不正确!")); DDX_Text(&dxOut,IDC_RAIL_HEIGHT,m_strRailHeight); pEdit->SetFocus(); } } else { m_strRailHeight=temp; DDX_Text(&dxOut,IDC_RAIL_HEIGHT,m_strRailHeight); UpdateImage(); } break; } case IDC_RAIL_WIDTH: {//扶手宽度 必须填写容错处理 // static double x,y; // static CString nRailHeight,nSave; // nSave=m_strRailWidth; // x=_tcstod(m_strRailWidth,NULL); // this->GetDlgItemText(IDC_RAIL_WIDTH,nRailHeight); // y=_tcstod(nRailHeight,NULL); // this->UpdateData(); // TDbEntity *pStep = TDbEntity::cast(NewObject()); // Dlg2Obj(pStep); // if (!pStep->IsValid()) // { // CRectStairCreateDlg::m_bError=TRUE; // this->MessageBox(_T("输入的扶手宽度不正确,请正确填写!"),_T("AutoCAD"),MB_OK); // m_strRailWidth=nSave; // DDX_Text(&dxOut,IDC_RAIL_WIDTH,m_strRailWidth); // } // else // { // this->UpdateImage(); // this->UpdateData(); // m_strRailWidth=nRailHeight; // this->UpdateData(FALSE); // } // pStep=NULL; if (::_tstof(temp)<_DIST_SNAP) { if (bReportError) { AfxMessageBox(_T("扶手宽度不正确!")); DDX_Text(&dxOut,IDC_RAIL_WIDTH,m_strRailWidth); pEdit->SetFocus(); } } else { m_strRailWidth=temp; DDX_Text(&dxOut,IDC_RAIL_WIDTH,m_strRailWidth); UpdateImage(); } break; } case IDC_RAIL_DISTTOSIDE: {//扶手边距 必须填写容错处理 // static double x,y; // static CString nRailHeight,nSave; // nSave=m_strRailDistToSide; // x=_tcstod(m_strRailDistToSide,NULL); // this->GetDlgItemText(IDC_RAIL_DISTTOSIDE,nRailHeight); // y=_tcstod(nRailHeight,NULL); // this->UpdateData(); // TDbEntity *pStep=TDbEntity::cast(NewObject()); // Dlg2Obj(pStep); // if (!pStep->IsValid()) // { // CRectStairCreateDlg::m_bError=TRUE; // this->MessageBox(_T("输入的扶手边距不正确,请正确填写!"),_T("AutoCAD"),MB_OK); // m_strRailDistToSide=nSave; // DDX_Text(&dxOut,IDC_RAIL_DISTTOSIDE,m_strRailDistToSide); // } // else // { // this->UpdateImage(); // this->UpdateData(); // m_strRailDistToSide=nRailHeight; // this->UpdateData(FALSE); // } // pStep=NULL; if (_tstof(temp)<-(_tstof(m_strSpaceWidth)-_tstof(m_strStairWidth)*2)/2 ||_tstof(temp)>_tstof(m_strStairWidth)/2) { if (bReportError) { AfxMessageBox(_T("扶手距边距离不正确!")); DDX_Text(&dxOut,IDC_RAIL_DISTTOSIDE,m_strRailDistToSide); pEdit->SetFocus(); } } else { m_strRailDistToSide=temp; DDX_Text(&dxOut,IDC_RAIL_DISTTOSIDE,m_strRailDistToSide); UpdateImage(); } break; } case IDC_ALIGN_SLAB: {//齐平台 break; } case IDC_ALIGN_MID: {//居中 break; } case IDC_ALIGN_FLOOR: {//齐楼板 break; } case IDC_RADIO_FREEDOM:// [7/29/2008 nsh] {//自由 break; } case IDC_SIDE_LEFT: {//上楼位置-左边 break; } case IDC_SIDE_RIGHT: {//上楼位置-右边 break; } case IDC_OUTRAIL: {//有外边梁 break; } case IDC_CHECK_CONNECTION: { break; } case IDC_AS_ASCENT: {//重写作为坡道的操作 this->UpdateImage(); break; } case IDC_CHECK_OUTRAIL: {//外侧栏杆 break; } case IDC_CHECK1: {//标注上楼方向 break; } case IDC_EDIT_ROATIONDIST: {//转角伸出距离 // if (::_tstof(temp)<0 || temp==_T("")) // temp=_T("0"); // m_strRoationRailDist=temp; // DDX_Text(&dxOut,IDC_EDIT_ROATIONDIST,m_strRoationRailDist); // if (::_tstof(temp)<-(_tstof(m_strStepWidth)*(m_nStepNum1>m_nStepNum2?m_nStepNum1:m_nStepNum2-1)*0.5)) { if (bReportError) { AfxMessageBox(_T("转角扶手伸出距离不正确!")); DDX_Text(&dxOut,IDC_EDIT_ROATIONDIST,m_strRoationRailDist); pEdit->SetFocus(); } } else { m_strRoationRailDist=temp; DDX_Text(&dxOut,IDC_EDIT_ROATIONDIST,m_strRoationRailDist); UpdateImage(); } } break; case IDC_EDIT_FLOORDIST: {//层间伸出距离 // if (::_tstof(temp)<0 || temp==_T("")) // temp=_T("0"); // m_strFloorRailDist=temp; // DDX_Text(&dxOut,IDC_EDIT_FLOORDIST,m_strFloorRailDist); // UpdateImage(); if (::_tstof(temp)<-(_tstof(m_strStepWidth)*(m_nStepNum1>m_nStepNum2?m_nStepNum1:m_nStepNum2-1)*0.5)) { if (bReportError) { AfxMessageBox(_T("层间扶手伸出距离不正确!")); DDX_Text(&dxOut,IDC_EDIT_FLOORDIST,m_strFloorRailDist); pEdit->SetFocus(); } } else { m_strFloorRailDist=temp; DDX_Text(&dxOut,IDC_EDIT_FLOORDIST,m_strFloorRailDist); UpdateImage(); } } break; case IDC_EDIT_SECTNUM: {//剖切高度 if (::_tstof(temp)<_tstof(m_strStepHeight)*0.5 || _tstof(temp)>_tstof(m_strStepHeight)*(m_nStepNum-0.5)) { if (bReportError) { AfxMessageBox(_T("剖切高度不正确!")); DDX_Text(&dxOut,IDC_EDIT_SECTNUM,m_dSectStepNum); pEdit->SetFocus(); } } else { m_dSectStepNum=::_ttoi(temp); m_iSectStepNum=(int)(m_dSectStepNum/::_tstof(m_strStepHeight)+0.5); DDX_Text(&dxOut,IDC_EDIT_SECTNUM2,m_iSectStepNum); DDX_Text(&dxOut,IDC_EDIT_SECTNUM,m_dSectStepNum); UpdateImage(); } } break; case IDC_EDIT_SECTNUM2: {//剖切步数 m_ctrlSectNum.SetRange(1,m_nStepNum); if (::_ttoi(temp)>0&&::_ttoi(temp)<=m_nStepNum) { m_iSectStepNum=::_ttoi(temp); m_dSectStepNum=(m_iSectStepNum-0.5)*::_tstof(m_strStepHeight); DDX_Text(&dxOut,IDC_EDIT_SECTNUM2,m_iSectStepNum); DDX_Text(&dxOut,IDC_EDIT_SECTNUM,m_dSectStepNum); UpdateImage(); } else if (bReportError) { AfxMessageBox(_T("剖切步数不正确!")); int sectNum=m_iSectStepNum; if (m_iSectStepNum<0||m_iSectStepNum>m_nStepNum) { sectNum=(int)(m_nStepNum/2); } DDX_Text(&dxOut,IDC_EDIT_SECTNUM2,sectNum); pEdit->SetFocus(); } } break; case IDC_CHECK_EVA_RADIUS:// [6/16/2016 jsx] {//是否有疏散半径 break; } case IDC_RADIO_EVA_SINGLE:// [6/16/2016 jsx] {//单侧疏散半径 break; } case IDC_RADIO_EVA_DOUBLE:// [6/16/2008 jsx] {//双侧疏散半径 break; } default: if (m_bEdit) break; else bContinue=true; } m_bUpdateEdit=TRUE; if (!m_bEdit) { if (!m_bError) { acedPostCommand(_T("\33")); } else { m_bError=FALSE; } } bUpdating=false; return true; //return bContinue?CBaseStairDlg::UpdateEdit(ctrlID,bReportError):true; } BOOL CRectStairCreateDlg::OnInitDialog() { if (m_nStepNum<4) { m_nStepNum=20; m_nStepNum1=m_nStepNum2=10; m_strStairHeight=Dist2Str(_tstof(m_strStepHeight)*20); } else if ((m_nStepNum1+m_nStepNum2)!=m_nStepNum||m_nStepNum1<2||m_nStepNum2<2) { m_nStepNum1=m_nStepNum/2; m_nStepNum2=m_nStepNum-m_nStepNum1; } CLineStairDlg::OnInitDialog(); for(long i=0;iGetDlgItem(IDC_HAS_SLANT)->EnableWindow(TRUE); this->GetDlgItem(IDC_ON_GROUND)->EnableWindow(TRUE); //新添加 this->GetDlgItem(IDC_EDIT_SECTNUM2)->ShowWindow(SW_HIDE); this->GetDlgItem(IDC_SPIN_SECTNUM)->ShowWindow(SW_HIDE); this->GetDlgItem(IDC_STATIC_SECT)->ShowWindow(SW_HIDE); this->GetDlgItem(IDC_STATIC_SECTNUM)->ShowWindow(SW_SHOW); this->GetDlgItem(IDC_EDIT_SECTNUM)->ShowWindow(SW_SHOW); //add by xlc on 090527 GetDlgItem(IDC_STAIR_LENGTH)->ShowWindow(SW_SHOW); GetDlgItem(IDC_STAIR_LENGTH_STATIC2)->ShowWindow(SW_SHOW); GetDlgItem(IDC_CHECK_EVA_RADIUS)->ShowWindow(SW_HIDE); //保存状态 m_bSaveCurEvaRadius = m_bEvaRadius; if (m_bEvaRadius) ((CButton*)GetDlgItem(IDC_CHECK_EVA_RADIUS))->SetCheck(FALSE); GetDlgItem(IDC_STATIC_EVA)->ShowWindow(SW_HIDE); GetDlgItem(IDC_RADIO_EVA_SINGLE)->ShowWindow(SW_HIDE); GetDlgItem(IDC_RADIO_EVA_DOUBLE)->ShowWindow(SW_HIDE); GetDlgItem(IDC_STEP_NUM1)->EnableWindow(FALSE); GetDlgItem(IDC_STEP_NUM2)->EnableWindow(FALSE); GetDlgItem(IDC_STEP_NUM1_SPIN)->EnableWindow(FALSE); GetDlgItem(IDC_STEP_NUM2_SPIN)->EnableWindow(FALSE); } else { this->GetDlgItem(IDC_EDIT_SECTNUM2)->ShowWindow(SW_SHOW); this->GetDlgItem(IDC_SPIN_SECTNUM)->ShowWindow(SW_SHOW); this->GetDlgItem(IDC_STATIC_SECT)->ShowWindow(SW_SHOW); this->GetDlgItem(IDC_STATIC_SECTNUM)->ShowWindow(SW_HIDE); this->GetDlgItem(IDC_EDIT_SECTNUM)->ShowWindow(SW_HIDE); this->GetDlgItem(IDC_HAS_SLANT)->EnableWindow(FALSE); this->GetDlgItem(IDC_ON_GROUND)->EnableWindow(FALSE); //add by xlc on 090527 GetDlgItem(IDC_STAIR_LENGTH)->ShowWindow(SW_HIDE); GetDlgItem(IDC_STAIR_LENGTH_STATIC2)->ShowWindow(SW_HIDE); GetDlgItem(IDC_CHECK_EVA_RADIUS)->ShowWindow(SW_SHOW); if (m_bSaveCurEvaRadius) ((CButton*)GetDlgItem(IDC_CHECK_EVA_RADIUS))->SetCheck(TRUE); GetDlgItem(IDC_STATIC_EVA)->ShowWindow(SW_SHOW); GetDlgItem(IDC_RADIO_EVA_SINGLE)->ShowWindow(SW_SHOW); GetDlgItem(IDC_RADIO_EVA_DOUBLE)->ShowWindow(SW_SHOW); GetDlgItem(IDC_STEP_NUM1)->EnableWindow(TRUE); GetDlgItem(IDC_STEP_NUM2)->EnableWindow(TRUE); GetDlgItem(IDC_STEP_NUM1_SPIN)->EnableWindow(TRUE); GetDlgItem(IDC_STEP_NUM2_SPIN)->EnableWindow(TRUE); } if (m_bAsAscent) { m_dSectStepNum=(m_iSectStepNum-0.5)*::_tstof(m_strStepHeight); } else { m_iSectStepNum=(int)(m_dSectStepNum/::_tstof(m_strStepHeight)+0.5); } this->GetDlgItem(IDC_CHECK_OUTRAIL)->EnableWindow(m_bOutRail);//外侧扶手 if (!m_bEdit) { CRect rect,rect1; GetDlgItem(IDC_PREVIEW)->GetWindowRect(rect); GetDlgItem(IDOK)->GetWindowRect(rect1); ScreenToClient(rect); ScreenToClient(rect1); rect.bottom = rect1.bottom; GetDlgItem(IDC_PREVIEW)->MoveWindow(rect); GetDlgItem(IDOK)->ShowWindow(SW_HIDE); GetDlgItem(IDCANCEL)->ShowWindow(SW_HIDE); } if (m_bEvaRadius) { GetDlgItem(IDC_RADIO_EVA_SINGLE)->EnableWindow(TRUE); GetDlgItem(IDC_RADIO_EVA_DOUBLE)->EnableWindow(TRUE); } else { GetDlgItem(IDC_RADIO_EVA_SINGLE)->EnableWindow(FALSE); GetDlgItem(IDC_RADIO_EVA_DOUBLE)->EnableWindow(FALSE); } UpdateImage(); //add by xlc on 090211 SetWindowText(_T("双跑楼梯")); return TRUE; } void CRectStairCreateDlg::OnPickSpaceWidth() {//梯间宽的处理函数 if (m_bEdit) { double nSpaceWidth=_tstof(m_strSpaceWidth); BeginEditorCommand(); int nRet=GetDist(_T("\n楼梯间宽度"), nSpaceWidth, RSG_NOZERO|RSG_NONEG); CompleteEditorCommand(); if (nRet==RTNORM) { if (nSpaceWidth<(2.0*_MIN_STAIRWIDTH)) { ::AfxMessageBox(_T("楼梯间宽太小,请重新输入")); return; } CString temp; temp.Format(_T("%.2f"),nSpaceWidth); GetDlgItem(IDC_SPACE_WIDTH)->SetWindowText(temp);; UpdateEdit(IDC_SPACE_WIDTH,true); } } else { acedGetAcadDwgView()->GetFocus(); CRectStairCreateDlg::m_bStepWidth=TRUE; CRectStairCreateDlg::m_bESCStairWidth=TRUE; this->ShowWindow(SW_HIDE); acedPostCommand(_T("\33")); } } void CRectStairCreateDlg::OnPickStairWidth2() { //梯段宽的处理函数 if (m_bEdit) { double nWidth=_tstof(m_strStairWidth2); BeginEditorCommand(); int nRet=GetDist(_T("\n井宽"), nWidth, RSG_NONEG); CompleteEditorCommand(); if (nRet==RTNORM) { CString temp; temp.Format(_T("%.2f"),nWidth); GetDlgItem(IDC_STAIR_WIDTH2)->SetWindowText(temp); UpdateEdit(IDC_STAIR_WIDTH2,true); } } else { acedGetAcadDwgView()->GetFocus(); CRectStairCreateDlg::m_bStairSpace=TRUE; CRectStairCreateDlg::m_bESCStairWidth=TRUE; this->ShowWindow(SW_HIDE); acedPostCommand(_T("\33")); } } // Add By LCF ON 2004/06/30 void CRectStairCreateDlg::OnSelchangeStairHeightCombo() { } // [9/17/2007 nsh] void CRectStairCreateDlg::OnClose() { if (m_bEdit) { GetDlgItem(IDCANCEL)->SetFocus(); } else { m_bClickClose=TRUE; CRectStairCreateDlg::m_pSelfRSC=NULL; acedPostCommand(_T("\33")); } CBaseStairDlg::OnClose(); } void CRectStairCreateDlg::OnNcDestroy() { if (m_bEdit) return; delete this; } void CRectStairCreateDlg::OnBnClickedPickStairwidth() { if (m_bEdit) { double nStairWidth=_tstof(m_strStairWidth); BeginEditorCommand(); int nRet=GetDist(_T("\n梯段宽度"), nStairWidth, RSG_NOZERO|RSG_NONEG); CompleteEditorCommand(); if (nRet==RTNORM) { if (nStairWidth>(::_tstof(m_strSpaceWidth)/2)) { ::AfxMessageBox(_T("梯段宽太大,请重新输入")); return; } CString temp; temp.Format(_T("%.2f"),nStairWidth); GetDlgItem(IDC_STAIR_WIDTH)->SetWindowText(temp);; UpdateEdit(IDC_STAIR_WIDTH,true); } } else { acedGetAcadDwgView()->GetFocus(); CRectStairCreateDlg::m_bStairSpace=TRUE; CRectStairCreateDlg::m_bESCStepWidth=TRUE; this->ShowWindow(SW_HIDE); acedPostCommand(_T("\33")); } } void CRectStairCreateDlg::OnBnClickedAutorail() { //自动生成边梁 this->UpdateData(); this->UpdateImage(); this->UpdateEdit(IDC_AUTORAIL,true); } void CRectStairCreateDlg::OnBnClickedLeftBeam() { //有左边梁 this->UpdateData(); this->UpdateImage(); this->UpdateEdit(IDC_LEFT_BEAM,true); } void CRectStairCreateDlg::OnBnClickedRightBeam() { // 有右边梁 this->UpdateData(); this->UpdateImage(); this->UpdateEdit(IDC_RIGHT_BEAM,true); } void CRectStairCreateDlg::OnBnClickedOutrail() { //有外边梁 this->UpdateData(); this->UpdateImage(); this->GetDlgItem(IDC_CHECK_OUTRAIL)->EnableWindow(m_bOutRail); this->UpdateEdit(IDC_OUTRAIL,true); } void CRectStairCreateDlg::OnClickOutHandRail() {//外侧栏杆 this->UpdateData(); this->UpdateImage(); this->UpdateEdit(IDC_CHECK_OUTRAIL,false); } void CRectStairCreateDlg::OnBnClickedAsAscent() { BOOL bAsAscent=m_bAsAscent; //作为坡道的处理代码 this->UpdateData(); CDataExchange dxOut(this,false); if (m_bAsAscent==TRUE) { this->GetDlgItem(IDC_HAS_SLANT)->EnableWindow(TRUE); this->GetDlgItem(IDC_ON_GROUND)->EnableWindow(TRUE); //新添加 this->GetDlgItem(IDC_EDIT_SECTNUM2)->ShowWindow(SW_HIDE); this->GetDlgItem(IDC_SPIN_SECTNUM)->ShowWindow(SW_HIDE); this->GetDlgItem(IDC_STATIC_SECT)->ShowWindow(SW_HIDE); this->GetDlgItem(IDC_STATIC_SECTNUM)->ShowWindow(SW_SHOW); this->GetDlgItem(IDC_EDIT_SECTNUM)->ShowWindow(SW_SHOW); //add by xlc on 090527 GetDlgItem(IDC_STAIR_LENGTH)->ShowWindow(SW_SHOW); GetDlgItem(IDC_STAIR_LENGTH_STATIC2)->ShowWindow(SW_SHOW); GetDlgItem(IDC_CHECK_EVA_RADIUS)->ShowWindow(SW_HIDE); m_bSaveCurEvaRadius = m_bEvaRadius; if (m_bEvaRadius) ((CButton*)GetDlgItem(IDC_CHECK_EVA_RADIUS))->SetCheck(FALSE); GetDlgItem(IDC_STATIC_EVA)->ShowWindow(SW_HIDE); GetDlgItem(IDC_RADIO_EVA_SINGLE)->ShowWindow(SW_HIDE); GetDlgItem(IDC_RADIO_EVA_DOUBLE)->ShowWindow(SW_HIDE); GetDlgItem(IDC_STEP_NUM1)->EnableWindow(FALSE); GetDlgItem(IDC_STEP_NUM2)->EnableWindow(FALSE); GetDlgItem(IDC_STEP_NUM1_SPIN)->EnableWindow(FALSE); GetDlgItem(IDC_STEP_NUM2_SPIN)->EnableWindow(FALSE); if (!bAsAscent) { m_strStairLength=Dist2Str(::_tstof(m_strStepWidth)*m_nStepNum1); DDX_Text(&dxOut,IDC_STAIR_LENGTH,m_strStairLength); } } else { this->GetDlgItem(IDC_EDIT_SECTNUM2)->ShowWindow(SW_SHOW); this->GetDlgItem(IDC_SPIN_SECTNUM)->ShowWindow(SW_SHOW); this->GetDlgItem(IDC_STATIC_SECT)->ShowWindow(SW_SHOW); this->GetDlgItem(IDC_STATIC_SECTNUM)->ShowWindow(SW_HIDE); this->GetDlgItem(IDC_EDIT_SECTNUM)->ShowWindow(SW_HIDE); this->GetDlgItem(IDC_HAS_SLANT)->EnableWindow(FALSE); this->GetDlgItem(IDC_ON_GROUND)->EnableWindow(FALSE); //add by xlc on 090527 GetDlgItem(IDC_STAIR_LENGTH)->ShowWindow(SW_HIDE); GetDlgItem(IDC_STAIR_LENGTH_STATIC2)->ShowWindow(SW_HIDE); GetDlgItem(IDC_CHECK_EVA_RADIUS)->ShowWindow(SW_SHOW); if (m_bSaveCurEvaRadius) ((CButton*)GetDlgItem(IDC_CHECK_EVA_RADIUS))->SetCheck(TRUE); GetDlgItem(IDC_STATIC_EVA)->ShowWindow(SW_SHOW); GetDlgItem(IDC_RADIO_EVA_SINGLE)->ShowWindow(SW_SHOW); GetDlgItem(IDC_RADIO_EVA_DOUBLE)->ShowWindow(SW_SHOW); GetDlgItem(IDC_STEP_NUM1)->EnableWindow(TRUE); GetDlgItem(IDC_STEP_NUM2)->EnableWindow(TRUE); GetDlgItem(IDC_STEP_NUM1_SPIN)->EnableWindow(TRUE); GetDlgItem(IDC_STEP_NUM2_SPIN)->EnableWindow(TRUE); } // DDX_Check(&dxOut,IDC_AS_ASCENT,m_bAsAscent); // if (m_bAsAscent) // { // m_dSectStepNum=(m_iSectStepNum-0.5)*::_tstof(m_strStepHeight); // DDX_Text(&dxOut,IDC_EDIT_SECTNUM,m_dSectStepNum); // } // else // { // m_iSectStepNum=(int)(m_dSectStepNum/::_tstof(m_strStepHeight)+0.5); // DDX_Text(&dxOut,IDC_EDIT_SECTNUM2,m_iSectStepNum); // } this->UpdateImage(); // this->UpdateEdit(IDC_AS_ASCENT,true); if (!m_bEdit) { m_bUpdateEdit=TRUE; acedPostCommand(_T("\33")); } } void CRectStairCreateDlg::OnBnClickedSideLeft() {//上楼位置-左边 this->UpdateImage(); this->UpdateData(); UpdateEdit(IDC_SIDE_LEFT,true); } void CRectStairCreateDlg::OnBnClickedSideRight() {//上楼位置-右边 this->UpdateImage(); this->UpdateData(); UpdateEdit(IDC_SIDE_RIGHT,true); } void CRectStairCreateDlg::OnBnClickedOnGround() { this->UpdateData(); this->UpdateImage(); this->UpdateEdit(IDC_ON_GROUND,true); } void CRectStairCreateDlg::OnBnClickedHasSlant() { //加防滑线 this->UpdateData(); this->UpdateImage(); this->UpdateEdit(IDC_HAS_SLANT,true); } void CRectStairCreateDlg::OnBnClickedRadioFirst() { //首层 this->UpdateImage(); this->UpdateData(); this->UpdateEdit(IDC_RADIO_FIRST,true); } void CRectStairCreateDlg::OnBnClickedRadioMid() { //中间层 this->UpdateImage(); this->UpdateData(); this->UpdateEdit(IDC_RADIO_MID,true); } void CRectStairCreateDlg::OnBnClickedRadioTop() { // 顶层 this->UpdateImage(); this->UpdateData(); this->UpdateEdit(IDC_RADIO_TOP,true); } void CRectStairCreateDlg::OnBnClickedAlignFloor() {//齐楼板 this->UpdateData(); this->UpdateEdit(IDC_ALIGN_FLOOR,true); this->UpdateImage(); } void CRectStairCreateDlg::OnBnClickedAlignMid() {//居中 this->UpdateData(); this->UpdateEdit(IDC_ALIGN_MID,true); this->UpdateImage(); } void CRectStairCreateDlg::OnBnClickedAlignSlab() {//齐平台 this->UpdateData(); this->UpdateEdit(IDC_ALIGN_SLAB,true); this->UpdateImage(); } void CRectStairCreateDlg::OnBnClickedAnyIns() {//自由插入 this->UpdateData(); this->UpdateEdit(IDC_RADIO_FREEDOM); this->UpdateImage(); } void CRectStairCreateDlg::OnBnClickedRectPlatform() { this->GetDlgItem(IDC_SLAB_WIDTH)->EnableWindow(TRUE); this->GetDlgItem(IDC_EDIT_SLABWIDTH2)->EnableWindow(TRUE);// [7/29/2008 nsh] this->UpdateData(); this->UpdateImage(); this->UpdateEdit(IDC_RECT_PLATFORM,true); } void CRectStairCreateDlg::OnBnClickedArcPlatform() { this->GetDlgItem(IDC_SLAB_WIDTH)->EnableWindow(TRUE); this->GetDlgItem(IDC_EDIT_SLABWIDTH2)->EnableWindow(TRUE);// [7/29/2008 nsh] this->UpdateData(); this->UpdateImage(); this->UpdateEdit(IDC_ARC_PLATFORM,true); } void CRectStairCreateDlg::OnBnClickedNoPlatform() { HWND hWnd=this->GetSafeHwnd(); this->GetDlgItem(IDC_SLAB_WIDTH)->EnableWindow(FALSE); this->GetDlgItem(IDC_EDIT_SLABWIDTH2)->EnableWindow(FALSE);// [7/29/2008 nsh] this->UpdateData(); this->UpdateImage(); this->UpdateEdit(IDC_NO_PLATFORM,true); } void CRectStairCreateDlg::OnBnClickRailCon() {//扶手是否连接 this->UpdateData(); this->UpdateImage(); this->UpdateEdit(IDC_CHECK_CONNECTION,false); } void CRectStairCreateDlg::OnClickUpdir() { this->UpdateData(); this->UpdateImage(); this->UpdateEdit(IDC_CHECK1,false); } BOOL CRectStairCreateDlg::CheckENChange(UINT ctrlID,const CString pStr) { CString temp; this->GetDlgItemText(ctrlID,temp); if (temp==pStr) { return FALSE; } return TRUE; } double GetMinDouble(const double& Num1,const double& Num2) { if (fabs(Num1-Num2)<=1e-6) { return Num1; } else if (Num1-Num2>1e-6) { return Num2; } else if (Num2-Num1>1e-6) { return Num1; } return 0; } double GetMaxDouble(const double& Num1,const double& Num2) { if (fabs(Num1-Num2)<=1e-6) { return Num1; } else if (Num1-Num2>1e-6) { return Num1; } else if (Num2-Num1>1e-6) { return Num2; } return 0; } void CRectStairCreateDlg::OnBnClickEvaRadius() {//是否有疏散半径 this->UpdateData(); CDataExchange dxOut(this,false); if (m_bEvaRadius==TRUE) { GetDlgItem(IDC_RADIO_EVA_SINGLE)->EnableWindow(TRUE); GetDlgItem(IDC_RADIO_EVA_DOUBLE)->EnableWindow(TRUE); } else { GetDlgItem(IDC_RADIO_EVA_SINGLE)->EnableWindow(FALSE); GetDlgItem(IDC_RADIO_EVA_DOUBLE)->EnableWindow(FALSE); } //有疏散半径时,平台宽度最小为梯间宽的二分之一 double dSlabMinWidth = ::_tstof(m_strSpaceWidth)/2.0; if (_wtof(m_strSlabWidth) < dSlabMinWidth) m_strSlabWidth.Format(_T("%g"), dSlabMinWidth); UpdateData(FALSE); this->UpdateData(); this->UpdateEdit(IDC_CHECK_EVA_RADIUS, false); this->UpdateImage(); } void CRectStairCreateDlg::OnBnClickedRadioSingle() { this->UpdateData(); this->UpdateEdit(IDC_RADIO_EVA_SINGLE, false); this->UpdateImage(); } void CRectStairCreateDlg::OnBnClickedRadioDouble() { this->UpdateData(); this->UpdateEdit(IDC_RADIO_EVA_DOUBLE, false); this->UpdateImage(); }