809 lines
22 KiB
C++
809 lines
22 KiB
C++
// PrincipleDirtDlg.cpp : implementation file
|
|
//
|
|
|
|
#include "stdafx.h"
|
|
|
|
#include <dbPipeValve.h>
|
|
#include <DbSymbolAnnotate.h>
|
|
#include <xtext.h>
|
|
#include <DbEquipment.h>
|
|
#include <PipeWireMonitor.h>
|
|
|
|
#include "PrincipleDirtDlg.h"
|
|
#include "DistFloorDlg.h"
|
|
#include "SanitaryDangDlg.h"
|
|
#include "DangFloorDlg.h"
|
|
|
|
#ifdef _DEBUG
|
|
#define new DEBUG_NEW
|
|
#undef THIS_FILE
|
|
static char THIS_FILE[] = __FILE__;
|
|
#endif
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
// 污水原理
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
extern void DrawFloorLine(XPoint p1, XPoint p2, const TCHAR*szPipeLayer, const TCHAR*szText, double nHeight, const TCHAR*szSerial);
|
|
|
|
void PrincipleDirt()
|
|
{
|
|
CTemporaryResourceOverride vTemp;
|
|
CPrincipleDirtDlg dlg;
|
|
if(dlg.DoModal() != IDOK)
|
|
return;
|
|
CString csLayer;
|
|
if(dlg.m_iType == 0)
|
|
csLayer = LAY_PIPE_DIRT;
|
|
else
|
|
csLayer = LAY_PIPE_USELESS;
|
|
InitPipeLayer(csLayer);
|
|
InitLayer(LAY_EQ_DIRT);
|
|
|
|
XPoint ptIns, ptStart, ptEnd, ptFloor, ptStartAerate, ptEndAerate;
|
|
xg_getvar(_T("VIEWCTR"), ptIns);
|
|
ptIns = Ucs2Wcs(ptIns);
|
|
PickSet ss(SS_FREE);
|
|
CString csDwb = g_csDwbPath + _T("TwtSys");
|
|
XString xsTmp, xsTmp3, xsTmp2;
|
|
if(LoadDwbBlock(csDwb, _T("00000132"), xsTmp) != RTNORM) //断线
|
|
return;
|
|
if(LoadDwbBlock(csDwb, _T("00000148"), xsTmp3) != RTNORM) //检查口
|
|
return;
|
|
if(dlg.m_iCup == 1){
|
|
if(LoadDwbBlock(csDwb, _T("00000388"), xsTmp2) != RTNORM) //通气帽
|
|
return;
|
|
}
|
|
else{
|
|
if(LoadDwbBlock(csDwb, _T("00000133"), xsTmp2) != RTNORM) //钢丝球
|
|
return;
|
|
}
|
|
|
|
ss.IncludeBegin();
|
|
|
|
double nAllHeight = dlg.m_nAllHeight;
|
|
double nBraLength = dlg.m_nFloorLen;
|
|
ptStart = ptIns;
|
|
ads_polar(ptStart, PI/2*3, dlg.m_nHeight*1000, ptStart);
|
|
ads_polar(ptIns, PI/2, nAllHeight+dlg.m_iDist2Floor2, ptEnd);
|
|
CString strAterateType = dlg.m_strWndComboAterateType; // cet 2010.7.5 add
|
|
CString strConnType = dlg.GetConnectType(); // cet 2010.7.5 add
|
|
if (strAterateType.Compare(_T("自循环通气")) == 0) // cet 2010.7.5 add
|
|
{
|
|
ads_polar(ptEnd, PI/2*3, dlg.m_iDist2Floor2 + 800, ptEnd);
|
|
}
|
|
DrawSysPipeByLayer(ptStart, ptEnd, csLayer);
|
|
|
|
// cet 2010.7.6 add 添加扩展数据
|
|
Entity ent;
|
|
ent.GetLast();
|
|
WriteXdata(ent, _T("AterateType"), strAterateType);
|
|
WriteXdata(ent, _T("ConnectType"), strConnType);
|
|
CString strTemp;
|
|
strTemp.Format(_T("%d"), dlg.m_iNum);
|
|
WriteXdata(ent, _T("FloorNum"), strTemp);
|
|
|
|
// cet 2010.7.5 del
|
|
// TDbEquipment *pEquip = new TDbEquipment;
|
|
// pEquip->SetBlock2d(GetBlkIdByName(xsTmp2));
|
|
// pEquip->SetLocation(ptEnd);
|
|
// pEquip->SetHidePipe(TRUE);
|
|
// pEquip->SetDang(0);
|
|
// pEquip->SetPipeLength(0);
|
|
// pEquip->SetSpare(0);
|
|
// pEquip->SetSysBlock((const TCHAR*)xsTmp2);
|
|
// pEquip->setLayer(LAY_EQ_DIRT);
|
|
// pEquip->setColor(AcCmColor()); //随层
|
|
// AddToCurrentSpace(pEquip, Adesk::kTrue);
|
|
|
|
// cet 2010.7.5 add
|
|
if (strAterateType.Compare(_T("自循环通气")) != 0) // cet 2010.7.5 add
|
|
{
|
|
TDbEquipment *pEquip = new TDbEquipment;
|
|
pEquip->SetBlock2d(GetBlkIdByName(xsTmp2));
|
|
pEquip->SetLocation(ptEnd);
|
|
pEquip->SetHidePipe(TRUE);
|
|
pEquip->SetDang(0);
|
|
pEquip->SetPipeLength(0);
|
|
pEquip->SetSpare(0);
|
|
pEquip->SetSysBlock((const TCHAR*)xsTmp2);
|
|
pEquip->setLayer(LAY_EQ_DIRT);
|
|
pEquip->setColor(AcCmColor()); //随层
|
|
AddToCurrentSpace(pEquip, Adesk::kTrue);
|
|
}
|
|
|
|
BOOL bLeft = FALSE;
|
|
double nRotate(0), nRotateAerate(0);
|
|
if(dlg.m_iMode == 0){
|
|
nRotate = 0;
|
|
nRotateAerate = PI;
|
|
}
|
|
else if(dlg.m_iMode == 1){
|
|
nRotate = PI;
|
|
nRotateAerate = 0;
|
|
bLeft = TRUE;
|
|
}
|
|
else if(dlg.m_iMode == 2){
|
|
nRotateAerate = PI;
|
|
nRotate = PI/4;
|
|
}
|
|
else if(dlg.m_iMode == 3){
|
|
nRotateAerate = 0;
|
|
nRotate = PI+PI/4;
|
|
bLeft = TRUE;
|
|
}
|
|
// cet 2010.7.5 del
|
|
// if(dlg.m_bHasAerate){ //绘制通气管
|
|
// {
|
|
// InitPipeLayer(LAY_PIPE_OTHER);
|
|
// ptStartAerate = ptIns;
|
|
// ads_polar(ptStartAerate, nRotateAerate, dlg.m_iDist2Aerate, ptStartAerate);
|
|
// ads_polar(ptStartAerate, PI/2, nAllHeight-1000, ptEndAerate);
|
|
// ads_polar(ptStartAerate, PI/2*3, (dlg.m_nHeight-1)*1000, ptStartAerate);
|
|
// DrawSysPipeByLayer(ptStartAerate, ptEndAerate, LAY_PIPE_OTHER);
|
|
// double nAng = PI/4*3;
|
|
// if(nRotateAerate > 0)
|
|
// nAng = PI/4;
|
|
// XPoint p1, p2;
|
|
// p1 = ptEndAerate;
|
|
// double nDistTmp = sqrt(2.0)*dlg.m_iDist2Aerate;
|
|
// ads_polar(p1, nAng, nDistTmp, p2);
|
|
// DrawSysPipeByLayer(p1, p2, LAY_PIPE_OTHER);
|
|
//
|
|
// nAng = PI/4*3 + PI/2;
|
|
// if(nRotateAerate > 0)
|
|
// nAng = -PI/4;
|
|
// p1 = ptStartAerate;
|
|
// ads_polar(p1, nAng, nDistTmp, p2);
|
|
// DrawSysPipeByLayer(p1, p2, LAY_PIPE_OTHER);
|
|
// }
|
|
|
|
//cet 2010.7.5 add 绘制一小段横杆管
|
|
XPoint ptE;
|
|
if (dlg.m_iMode == 0 || dlg.m_iMode == 2)
|
|
{
|
|
ads_polar(ptStart, 0, dlg.m_nHeight * 1000, ptE);
|
|
}
|
|
else
|
|
{
|
|
ads_polar(ptStart, PI, dlg.m_nHeight * 1000, ptE);
|
|
}
|
|
DrawSysPipeByLayer(ptStart, ptE, csLayer);
|
|
//绘制通气管
|
|
if (strAterateType.Compare(_T("专用通气")) == 0)
|
|
{
|
|
InitPipeLayer(LAY_PIPE_OTHER);
|
|
ptStartAerate = ptIns;
|
|
ads_polar(ptStartAerate, nRotateAerate, dlg.m_iDist2Aerate, ptStartAerate);
|
|
ads_polar(ptStartAerate, PI/2, nAllHeight-1000, ptEndAerate);
|
|
ads_polar(ptStartAerate, PI/2*3, (dlg.m_nHeight-1)*1000, ptStartAerate);
|
|
DrawSysPipeByLayer(ptStartAerate, ptEndAerate, LAY_PIPE_OTHER);
|
|
double nAng = PI/4*3;
|
|
if(nRotateAerate > 0)
|
|
nAng = PI/4;
|
|
XPoint p1, p2;
|
|
p1 = ptEndAerate;
|
|
double nDistTmp = sqrt(2.0)*dlg.m_iDist2Aerate;
|
|
ads_polar(p1, nAng, nDistTmp, p2);
|
|
DrawSysPipeByLayer(p1, p2, LAY_PIPE_OTHER);
|
|
|
|
nAng = PI/4*3 + PI/2;
|
|
if(nRotateAerate > 0)
|
|
nAng = -PI/4;
|
|
p1 = ptStartAerate;
|
|
ads_polar(p1, nAng, nDistTmp, p2);
|
|
DrawSysPipeByLayer(p1, p2, LAY_PIPE_OTHER);
|
|
}
|
|
else if (strAterateType.Compare(_T("自循环通气")) == 0)
|
|
{
|
|
InitPipeLayer(LAY_PIPE_OTHER);
|
|
ptStartAerate = ptIns;
|
|
ads_polar(ptStartAerate, nRotateAerate, dlg.m_iDist2Aerate, ptStartAerate);
|
|
ads_polar(ptStartAerate, PI/2, nAllHeight-800, ptEndAerate);
|
|
ads_polar(ptStart, nRotateAerate, dlg.m_iDist2Aerate, ptStartAerate);
|
|
ads_polar(ptStartAerate, PI/2, 300, ptStartAerate);
|
|
DrawSysPipeByLayer(ptStartAerate, ptEndAerate, LAY_PIPE_OTHER);
|
|
XPoint ptE;
|
|
ads_polar(ptEnd, nRotateAerate, 1, ptE); // 使顶部的白色横管与立管不相交,以保证排水计算时搜索不到白线,标注正确显示
|
|
DrawSysPipeByLayer(ptEndAerate, ptE, LAY_PIPE_OTHER);
|
|
|
|
XPoint pt1 = ptStartAerate, pt2, pt3;
|
|
if (dlg.m_iMode == 0 || dlg.m_iMode == 2)
|
|
{
|
|
ads_polar(pt1, 0, dlg.m_iDist2Aerate + 1000, pt2);
|
|
}
|
|
else
|
|
{
|
|
ads_polar(pt1, PI, dlg.m_iDist2Aerate + 1000, pt2);
|
|
}
|
|
|
|
ads_polar(pt2, PI / 2 * 3, 300, pt3);
|
|
DrawSysPipeByLayer(pt1, pt2, LAY_PIPE_OTHER);
|
|
DrawSysPipeByLayer(pt2, pt3, LAY_PIPE_OTHER);
|
|
}
|
|
|
|
ptFloor = ptIns;
|
|
double nCountHeight = dlg.m_nMinEle;
|
|
for(int i=0;i<dlg.m_iNum+1;i++){
|
|
ptStart = ptFloor;
|
|
if(dlg.m_bFloor){
|
|
//楼板线和字
|
|
ads_polar(ptStart, PI, dlg.m_nHeight*1000, ptStart);
|
|
ads_polar(ptFloor, 0, dlg.m_nFloorLen, ptEnd);
|
|
CString csText;
|
|
if(i == dlg.m_iNum)
|
|
csText = _T("屋面");
|
|
else
|
|
csText = dlg.m_lstName[i];
|
|
double nLastHeight(0);
|
|
if(i > 0)
|
|
nLastHeight = _tstof(dlg.m_lstHeight[i-1]);
|
|
nCountHeight += nLastHeight;
|
|
DrawFloorLine(ptStart, ptEnd, csLayer, csText, nCountHeight,_T(""));
|
|
|
|
}
|
|
if(i == dlg.m_iNum)
|
|
break;
|
|
|
|
//干管
|
|
XPoint ptPipeS, ptPipeE, ptValve, ptClear;
|
|
ads_polar(ptFloor, PI/2, dlg.m_nElevation*1000, ptPipeS);
|
|
ads_polar(ptFloor, PI/2, dlg.m_iDist2Floor, ptClear);
|
|
|
|
|
|
ads_polar(ptPipeS, nRotate, dlg.m_nLen, ptPipeE);
|
|
ads_polar(ptPipeS, nRotate, dlg.m_nLen/2, ptValve);
|
|
|
|
if(bLeft)
|
|
DrawSysPipeByLayer(ptPipeE, ptPipeS, csLayer);
|
|
else
|
|
DrawSysPipeByLayer(ptPipeS, ptPipeE, csLayer);
|
|
|
|
|
|
if((i%dlg.m_iCheck == 0) || (i == dlg.m_iNum-1)){
|
|
if(bLeft)
|
|
InsEquipmentByName((const TCHAR*)xsTmp3, ptClear, PI, LAY_EQ_DIRT, FALSE, FALSE);
|
|
else
|
|
InsEquipmentByName((const TCHAR*)xsTmp3, ptClear, 0, LAY_EQ_DIRT, FALSE, FALSE);
|
|
}
|
|
// cet 2010.7.5 del
|
|
// if((i%(dlg.m_iAerate + 2) == 0) && i != 0){
|
|
//
|
|
// if(dlg.m_bHasAerate)
|
|
// {
|
|
// double nAng = PI/4;
|
|
// if(nRotateAerate > 0)
|
|
// nAng = PI-PI/4;
|
|
// XPoint p1, p2;
|
|
// ads_polar(ptFloor, PI/2, dlg.m_nElevation*2000, p1);
|
|
//
|
|
// double nDistTmp = sqrt(2.0)*dlg.m_iDist2Aerate;
|
|
// ads_polar(p1, nAng, nDistTmp, p2);
|
|
// DrawSysPipeByLayer(p1, p2, LAY_PIPE_OTHER);
|
|
// }
|
|
//
|
|
// }
|
|
|
|
// cet 2010.7.5 add
|
|
if ((strConnType.Compare(_T("结合通气管每层连接")) == 0 && i != 0) ||
|
|
(strConnType.Compare(_T("结合通气管隔层连接")) == 0 && i != 0 && i % 2 == 0)) // 绘制结合通气管
|
|
{
|
|
double nAng = PI/4;
|
|
if(nRotateAerate > 0)
|
|
nAng = PI-PI/4;
|
|
XPoint p1, p2;
|
|
ads_polar(ptFloor, PI/2, dlg.m_nElevation*2000, p1);
|
|
|
|
double nDistTmp = sqrt(2.0)*dlg.m_iDist2Aerate;
|
|
ads_polar(p1, nAng, nDistTmp, p2);
|
|
DrawSysPipeByLayer(p1, p2, LAY_PIPE_OTHER);
|
|
}
|
|
|
|
if ((strConnType.Compare(_T("专用通气形式")) == 0 && i != 0) ||
|
|
(strConnType.Compare(_T("环形通气形式")) == 0 && i != 0 && (i -1) % 3 == 0)) // 绘制结合通气管
|
|
{
|
|
XPoint pt1, pt2;
|
|
pt2 = ptPipeS;
|
|
ads_polar(ptFloor, PI/2, dlg.m_nElevation * 1000 * (1 - 0.2), pt1);
|
|
ads_polar(pt2, PI / 2 *3, 150 , pt2);
|
|
ads_polar(pt1, nRotateAerate, dlg.m_iDist2Aerate, pt1);
|
|
DrawSysPipeByLayer(pt1, pt2, LAY_PIPE_OTHER);
|
|
}
|
|
|
|
if (strConnType.Compare(_T("环形通气形式")) == 0) // 绘制环形通气管
|
|
{
|
|
XPoint ptTL, ptTR, ptB;
|
|
ads_polar(ptFloor, PI / 2, 1500, ptTL);
|
|
ads_polar(ptTL, nRotateAerate, dlg.m_iDist2Aerate, ptTL);
|
|
ads_polar(ptTL, PI - nRotateAerate, dlg.m_iDist2Aerate + dlg.m_nLen * 0.6, ptTR);
|
|
ads_polar(ptPipeS, PI - nRotateAerate, dlg.m_nLen * 0.6, ptB);
|
|
if (dlg.m_iMode == 2 || dlg.m_iMode == 3)
|
|
{
|
|
AcDbLine line1(ptPipeS, ptPipeE);
|
|
AcDbLine line2(ptTR, ptB);
|
|
AcGePoint3dArray arPt;
|
|
line1.intersectWith(&line2, AcDb::kExtendArg, arPt);
|
|
if (arPt.length() == 1)
|
|
{
|
|
ptB = arPt[0];
|
|
}
|
|
}
|
|
DrawSysPipeByLayer(ptTL, ptTR, LAY_PIPE_OTHER);
|
|
DrawSysPipeByLayer(ptTR, ptB, LAY_PIPE_OTHER);
|
|
}
|
|
|
|
InsEquipmentByName(xsTmp, ptPipeE, nRotate, LAY_EQ_DIRT, FALSE, FALSE);
|
|
Entity entLast;
|
|
entLast.GetLast();
|
|
WriteXdata(entLast, _T("TG-LAYER"), csLayer);
|
|
|
|
OPENOBJ_BEGIN(entLast, AcDb::kForWrite, TDbEquipment, pEquipTmp);
|
|
if(pEquipTmp){
|
|
pEquipTmp->SetDang(_tstof(dlg.m_lstDang[i]));
|
|
pEquipTmp->SetSpare(_tstof(dlg.m_lstAllQ[i]));
|
|
pEquipTmp->SetPipeLength(_tstof(dlg.m_lstBigQ[i]));
|
|
}
|
|
OPENOBJ_END();
|
|
|
|
|
|
ads_polar(ptFloor, PI/2, _tstof(dlg.m_lstHeight[i])*1000, ptFloor);
|
|
}
|
|
|
|
ss.IncludeEnd();
|
|
for(long m=0;m<ss.Length();m++){
|
|
Entity entTmp = ss[m];
|
|
OPENOBJ_BEGIN(entTmp, AcDb::kForWrite, TDbPipe, pPipe);
|
|
if(pPipe){
|
|
pPipe->SetMaterial(dlg.m_iMaterial);
|
|
}
|
|
OPENOBJ_END();
|
|
}
|
|
|
|
int nOsMode=0;
|
|
xg_getvar(_T("OSMODE"), &nOsMode);
|
|
nOsMode &= ~0x4000;
|
|
nOsMode |= OS_INT|OS_END|OS_NEA|OS_MID;
|
|
XPushVar<int> vOsMode(_T("OSMODE"), nOsMode);
|
|
|
|
ptIns = Wcs2Ucs(ptIns);
|
|
|
|
ss.Redraw(2);
|
|
actrTransactionManager->flushGraphics(); //acad 刷新
|
|
XPoint xp;
|
|
int nRet = DragMovePickSet(ss, _T("\n请点取系统图位置<退出>: "), ptIns, xp);
|
|
if(nRet != RTNORM){
|
|
ss.Erase();
|
|
// TPipePerDocData *pData = GetCurPipeDocData();
|
|
// pData->EnableWork(FALSE);
|
|
return;
|
|
}
|
|
ss.Redraw(1);
|
|
|
|
|
|
}
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
// CPrincipleDirtDlg dialog
|
|
int CPrincipleDirtDlg::m_iType = 0;
|
|
BOOL CPrincipleDirtDlg::m_bFloor = TRUE;
|
|
double CPrincipleDirtDlg::m_nElevation = -0.25;
|
|
int CPrincipleDirtDlg::m_iNum = 6;
|
|
|
|
CString CPrincipleDirtDlg::m_csMaterial = "";
|
|
|
|
CPrincipleDirtDlg::CPrincipleDirtDlg(CWnd* pParent /*=NULL*/)
|
|
: CDialog(CPrincipleDirtDlg::IDD, pParent), m_spinFloor(1), m_spinCheck(1), m_spinLen(50), m_spinDist2Floor(50), m_spinDist2Floor2(50)
|
|
{
|
|
//{{AFX_DATA_INIT(CPrincipleDirtDlg)
|
|
m_nHeight = 3;
|
|
m_nLen = 400;
|
|
m_nFloorLen = 16000;
|
|
m_iMode = 0;
|
|
m_iDist2Floor = 1000;
|
|
m_iCup = 1;
|
|
m_iDist2Floor2 = 800;
|
|
m_iMaterial = -1;
|
|
m_nNg = 4;
|
|
m_iDist2Aerate = 200;
|
|
m_nBigQ = 1;
|
|
m_nAllQ = 1;
|
|
m_iCheck = 2;
|
|
m_strWndComboAterateType = _T("伸顶通气");
|
|
//}}AFX_DATA_INIT
|
|
m_nAllHeight = 0;
|
|
m_nMinEle= 0;
|
|
|
|
}
|
|
|
|
|
|
void CPrincipleDirtDlg::DoDataExchange(CDataExchange* pDX)
|
|
{
|
|
CDialog::DoDataExchange(pDX);
|
|
//{{AFX_DATA_MAP(CPrincipleDirtDlg)
|
|
DDX_Control(pDX, IDC_COMBO_CONNTYPE, m_wndComboConnType);
|
|
DDX_Control(pDX, IDC_SPIN_CHECK, m_spinCheck);
|
|
DDX_Control(pDX, IDC_COMBO_MATERIAL, m_comboMat);
|
|
DDX_Control(pDX, IDC_SPIN_DIST2FLOOR2, m_spinDist2Floor2);
|
|
DDX_Control(pDX, IDC_SPIN_DIST2FLOOR, m_spinDist2Floor);
|
|
DDX_Control(pDX, IDC_SPIN_LEN, m_spinLen);
|
|
DDX_Control(pDX, IDC_SPIN_FLOOR, m_spinFloor);
|
|
DDX_Text(pDX, IDC_EDIT_FOOR_HEIGHT, m_nHeight);
|
|
DDX_Text(pDX, IDC_FLOOR_LEN, m_nLen);
|
|
DDX_Text(pDX, IDC_FLOOR_LEN2, m_nFloorLen);
|
|
DDX_Radio(pDX, IDC_RADIO_TYPE1, m_iMode);
|
|
DDX_Text(pDX, IDC_EDIT_DIST2FLOOR, m_iDist2Floor);
|
|
DDX_Radio(pDX, IDC_RADIO_CUP1, m_iCup);
|
|
DDX_Text(pDX, IDC_EDIT_DIST2FLOOR2, m_iDist2Floor2);
|
|
DDX_CBIndex(pDX, IDC_COMBO_MATERIAL, m_iMaterial);
|
|
DDX_Text(pDX, IDC_EDIT_DG, m_nNg);
|
|
DDX_Text(pDX, IDC_EDIT_DIST2AERATE, m_iDist2Aerate);
|
|
DDX_Text(pDX, IDC_EDIT_BIGQ, m_nBigQ);
|
|
DDX_Text(pDX, IDC_EDIT_ALLQ, m_nAllQ);
|
|
DDX_Text(pDX, IDC_EDIT_CHECK, m_iCheck);
|
|
DDX_Text(pDX, IDC_EDIT_ELEVATION, m_nElevation);
|
|
DDX_Text(pDX, IDC_FLOOR_NUM, m_iNum);
|
|
DDX_Check(pDX, IDC_CHECK_FLOOR, m_bFloor);
|
|
DDX_CBIndex(pDX, IDC_COMBO_TYPE, m_iType);
|
|
DDX_CBString(pDX, IDC_COMBO_ATERATETYPE, m_strWndComboAterateType);
|
|
//}}AFX_DATA_MAP
|
|
}
|
|
|
|
|
|
BEGIN_MESSAGE_MAP(CPrincipleDirtDlg, CDialog)
|
|
//{{AFX_MSG_MAP(CPrincipleDirtDlg)
|
|
ON_WM_PAINT()
|
|
ON_BN_CLICKED(IDC_BUTTON_HEIGHT, OnButtonHeight)
|
|
ON_BN_CLICKED(IDC_RADIO_TYPE1, OnRadioType1)
|
|
ON_BN_CLICKED(IDC_RADIO_TYPE2, OnRadioType2)
|
|
ON_BN_CLICKED(IDC_RADIO_TYPE3, OnRadioType3)
|
|
ON_BN_CLICKED(IDC_RADIO_TYPE4, OnRadioType4)
|
|
ON_BN_CLICKED(IDC_RADIO_TYPE5, OnRadioType5)
|
|
ON_BN_CLICKED(IDC_BUTTON_NG, OnButtonNg)
|
|
ON_BN_CLICKED(IDC_BUTTON_DANG, OnButtonDang)
|
|
ON_CBN_SELCHANGE(IDC_COMBO_ATERATETYPE, OnSelchangeComboAteratetype)
|
|
//}}AFX_MSG_MAP
|
|
END_MESSAGE_MAP()
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
// CPrincipleDirtDlg message handlers
|
|
BOOL CPrincipleDirtDlg::OnInitDialog()
|
|
{
|
|
CDialog::OnInitDialog();
|
|
|
|
m_spinFloor.SetRange(1, 50);
|
|
m_spinCheck.SetRange(1, 50);
|
|
m_spinLen.SetRange(50, 5000);
|
|
m_spinDist2Floor.SetRange(0, 3000);
|
|
m_spinDist2Floor2.SetRange(0, 3000);
|
|
XStringList lstMat;
|
|
GetPipeMaterialList(lstMat);
|
|
for(int i=0;i<lstMat.Length();i++){
|
|
m_comboMat.AddString(lstMat[i]);
|
|
CString csTmp = lstMat[i];
|
|
if(m_csMaterial == csTmp)
|
|
m_iMaterial = i;
|
|
}
|
|
if(m_iMaterial < 0)
|
|
m_iMaterial = g_iPipeMaterial[3];
|
|
UpdateData(FALSE);
|
|
// OnCheckHasaerate(); // cet 2010.7.5 del
|
|
OnSelchangeComboAteratetype(); // cet 2010.7.5 add
|
|
|
|
return TRUE; // return TRUE unless you set the focus to a control
|
|
// EXCEPTION: OCX Property Pages should return FALSE
|
|
}
|
|
|
|
void CPrincipleDirtDlg::OnPaint()
|
|
{
|
|
CPaintDC dc(this); // device context for painting
|
|
OpenSlide();
|
|
}
|
|
|
|
void CPrincipleDirtDlg::OpenSlide()
|
|
{
|
|
CWnd *pWnd = GetDlgItem(IDC_STATIC_PREVIEW);
|
|
CString csTmp;
|
|
UpdateData(TRUE);
|
|
csTmp.Format(_T("TWT(ZKT%d)"), m_iMode+1);
|
|
DrawSlide(csTmp, pWnd);
|
|
}
|
|
|
|
void CPrincipleDirtDlg::OnButtonHeight()
|
|
{
|
|
UpdateData(TRUE);
|
|
CTemporaryResourceOverride vTemp;
|
|
CDistFloorDlg dlg;
|
|
for(int i=0;i<m_iNum;i++){
|
|
CString csText, csHeight;
|
|
csText.Format(_T("%d楼"), i+1);
|
|
dlg.m_lstName.Append(tstrnew(csText));
|
|
csHeight.Format(_T("%.2f"), m_nHeight);
|
|
dlg.m_lstHeight.Append(tstrnew(csHeight));
|
|
}
|
|
if(dlg.DoModal() != IDOK)
|
|
return;
|
|
|
|
|
|
m_nMinEle = _tstof(dlg.m_sStartBaseEle);//zxl 2011.10.20 add
|
|
|
|
m_lstName.Reset();
|
|
m_lstHeight.Reset();
|
|
|
|
m_iNum = dlg.m_lstHeight.Length();
|
|
for(i=0;i<m_iNum;i++){
|
|
CString csText, csHeight;
|
|
csText = dlg.m_lstName[i];
|
|
csHeight = dlg.m_lstHeight[i];
|
|
m_lstName.Append(tstrnew(csText));
|
|
m_lstHeight.Append(tstrnew(csHeight));
|
|
}
|
|
UpdateData(FALSE);
|
|
}
|
|
|
|
void CPrincipleDirtDlg::OnRadioType1()
|
|
{
|
|
OpenSlide();
|
|
}
|
|
|
|
void CPrincipleDirtDlg::OnRadioType2()
|
|
{
|
|
OpenSlide();
|
|
}
|
|
|
|
void CPrincipleDirtDlg::OnRadioType3()
|
|
{
|
|
OpenSlide();
|
|
}
|
|
|
|
void CPrincipleDirtDlg::OnRadioType4()
|
|
{
|
|
OpenSlide();
|
|
}
|
|
|
|
void CPrincipleDirtDlg::OnRadioType5()
|
|
{
|
|
OpenSlide();
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CPrincipleDirtDlg::OnOK()
|
|
{
|
|
UpdateData(TRUE);
|
|
m_comboMat.GetLBText(m_iMaterial, m_csMaterial);
|
|
CString csText, csHeight;
|
|
if(m_lstHeight.Length() < 1){
|
|
for(int i=0;i<m_iNum;i++){
|
|
csText.Format(_T("%d楼"), i+1);
|
|
m_lstName.Append(tstrnew(csText));
|
|
csHeight.Format(_T("%.2f"), m_nHeight);
|
|
m_lstHeight.Append(tstrnew(csHeight));
|
|
}
|
|
}
|
|
int len = m_iNum - m_lstHeight.Length();
|
|
for(int j=0;j<len;j++){
|
|
csHeight.Format(_T("%.2f"), m_nHeight);
|
|
m_lstHeight.Append(tstrnew(csHeight));
|
|
csText.Format(_T("%d楼"), m_lstHeight.Length());
|
|
m_lstName.Append(tstrnew(csText));
|
|
|
|
}
|
|
for(int i=0;i<m_iNum;i++){
|
|
csText = m_lstHeight[i];
|
|
m_nAllHeight += (_tstof(csText)*1000);
|
|
csText = m_lstName[i];
|
|
//if(csText.Find(_T("地下")) > -1)
|
|
if(csText.Find(_T("地下")) > -1 || csText.Find(_T("-")) > -1)//添加-1F -2F表示楼层 zxl 2011.10.20 add
|
|
m_nMinEle -= _tstof(m_lstHeight[i]);
|
|
}
|
|
//////////
|
|
if(m_lstBigQ.Length() < 1){
|
|
for(int i=0;i<m_iNum;i++){
|
|
csHeight.Format(_T("%.2f"), m_nBigQ);
|
|
m_lstBigQ.Append(tstrnew(csHeight));
|
|
}
|
|
}
|
|
if(m_lstDang.Length() < 1){
|
|
for(int i=0;i<m_iNum;i++){
|
|
csHeight.Format(_T("%.2f"), m_nNg);
|
|
m_lstDang.Append(tstrnew(csHeight));
|
|
}
|
|
}
|
|
if(m_lstAllQ.Length() < 1){
|
|
for(int i=0;i<m_iNum;i++){
|
|
csHeight.Format(_T("%.2f"), m_nAllQ);
|
|
m_lstAllQ.Append(tstrnew(csHeight));
|
|
}
|
|
}
|
|
|
|
// cet 2010.7.5 add
|
|
int nIndex = m_wndComboConnType.GetCurSel();
|
|
if (m_strWndComboAterateType.Compare(_T("伸顶通气")) == 0)
|
|
{
|
|
m_strConnectType = _T("");
|
|
}
|
|
else if (m_strWndComboAterateType.Compare(_T("专用通气")) == 0)
|
|
{
|
|
if (nIndex == 0)
|
|
{
|
|
m_strConnectType = _T("结合通气管每层连接");
|
|
}
|
|
else if (nIndex == 1)
|
|
{
|
|
m_strConnectType = _T("结合通气管隔层连接");
|
|
}
|
|
}
|
|
else if (m_strWndComboAterateType.Compare(_T("自循环通气")) == 0)
|
|
{
|
|
if (nIndex == 0)
|
|
{
|
|
m_strConnectType = _T("专用通气形式");
|
|
}
|
|
else if (nIndex == 1)
|
|
{
|
|
m_strConnectType = _T("环形通气形式");
|
|
}
|
|
}
|
|
|
|
CDialog::OnOK();
|
|
}
|
|
|
|
void CPrincipleDirtDlg::OnButtonNg()
|
|
{
|
|
CTemporaryResourceOverride vTemp;
|
|
CSanitaryDangDlg dlg;
|
|
dlg.m_iMode = 1;
|
|
dlg.m_bMultSel = TRUE;
|
|
if(dlg.DoModal() == IDOK){
|
|
m_nNg = dlg.m_nRet;
|
|
m_nBigQ = dlg.m_nBigQ;
|
|
m_nAllQ = dlg.m_nAllQ;
|
|
UpdateData(FALSE);
|
|
}
|
|
|
|
}
|
|
|
|
void CPrincipleDirtDlg::OnButtonDang()
|
|
{
|
|
UpdateData(TRUE);
|
|
CTemporaryResourceOverride vTemp;
|
|
CDangFloorDlg dlg(1);
|
|
dlg.m_iFloorNum = m_iNum;
|
|
for(int i=0;i<m_iNum;i++){
|
|
CString csHeight;
|
|
csHeight.Format(_T("%.2f"), m_nNg);
|
|
dlg.m_lstDang.Append(tstrnew(csHeight));
|
|
}
|
|
if(dlg.DoModal() != IDOK)
|
|
return;
|
|
|
|
m_lstDang.Reset();
|
|
m_lstBigQ.Reset();
|
|
m_lstAllQ.Reset();
|
|
for(i=0;i<m_iNum;i++){
|
|
CString csDang = dlg.m_lstDang[i];
|
|
CString csAutoClose = dlg.m_lstAutoClose[i];
|
|
CString csAllQ = dlg.m_lstAllQ[i];
|
|
m_lstDang.Append(tstrnew(csDang));
|
|
m_lstBigQ.Append(tstrnew(csAutoClose));
|
|
m_lstAllQ.Append(tstrnew(csAllQ));
|
|
}
|
|
|
|
}
|
|
|
|
// cet 2010.7.5 del
|
|
// void CPrincipleDirtDlg::OnCheckHasaerate()
|
|
// {
|
|
// UpdateData(TRUE);
|
|
// CWnd *pWnd = GetDlgItem(IDC_EDIT_DIST2AERATE);
|
|
// CWnd *pWnd2 = GetDlgItem(IDC_COMBO_AERATE);
|
|
// if(m_bHasAerate)
|
|
// {
|
|
// pWnd->EnableWindow(TRUE);
|
|
// pWnd2->EnableWindow(TRUE);
|
|
// }
|
|
// else
|
|
// {
|
|
// pWnd->EnableWindow(FALSE);
|
|
// pWnd2->EnableWindow(FALSE);
|
|
// }
|
|
// }
|
|
|
|
|
|
void CPrincipleDirtDlg::OnSelchangeComboAteratetype()
|
|
{
|
|
UpdateData(TRUE);
|
|
// 删除下拉列表框中的内容
|
|
int nNum = m_wndComboConnType.GetCount();
|
|
for (int i = nNum - 1; i > -1; i--)
|
|
{
|
|
m_wndComboConnType.DeleteString(i);
|
|
}
|
|
|
|
CWnd *pWnd = NULL, *pWnd2 = NULL, *pWnd3 = NULL, *pWnd4 = NULL;
|
|
pWnd = GetDlgItem(IDC_EDIT_DIST2AERATE);
|
|
pWnd2 = GetDlgItem(IDC_RADIO_CUP1);
|
|
pWnd3 = GetDlgItem(IDC_RADIO_CUP2);
|
|
pWnd4 = GetDlgItem(IDC_EDIT_DIST2FLOOR2);
|
|
|
|
if (m_strWndComboAterateType.Compare(_T("伸顶通气")) == 0)
|
|
{
|
|
m_wndComboConnType.EnableWindow(FALSE);
|
|
if (pWnd != NULL)
|
|
{
|
|
pWnd->EnableWindow(FALSE);
|
|
}
|
|
|
|
if (pWnd2 != NULL)
|
|
{
|
|
pWnd2->EnableWindow(TRUE);
|
|
}
|
|
|
|
if (pWnd3 != NULL)
|
|
{
|
|
pWnd3->EnableWindow(TRUE);
|
|
}
|
|
|
|
if (pWnd4 != NULL)
|
|
{
|
|
pWnd4->EnableWindow(TRUE);
|
|
}
|
|
}
|
|
else if (m_strWndComboAterateType.Compare(_T("专用通气")) == 0)
|
|
{
|
|
m_wndComboConnType.EnableWindow(TRUE);
|
|
if (pWnd != NULL)
|
|
{
|
|
pWnd->EnableWindow(TRUE);
|
|
}
|
|
|
|
if (pWnd2 != NULL)
|
|
{
|
|
pWnd2->EnableWindow(TRUE);
|
|
}
|
|
|
|
if (pWnd3 != NULL)
|
|
{
|
|
pWnd3->EnableWindow(TRUE);
|
|
}
|
|
|
|
if (pWnd4 != NULL)
|
|
{
|
|
pWnd4->EnableWindow(TRUE);
|
|
}
|
|
|
|
m_wndComboConnType.InsertString(0, _T("结合通气管每层连接"));
|
|
m_wndComboConnType.InsertString(1, _T("结合通气管隔层连接"));
|
|
m_wndComboConnType.SetCurSel(0);
|
|
}
|
|
else if (m_strWndComboAterateType.Compare(_T("自循环通气")) == 0)
|
|
{
|
|
m_wndComboConnType.EnableWindow(TRUE);
|
|
if (pWnd != NULL)
|
|
{
|
|
pWnd->EnableWindow(TRUE);
|
|
}
|
|
if (pWnd2 != NULL)
|
|
{
|
|
pWnd2->EnableWindow(FALSE);
|
|
}
|
|
|
|
if (pWnd3 != NULL)
|
|
{
|
|
pWnd3->EnableWindow(FALSE);
|
|
}
|
|
|
|
if (pWnd4 != NULL)
|
|
{
|
|
pWnd4->EnableWindow(FALSE);
|
|
}
|
|
|
|
m_wndComboConnType.InsertString(0, _T("专用通气形式"));
|
|
m_wndComboConnType.InsertString(1, _T("环形通气形式"));
|
|
m_wndComboConnType.SetCurSel(0);
|
|
}
|
|
}
|