2539 lines
58 KiB
C++
2539 lines
58 KiB
C++
#include "stdafx.h"
|
|
#include "DGJMDlg.h"
|
|
#include "KTCADUtilityEx.h"
|
|
#include "GLTKDlg.h"
|
|
#include "UITools.h"
|
|
#include "CGLFJDlg.h"
|
|
#include <algorithm>
|
|
#include "TJZJDlg.h"
|
|
#include "FZGWDlg.h"
|
|
#include "TJDJDlg.h"
|
|
#include "TJDHDlg.h"
|
|
#include "TJDUDlg.h"
|
|
#include "MHQDlg.h"
|
|
#include "JPSGDLG.h"
|
|
#include "FMHDlg.h"
|
|
#include "JKSBDlg.h"
|
|
#include "SDFJDlg.h"
|
|
#include "WSJCDlg.h"
|
|
#include "CSFCDlg.h"
|
|
#include "YWBJDlg.h"
|
|
#include "WDBJDlg.h"
|
|
#include "YYHTDlg.h"
|
|
#include "YQTCDlg.h"
|
|
#include <set>
|
|
#include <functional>
|
|
#include "HZGL_SCFJDlg.h"
|
|
#include "BimInfoDlg.h"
|
|
#include "CGLFJDlg.h"
|
|
#include "AecDbShEarthWorm.h"
|
|
#include "AecDb3dRoadAxisLine.h"
|
|
|
|
extern void SplitStrintToArray(LPCTSTR pszDescr,CStringArray& arInfo,TCHAR tcSpace);
|
|
extern Acad::ErrorStatus AddToModelSpace(AcDbEntity* pEnt,AcDbDatabase* pDb ,bool bClose );
|
|
extern bool analySlabScript(LPCTSTR script
|
|
, int &idxRoom // 舱室
|
|
, int &type // 类型(横/竖)
|
|
, double &dist // 距舱室 底部/左侧 距离
|
|
, double &width // 板宽/板高
|
|
, double &x // ptOff-x
|
|
, double &y // ptOff-y
|
|
);
|
|
extern bool getSubRoomInfo(LPCTSTR key, int &idxRoom, double &x, double &y);
|
|
extern bool findKeysBySlab(CMapStringToString &mfcMap, ERoom &room, LPCTSTR slabScript, CString &key1, CString &key2);
|
|
extern bool hasAddin(const int &idx, LPCTSTR addinType, const CMapStringToString &mapAddtion);
|
|
extern void removeAddin(const int &idx, LPCTSTR addinType, CMapStringToString &mapAddtion);
|
|
|
|
void FreeBuffer(AcDbVoidPtrArray& arTextPtrs)
|
|
{
|
|
AcDbEntity* pEnt = NULL;
|
|
while (arTextPtrs.length() > 0)
|
|
{
|
|
pEnt = (AcDbEntity*)arTextPtrs.first();
|
|
arTextPtrs.removeFirst();
|
|
DELETE_PTR(pEnt);
|
|
}
|
|
arTextPtrs.removeAll();
|
|
}
|
|
|
|
|
|
IMPLEMENT_DYNAMIC(CDGJMDlg, CDialog)
|
|
|
|
CDGJMDlg::CDGJMDlg(CWnd* pParent /*=NULL*/)
|
|
: CDialog(CDGJMDlg::IDD, pParent)
|
|
, m_dYXLen(80.0)
|
|
, m_dT1(400.0)
|
|
, m_dT2(400.0)
|
|
, m_dT4(400.0)
|
|
, m_dT5(400.0)
|
|
, m_sRoomName(_T("电力舱"))
|
|
, m_bShowAddtion3d(TRUE)
|
|
, m_bBHShortDraw(TRUE)
|
|
{
|
|
m_curSection.pReg = NULL;
|
|
m_curSection.pt.set(0,0,0);
|
|
m_sCrossSectionScr = _T("");
|
|
m_bIsYXGLJD = false;
|
|
|
|
m_curSection.dThick[0] = m_dT1;
|
|
m_curSection.dThick[1] = m_dT2;
|
|
m_curSection.dThick[2] = m_dT4;
|
|
m_curSection.dThick[3] = m_dT5;
|
|
|
|
m_pRegionRoom = NULL;
|
|
m_sAddtionScr = _T("");
|
|
}
|
|
|
|
CDGJMDlg::~CDGJMDlg()
|
|
{
|
|
}
|
|
|
|
void CDGJMDlg::DoDataExchange(CDataExchange* pDX)
|
|
{
|
|
CDialog::DoDataExchange(pDX);
|
|
|
|
DDX_Control(pDX, IDC_BTADDROOM2, m_wndButton2);
|
|
DDX_Control(pDX, IDC_BTADDROOM3, m_wndButton3);
|
|
DDX_Control(pDX, IDC_BTADDROOM4, m_wndButton4);
|
|
DDX_Control(pDX, IDC_BTADDROOM5, m_wndButton5);
|
|
DDX_Control(pDX, IDC_BTADDROOM6, m_wndButton6);
|
|
DDX_Control(pDX, IDC_BTADDROOM7, m_wndButton7);
|
|
DDX_Control(pDX, IDC_BTADDROOM8, m_wndButton8);
|
|
DDX_Control(pDX, IDC_BTADDROOM9, m_wndButton9);
|
|
DDX_Control(pDX, IDC_BTADDROOM10, m_wndButton10);
|
|
DDX_Control(pDX, IDC_BTADDROOM11, m_wndButton11);
|
|
|
|
DDX_Control(pDX, IDC_BUTTON6, m_wndButton12);
|
|
DDX_Control(pDX, IDC_BUTTON5, m_wndButton13);
|
|
DDX_Control(pDX, IDC_BUTTON3, m_wndButton14);
|
|
|
|
DDX_Control(pDX, IDC_BUTTON19, m_wndButton19);
|
|
DDX_Control(pDX, IDC_BUTTON74, m_wndButton74);
|
|
DDX_Control(pDX, IDC_BUTTON11, m_wndButtonCo11);
|
|
DDX_Control(pDX, IDC_BUTTON81, m_wndButton81);
|
|
|
|
DDX_Text(pDX, IDC_EDITYX, m_dYXLen);
|
|
DDX_Text(pDX, IDC_EDITT1, m_dT1);
|
|
DDX_Text(pDX, IDC_EDITT2, m_dT2);
|
|
DDX_Text(pDX, IDC_EDITT3, m_dT4);
|
|
DDX_Text(pDX, IDC_EDITT4, m_dT5);
|
|
DDX_Control(pDX, IDC_COMBO4, m_wndCombo4);
|
|
DDX_Text(pDX, IDC_EDIT24, m_sRoomName);
|
|
DDX_Control(pDX, IDC_EDIT24, m_wndEditName);
|
|
|
|
DDX_CBString(pDX, IDC_COMBO1, m_sCity);
|
|
DDX_CBString(pDX, IDC_COMBO2, m_sRoad);
|
|
DDX_Check(pDX, IDC_CHECK1, m_bShowAddtion3d);
|
|
DDX_Check(pDX, IDC_CHECK3, m_bBHShortDraw);
|
|
}
|
|
|
|
BEGIN_MESSAGE_MAP(CDGJMDlg, CDialog)
|
|
ON_BN_CLICKED(IDOK, &CDGJMDlg::OnBnClickedOk)
|
|
ON_BN_CLICKED(IDC_BUTTON1, &CDGJMDlg::OnBnClickedButton1)
|
|
ON_BN_CLICKED(IDC_BTADDTODB, &CDGJMDlg::OnBnClickedBtaddtodb)
|
|
ON_BN_CLICKED(IDC_BTSELFROMDB, &CDGJMDlg::OnBnClickedBtselfromdb)
|
|
ON_BN_CLICKED(IDC_BUTTON4, &CDGJMDlg::OnBnClickedButton4)
|
|
ON_BN_CLICKED(IDC_BUTTON13, &CDGJMDlg::OnBnClickedButton13)
|
|
ON_BN_CLICKED(IDC_BUTTON17, &CDGJMDlg::OnBnClickedButton17)
|
|
ON_BN_CLICKED(IDC_BUTTON56, &CDGJMDlg::OnBnClickedButton56)
|
|
ON_WM_DESTROY()
|
|
ON_BN_CLICKED(IDC_BTADDROOM2, &CDGJMDlg::OnBnClickedBtaddroom2)
|
|
ON_BN_CLICKED(IDC_BTADDROOM3, &CDGJMDlg::OnBnClickedBtaddroom3)
|
|
ON_BN_CLICKED(IDC_BTADDROOM4, &CDGJMDlg::OnBnClickedBtaddroom4)
|
|
ON_BN_CLICKED(IDC_BTADDROOM5, &CDGJMDlg::OnBnClickedBtaddroom5)
|
|
ON_MESSAGE(WM_VIEW_LBUTTONDOWN, &CDGJMDlg::OnViewLButtonDown)
|
|
ON_CBN_SELCHANGE(IDC_COMBO4, &CDGJMDlg::OnCbnSelchangeCombo4)
|
|
ON_EN_CHANGE(IDC_EDIT24, &CDGJMDlg::OnEnChangeEdit24)
|
|
ON_BN_CLICKED(IDC_BTADDROOM6, &CDGJMDlg::OnBnClickedBtaddroom6)
|
|
ON_BN_CLICKED(IDC_BTADDROOM9, &CDGJMDlg::OnBnClickedBtaddroom9)
|
|
ON_BN_CLICKED(IDC_BTADDROOM8, &CDGJMDlg::OnBnClickedBtaddroom8)
|
|
ON_BN_CLICKED(IDC_BTADDROOM10, &CDGJMDlg::OnBnClickedBtaddroom10)
|
|
ON_BN_CLICKED(IDC_BTADDROOM7, &CDGJMDlg::OnBnClickedBtaddroom7)
|
|
ON_BN_CLICKED(IDC_BTADDROOM11, &CDGJMDlg::OnBnClickedBtaddroom11)
|
|
ON_BN_CLICKED(IDC_BUTTON6, &CDGJMDlg::OnBnClickedButton6)
|
|
ON_BN_CLICKED(IDC_BUTTON19, &CDGJMDlg::OnBnClickedButton19)
|
|
ON_BN_CLICKED(IDC_BUTTON74, &CDGJMDlg::OnBnClickedButton74)
|
|
ON_BN_CLICKED(IDC_BUTTON11, &CDGJMDlg::OnBnClickedButton11)
|
|
ON_BN_CLICKED(IDC_BUTTON81, &CDGJMDlg::OnBnClickedButton81)
|
|
ON_BN_CLICKED(IDC_BUTTON3, &CDGJMDlg::OnBnClickedButton3)
|
|
END_MESSAGE_MAP()
|
|
|
|
BOOL CDGJMDlg::OnInitDialog()
|
|
{
|
|
CDialog::OnInitDialog();
|
|
|
|
// 子类化控件对象
|
|
if (!m_wndViewCtrl.SubclassDlgItem(IDC_STATIC_FRM, this))
|
|
{
|
|
return FALSE;
|
|
}
|
|
|
|
//各种添加按钮图标化
|
|
CBitmap bmp32;
|
|
if (!bmp32.LoadBitmap(IDB_BITMAP10))
|
|
{
|
|
AfxMessageBox(_T("Can't load bitmap: %x\n"), IDB_BITMAP32);
|
|
ASSERT(FALSE);
|
|
return FALSE;
|
|
}
|
|
|
|
//附属物界面
|
|
BITMAP bmpObj32;
|
|
bmp32.GetBitmap(&bmpObj32);
|
|
UINT nFlags = ILC_COLOR24 | ILC_MASK;
|
|
m_Imagelist32.Create(32, bmpObj32.bmHeight, nFlags, 0, 0);
|
|
m_Imagelist32.Add(&bmp32, RGB(255, 0, 0));
|
|
|
|
m_wndButton2.SetIcon(m_Imagelist32.ExtractIcon(0));
|
|
m_wndButton3.SetIcon(m_Imagelist32.ExtractIcon(2));
|
|
m_wndButton4.SetIcon(m_Imagelist32.ExtractIcon(1));
|
|
m_wndButton5.SetIcon(m_Imagelist32.ExtractIcon(3));
|
|
m_wndButton6.SetIcon(m_Imagelist32.ExtractIcon(4));
|
|
m_wndButton9.SetIcon(m_Imagelist32.ExtractIcon(5));
|
|
m_wndButton8.SetIcon(m_Imagelist32.ExtractIcon(6));
|
|
m_wndButton7.SetIcon(m_Imagelist32.ExtractIcon(8));
|
|
m_wndButton10.SetIcon(m_Imagelist32.ExtractIcon(7));
|
|
m_wndButton11.SetIcon(m_Imagelist32.ExtractIcon(9));
|
|
m_wndButton12.SetIcon(m_Imagelist32.ExtractIcon(10));
|
|
m_wndButton13.SetIcon(m_Imagelist32.ExtractIcon(11));
|
|
m_wndButton14.SetIcon(m_Imagelist32.ExtractIcon(12));
|
|
|
|
m_wndButton19.SetIcon(m_Imagelist32.ExtractIcon(13));
|
|
m_wndButton74.SetIcon(m_Imagelist32.ExtractIcon(14));
|
|
m_wndButtonCo11.SetIcon(m_Imagelist32.ExtractIcon(15));
|
|
m_wndButton81.SetIcon(m_Imagelist32.ExtractIcon(16));
|
|
|
|
if (!m_bIsYXGLJD)
|
|
{
|
|
GetDlgItem(IDC_STATIC_YX)->ShowWindow(SW_HIDE);
|
|
GetDlgItem(IDC_EDITYX)->ShowWindow(SW_HIDE);
|
|
GetDlgItem(IDC_STATIC_YXM)->ShowWindow(SW_HIDE);
|
|
}
|
|
|
|
if (m_sAddtionScr.IsEmpty() || m_curSection.pReg == NULL)
|
|
{
|
|
ShowLastSection();
|
|
}
|
|
else
|
|
{
|
|
ExtractRegionRooms();
|
|
ExtrAddtionToMap();
|
|
|
|
ShowEwSection();
|
|
|
|
//3.显示附件
|
|
ShowAddtion();
|
|
|
|
//2.显示舱室名称
|
|
ShowRoomName();
|
|
}
|
|
return TRUE;
|
|
}
|
|
|
|
STSection* CDGJMDlg::GetSTSection()
|
|
{
|
|
m_curSection.sAddtionScr = m_sAddtionScr;
|
|
return &m_curSection;
|
|
}
|
|
|
|
void CDGJMDlg::SetSTSection(STSection* pSection)
|
|
{
|
|
if (pSection != NULL)
|
|
{
|
|
m_curSection.dThick[0] = pSection->dThick[0];
|
|
m_curSection.dThick[1] = pSection->dThick[1];
|
|
m_curSection.dThick[2] = pSection->dThick[2];
|
|
m_curSection.dThick[3] = pSection->dThick[3];
|
|
m_curSection.sAddtionScr = pSection->sAddtionScr;
|
|
|
|
if (pSection->pReg != NULL)
|
|
{
|
|
m_curSection.pReg = (AcDbRegion*)pSection->pReg->clone();
|
|
}
|
|
m_sAddtionScr = pSection->sAddtionScr;
|
|
}
|
|
}
|
|
|
|
AecDbObjXDataMap* CDGJMDlg::GetSpecMapData( )
|
|
{
|
|
return &m_mapSpecXData;
|
|
}
|
|
|
|
void CDGJMDlg::SetInplaceEdit(bool bInput)
|
|
{
|
|
m_bIsYXGLJD = bInput;
|
|
}
|
|
|
|
void CDGJMDlg::SetCrossSectionScr(LPCTSTR pszCrossSectionScr,const AcGePoint3d& pt)
|
|
{
|
|
m_curSection.pt = pt;
|
|
m_sCrossSectionScr = pszCrossSectionScr;
|
|
m_curSection.pReg = NULL;
|
|
|
|
int nPos = m_sCrossSectionScr.Find(_T("<ELAGN:") );
|
|
CString sX,sY;
|
|
CString sPt = m_sCrossSectionScr.Mid(nPos);
|
|
sPt.TrimLeft(_T("<ELAGN:"));
|
|
sPt.TrimRight(_T(">"));
|
|
nPos = sPt.Find(_T(','));
|
|
if (nPos != -1)
|
|
{
|
|
CStringArray arInfo;
|
|
SplitStrintToArray(sPt,arInfo,_T(','));
|
|
|
|
if (arInfo.GetSize() >= 2)
|
|
{
|
|
sX = arInfo.GetAt(0);
|
|
sY = arInfo.GetAt(1);
|
|
m_curSection.pt.set(_ttof(sX),_ttof(sY),0.0);
|
|
|
|
if (arInfo.GetSize() >= 6)
|
|
{
|
|
m_curSection.dThick[0] = _ttof(arInfo.GetAt(2));
|
|
m_curSection.dThick[1] = _ttof(arInfo.GetAt(3));
|
|
m_curSection.dThick[2] = _ttof(arInfo.GetAt(4));
|
|
m_curSection.dThick[3] = _ttof(arInfo.GetAt(5));
|
|
}
|
|
}
|
|
}
|
|
|
|
CString sFullPath = FilePath::GetSysDir();
|
|
sFullPath.MakeLower();
|
|
sFullPath += _T("\\DGJM.sat");
|
|
|
|
CStdioFile file;
|
|
if (file.Open(sFullPath,CFile::modeCreate |CFile::modeWrite ))
|
|
{
|
|
CString sScr = m_sCrossSectionScr;
|
|
if (nPos != -1)
|
|
{
|
|
sScr = m_sCrossSectionScr.Mid(0,nPos);
|
|
}
|
|
file.WriteString(sScr);
|
|
file.Close();
|
|
}
|
|
}
|
|
|
|
void CDGJMDlg::SetAddtionScr(LPCTSTR pszAddtionScr)
|
|
{
|
|
m_sAddtionScr = pszAddtionScr;
|
|
|
|
//m_sAddtionScr-->m_mapAddtion;
|
|
m_mapAddtion.RemoveAll();
|
|
ExtrAddtionToMap();
|
|
}
|
|
|
|
void CDGJMDlg::GetAddtionScr(CString& sScr) const
|
|
{
|
|
sScr = m_sAddtionScr;
|
|
}
|
|
|
|
void CDGJMDlg::ExtrAddtionToMap( )
|
|
{
|
|
m_mapAddtion.RemoveAll();
|
|
int nPos = m_sAddtionScr.Find(_T("EXT:"));
|
|
if (nPos != -1)
|
|
{
|
|
//EXT:
|
|
if (nPos + 4 < m_sAddtionScr.GetLength() )
|
|
{
|
|
CString sName;
|
|
CString sExt = m_sAddtionScr.Mid(nPos + 4);
|
|
//<><><><><><>.....
|
|
CString sScript,sScriptT,sScript2,sScriptNewVer;
|
|
CString sKey,sOld;
|
|
|
|
int nSta = 0,nPos2 = 0,nRoomIndex = 0,nLRPos = 0,nNo = 1;
|
|
nPos = sExt.Find(_T('<'),nSta);
|
|
while(nPos != -1)
|
|
{
|
|
nPos2 = sExt.Find(_T('>'),nPos + 1);
|
|
if (nPos2 == -1)
|
|
break;
|
|
|
|
//..<***>...
|
|
sScript = sExt.Mid(nPos + 1,nPos2 - nPos - 1);
|
|
|
|
if (sScript.Find( EW_HOLDER ) != -1)
|
|
{
|
|
//HOLDER:房间|左右位置|层数|垂直间隙|水平间隙|距顶D|长度|宽度|厚度|材料|用途|偏移=(,,,)|编号
|
|
sScriptT = sScript;
|
|
sScriptT.TrimLeft(EW_HOLDER);
|
|
sScriptT.TrimLeft(_T(':'));
|
|
|
|
CStringArray arInf;
|
|
SplitStrintToArray(sScriptT,arInf,_T('|'));
|
|
|
|
if (arInf.GetSize() >= 12)
|
|
{
|
|
nRoomIndex = _ttoi(arInf.GetAt(0));
|
|
nLRPos = _ttoi(arInf.GetAt(1));
|
|
|
|
if (arInf.GetSize() > 12)
|
|
{
|
|
nNo = _ttoi(arInf.GetAt(12));
|
|
}
|
|
else//旧版本
|
|
{
|
|
static int nNum = 1;
|
|
nNo = nNum++;
|
|
|
|
sOld.Format(_T("|%d"),nNo);
|
|
sScriptNewVer =sScript + sOld;
|
|
m_sAddtionScr.Replace(sScript,sScriptNewVer);
|
|
sScript = sScriptNewVer;
|
|
}
|
|
|
|
sKey.Format(_T("%d-%d-%d-HOLDER"),nRoomIndex,nLRPos,nNo);
|
|
|
|
sScript2.Format(_T("<%s>"),sScript);
|
|
m_mapAddtion.SetAt(sKey,sScript2);
|
|
}
|
|
}
|
|
else if (sScript.Find(EW_BOSS) != -1)
|
|
{
|
|
//<BOSS:房间|左右位置|侧间隙|水平间隙|宽|高|长|直径|用途>
|
|
sScriptT = sScript;
|
|
sScriptT.TrimLeft(EW_BOSS);
|
|
sScriptT.TrimLeft(_T(':'));
|
|
|
|
CStringArray arInf;
|
|
SplitStrintToArray(sScriptT,arInf,_T('|'));
|
|
|
|
if (arInf.GetSize() >= 9)
|
|
{
|
|
nRoomIndex = _ttoi(arInf.GetAt(0));
|
|
if (arInf.GetSize() > 16)
|
|
nLRPos = _ttoi(arInf.GetAt(16));
|
|
|
|
sKey.Format(_T("%d-%d-BOSS"),nRoomIndex,nLRPos);
|
|
|
|
sScript2.Format(_T("<%s>"),sScript);
|
|
m_mapAddtion.SetAt(sKey,sScript2);
|
|
}
|
|
}
|
|
else if (sScript.Find( EW_HANGER ) != -1)
|
|
{
|
|
//HANGER:房间|层数|垂直间隙|水平间隙|左侧距离|距顶D|长度|宽度|厚度|材料|用途|偏移(,,,)
|
|
sScriptT = sScript;
|
|
sScriptT.TrimLeft(EW_HANGER);
|
|
sScriptT.TrimLeft(_T(':'));
|
|
|
|
CStringArray arInf;
|
|
SplitStrintToArray(sScriptT,arInf,_T('|'));
|
|
|
|
if (arInf.GetSize() >= 13)
|
|
{
|
|
nNo = _ttoi(arInf.GetAt(12));
|
|
}
|
|
else//旧版本
|
|
{
|
|
static int nNum = 1;
|
|
nNo = nNum++;
|
|
|
|
sOld.Format(_T("|%d"), nNo);
|
|
sScriptNewVer = sScript + sOld;
|
|
m_sAddtionScr.Replace(sScript, sScriptNewVer);
|
|
sScript = sScriptNewVer;
|
|
}
|
|
|
|
if (arInf.GetSize() >= 11)
|
|
{
|
|
nRoomIndex = _ttoi(arInf.GetAt(0));
|
|
sKey.Format(_T("%d-%d-%d-HANGER"),nRoomIndex,0, nNo);
|
|
|
|
sScript2.Format(_T("<%s>"),sScript);
|
|
m_mapAddtion.SetAt(sKey,sScript2);
|
|
}
|
|
}
|
|
else if (sScript.Find(EW_RINGS) != -1)
|
|
{
|
|
//RINGS:房间|半径|长度|位置|材料|用途
|
|
sScriptT = sScript;
|
|
sScriptT.TrimLeft(EW_RINGS);
|
|
sScriptT.TrimLeft(_T(':'));
|
|
|
|
CStringArray arInf;
|
|
SplitStrintToArray(sScriptT,arInf,_T('|'));
|
|
|
|
if (arInf.GetSize() >= 9)
|
|
{
|
|
nNo = _ttoi(arInf.GetAt(8));
|
|
}
|
|
else//旧版本
|
|
{
|
|
static int nNum = 1;
|
|
nNo = nNum++;
|
|
|
|
sOld.Format(_T("|%d"), nNo);
|
|
sScriptNewVer = sScript + sOld;
|
|
m_sAddtionScr.Replace(sScript, sScriptNewVer);
|
|
sScript = sScriptNewVer;
|
|
}
|
|
|
|
if (arInf.GetSize() >= 7)
|
|
{
|
|
nRoomIndex = _ttoi(arInf.GetAt(0));
|
|
|
|
sKey.Format(_T("%d-%d-%d-RINGS"),nRoomIndex,0, nNo);
|
|
|
|
sScript2.Format(_T("<%s>"),sScript);
|
|
m_mapAddtion.SetAt(sKey,sScript2);
|
|
}
|
|
}
|
|
else if (sScript.Find(EW_LAMPS) != -1)
|
|
{
|
|
//LAMPS:房间|长度|宽度|厚度|左侧定位|纵向间距|瓦数|名称|型好|厂家
|
|
sScriptT = sScript;
|
|
sScriptT.TrimLeft(EW_LAMPS);
|
|
sScriptT.TrimLeft(_T(':'));
|
|
|
|
CStringArray arInf;
|
|
SplitStrintToArray(sScriptT, arInf, _T('|'));
|
|
|
|
if (arInf.GetSize() >= 12)
|
|
{
|
|
nNo = _ttoi(arInf.GetAt(11));
|
|
}
|
|
else//旧版本
|
|
{
|
|
static int nNum = 1;
|
|
nNo = nNum++;
|
|
|
|
sOld.Format(_T("|%d"), nNo);
|
|
sScriptNewVer = sScript + sOld;
|
|
m_sAddtionScr.Replace(sScript, sScriptNewVer);
|
|
sScript = sScriptNewVer;
|
|
}
|
|
|
|
if (arInf.GetSize() >= 10)
|
|
{
|
|
nRoomIndex = _ttoi(arInf.GetAt(0));
|
|
|
|
sKey.Format(_T("%d-%d-%d-LAMPS"), nRoomIndex, 0, nNo);
|
|
|
|
sScript2.Format(_T("<%s>"),sScript);
|
|
m_mapAddtion.SetAt(sKey,sScript2);
|
|
}
|
|
}
|
|
else if (sScript.Find(EW_FIREET) != -1)
|
|
{
|
|
|
|
//FIREET:房间|安装方式|安装位置|X直径L|Y直径H|上间隙TSP|下间隙DSP|填充量|工作温度|性能|型号|名称|类别|厂家
|
|
sScriptT = sScript;
|
|
sScriptT.TrimLeft(EW_FIREET);
|
|
sScriptT.TrimLeft(_T(':'));
|
|
|
|
CStringArray arInf;
|
|
SplitStrintToArray(sScriptT, arInf, _T('|'));
|
|
|
|
if (arInf.GetSize() >= 16)
|
|
{
|
|
nNo = _ttoi(arInf.GetAt(15));
|
|
}
|
|
else//旧版本
|
|
{
|
|
static int nNum = 1;
|
|
nNo = nNum++;
|
|
|
|
sOld.Format(_T("|%d"), nNo);
|
|
sScriptNewVer = sScript + sOld;
|
|
m_sAddtionScr.Replace(sScript, sScriptNewVer);
|
|
sScript = sScriptNewVer;
|
|
}
|
|
|
|
if (arInf.GetSize() >= 13)
|
|
{
|
|
nRoomIndex = _ttoi(arInf.GetAt(0));
|
|
int nSetup = _ttoi(arInf.GetAt(1));
|
|
int nHSetup = _ttoi(arInf.GetAt(2));
|
|
|
|
CString sTemp;
|
|
sTemp.Format(_T("1%d%d"),nSetup,nHSetup);
|
|
|
|
sKey.Format(_T("%d-%s-%d-FIREET"), nRoomIndex, sTemp, nNo);
|
|
|
|
sScript2.Format(_T("<%s>"),sScript);
|
|
m_mapAddtion.SetAt(sKey,sScript2);
|
|
}
|
|
}
|
|
else if (sScript.Find(EW_GUTTERWAY) != -1)
|
|
{
|
|
sKey.Format(_T("%d-%d-GUTTERWAY"), 0, 0);
|
|
|
|
sScript2.Format(_T("<%s>"),sScript);
|
|
m_mapAddtion.SetAt(sKey,sScript);
|
|
}
|
|
else if (sScript.Find(EW_FIREDOOR) != -1)
|
|
{
|
|
//FIREDOOR:房间|宽|高|位置|型号|厂家
|
|
sScriptT = sScript;
|
|
sScriptT.TrimLeft(EW_FIREDOOR);
|
|
sScriptT.TrimLeft(_T(':'));
|
|
|
|
CStringArray arInf;
|
|
SplitStrintToArray(sScriptT, arInf, _T('|'));
|
|
|
|
if (arInf.GetSize() >= 8)
|
|
{
|
|
nNo = _ttoi(arInf.GetAt(7));
|
|
}
|
|
else//旧版本
|
|
{
|
|
static int nNum = 1;
|
|
nNo = nNum++;
|
|
|
|
sOld.Format(_T("|%d"), nNo);
|
|
sScriptNewVer = sScript + sOld;
|
|
m_sAddtionScr.Replace(sScript, sScriptNewVer);
|
|
sScript = sScriptNewVer;
|
|
}
|
|
|
|
if (arInf.GetSize() >= 5)
|
|
{
|
|
nRoomIndex = _ttoi(arInf.GetAt(0));
|
|
sKey.Format(_T("%d-%d-%d-FIREDOOR"), nRoomIndex, nPos, nNo);
|
|
|
|
sScript2.Format(_T("<%s>"),sScript);
|
|
m_mapAddtion.SetAt(sKey,sScript2);
|
|
}
|
|
}
|
|
else if (sScript.Find(EW_SECURITY) != -1)
|
|
{
|
|
//SECURITY:房间|大径|小径|高度|定位|间距|名称|型号|厂家
|
|
sScriptT = sScript;
|
|
sScriptT.TrimLeft(EW_SECURITY);
|
|
sScriptT.TrimLeft(_T(':'));
|
|
|
|
CStringArray arInf;
|
|
SplitStrintToArray(sScriptT, arInf, _T('|'));
|
|
|
|
if (arInf.GetSize() >= 11)
|
|
{
|
|
nNo = _ttoi(arInf.GetAt(10));
|
|
}
|
|
else//旧版本
|
|
{
|
|
static int nNum = 1;
|
|
nNo = nNum++;
|
|
|
|
sOld.Format(_T("|%d"), nNo);
|
|
sScriptNewVer = sScript + sOld;
|
|
m_sAddtionScr.Replace(sScript, sScriptNewVer);
|
|
sScript = sScriptNewVer;
|
|
}
|
|
|
|
if (arInf.GetSize() >= 9)
|
|
{
|
|
nRoomIndex = _ttoi(arInf.GetAt(0));
|
|
sKey.Format(_T("%d-%d-%d-SECURITY"), nRoomIndex, 0, nNo);
|
|
|
|
sScript2.Format(_T("<%s>"),sScript);
|
|
m_mapAddtion.SetAt(sKey,sScript2);
|
|
}
|
|
}
|
|
else if (sScript.Find(EW_DRAFAN) != -1)
|
|
{
|
|
//DRAFAN:房间|外径|长度|吊高|间距|风量|功率|机号|名称|型号|厂家
|
|
sScriptT = sScript;
|
|
sScriptT.TrimLeft(EW_DRAFAN);
|
|
sScriptT.TrimLeft(_T(':'));
|
|
|
|
CStringArray arInf;
|
|
SplitStrintToArray(sScriptT, arInf, _T('|'));
|
|
|
|
if (arInf.GetSize() >= 13)
|
|
{
|
|
nNo = _ttoi(arInf.GetAt(12));
|
|
}
|
|
else//旧版本
|
|
{
|
|
static int nNum = 1;
|
|
nNo = nNum++;
|
|
|
|
sOld.Format(_T("|%d"), nNo);
|
|
sScriptNewVer = sScript + sOld;
|
|
m_sAddtionScr.Replace(sScript, sScriptNewVer);
|
|
sScript = sScriptNewVer;
|
|
}
|
|
|
|
if (arInf.GetSize() >= 11)
|
|
{
|
|
nRoomIndex = _ttoi(arInf.GetAt(0));
|
|
|
|
sKey.Format(_T("%d-%d-%d-DRAFAN"), nRoomIndex, 0, nNo);
|
|
|
|
sScript2.Format(_T("<%s>"),sScript);
|
|
m_mapAddtion.SetAt(sKey,sScript2);
|
|
}
|
|
}
|
|
else if (sScript.Find(EW_GASALARM) != -1)
|
|
{
|
|
//GASALARM:房间|位置|高度|长|宽|厚|间距|名称|等级|型号|厂家
|
|
sScriptT = sScript;
|
|
sScriptT.TrimLeft(EW_GASALARM);
|
|
sScriptT.TrimLeft(_T(':'));
|
|
|
|
CStringArray arInf;
|
|
SplitStrintToArray(sScriptT, arInf, _T('|'));
|
|
|
|
if (arInf.GetSize() >= 13)
|
|
{
|
|
nNo = _ttoi(arInf.GetAt(12));
|
|
}
|
|
else//旧版本
|
|
{
|
|
static int nNum = 1;
|
|
nNo = nNum++;
|
|
|
|
sOld.Format(_T("|%d"), nNo);
|
|
sScriptNewVer = sScript + sOld;
|
|
m_sAddtionScr.Replace(sScript, sScriptNewVer);
|
|
sScript = sScriptNewVer;
|
|
}
|
|
|
|
if (arInf.GetSize() >= 11)
|
|
{
|
|
nRoomIndex = _ttoi(arInf.GetAt(0));
|
|
nLRPos = _ttoi(arInf.GetAt(1));
|
|
|
|
sKey.Format(_T("%d-%d-%d-GASALARM"), nRoomIndex, nLRPos, nNo);
|
|
|
|
sScript2.Format(_T("<%s>"),sScript);
|
|
m_mapAddtion.SetAt(sKey,sScript2);
|
|
}
|
|
}
|
|
else if(sScript.Find(EW_ROOMSLAB) != -1)
|
|
{
|
|
//ROOMSLAB: 房间|位置方向|距离|子舱宽|板厚度|偏移x|偏移y|编号
|
|
sScriptT = sScript;
|
|
sScriptT.TrimLeft(EW_ROOMSLAB);
|
|
sScriptT.TrimLeft(_T(':'));
|
|
|
|
CStringArray arInf;
|
|
SplitStrintToArray(sScriptT, arInf, _T('|'));
|
|
|
|
if (arInf.GetSize() >= 8)
|
|
{
|
|
nRoomIndex = _ttoi(arInf.GetAt(0));
|
|
CString sNo = arInf.GetAt(7);
|
|
|
|
sKey.Format(_T("%d-%s-ROOMSLAB"), nRoomIndex, sNo);
|
|
|
|
sScript2.Format(_T("<%s>"),sScript);
|
|
m_mapAddtion.SetAt(sKey,sScript2);
|
|
}
|
|
}
|
|
else if (sScript.Find(EW_SMOKALARM) != -1)
|
|
{
|
|
//SMOKALARM:房间|位置|间距|外径|高度|名称|编号|规格|厂家|偏移
|
|
sScriptT = sScript;
|
|
sScriptT.TrimLeft(EW_SMOKALARM);
|
|
sScriptT.TrimLeft(_T(':'));
|
|
|
|
CStringArray arInf;
|
|
SplitStrintToArray(sScriptT, arInf, _T('|'));
|
|
|
|
if (arInf.GetSize() >= 11)
|
|
{
|
|
nNo = _ttoi(arInf.GetAt(10));
|
|
}
|
|
else//旧版本
|
|
{
|
|
static int nNum = 1;
|
|
nNo = nNum++;
|
|
|
|
sOld.Format(_T("|%d"), nNo);
|
|
sScriptNewVer = sScript + sOld;
|
|
m_sAddtionScr.Replace(sScript, sScriptNewVer);
|
|
sScript = sScriptNewVer;
|
|
}
|
|
|
|
if (arInf.GetSize() >= 10)
|
|
{
|
|
nRoomIndex = _ttoi(arInf.GetAt(0));
|
|
sKey.Format(_T("%d-%d-%d-SMOKALARM"), nRoomIndex, 0, nNo);
|
|
|
|
sScript2.Format(_T("<%s>"),sScript);
|
|
m_mapAddtion.SetAt(sKey,sScript2);
|
|
}
|
|
}
|
|
else if (sScript.Find(EW_TEMPALARM) != -1)
|
|
{
|
|
//TEMPALARM:房间|左右侧|位置|间距|宽度|高度|厚度|名称|编号|规格|厂家|偏移
|
|
sScriptT = sScript;
|
|
sScriptT.TrimLeft(EW_TEMPALARM);
|
|
sScriptT.TrimLeft(_T(':'));
|
|
|
|
CStringArray arInf;
|
|
SplitStrintToArray(sScriptT, arInf, _T('|'));
|
|
|
|
if (arInf.GetSize() >= 13)
|
|
{
|
|
nNo = _ttoi(arInf.GetAt(12));
|
|
}
|
|
else//旧版本
|
|
{
|
|
static int nNum = 1;
|
|
nNo = nNum++;
|
|
|
|
sOld.Format(_T("|%d"), nNo);
|
|
sScriptNewVer = sScript + sOld;
|
|
m_sAddtionScr.Replace(sScript, sScriptNewVer);
|
|
sScript = sScriptNewVer;
|
|
}
|
|
|
|
if (arInf.GetSize() >= 10)
|
|
{
|
|
nRoomIndex = _ttoi(arInf.GetAt(0));
|
|
int nPos = _ttoi(arInf.GetAt(1));
|
|
|
|
sKey.Format(_T("%d-%d-%d-TEMPALARM"), nRoomIndex, nPos, nNo);
|
|
|
|
sScript2.Format(_T("<%s>"),sScript);
|
|
m_mapAddtion.SetAt(sKey,sScript2);
|
|
}
|
|
}
|
|
else if (sScript.Find(EW_COALARM) != -1)
|
|
{
|
|
//COALARM:房间|左右侧|位置|间距|宽度|高度|厚度|名称|浓度|偏移
|
|
sScriptT = sScript;
|
|
sScriptT.TrimLeft(EW_COALARM);
|
|
sScriptT.TrimLeft(_T(':'));
|
|
|
|
CStringArray arInf;
|
|
SplitStrintToArray(sScriptT, arInf, _T('|'));
|
|
|
|
if (arInf.GetSize() >= 12)
|
|
{
|
|
nNo = _ttoi(arInf.GetAt(11));
|
|
}
|
|
else//旧版本
|
|
{
|
|
static int nNum = 1;
|
|
nNo = nNum++;
|
|
|
|
sOld.Format(_T("|%d"), nNo);
|
|
sScriptNewVer = sScript + sOld;
|
|
m_sAddtionScr.Replace(sScript, sScriptNewVer);
|
|
sScript = sScriptNewVer;
|
|
}
|
|
|
|
if (arInf.GetSize() >= 10)
|
|
{
|
|
nRoomIndex = _ttoi(arInf.GetAt(0));
|
|
int nPos = _ttoi(arInf.GetAt(1));
|
|
sKey.Format(_T("%d-%d-%d-COALARM"), nRoomIndex, nPos, nNo);
|
|
|
|
sScript2.Format(_T("<%s>"),sScript);
|
|
m_mapAddtion.SetAt(sKey,sScript2);
|
|
}
|
|
}
|
|
else if (sScript.Find(EW_OXALARM) != -1)
|
|
{
|
|
//OXALARM:房间|左右侧|位置|间距|宽度|高度|厚度|名称|采样方式|测量精度|厂家|偏移
|
|
sScriptT = sScript;
|
|
sScriptT.TrimLeft(EW_OXALARM);
|
|
sScriptT.TrimLeft(_T(':'));
|
|
|
|
CStringArray arInf;
|
|
SplitStrintToArray(sScriptT, arInf, _T('|'));
|
|
|
|
if (arInf.GetSize() >= 13)
|
|
{
|
|
nNo = _ttoi(arInf.GetAt(12));
|
|
}
|
|
else//旧版本
|
|
{
|
|
static int nNum = 1;
|
|
nNo = nNum++;
|
|
|
|
sOld.Format(_T("|%d"), nNo);
|
|
sScriptNewVer = sScript + sOld;
|
|
m_sAddtionScr.Replace(sScript, sScriptNewVer);
|
|
sScript = sScriptNewVer;
|
|
}
|
|
|
|
if (arInf.GetSize() >= 10)
|
|
{
|
|
nRoomIndex = _ttoi(arInf.GetAt(0));
|
|
int nPos = _ttoi(arInf.GetAt(1));
|
|
sKey.Format(_T("%d-%d-%d-OXALARM"), nRoomIndex, nPos, nNo);
|
|
|
|
sScript2.Format(_T("<%s>"),sScript);
|
|
m_mapAddtion.SetAt(sKey,sScript2);
|
|
}
|
|
}
|
|
else if (sScript.Find(EW_ROOMNAME) != -1)
|
|
{
|
|
//ROOMNAME:房间|中心x|中心y|名称 -->x,y放大100倍
|
|
sScriptT = sScript;
|
|
sScriptT.TrimLeft(EW_ROOMNAME);
|
|
sScriptT.TrimLeft(_T(':'));
|
|
|
|
//判断是否分舱
|
|
//double dCenX = (pt[0].x + pt[2].x) / 2.0;
|
|
//double dCenY = (pt[0].y + pt[2].y) / 2.0;
|
|
//CString sKey,sVal;
|
|
//sKey.Format(_T("%d|%d|%d|ROOMNAME"), nRoomIndex, (int)( 100.0 * dCenX ),(int)(100.0 * dCenY) );//放大100倍
|
|
//sVal.Format(_T("<ROOMNAME:%d|%d|%d|%s>"),nRoomIndex,(int)( 100.0 * dCenX ),(int)(100.0 * dCenY),m_sRoomName);
|
|
//m_mapAddtion.SetAt(sKey,sVal);
|
|
|
|
CStringArray arInf;
|
|
SplitStrintToArray(sScriptT, arInf, _T('|'));
|
|
|
|
if (arInf.GetSize() >= 4)
|
|
{
|
|
nRoomIndex = _ttoi(arInf.GetAt(0));
|
|
int nCenX = _ttoi(arInf.GetAt(1));
|
|
int nCenY = _ttoi(arInf.GetAt(2));
|
|
sName = arInf.GetAt(3);
|
|
|
|
sKey.Format(_T("%d|%d|%d|ROOMNAME"),nRoomIndex,nCenX,nCenY);
|
|
|
|
sScript2.Format(_T("<%s>"),sScript);
|
|
m_mapAddtion.SetAt(sKey,sScript2);
|
|
m_mapIndexToName.SetAt(arInf.GetAt(0),sName);
|
|
}
|
|
}
|
|
else if (sScript.Find(EW_CHARMNO) != -1)
|
|
{
|
|
//盾构没有倒角
|
|
}
|
|
|
|
nSta += sScript.GetLength();
|
|
nPos = sExt.Find(_T('<'),nSta);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
void CDGJMDlg::FormatAddtionScr()
|
|
{
|
|
m_sAddtionScr = _T("");
|
|
CString sExt = _T("EXT:"),sKey,sExtVal;
|
|
for (POSITION ps = m_mapAddtion.GetStartPosition();ps != NULL;)
|
|
{
|
|
m_mapAddtion.GetNextAssoc(ps,sKey,sExtVal);
|
|
sExt += sExtVal;
|
|
}
|
|
if (sExt.CompareNoCase(_T("EXT:")) != 0)
|
|
{
|
|
m_sAddtionScr += sExt;
|
|
}
|
|
}
|
|
|
|
void CDGJMDlg::OnBnClickedBtaddtodb()
|
|
{
|
|
UpdateData(TRUE);
|
|
|
|
if (m_dT1 < 1.e-1 || m_dT2 < 1.e-1 ||
|
|
m_dT4 < 1.e-1 || m_dT5 < 1.e-1)
|
|
{
|
|
AfxMessageBox(_T("请检查管廊上下两侧壁厚是否合理!"));
|
|
return;
|
|
}
|
|
|
|
if (m_curSection.pReg != NULL)
|
|
{
|
|
CString sFullPath = FilePath::GetSysDir();
|
|
sFullPath.MakeLower();
|
|
sFullPath += _T("\\DGJM.sat");
|
|
|
|
CString sRegionScrp = _T("");
|
|
CString sLine;
|
|
AcDbVoidPtrArray arBodyPtrs;
|
|
arBodyPtrs.append(m_curSection.pReg);
|
|
|
|
if ( Acad::eOk == AcDbBody::acisOut(sFullPath,arBodyPtrs) )
|
|
{
|
|
CFile file;
|
|
if (file.Open(sFullPath,CFile::modeRead))
|
|
{
|
|
ULONGLONG dwFileLength = file.GetLength();
|
|
char* pszTxt = new char[dwFileLength];
|
|
|
|
file.Read(pszTxt,dwFileLength);
|
|
|
|
sRegionScrp = pszTxt;
|
|
delete [] pszTxt;
|
|
|
|
file.Close();
|
|
}
|
|
}
|
|
|
|
CString sElPt;
|
|
sElPt.Format(_T("<ELAGN:%g,%g,%g,%g,%g,%g>"),m_curSection.pt.x,m_curSection.pt.y,m_dT1,m_dT2,m_dT4,m_dT5);
|
|
sRegionScrp += sElPt;
|
|
|
|
CGLTKDlg dlg(CGLTKDlg::eInput);
|
|
dlg.SetCrossSectionScr(sRegionScrp);
|
|
dlg.SetAddtionScr(m_sAddtionScr);
|
|
dlg.DoModal();
|
|
}
|
|
}
|
|
|
|
void CDGJMDlg::OnBnClickedBtselfromdb()
|
|
{
|
|
CGLTKDlg dlg(CGLTKDlg::eSelect);
|
|
if ( IDOK == dlg.DoModal() )
|
|
{
|
|
CString sScr,sScrT;
|
|
if (dlg.GetCrossSectionScr(sScr))
|
|
{
|
|
dlg.GetAddtionScr(m_sAddtionScr);
|
|
|
|
sScrT = sScr;
|
|
if (sScr.Find(_T("RECT:")) != -1)
|
|
{
|
|
AfxMessageBox(_T("选择的是脚本不是盾构管廊截面!"));
|
|
return;
|
|
}
|
|
|
|
CString sFullPath = FilePath::GetSysDir();
|
|
sFullPath.MakeLower();
|
|
sFullPath += _T("\\DGJM.sat");
|
|
|
|
int nPos = sScr.Find(_T("<ELAGN:"));
|
|
if (nPos != -1)
|
|
{
|
|
sScrT = sScr.Mid(0,nPos);
|
|
}
|
|
|
|
CString sX,sY;
|
|
CString sPt = sScr.Mid(nPos);
|
|
sPt.TrimLeft(_T("<ELAGN:"));
|
|
sPt.TrimRight(_T(">"));
|
|
nPos = sPt.Find(_T(','));
|
|
if (nPos != -1)
|
|
{
|
|
CStringArray arInfo;
|
|
SplitStrintToArray(sPt,arInfo,_T(','));
|
|
|
|
if (arInfo.GetSize() >= 2)
|
|
{
|
|
sX = arInfo.GetAt(0);
|
|
sY = arInfo.GetAt(1);
|
|
m_curSection.pt.set(_ttof(sX),_ttof(sY),0.0);
|
|
|
|
if (arInfo.GetSize() >= 6)
|
|
{
|
|
m_curSection.dThick[0] = _ttof(arInfo.GetAt(2));
|
|
m_curSection.dThick[1] = _ttof(arInfo.GetAt(3));
|
|
m_curSection.dThick[2] = _ttof(arInfo.GetAt(4));
|
|
m_curSection.dThick[3] = _ttof(arInfo.GetAt(5));
|
|
|
|
m_dT1 = m_curSection.dThick[0];
|
|
m_dT2 = m_curSection.dThick[1];
|
|
m_dT4 = m_curSection.dThick[2];
|
|
m_dT5 = m_curSection.dThick[3];
|
|
}
|
|
}
|
|
}
|
|
|
|
CStdioFile file;
|
|
if (file.Open(sFullPath,CFile::modeCreate |CFile::modeWrite ))
|
|
{
|
|
file.WriteString(sScrT);
|
|
file.Close();
|
|
}
|
|
|
|
AcDbVoidPtrArray arBodyPtrs;
|
|
if ( Acad::eOk == AcDbBody::acisIn(sFullPath,arBodyPtrs) )
|
|
{
|
|
if (arBodyPtrs.length() > 0)
|
|
{
|
|
AcDbEntity* pEnt = (AcDbEntity*)arBodyPtrs.first();
|
|
AcDbRegion* pRegion = AcDbRegion::cast(pEnt);
|
|
if (pRegion != NULL)
|
|
{
|
|
m_curSection.pReg = pRegion;
|
|
}
|
|
|
|
m_curSection.sAddtionScr = m_sAddtionScr;
|
|
if (m_curSection.pReg != NULL)
|
|
{
|
|
ExtractRegionRooms();
|
|
ShowEwSection();
|
|
|
|
//2.显示舱室名称
|
|
ShowRoomName();
|
|
|
|
//3.显示附件
|
|
ShowAddtion();
|
|
}
|
|
}
|
|
}
|
|
UpdateData(FALSE);
|
|
UpdateWindow();
|
|
}
|
|
}
|
|
}
|
|
|
|
void CDGJMDlg::ShowLastSection()
|
|
{
|
|
//1.截面
|
|
CString sFullPath = FilePath::GetSysDir();
|
|
sFullPath.MakeLower();
|
|
sFullPath += _T("\\DGJM.sat");
|
|
|
|
CFileFind find;
|
|
if (!find.FindFile(sFullPath))
|
|
{
|
|
return;
|
|
}
|
|
|
|
AcDbVoidPtrArray arBodyPtrs;
|
|
if ( Acad::eOk == AcDbBody::acisIn(sFullPath,arBodyPtrs) )
|
|
{
|
|
if (arBodyPtrs.length() > 0)
|
|
{
|
|
AcDbEntity* pEnt = (AcDbEntity*)arBodyPtrs.first();
|
|
AcDbRegion* pRegion = AcDbRegion::cast(pEnt);
|
|
if (pRegion != NULL)
|
|
{
|
|
m_curSection.pReg = pRegion;
|
|
}
|
|
|
|
if (m_curSection.pReg != NULL)
|
|
{
|
|
ExtractRegionRooms();
|
|
ShowEwSection();
|
|
}
|
|
}
|
|
}
|
|
|
|
//2.壁厚
|
|
sFullPath = FilePath::GetSysDir();
|
|
sFullPath.MakeLower();
|
|
sFullPath += _T("\\DGJM.ext");
|
|
|
|
CString sLine;
|
|
CStdioFile file;
|
|
if (file.Open(sFullPath,CFile::modeRead | CFile::typeText))
|
|
{
|
|
file.ReadString(sLine);
|
|
file.Close();
|
|
|
|
sLine.TrimRight(_T('\n'));
|
|
CStringArray arInf;
|
|
SplitStrintToArray(sLine,arInf,_T(','));
|
|
|
|
if (arInf.GetSize() >= 6)
|
|
{
|
|
m_curSection.pt.set(_ttof(arInf.GetAt(0)),_ttof(arInf.GetAt(1)),0.0);
|
|
m_dT1 = _ttof(arInf.GetAt(2));
|
|
m_dT2 = _ttof(arInf.GetAt(3));
|
|
m_dT4 = _ttof(arInf.GetAt(4));
|
|
m_dT5 = _ttof(arInf.GetAt(5));
|
|
|
|
m_curSection.dThick[0] = m_dT1;
|
|
m_curSection.dThick[1] = m_dT2;
|
|
m_curSection.dThick[2] = m_dT4;
|
|
m_curSection.dThick[3] = m_dT5;
|
|
}
|
|
}
|
|
|
|
//3.名称
|
|
sFullPath = FilePath::GetSysDir();
|
|
sFullPath.MakeLower();
|
|
sFullPath += _T("\\DGJM.nam");
|
|
|
|
CString sIndex,sName;
|
|
AcDbText* pText = NULL;
|
|
AcGePoint3d ptIns;
|
|
|
|
CStringArray arInf;
|
|
if (file.Open(sFullPath,CFile::modeRead | CFile::typeText))
|
|
{
|
|
sLine = _T("");
|
|
while(file.ReadString(sLine))
|
|
{
|
|
sLine.TrimRight(_T('\n'));
|
|
arInf.RemoveAll();
|
|
SplitStrintToArray(sLine,arInf,_T(','));
|
|
|
|
if (arInf.GetSize() >= 4)
|
|
{
|
|
sIndex = arInf.GetAt(0);
|
|
sName = arInf.GetAt(1);
|
|
m_mapIndexToName.SetAt(sIndex,sName);
|
|
}
|
|
}
|
|
file.Close();
|
|
}
|
|
|
|
ExtractRegionRooms();
|
|
|
|
//4.显示附件
|
|
sFullPath = FilePath::GetSysDir();
|
|
sFullPath.MakeLower();
|
|
sFullPath += _T("\\DGJM.adt");
|
|
if (file.Open(sFullPath,CFile::modeRead | CFile::typeText))
|
|
{
|
|
sLine = _T("");
|
|
file.ReadString(sLine);
|
|
sLine.TrimRight(_T('\n'));
|
|
|
|
m_sAddtionScr = sLine;
|
|
|
|
m_mapAddtion.RemoveAll();
|
|
ExtrAddtionToMap();
|
|
|
|
file.Close();
|
|
}
|
|
ShowAddtion();
|
|
ShowRoomName();
|
|
|
|
UpdateData(FALSE);
|
|
UpdateWindow();
|
|
}
|
|
|
|
void CDGJMDlg::OnBnClickedOk()
|
|
{
|
|
FormatAddtionScr();
|
|
|
|
OnOK();
|
|
}
|
|
|
|
void CDGJMDlg::OnBnClickedButton1()
|
|
{
|
|
EnableWindow(FALSE);
|
|
CWnd* pFrame = acedGetAcadFrame();
|
|
pFrame->EnableWindow(TRUE);
|
|
ShowWindow(SW_HIDE);
|
|
pFrame->SetFocus();
|
|
|
|
do
|
|
{
|
|
ads_point pt,pt2;
|
|
ads_name ent;
|
|
|
|
int nRes = acedEntSel(_T("\n请选择一个面域:"), ent, pt);
|
|
if (nRes != RTNORM) break;
|
|
|
|
AcDbObjectId id;
|
|
acdbGetObjectId(id, ent);
|
|
m_curSection.clear();
|
|
nRes = acedGetPoint(NULL, _T("\n请选一点做为标高的基准点:"),pt);
|
|
if (nRes != RTNORM) break;
|
|
|
|
acdbUcs2Wcs(pt, pt2, false);
|
|
m_curSection.pt = asPnt3d(pt2);
|
|
|
|
AcGeMatrix3d xform;
|
|
AcGeVector3d vtMove = m_curSection.pt.asVector();
|
|
vtMove.negate();
|
|
xform.setToTranslation(vtMove);
|
|
|
|
OPENOBJ_BEGIN(id, AcDb::kForRead, AcDbRegion, pReg)
|
|
if (pReg)
|
|
{
|
|
m_curSection.pReg = (AcDbRegion*)pReg->clone();
|
|
m_curSection.pReg->transformBy(xform);
|
|
m_curSection.pt.transformBy(xform);
|
|
m_curSection.sAddtionScr = _T("");//上次清空
|
|
m_sAddtionScr = _T("");//上次清空
|
|
}
|
|
OPENOBJ_END()
|
|
|
|
} while (false);
|
|
|
|
pFrame->EnableWindow(FALSE);
|
|
ShowWindow(SW_SHOW);
|
|
EnableWindow(TRUE);
|
|
UpdateData(FALSE);
|
|
|
|
ExtractRegionRooms();
|
|
ShowEwSection();
|
|
}
|
|
|
|
void CDGJMDlg::RedrawDrawRegion()
|
|
{
|
|
//1.显示截面
|
|
ShowEwSection();
|
|
|
|
//2.显示舱室名称
|
|
ShowRoomName();
|
|
|
|
//3.显示附件
|
|
ShowAddtion();
|
|
|
|
//4.显示当前舱室
|
|
AcGsView* pView = m_wndViewCtrl.view();
|
|
AcGsModel* pModel = m_wndViewCtrl.model();
|
|
|
|
if (pView != NULL && m_pRegionRoom != NULL)
|
|
{
|
|
pView->add(m_pRegionRoom, pModel);
|
|
m_wndViewCtrl.view()->invalidate();
|
|
m_wndViewCtrl.RedrawWindow();
|
|
}
|
|
}
|
|
|
|
void CDGJMDlg::ShowAddtion()
|
|
{
|
|
//合成脚本
|
|
FormatAddtionScr();
|
|
|
|
if (!m_sAddtionScr.IsEmpty())
|
|
{
|
|
AecDbShEarthWorm shWorm;
|
|
|
|
AcGePoint3d ptEnd(100,0,0);
|
|
AcDbLine ln(AcGePoint3d(0,0,0),ptEnd);
|
|
|
|
AecDb3dRoadAxisLine* pRoadLn = new AecDb3dRoadAxisLine;
|
|
pRoadLn->AppendCurveSeg(&ln);
|
|
|
|
shWorm.GetSpecialtyData()->SetAt(KEY_2DSTYLE, 2);
|
|
shWorm.SetSection(m_curSection.pReg,m_curSection.pt);
|
|
shWorm.SetBaseCurve(pRoadLn);
|
|
shWorm.SetAddtionScr(m_sAddtionScr);
|
|
|
|
AcDbVoidPtrArray arCurPtrs;
|
|
shWorm.GetAddtionSection(arCurPtrs);
|
|
|
|
AcGsView* pView = m_wndViewCtrl.view();
|
|
AcGsModel* pModel = m_wndViewCtrl.model();
|
|
|
|
AcDbEntity* pEnt = NULL;
|
|
for (int i = 0;i < arCurPtrs.length();i++)
|
|
{
|
|
pEnt = (AcDbEntity*)arCurPtrs.at(i);
|
|
pView->add(pEnt, pModel);
|
|
m_arDrawBuffer.append(pEnt);
|
|
}
|
|
|
|
m_wndViewCtrl.view()->invalidate();
|
|
m_wndViewCtrl.RedrawWindow();
|
|
}
|
|
}
|
|
|
|
void CDGJMDlg::ShowRoomName()
|
|
{
|
|
CString sKey,sName;
|
|
AcDbRegion* pRegion = NULL;
|
|
AcDbText* pText = NULL;
|
|
|
|
//延着整体圆排序
|
|
double perimeter;
|
|
double area;
|
|
AcGePoint2d centroid;
|
|
double momInertia[2];
|
|
double prodInertia;
|
|
double prinMoments[2];
|
|
AcGeVector2d prinAxes[2];
|
|
double radiiGyration[2];
|
|
AcGePoint2d extentsLow;
|
|
AcGePoint2d extentsHigh;
|
|
|
|
AcGePoint3d ptIns;
|
|
for (int i = 0;i < m_arRegionRooms.length();i++)
|
|
{
|
|
pRegion = (AcDbRegion*)m_arRegionRooms.at(i);
|
|
|
|
pRegion->getAreaProp(AcGePoint3d::kOrigin,AcGeVector3d::kXAxis,AcGeVector3d::kYAxis,
|
|
perimeter,
|
|
area,
|
|
centroid,
|
|
momInertia,
|
|
prodInertia,
|
|
prinMoments,
|
|
prinAxes,
|
|
radiiGyration,
|
|
extentsLow,
|
|
extentsHigh);
|
|
|
|
sKey.Format(_T("%d"),i);
|
|
ptIns.set(centroid.x,centroid.y,0.0);
|
|
|
|
if (m_mapIndexToName.Lookup(sKey,sName))
|
|
{
|
|
pText = NULL;
|
|
if (m_mapIndexToDbText.Lookup(sKey,(void*&)pText))
|
|
{
|
|
pText->setPosition(ptIns);
|
|
pText->setTextString(sName);
|
|
}
|
|
else
|
|
{
|
|
ptIns.set(centroid.x,centroid.y,0.0);
|
|
pText = new AcDbText(ptIns,sName,acdbCurDwg()->textstyle(),0.15,0.0);
|
|
pText->setHeight(.15);
|
|
pText->setColorIndex(1);
|
|
pText->setTextStyle(acdbCurDwg()->textstyle());
|
|
pText->setHorizontalMode(AcDb::kTextLeft);
|
|
m_mapIndexToDbText.SetAt(sKey,pText);
|
|
}
|
|
|
|
if (pText != NULL)
|
|
{
|
|
m_wndViewCtrl.view()->erase(pText);
|
|
m_wndViewCtrl.Add(pText);
|
|
|
|
if (m_arDrawBuffer.find(pText) == -1)
|
|
m_arDrawBuffer.append(pText);
|
|
}
|
|
}
|
|
}
|
|
m_wndViewCtrl.view()->invalidate();
|
|
m_wndViewCtrl.Invalidate();
|
|
m_wndViewCtrl.RedrawWindow();
|
|
}
|
|
|
|
void CDGJMDlg::ShowEwSection()
|
|
{
|
|
if (m_curSection.pReg != NULL)
|
|
{
|
|
m_arDrawBuffer.removeAll();
|
|
m_wndViewCtrl.clearAll();
|
|
m_wndViewCtrl.init(true);
|
|
m_wndViewCtrl.SetOrbitFlag(OBF_PAN | OBF_ZOOM | OBF_COTE);
|
|
|
|
AcDbExtents exts;
|
|
m_curSection.pReg->getGeomExtents(exts);
|
|
m_wndViewCtrl.InitFromCurrentView2D(exts,true);
|
|
|
|
m_wndViewCtrl.Add(m_curSection.pReg);
|
|
m_arDrawBuffer.append(m_curSection.pReg);
|
|
|
|
m_wndViewCtrl.view()->invalidate();
|
|
m_wndViewCtrl.Invalidate();
|
|
m_wndViewCtrl.RedrawWindow();
|
|
}
|
|
}
|
|
|
|
void CDGJMDlg::OnBnClickedButton4()
|
|
{
|
|
double dt = 0.0;
|
|
if (GetThick(dt))
|
|
{
|
|
m_dT1 = dt;
|
|
UpdateData(FALSE);
|
|
}
|
|
}
|
|
|
|
void CDGJMDlg::OnBnClickedButton13()
|
|
{
|
|
double dt = 0.0;
|
|
if (GetThick(dt))
|
|
{
|
|
m_dT2 = dt;
|
|
UpdateData(FALSE);
|
|
}
|
|
}
|
|
|
|
void CDGJMDlg::OnBnClickedButton17()
|
|
{
|
|
double dt = 0.0;
|
|
if (GetThick(dt))
|
|
{
|
|
m_dT4 = dt;
|
|
UpdateData(FALSE);
|
|
}
|
|
}
|
|
|
|
void CDGJMDlg::OnBnClickedButton56()
|
|
{
|
|
double dt = 0.0;
|
|
if (GetThick(dt))
|
|
{
|
|
m_dT5 = dt;
|
|
UpdateData(FALSE);
|
|
}
|
|
}
|
|
|
|
bool CDGJMDlg::GetThick(double& dt)
|
|
{
|
|
acedGetAcadFrame()->EnableWindow(TRUE);
|
|
ShowWindow(SW_HIDE);
|
|
acedGetAcadFrame()->SetFocus();
|
|
|
|
double dDist = 0.0;
|
|
ads_point pt1,pt2;
|
|
int nRes = acedGetPoint(NULL,_T("\n请选择测量尺寸第一点:"),pt1);
|
|
if (nRes == RTNORM)
|
|
{
|
|
nRes = acedGetPoint(pt1,_T("\n请选择测量尺寸第一点:"),pt2);
|
|
if (nRes == RTNORM)
|
|
{
|
|
dDist = acutDistance(pt1,pt2);
|
|
dDist *= 1000.0;//米单位
|
|
|
|
dt = (int)(dDist);
|
|
|
|
ShowWindow(SW_SHOW);
|
|
return true;
|
|
}
|
|
}
|
|
ShowWindow(SW_SHOW);
|
|
SetFocus();
|
|
acedGetAcadFrame()->EnableWindow(FALSE);
|
|
EnableWindow(TRUE);
|
|
return false;
|
|
}
|
|
|
|
void CDGJMDlg::OnDestroy()
|
|
{
|
|
CDialog::OnDestroy();
|
|
|
|
//1.写壁厚
|
|
CString sFullPath = FilePath::GetSysDir();
|
|
sFullPath.MakeLower();
|
|
sFullPath += _T("\\DGJM.ext");
|
|
|
|
CString sLine;
|
|
CStdioFile file;
|
|
if (file.Open(sFullPath,CFile::modeCreate | CFile::modeWrite | CFile::typeText))
|
|
{
|
|
sLine.Format(_T("%g,%g,%g,%g,%g,%g\n"),m_curSection.pt.x,m_curSection.pt.y,m_dT1,m_dT2,m_dT4,m_dT5);
|
|
file.WriteString(sLine);
|
|
file.Close();
|
|
}
|
|
|
|
//2.写名称
|
|
sFullPath = FilePath::GetSysDir();
|
|
sFullPath.MakeLower();
|
|
sFullPath += _T("\\DGJM.nam");
|
|
|
|
CString sKey;
|
|
AcDbText* pText = NULL;
|
|
AcGePoint3d ptIns;
|
|
|
|
if (file.Open(sFullPath,CFile::modeCreate | CFile::modeWrite | CFile::typeText))
|
|
{
|
|
for (POSITION ps = m_mapIndexToDbText.GetStartPosition();ps != NULL;)
|
|
{
|
|
m_mapIndexToDbText.GetNextAssoc(ps,sKey,(void*&)pText);
|
|
ptIns = pText->position();
|
|
sLine.Format(_T("%s,%s,%g,%g\n"),sKey,pText->textStringConst(),ptIns.x,ptIns.y);
|
|
file.WriteString(sLine);
|
|
}
|
|
file.Close();
|
|
}
|
|
|
|
//3.附件
|
|
sFullPath = FilePath::GetSysDir();
|
|
sFullPath.MakeLower();
|
|
sFullPath += _T("\\DGJM.adt");
|
|
if (file.Open(sFullPath,CFile::modeCreate | CFile::modeWrite | CFile::typeText))
|
|
{
|
|
file.WriteString(m_sAddtionScr);
|
|
file.Close();
|
|
}
|
|
}
|
|
|
|
LRESULT CDGJMDlg::OnViewLButtonDown(WPARAM wp, LPARAM lp)
|
|
{
|
|
//鼠标点击的点
|
|
AcGePoint3d* pPt = (AcGePoint3d*)lp;
|
|
pPt->z = 0.0;
|
|
|
|
if (m_curSection.pReg != NULL)
|
|
{
|
|
AcGsView* pView = m_wndViewCtrl.view();
|
|
AcGsModel* pModel = m_wndViewCtrl.model();
|
|
|
|
//判断点落在region内
|
|
AcDbExtents ext;
|
|
AcDbCurve* pPl = NULL;
|
|
AcDbRegion* pRegion = NULL;
|
|
AcDbRay rayx1,rayx2;
|
|
AcDbCurve* pCurve = NULL;
|
|
AcGePoint3dArray arPts1,arPts2;
|
|
|
|
rayx1.setBasePoint(*pPt);
|
|
rayx1.setUnitDir(AcGeVector3d::kXAxis);
|
|
|
|
rayx2.setBasePoint(*pPt);
|
|
rayx2.setUnitDir(-AcGeVector3d::kXAxis);
|
|
|
|
AcDbVoidPtrArray arCurPtrs,arSubEntPtrs;
|
|
for (int i = 0;i < m_arRegionRooms.length();i++)
|
|
{
|
|
pRegion = (AcDbRegion*)m_arRegionRooms.at(i);
|
|
|
|
arCurPtrs.removeAll();
|
|
pRegion->explode(arCurPtrs);
|
|
|
|
arSubEntPtrs.removeAll();
|
|
pCurve = KTCADUtilityEx::ConvertBoundCurve(arCurPtrs,arSubEntPtrs);
|
|
pPl = AcDbCurve::cast(pCurve);
|
|
if (pPl != NULL)
|
|
{
|
|
pPl->intersectWith(&rayx1,AcDb::kOnBothOperands,arPts1);
|
|
pPl->intersectWith(&rayx2,AcDb::kOnBothOperands,arPts2);
|
|
|
|
if (!arPts1.isEmpty() && !arPts2.isEmpty())
|
|
{
|
|
if (pView != NULL && m_pRegionRoom != NULL)
|
|
{
|
|
pView->erase(m_pRegionRoom);
|
|
}
|
|
|
|
m_pRegionRoom = pRegion;
|
|
m_pRegionRoom->setColorIndex(6);
|
|
|
|
if (pView != NULL)
|
|
{
|
|
pView->add(m_pRegionRoom, pModel);
|
|
}
|
|
|
|
delete pPl;
|
|
m_wndViewCtrl.view()->invalidate();
|
|
m_wndViewCtrl.RedrawWindow();
|
|
break;
|
|
}
|
|
delete pPl;
|
|
}
|
|
}
|
|
}
|
|
return 0L;
|
|
}
|
|
|
|
void CDGJMDlg::OnCbnSelchangeCombo4()
|
|
{
|
|
int nSel = m_wndCombo4.GetCurSel();
|
|
if (nSel != -1)
|
|
{
|
|
m_wndCombo4.GetLBText(nSel,m_sRoomName);
|
|
UpdateData(FALSE);
|
|
m_wndEditName.SetWindowText(m_sRoomName);
|
|
}
|
|
RedrawDrawRegion();
|
|
}
|
|
|
|
void CDGJMDlg::OnEnChangeEdit24()
|
|
{
|
|
UpdateData();
|
|
CString sTemp;
|
|
sTemp.Format(_T("%d"),GetIdxOfRoom());
|
|
m_mapIndexToName.SetAt(sTemp,m_sRoomName);
|
|
|
|
int nRoomIndex = GetIdxOfRoom();
|
|
if (nRoomIndex != -1)
|
|
{
|
|
//延着整体圆排序
|
|
double perimeter;
|
|
double area;
|
|
AcGePoint2d centroid;
|
|
double momInertia[2];
|
|
double prodInertia;
|
|
double prinMoments[2];
|
|
AcGeVector2d prinAxes[2];
|
|
double radiiGyration[2];
|
|
AcGePoint2d extentsLow;
|
|
AcGePoint2d extentsHigh;
|
|
|
|
AcGePoint3d ptIns;
|
|
AcDbRegion* pRegion = (AcDbRegion*)m_arRegionRooms.at(nRoomIndex);
|
|
|
|
pRegion->getAreaProp(AcGePoint3d::kOrigin,AcGeVector3d::kXAxis,AcGeVector3d::kYAxis,
|
|
perimeter,
|
|
area,
|
|
centroid,
|
|
momInertia,
|
|
prodInertia,
|
|
prinMoments,
|
|
prinAxes,
|
|
radiiGyration,
|
|
extentsLow,
|
|
extentsHigh);
|
|
|
|
int nCenX = (int)(centroid.x + 0.5);
|
|
int nCenY = (int)(centroid.y + 0.5);
|
|
|
|
CString sKey,sScript2;
|
|
sKey.Format(_T("%d|%d|%d|ROOMNAME"),nRoomIndex,nCenX,nCenY);
|
|
|
|
//sKey.Format(_T("%d|%d|%d|ROOMNAME"), nRoomIndex, (int)( 100.0 * dCenX ),(int)(100.0 * dCenY) );//放大100倍
|
|
//sVal.Format(_T("<ROOMNAME:%d|%d|%d|%s>"),nRoomIndex,(int)( 100.0 * dCenX ),(int)(100.0 * dCenY),m_sRoomName);
|
|
//m_mapAddtion.SetAt(sKey,sVal);
|
|
|
|
sScript2.Format(_T("<ROOMNAME:%d|%d|%d|%s>"),nRoomIndex,nCenX,nCenY,m_sRoomName);
|
|
m_mapAddtion.SetAt(sKey,sScript2);
|
|
}
|
|
|
|
UpdateData(FALSE);
|
|
|
|
RedrawDrawRegion();
|
|
}
|
|
|
|
void CDGJMDlg::ExtractRegionRooms()
|
|
{
|
|
if (m_curSection.pReg != NULL)
|
|
{
|
|
AecDbShEarthWorm::ExtractRegionRooms(m_arRegionRooms,m_curSection.pReg);
|
|
}
|
|
}
|
|
|
|
void CDGJMDlg::GetRoomNames(CStringArray& arRoomNames)
|
|
{
|
|
CString sKey,sName;
|
|
for (int i = 0;i < m_arRegionRooms.length();i++)
|
|
{
|
|
sKey.Format(_T("%d"),i);
|
|
if (m_mapIndexToName.Lookup(sKey,sName))
|
|
{
|
|
arRoomNames.Add(sName);
|
|
}
|
|
else
|
|
{
|
|
break;
|
|
}
|
|
}
|
|
|
|
//ROOMNAME: 房间|中心x|中心y|名称 -->x,y放大100倍
|
|
//<ROOMNAME:%d|%d|%d|%s>
|
|
int nPos = -1;
|
|
CString sVal;
|
|
for (POSITION ps = m_mapAddtion.GetStartPosition();ps != NULL;)
|
|
{
|
|
m_mapAddtion.GetNextAssoc(ps,sKey,sVal);
|
|
|
|
if (sVal.Find(EW_ROOMNAME) != -1)
|
|
{
|
|
nPos = sVal.ReverseFind(_T('|'));
|
|
if (nPos != -1 && nPos < sVal.GetLength() - 1)
|
|
{
|
|
sName = sVal.Mid(nPos + 1);
|
|
arRoomNames.Add(sName);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
int CDGJMDlg::GetIdxOfRoom()
|
|
{
|
|
if (m_pRegionRoom == NULL)
|
|
return -1;
|
|
|
|
AcDbRegion* pRegion = NULL;
|
|
for (int i = 0;i < m_arRegionRooms.length();i++)
|
|
{
|
|
pRegion = (AcDbRegion*)m_arRegionRooms.at(i);
|
|
if (pRegion == m_pRegionRoom)
|
|
{
|
|
return i;
|
|
}
|
|
}
|
|
return -1;
|
|
}
|
|
|
|
//添加支架
|
|
void CDGJMDlg::OnBnClickedBtaddroom2()
|
|
{
|
|
if (m_pRegionRoom == NULL)
|
|
{
|
|
AfxMessageBox(_T("请选择舱室添加支吊架!"));
|
|
return;
|
|
}
|
|
|
|
int nIndex = GetIdxOfRoom();
|
|
if (nIndex != -1)
|
|
{
|
|
CString sKey, sName;
|
|
sKey.Format(_T("%d"), nIndex);
|
|
if ( m_mapIndexToName.Lookup(sKey, sName) )
|
|
{
|
|
//计算可能分舱的四个方向的偏移量
|
|
CString sOffsets = _T("");
|
|
|
|
CStringArray arRooms;
|
|
GetRoomNames(arRooms);
|
|
|
|
if (arRooms.IsEmpty())
|
|
{
|
|
AfxMessageBox(_T("请先设置舱室名称!"));
|
|
return;
|
|
}
|
|
CGLFJDlg dlg1(PIPECABLE::eHOLDER, nIndex, m_sAddtionScr, sOffsets, m_mapAddtion, arRooms);
|
|
dlg1.DoModal();
|
|
|
|
//刷新
|
|
RedrawDrawRegion();
|
|
}
|
|
else
|
|
{
|
|
AfxMessageBox(_T("请先设置选择的舱室名称!"));
|
|
}
|
|
}
|
|
}
|
|
|
|
//添加吊架
|
|
void CDGJMDlg::OnBnClickedBtaddroom3()
|
|
{
|
|
int nIndex = GetIdxOfRoom();
|
|
if (nIndex != -1)
|
|
{
|
|
CString sKey, sName;
|
|
sKey.Format(_T("%d"), GetIdxOfRoom());
|
|
if ( m_mapIndexToName.Lookup(sKey, sName) )
|
|
{
|
|
//计算可能分舱的四个方向的偏移量
|
|
CString sOffsets = _T("");
|
|
|
|
CStringArray arRooms;
|
|
GetRoomNames(arRooms);
|
|
|
|
if (arRooms.IsEmpty())
|
|
{
|
|
AfxMessageBox(_T("请先设置舱室名称!"));
|
|
return;
|
|
}
|
|
CGLFJDlg dlg1(PIPECABLE::eHANGER, nIndex, m_sAddtionScr, sOffsets, m_mapAddtion, arRooms);
|
|
dlg1.DoModal();
|
|
|
|
//刷新
|
|
RedrawDrawRegion();
|
|
}
|
|
else
|
|
{
|
|
AfxMessageBox(_T("请先设置选择的舱室名称!"));
|
|
}
|
|
}
|
|
}
|
|
|
|
//预留管位
|
|
void CDGJMDlg::OnBnClickedBtaddroom4()
|
|
{
|
|
int nIndex = GetIdxOfRoom();
|
|
if (nIndex != -1)
|
|
{
|
|
CString sKey,sName;
|
|
sKey.Format(_T("%d"),GetIdxOfRoom());
|
|
if ( m_mapIndexToName.Lookup(sKey,sName) )
|
|
{
|
|
//预留官位只能放在主舱!!!!
|
|
//计算可能分舱的四个方向的偏移量
|
|
CString sOffsets = _T("");
|
|
|
|
CFZGWDlg dlg;
|
|
dlg.m_data.m_sSpec = sName;
|
|
if ( IDOK == dlg.DoModal() )
|
|
{
|
|
CString sBoss;
|
|
CString sPos = dlg.GetScript(sBoss,nIndex,sOffsets);
|
|
|
|
CString sKey;
|
|
sKey.Format(_T("%d-%s-BOSS"), nIndex, sPos);
|
|
|
|
if (dlg.m_bRemove)
|
|
{
|
|
m_mapAddtion.RemoveKey(sKey);
|
|
}
|
|
else
|
|
{
|
|
if (!m_mapAddtion.Lookup(sKey, sBoss))
|
|
m_mapAddtion.SetAt(sKey, sBoss);
|
|
else
|
|
{
|
|
CString str(_T(""));
|
|
str.Format(_T("管位编号:%s已经存在!"), sPos);
|
|
AfxMessageBox(str);
|
|
}
|
|
}
|
|
|
|
//刷新
|
|
RedrawDrawRegion();
|
|
}
|
|
}
|
|
else
|
|
{
|
|
AfxMessageBox(_T("请先设置选择的舱室名称!"));
|
|
}
|
|
}
|
|
else
|
|
{
|
|
AfxMessageBox(_T("请选择管廊舱室预留管位!"));
|
|
}
|
|
}
|
|
|
|
//加吊环
|
|
void CDGJMDlg::OnBnClickedBtaddroom5()
|
|
{
|
|
int nIndex = GetIdxOfRoom();
|
|
if (nIndex != -1)
|
|
{
|
|
CString sKey,sName;
|
|
sKey.Format(_T("%d"),GetIdxOfRoom());
|
|
if ( m_mapIndexToName.Lookup(sKey,sName) )
|
|
{
|
|
//计算可能分舱的四个方向的偏移量
|
|
CString sOffsets = _T("");
|
|
|
|
CTJDHDlg dlg;
|
|
if ( IDOK == dlg.DoModal() )
|
|
{
|
|
CString sRings;
|
|
int nPos = dlg.GetScript(sRings,nIndex,sOffsets);
|
|
|
|
CString sKey;
|
|
sKey.Format(_T("%d-%d-%d-RINGS"),nIndex,nPos, dlg.m_nNo);
|
|
if (dlg.m_bRemove)
|
|
{
|
|
removeAddin(dlg.m_nNo, _T("RINGS"), m_mapAddtion);
|
|
}
|
|
else
|
|
{
|
|
if (!hasAddin(dlg.m_nNo, _T("RINGS"), m_mapAddtion))
|
|
m_mapAddtion.SetAt(sKey, sRings);
|
|
else
|
|
{
|
|
CString str(_T(""));
|
|
str.Format(_T("编号:%d已经存在!"), dlg.m_nNo);
|
|
AfxMessageBox(str);
|
|
}
|
|
}
|
|
|
|
//刷新
|
|
RedrawDrawRegion();
|
|
}
|
|
}
|
|
else
|
|
{
|
|
AfxMessageBox(_T("请先设置选择的舱室名称!"));
|
|
}
|
|
}
|
|
else
|
|
{
|
|
AfxMessageBox(_T("请选择管廊舱室添加吊环!"));
|
|
}
|
|
}
|
|
|
|
//加灯具
|
|
void CDGJMDlg::OnBnClickedBtaddroom6()
|
|
{
|
|
int nIndex = GetIdxOfRoom();
|
|
if (nIndex != -1)
|
|
{
|
|
CString sKey,sName;
|
|
sKey.Format(_T("%d"),GetIdxOfRoom());
|
|
if ( m_mapIndexToName.Lookup(sKey,sName) )
|
|
{
|
|
//计算可能分舱的四个方向的偏移量
|
|
CString sOffsets = _T("");
|
|
|
|
CTJDUDlg dlg;
|
|
if ( IDOK == dlg.DoModal() )
|
|
{
|
|
CString sLamps;
|
|
int nPos = dlg.GetScript(sLamps, nIndex,sOffsets);
|
|
|
|
CString sKey;
|
|
sKey.Format(_T("%d-%d-%d-LAMPS"),nIndex,nPos, dlg.m_nNo);
|
|
if (dlg.m_bRemove)
|
|
{
|
|
removeAddin(dlg.m_nNo, _T("LAMPS"), m_mapAddtion);
|
|
}
|
|
else
|
|
{
|
|
if (!hasAddin(dlg.m_nNo, _T("LAMPS"), m_mapAddtion))
|
|
m_mapAddtion.SetAt(sKey, sLamps);
|
|
else
|
|
{
|
|
CString str(_T(""));
|
|
str.Format(_T("编号:%d已经存在!"), dlg.m_nNo);
|
|
AfxMessageBox(str);
|
|
}
|
|
}
|
|
|
|
//刷新
|
|
RedrawDrawRegion();
|
|
}
|
|
}
|
|
else
|
|
{
|
|
AfxMessageBox(_T("请先设置选择的舱室名称!"));
|
|
}
|
|
}
|
|
else
|
|
{
|
|
AfxMessageBox(_T("请选择管廊舱室添加灯具!"));
|
|
}
|
|
}
|
|
|
|
//加灭火器
|
|
void CDGJMDlg::OnBnClickedBtaddroom9()
|
|
{
|
|
int nIndex = GetIdxOfRoom();
|
|
if (nIndex != -1)
|
|
{
|
|
CString sKey, sName;
|
|
sKey.Format(_T("%d"), GetIdxOfRoom());
|
|
if ( m_mapIndexToName.Lookup(sKey, sName) )
|
|
{
|
|
//计算可能分舱的四个方向的偏移量
|
|
CString sOffsets = _T("");
|
|
|
|
CMHQDlg dlg;
|
|
if (IDOK == dlg.DoModal())
|
|
{
|
|
CString sFireet;
|
|
int nPos = dlg.GetScript(sFireet, nIndex,sOffsets);
|
|
|
|
CString sKey;
|
|
sKey.Format(_T("%d-1%d%d-%d-FIREET"), nIndex, dlg.m_nSetup, dlg.m_nHSetup, dlg.m_nNo);
|
|
if (dlg.m_bRemove)
|
|
{
|
|
removeAddin(dlg.m_nNo, _T("FIREET"), m_mapAddtion);
|
|
}
|
|
else
|
|
{
|
|
if (!hasAddin(dlg.m_nNo, _T("FIREET"), m_mapAddtion))
|
|
m_mapAddtion.SetAt(sKey, sFireet);
|
|
else
|
|
{
|
|
CString str(_T(""));
|
|
str.Format(_T("编号:%d已经存在!"), dlg.m_nNo);
|
|
AfxMessageBox(str);
|
|
}
|
|
}
|
|
|
|
//刷新
|
|
RedrawDrawRegion();
|
|
}
|
|
}
|
|
else
|
|
{
|
|
AfxMessageBox(_T("请先设置选择的舱室名称!"));
|
|
}
|
|
}
|
|
else
|
|
{
|
|
AfxMessageBox(_T("请选择管廊舱室添加灭火器!"));
|
|
}
|
|
}
|
|
|
|
//加防火门
|
|
void CDGJMDlg::OnBnClickedBtaddroom8()
|
|
{
|
|
int nIndex = GetIdxOfRoom();
|
|
if (nIndex != -1)
|
|
{
|
|
//FIREDOOR:房间|宽|高|型号|厂家
|
|
CString sKey, sName;
|
|
sKey.Format(_T("%d"), GetIdxOfRoom());
|
|
if ( m_mapIndexToName.Lookup(sKey, sName) )
|
|
{
|
|
//计算可能分舱的四个方向的偏移量
|
|
CString sOffsets = _T("");
|
|
|
|
CFMHDlg dlg;
|
|
if (IDOK == dlg.DoModal())
|
|
{
|
|
CString sFireet;
|
|
int nPos = dlg.GetScript(sFireet, nIndex,sOffsets);
|
|
|
|
CString sKey;
|
|
sKey.Format(_T("%d-%d-%d-FIREDOOR"), nIndex, nPos, dlg.m_nNo);
|
|
if (dlg.m_bRemove)
|
|
{
|
|
removeAddin(dlg.m_nNo, _T("FIREDOOR"), m_mapAddtion);
|
|
}
|
|
else
|
|
{
|
|
if (!hasAddin(dlg.m_nNo, _T("FIREDOOR"), m_mapAddtion))
|
|
m_mapAddtion.SetAt(sKey, sFireet);
|
|
else
|
|
{
|
|
CString str(_T(""));
|
|
str.Format(_T("编号:%d已经存在!"), dlg.m_nNo);
|
|
AfxMessageBox(str);
|
|
}
|
|
}
|
|
//刷新
|
|
RedrawDrawRegion();
|
|
}
|
|
}
|
|
else
|
|
{
|
|
AfxMessageBox(_T("请先设置选择的舱室名称!"));
|
|
}
|
|
}
|
|
else
|
|
{
|
|
AfxMessageBox(_T("请选择管廊舱室添加防火门!"));
|
|
}
|
|
}
|
|
|
|
//家监控
|
|
void CDGJMDlg::OnBnClickedBtaddroom10()
|
|
{
|
|
int nIndex = GetIdxOfRoom();
|
|
if (nIndex != -1)
|
|
{
|
|
//FIREDOOR:房间|宽|高|型号|厂家
|
|
CString sKey, sName;
|
|
sKey.Format(_T("%d"), GetIdxOfRoom());
|
|
if ( m_mapIndexToName.Lookup(sKey, sName) )
|
|
{
|
|
//计算可能分舱的四个方向的偏移量
|
|
CString sOffsets = _T("");
|
|
|
|
CJKSBDlg dlg;
|
|
if (IDOK == dlg.DoModal())
|
|
{
|
|
CString sSecurity;
|
|
int nPos = dlg.GetScript(sSecurity, nIndex,sOffsets);
|
|
|
|
CString sKey;
|
|
sKey.Format(_T("%d-%d-%d-SECURITY"), nIndex, nPos, dlg.m_nNo);
|
|
if (dlg.m_bRemove)
|
|
{
|
|
removeAddin(dlg.m_nNo, _T("SECURITY"), m_mapAddtion);
|
|
}
|
|
else
|
|
{
|
|
if (!hasAddin(dlg.m_nNo, _T("SECURITY"), m_mapAddtion))
|
|
m_mapAddtion.SetAt(sKey, sSecurity);
|
|
else
|
|
{
|
|
CString str(_T(""));
|
|
str.Format(_T("编号:%d已经存在!"), dlg.m_nNo);
|
|
AfxMessageBox(str);
|
|
}
|
|
}
|
|
//刷新
|
|
RedrawDrawRegion();
|
|
}
|
|
}
|
|
else
|
|
{
|
|
AfxMessageBox(_T("请先设置选择的舱室名称!"));
|
|
}
|
|
}
|
|
else
|
|
{
|
|
AfxMessageBox(_T("请选择管廊舱室添加监控!"));
|
|
}
|
|
}
|
|
|
|
//排风机
|
|
void CDGJMDlg::OnBnClickedBtaddroom7()
|
|
{
|
|
int nIndex = GetIdxOfRoom();
|
|
if (nIndex != -1)
|
|
{
|
|
//DRAFAN:房间|外径|长度|吊高|间距|风量|功率|机号|名称|型号|厂家
|
|
CString sKey, sName;
|
|
sKey.Format(_T("%d"), GetIdxOfRoom());
|
|
if ( m_mapIndexToName.Lookup(sKey, sName) )
|
|
{
|
|
//计算可能分舱的四个方向的偏移量
|
|
CString sOffsets = _T("");
|
|
|
|
CSDFJDlg dlg;
|
|
if (IDOK == dlg.DoModal())
|
|
{
|
|
CString sScript;
|
|
int nPos = dlg.GetScript(sScript, nIndex,sOffsets);
|
|
|
|
CString sKey;
|
|
sKey.Format(_T("%d-%d-%d-DRAFAN"), nIndex, nPos, dlg.m_nNo);
|
|
if (dlg.m_bRemove)
|
|
{
|
|
removeAddin(dlg.m_nNo, _T("DRAFAN"), m_mapAddtion);
|
|
}
|
|
else
|
|
{
|
|
if (!hasAddin(dlg.m_nNo, _T("DRAFAN"), m_mapAddtion))
|
|
m_mapAddtion.SetAt(sKey, sScript);
|
|
else
|
|
{
|
|
CString str(_T(""));
|
|
str.Format(_T("编号:%d已经存在!"), dlg.m_nNo);
|
|
AfxMessageBox(str);
|
|
}
|
|
}
|
|
//刷新
|
|
RedrawDrawRegion();
|
|
}
|
|
}
|
|
else
|
|
{
|
|
AfxMessageBox(_T("请先设置选择的舱室名称!"));
|
|
}
|
|
}
|
|
else
|
|
{
|
|
AfxMessageBox(_T("请选择管廊舱室添加风机!"));
|
|
}
|
|
}
|
|
|
|
//排水沟
|
|
void CDGJMDlg::OnBnClickedBtaddroom11()
|
|
{
|
|
int nIndex = GetIdxOfRoom();
|
|
if (nIndex != -1)
|
|
{
|
|
CString sKey, sName;
|
|
sKey.Format(_T("%d"), GetIdxOfRoom());
|
|
if ( m_mapIndexToName.Lookup(sKey, sName) )
|
|
{
|
|
//计算可能分舱的四个方向的偏移量
|
|
CString sOffsets = _T("");
|
|
|
|
//排水沟一律在底部
|
|
CJPSGDlg gDlg;
|
|
if (IDOK == gDlg.DoModal())
|
|
{
|
|
CString sWater;
|
|
int nPos = gDlg.GetScript(sWater, nIndex);
|
|
|
|
CString sKey;
|
|
sKey.Format(_T("%d-%d-GUTTERWAY"), 0, 0);
|
|
if (gDlg.m_bRemove)
|
|
{
|
|
m_mapAddtion.RemoveKey(sKey);
|
|
}
|
|
else
|
|
{
|
|
m_mapAddtion.SetAt(sKey, sWater);
|
|
}
|
|
|
|
//刷新
|
|
RedrawDrawRegion();
|
|
}
|
|
}
|
|
else
|
|
{
|
|
AfxMessageBox(_T("请先设置选择的舱室名称!"));
|
|
}
|
|
}
|
|
else
|
|
{
|
|
AfxMessageBox(_T("请选择管廊舱室添加排水沟!"));
|
|
}
|
|
}
|
|
|
|
//瓦斯报警器
|
|
void CDGJMDlg::OnBnClickedButton6()
|
|
{
|
|
int nIndex = GetIdxOfRoom();
|
|
if (nIndex != -1)
|
|
{
|
|
//GASALARM:房间|位置|高度|长|宽|厚|间距|名称|等级|型号|厂家
|
|
CString sKey, sName;
|
|
sKey.Format(_T("%d"), GetIdxOfRoom());
|
|
if ( m_mapIndexToName.Lookup(sKey, sName) )
|
|
{
|
|
//计算可能分舱的四个方向的偏移量
|
|
CString sOffsets = _T("");
|
|
|
|
CWSJCDlg dlg;
|
|
if (IDOK == dlg.DoModal())
|
|
{
|
|
CString sScript;
|
|
int nPos = dlg.GetScript(sScript, nIndex,sOffsets);
|
|
|
|
CString sKey;
|
|
sKey.Format(_T("%d-%d-%d-GASALARM"), nIndex, nPos, dlg.m_nNo);
|
|
if (dlg.m_bRemove)
|
|
{
|
|
removeAddin(dlg.m_nNo, _T("GASALARM"), m_mapAddtion);
|
|
}
|
|
else
|
|
{
|
|
if (!hasAddin(dlg.m_nNo, _T("GASALARM"), m_mapAddtion))
|
|
m_mapAddtion.SetAt(sKey, sScript);
|
|
else
|
|
{
|
|
CString str(_T(""));
|
|
str.Format(_T("编号:%d已经存在!"), dlg.m_nNo);
|
|
AfxMessageBox(str);
|
|
}
|
|
}
|
|
|
|
//刷新
|
|
RedrawDrawRegion();
|
|
}
|
|
}
|
|
else
|
|
{
|
|
AfxMessageBox(_T("请先设置选择的舱室名称!"));
|
|
}
|
|
}
|
|
else
|
|
{
|
|
AfxMessageBox(_T("请选择管廊舱室添加瓦斯报警器!"));
|
|
}
|
|
}
|
|
|
|
//烟雾报警器
|
|
void CDGJMDlg::OnBnClickedButton19()
|
|
{
|
|
int nIndex = GetIdxOfRoom();
|
|
if (nIndex != -1)
|
|
{
|
|
//SMOKALARM:房间|位置|高度|长|宽|厚|间距|名称|等级|型号|厂家
|
|
CString sKey, sName;
|
|
sKey.Format(_T("%d"), GetIdxOfRoom());
|
|
if ( m_mapIndexToName.Lookup(sKey, sName) )
|
|
{
|
|
//计算可能分舱的四个方向的偏移量
|
|
CString sOffsets = _T("");
|
|
|
|
CYWBJDlg dlg;
|
|
if (IDOK == dlg.DoModal())
|
|
{
|
|
CString sScript;
|
|
int nPos = dlg.GetScript(sScript, nIndex,sOffsets);
|
|
|
|
CString sKey;
|
|
sKey.Format(_T("%d-%d-%d-SMOKALARM"), nIndex, nPos, dlg.m_nNo);
|
|
if (dlg.m_bRemove)
|
|
{
|
|
removeAddin(dlg.m_nNo, _T("SMOKALARM"), m_mapAddtion);
|
|
}
|
|
else
|
|
{
|
|
if (!hasAddin(dlg.m_nNo, _T("SMOKALARM"), m_mapAddtion))
|
|
m_mapAddtion.SetAt(sKey, sScript);
|
|
else
|
|
{
|
|
CString str(_T(""));
|
|
str.Format(_T("编号:%d已经存在!"), dlg.m_nNo);
|
|
AfxMessageBox(str);
|
|
}
|
|
}
|
|
//刷新
|
|
RedrawDrawRegion();
|
|
}
|
|
}
|
|
else
|
|
{
|
|
AfxMessageBox(_T("请先设置选择的舱室名称!"));
|
|
}
|
|
}
|
|
else
|
|
{
|
|
AfxMessageBox(_T("请选择管廊舱室添加烟雾报警器!"));
|
|
}
|
|
}
|
|
|
|
//温度报警器
|
|
void CDGJMDlg::OnBnClickedButton74()
|
|
{
|
|
int nIndex = GetIdxOfRoom();
|
|
if (nIndex != -1)
|
|
{
|
|
//TEMPALARM:房间|左右侧|位置|间距|宽度|高度|厚度|名称|编号|规格|厂家|偏移
|
|
CString sKey, sName;
|
|
sKey.Format(_T("%d"), GetIdxOfRoom());
|
|
if ( m_mapIndexToName.Lookup(sKey, sName) )
|
|
{
|
|
//计算可能分舱的四个方向的偏移量
|
|
CString sOffsets = _T("");
|
|
|
|
CWDBJDlg dlg;
|
|
if (IDOK == dlg.DoModal())
|
|
{
|
|
CString sScript;
|
|
int nPos = dlg.GetScript(sScript, nIndex,sOffsets);
|
|
|
|
CString sKey;
|
|
sKey.Format(_T("%d-%d-%d-TEMPALARM"), nIndex, nPos, dlg.m_nNo);
|
|
if (dlg.m_bRemove)
|
|
{
|
|
removeAddin(dlg.m_nNo, _T("TEMPALARM"), m_mapAddtion);
|
|
}
|
|
else
|
|
{
|
|
if (!hasAddin(dlg.m_nNo, _T("TEMPALARM"), m_mapAddtion))
|
|
m_mapAddtion.SetAt(sKey, sScript);
|
|
else
|
|
{
|
|
CString str(_T(""));
|
|
str.Format(_T("编号:%d已经存在!"), dlg.m_nNo);
|
|
AfxMessageBox(str);
|
|
}
|
|
}
|
|
|
|
//刷新
|
|
RedrawDrawRegion();
|
|
}
|
|
}
|
|
else
|
|
{
|
|
AfxMessageBox(_T("请先设置选择的舱室名称!"));
|
|
}
|
|
}
|
|
else
|
|
{
|
|
AfxMessageBox(_T("请选择管廊舱室添加温度湿度报警器!"));
|
|
}
|
|
}
|
|
|
|
//CO探测器
|
|
void CDGJMDlg::OnBnClickedButton11()
|
|
{
|
|
int nIndex = GetIdxOfRoom();
|
|
if (nIndex != -1)
|
|
{
|
|
//COALARM:房间|左右侧|位置|间距|宽度|高度|厚度|名称|浓度|偏移
|
|
CString sKey, sName;
|
|
sKey.Format(_T("%d"), GetIdxOfRoom());
|
|
if ( m_mapIndexToName.Lookup(sKey, sName) )
|
|
{
|
|
//计算可能分舱的四个方向的偏移量
|
|
CString sOffsets = _T("");
|
|
|
|
CYYHTDlg dlg;
|
|
if (IDOK == dlg.DoModal())
|
|
{
|
|
CString sScript;
|
|
int nPos = dlg.GetScript(sScript, nIndex,sOffsets);
|
|
|
|
CString sKey;
|
|
sKey.Format(_T("%d-%d-%d-COALARM"), nIndex, nPos, dlg.m_nNo);
|
|
if (dlg.m_bRemove)
|
|
{
|
|
removeAddin(dlg.m_nNo, _T("COALARM"), m_mapAddtion);
|
|
}
|
|
else
|
|
{
|
|
if (!hasAddin(dlg.m_nNo, _T("COALARM"), m_mapAddtion))
|
|
m_mapAddtion.SetAt(sKey, sScript);
|
|
else
|
|
{
|
|
CString str(_T(""));
|
|
str.Format(_T("编号:%d已经存在!"), dlg.m_nNo);
|
|
AfxMessageBox(str);
|
|
}
|
|
}
|
|
|
|
//刷新
|
|
RedrawDrawRegion();
|
|
}
|
|
}
|
|
else
|
|
{
|
|
AfxMessageBox(_T("请先设置选择的舱室名称!"));
|
|
}
|
|
}
|
|
else
|
|
{
|
|
AfxMessageBox(_T("请选择管廊舱室添加温度湿度报警器!"));
|
|
}
|
|
}
|
|
|
|
//O2探测器
|
|
void CDGJMDlg::OnBnClickedButton81()
|
|
{
|
|
int nIndex = GetIdxOfRoom();
|
|
if (nIndex != -1)
|
|
{
|
|
//OXALARM:房间|左右侧|位置|间距|宽度|高度|厚度|名称|采样方式|测量精度|厂家|偏移
|
|
CString sKey, sName;
|
|
sKey.Format(_T("%d"), GetIdxOfRoom());
|
|
if ( m_mapIndexToName.Lookup(sKey, sName) )
|
|
{
|
|
//计算可能分舱的四个方向的偏移量
|
|
CString sOffsets = _T("");
|
|
|
|
CYQTCDlg dlg;
|
|
if (IDOK == dlg.DoModal())
|
|
{
|
|
CString sScript;
|
|
int nPos = dlg.GetScript(sScript, nIndex,sOffsets);
|
|
|
|
CString sKey;
|
|
sKey.Format(_T("%d-%d-%d-OXALARM"), nIndex, nPos, dlg.m_nNo);
|
|
if (dlg.m_bRemove)
|
|
{
|
|
removeAddin(dlg.m_nNo, _T("OXALARM"), m_mapAddtion);
|
|
}
|
|
else
|
|
{
|
|
if (!hasAddin(dlg.m_nNo, _T("OXALARM"), m_mapAddtion))
|
|
m_mapAddtion.SetAt(sKey, sScript);
|
|
else
|
|
{
|
|
CString str(_T(""));
|
|
str.Format(_T("编号:%d已经存在!"), dlg.m_nNo);
|
|
AfxMessageBox(str);
|
|
}
|
|
}
|
|
//刷新
|
|
RedrawDrawRegion();
|
|
}
|
|
}
|
|
else
|
|
{
|
|
AfxMessageBox(_T("请先设置选择的舱室名称!"));
|
|
}
|
|
}
|
|
else
|
|
{
|
|
AfxMessageBox(_T("请选择管廊舱室添加温度湿度报警器!"));
|
|
}
|
|
}
|
|
//横断出图
|
|
extern BOOL OutDrawing(LPCTSTR pszDrawFileSub, AcDbVoidPtrArray& arEntPtrs, const AcGeVector3d& vtDir, bool bIsShowEntPtrs,bool bAddToModelSpace, bool hasDim = true);
|
|
void CDGJMDlg::OnBnClickedButton3()
|
|
{
|
|
EnableWindow(FALSE);
|
|
CWnd* pFrame = acedGetAcadFrame();
|
|
pFrame->EnableWindow(TRUE);
|
|
ShowWindow(SW_HIDE);
|
|
pFrame->SetFocus();
|
|
|
|
AcDbVoidPtrArray arDrawffer;
|
|
GetDrawBuffer(arDrawffer);
|
|
|
|
AcAxDocLock lock;
|
|
|
|
/*AcDbObjectId id;
|
|
AcDbEntity* pEnt = NULL;
|
|
for (int i = 0;i < arDrawffer.length();i++)
|
|
{
|
|
pEnt = (AcDbEntity*)arDrawffer.at(i);
|
|
AddToModelSpace(pEnt,id,NULL,true);
|
|
}*/
|
|
|
|
bool bAddToModelSpace = false;
|
|
int nRelt = 0;
|
|
int nRes = acedGetInt(_T("\n请选择断面出图空间[布局空间(0)/模型空间(1)]<布局空间>:"),&nRelt);
|
|
if (nRes == RTCAN )
|
|
{
|
|
pFrame->EnableWindow(FALSE);
|
|
EndDialog(IDCANCLE);
|
|
return;
|
|
}
|
|
|
|
if (nRelt == 1)
|
|
bAddToModelSpace = true;
|
|
|
|
OutDrawing(LAYOUTNAME_HD, arDrawffer, AcGeVector3d::kXAxis, true,bAddToModelSpace);
|
|
|
|
pFrame->EnableWindow(FALSE);
|
|
EndDialog(IDCANCLE);
|
|
}
|
|
|
|
int CDGJMDlg::GetDrawBuffer(AcDbVoidPtrArray& arDrawbuffer) const
|
|
{
|
|
if (!m_arDrawBuffer.isEmpty())
|
|
{
|
|
AcDbEntity* pEnt = NULL,*pEntClone = NULL;
|
|
for (int i = 0;i < m_arDrawBuffer.length();i++)
|
|
{
|
|
pEnt = (AcDbEntity*)m_arDrawBuffer.at(i);
|
|
if (pEnt != NULL)
|
|
{
|
|
AcDbRegion* pReg = AcDbRegion::cast(pEnt);
|
|
if (pReg != NULL)
|
|
{
|
|
pReg->explode(arDrawbuffer);
|
|
}
|
|
else
|
|
{
|
|
pEntClone = (AcDbEntity*)pEnt->clone();
|
|
arDrawbuffer.append(pEntClone);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return arDrawbuffer.length();
|
|
} |