Files
envi-code/SourceCode/Code2026/tg_shs/shs_pipewire/DbFloorPipe.cpp
T
2026-09-28 15:28:50 +08:00

1755 lines
53 KiB
C++
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// DbFloorPipe.cpp: implementation of the TDbFloorPipe class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "DbFloorPipe.h"
#include "PipeTools.h"
#include "PipeStyle1.h"
#include "PipeStyle2.h"
#include "PipeStyle3.h"
#include "PipeStyle4.h"
#include "PipeStyle5.h"
#include "PipeStyle6.h"
ACRX_DXF_DEFINE_MEMBERS(ATSFloorPipe, ATSEntity, AcDb::kDHL_CURRENT,
AcDb::kMReleaseCurrent, 1, ATS_FLOORPIPE,
"ATS_FLOORPIPE图形无法解析, 请下载上华软件|网址: www.shanghuasoft.com");
IMPLEMENT_TENTBASE(TDbFloorPipe);
// sg modify,1——>2,增加了线宽和颜色
// const Adesk::UInt8 TDbFloorPipe::g_nVersion = 1;
// sg modify,2——>3,增加了曲率半径、距墙距离等
// const Adesk::UInt8 TDbFloorPipe::g_nVersion = 2;
// modify by cq 2015-07-24 3-->4 // 增加了回折型盘管外边界宽度和间距等和任意开口功能
// const Adesk::UInt8 TDbFloorPipe::g_nVersion = 3;
const Adesk::UInt8 TDbFloorPipe::g_nVersion = 4;
// 自PipeLine.cpp中
extern double GetArcRadius(double dbInput);
void InitDbFloorPipe(BOOL bTrue)
{
if (bTrue)
{
TDbFloorPipe::rxInit();
TDbFloorPipe::InitMatchProtocol(TRUE);
}
else
{
TDbFloorPipe::InitMatchProtocol(FALSE);
deleteAcRxClass(TDbFloorPipe::desc());
}
}
XPoint TDbFloorPipe:: m_ptStartDraw;
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
TDbFloorPipe::TDbFloorPipe()
{
m_nPipeType = 1;
m_nEntryType = 1;
m_dbPGAngle = 0;
m_dDistToWall = 100; // sg add
m_bWeight = FALSE;
m_dLineWeight = 0.35;
m_dRadius = 0;
m_nAreaType = 0;
m_dLeftArea = 1000;
m_dRightArea = 1000;
m_bSameDist = TRUE;
m_bIsHighlight = FALSE;
m_bLeftChk = TRUE;
m_bRightChk = TRUE;
m_bTopChk = TRUE;
m_bBottomChk = TRUE;
}
TDbFloorPipe::~TDbFloorPipe()
{
}
// 设置管线间距
void TDbFloorPipe::SetPipeDist(double nDist, const BOOL &bPassAllDist)
{
assertWriteEnabled();
m_nPipeDist = nDist;
if (bPassAllDist) // 给所有的间距赋值
{
m_bSameDist = TRUE;
m_nPipeLeftDist = nDist;
m_nPipeRightDist = nDist;
m_nPipeTopDist = nDist;
if( 1 == m_nPipeType )
m_nPipeBottomDist = nDist;
}
}
// 统一间距
void TDbFloorPipe::SetParam(XPoint ptStart, XPoint ptEnd, int nDist, double dbPGAngle, int nEntryType,
int nPipeType, int nDistB)
{
assertWriteEnabled();
// mcl add 2010.11.19 这些参数改变时要清空 供回绘制点,按重新计算
if (ptStart.Distance(m_ptStart) > 1 || ptEnd.Distance(ptEnd) > 1
|| fabs(nDist - m_nPipeDist) > 1 || nEntryType != m_nEntryType
|| fabs(nDistB - m_nPipeBottomDist) > 1
|| (nPipeType != m_nPipeType && (m_nPipeType == 2 || nPipeType == 2)
|| !m_bSameDist)
)
{
ClearDrawPt();
}
m_ptStart = ptStart;
m_ptEnd = ptEnd;
m_dbPGAngle = dbPGAngle;
m_nEntryType = nEntryType;
m_nPipeType = nPipeType;
SetPipeDist(nDist);
if (nDistB > 0) // 不需要间距B时,nDistB为0
{
m_nPipeBottomDist = nDistB;
}
GetEntryPt(); // 得到m_ptEntry点
}
// 不统一间距
void TDbFloorPipe::SetParam(XPoint ptStart, XPoint ptEnd, int iLeftDist,
int iRightDist, int iTopDist, int iBottomDist,
double dbPGAngle, int nEntryType, int nPipeType)
{
assertWriteEnabled();
// mcl add 2010.11.19 这些参数改变时要清空 供回绘制点,按重新计算
if (ptStart.Distance(m_ptStart) > 1 || ptEnd.Distance(ptEnd) > 1
|| fabs(iLeftDist - m_nPipeLeftDist) > 1 || fabs(iRightDist - m_nPipeRightDist) > 1
|| fabs(iTopDist - m_nPipeTopDist) > 1 || fabs(iBottomDist - m_nPipeBottomDist) > 1
|| nEntryType != m_nEntryType
|| (nPipeType != m_nPipeType && (m_nPipeType == 2 || nPipeType == 2))
|| m_bSameDist)
{
ClearDrawPt();
}
m_ptStart = ptStart;
m_ptEnd = ptEnd;
m_dbPGAngle = dbPGAngle;
m_nEntryType = nEntryType;
m_nPipeLeftDist = iLeftDist;
m_nPipeRightDist = iRightDist;
m_nPipeTopDist = iTopDist;
m_nPipeBottomDist = iBottomDist;
m_nPipeType = nPipeType;
m_bSameDist = FALSE;
GetEntryPt();
}
// add by myy 2015-3-4 地热盘管统一间距
void TDbFloorPipe::SetParam(XPoint ptStart, XPoint ptEnd, XPoint ptPick, int nDist,
double dbPGAngle, int nEntryType, int nPipeType,
int nDistB)
{
assertWriteEnabled();
// mcl add 2010.11.19 这些参数改变时要清空 供回绘制点,按重新计算
if (ptStart.Distance(m_ptStart) > 1 || ptEnd.Distance(ptEnd) > 1
|| fabs(nDist - m_nPipeDist) > 1 || nEntryType != m_nEntryType
|| fabs(nDistB - m_nPipeBottomDist) > 1
|| (nPipeType != m_nPipeType && (m_nPipeType == 2 || nPipeType == 2)
|| !m_bSameDist)
)
{
ClearDrawPt();
}
m_ptStart = ptStart;
m_ptEnd = ptEnd;
m_dbPGAngle = dbPGAngle;
m_nEntryType = nEntryType;
m_nPipeType = nPipeType;
SetPipeDist(nDist);
m_ptPickEntry = ptPick; // 开口点
if (nDistB > 0) // 不需要间距B时,nDistB为0
{
m_nPipeBottomDist = nDistB;
}
GetEntryPt(); // 得到m_ptEntry点
}
// add by myy 2015-3-4 地热盘管不统一间距
void TDbFloorPipe::SetParam(XPoint ptStart, XPoint ptEnd, XPoint ptPick, int iLeftDist,
int iRightDist, int iTopDist, int iBottomDist,
double dbPGAngle, int nEntryType, int nPipeType, int nDistB)
{
assertWriteEnabled();
// mcl add 2010.11.19 这些参数改变时要清空 供回绘制点,按重新计算
if (ptStart.Distance(m_ptStart) > 1 || ptEnd.Distance(ptEnd) > 1
|| fabs(iLeftDist - m_nPipeLeftDist) > 1 || fabs(iRightDist - m_nPipeRightDist) > 1
|| fabs(iTopDist - m_nPipeTopDist) > 1 || fabs(iBottomDist - m_nPipeBottomDist) > 1
|| nEntryType != m_nEntryType
|| (nPipeType != m_nPipeType && (m_nPipeType == 2 || nPipeType == 2))
|| m_bSameDist)
{
ClearDrawPt();
}
m_ptStart = ptStart;
m_ptEnd = ptEnd;
m_dbPGAngle = dbPGAngle;
m_nEntryType = nEntryType;
m_nPipeLeftDist = iLeftDist;
m_nPipeRightDist = iRightDist;
m_nPipeTopDist = iTopDist;
m_ptPickEntry = ptPick; // 开口点
if (nDistB > 0) // 不需要间距B时,nDistB为0
{
m_nPipeBottomDist = nDistB;
}
m_nPipeType = nPipeType;
m_bSameDist = FALSE;
GetEntryPt();
}
// add by myy 2015-1-26 回折型盘管
void TDbFloorPipe::SetParam(XPoint ptStart, XPoint ptEnd, XPoint ptPick, BOOL bSameDist,
int iLeftDist, int iRightDist, int iTopDist, int iBottomDist,
double dBorderLeftWidth, double dBorderRightWidth,
double dBorderUpWidth, double dBorderDownWidth,
double dBorderLeftDist, double dBorderRigtDist,
double dBorderUpDist, double dBorderDownDist,
double dbPGAngle, int nEntryType, int nPipeType)
{
assertWriteEnabled();
// mcl add 2010.11.19 这些参数改变时要清空 供回绘制点,按重新计算
if (ptStart.Distance(m_ptStart) > 1 || ptEnd.Distance(ptEnd) > 1
|| fabs(iLeftDist - m_nPipeLeftDist) > 1 || fabs(iRightDist - m_nPipeRightDist) > 1
|| fabs(iTopDist - m_nPipeTopDist) > 1 || fabs(iBottomDist - m_nPipeBottomDist) > 1
|| nEntryType != m_nEntryType
|| (nPipeType != m_nPipeType && (m_nPipeType == 2 || nPipeType == 2))
|| m_bSameDist)
{
ClearDrawPt();
}
m_ptStart = ptStart;
m_ptEnd = ptEnd;
m_dbPGAngle = dbPGAngle;
m_nEntryType = nEntryType;
m_nPipeLeftDist = iLeftDist;
m_nPipeRightDist = iRightDist;
m_nPipeTopDist = iTopDist;
m_nPipeBottomDist = iBottomDist;
m_nPipeType = nPipeType;
m_dBorderLeftWidth = dBorderLeftWidth;
m_dBorderRightWidth = dBorderRightWidth;
m_dBorderUpWidth = dBorderUpWidth;
m_dBorderDownWidth = dBorderDownWidth;
m_dBorderLeftDist = dBorderLeftDist;
m_dBorderRightDist = dBorderRigtDist;
m_dBorderUpDist = dBorderUpDist;
m_dBorderDownDist = dBorderDownDist;
m_dInnerLeftDist = iLeftDist;
m_dInnerRightDist = iRightDist;
m_dInnerUpDist = iTopDist;
m_dInnerDownDist = iBottomDist;
m_bSameDist = bSameDist;
m_ptPickEntry = ptPick; // 开口点
GetEntryPt();
}
//////////////////////////////////////////////////////////////////////
// Override TDbEntity
//////////////////////////////////////////////////////////////////////
void TDbFloorPipe::CopyPropertiesFrom(AcDbEntity *pSrc, unsigned gMatchFlag)
{
assertWriteEnabled();
TDbEntity::CopyPropertiesFrom(pSrc, gMatchFlag);
TDbFloorPipe *pPipe = TDbFloorPipe::cast(pSrc);
if (pPipe != NULL)
{
m_bSameDist = pPipe->m_bSameDist;
m_dPipeOutDist = pPipe->m_dPipeOutDist;
m_nPipeDist = pPipe->m_nPipeDist;
m_nPipeLeftDist = pPipe->m_nPipeLeftDist;
m_nPipeRightDist = pPipe->m_nPipeRightDist;
m_nPipeTopDist = pPipe->m_nPipeTopDist;
m_nPipeBottomDist = pPipe->m_nPipeBottomDist;
m_nEntryType = pPipe->m_nEntryType;
m_dDistToWall = pPipe->m_dDistToWall; // sg add
m_dRadius = pPipe->m_dRadius;
m_bWeight = pPipe->m_bWeight;
m_dLineWeight = pPipe->m_dLineWeight;
m_nAreaType = pPipe->m_nAreaType;
m_dLeftArea = pPipe->m_dLeftArea;
m_dRightArea = pPipe->m_dRightArea;
m_idRetLayer = pPipe->m_idRetLayer;
m_ptDrawSupply = pPipe->m_ptDrawSupply;
m_ptDrawReturn = pPipe->m_ptDrawReturn;
m_bIsHighlight = pPipe->m_bIsHighlight;
//add by dyw 20150428 复制添加的一些变量
m_bLeftChk = pPipe->IsLeftCheck();
m_bRightChk = pPipe->IsRightCheck();
m_bTopChk = pPipe->IsTopCheck();
m_bBottomChk = pPipe->IsBottomCheck();
m_dBorderLeftDist = pPipe->m_dBorderLeftDist;
m_dBorderRightDist = pPipe->m_dBorderRightDist;
m_dBorderUpDist = pPipe->m_dBorderUpDist;
m_dBorderDownDist = pPipe->m_dBorderDownDist;
m_dBorderLeftWidth = pPipe->m_dBorderLeftWidth;
m_dBorderRightWidth = pPipe->m_dBorderRightWidth;
m_dBorderUpWidth = pPipe->m_dBorderUpWidth;
m_dBorderDownWidth = pPipe->m_dBorderDownWidth;
//add end
}
TDbEntity::CopyPropertiesFrom(pSrc, gMatchFlag); // sr add
}
Acad::ErrorStatus TDbFloorPipe::subGetClassID(CLSID* pClsid) const
{
return Acad::eOk;
}
// 取动态属性显示数据
void TDbFloorPipe::GetTips(DList<TObjInfoUnit> &info) const
{
info.Append(new TObjInfoUnit(_T("对象类型"), _T("地热盘管")));
info.Append(new TObjInfoUnit(_T("管长"), XString(_T("%.2f"), GetPipeLength())));
// info.Append(new TObjInfoUnit(_T("管间左间距"), XString(_T("%.0f"),
// m_nPipeLeftDist)));
// info.Append(new TObjInfoUnit(_T("管间右间距"), XString(_T("%.0f"),
// m_nPipeRightDist)));
// info.Append(new TObjInfoUnit(_T("管间上间距"), XString(_T("%.0f"),
// m_nPipeTopDist)));
// info.Append(new TObjInfoUnit(_T("管间下间距"), XString(_T("%.0f"),
// m_nPipeBottomDist)));
}
Acad::ErrorStatus
TDbFloorPipe::GetGripText(int idx, CString &cs) const
{
Acad::ErrorStatus es = Acad::eOk;
switch(idx) {
case 0:
cs = _T("移动盘管");
break;
case 1:
cs = _T("改变尺寸");
break;
case 2:
cs = _T("改变尺寸");
break;
case 3:
cs = _T("进出口方向调整");
break;
case 4:
cs = _T("绘制供水管线");
break;
case 5:
cs = _T("绘制回水管线");
break;
default:
es = Acad::eInvalidInput;
}
return es;
}
//////////////////////////////////////////////////////////////////////
// Override AcDbEntity
//////////////////////////////////////////////////////////////////////
Acad::ErrorStatus
TDbFloorPipe::subGetOsnapPoints(AcDb::OsnapMode osnapMode,
INT_PTR gsSelectionMark,
const AcGePoint3d& ptPick,
const AcGePoint3d& lastPoint,
const AcGeMatrix3d& viewXform,
AcGePoint3dArray& snapPoints,
AcDbIntArray& geomIds) const
{
Acad::ErrorStatus es=Acad::eOk;
if (osnapMode == AcDb::kOsModeIns ||
osnapMode == AcDb::kOsModeCen ||
osnapMode == AcDb::kOsModeNode)
{
snapPoints.append(m_ptStart);
snapPoints.append(m_ptEnd);
}
es = TDbEntity::subGetOsnapPoints(osnapMode, gsSelectionMark, ptPick,
lastPoint, viewXform, snapPoints, geomIds);
return es;
}
Acad::ErrorStatus
TDbFloorPipe::subGetGripPoints(AcGePoint3dArray& gripPoints,
AcDbIntArray& osnapModes,
AcDbIntArray& geomIds) const
{
assertReadEnabled();
XPoint ptMid;
Midpoint(m_ptStart, m_ptEnd, ptMid);
gripPoints.append(ptMid);
gripPoints.append(m_ptStart);
gripPoints.append(m_ptEnd);
//. gripPoints.append(m_ptEntry);
// add begin
XPoint ptGrip;
Midpoint(m_ptDrawSupply, m_ptDrawReturn, ptGrip);
ptGrip += GetEntryDir() * 200;
gripPoints.append(ptGrip);
gripPoints.append(m_ptDrawSupply); // 入口点
gripPoints.append(m_ptDrawReturn); // 出口点
// add end by cq 2015-04-16 11:09:40 计算入口、出口点
m_ptAlterEntryGrip = ptGrip;
return Acad::eOk;
}
Acad::ErrorStatus
TDbFloorPipe::subMoveGripPointsAt(const AcDbIntArray& indices,
const AcGeVector3d& offset)
{
assertWriteEnabled();
AcGeMatrix3d mat;
AcGeVector3d vtOffset = offset;
vtOffset.z = 0;
mat.setToTranslation(vtOffset);
int idx(0), i(0);
for (i = 0; i < indices.length(); i++)
{
idx = indices[i];
if (idx == 0)
{
m_ptStart.TransformBy(mat);
m_ptEnd.TransformBy(mat);
m_ptDrawSupply.TransformBy(mat);
m_ptDrawReturn.TransformBy(mat);
if( m_ptPickEntry.x != 0 || m_ptPickEntry.y != 0 )
{
m_ptPickEntry.TransformBy(mat);
}
}
else if (idx == 1)
{
m_ptStart.TransformBy(mat);
GetDefaultPick();
ClearDrawPt();
}
else if (idx == 2)
{
m_ptEnd.TransformBy(mat);
GetDefaultPick();
ClearDrawPt();
}
else if (idx == 3)
{
XPoint ptTmp = m_ptAlterEntryGrip;
ptTmp.TransformBy(mat);
double nDist(-1);
int idx(-1), j(1);
for (j = 1; j < 9; j++)
{
XPoint ptEntry = GetEntryPt(j);
double nDistTmp = ads_distance(ptTmp, ptEntry);
if (nDist < 0 || nDist > nDistTmp)
{
nDist = nDistTmp;
idx = j;
}
}
// add by myy 2015-2-3 处理回折型盘管
if (1 == m_nPipeType)
{
switch (idx){
case 1:
idx = 7;
break;
case 2:
case 4:
case 6:
idx = idx + 2;
break;
case 3:
case 5:
case 7:
idx = idx - 2;
break;
case 8:
idx = 2;
break;
}
}
m_ptPickEntry = ptTmp; // 获取开口点
// add end
SetEntryType(idx);
ClearDrawPt();
}
else if (idx == 4)
{
m_ptStartDraw = m_ptDrawSupply;
PostCommand(_T("\33shpg\n")); // mcl add 2010.11.17,手绘盘管命令,下同
return Acad::eOk;
}
else if (idx == 5)
{
m_ptStartDraw = m_ptDrawReturn;
PostCommand(_T("\33shpg\n"));
return Acad::eOk;
}
}
GetEntryPt();
return Acad::eOk;
}
// 从DWG读入数据:
Acad::ErrorStatus TDbFloorPipe::dwgInFields(AcDbDwgFiler* pFiler)
{
assertWriteEnabled();
Acad::ErrorStatus es = TDbEntity::dwgInFields(pFiler);
if (es != Acad::eOk)
return es;
Adesk::UInt8 nVer;
pFiler->readItem(&nVer);
if (nVer > g_nVersion) // Version is too new
{
return Acad::eMakeMeProxy;
}
pFiler->readItem((AcGePoint3d *)&m_ptStart);
pFiler->readItem((AcGePoint3d *)&m_ptEnd);
pFiler->readItem(&m_dbPGAngle);
pFiler->readItem(&m_nEntryType);
pFiler->readItem(&m_nPipeType);
pFiler->readItem(&m_nPipeLeftDist);
pFiler->readItem(&m_nPipeRightDist);
pFiler->readItem(&m_nPipeTopDist);
pFiler->readItem(&m_nPipeBottomDist);
m_nPipeDist = m_nPipeLeftDist;
if (nVer > 2) // sg add,7.6
{
pFiler->readItem(&m_dDistToWall);
pFiler->readItem(&m_dRadius);
//pFiler->readItem(&m_bWeight);
FilerRead(pFiler, m_bWeight);
pFiler->readItem(&m_dLineWeight);
pFiler->readItem(&m_nAreaType);
pFiler->readItem(&m_dLeftArea);
pFiler->readItem(&m_dRightArea);
//pFiler->readItem(&m_bSameDist);
FilerRead(pFiler, m_bSameDist);
// mcl add 2010.11.16, 采用扩展数据存储,兼容以前版本(8.2、8.0)格式
const TEntityFields &filds = Fields();
filds.GFD(RETURN_LAYER, (AcDbHardPointerId&)m_idRetLayer);
filds.GFD(DRAW_SUPPLYPT, (AcGePoint3d&)m_ptDrawSupply);
filds.GFD(DRAW_RETURNPT, (AcGePoint3d&)m_ptDrawReturn);
BOOL bFloorPipeT20;
if( filds.GFD(_T("FloorPipeT20"), (BOOL&)bFloorPipeT20) )
{// cq 2015-08-25 T20盘管(在盘管补丁中增加一个字段 用以区分T20正式版和T20V2公测版盘管实体)
m_dBorderLeftWidth = m_dBorderRightWidth = m_dBorderUpWidth = m_dBorderDownWidth = .0;
m_dBorderLeftDist = m_dBorderRightDist = m_dBorderUpDist = m_dBorderDownDist = .0;
m_dPipeOutDist = .0;
m_ptPickEntry.x = m_ptPickEntry.y = m_ptPickEntry.z = .0;
m_ptAlterEntryGrip.x = m_ptAlterEntryGrip.y = m_ptAlterEntryGrip.z = .0;
m_bLeftChk = m_bRightChk = m_bTopChk = m_bBottomChk = FALSE;
}
else
{
filds.GFD(DRAW_BORDERLEFTWIDTH, m_dBorderLeftWidth);
filds.GFD(DRAW_BORDERRIGHTWIDTH, m_dBorderRightWidth);
filds.GFD(DRAW_BORDERTOPWIDTH, m_dBorderUpWidth);
filds.GFD(DRAW_BORDERBOTTOMWIDTH, m_dBorderDownWidth);
filds.GFD(DRAW_BORDERLEFTDIST, m_dBorderLeftDist);
filds.GFD(DRAW_BORDERRIGHTDIST, m_dBorderRightDist);
filds.GFD(DRAW_BORDERTOPDIST, m_dBorderUpDist);
filds.GFD(DRAW_BORDERBOTTOMDIST, m_dBorderDownDist);
filds.GFD(DRAW_PIPEOUTDIST, m_dPipeOutDist);
filds.GFD(DRAW_ENTRYPT, (AcGePoint3d&)m_ptPickEntry);
filds.GFD(DRAW_ALTERENTRYPT, (AcGePoint3d&)m_ptAlterEntryGrip); //add by dyw 20150408
//add by dyw 201504280 style1外区checkbox的状态
filds.GFD(DRAW_BLEFTCHECK, m_bLeftChk);
filds.GFD(DRAW_BRGIHTCHECK, m_bRightChk);
filds.GFD(DRAW_BTOPCHECK, m_bTopChk);
filds.GFD(DRAW_BBOTTOMCHECK,m_bBottomChk);
}
}
else
{
m_dDistToWall = m_nPipeLeftDist;
m_dRadius = GetArcRadius(m_nPipeDist);
m_bWeight = g_bPipeWeight;
m_dLineWeight = 0.35;
m_nAreaType = 0;
m_dLeftArea = 1000;
m_dRightArea = 1000;
// add begin
m_dBorderLeftWidth = m_dBorderRightWidth = m_dBorderUpWidth = m_dBorderDownWidth = .0;
m_dBorderLeftDist = m_dBorderRightDist = m_dBorderUpDist = m_dBorderDownDist = .0;
m_dPipeOutDist = .0;
m_ptPickEntry.x = m_ptPickEntry.y = m_ptPickEntry.z = .0;
m_ptAlterEntryGrip.x = m_ptAlterEntryGrip.y = m_ptAlterEntryGrip.z = .0;
m_bLeftChk = m_bRightChk = m_bTopChk = m_bBottomChk = FALSE;
if (fabs(m_nPipeLeftDist-m_nPipeRightDist)>1.0E-5 ||
fabs(m_nPipeLeftDist-m_nPipeTopDist)>1.0E-5 ||
fabs(m_nPipeLeftDist-m_nPipeBottomDist)>1.0E-5 ||
fabs(m_nPipeTopDist-m_nPipeRightDist)>1.0E-5 ||
fabs(m_nPipeTopDist-m_nPipeBottomDist)>1.0E-5 ||
fabs(m_nPipeRightDist-m_nPipeBottomDist)>1.0E-5)
{
m_bSameDist = FALSE;
}
else
{
m_bSameDist = TRUE;
}
// add end by cq 2015-07-24 版本控制T20V2.0
}
GetEntryPt(); // sg modify,先获取数据,最后确定出口点位置,2008-6-13
return pFiler->filerStatus();
}
Acad::ErrorStatus TDbFloorPipe::dwgOutFields(AcDbDwgFiler* pFiler) const
{
assertReadEnabled();
// mcl add 2010.11.16, 采用扩展数据存储,兼容以前版本(8.2、8.0)格式
const TEntityFields &filds = GetFields();
((TEntityFields*)&filds)->SFD(RETURN_LAYER, (AcDbHardPointerId&)m_idRetLayer);
((TEntityFields*)&filds)->SFD(DRAW_SUPPLYPT, m_ptDrawSupply.AsAcGePoint3d());
((TEntityFields*)&filds)->SFD(DRAW_RETURNPT, m_ptDrawReturn.AsAcGePoint3d());
((TEntityFields*)&filds)->SFD(DRAW_BORDERLEFTWIDTH, (double)m_dBorderLeftWidth);
((TEntityFields*)&filds)->SFD(DRAW_BORDERRIGHTWIDTH, (double)m_dBorderRightWidth);
((TEntityFields*)&filds)->SFD(DRAW_BORDERTOPWIDTH, (double)m_dBorderUpWidth);
((TEntityFields*)&filds)->SFD(DRAW_BORDERBOTTOMWIDTH, (double)m_dBorderDownWidth);
((TEntityFields*)&filds)->SFD(DRAW_BORDERLEFTDIST, (double)m_dBorderLeftDist);
((TEntityFields*)&filds)->SFD(DRAW_BORDERRIGHTDIST, (double)m_dBorderRightDist);
((TEntityFields*)&filds)->SFD(DRAW_BORDERTOPDIST, (double)m_dBorderUpDist);
((TEntityFields*)&filds)->SFD(DRAW_BORDERBOTTOMDIST, (double)m_dBorderDownDist);
((TEntityFields*)&filds)->SFD(DRAW_PIPEOUTDIST, (double)m_dPipeOutDist);
((TEntityFields*)&filds)->SFD(DRAW_ENTRYPT, m_ptPickEntry.AsAcGePoint3d());
// add end
//add by dyw 201504280 style1外区checkbox的状态
((TEntityFields*)&filds)->SFD(DRAW_BLEFTCHECK, m_bLeftChk);
((TEntityFields*)&filds)->SFD(DRAW_BRGIHTCHECK, m_bRightChk);
((TEntityFields*)&filds)->SFD(DRAW_BTOPCHECK, m_bTopChk);
((TEntityFields*)&filds)->SFD(DRAW_BBOTTOMCHECK, m_bBottomChk);
//add end
((TEntityFields*)&filds)->SFD(DRAW_ALTERENTRYPT, m_ptAlterEntryGrip.AsAcGePoint3d());
Acad::ErrorStatus es = TDbEntity::dwgOutFields(pFiler);
if (es != Acad::eOk)
return es;
pFiler->writeItem(g_nVersion);
pFiler->writeItem((const AcGePoint3d &)m_ptStart);
pFiler->writeItem((const AcGePoint3d &)m_ptEnd);
pFiler->writeItem(m_dbPGAngle);
pFiler->writeItem(m_nEntryType);
pFiler->writeItem(m_nPipeType);
pFiler->writeItem(m_nPipeLeftDist);
pFiler->writeItem(m_nPipeRightDist);
pFiler->writeItem(m_nPipeTopDist);
pFiler->writeItem(m_nPipeBottomDist);
pFiler->writeItem(m_dDistToWall); // sg add
pFiler->writeItem(m_dRadius);
//pFiler->writeItem(m_bWeight);
FilerWrite(pFiler, m_bWeight);
pFiler->writeItem(m_dLineWeight);
pFiler->writeItem(m_nAreaType);
pFiler->writeItem(m_dLeftArea);
pFiler->writeItem(m_dRightArea);
//pFiler->writeItem(m_bSameDist);
FilerWrite(pFiler, m_bSameDist);
return pFiler->filerStatus();
}
Acad::ErrorStatus TDbFloorPipe::dxfInFields(AcDbDxfFiler* pFiler)
{
assertWriteEnabled();
Acad::ErrorStatus es = Acad::eOk;
es = TDbEntity::dxfInFields(pFiler);
return es;
}
Acad::ErrorStatus TDbFloorPipe::dxfOutFields(AcDbDxfFiler* pFiler) const
{
Acad::ErrorStatus es = Acad::eOk;
es = TDbEntity::dxfOutFields(pFiler);
return es;
}
// Active when being rotated, scaled, moved, etc.
Acad::ErrorStatus
TDbFloorPipe::subTransformBy(const AcGeMatrix3d& xform)
{
assertWriteEnabled();
m_ptStart.TransformBy(xform);
m_ptEnd.TransformBy(xform);
// 开口点
if( m_ptPickEntry.x != 0 || m_ptPickEntry.y != 0 )
{
m_ptPickEntry.TransformBy(xform);
}
m_ptPickEntry.z = 0.0;
double dScale = xform.scale();
if( fabs(dScale-1.0f) < g_fZero )
{
m_ptDrawSupply.TransformBy(xform);
m_ptDrawReturn.TransformBy(xform);
}
else
{
m_ptDrawSupply.x = m_ptDrawSupply.y = .0;
m_ptDrawReturn.x = m_ptDrawReturn.y = .0;
}
// mcl add 2010.11.23,不允许改变Z坐标
m_ptStart.z = m_ptEnd.z = m_ptDrawSupply.z = m_ptDrawReturn.z = 0.0;
// gesp added
XVector3D vtRot(cos(m_dbPGAngle), sin(m_dbPGAngle));
((AcGeVector3d &)vtRot).transformBy(xform);
m_dbPGAngle = ads_angle(XPoint(), vtRot);
//if (!!objectId()) // sg add 2008-5-20 delete by cq 2015-08-14镜像过程中预览不正确
{
XString &sCmd = GetCurDocData()->m_sCurCommand;
if (_tcsicmp(sCmd, _T("MIRROR"))==0)
{
if (m_nEntryType>0 && m_nEntryType<5)
{
m_nEntryType = 5 - m_nEntryType;
}
else if (m_nEntryType>4 && m_nEntryType<9)
{
m_nEntryType = 13 - m_nEntryType;
}
}
}
GetEntryPt();
return Acad::eOk;
}
//////////////////////////////////////////////////////////////////////
// 获取m_ptEntry点坐标
//////////////////////////////////////////////////////////////////////
// 改:修改CPipeStyle1/6::GetEntryPt()函数,点m_ptEntry距虚拟矩形的间距为距墙距离
// 修改CPipeStyle1/6的构造函数,可以接受新增加的变量
void TDbFloorPipe::GetEntryPt()
{
switch(m_nPipeType) {
case 1:
{
// change by myy 2014-11-12
//CPipeStyle1 style(m_ptStart, m_ptEnd, (int)m_nPipeLeftDist,
// (int)m_nPipeRightDist, (int)m_nPipeTopDist, (int)m_nPipeBottomDist,
// m_dbPGAngle, m_nEntryType, m_dDistToWall, m_dRadius, m_bWeight,
// m_dLineWeight, colorIndex());
//change begin 20150428
//CPipeStyle1 style(m_ptStart, m_ptEnd, m_ptPickEntry, m_bSameDist, (int)m_nPipeLeftDist,
// (int)m_nPipeRightDist, (int)m_nPipeTopDist, (int)m_nPipeBottomDist,
// m_dbPGAngle, m_nEntryType, m_dDistToWall, m_dRadius, m_dBorderLeftWidth,
// m_dBorderRightWidth, m_dBorderUpWidth, m_dBorderDownWidth, m_dBorderLeftDist,
// m_dBorderRightDist, m_dBorderUpDist, m_dBorderDownDist, m_bWeight, m_dLineWeight, colorIndex());
//add by dyw 20150428 如果外区checkbox没有勾选则该边没有外区
double dLBordWidth = IsLeftCheck() ? m_dBorderLeftWidth : 0;
double dRBordWidth = IsRightCheck() ? m_dBorderRightWidth : 0;
double dUBordWidth = IsTopCheck() ? m_dBorderUpWidth : 0;
double dDBordWidth = IsBottomCheck() ? m_dBorderDownWidth : 0;
CPipeStyle1 style(m_ptStart, m_ptEnd, m_ptPickEntry, m_bSameDist, (int)m_nPipeLeftDist,
(int)m_nPipeRightDist, (int)m_nPipeTopDist, (int)m_nPipeBottomDist,
m_dbPGAngle, m_nEntryType, m_dDistToWall, m_dRadius, dLBordWidth,
dRBordWidth, dUBordWidth, dDBordWidth, m_dBorderLeftDist,
m_dBorderRightDist, m_dBorderUpDist, m_dBorderDownDist, m_bWeight, m_dLineWeight, colorIndex());
//add end
//change end
if (!!m_ptPickEntry)
m_ptEntry = m_ptPickEntry;
else
m_ptEntry = style.GetEntryPt(m_nEntryType);
// change end
}
break;
case 2:
{
// change by myy 2015-1-26
/*CPipeStyle2 style(m_ptStart, m_ptEnd, m_dbPGAngle, m_nEntryType,
m_dRadius, m_dDistToWall, (int)m_nPipeLeftDist, (int)m_nPipeTopDist,
(int)m_nPipeRightDist, (int)m_nPipeBottomDist, m_nAreaType,
m_dLeftArea, m_dRightArea, m_bWeight, m_dLineWeight, colorIndex());*/
CPipeStyle2 style(m_ptStart, m_ptEnd, m_ptPickEntry, m_dbPGAngle, m_nEntryType,
m_dRadius, m_dDistToWall, (int)m_nPipeLeftDist, (int)m_nPipeTopDist,
(int)m_nPipeRightDist, (int)m_nPipeBottomDist, m_nAreaType,
m_dLeftArea, m_dRightArea, m_bWeight, m_dLineWeight, colorIndex());
style.SetSameDist(m_bSameDist, (int)m_nPipeDist);
// m_ptEntry = style.GetEntryPt(m_nEntryType);
// style.SetEntryType(m_nEntryType);
if (!!m_ptPickEntry)
m_ptEntry = m_ptPickEntry;
else
m_ptEntry = style.GetEntryPt();
// change end
}
break;
case 3:
{
// change by myy 2015-1-28
/*CPipeStyle3 style(m_ptStart, m_ptEnd, m_dbPGAngle, m_nEntryType,
m_dRadius, m_dDistToWall, (int)m_nPipeLeftDist, (int)m_nPipeTopDist,
(int)m_nPipeRightDist, m_nAreaType, m_dLeftArea, m_dRightArea,
m_bWeight, m_dLineWeight, colorIndex());*/
CPipeStyle3 style(m_ptStart, m_ptEnd, m_ptPickEntry, m_dbPGAngle, m_nEntryType,
m_dRadius, m_dDistToWall, (int)m_nPipeLeftDist, (int)m_nPipeTopDist,
(int)m_nPipeRightDist, m_nAreaType, m_dLeftArea, m_dRightArea,
m_bWeight, m_dLineWeight, colorIndex());
style.SetSameDist(m_bSameDist, (int)m_nPipeDist);
// m_ptEntry = style.GetEntryPt(m_nEntryType);
if (!!m_ptPickEntry)
m_ptEntry = m_ptPickEntry;
else
m_ptEntry = style.GetEntryPt();
// change end
}
break;
case 4:
{
// change by myy 2015-1-30
/*CPipeStyle4 style(m_ptStart, m_ptEnd, m_dbPGAngle, m_nEntryType,
m_dRadius, m_dDistToWall, (int)m_nPipeLeftDist, (int)m_nPipeTopDist,
(int)m_nPipeRightDist, (int)m_nPipeBottomDist, m_nAreaType,
m_dLeftArea, m_dRightArea, m_bWeight, m_dLineWeight, colorIndex());*/
CPipeStyle4 style(m_ptStart, m_ptEnd, m_ptPickEntry, m_dbPGAngle, m_nEntryType,
m_dRadius, m_dDistToWall, (int)m_nPipeLeftDist, (int)m_nPipeTopDist,
(int)m_nPipeRightDist, (int)m_nPipeBottomDist, m_nAreaType,
m_dLeftArea, m_dRightArea, m_bWeight, m_dLineWeight, colorIndex());
style.SetSameDist(m_bSameDist, (int)m_nPipeDist);
// m_ptEntry = style.GetEntryPt(m_nEntryType);
if (!!m_ptPickEntry)
m_ptEntry = m_ptPickEntry;
else
m_ptEntry = style.GetEntryPt();
// change end
}
break;
case 5:
{
CPipeStyle5 style(m_ptStart, m_ptEnd, (int)m_nPipeDist,
m_dbPGAngle, m_nEntryType, colorIndex());
m_ptEntry = style.GetEntryPt(m_nEntryType);
}
break;
case 6:
{
CPipeStyle6 style(m_ptStart, m_ptEnd, (int)m_nPipeDist,
m_dbPGAngle, m_nEntryType, colorIndex());
m_ptEntry = style.GetEntryPt(m_nEntryType);
}
break;
default:
return;
}
// change by myy 2015-2-3
// mcl add 2010.11.16,出口点不再多出一截,跟盘管对其
if (0 == m_ptPickEntry.x && 0 == m_ptPickEntry.y)
{
if (m_idRetLayer.isValid()) // 有回水图层说明是8.5以后(含)的实体,因考虑兼容,8.5没有增加版本号。以后可根据版本号判断
m_ptEntry -= m_dDistToWall * GetEntryDir();
}
if (!m_ptDrawSupply && !m_ptDrawReturn)
{
GetEntryInf(m_ptDrawSupply, m_ptDrawReturn);
}
}
void TDbFloorPipe::GetEntryInf(XPoint &ptSupply, XPoint &ptReturn)
{
switch(m_nPipeType) {
case 1:
{
//change by dyw 20150428 如果外区checkbox没有勾选则该边没有外区
//CPipeStyle1 style(m_ptStart, m_ptEnd, m_ptPickEntry, m_bSameDist, (int)m_nPipeLeftDist,
// (int)m_nPipeRightDist, (int)m_nPipeTopDist, (int)m_nPipeBottomDist,
// m_dbPGAngle, m_nEntryType, m_dDistToWall, m_dRadius, m_dBorderLeftWidth,
// m_dBorderRightWidth, m_dBorderUpWidth, m_dBorderDownWidth, m_dBorderLeftDist,
// m_dBorderRightDist, m_dBorderUpDist, m_dBorderDownDist, m_bWeight, m_dLineWeight, colorIndex());
double dLBordWidth = IsLeftCheck() ? m_dBorderLeftWidth : 0;
double dRBordWidth = IsRightCheck() ? m_dBorderRightWidth : 0;
double dUBordWidth = IsTopCheck() ? m_dBorderUpWidth : 0;
double dDBordWidth = IsBottomCheck() ? m_dBorderDownWidth : 0;
CPipeStyle1 style(m_ptStart, m_ptEnd, m_ptPickEntry, m_bSameDist, (int)m_nPipeLeftDist,
(int)m_nPipeRightDist, (int)m_nPipeTopDist, (int)m_nPipeBottomDist,
m_dbPGAngle, m_nEntryType, m_dDistToWall, m_dRadius, dLBordWidth,
dRBordWidth, dUBordWidth, dDBordWidth, m_dBorderLeftDist,
m_dBorderRightDist, m_dBorderUpDist, m_dBorderDownDist, m_bWeight, m_dLineWeight, colorIndex());
//change end
style.GetCrossPts(ptSupply, ptReturn);
m_dPipeOutDist = style.GetPipeOutDist();
}
break;
case 2:
{
CPipeStyle2 style(m_ptStart, m_ptEnd, m_ptPickEntry, m_dbPGAngle, m_nEntryType,
m_dRadius, m_dDistToWall, (int)m_nPipeLeftDist, (int)m_nPipeTopDist,
(int)m_nPipeRightDist, (int)m_nPipeBottomDist, m_nAreaType,
m_dLeftArea, m_dRightArea, m_bWeight, m_dLineWeight, colorIndex());
style.SetSameDist(m_bSameDist, (int)m_nPipeDist);
style.GetCrossPts(ptSupply, ptReturn);
}
break;
case 3:
{
CPipeStyle3 style(m_ptStart, m_ptEnd, m_ptPickEntry, m_dbPGAngle, m_nEntryType,
m_dRadius, m_dDistToWall, (int)m_nPipeLeftDist, (int)m_nPipeTopDist,
(int)m_nPipeRightDist, m_nAreaType, m_dLeftArea, m_dRightArea,
m_bWeight, m_dLineWeight, colorIndex());
style.SetSameDist(m_bSameDist, (int)m_nPipeDist);
style.GetCrossPts(ptSupply, ptReturn);
}
break;
case 4:
{
CPipeStyle4 style(m_ptStart, m_ptEnd, m_ptPickEntry, m_dbPGAngle, m_nEntryType,
m_dRadius, m_dDistToWall, (int)m_nPipeLeftDist, (int)m_nPipeTopDist,
(int)m_nPipeRightDist, (int)m_nPipeBottomDist, m_nAreaType,
m_dLeftArea, m_dRightArea, m_bWeight, m_dLineWeight, colorIndex());
style.SetSameDist(m_bSameDist, (int)m_nPipeDist);
style.GetCrossPts(ptSupply, ptReturn);
}
break;
}
}
// 目前仅用于TDbFloorPipe::subMoveGripPointsAt()函数中
XPoint TDbFloorPipe::GetEntryPt(int iEntryType)
{
XPoint ptRet;
switch(m_nPipeType) {
case 1:
{
// change by myy 2014-11-12
//CPipeStyle1 style(m_ptStart, m_ptEnd, (int)m_nPipeLeftDist,
// (int)m_nPipeRightDist, (int)m_nPipeTopDist, (int)m_nPipeBottomDist,
// m_dbPGAngle, m_nEntryType, m_dDistToWall, m_dRadius, m_bWeight,
// m_dLineWeight, colorIndex());
/*CPipeStyle1 style(m_ptStart, m_ptEnd, m_ptPickEntry, m_bSameDist, (int)m_nPipeLeftDist,
(int)m_nPipeRightDist, (int)m_nPipeTopDist, (int)m_nPipeBottomDist,
m_dbPGAngle, m_nEntryType, m_dDistToWall, m_dRadius, m_dBorderLeftWidth,
m_dBorderRightWidth, m_dBorderUpWidth, m_dBorderDownWidth, m_dBorderLeftDist,
m_dBorderRightDist, m_dBorderUpDist, m_dBorderDownDist, m_bWeight, m_dLineWeight, colorIndex());*/
double dLBordWidth = IsLeftCheck() ? m_dBorderLeftWidth : 0;
double dRBordWidth = IsRightCheck() ? m_dBorderRightWidth : 0;
double dUBordWidth = IsTopCheck() ? m_dBorderUpWidth : 0;
double dDBordWidth = IsBottomCheck() ? m_dBorderDownWidth : 0;
CPipeStyle1 style(m_ptStart, m_ptEnd, m_ptPickEntry, m_bSameDist, (int)m_nPipeLeftDist,
(int)m_nPipeRightDist, (int)m_nPipeTopDist, (int)m_nPipeBottomDist,
m_dbPGAngle, m_nEntryType, m_dDistToWall, m_dRadius, dLBordWidth,
dRBordWidth, dUBordWidth, dDBordWidth, m_dBorderLeftDist,
m_dBorderRightDist, m_dBorderUpDist, m_dBorderDownDist, m_bWeight, m_dLineWeight, colorIndex());
// change end
ptRet = style.GetEntryPt(iEntryType);
}
break;
case 2:
{
// change by myy 2015-1-27
/*CPipeStyle2 style(m_ptStart, m_ptEnd, m_dbPGAngle, m_nEntryType,
m_dRadius, m_dDistToWall, (int)m_nPipeLeftDist, (int)m_nPipeTopDist,
(int)m_nPipeRightDist, (int)m_nPipeBottomDist, m_nAreaType,
m_dLeftArea, m_dRightArea, m_bWeight, m_dLineWeight, colorIndex());*/
CPipeStyle2 style(m_ptStart, m_ptEnd, m_ptPickEntry, m_dbPGAngle, m_nEntryType,
m_dRadius, m_dDistToWall, (int)m_nPipeLeftDist, (int)m_nPipeTopDist,
(int)m_nPipeRightDist, (int)m_nPipeBottomDist, m_nAreaType,
m_dLeftArea, m_dRightArea, m_bWeight, m_dLineWeight, colorIndex());
// change end
style.SetSameDist(m_bSameDist, (int)m_nPipeDist);
// ptRet = style.GetEntryPt(iEntryType);
style.SetEntryType(iEntryType);
ptRet = style.GetEntryPt();
}
break;
case 3:
{
// change by myy 2015-1-28
/*CPipeStyle3 style(m_ptStart, m_ptEnd, m_dbPGAngle, m_nEntryType,
m_dRadius, m_dDistToWall, (int)m_nPipeLeftDist, (int)m_nPipeTopDist,
(int)m_nPipeRightDist, m_nAreaType, m_dLeftArea, m_dRightArea,
m_bWeight, m_dLineWeight, colorIndex());*/
CPipeStyle3 style(m_ptStart, m_ptEnd, m_ptPickEntry, m_dbPGAngle, m_nEntryType, m_dRadius,
m_dDistToWall, (int)m_nPipeLeftDist, (int)m_nPipeTopDist, (int)m_nPipeRightDist, m_nAreaType,
m_dLeftArea, m_dRightArea, m_bWeight, m_dLineWeight, colorIndex());
// change end
style.SetSameDist(m_bSameDist, (int)m_nPipeDist);
// ptRet = style.GetEntryPt(iEntryType);
style.SetEntryType(iEntryType);
ptRet = style.GetEntryPt();
}
break;
case 4:
{
// change by myy 2015-1-30
/*CPipeStyle4 style(m_ptStart, m_ptEnd, m_dbPGAngle, m_nEntryType,
m_dRadius, m_dDistToWall, (int)m_nPipeLeftDist, (int)m_nPipeTopDist,
(int)m_nPipeRightDist, (int)m_nPipeBottomDist, m_nAreaType,
m_dLeftArea, m_dRightArea, m_bWeight, m_dLineWeight, colorIndex());*/
CPipeStyle4 style(m_ptStart, m_ptEnd, m_ptPickEntry, m_dbPGAngle, m_nEntryType, m_dRadius, m_dDistToWall,
(int)m_nPipeLeftDist, (int)m_nPipeTopDist, (int)m_nPipeRightDist, (int)m_nPipeBottomDist, m_nAreaType,
m_dLeftArea, m_dRightArea, m_bWeight, m_dLineWeight, colorIndex());
// change end
style.SetSameDist(m_bSameDist, (int)m_nPipeDist);
// ptRet = style.GetEntryPt(iEntryType);
style.SetEntryType(iEntryType);
ptRet = style.GetEntryPt();
}
break;
case 5:
{
CPipeStyle5 style(m_ptStart, m_ptEnd, (int)m_nPipeDist,
m_dbPGAngle, m_nEntryType, colorIndex());
ptRet = style.GetEntryPt(iEntryType);
}
break;
case 6:
{
CPipeStyle6 style(m_ptStart, m_ptEnd, (int)m_nPipeDist,
m_dbPGAngle, m_nEntryType, colorIndex());
ptRet = style.GetEntryPt(iEntryType);
}
break;
default:
return ptRet;
}
return ptRet;
}
// 获取盘管长度
double TDbFloorPipe::GetPipeLength() const
{
AcDbVoidPtrArray entSet;
explode(entSet);
double dPipeLength(0); // 长度
int i(0),
nLen = entSet.length();
for (i=0; i<nLen; i++)
{
AcDbEntity *pEnt = (AcDbEntity *)entSet[i];
// if (!m_bWeight) // 不加粗,实体为“Line、Arc”
// if (!g_bPipeWeight) // 不加粗,实体为“Line、Arc”
if (!g_bFloorPipeWeight) // 不加粗,实体为“Line、Arc”
{
AcDbLine *pLine = NULL;
AcDbArc *pArc = NULL;
if (pLine = AcDbLine::cast(pEnt))
{
dPipeLength += ads_distance(XPoint(pLine->startPoint()),
XPoint(pLine->endPoint()));
}
else if (pArc = AcDbArc::cast(pEnt))
{
XArc arc(XPoint(pArc->center()), pArc->radius(), pArc->startAngle(),
pArc->endAngle());
dPipeLength += arc.GetLength();
}
}
else // 加粗,实体为“PolyLine”,sg add
{
AcDbPolyline *pPLine = NULL;
if (pPLine = AcDbPolyline::cast(pEnt))
{
double dBulge(0);
AcGePoint2d ptS, ptE;
pPLine->getBulgeAt(0, dBulge);
pPLine->getPointAt(0, ptS);
pPLine->getPointAt(1, ptE);
dBulge = atan(dBulge) * 4;
XCurveSegment seg(XPoint(ptS), XPoint(ptE), dBulge, LS_FINITE);
dPipeLength += seg.GetLength();
}
}
}
ReleaseEntSet(entSet);
return dPipeLength/1000;
}
// 获取最小间距,用于倒角
double TDbFloorPipe::GetMinDist() const
{
double dDist(-1);
switch(m_nPipeType) {
case 1: // 回折型
{
// change by myy 2014-11-12
//CPipeStyle1 style(m_ptStart, m_ptEnd, (int)m_nPipeLeftDist,
// (int)m_nPipeRightDist, (int)m_nPipeTopDist, (int)m_nPipeBottomDist,
// m_dbPGAngle, m_nEntryType, m_dDistToWall, m_dRadius, m_bWeight,
// m_dLineWeight, colorIndex());
/*CPipeStyle1 style(m_ptStart, m_ptEnd, m_ptPickEntry, m_bSameDist, (int)m_nPipeLeftDist,
(int)m_nPipeRightDist, (int)m_nPipeTopDist, (int)m_nPipeBottomDist,
m_dbPGAngle, m_nEntryType, m_dDistToWall, m_dRadius, m_dBorderLeftWidth,
m_dBorderRightWidth, m_dBorderUpWidth, m_dBorderDownWidth, m_dBorderLeftDist,
m_dBorderRightDist, m_dBorderUpDist, m_dBorderDownDist, m_bWeight, m_dLineWeight, colorIndex());*/
double dLBordWidth = IsLeftCheck() ? m_dBorderLeftWidth : 0;
double dRBordWidth = IsRightCheck() ? m_dBorderRightWidth : 0;
double dUBordWidth = IsTopCheck() ? m_dBorderUpWidth : 0;
double dDBordWidth = IsBottomCheck() ? m_dBorderDownWidth : 0;
CPipeStyle1 style(m_ptStart, m_ptEnd, m_ptPickEntry, m_bSameDist, (int)m_nPipeLeftDist,
(int)m_nPipeRightDist, (int)m_nPipeTopDist, (int)m_nPipeBottomDist,
m_dbPGAngle, m_nEntryType, m_dDistToWall, m_dRadius, dLBordWidth,
dRBordWidth, dUBordWidth, dDBordWidth, m_dBorderLeftDist,
m_dBorderRightDist, m_dBorderUpDist, m_dBorderDownDist, m_bWeight, m_dLineWeight, colorIndex());
// change end
dDist = style.GetCenterDist();
}
break;
case 2: // 平行型
{
// change by myy 2015-1-27
/*CPipeStyle2 style(m_ptStart, m_ptEnd, m_dbPGAngle, m_nEntryType,
m_dRadius, m_dDistToWall, (int)m_nPipeLeftDist, (int)m_nPipeTopDist,
(int)m_nPipeRightDist, (int)m_nPipeBottomDist, m_nAreaType,
m_dLeftArea, m_dRightArea, m_bWeight, m_dLineWeight, colorIndex());*/
CPipeStyle2 style(m_ptStart, m_ptEnd, m_ptPickEntry, m_dbPGAngle, m_nEntryType,
m_dRadius, m_dDistToWall, (int)m_nPipeLeftDist, (int)m_nPipeTopDist,
(int)m_nPipeRightDist, (int)m_nPipeBottomDist, m_nAreaType,
m_dLeftArea, m_dRightArea, m_bWeight, m_dLineWeight, colorIndex());
// change end
style.SetSameDist(m_bSameDist, (int)m_nPipeDist);
dDist = style.GetMinDist();
}
break;
case 3:
{
// change by myy 2015-1-28
/*CPipeStyle3 style(m_ptStart, m_ptEnd, m_dbPGAngle, m_nEntryType,
m_dRadius, m_dDistToWall, (int)m_nPipeLeftDist, (int)m_nPipeTopDist,
(int)m_nPipeRightDist, m_nAreaType, m_dLeftArea, m_dRightArea,
m_bWeight, m_dLineWeight, colorIndex());*/
CPipeStyle3 style(m_ptStart, m_ptEnd, m_ptPickEntry, m_dbPGAngle, m_nEntryType, m_dRadius,
m_dDistToWall, (int)m_nPipeLeftDist, (int)m_nPipeTopDist, (int)m_nPipeRightDist, m_nAreaType,
m_dLeftArea, m_dRightArea, m_bWeight, m_dLineWeight, colorIndex());
// change end
style.SetSameDist(m_bSameDist, (int)m_nPipeDist);
dDist = style.GetMinDist();
}
break;
case 4:
{
// change by myy 2015-1-30
/*CPipeStyle4 style(m_ptStart, m_ptEnd, m_dbPGAngle, m_nEntryType,
m_dRadius, m_dDistToWall, (int)m_nPipeLeftDist, (int)m_nPipeTopDist,
(int)m_nPipeRightDist, (int)m_nPipeBottomDist, m_nAreaType,
m_dLeftArea, m_dRightArea, m_bWeight, m_dLineWeight, colorIndex());*/
CPipeStyle4 style(m_ptStart, m_ptEnd, m_ptPickEntry, m_dbPGAngle, m_nEntryType,
m_dRadius, m_dDistToWall, (int)m_nPipeLeftDist, (int)m_nPipeTopDist,
(int)m_nPipeRightDist, (int)m_nPipeBottomDist, m_nAreaType,
m_dLeftArea, m_dRightArea, m_bWeight, m_dLineWeight, colorIndex());
// change end
style.SetSameDist(m_bSameDist, (int)m_nPipeDist);
dDist = style.GetMinDist();
}
break;
default:
break;
}
return dDist;
}
// 绘制盘管,sg add color and lineweight
Acad::ErrorStatus TDbFloorPipe::ExplodeOrDraw2d(XExplodeDraw &dc) const
{
// cet 2016.10.17 add 图层关闭时,实体不显示,不进行绘制(打印时,也不会绘制)
AcDbLayerTableRecordPointer player(this->layerId(), AcDb::kForRead);
if (player.openStatus() == Acad::eOk && player->isOff())
{
return Acad::eOk;
}
// mcl add 2010.11.15 设置颜色随层
int nOrigColor = dc.GetColor();
int nEntColor = colorIndex();
if (nEntColor == 256)
dc.SetColor(256);
XPoint ptArror;
switch(m_nPipeType) {
case 1:
{
// change by myy 2014-1-12
//CPipeStyle1 style(m_ptStart, m_ptEnd, (int)m_nPipeLeftDist,
// (int)m_nPipeRightDist, (int)m_nPipeTopDist, (int)m_nPipeBottomDist,
// m_dbPGAngle, m_nEntryType, m_dDistToWall, m_dExplodeOrDraw2dRadius, m_bWeight,
// m_dLineWeight, colorIndex());
//change begin 20150428
//CPipeStyle1 style(m_ptStart, m_ptEnd, m_ptPickEntry, m_bSameDist, (int)m_nPipeLeftDist,
// (int)m_nPipeRightDist, (int)m_nPipeTopDist, (int)m_nPipeBottomDist,
// m_dbPGAngle, m_nEntryType, m_dDistToWall, m_dRadius, m_dBorderLeftWidth,
// m_dBorderRightWidth, m_dBorderUpWidth, m_dBorderDownWidth, m_dBorderLeftDist,
// m_dBorderRightDist, m_dBorderUpDist, m_dBorderDownDist, m_bWeight, m_dLineWeight, colorIndex());
//add by dyw 20150428 如果外区checkbox没有勾选则该边没有外区
double dLBordWidth = IsLeftCheck() ? m_dBorderLeftWidth : 0;
double dRBordWidth = IsRightCheck() ? m_dBorderRightWidth : 0;
double dUBordWidth = IsTopCheck() ? m_dBorderUpWidth : 0;
double dDBordWidth = IsBottomCheck() ? m_dBorderDownWidth : 0;
CPipeStyle1 style(m_ptStart, m_ptEnd, m_ptPickEntry, m_bSameDist, (int)m_nPipeLeftDist,
(int)m_nPipeRightDist, (int)m_nPipeTopDist, (int)m_nPipeBottomDist,
m_dbPGAngle, m_nEntryType, m_dDistToWall, m_dRadius, dLBordWidth,
dRBordWidth, dUBordWidth, dDBordWidth, m_dBorderLeftDist,
m_dBorderRightDist, m_dBorderUpDist, m_dBorderDownDist, m_bWeight, m_dLineWeight, colorIndex());
//add end
//change end
style.m_ptDrawSupply = m_ptDrawSupply;
style.m_ptDrawReturn = m_ptDrawReturn;
style.DrawPGLine(dc, m_idRetLayer);
Midpoint(style.m_ptDrawSupply, style.m_ptDrawReturn, ptArror);
ptArror += GetEntryDir() * 200;
// change end
}
break;
case 2:
{
// change by myy 2015-1-27
/*CPipeStyle2 style(m_ptStart, m_ptEnd, m_dbPGAngle, m_nEntryType,
m_dRadius, m_dDistToWall, (int)m_nPipeLeftDist, (int)m_nPipeTopDist,
(int)m_nPipeRightDist, (int)m_nPipeBottomDist, m_nAreaType,
m_dLeftArea, m_dRightArea, m_bWeight, m_dLineWeight, colorIndex());*/
CPipeStyle2 style(m_ptStart, m_ptEnd, m_ptPickEntry, m_dbPGAngle, m_nEntryType,
m_dRadius, m_dDistToWall, (int)m_nPipeLeftDist, (int)m_nPipeTopDist,
(int)m_nPipeRightDist, (int)m_nPipeBottomDist, m_nAreaType,
m_dLeftArea, m_dRightArea, m_bWeight, m_dLineWeight, colorIndex());
style.SetSameDist(m_bSameDist, (int)m_nPipeDist);
style.m_ptDrawSupply = m_ptDrawSupply;
style.m_ptDrawReturn = m_ptDrawReturn;
//style.m_bDrawOutLine = !m_idRetLayer.isValid(); //delete by dyw 20150717 当前版本绘制外面的线会导致绘制时预览错误
style.DrawPGLine(dc, m_idRetLayer);
Midpoint(style.m_ptDrawSupply, style.m_ptDrawReturn, ptArror);
ptArror += GetEntryDir() * 200;
// change end
}
break;
case 3:
{
// change by myy 2015-1-28
/*CPipeStyle3 style(m_ptStart, m_ptEnd, m_dbPGAngle, m_nEntryType,
m_dRadius, m_dDistToWall, (int)m_nPipeLeftDist, (int)m_nPipeTopDist,
(int)m_nPipeRightDist, m_nAreaType, m_dLeftArea, m_dRightArea,
m_bWeight, m_dLineWeight, colorIndex());*/
CPipeStyle3 style(m_ptStart, m_ptEnd, m_ptPickEntry, m_dbPGAngle, m_nEntryType, m_dRadius,
m_dDistToWall, (int)m_nPipeLeftDist, (int)m_nPipeTopDist, (int)m_nPipeRightDist, m_nAreaType,
m_dLeftArea, m_dRightArea, m_bWeight, m_dLineWeight, colorIndex());
style.m_ptDrawSupply = m_ptDrawSupply;
style.m_ptDrawReturn = m_ptDrawReturn;
style.SetSameDist(m_bSameDist, (int)m_nPipeDist);
style.DrawPGLine(dc, m_idRetLayer);
Midpoint(style.m_ptDrawSupply, style.m_ptDrawReturn, ptArror);
ptArror += GetEntryDir() * 200;
// change end
}
break;
case 4:
{
// change by myy 2015-1-30
/*CPipeStyle4 style(m_ptStart, m_ptEnd, m_dbPGAngle, m_nEntryType,
m_dRadius, m_dDistToWall, (int)m_nPipeLeftDist, (int)m_nPipeTopDist,
(int)m_nPipeRightDist, (int)m_nPipeBottomDist, m_nAreaType,
m_dLeftArea, m_dRightArea, m_bWeight, m_dLineWeight, colorIndex());*/
CPipeStyle4 style(m_ptStart, m_ptEnd, m_ptPickEntry, m_dbPGAngle, m_nEntryType,
m_dRadius, m_dDistToWall, (int)m_nPipeLeftDist, (int)m_nPipeTopDist,
(int)m_nPipeRightDist, (int)m_nPipeBottomDist, m_nAreaType,
m_dLeftArea, m_dRightArea, m_bWeight, m_dLineWeight, colorIndex());
style.SetSameDist(m_bSameDist, (int)m_nPipeDist);
style.m_ptDrawSupply = m_ptDrawSupply;
style.m_ptDrawReturn = m_ptDrawReturn;
style.DrawPGLine(dc, m_idRetLayer);
Midpoint(style.m_ptDrawSupply, style.m_ptDrawReturn, ptArror);
ptArror += GetEntryDir() * 200;
// change end
}
break;
case 5:
{
CPipeStyle5 style(m_ptStart, m_ptEnd, (int)m_nPipeDist,
m_dbPGAngle, m_nEntryType, colorIndex());
style.DrawPGLine(dc);
}
break;
case 6:
{
CPipeStyle6 style(m_ptStart, m_ptEnd, (int)m_nPipeDist,
m_dbPGAngle, m_nEntryType, colorIndex());
style.DrawPGLine(dc);
}
break;
default:
return Acad::eOk;
}
// mcl add. 2010.11.17,绘制出口箭头
AcDbObjectIdArray idArray;
if(m_bIsHighlight || dc.IsDragging())
DrawEntryArror(dc, ptArror);
dc.SetColor(nOrigColor);
return Acad::eOk;
}
XPoint TDbFloorPipe::GetStdSupplyPoint() const // 获取标准回水管端位置
{
return m_ptEntry;
}
XPoint TDbFloorPipe::GetStdReturnPoint() const // 获取标准回水管端位置
{
// change by myy 2014-12-12
// double dLen = 0.0;
// if (m_bSameDist || !m_bSameDist && 1e-6 >= m_dBorderLeftWidth)
// {
// if (!!m_ptPickEntry)
// dLen = m_nPipeBottomDist;
// else
// dLen = m_nPipeLeftDist;
// }
// else if (!m_bSameDist && 1e-6 < m_dBorderLeftWidth)
// {
// if (!!m_ptPickEntry)
// dLen = m_dBorderDownDist;
// else
// dLen = m_dBorderLeftDist;
// }
//change by dyw 20150408
double dLen = 100;
//chang end
XPoint ptRet;
if (!!m_ptPickEntry && 1 == m_nPipeType)
{
if (1 == m_nEntryType || 8 == m_nEntryType)
{
ads_polar(m_ptEntry, (1.5*PI+m_dbPGAngle), dLen, ptRet);
}
else if (2 == m_nEntryType || 3 == m_nEntryType)
{
ads_polar(m_ptEntry, (PI+m_dbPGAngle), dLen, ptRet);
}
else if (4 == m_nEntryType || 5 == m_nEntryType)
{
ads_polar(m_ptEntry, (0.5*PI+m_dbPGAngle), dLen, ptRet);
}
else if (6 == m_nEntryType || 7 == m_nEntryType)
{
ads_polar(m_ptEntry, (0+m_dbPGAngle), dLen, ptRet);
}
}
else
{
if ((1 == m_nEntryType) || (4 == m_nEntryType))
{
ads_polar(m_ptEntry, (0+m_dbPGAngle), dLen, ptRet);
}
else if ((2 == m_nEntryType) || (7 == m_nEntryType))
{
ads_polar(m_ptEntry, (0.5*PI+m_dbPGAngle), dLen, ptRet);
}
else if ((3 == m_nEntryType) || (6 == m_nEntryType))
{
ads_polar(m_ptEntry, (1.5*PI+m_dbPGAngle), dLen, ptRet);
}
else if ((5 == m_nEntryType) || (8 == m_nEntryType))
{
ads_polar(m_ptEntry, (PI+m_dbPGAngle), dLen, ptRet);
}
}
// change end
return ptRet;
}
AcGeVector3d TDbFloorPipe::GetEntryDir() const
{
// modify begin
XPoint ptRet = GetStdReturnPoint();
double dAng = ads_angle(m_ptEntry, ptRet) + 0.5*PI;
if ((1 == m_nEntryType) || (3 == m_nEntryType) || (5 == m_nEntryType) || (7 == m_nEntryType))
{
dAng = ads_angle(m_ptEntry, ptRet) - 0.5*PI;
}
dAng = CT_std_angle(dAng);
// double dAng = ads_angle(m_ptDrawSupply, m_ptDrawReturn);
// if( m_nEntryType%2 != 0 )
// dAng -= 0.5*PI;
// else
// dAng += 0.5*PI;
// dAng = CT_std_angle(dAng);
return XVector3D(XPoint(0,0,0), dAng, 1);
}
void TDbFloorPipe::DrawEntryArror(XExplodeDraw &dc, const XPoint &ptArror) const
{
int nOrigColor = dc.GetColor();
dc.SetColor(1);
double dArrorBody(200),dArror(100);
AcGeVector3d vt = GetEntryDir();
XPoint ptEnd = ptArror + vt * dArrorBody;
// 箭身
XLine line(ptArror, ptEnd, LS_FINITE);
dc.DrawLine(line);
// 箭头两个键翼
double dAngle = ads_angle(ptEnd, ptArror);
dAngle -= PI*0.25;
XPoint ptUpArr, ptDownArr;
ads_polar(ptEnd, dAngle, dArror, ptUpArr);
dAngle += PI*0.5;
ads_polar(ptEnd, dAngle, dArror, ptDownArr);
line.SetPoints(ptEnd, ptUpArr);
dc.DrawLine(line);
line.SetPoints(ptEnd, ptDownArr);
dc.DrawLine(line);
dc.SetColor(nOrigColor);
}
void TDbFloorPipe::ClearDrawPt()
{
assertWriteEnabled();
m_ptDrawSupply.x = m_ptDrawSupply.y = m_ptDrawSupply.z = 0.0;
m_ptDrawReturn = m_ptDrawSupply;
}
XPoint TDbFloorPipe::GetStartDrawPt()
{
return m_ptStartDraw;
}
void TDbFloorPipe::ClearStartDrawPt()
{
m_ptStartDraw.x = m_ptStartDraw.y = m_ptStartDraw.z = 0.0;
}
BOOL TDbFloorPipe::IsRealSameDist(double &dSameDist)
{
if( m_bSameDist )
{
dSameDist = m_nPipeLeftDist;
return TRUE;
}
if( m_nPipeType != 1 )
{
if( fabs(m_nPipeLeftDist-m_nPipeRightDist) < g_fZero &&
fabs(m_nPipeLeftDist-m_nPipeTopDist) < g_fZero )
{
dSameDist = m_nPipeLeftDist;
return TRUE;
}
return FALSE;
}
double dLBordWidth = IsLeftCheck() ? m_dBorderLeftWidth : 0;
double dRBordWidth = IsRightCheck() ? m_dBorderRightWidth : 0;
double dUBordWidth = IsTopCheck() ? m_dBorderUpWidth : 0;
double dDBordWidth = IsBottomCheck() ? m_dBorderDownWidth : 0;
CPipeStyle1 style(m_ptStart, m_ptEnd, m_ptPickEntry, m_bSameDist, (int)m_nPipeLeftDist,
(int)m_nPipeRightDist, (int)m_nPipeTopDist, (int)m_nPipeBottomDist,
m_dbPGAngle, m_nEntryType, m_dDistToWall, m_dRadius, dLBordWidth,
dRBordWidth, dUBordWidth, dDBordWidth, m_dBorderLeftDist,
m_dBorderRightDist, m_dBorderUpDist, m_dBorderDownDist, m_bWeight, m_dLineWeight, colorIndex());
if( !style.DrawPGLine() )
{
return FALSE;
}
return style.GetRealSameDist(dSameDist);
}
double TDbFloorPipe::GetPipeOutDist() const
{
if ( m_nPipeType != 1 )
{
return m_nPipeLeftDist;
}
double dLBordWidth = IsLeftCheck() ? m_dBorderLeftWidth : 0;
double dRBordWidth = IsRightCheck() ? m_dBorderRightWidth : 0;
double dUBordWidth = IsTopCheck() ? m_dBorderUpWidth : 0;
double dDBordWidth = IsBottomCheck() ? m_dBorderDownWidth : 0;
CPipeStyle1 style(m_ptStart, m_ptEnd, m_ptPickEntry, m_bSameDist, (int)m_nPipeLeftDist,
(int)m_nPipeRightDist, (int)m_nPipeTopDist, (int)m_nPipeBottomDist,
m_dbPGAngle, m_nEntryType, m_dDistToWall, m_dRadius, dLBordWidth,
dRBordWidth, dUBordWidth, dDBordWidth, m_dBorderLeftDist,
m_dBorderRightDist, m_dBorderUpDist, m_dBorderDownDist, m_bWeight, m_dLineWeight, colorIndex());
return style.GetPipeOutDist();
}
void TDbFloorPipe::GetDefaultPick()
{
if( m_ptPickEntry.x == 0 && m_ptPickEntry.y == 0 )
{
return ;
}
AcGePoint2d ptStart = m_ptStart.AsAcGePoint2d(),
ptEnd = m_ptEnd.AsAcGePoint2d(),
ptPick = m_ptAlterEntryGrip.AsAcGePoint2d();
double dTemp, dPrec = 1e-6;
ptEnd.rotateBy(-m_dbPGAngle, ptStart);
ptPick.rotateBy(-m_dbPGAngle, ptStart);
AcGeVector2d ptVec(1.0, -1.0);
double dDist = m_dDistToWall * sqrt(2.0);
ptStart += ptVec.normalize()*dDist;
ptEnd -= ptVec.normalize()*dDist;
if( ptStart.x - ptEnd.x > dPrec )
{
if( ptStart.y - ptEnd.y > dPrec )
{
dTemp = ptStart.x;
ptStart.x = ptEnd.x;
ptEnd.x = dTemp;
}
else
{
std::swap(ptStart, ptEnd);
}
}
else
{
if( ptStart.y - ptEnd.y < dPrec )
{
dTemp = ptStart.y;
ptStart.y = ptEnd.y;
ptEnd.y = dTemp;
}
}
AcGePoint3d ptAcLT(ptStart.x, ptStart.y, 0),
ptAcLB(ptStart.x, ptEnd.y, 0),
ptAcRT(ptEnd.x, ptStart.y, 0),
ptAcRB(ptEnd.x, ptEnd.y, 0);
BOOL bAdjust = FALSE;
BOOL bNoInflect = m_nPipeType!=1?TRUE:FALSE;
int nEntryType = m_nEntryType;
if( bNoInflect )
{
switch (nEntryType){
case 1:
nEntryType = 7;
break;
case 2:
case 4:
case 6:
nEntryType += 2;
break;
case 3:
case 5:
case 7:
nEntryType -= 2;
break;
case 8:
nEntryType = 2;
break;
}
}
if( ptPick.x - ptEnd.x > -dPrec )
{
if( nEntryType == 2 || nEntryType == 7 )
{
nEntryType = 8;
bAdjust = TRUE;
}
else if( nEntryType == 3 || nEntryType == 6 )
{
nEntryType = 5;
bAdjust = TRUE;
}
}
else if( ptPick.x - ptStart.x < dPrec )
{
if( nEntryType == 2 || nEntryType == 7 )
{
nEntryType = 1;
bAdjust = TRUE;
}
else if( nEntryType == 3 || nEntryType == 6 )
{
nEntryType = 4;
bAdjust = TRUE;
}
}
if( ptPick.y - ptEnd.y < dPrec )
{
if( nEntryType == 1 || nEntryType == 4 )
{
nEntryType = 2;
bAdjust = TRUE;
}
else if( nEntryType == 5 || nEntryType == 8 )
{
nEntryType = 7;
bAdjust = TRUE;
}
}
else if( ptPick.y - ptStart.y > -dPrec )
{
if( nEntryType == 1 || nEntryType == 4 )
{
nEntryType = 3;
bAdjust = TRUE;
}
else if( nEntryType == 5 || nEntryType == 8 )
{
nEntryType = 6;
bAdjust = TRUE;
}
}
if( bAdjust )
{
ads_point ptLB, ptLT, ptRB, ptRT;
ARX2AdsPt(ptAcLB, ptLB);
ARX2AdsPt(ptAcLT, ptLT);
ARX2AdsPt(ptAcRB, ptRB);
ARX2AdsPt(ptAcRT, ptRT);
XPoint ptPk;
switch(nEntryType) // 判断入口
{
case 1:
acutPolar(ptLB, 1.5*PI, m_dDistToWall+50, ptPk);
break;
case 2:
acutPolar(ptLB, PI, m_dDistToWall+50, ptPk);
break;
case 3:
acutPolar(ptLT, PI, m_dDistToWall+50, ptPk);
break;
case 4:
acutPolar(ptLT, 0.5*PI, m_dDistToWall+50, ptPk);
break;
case 5:
acutPolar(ptRT, 0.5*PI, m_dDistToWall+50, ptPk);
break;
case 6:
acutPolar(ptRT, 0, m_dDistToWall+50, ptPk);
break;
case 7:
acutPolar(ptRB, 0, m_dDistToWall+50, ptPk);
break;
case 8:
acutPolar(ptRB, 1.5*PI, m_dDistToWall+50, ptPk);
break;
}
AcGeMatrix3d mat;
mat.setToRotation(m_dbPGAngle, AcGeVector3d(0, 0, 1), m_ptStart);
ptPk.TransformBy(mat);
double nDist(-1);
int idx(-1), j(1);
for (j = 1; j < 9; j++)
{
XPoint ptEntry = GetEntryPt(j);
double nDistTmp = ads_distance(ptPk, ptEntry);
if (nDist < 0 || nDist > nDistTmp)
{
nDist = nDistTmp;
idx = j;
}
}
if (1 == m_nPipeType)
{
switch (idx){
case 1:
idx = 7;
break;
case 2:
case 4:
case 6:
idx = idx + 2;
break;
case 3:
case 5:
case 7:
idx = idx - 2;
break;
case 8:
idx = 2;
break;
}
}
m_ptPickEntry = ptPk;
SetEntryType(idx);
}
}