Files
envi-code/SourceCode/Code2026/tg_shs/shs_TwtKernal/SprinklerSysDlg.cpp
T
gjm 164968b62e chore
把非utf8-bom编码的cpp/h文件改为 utf8 bom 编码, msvc识别utf8编码时,如果不是bom格式的,会使用当前cp_oem来解码.
2026-10-04 00:04:20 +08:00

689 lines
19 KiB
C++

// SprinklerSysDlg.cpp : implementation file
//
#include "stdafx.h"
#include <DbEquipment.h>
#include <xtext.h>
#include <dbPipeValve.h>
#include <DbSymbolAnnotate.h>
#include <PipeWireMonitor.h>
#include "SprinklerSysDlg.h"
#include "DistFloorDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// 喷淋系统
/////////////////////////////////////////////////////////////////////////////
extern CString GetValveLayBySys(TPipeSys::SysType sys);
AcDbObjectId DrawSysPipeByLayer(XPoint ptStart, XPoint ptEnd, const TCHAR* szLayer, int iLevel)
{
if(ptStart == ptEnd)
return NULL;
TPipeSys::SysType sys = GetPipeSysByLayer(szLayer);
TDbPipe *pPipe = new TDbPipe;
if(!g_bStandPipeArc)//传统扣弯
pPipe->SetRadiusIn(-2);
pPipe->SetHideLevel(iLevel);
pPipe->SetStartPoint(ptStart);
pPipe->SetEndPoint(ptEnd);
pPipe->setLayer(szLayer);
pPipe->setLinetype(GetPipeWireLayLineType(szLayer));
pPipe->SetDnDiameter(g_iDefaultPipeDn);
pPipe->SetMaterial(g_iPipeMaterial[GetPipeLayerIdxByName(szLayer)]);
pPipe->SetPipeWeight(g_nPipeWidth[GetPipeLayerIdxByName(szLayer)]);
pPipe->SetSysType(sys);
pPipe->SetRadius(g_nPipeRadius[GetPipeLayerIdxByName(szLayer)]);
pPipe->setColor(AcCmColor()); //随层
pPipe->SetModelType(TPipeSys::kSystem);
AcDbObjectId id = AddToCurrentSpace(pPipe, Adesk::kTrue);
return id;
}
AcDbObjectId DrawPlanPipeByLayer(XPoint ptStart, XPoint ptEnd, const TCHAR* szLayer, int iLevel)
{
TPipeSys::SysType sys = GetPipeSysByLayer(szLayer);
TDbPipe *pPipe = new TDbPipe;
if(!g_bStandPipeArc)//传统扣弯
pPipe->SetRadiusIn(-2);
pPipe->SetHideLevel(iLevel);
pPipe->SetStartPoint(ptStart);
pPipe->SetEndPoint(ptEnd);
pPipe->setLayer(szLayer);
pPipe->setLinetype(GetPipeWireLayLineType(szLayer));
pPipe->SetDnDiameter(g_iDefaultPipeDn);
pPipe->SetMaterial(g_iPipeMaterial[GetPipeLayerIdxByName(szLayer)]);
pPipe->SetPipeWeight(g_nPipeWidth[GetPipeLayerIdxByName(szLayer)]);
pPipe->SetSysType(sys);
pPipe->SetRadius(g_nPipeRadius[GetPipeLayerIdxByName(szLayer)]);
pPipe->setColor(AcCmColor()); //随层
pPipe->SetModelType(TPipeSys::kModel);
AcDbObjectId id = AddToCurrentSpace(pPipe, Adesk::kTrue);
return id;
}
AcDbObjectId InsValveByName(const TCHAR* szName, XPoint pt, const TCHAR* szPipeLay, BOOL bHorizontal)
{
TPipeSys::SysType sys = GetPipeSysByLayer(szPipeLay);
CString csLay = GetValveLayBySys(sys);
InitLayer(csLay);
AcDbObjectId recordId = GetBlkIdByName(szName);
if(!recordId)
return recordId;
double nWidth = GetValveWidth(szName);
TDbPipeValve *pValve = new TDbPipeValve;
pValve->SetBlock2d(recordId);
pValve->SetLocation(pt);
pValve->SetWidth(nWidth);
pValve->SetFlangeDn(nWidth/2);
pValve->setLayer(csLay);
pValve->setColor(AcCmColor()); //随层
pValve->SetSysType(sys);
AcDbObjectId id = AddToCurrentSpace(pValve, Adesk::kTrue);
return id;
}
AcDbObjectId InsValveByName(const TCHAR* szName, XPoint pt, const TCHAR* szPipeLay, XPoint ptPipeS, XPoint ptPipeE)
{
TPipeSys::SysType sys = GetPipeSysByLayer(szPipeLay);
CString csLay = GetValveLayBySys(sys);
InitLayer(csLay);
AcDbObjectId recordId = GetBlkIdByName(szName);
if(!recordId)
return recordId;
XVector3D vectBase(ptPipeE.x - ptPipeS.x, ptPipeE.y - ptPipeS.y, 0);
vectBase.Normalize();
int iQuadrant = 0;
if(vectBase.y < -0.000001
||(vectBase.y<0.000001&&vectBase.y>=-0.000001&&vectBase.x<0)){ //管线逆向绘制
vectBase.x = -vectBase.x;
vectBase.y = -vectBase.y;
iQuadrant = 2;
}
double nWidth = GetValveWidth(szName);
TDbPipeValve *pValve = new TDbPipeValve;
pValve->SetBlock2d(recordId);
pValve->SetDirection(vectBase);
pValve->SetQuadrant(iQuadrant);
pValve->SetLocation(pt);
pValve->SetWidth(nWidth);
pValve->SetFlangeDn(nWidth/2);
pValve->setLayer(csLay);
pValve->setColor(AcCmColor()); //随层
pValve->SetSysType(sys);
AcDbObjectId id = AddToCurrentSpace(pValve, Adesk::kTrue);
return id;
}
AcDbObjectId InsSysSprinkler(const TCHAR* szName, XPoint pt, double nAng)
{
InitLayer(LAY_EQUIP_SPRINKLE);
AcDbObjectId recordId = GetBlkIdByName(szName);
if(!recordId)
return recordId;
TDbEquipment *pEquip = new TDbEquipment;
pEquip->SetBlock2d(recordId);
pEquip->SetLocation(pt);
pEquip->SetScale(g_nSprinklerRadius);
pEquip->SetHidePipe(FALSE);
pEquip->SetAngle(nAng);
pEquip->setLayer(LAY_EQUIP_SPRINKLE);
pEquip->setColor(AcCmColor()); //随层
AcDbObjectId id = AddToCurrentSpace(pEquip, Adesk::kTrue);
return id;
}
AcDbObjectId InsElevation(XPoint pt, const TCHAR* szText, const TCHAR*szLayer, BOOL bRight = TRUE)
{
AcDbObjectId id = InitLayer(LAY_TEXT);
TDbSymbElevation *pElev = new TDbSymbElevation;
pElev->SetLocation(pt);
pElev->SetLayoutRotation(Ucs2Wcs(0.0));
pElev->SetText(szText);
// zxl 2012.07.03 modify
//pElev->SetTextHeight(g_nTwtDimHeight);
pElev->SetTextHeight(g_nEleDimHeight);
pElev->SetBaseLine(FALSE);
pElev->SetLeader(FALSE);
// zxl 2012.07.03 modify
//pElev->SetTextStyleId(InitTwtTextStyle(g_csTwtDimStyle));
pElev->SetTextStyleId(InitTwtTextStyle(g_csEleDimStyle));
pElev->setLayer(pElev->GetDefaultLayer());
pElev->SetTextLayerId(id);
pElev->SetTextBaseLen(pElev->GetDefaultTextBaseLen()*1.1);
pElev->SetTextPoint(pElev->GetDefaultTextLocation());
if(!bRight) //标高标注往左边绘制
{
double dLen = pElev->GetBaseLen();
AcDbIntArray indices;
indices.append(1);
pElev->moveGripPointsAt(indices, AcGeVector3d(-dLen*DocGetPScale(), 0.0, 0.0));
}
AcDbObjectId idRet = pElev->AddToCSpace(Adesk::kTrue);
Entity ent;
ent.GetLast();
WriteXdata(ent, _T("TG-LAYER"), szLayer);
return idRet;
}
void DrawFloorLine(XPoint p1, XPoint p2, const TCHAR*szPipeLayer, const TCHAR*szText, double nHeight, const TCHAR*szSerial=_T(""))
{
InitLayer(LAY_TWT);
InitTwtTextStyle(g_csTwtDimStyle);
XPushVarStr clayer(_T("CLAYER"), LAY_TWT);
//楼板线和字
//zxl 2013.05.27 add
ads_polar(p1, Ucs2Wcs(0.0 - PI), 5*DocGetPScale(), p1);
XLine line(p1, p2, 1);
XPoint ptTmp;
int ret = ptTmp & line;
line.Make();
Entity ent;
ent.GetLast();
WriteXdata(ent, _T("TG-LAYER"), szPipeLayer);
WriteXdata(ent, _T("PIPE-SERIAL"), (const TCHAR*)szSerial);
BOOL bLeft = TRUE;
if(_tcsicmp(szText, _T("")) != 0)
{
XPoint ptText;
ads_polar(p1, PI/2, 50, ptText);
XText text(szText, ptText, g_nTwtDimHeight * DocGetPScale(), g_nDimScale, g_csTwtDimStyle, LAY_TEXT);
text.SetRotate(Ucs2Wcs(0.0));
text.TgDraw(XExplodeDraw::kBottomLeft);
ent.GetLast();
WriteXdata(ent, _T("TG-LAYER"), szPipeLayer);
WriteXdata(ent, _T("PIPE-SERIAL"), (const TCHAR*)szSerial);
}
else
bLeft = FALSE;
if(nHeight < -998)
return;
XPoint ptEle;
CString csEle;
csEle.Format(_T("%.3f"), nHeight);
ads_polar(p1, Ucs2Wcs(0.0), 15*DocGetPScale(), ptEle);
InsElevation(ptEle, csEle, szPipeLayer, bLeft);
ent.GetLast();
WriteXdata(ent, _T("PIPE-SERIAL"), (const TCHAR*)szSerial);
}
void SprinklerSys()
{
CTemporaryResourceOverride vTemp;
CSprinklerSysDlg dlg;
if(dlg.DoModal() != IDOK)
return;
InitLayer(LAY_EQ_SPRINKLE);
InitLayer(LAY_EQUIP_SPRINKLE);
InitPipeLayer(LAY_PIPE_SPRINKLE);
XPoint ptIns, ptStart, ptEnd, ptFloor;
xg_getvar(_T("VIEWCTR"), ptIns);
ptIns = Ucs2Wcs(ptIns);
PickSet ss(SS_FREE);
ss.IncludeBegin();
double nAllHeight = dlg.m_nAllHeight;
double nBraLength = dlg.m_nDist*(dlg.m_iNum+3);
ptStart = ptIns;
ads_polar(ptStart, PI/2*3, dlg.m_nFloorHeight*1000, ptStart);
ads_polar(ptIns, PI/2, nAllHeight, ptEnd);
DrawSysPipeByLayer(ptStart, ptEnd, LAY_PIPE_SPRINKLE);
ptFloor = ptIns;
XPoint ptPtS, ptPtE;
CString csDwb = g_csDwbPath + _T("TwtSys");
XString xsTmp, xsTmp2, xsTmp3, xsTmp4, xsTmp5, xsTmp6, xsTmp7, xsTmp8, xsTmp9, xsTmp10;
if(LoadDwbBlock(csDwb, _T("00000126"), xsTmp) != RTNORM) //干式
return;
if(LoadDwbBlock(csDwb, _T("00000283"), xsTmp2) != RTNORM) //闭式
return;
if(LoadDwbBlock(csDwb, _T("00000130"), xsTmp3) != RTNORM) //侧式
return;
if(LoadDwbBlock(csDwb, _T("00000132"), xsTmp10) != RTNORM) //断线
return;
csDwb = g_csDwbPath + _T("valve");
if(LoadDwbBlock(csDwb, _T("00000437"), xsTmp4) != RTNORM) //遥控信号阀
return;
if(LoadDwbBlock(csDwb, _T("00000531"), xsTmp5) != RTNORM) //流量指示器
return;
if(LoadDwbBlock(csDwb, _T("00000669"), xsTmp6) != RTNORM) //自动排气阀
return;
if(LoadDwbBlock(csDwb, _T("00000497"), xsTmp7) != RTNORM) //截止阀
return;
if(LoadDwbBlock(csDwb, _T("00000667"), xsTmp8) != RTNORM) //末端试水阀
return;
if(LoadDwbBlock(csDwb, _T("00000592"), xsTmp9) != RTNORM) //压力表
return;
ads_polar(ptStart, PI/2, dlg.m_nFloorHeight*1000/2, ptEnd);
InsValveByName((const TCHAR*)xsTmp7, ptEnd, LAY_PIPE_SPRINKLE);
double nCountHeight = dlg.m_nMinEle;
for(int i=0;i<dlg.m_iFloorNum;i++){
ptStart = ptFloor;
ads_polar(ptStart, PI, dlg.m_nFloorHeight*1000, ptStart);
ads_polar(ptFloor, 0, nBraLength-(dlg.m_nFloorHeight*1000), ptEnd);
double nLastHeight(0);
if(i > 0)
nLastHeight = _tstof(dlg.m_lstHeight[i-1]);
nCountHeight += nLastHeight;
//楼板线和字
CString csText = dlg.m_lstName[i];
DrawFloorLine(ptStart, ptEnd, LAY_PIPE_SPRINKLE, csText, nCountHeight);
//干管
XPoint ptPipeS, ptPipeE;
ads_polar(ptFloor, PI/2, dlg.m_nElevation*1000, ptPipeS);
ads_polar(ptPipeS, 0, nBraLength, ptPipeE);
DrawSysPipeByLayer(ptPipeS, ptPipeE, LAY_PIPE_SPRINKLE);
//阀门
XPoint ptValve1, ptValve2, ptValve3, ptValve4;
ads_polar(ptPipeS, 0, dlg.m_nDist, ptValve1);
InsValveByName((const TCHAR*)xsTmp4, ptValve1, LAY_PIPE_SPRINKLE);//遥控信号阀
ads_polar(ptPipeS, 0, dlg.m_nDist*2, ptValve1);
InsValveByName((const TCHAR*)xsTmp5, ptValve1, LAY_PIPE_SPRINKLE);//流量指示器
if(i == dlg.m_iFloorNum-1){
ads_polar(ptPipeS, 0, dlg.m_nDist*(dlg.m_iNum+3), ptPtS);
ads_polar(ptPtS, PI/2*3, dlg.m_nLength, ptValve4);
InsValveByName((const TCHAR*)xsTmp7, ptValve4, LAY_PIPE_SPRINKLE);
ads_polar(ptPtS, PI/2*3, dlg.m_nLength*2, ptPtE);
DrawSysPipeByLayer(ptPtE, ptPtS, LAY_PIPE_SPRINKLE);
InsValveByName((const TCHAR*)xsTmp8, ptPtE, LAY_PIPE_SPRINKLE);
ads_polar(ptPtS, PI/2*3, dlg.m_nLength*1.5, ptPtS);
ads_polar(ptPtS, 0, dlg.m_nLength, ptPtE);
DrawSysPipeByLayer(ptPtS, ptPtE, LAY_PIPE_SPRINKLE);
InsValveByName((const TCHAR*)xsTmp9, ptPtE, LAY_PIPE_SPRINKLE);
}
else{
ads_polar(ptPipeS, 0, dlg.m_nDist*(dlg.m_iNum+2)+dlg.m_nDist/3, ptValve3);//截止阀
InsValveByName((const TCHAR*)xsTmp7, ptValve3, LAY_PIPE_SPRINKLE);
ads_polar(ptPipeS, 0, dlg.m_nDist*(dlg.m_iNum+3), ptValve4);
InsEquipmentByName(xsTmp10, ptValve4, 0, LAY_EQ_SPRINKLE, FALSE, FALSE);
}
//标高
// XPoint ptEle;
// CString csEle;
// double nLastHeight(0);
// if(i > 0)
// nLastHeight = _tstof(dlg.m_lstHeight[i-1]);
// nCountHeight += nLastHeight;
// csEle.Format(_T("%.3f"), nCountHeight);
//
// ads_polar(ptFloor, 0, dlg.m_nDist, ptEle);
// InsElevation(ptEle, csEle, LAY_PIPE_SPRINKLE);
//喷头
for(int j=0;j<dlg.m_iNum;j++){
double nAng(0), nAngPipe(PI/2*3);
CString csTmpBlk;
if(dlg.m_iPos1 == 0){ // 上喷
nAng = PI;
nAngPipe = PI/2;
}
ads_polar(ptPipeS, 0, dlg.m_nDist*(j+3), ptPtS);
ads_polar(ptPtS, nAngPipe, dlg.m_nLength, ptPtE);
DrawSysPipeByLayer(ptPtS, ptPtE, LAY_PIPE_SPRINKLE);
if(dlg.m_iStyle == 3){
ptPtS = ptPtE;
ads_polar(ptPtS, 0, dlg.m_nLength/2, ptPtE);
DrawSysPipeByLayer(ptPtS, ptPtE, LAY_PIPE_SPRINKLE);
nAng = PI/2;
}
if(dlg.m_iStyle == 0)
csTmpBlk = (const TCHAR*)xsTmp;
else if(dlg.m_iStyle == 1)
csTmpBlk = (const TCHAR*)xsTmp2;
else if(dlg.m_iStyle == 2 || dlg.m_iStyle == 3)
csTmpBlk = (const TCHAR*)xsTmp3;
InsSysSprinkler(csTmpBlk, ptPtE, nAng);
if(dlg.m_iStyle == 1 && dlg.m_iPos1 == 2){
ads_polar(ptPipeS, 0, dlg.m_nDist*(j+3), ptPtS);
ads_polar(ptPtS, PI/2, dlg.m_nLength, ptPtE);
DrawSysPipeByLayer(ptPtS, ptPtE, LAY_PIPE_SPRINKLE);
InsSysSprinkler(csTmpBlk, ptPtE, PI);
}
}
//ads_polar(ptFloor, PI/2, dlg.m_nFloorHeight*1000, ptFloor);
ads_polar(ptFloor, PI/2, _tstof(dlg.m_lstHeight[i])*1000, ptFloor);
}
InsValveByName((const TCHAR*)xsTmp6, ptFloor, LAY_PIPE_SPRINKLE, TRUE);
ss.IncludeEnd();
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);
}
/////////////////////////////////////////////////////////////////////////////
// CSprinklerSysDlg dialog
//void HideDialog(CWnd *pWnd, BOOL Flag)
//{
// if (Flag) {
// pWnd->GetParent()->EnableWindow(TRUE);
// pWnd->GetParent()->SetFocus();
// pWnd->GetParent()->SetActiveWindow();
// pWnd->ShowWindow(SW_HIDE);
// }
// else {
// pWnd->GetParent()->EnableWindow(FALSE);
// pWnd->EnableWindow(TRUE);
// pWnd->SetActiveWindow();
// pWnd->ShowWindow(SW_SHOW);
// }
//}
int CSprinklerSysDlg::m_iNum = 8;
int CSprinklerSysDlg::m_iFloorNum = 3;
CSprinklerSysDlg::CSprinklerSysDlg(CWnd* pParent /*=NULL*/)
: CDialog(CSprinklerSysDlg::IDD, pParent), m_spinNum(1), m_spinLength(50), m_spinFloor(1)
{
//{{AFX_DATA_INIT(CSprinklerSysDlg)
m_iStyle = 1;
m_iPos1 = 1;
m_nLength = 250;
m_nFloorHeight = 3;
m_nElevation = 2.2;
m_nDist = 1000;
//}}AFX_DATA_INIT
m_nAllHeight = 0;
m_nMinEle= 0;
}
void CSprinklerSysDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CSprinklerSysDlg)
DDX_Control(pDX, IDC_SPIN_NUM, m_spinNum);
DDX_Control(pDX, IDC_SPIN_LENGTH, m_spinLength);
DDX_Control(pDX, IDC_SPIN_FLOOR, m_spinFloor);
DDX_Radio(pDX, IDC_RADIO_TYPE1, m_iStyle);
DDX_Radio(pDX, IDC_RADIO_POS1, m_iPos1);
DDX_Text(pDX, IDC_EDIT_NUM, m_iNum);
DDX_Text(pDX, IDC_FLOOR_NUM, m_iFloorNum);
DDX_Text(pDX, IDC_EDIT_LENGTH, m_nLength);
DDX_Text(pDX, IDC_EDIT_FOOR_HEIGHT, m_nFloorHeight);
DDX_Text(pDX, IDC_EDIT_ELEVATION, m_nElevation);
DDX_Text(pDX, IDC_EDIT_DIST, m_nDist);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CSprinklerSysDlg, CDialog)
//{{AFX_MSG_MAP(CSprinklerSysDlg)
ON_WM_PAINT()
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_POS1, OnRadioPos1)
ON_BN_CLICKED(IDC_RADIO_POS2, OnRadioPos2)
ON_BN_CLICKED(IDC_RADIO_POS3, OnRadioPos3)
ON_BN_CLICKED(IDC_BUTTON_HEIGHT, OnButtonHeight)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CSprinklerSysDlg message handlers
BOOL CSprinklerSysDlg::OnInitDialog()
{
CDialog::OnInitDialog();
m_spinNum.SetRange(1, 50);
m_spinLength.SetRange(50, 1000);
m_spinFloor.SetRange(1, 50);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CSprinklerSysDlg::OnPaint()
{
CPaintDC dc(this); // device context for painting
OpenSlide();
CWnd *pWnd = GetDlgItem(IDC_STATIC_PREVIEW2);
DrawSlide(_T("TWT(PSXT)"), pWnd);
}
void CSprinklerSysDlg::OpenSlide()
{
CString csSldName;
UpdateData();
if(m_iStyle == 0 && m_iPos1 == 0) //开 上喷
csSldName = _T("TWT(PT3)");
else if(m_iStyle == 0 && m_iPos1 == 1)//开 下喷
csSldName = _T("TWT(PT4)");
else if(m_iStyle == 1 && m_iPos1 == 0)//闭 上喷
csSldName = _T("TWT(PT2)");
else if(m_iStyle == 1 && m_iPos1 == 1)//闭 下喷
csSldName = _T("TWT(PT1)");
else if(m_iStyle == 1 && m_iPos1 == 2)//闭 上下喷
csSldName = _T("TWT(PT5) && m_iPos1 == 1");
else if(m_iStyle == 2) //侧墙 下喷
csSldName = _T("TWT(PT6)");
else if(m_iStyle == 3) //侧墙 下喷
csSldName = _T("TWT(PT7)");
else{
csSldName = _T("");
}
CWnd *pWnd = GetDlgItem(IDC_STATIC_PREVIEW);
DrawSlide((const TCHAR*)csSldName, pWnd);
}
void CSprinklerSysDlg::OnRadioType1()
{
UpdateData();
if(m_iPos1 == 2){
m_iPos1 = 1;
UpdateData(FALSE);
}
OpenSlide();
}
void CSprinklerSysDlg::OnRadioType2()
{
OpenSlide();
}
void CSprinklerSysDlg::OnRadioType3()
{
UpdateData();
m_iPos1 = 1;
UpdateData(FALSE);
OpenSlide();
}
void CSprinklerSysDlg::OnRadioType4()
{
UpdateData();
m_iPos1 = 1;
UpdateData(FALSE);
OpenSlide();
}
void CSprinklerSysDlg::OnRadioPos1()
{
UpdateData();
if(m_iStyle == 2 || m_iStyle == 3){
m_iPos1 = 1;
UpdateData(FALSE);
return;
}
OpenSlide();
}
void CSprinklerSysDlg::OnRadioPos2()
{
OpenSlide();
}
void CSprinklerSysDlg::OnRadioPos3()
{
UpdateData();
if(m_iStyle == 2 || m_iStyle == 3){
m_iPos1 = 1;
UpdateData(FALSE);
return;
}
else if(m_iStyle == 0){
m_iPos1 = 1;
UpdateData(FALSE);
return;
}
OpenSlide();
}
void CSprinklerSysDlg::OnButtonHeight()
{
UpdateData(TRUE);
CTemporaryResourceOverride vTemp;
CDistFloorDlg dlg;
for(int i=0;i<m_iFloorNum;i++){
CString csText, csHeight;
csText.Format(_T("%d楼"), i+1);
dlg.m_lstName.Append(tstrnew(csText));
csHeight.Format(_T("%.2f"), m_nFloorHeight);
dlg.m_lstHeight.Append(tstrnew(csHeight));
}
if(dlg.DoModal() != IDOK)
return;
m_lstHeight.Reset();
m_nMinEle = _tstof(dlg.m_sStartBaseEle);//zxl 2011.10.20 add
m_iFloorNum = dlg.m_lstHeight.Length();
for(i=0;i<m_iFloorNum;i++){
CString csHeight;
csHeight = dlg.m_lstHeight[i];
m_lstHeight.Append(tstrnew(csHeight));
CString csText = dlg.m_lstName[i];
m_lstName.Append(tstrnew(csText));
}
UpdateData(FALSE);
}
void CSprinklerSysDlg::OnOK()
{
UpdateData(TRUE);
CString csText, csHeight;
if(m_lstHeight.Length() < 1){
for(int i=0;i<m_iFloorNum;i++){
csText.Format(_T("%d楼"), i+1);
m_lstName.Append(tstrnew(csText));
csHeight.Format(_T("%.2f"), m_nFloorHeight);
m_lstHeight.Append(tstrnew(csHeight));
}
}
int len = m_iFloorNum - m_lstHeight.Length();
for(int j=0;j<len;j++){
csHeight.Format(_T("%.2f"), m_nFloorHeight);
m_lstHeight.Append(tstrnew(csHeight));
csText.Format(_T("%d楼"), m_lstHeight.Length());
m_lstName.Append(tstrnew(csText));
}
for(int i=0;i<m_iFloorNum;i++){
csText = m_lstHeight[i];
double nHeight = _tstof(csText)*1000;
m_nAllHeight += nHeight;
csText = m_lstName[i];
if(csText.Find(_T("地下")) > -1 || csText.Find(_T("-")) > -1)
m_nMinEle -= _tstof(m_lstHeight[i]);
}
CDialog::OnOK();
}