633 lines
16 KiB
C++
633 lines
16 KiB
C++
#include "stdafx.h"
|
|
#include "jig.h"
|
|
#include "DimMutiPipeEditDlg.h"
|
|
|
|
#ifdef _DEBUG
|
|
#define new DEBUG_NEW
|
|
#undef THIS_FILE
|
|
static char THIS_FILE[] = __FILE__;
|
|
#endif
|
|
|
|
|
|
//***************************************************************************************************
|
|
// 多管标注修改
|
|
//***************************************************************************************************
|
|
// zxl 2012.09.07 add
|
|
bool GetCurrentElev(TDbPipe *pPipe, double &dEle, TDbPipeMultDim *pDim)
|
|
{
|
|
if (pPipe == NULL || pDim == NULL)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
XPoint ptStart, ptEnd;
|
|
ptStart = pDim->GetStartPoint();
|
|
ptEnd = pDim->GetTurnPoint();
|
|
XLine lineBase(ptStart, ptEnd, 1);
|
|
lineBase.StartPoint().z = 0;
|
|
lineBase.EndPoint().z = 0;
|
|
XPoint ptInt;
|
|
|
|
XPoint ptS = pPipe->GetStartPoint(), ptE = pPipe->GetEndPoint();
|
|
XLine line(ptS, ptE, 1);
|
|
line.StartPoint().z = 0;
|
|
line.EndPoint().z = 0;
|
|
int ret = line.Intersection(&lineBase, ptInt); // 管线与标注线交点
|
|
if(!ptInt)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
line.StartPoint().z = ptS.z;
|
|
line.EndPoint().z = ptE.z;
|
|
pPipe->getClosestPointTo(ptInt, AcGeVector3d::kZAxis, ptInt); // 交点到管线中心线的z轴投影
|
|
dEle = ptInt.z;
|
|
if(!DocGetMeterUnitDraw())
|
|
{
|
|
dEle *= 0.001;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
int EditMutiPipeDim(AcDbObjectId idDim)
|
|
{
|
|
CTemporaryResourceOverride vTemp;
|
|
CDimMutiPipeEditDlg dlg;
|
|
dlg.m_idDim = idDim;
|
|
OPENOBJ_BEGIN(idDim, AcDb::kForRead, TDbPipeMultDim, pDim);
|
|
if(pDim){
|
|
pDim->GetPipes(dlg.m_lstId);
|
|
dlg.m_dHeight = pDim->GetTextHeight();
|
|
dlg.m_csTextStyle = GetSymbolName(pDim->GetTextStyleId());
|
|
dlg.m_nDimType = pDim->GetDimType();
|
|
dlg.m_nAlignType = pDim->GetDimAlignType();
|
|
dlg.m_dDist2Line = pDim->GetDimDist2Line();
|
|
dlg.m_nDimFloorNumType = pDim->GetDimFloorNumType();// ZXL 2013.11.12 ADD
|
|
|
|
CString sText = pDim->GetPipePrefix();
|
|
if (sText.IsEmpty())
|
|
{
|
|
sText = _T("无");
|
|
}
|
|
dlg.m_sPipePrefix = sText;
|
|
|
|
// cet 2011.4.26 add
|
|
if (dlg.m_nDimType == 3)
|
|
{
|
|
dlg.m_nDimType = 2;
|
|
}
|
|
else if (dlg.m_nDimType == 4)// zxl 2012.06.28 add
|
|
{
|
|
dlg.m_nDimType = 3;
|
|
}
|
|
else if (dlg.m_nDimType == 5)// zxl 2013.01.21 add
|
|
{
|
|
dlg.m_nDimType = 4;
|
|
}
|
|
DList<AcDbObjectId> lstPipe;
|
|
std::vector<double> vecElev;
|
|
pDim->GetPipes(lstPipe);
|
|
BOOL bAllVer = TRUE;
|
|
for (int i = 0; i < lstPipe.Length(); i++)
|
|
{
|
|
AcDbObjectId id = *lstPipe[i];
|
|
TDbPipe *pPipe = NULL;
|
|
double dElev = 0.0;
|
|
acdbOpenObject(pPipe, id, AcDb::kForRead);
|
|
if (pPipe != NULL)
|
|
{
|
|
if (bAllVer)
|
|
{
|
|
bAllVer = pPipe->IsVertical();
|
|
}
|
|
// zxl 2012.09.07 add
|
|
if (GetCurrentElev(pPipe, dElev, pDim))
|
|
{
|
|
vecElev.push_back(dElev);
|
|
}
|
|
|
|
pPipe->close();
|
|
}
|
|
}
|
|
dlg.SetShowEle(bAllVer);
|
|
dlg.SetElevs(vecElev); // zxl 2012.09.07 add
|
|
}
|
|
OPENOBJ_END();
|
|
if(dlg.DoModal() != IDOK)
|
|
return RTNORM;
|
|
|
|
OPENOBJ_BEGIN(idDim, AcDb::kForWrite, TDbPipeMultDim, pDim);
|
|
if(pDim){
|
|
pDim->SetPipes(dlg.m_lstId);
|
|
pDim->SetTextHeight(dlg.m_dHeight);
|
|
// zxl 2013.01.21 add
|
|
pDim->SetDimAlignType(dlg.m_nAlignType);
|
|
pDim->SetDimDist2Line(dlg.m_dDist2Line);
|
|
if (dlg.m_sPipePrefix.Compare(_T("无")) == 0)
|
|
{
|
|
dlg.m_sPipePrefix = _T("");
|
|
}
|
|
pDim->SetPipePrefix(dlg.m_sPipePrefix);
|
|
// cet 2011.4.26 modify
|
|
//pDim->SetDimType(dlg.m_nDimType);
|
|
if (dlg.m_nDimType == 2)
|
|
{
|
|
pDim->SetDimType(3);
|
|
}
|
|
else if (dlg.m_nDimType == 3)// zxl 2012.06.28 add
|
|
{
|
|
pDim->SetDimType(4);
|
|
}
|
|
else if (dlg.m_nDimType == 4)// zxl 2013.01.21 add
|
|
{
|
|
pDim->SetDimType(5);
|
|
CString csText; // 更新管代号
|
|
{
|
|
for (int i = 0; i < dlg.m_lstId.Length(); i++)
|
|
{
|
|
AcDbObjectId id = *(dlg.m_lstId[i]);
|
|
ads_name name;
|
|
acdbGetAdsName(name, id);
|
|
Entity ent = name;
|
|
TCHAR szLayer[255];
|
|
ent.GetData(8, szLayer);
|
|
int idx = GetPipeLayerIdxByName(szLayer);
|
|
CString sLabel;
|
|
if(idx >= 0)
|
|
sLabel = g_csPipeDim[idx];
|
|
sLabel += _T(",");
|
|
csText += sLabel;
|
|
}
|
|
pDim->SetPipeLabel(csText);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
pDim->SetDimType(dlg.m_nDimType);
|
|
}
|
|
pDim->SetDimFloorNumType(dlg.m_nDimFloorNumType);// ZXL 2013.11.12 ADD 设置楼号标注样式
|
|
pDim->SetTextStyleId(GetTextStyleId(dlg.m_csTextStyle));
|
|
// zxl 2013.01.21 add
|
|
//if (fabs(pDim->GetDefaultTextBaseLen()) > fabs(pDim->GetTextBaseLen())) zxl 20133.04.22 del
|
|
{
|
|
if (pDim->GetTextBaseLen() < 0)
|
|
{
|
|
pDim->SetTextBaseLen(-pDim->GetDefaultTextBaseLen());
|
|
}
|
|
else
|
|
{
|
|
pDim->SetTextBaseLen(pDim->GetDefaultTextBaseLen());
|
|
}
|
|
}
|
|
}
|
|
OPENOBJ_END();
|
|
return RTNORM;
|
|
}
|
|
|
|
void ModidyMultiDimDn()
|
|
{
|
|
Entity entSel;
|
|
//cet 2012.3.27 modify
|
|
//RBList rbMask(RTDXF0, _T("ATS_PIPEMULTDIM"), 8, LAY_OTHER_DIM, NULL);
|
|
RBList rbMask(RTDXF0, _T("ATS_PIPEMULTDIM"), NULL);
|
|
if(SelectEntity(_T("\n请选择要修改的标注:<退出>"), entSel, rbMask) != RTNORM)
|
|
return;
|
|
AcDbObjectId idDim=NULL;
|
|
acdbGetObjectId(idDim, entSel);
|
|
EditMutiPipeDim(idDim);
|
|
|
|
// PickSet ss(SS_FREE);
|
|
// ss += entSel;
|
|
// UpdateGraphic(ss);
|
|
}
|
|
|
|
CDimMutiPipeEditDlg::CDimMutiPipeEditDlg(CWnd* pParent /*=NULL*/)
|
|
: CDialog(CDimMutiPipeEditDlg::IDD, pParent)
|
|
{
|
|
//{{AFX_DATA_INIT(CDimMutiPipeEditDlg)
|
|
m_dHeight = 0.0;
|
|
m_nStyle = -1;
|
|
m_nDimType = -1;
|
|
m_dDist2Line = 2;
|
|
m_nAlignType = 0;
|
|
m_sPipePrefix = _T("");
|
|
m_nDimFloorNumType = 0;// ZXL 2013.11.12 ADD
|
|
//}}AFX_DATA_INIT
|
|
}
|
|
|
|
|
|
void CDimMutiPipeEditDlg::DoDataExchange(CDataExchange* pDX)
|
|
{
|
|
CDialog::DoDataExchange(pDX);
|
|
//{{AFX_DATA_MAP(CDimMutiPipeEditDlg)
|
|
DDX_Control(pDX, IDC_COMBO_TEXTSTYLE, m_comboStyle);
|
|
DDX_Text(pDX, IDC_EDIT_HEIGHT, m_dHeight);
|
|
DDX_CBIndex(pDX, IDC_COMBO_TEXTSTYLE, m_nStyle);
|
|
DDX_Radio(pDX, IDC_RADIO_TYPE1, m_nDimType);
|
|
DDX_Text(pDX, IDC_EDIT_DIST, m_dDist2Line);
|
|
DDX_CBIndex(pDX, IDC_COMBO_ALIGN, m_nAlignType);
|
|
DDX_Control(pDX, IDC_COMBO_PREFIX, m_comPipePreFix);
|
|
DDX_Text(pDX, IDC_COMBO_PREFIX, m_sPipePrefix);
|
|
DDX_CBIndex(pDX, IDC_COMBO_VPIPEDIM, m_nDimFloorNumType);// ZXL 2013.11.12 ADD
|
|
//}}AFX_DATA_MAP
|
|
}
|
|
|
|
|
|
BEGIN_MESSAGE_MAP(CDimMutiPipeEditDlg, CDialog)
|
|
//{{AFX_MSG_MAP(CDimMutiPipeEditDlg)
|
|
ON_BN_CLICKED(IDC_BUTTON_LOCAT, OnButtonLocat)
|
|
ON_BN_CLICKED(IDC_BUTTON_ADD, OnButtonAdd)
|
|
ON_BN_CLICKED(IDC_BUTTON_DEL, OnButtonDel)
|
|
//}}AFX_MSG_MAP
|
|
END_MESSAGE_MAP()
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
// CDimMutiPipeEditDlg message handlers
|
|
|
|
BOOL CDimMutiPipeEditDlg::OnInitDialog()
|
|
{
|
|
CDialog::OnInitDialog();
|
|
|
|
XSymbolList lstStyle(_T("STYLE"));
|
|
for (int m =0; m < lstStyle.Length(); m++) {
|
|
m_comboStyle.AddString(lstStyle[m]);
|
|
if(_tcsicmp(m_csTextStyle, lstStyle[m]) == 0){
|
|
m_nStyle = m;
|
|
}
|
|
}
|
|
|
|
//zxl 2012.09.07 modify
|
|
// m_grid.AppendCol(_T("编号"), 50);
|
|
// m_grid.AppendCol(_T("标注类型"), 50);
|
|
// m_grid.AppendCol(_T("管径"), 50);
|
|
// m_grid.AppendCol(_T("坡度"), 50);
|
|
if (m_bShowEle)
|
|
{
|
|
m_grid.AppendCol(_T("编号"), 60);
|
|
m_grid.AppendCol(_T("标注类型"), 70);
|
|
m_grid.AppendCol(_T("管径"), 50);
|
|
m_grid.AppendCol(_T("坡度"), 60);
|
|
m_grid.AppendCol(_T("楼号"), 50);
|
|
}
|
|
else
|
|
{
|
|
m_grid.AppendCol(_T("编号"), 60);
|
|
m_grid.AppendCol(_T("标注类型"), 70);
|
|
m_grid.AppendCol(_T("管径"), 50);
|
|
m_grid.AppendCol(_T("坡度"), 60);
|
|
m_grid.AppendCol(_T("标高"), 50);
|
|
}
|
|
|
|
m_grid.Clear();
|
|
|
|
// 设定每一列文字居中 zxl 2013.01.23 add
|
|
for (int j = 0; j < m_grid.GetColNum(); j++)
|
|
{
|
|
m_grid.GetCol(j).SetCenterAlign(true);
|
|
}
|
|
m_grid.Create(this, IDC_LIST_DN);
|
|
m_grid.FitLastCol();
|
|
m_grid.SetWnd(this);
|
|
m_grid.SetNoAppendButton(TRUE);
|
|
m_grid.SetNoDefaultMenu(true);
|
|
|
|
|
|
for(int i=0;i<m_lstId.Length();i++){
|
|
AcDbObjectId id = *m_lstId[i];
|
|
CString csText, csDn, csI;
|
|
double nDn(0), dI(0);
|
|
ads_name ent2;
|
|
Entity ent;
|
|
acdbGetAdsName(ent2, id);
|
|
ent = ent2;
|
|
CString csSerial = ReadXdata(ent, _T("PIPE-SERIAL"));
|
|
CString csFloor = ReadXdata(ent, _T("BUILDING-SERIAL"));
|
|
double dElev = 0.0;
|
|
|
|
OPENOBJ_BEGIN(id, AcDb::kForRead, TDbPipe, pPipe)
|
|
if(pPipe){
|
|
csText = pPipe->GetLabel();
|
|
nDn = pPipe->GetDnDiameter();
|
|
csDn.Format(_T("%.0f"), nDn);
|
|
dI = pPipe->GetPipeGradient();
|
|
csI.Format(_T("%.4f"), dI);
|
|
}
|
|
else{
|
|
m_lstId.Remove(i);
|
|
i--;
|
|
continue;
|
|
}
|
|
OPENOBJ_END()
|
|
m_grid.AppendRow();
|
|
|
|
m_grid.GetCell(i, 0).SetText(csSerial);
|
|
m_grid.GetCell(i, 1).SetText(csText);
|
|
m_grid.GetCell(i, 2).SetText(csDn);
|
|
m_grid.GetCell(i, 3).SetText(csI);
|
|
|
|
// zxl 2012.09.07 add
|
|
if (!m_bShowEle)
|
|
{
|
|
double dEle = 0.0;
|
|
if (i < m_vecElev.size())
|
|
{
|
|
dEle = m_vecElev[i];
|
|
}
|
|
CString sEle;
|
|
sEle.Format(_T("%.3f"), dEle);
|
|
m_grid.GetCell(i, 4).SetText(sEle);
|
|
}
|
|
else
|
|
{
|
|
m_grid.GetCell(i, 4).SetText(csFloor);
|
|
}
|
|
}
|
|
|
|
m_grid.Refresh();
|
|
|
|
// cet 2011.4.26 add
|
|
if (m_bShowEle)
|
|
{
|
|
CWnd *pWnd = GetDlgItem(IDC_RADIO_ELE);
|
|
if (pWnd != NULL)
|
|
{
|
|
pWnd->ShowWindow(SW_HIDE);
|
|
}
|
|
CWnd *pWnd1 = GetDlgItem(IDC_RADIO_DNANDELE);
|
|
if (pWnd1 != NULL)
|
|
{
|
|
pWnd1->ShowWindow(SW_HIDE);
|
|
}
|
|
|
|
// zxl 2013.01.21 add
|
|
CWnd *pWnd2 = GetDlgItem(IDC_RADIO_TYPE3);
|
|
if (pWnd2 != NULL)
|
|
{
|
|
pWnd2->ShowWindow(SW_HIDE);
|
|
}
|
|
CWnd *pWnd3 = GetDlgItem(IDC_COMBO_PREFIX);
|
|
if (pWnd3 != NULL)
|
|
{
|
|
pWnd3->ShowWindow(SW_HIDE);
|
|
}
|
|
CWnd *pWnd4 = GetDlgItem(IDC_STATIC_PREFIX);
|
|
if (pWnd4 != NULL)
|
|
{
|
|
pWnd4->ShowWindow(SW_HIDE);
|
|
}
|
|
}
|
|
else// ZXL 2013.11.12 ADD
|
|
{
|
|
CWnd *pWnd = GetDlgItem(IDC_STATIC_UNIT3);
|
|
if (pWnd != NULL)
|
|
{
|
|
pWnd->ShowWindow(SW_HIDE);
|
|
}
|
|
CWnd *pWnd1 = GetDlgItem(IDC_COMBO_VPIPEDIM);
|
|
if (pWnd1 != NULL)
|
|
{
|
|
pWnd1->ShowWindow(SW_HIDE);
|
|
}
|
|
}
|
|
|
|
UpdateData(FALSE);
|
|
return TRUE; // return TRUE unless you set the focus to a control
|
|
// EXCEPTION: OCX Property Pages should return FALSE
|
|
}
|
|
|
|
void CDimMutiPipeEditDlg::OnOK()
|
|
{
|
|
UpdateData(TRUE);
|
|
m_comboStyle.GetLBText(m_nStyle, m_csTextStyle);
|
|
int num = m_grid.GetRowNum();
|
|
for(m_grid.MoveToFirst(); !m_grid.IsOut(); m_grid.MoveToNext()){
|
|
WDGridRow *pRow = m_grid.CurRow();
|
|
|
|
CString csName = (*pRow)[0].GetText().cs();
|
|
CString csType = (*pRow)[1].GetText().cs();
|
|
CString csDn = (*pRow)[2].GetText().cs();
|
|
CString csI = (*pRow)[3].GetText().cs();
|
|
CString csFloor = (*pRow)[4].GetText().cs();
|
|
|
|
// zxl 2012.09.07 add
|
|
CString csEle;
|
|
if (!m_bShowEle)
|
|
{
|
|
csEle = (*pRow)[4].GetText();
|
|
}
|
|
|
|
int idx = pRow->GetIndex();
|
|
AcDbObjectId id = *m_lstId[idx];
|
|
double dOldEle = 0.0;
|
|
if (idx < m_vecElev.size())
|
|
{
|
|
dOldEle = m_vecElev[idx];
|
|
}
|
|
double dEleChange = _tstof(csEle) - dOldEle;
|
|
|
|
//ZXL 2012.06.29 ADD 增加修改编号功能
|
|
ads_name name;
|
|
acdbGetAdsName(name, id);
|
|
Entity ent = name;
|
|
WriteXdata(ent, _T("PIPE-SERIAL"), csName);
|
|
WriteXdata(ent, _T("BUILDING-SERIAL"), csFloor);
|
|
|
|
OPENOBJ_BEGIN(id, AcDb::kForWrite, TDbPipe, pPipe)
|
|
if(pPipe){
|
|
// zxl 2012.09.07 add
|
|
if (dEleChange > 0.001 || dEleChange < -0.001)
|
|
{
|
|
if(!DocGetMeterUnitDraw())
|
|
{
|
|
dEleChange *= 1000;
|
|
}
|
|
XPoint ptS, ptE;
|
|
pPipe->GetStartPoint(ptS);
|
|
pPipe->getEndPoint(ptE);
|
|
ptS.z += dEleChange;
|
|
ptE.z += dEleChange;
|
|
pPipe->SetStartPoint(ptS);
|
|
pPipe->SetEndPoint(ptE);
|
|
}
|
|
|
|
pPipe->SetLabel(csType);
|
|
pPipe->SetDnDiameter(_tstof(csDn));
|
|
pPipe->SetPipeGradient(_tstof(csI));
|
|
}
|
|
OPENOBJ_END()
|
|
}
|
|
|
|
CDialog::OnOK();
|
|
}
|
|
|
|
void CDimMutiPipeEditDlg::OnButtonLocat()
|
|
{
|
|
long idx = m_grid.GetCurRowIndex();
|
|
int nColorIdx = 0;
|
|
AcDbObjectId id = NULL;
|
|
if(idx > -1){
|
|
WDGridRow *pRow = &m_grid.GetRow(idx);
|
|
int idx = pRow->GetIndex();
|
|
id = *m_lstId[idx];
|
|
OPENOBJ_BEGIN(id, AcDb::kForWrite, TDbPipe, pPipe)
|
|
if(pPipe){
|
|
nColorIdx = pPipe->colorIndex();
|
|
pPipe->setColorIndex(7);
|
|
}
|
|
OPENOBJ_END()
|
|
}
|
|
|
|
HideDialog(this, TRUE);
|
|
TCHAR szTmp[256];
|
|
ads_getstring(NULL, _T("\n按任意键返回对话框:<返回>"), szTmp);
|
|
OPENOBJ_BEGIN(id, AcDb::kForWrite, TDbPipe, pPipe)
|
|
if(pPipe){
|
|
pPipe->setColorIndex(nColorIdx);
|
|
}
|
|
OPENOBJ_END()
|
|
|
|
HideDialog(this, FALSE);
|
|
|
|
}
|
|
|
|
void CDimMutiPipeEditDlg::OnButtonDel()
|
|
{
|
|
RBList rbMask(RTDXF0, _T("ATS_PIPE"), NULL);
|
|
Entity ent;
|
|
HideDialog(this, TRUE);
|
|
if(SelectEntity(_T("\n请选择要删除管线:<退出>"), ent, rbMask) != RTNORM){
|
|
HideDialog(this, FALSE);
|
|
return;
|
|
}
|
|
AcDbObjectId id = NULL;
|
|
acdbGetObjectId(id, ent);
|
|
for(int i=0;i<m_lstId.Length();i++){
|
|
AcDbObjectId id2 = *m_lstId[i];
|
|
if(id == id2){
|
|
m_lstId.Remove(i);
|
|
m_grid.DelRow(i);
|
|
break;
|
|
}
|
|
}
|
|
HideDialog(this, FALSE);
|
|
|
|
}
|
|
|
|
void CDimMutiPipeEditDlg::OnButtonAdd()
|
|
{
|
|
RBList rbMask(RTDXF0, _T("ATS_PIPE"), NULL);
|
|
Entity ent;
|
|
HideDialog(this, TRUE);
|
|
if(SelectEntity(_T("\n请选择新管线:<退出>"), ent, rbMask) != RTNORM){
|
|
HideDialog(this, FALSE);
|
|
return;
|
|
}
|
|
XPoint ptStart, ptTurn, pt1, pt2, ptInt, ptInt2;
|
|
OPENOBJ_BEGIN(m_idDim, AcDb::kForRead, TDbPipeMultDim, pDim);
|
|
if(pDim){
|
|
ptStart = pDim->GetStartPoint();
|
|
ptTurn = pDim->GetTurnPoint();
|
|
}
|
|
OPENOBJ_END();
|
|
XLine line(ptStart, ptTurn, 1);
|
|
|
|
|
|
OPENOBJ_BEGIN(ent, AcDb::kForRead, TDbPipe, pPipe)
|
|
if(pPipe)
|
|
{
|
|
pt1 = pPipe->StartPoint();
|
|
pt1.z = 0;
|
|
pt2 = pPipe->EndPoint();
|
|
pt2.z = 0;
|
|
}
|
|
OPENOBJ_END()
|
|
XLine line2(pt1, pt2, 1);
|
|
int ret = line.Intersection(&line2, ptInt);
|
|
PointList lstPt(ptStart, ptTurn, 0);
|
|
if(!!ptInt){
|
|
lstPt.Insert(ptInt);
|
|
for(int i=0;i<m_lstId.Length();i++){
|
|
AcDbObjectId id2 = *m_lstId[i];
|
|
OPENOBJ_BEGIN(id2, AcDb::kForRead, TDbPipe, pPipe)
|
|
if(pPipe){
|
|
pt1 = pPipe->StartPoint();
|
|
pt1.z = 0;
|
|
pt2 = pPipe->EndPoint();
|
|
pt2.z = 0;
|
|
}
|
|
OPENOBJ_END()
|
|
XLine line3(pt1, pt2, 1);
|
|
line.Intersection(&line3, ptInt2);
|
|
if(!!ptInt2){
|
|
lstPt.Insert(ptInt2);
|
|
}
|
|
}
|
|
}
|
|
lstPt.Remove(lstPt.Length()-1);
|
|
lstPt.Remove(0);
|
|
|
|
AcDbObjectId id = NULL;
|
|
acdbGetObjectId(id, ent);
|
|
for(int j=0;j<lstPt.Length();j++){
|
|
XPoint ptTmp = *lstPt[j];
|
|
if(ptInt == ptTmp){
|
|
CString csText, csDn, csI;
|
|
double nDn(0), dI(0);
|
|
if(m_lstId.Length()>j)
|
|
{
|
|
m_lstId[j];
|
|
m_lstId.Insert(new AcDbObjectId(id));
|
|
}
|
|
else
|
|
{
|
|
m_lstId.Append(new AcDbObjectId(id));
|
|
}
|
|
OPENOBJ_BEGIN(id, AcDb::kForRead, TDbPipe, pPipe)
|
|
if(pPipe){
|
|
csText = pPipe->GetLabel();
|
|
nDn = pPipe->GetDnDiameter();
|
|
csDn.Format(_T("%.0f"), nDn);
|
|
dI = pPipe->GetPipeGradient();
|
|
csI.Format(_T("%.4f"), dI);
|
|
}
|
|
OPENOBJ_END()
|
|
CString csSerial = ReadXdata(ent, _T("PIPE-SERIAL"));
|
|
m_grid.InsertRow(j);
|
|
m_grid.GetCell(j, 0).SetText(csSerial);
|
|
m_grid.GetCell(j, 1).SetText(csText);
|
|
m_grid.GetCell(j, 2).SetText(csDn);
|
|
m_grid.GetCell(j, 3).SetText(csI);
|
|
|
|
break;
|
|
}
|
|
}
|
|
|
|
|
|
HideDialog(this, FALSE);
|
|
|
|
}
|
|
|
|
void CDimMutiPipeEditDlg::SetShowEle(BOOL bShow)
|
|
{
|
|
m_bShowEle = bShow;
|
|
}
|
|
|
|
WDGridClick ::WDGridClick()
|
|
{
|
|
|
|
}
|
|
|
|
// zxl 2012.09.07 add
|
|
void WDGridClick::OnDblClick(WDGridRow&row)
|
|
{
|
|
if (m_pWnd != NULL)
|
|
{
|
|
m_pWnd->OnButtonLocat();
|
|
}
|
|
}
|
|
|
|
// zxl 2012.09.07 add
|
|
void WDGridClick::SetWnd(CDimMutiPipeEditDlg* pWnd)
|
|
{
|
|
m_pWnd = pWnd;
|
|
} |