4157 lines
101 KiB
C++
4157 lines
101 KiB
C++
//------------------------------------------------------------------------+
|
|
// Copyright (C), 1998-2011, Beijing Tangent Software Co. Ltd.
|
|
// = FileName : TDbWall类
|
|
// = Version : ver1.0
|
|
// = Author : cet
|
|
// = CreateDate : 2011-05-09
|
|
// = Description: 剪力墙类实现
|
|
// = Maintainers:
|
|
//
|
|
//------------------------------------------------------------------------+
|
|
|
|
#include "StdAfx.h"
|
|
#ifdef TASD
|
|
#include "TDbWall.h"
|
|
#include "TAsdKeyDefine.h"
|
|
|
|
/*
|
|
Acad::ErrorStatus TDbWall::dwgInFields (AcDbDwgFiler* pFiler)
|
|
{
|
|
assertWriteEnabled();
|
|
Acad::ErrorStatus es = TDbBaseWall::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(&m_idLayerLoad);
|
|
pFiler->readItem(&m_idLayerLoadL);
|
|
pFiler->readItem(&m_idLayerLoadC);
|
|
pFiler->readItem(&m_idTextStyle);
|
|
pFiler->readItem(&m_idTextStyleRB);
|
|
|
|
return pFiler->filerStatus();
|
|
}
|
|
|
|
Acad::ErrorStatus TDbWall::dwgOutFields(AcDbDwgFiler* pFiler) const
|
|
{
|
|
assertReadEnabled();
|
|
Acad::ErrorStatus es = TDbBaseWall::dwgOutFields(pFiler);
|
|
if (es != Acad::eOk)
|
|
{
|
|
return es;
|
|
}
|
|
|
|
pFiler->writeItem(g_nVersion);
|
|
|
|
pFiler->writeItem(m_idLayerLoad);
|
|
pFiler->writeItem(m_idLayerLoadL);
|
|
pFiler->writeItem(m_idLayerLoadC);
|
|
pFiler->writeItem(m_idTextStyle);
|
|
pFiler->writeItem(m_idTextStyleRB);
|
|
|
|
return pFiler->filerStatus();
|
|
}
|
|
*/
|
|
Acad::ErrorStatus TDbWall::StruExplodeOrDraw3d( TGGiExplodeDrawBase &dc ) const
|
|
{
|
|
assertReadEnabled();
|
|
|
|
//modify by xlc on 120112荷载显示控制
|
|
if((DocGetWallShowLoad() && g_nLoadDrawMode == BYOBJLOAD)|| g_nLoadDrawMode == WALLLOAD)
|
|
{
|
|
DrawWallLoad3D(dc);
|
|
}
|
|
|
|
return Acad::eOk;
|
|
}
|
|
|
|
Acad::ErrorStatus TDbWall::StruExplodeOrDraw2d( TGGiExplodeDrawBase &dc ) const
|
|
{
|
|
assertReadEnabled();
|
|
|
|
// 墙尺寸
|
|
if (_tcscmp(dc.Desc(), XAcGiViewDraw::Descriptor())==0)
|
|
{
|
|
AcGiCommonDraw *dcCommon = ((XAcGiViewDraw &)dc).GetCommonDraw();
|
|
if (!dcCommon->context()->isPlotGeneration())
|
|
{
|
|
if(DocGetShowBH() && DocGetWallShowBH())
|
|
{
|
|
DrawBH(dc);
|
|
}
|
|
}
|
|
}
|
|
|
|
// 墙编号
|
|
if(DocGetShowNo() && DocGetWallShowCL())
|
|
{
|
|
DrawCLab(dc);
|
|
}
|
|
|
|
//modify by xlc on 120112荷载显示控制
|
|
//if (DocGetShowLoadPara())
|
|
if((DocGetWallShowLoad() && g_nLoadDrawMode == BYOBJLOAD)|| g_nLoadDrawMode == WALLLOAD)
|
|
{
|
|
DrawWallLoad(dc);
|
|
}
|
|
|
|
//if (!g_bDetailMode) //简图
|
|
//{
|
|
|
|
// TGGeCurveSegment seg;
|
|
// GetBaseLine(seg);
|
|
// seg.SetElevation(0.0);
|
|
|
|
// dc << seg;
|
|
// return Acad::eOk;
|
|
//}
|
|
|
|
// 绘制线
|
|
// 双线绘制样式
|
|
/* TBaseWallLine bwlThis;
|
|
GetThisBaseWallLine(bwlThis);
|
|
|
|
// 融合剪力墙
|
|
TDPtrList<TBaseWallLine> arBaseWallLinesS, arBaseWallLinesM, arBaseWallLinesE;
|
|
GetAssocBaseWallLine(arBaseWallLinesS, arBaseWallLinesM, arBaseWallLinesE);
|
|
|
|
// 起点融合
|
|
TBaseWallIntegrateTool::IntegrateAtTail(true, bwlThis, arBaseWallLinesS);
|
|
|
|
// 终点融合
|
|
TBaseWallIntegrateTool::IntegrateAtTail(false, bwlThis, arBaseWallLinesE);
|
|
|
|
// 墙内融合
|
|
for (int i = 0; i < arBaseWallLinesM.Length(); i++)
|
|
{
|
|
TBaseWallIntegrateTool::Integrate(bwlThis,*arBaseWallLinesM[i]);
|
|
}
|
|
|
|
// 融合柱子
|
|
TDbStruColumn *pStruColumn = NULL;
|
|
for (i = 0; i < m_arColumnIds.length(); i++)
|
|
{
|
|
acdbOpenObject(pStruColumn, m_arColumnIds[i], AcDb::kForRead);
|
|
if (pStruColumn != NULL)
|
|
{
|
|
TGGePoly2D poly2d;
|
|
pStruColumn->GetOutline(poly2d);
|
|
pStruColumn->Close();
|
|
|
|
poly2d.SetElevation(0.0);
|
|
|
|
TBaseWallIntegrateTool::Integrate(bwlThis, poly2d);
|
|
}
|
|
}
|
|
|
|
// 融合洞并绘制增加的墙线
|
|
IntegrateWallHole(bwlThis);
|
|
DrawHoleSideLine2d(dc);
|
|
|
|
TGGeVisibilityPoly2D left, right;
|
|
left = bwlThis.GetLeftLine();
|
|
right = bwlThis.GetRightLine();
|
|
AcDbObjectIdArray idArr;
|
|
GetCoverSlab(idArr);
|
|
if (idArr.length() > 0) // 有板
|
|
{
|
|
DrawWallLine2dForCoverSlab(dc, left);
|
|
DrawWallLine2dForCoverSlab(dc, right);
|
|
}
|
|
else
|
|
{
|
|
DrawBaseWall2d(dc, left, true);
|
|
DrawBaseWall2d(dc, right, false);
|
|
}
|
|
|
|
// 封闭墙体端点出封口
|
|
int nLen = arBaseWallLinesS.Length();
|
|
bool bHasColumn = IsLinkColumn(true);
|
|
if (nLen == 0 && !bHasColumn) // 起点封口
|
|
{
|
|
if (!(left.GetVisibleAt(0) == AcDb::kInvisible && right.GetVisibleAt(0) == AcDb::kInvisible))
|
|
{
|
|
dc << TGGeLine(*left[0], *right[0]);
|
|
}
|
|
}
|
|
else if (nLen == 1 && !bHasColumn) // 处理起点处有一个融合墙体时,墙体端点两点连线平行的情况
|
|
{
|
|
AcDbObjectId idWall;
|
|
GetWallId(true, idWall);
|
|
DrawSideLine2d(true, idWall, bwlThis, dc);
|
|
}
|
|
else if (nLen == 0 && bHasColumn) // 起点关联柱子
|
|
{
|
|
DrawSideLine2d(true, dc);
|
|
}
|
|
|
|
nLen = arBaseWallLinesE.Length();
|
|
bHasColumn = IsLinkColumn(false);
|
|
if (arBaseWallLinesE.Length() == 0 && !bHasColumn) // 终点封口
|
|
{
|
|
if (!(left.GetVisibleAt(left.Length() - 2) == AcDb::kInvisible && right.GetVisibleAt(right.Length() - 2) == AcDb::kInvisible))
|
|
{
|
|
dc << TGGeLine(*left[left.Length() - 1], *right[right.Length() - 1]);
|
|
}
|
|
}
|
|
else if (nLen == 1 && !bHasColumn) // 处理终点处有一个融合墙体时,墙体端点两点连线平行的情况
|
|
{
|
|
AcDbObjectId idWall;
|
|
GetWallId(false, idWall);
|
|
DrawSideLine2d(false, idWall, bwlThis, dc);
|
|
}
|
|
else if (nLen == 0 && bHasColumn) // 终点关联柱子
|
|
{
|
|
DrawSideLine2d(false, dc);
|
|
}
|
|
*/
|
|
return Acad::eOk;
|
|
}
|
|
|
|
// 几何形心上的曲线, 端点位置不能作为准确的依据
|
|
TGGeCurveSegment TDbWall::GetCenterLine() const
|
|
{
|
|
double lWidth = m_lWidth, rWidth = m_rWidth;
|
|
|
|
double nGeomCenterLeftOffset = (lWidth - rWidth) / 2.0;
|
|
TGGeCurveSegment cv = TGGeCurveSegment::Offset(OFFSET_LEFT, nGeomCenterLeftOffset, LS_FINITE);
|
|
|
|
return cv;
|
|
}
|
|
|
|
/*
|
|
Acad::ErrorStatus TDbWall::GetExtents2d( TADSGePoint3d &ptLow, TADSGePoint3d &ptUp ) const
|
|
{
|
|
TGGePoly2D poly2d;
|
|
GetPoly2D(poly2d);
|
|
poly2d.GetExtend(ptLow, ptUp);
|
|
ptLow.z = 0.0;
|
|
ptUp.z = 0.0;
|
|
return Acad::eOk;
|
|
}
|
|
|
|
Acad::ErrorStatus TDbWall::GetExtents( TADSGePoint3d &ptLow, TADSGePoint3d &ptUp ) const
|
|
{
|
|
GetExtents2d(ptLow, ptUp);
|
|
|
|
double dH = 0.0;
|
|
GetAt(KEY_H, dH);
|
|
|
|
AcGePoint3d ptS;
|
|
GetAt(KEY_START, ptS);
|
|
|
|
double dTopE1(0),dTopE2(0);
|
|
GetAt(KEY_TOPE1, dTopE1);
|
|
GetAt(KEY_TOPE2, dTopE2);
|
|
|
|
ptLow.z = ptS.z - dH;
|
|
ptUp.z = ptS.z + (dTopE1 > dTopE2 ? dTopE1 : dTopE2);
|
|
return Acad::eOk;
|
|
}
|
|
|
|
void TDbWall::GetTips( TDPtrList<TObjInfoUnit> & lstInfo) const
|
|
{
|
|
|
|
}
|
|
|
|
const TCHAR * TDbWall::GetDefaultLayer() const
|
|
{
|
|
return LAY_S_WALL_PLAN_LINE;
|
|
}
|
|
|
|
BOOL TDbWall::IsValid() const
|
|
{
|
|
assertReadEnabled();
|
|
AcGePoint3d ptS, ptE;
|
|
GetAt(KEY_START, ptS);
|
|
GetAt(KEY_END, ptE);
|
|
double dWidth = 0.0;
|
|
GetAt(KEY_W, dWidth);
|
|
|
|
if (fabs(ptS.z - ptE.z) < _DIST_SNAP && dWidth > 0)
|
|
{
|
|
return true;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
*/
|
|
/*int TDbWall::GetCtrlToggleIndex() const
|
|
{
|
|
return 10;
|
|
}*/
|
|
/*
|
|
void TDbWall::CopyPropertiesFrom( AcDbEntity *pSrcEntity, unsigned gMatchFlag )
|
|
{
|
|
assertReadEnabled();
|
|
TDbBaseWall::CopyPropertiesFrom(pSrcEntity, gMatchFlag);
|
|
TDbWall *pEnt = TDbWall::cast(pSrcEntity);
|
|
if(pEnt != NULL)
|
|
{
|
|
double dWidth = 0.0, dHeight = 0.0;
|
|
GetAt(KEY_W, dWidth);
|
|
GetAt(KEY_H, dHeight);
|
|
int nWeight = 0;
|
|
GetAt(KEY_WEIGHT, nWeight);
|
|
|
|
GetSpecialtyData()->Empty();
|
|
m_mapXData = pEnt->m_mapXData;
|
|
|
|
SetAt(KEY_W, dWidth);
|
|
SetAt(KEY_H, dHeight);
|
|
SetAt(KEY_WEIGHT, nWeight);
|
|
|
|
if(database() == NULL ||
|
|
pSrcEntity->database() == NULL ||
|
|
database() == pSrcEntity->database())
|
|
{
|
|
m_idLayerLoad = pEnt->m_idLayerLoad;
|
|
m_idLayerLoadL = pEnt->m_idLayerLoadL;
|
|
m_idLayerLoadC = pEnt->m_idLayerLoadC;
|
|
m_idTextStyle = pEnt->m_idTextStyle;
|
|
m_idTextStyleRB = pEnt->m_idTextStyleRB;
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
void TDbWall::MakeAssocRelation( AcDbObjectIdArray& ids )
|
|
{
|
|
assertWriteEnabled();
|
|
|
|
if(ids.length() < 1)
|
|
{
|
|
return;
|
|
}
|
|
|
|
TPickEntSet ss(SS_FREE);
|
|
ads_name eName;
|
|
for (int i = 0; i < ids.length(); i++)
|
|
{
|
|
if (acdbGetAdsName(eName, ids[i]) == Acad::eOk)
|
|
{
|
|
ss += ids[i];
|
|
}
|
|
}
|
|
|
|
TEntitySet ent;
|
|
#ifdef TESTCASE
|
|
//简单方式手动建立关联
|
|
for (long j = 0; j < ss.Length(); j++)
|
|
{
|
|
ent = ss[j];
|
|
if (ent.Is(_T("ATS_WALL"))) // 剪力墙
|
|
{
|
|
if (!m_arAssocBWallIds.contains(ids[j])) // 剪力墙标高相同
|
|
{
|
|
m_arAssocBWallIds.append(ids[j]);
|
|
}
|
|
}
|
|
else if (ent.Is(_T("ATS_COLUMN"))) // 柱子
|
|
{
|
|
if (!m_arColumnIds.contains(ids[j])) // 标高相同
|
|
{
|
|
m_arColumnIds.append(ids[j]);
|
|
}
|
|
}
|
|
else if (ent.Is(_T("TCH_STRU_HOLE"))) // 墙洞
|
|
{
|
|
if (!m_arHoleIds.contains(ids[j]))
|
|
{
|
|
m_arHoleIds.append(ids[j]);
|
|
}
|
|
}
|
|
else if (ent.Is(_T("ATS_STRU_FLOORSLAB"))) // 板
|
|
{
|
|
if (!m_arSlabIds.contains(ids[j]))
|
|
{
|
|
m_arSlabIds.append(ids[j]);
|
|
}
|
|
}
|
|
}
|
|
return;
|
|
#endif
|
|
|
|
TGGePoly2D poly; //墙闭合平面
|
|
GetPoly2D(poly);
|
|
|
|
double dWidth = 0; //墙平面宽
|
|
GetTotalWidth(dWidth);
|
|
|
|
TGGeCurveSegment cvCL = GetCenterLine();
|
|
cvCL.SetLineFlag(LS_INFINITE);
|
|
|
|
double dElevS = cvCL.StartPoint().z;
|
|
double dElevE = cvCL.EndPoint().z;
|
|
bool bModFlg = false; //记录墙的中心线是否调整
|
|
double dGap(0);
|
|
AcDbObjectId idObj;
|
|
|
|
for (long j = 0; j < ss.Length(); j++)
|
|
{
|
|
ent = ss[j];
|
|
if (ent.Is(_T("ATS_WALL"))) //剪力墙
|
|
{
|
|
OPENOBJ_BEGIN(ent, AcDb::kForRead, TDbWall, pEnt);
|
|
if (!pEnt)
|
|
{
|
|
continue;
|
|
}
|
|
|
|
TGGePoly2D polyDest;
|
|
pEnt->GetPoly2D(polyDest);
|
|
|
|
double dWidthDest(0);
|
|
pEnt->GetTotalWidth(dWidthDest);
|
|
|
|
bool bRet = TBaseWallIntegrateTool::GetMinGap(poly, polyDest, dGap);
|
|
//间隙小于墙宽一半时,当作关联处理
|
|
if(bRet && (dGap < dWidth*0.5 || dGap < dWidthDest*0.5))
|
|
{
|
|
if (cvCL.Is(CURVE_LINE))
|
|
{
|
|
idObj = pEnt->objectId();
|
|
//建立关联时对墙的中心线进行校验,相交
|
|
TGGeCurveSegment cvCLDest = pEnt->GetCenterLine();
|
|
cvCLDest.SetLineFlag(LS_INFINITE);
|
|
|
|
TADSGePoint3d ptInter1,ptInter2;
|
|
int nNum = cvCL.Intersection(cvCLDest,ptInter1,ptInter2);
|
|
if (nNum == 0) //没有交点,返回
|
|
{
|
|
|
|
}
|
|
else
|
|
{
|
|
//两个交点时取离cvCL中点近的
|
|
if (nNum == 2)
|
|
{
|
|
TADSGePoint3d ptMid = cvCL.MidPoint();
|
|
ptInter1 = TGGeLine(ptInter1, ptInter2).NearPoint(ptMid);
|
|
}
|
|
|
|
bool bModBreak = false;
|
|
int nHitFlag = cvCL.HitTest2d(ptInter1);
|
|
if (nHitFlag == 6) //起始侧延长线
|
|
{
|
|
bModFlg = true;
|
|
bModBreak = true;
|
|
cvCL.SetStartPoint(ptInter1);
|
|
}
|
|
else if (nHitFlag == 7) //终止侧延长线
|
|
{
|
|
bModFlg = true;
|
|
bModBreak = true;
|
|
cvCL.SetEndPoint(ptInter1);
|
|
}
|
|
|
|
//add by xlc on 120417 墙自动打断
|
|
if (g_bAutoBreak)
|
|
{
|
|
if (bModBreak)
|
|
{
|
|
Acad::ErrorStatus es = upgradeOpen();
|
|
if ((es == Acad::eOk || es == Acad::eWasOpenForWrite))
|
|
{
|
|
AcGePoint3d pt = cvCL.StartPoint();
|
|
pt.z = dElevS;
|
|
SetAt(KEY_START, pt);
|
|
|
|
pt = cvCL.EndPoint();
|
|
pt.z = dElevE;
|
|
SetAt(KEY_END, pt);
|
|
}
|
|
}
|
|
|
|
bool bBreak = false;
|
|
if(nHitFlag == 5) //交点在线内时对自己进行打断
|
|
{
|
|
if(BreakAt(ptInter1,NULL))
|
|
{
|
|
bModFlg = false;
|
|
bBreak = true;
|
|
}
|
|
}
|
|
|
|
bool bModifyOld = g_bModifyAgain;
|
|
pEnt->BreakAt(ptInter1, NULL);
|
|
g_bModifyAgain = bModifyOld;
|
|
|
|
if (bBreak)
|
|
{
|
|
break;
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
continue;
|
|
}
|
|
OPENOBJ_END();
|
|
|
|
if (!m_arAssocBWallIds.contains(idObj))
|
|
{
|
|
m_arAssocBWallIds.append(idObj);
|
|
}
|
|
|
|
}
|
|
else if (ent.Is(_T("ATS_COLUMN"))) // 柱子
|
|
{
|
|
OPENOBJ_BEGIN(ent, AcDb::kForRead, TDbStruColumn, pEnt);
|
|
if (!pEnt)
|
|
{
|
|
continue;
|
|
}
|
|
|
|
TGGePoly2D polyDest;
|
|
pEnt->GetOutline(polyDest);
|
|
polyDest.SetElevation(0);
|
|
|
|
bool bRet = TBaseWallIntegrateTool::GetMinGap(poly,polyDest,dGap);
|
|
//间隙小于墙宽一半时,当作关联处理
|
|
if (bRet && dGap < dWidth*0.5)
|
|
{
|
|
if (g_bAutoBreak)
|
|
{
|
|
AcGePoint3d pt;
|
|
pEnt->GetAt(KEY_INSPTI, pt);
|
|
|
|
BreakAt(TADSGePoint3d(pt), &polyDest);
|
|
}
|
|
idObj = pEnt->objectId();
|
|
}
|
|
else
|
|
{
|
|
continue;
|
|
}
|
|
OPENOBJ_END();
|
|
|
|
if (!m_arColumnIds.contains(idObj))
|
|
{
|
|
m_arColumnIds.append(idObj);
|
|
}
|
|
}
|
|
else if (ent.Is(_T("TCH_STRU_HOLE"))) // 墙洞
|
|
{
|
|
OPENOBJ_BEGIN(ent, AcDb::kForRead, TDbWallHole, pEnt);
|
|
if (!pEnt)
|
|
{
|
|
continue;
|
|
}
|
|
|
|
TGGePoly2D polyDest;
|
|
TGGeCurveSegment cv;
|
|
pEnt->GetOutlinePoly2D(0, polyDest, cv);
|
|
polyDest.SetElevation(0);
|
|
|
|
// 判断间隙
|
|
bool bRet = TBaseWallIntegrateTool::GetMinGap(poly,polyDest,dGap);
|
|
if (bRet && dGap < _DIST_SNAP)
|
|
{
|
|
idObj = pEnt->objectId();
|
|
}
|
|
else
|
|
{
|
|
continue;
|
|
}
|
|
OPENOBJ_END();
|
|
|
|
if (!m_arHoleIds.contains(idObj))
|
|
{
|
|
m_arHoleIds.append(idObj);
|
|
}
|
|
}
|
|
else if (ent.Is(_T("ATS_STRU_FLOORSLAB"))) // 板
|
|
{
|
|
OPENOBJ_BEGIN(ent, AcDb::kForRead, TDbStruFloorSlab, pEnt);
|
|
if (!pEnt)
|
|
{
|
|
continue;
|
|
}
|
|
|
|
TGGePoly2D polyDest;
|
|
pEnt->GetOutline(polyDest);
|
|
polyDest.SetElevation(0);
|
|
|
|
// 判断间隙
|
|
bool bRet = TBaseWallIntegrateTool::GetMinGap(poly,polyDest,dGap);
|
|
if (bRet && dGap < _DIST_SNAP)
|
|
{
|
|
idObj = pEnt->objectId();
|
|
}
|
|
else
|
|
{
|
|
continue;
|
|
}
|
|
OPENOBJ_END();
|
|
|
|
if (!m_arSlabIds.contains(idObj))
|
|
{
|
|
m_arSlabIds.append(idObj);
|
|
}
|
|
}
|
|
}
|
|
|
|
// 修改墙的端点
|
|
if (bModFlg)
|
|
{
|
|
Acad::ErrorStatus es = upgradeOpen();
|
|
if ((es == Acad::eOk || es == Acad::eWasOpenForWrite))
|
|
{
|
|
AcGePoint3d pt = cvCL.StartPoint();
|
|
pt.z = dElevS;
|
|
SetAt(KEY_START, pt);
|
|
|
|
pt = cvCL.EndPoint();
|
|
pt.z = dElevE;
|
|
SetAt(KEY_END, pt);
|
|
}
|
|
}
|
|
}
|
|
|
|
void TDbWall::RemoveAssocRelation( AcDbObjectId& id )
|
|
{
|
|
m_arAssocBWallIds.remove(id);
|
|
m_arColumnIds.remove(id);
|
|
m_arHoleIds.remove(id);
|
|
m_arSlabIds.remove(id);
|
|
}
|
|
|
|
Acad::ErrorStatus TDbWall::DrawSideLine2d(bool bStart, const AcDbObjectId &idWall, const TBaseWallLine &wallLine, TGGiExplodeDrawBase &dc) const
|
|
{
|
|
TDbWall *pWall = NULL;
|
|
acdbOpenObject(pWall, idWall, AcDb::kForRead);
|
|
if (pWall != NULL)
|
|
{
|
|
TBaseWallLine bwlThat;
|
|
pWall->GetThisBaseWallLine(bwlThat);
|
|
int nThatWeight = 0;
|
|
pWall->GetAt(KEY_WEIGHT, nThatWeight);
|
|
pWall->close();
|
|
|
|
// 判断墙线融合方式
|
|
TADSGePoint3d ptThat1,ptThat2;
|
|
TBaseWallLine bwlThis;
|
|
GetThisBaseWallLine(bwlThis);
|
|
int nType = TBaseWallIntegrateTool::IsIntegrateAtTail(bwlThat, bwlThis);
|
|
if (nType == 1) // 起始端相交
|
|
{
|
|
TGGeVisibilityPoly2D leftThat = bwlThat.GetLeftLine();
|
|
TGGeVisibilityPoly2D rightThat = bwlThat.GetRightLine();
|
|
ptThat1 = *leftThat[0];
|
|
ptThat2 = *rightThat[0];
|
|
}
|
|
else if (nType == 2) // 终止端相交
|
|
{
|
|
TGGeVisibilityPoly2D leftThat = bwlThat.GetLeftLine();
|
|
TGGeVisibilityPoly2D rightThat = bwlThat.GetRightLine();
|
|
ptThat1 = *leftThat[leftThat.Length() - 1];
|
|
ptThat2 = *rightThat[leftThat.Length() - 1];
|
|
}
|
|
else
|
|
{
|
|
return Acad::eOk;
|
|
}
|
|
|
|
if (!!ptThat1 && !!ptThat2)
|
|
{
|
|
TADSGePoint3d ptThis1,ptThis2;
|
|
TGGeVisibilityPoly2D leftThis = bwlThis.GetLeftLine();
|
|
TGGeVisibilityPoly2D rightThis = bwlThis.GetRightLine();
|
|
if (bStart)
|
|
{
|
|
ptThis1 = *leftThis[0];
|
|
ptThis2 = *rightThis[0];
|
|
}
|
|
else
|
|
{
|
|
ptThis1 = *leftThis[leftThis.Length() - 1];
|
|
ptThis2 = *rightThis[rightThis.Length() - 1];
|
|
}
|
|
|
|
AcGeVector3d vtThat = ptThat1 - ptThat2;
|
|
AcGeVector3d vtThis = ptThis1 - ptThis2;
|
|
int nThisWeight = 0;
|
|
GetAt(KEY_WEIGHT, nThisWeight);
|
|
if (vtThis.isParallelTo(vtThat)) // 端点连线平行
|
|
{
|
|
if (nThisWeight < nThatWeight) // 比较优先级
|
|
{
|
|
dc << TGGeLine(ptThis1, ptThis2);
|
|
}
|
|
else
|
|
{
|
|
bool bSuperposition = (ptThat1.Distance(ptThis1) < _DIST_SNAP && ptThat2.Distance(ptThis2) < _DIST_SNAP)
|
|
|| (ptThat1.Distance(ptThis2) < _DIST_SNAP && ptThat2.Distance(ptThis1) < _DIST_SNAP); // 融合端点两两重合
|
|
if (!bSuperposition)
|
|
{
|
|
// 将that的融合端点投影到this融合端点连线的直线上
|
|
std::vector<TADSGePoint3d> vecPt;
|
|
vecPt.push_back(ptThis1);
|
|
vecPt.push_back(ptThis2);
|
|
TADSGePoint3d pt;
|
|
TGGeLine line(ptThis1, ptThis2);
|
|
ptThat1.Project(&line, pt);
|
|
vecPt.push_back(pt);
|
|
ptThat2.Project(&line, pt);
|
|
vecPt.push_back(pt);
|
|
|
|
// 求两点间的距离
|
|
std::map<double, std::vector<TADSGePoint3d> > mapData;
|
|
std::vector<TADSGePoint3d> vecTemp;
|
|
std::vector<TADSGePoint3d>::iterator it1, it2;
|
|
for (it1 = vecPt.begin(); it1 != vecPt.end(); it1++)
|
|
{
|
|
it2 = it1;
|
|
++it2;
|
|
for (; it2 != vecPt.end(); it2++)
|
|
{
|
|
vecTemp.clear();
|
|
vecTemp.push_back(*it1);
|
|
vecTemp.push_back(*it2);
|
|
mapData.insert(std::make_pair((*it1).Distance(*it2), vecTemp));
|
|
}
|
|
}
|
|
|
|
// 获取距离最远的点
|
|
std::map<double, std::vector<TADSGePoint3d> >::iterator it;
|
|
it = mapData.end();
|
|
--it;
|
|
vecTemp.clear();
|
|
vecTemp.push_back((*it).second[0]);
|
|
vecTemp.push_back((*it).second[1]);
|
|
|
|
// 从vecPt中删除最远的两点
|
|
for (it1 = vecTemp.begin(); it1 != vecTemp.end(); it1++)
|
|
{
|
|
for (it2 = vecPt.begin(); it2 != vecPt.end(); it2++)
|
|
{
|
|
if ((*it1).Distance(*it2) < _DIST_SNAP)
|
|
{
|
|
vecPt.erase(it2);
|
|
break;;
|
|
}
|
|
}
|
|
}
|
|
|
|
// this的融合端点是否与最远点重合
|
|
if (ptThis1.Distance(vecTemp[0]) < _DIST_SNAP || ptThis1.Distance(vecTemp[1]) < _DIST_SNAP)
|
|
{
|
|
double dDist1 = ptThis1.Distance(vecPt[0]);
|
|
double dDist2 = ptThis1.Distance(vecPt[1]);
|
|
if (dDist1 < dDist2)
|
|
{
|
|
dc << TGGeLine(ptThis1, vecPt[0]);
|
|
}
|
|
else
|
|
{
|
|
dc << TGGeLine(ptThis1, vecPt[1]);
|
|
}
|
|
}
|
|
|
|
if (ptThis2.Distance(vecTemp[0]) < _DIST_SNAP || ptThis2.Distance(vecTemp[1]) < _DIST_SNAP)
|
|
{
|
|
double dDist1 = ptThis2.Distance(vecPt[0]);
|
|
double dDist2 = ptThis2.Distance(vecPt[1]);
|
|
if (dDist1 < dDist2)
|
|
{
|
|
dc << TGGeLine(ptThis2, vecPt[0]);
|
|
}
|
|
else
|
|
{
|
|
dc << TGGeLine(ptThis2, vecPt[1]);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
else if (nThatWeight != nThisWeight) // 优先级不同
|
|
{
|
|
TGGeVisibilityPoly2D left = wallLine.GetLeftLine();
|
|
TGGeVisibilityPoly2D right = wallLine.GetRightLine();
|
|
if (bStart)
|
|
{
|
|
dc << TGGeLine(*left[0], *right[0]);
|
|
}
|
|
else
|
|
{
|
|
dc << TGGeLine(*left[left.Length() - 1], *right[right.Length() - 1]);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
return Acad::eOk;
|
|
}
|
|
|
|
Acad::ErrorStatus TDbWall::DrawSideLine2d(bool bStart, TGGiExplodeDrawBase &dc) const
|
|
{
|
|
// 查看端点与柱子是否发生融合
|
|
TBaseWallLine bwLine;
|
|
GetThisBaseWallLine(bwLine);
|
|
TGGeVisibilityPoly2D left = bwLine.GetLeftLine();
|
|
TGGeVisibilityPoly2D right = bwLine.GetRightLine();
|
|
TADSGePoint3d pt1, pt2; // 端点
|
|
if (bStart) // 起点
|
|
{
|
|
pt1 = *left[0];
|
|
pt2 = *right[0];
|
|
}
|
|
else // 终点
|
|
{
|
|
pt1 = *left[left.Length() - 1];
|
|
pt2 = *right[right.Length() - 1];
|
|
}
|
|
|
|
AcDbLine line(pt1, pt2);
|
|
TDbStruColumn *pStruColumn = NULL;
|
|
for (int i = 0; i < m_arColumnIds.length(); i++)
|
|
{
|
|
acdbOpenObject(pStruColumn, m_arColumnIds[i], AcDb::kForRead);
|
|
if (pStruColumn != NULL)
|
|
{
|
|
TGGePoly2D poly2d;
|
|
pStruColumn->GetOutline(poly2d);
|
|
pStruColumn->Close();
|
|
bool bLink1 = (pt1 & poly2d) == PR_EDGE || (pt1 & poly2d) == PR_INSIDE;
|
|
bool bLink2 = (pt2 & poly2d) == PR_EDGE || (pt2 & poly2d) == PR_INSIDE;
|
|
// 端点只要一点与柱子相连时,墙体部分封口
|
|
if ((bLink1 && !bLink2) || (!bLink1 && bLink2))
|
|
{
|
|
TADSGePoint3d pt;
|
|
if (bLink1 && !bLink2)
|
|
{
|
|
pt = pt2;
|
|
}
|
|
else
|
|
{
|
|
pt = pt1;
|
|
}
|
|
|
|
AcDbLine line(pt1,pt2);
|
|
AcDbCurve *pCurve = poly2d.AsAcDbCurve();
|
|
AcGePoint3dArray arrPt;
|
|
line.intersectWith(pCurve, AcDb::kOnBothOperands, arrPt);
|
|
if (arrPt.length() == 1)
|
|
{
|
|
pt1 = arrPt[0]; // 将AcGePoint3d转化为TADSGePoint3d
|
|
dc << TGGeLine(pt, pt1);
|
|
}
|
|
else if (arrPt.length() > 1)
|
|
{
|
|
std::map<double, TADSGePoint3d> data;
|
|
for (int i = 0; i < arrPt.length(); i++)
|
|
{
|
|
data.insert(std::make_pair(pt.Distance(arrPt[i]), arrPt[i]));
|
|
}
|
|
|
|
//获得最近的交点
|
|
pt1 = (*data.begin()).second;
|
|
dc << TGGeLine(pt1, pt);
|
|
}
|
|
|
|
break;
|
|
}
|
|
else if (!bLink1 && !bLink2) // 两点都与poly2d不相连
|
|
{
|
|
AcGePoint3dArray ptArr;
|
|
AcDbCurve *pCurve = poly2d.AsAcDbCurve();
|
|
if (pCurve != NULL)
|
|
{
|
|
pCurve->intersectWith(&line, AcDb::kOnBothOperands, ptArr);
|
|
if (ptArr.length() == 1)
|
|
{
|
|
dc << TGGeLine(pt1, pt2);
|
|
break;
|
|
}
|
|
else if (ptArr.length() == 2)
|
|
{
|
|
double dDist1 = 0.0, dDist2 = 0.0;
|
|
dDist1 = pt1.Distance(ptArr[0]);
|
|
dDist2 = pt1.Distance(ptArr[1]);
|
|
if(dDist2 > dDist1)
|
|
{
|
|
dc << TGGeLine(pt1, asDblArray(ptArr[0]));
|
|
}
|
|
else
|
|
{
|
|
dc << TGGeLine(pt1, asDblArray(ptArr[1]));
|
|
}
|
|
|
|
dDist1 = pt2.Distance(ptArr[0]);
|
|
dDist2 = pt2.Distance(ptArr[1]);
|
|
if(dDist2 > dDist1)
|
|
{
|
|
dc << TGGeLine(pt2, asDblArray(ptArr[0]));
|
|
}
|
|
else
|
|
{
|
|
dc << TGGeLine(pt2, asDblArray(ptArr[1]));
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
return Acad::eOk;
|
|
}
|
|
|
|
Acad::ErrorStatus TDbWall::DrawHoleSideLine2d(TGGiExplodeDrawBase &dc) const
|
|
{
|
|
TBaseWallLine wallLine;
|
|
GetThisBaseWallLine(wallLine);
|
|
TGGeVisibilityPoly2D &left = wallLine.GetLeftLine();
|
|
TGGeVisibilityPoly2D &right = wallLine.GetRightLine();
|
|
double dWallWidth = 0.0;
|
|
GetAt(KEY_W, dWallWidth);
|
|
|
|
for(int i = 0; i < m_arHoleIds.length(); i++)
|
|
{
|
|
TDbWallHole *pHole = NULL;
|
|
acdbOpenObject(pHole, m_arHoleIds[i], AcDb::kForRead);
|
|
if (pHole == NULL)
|
|
{
|
|
continue;
|
|
}
|
|
|
|
int nShapeType = -1;
|
|
pHole->GetAt(KEY_SECTYP, nShapeType);
|
|
double dHoleR = 0.0;
|
|
pHole->GetAt(KEY_R, dHoleR);
|
|
if (fabs(dHoleR) > _DIST_SNAP && nShapeType != ST_RECT) // 弧墙只处理矩形洞
|
|
{
|
|
pHole->close();
|
|
continue;
|
|
}
|
|
|
|
TGGePoly2D poly;
|
|
TGGeCurveSegment seg;
|
|
pHole->GetOutlinePoly2D(0.0, poly, seg);
|
|
int nHoleStyle = 0;
|
|
pHole->GetAt(KEY_BORE, nHoleStyle);
|
|
double dHoleWidth = 0.0;
|
|
pHole->GetAt(KEY_W, dHoleWidth);
|
|
pHole->close();
|
|
|
|
if (poly.Length() != 4)
|
|
{
|
|
continue;
|
|
}
|
|
|
|
bool bBore = true;
|
|
if (nHoleStyle == 0) // 不贯穿洞
|
|
{
|
|
bBore = false;
|
|
}
|
|
|
|
TGGeCurveSegment seg1, seg2;
|
|
poly.Nth(1, seg1);
|
|
poly.Nth(3, seg2);
|
|
TADSGePoint3d pt1, pt2, pt3, pt4;
|
|
seg1.GetStartPoint(pt1);
|
|
seg1.GetEndPoint(pt2);
|
|
seg2.GetStartPoint(pt3);
|
|
seg2.GetEndPoint(pt4);
|
|
|
|
if (!(PtIsOnPoly2d(pt1, left) && PtIsOnPoly2d(pt2, left) || PtIsOnPoly2d(pt3, right) && PtIsOnPoly2d(pt4, right)
|
|
|| PtIsOnPoly2d(pt3, left) && PtIsOnPoly2d(pt4, left) || PtIsOnPoly2d(pt1, right) && PtIsOnPoly2d(pt2, right)))
|
|
{
|
|
continue;
|
|
}
|
|
|
|
if (bBore)//贯穿洞
|
|
{
|
|
TGGeCurveSegment seg1, seg2;
|
|
poly.Nth(0, seg1);
|
|
poly.Nth(2, seg2);
|
|
dc << seg1;
|
|
dc << seg2;
|
|
}
|
|
else//不贯穿洞
|
|
{
|
|
TGGeCurveSegment seg1, seg2, seg3;
|
|
poly.Nth(0, seg1);
|
|
poly.Nth(2, seg2);
|
|
poly.Nth(3, seg3);
|
|
dc << seg1;
|
|
dc << seg2;
|
|
dc << seg3;
|
|
}
|
|
|
|
}
|
|
|
|
return Acad::eOk;
|
|
}
|
|
|
|
void TDbWall::GetPoly2dBehindIntegrate(TGGePoly2D &poly2d) const
|
|
{
|
|
assertReadEnabled();
|
|
TBaseWallLine bwlThis;
|
|
GetThisBaseWallLine(bwlThis);
|
|
|
|
// 通过融合剪切墙体
|
|
TDPtrList<TBaseWallLine> arBaseWallLinesS, arBaseWallLinesM, arBaseWallLinesE;
|
|
GetAssocBaseWallLine(arBaseWallLinesS, arBaseWallLinesM, arBaseWallLinesE);
|
|
|
|
// 起点融合
|
|
TBaseWallIntegrateTool::IntegrateAtTail(true, bwlThis, arBaseWallLinesS);
|
|
|
|
// 终点融合
|
|
TBaseWallIntegrateTool::IntegrateAtTail(false, bwlThis, arBaseWallLinesE);
|
|
|
|
// 端点融合后新生成的墙线
|
|
TGGeVisibilityPoly2D left, right;
|
|
left = bwlThis.GetLeftLine();
|
|
right = bwlThis.GetRightLine();
|
|
|
|
// 删除端点出不可见的墙线
|
|
DeleteInVisiblePt(true, left);
|
|
DeleteInVisiblePt(false,left);
|
|
DeleteInVisiblePt(true, right);
|
|
DeleteInVisiblePt(false, right);
|
|
|
|
// 有left,right生成闭合poly2d
|
|
AcDbPolyline* pLwPoly = new AcDbPolyline();
|
|
double dBuge = 0.0;
|
|
int nIndex = 0;
|
|
for (int i = 0; i < left.Length(); i++)
|
|
{
|
|
dBuge = tan(*(left.m_ardbulges[i]) / 4.0);
|
|
pLwPoly->addVertexAt(nIndex, (*left[i]).AsAcGePoint2d(), dBuge);
|
|
++nIndex;
|
|
}
|
|
|
|
for (i = right.Length() - 1; i >= 0; i--)
|
|
{
|
|
if (i > 0)
|
|
{
|
|
dBuge = tan(*(right.m_ardbulges[i-1]) / 4.0) * (-1);
|
|
}
|
|
else
|
|
{
|
|
dBuge = 0.0;
|
|
}
|
|
pLwPoly->addVertexAt(nIndex, (*right[i]).AsAcGePoint2d(), dBuge);
|
|
++nIndex;
|
|
}
|
|
|
|
pLwPoly->setClosed(Adesk::kTrue);
|
|
poly2d.SetAcDbCurve(pLwPoly);
|
|
delete pLwPoly;
|
|
}
|
|
|
|
void TDbWall::DeleteInVisiblePt(bool bStart, TGGeVisibilityPoly2D &poly) const
|
|
{
|
|
if (bStart) // 删除起点处不可见的点
|
|
{
|
|
for (int i = 0; i < poly.Length(); i++)
|
|
{
|
|
if (poly.GetVisibleAt(i) == AcDb::kInvisible)
|
|
{
|
|
poly.RemoveNode(i);
|
|
continue;
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
else // 删除终点处不可见的点
|
|
{
|
|
for (int i = poly.Length() - 1; i >= 0 ; i--)
|
|
{
|
|
if (poly.GetVisibleAt(i) == AcDb::kInvisible && i > 0 && poly.GetVisibleAt(i - 1) == AcDb::kInvisible)
|
|
{
|
|
poly.RemoveNode(i);
|
|
continue;
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
Acad::ErrorStatus TDbWall::DrawLineWall3d( TGGiExplodeDrawBase &dc ) const
|
|
{
|
|
TGGePoly2D poly;
|
|
GetPoly2dBehindIntegrate(poly);
|
|
if (poly.Length() != 4)
|
|
{
|
|
return Acad::eOk;
|
|
}
|
|
|
|
double dH = 0.0; // 墙高
|
|
GetAt(KEY_H, dH);
|
|
AcGePoint3d pt;
|
|
GetAt(KEY_START, pt);
|
|
poly.SetElevation(pt.z);
|
|
//顶高
|
|
double dTop1 = 0.0, dTop2 = 0.0;
|
|
GetAt(KEY_TOPE1, dTop1);
|
|
GetAt(KEY_TOPE2, dTop2);
|
|
poly[0]->z += dTop1;
|
|
poly[1]->z += dTop2;
|
|
poly[2]->z += dTop2;
|
|
poly[3]->z += dTop1;
|
|
|
|
// 绘制左侧面
|
|
TADSGePoint3d ptS = *poly[0], ptE = *poly[1]; // 左墙起点终点
|
|
TGGePoly2D polyBotLeft(1);
|
|
polyBotLeft.AppendNode(ptS);
|
|
polyBotLeft.AppendNode(ptE);
|
|
TADSGePoint3d pt1=ptS,pt2=ptE;
|
|
pt2.z -=dH + dTop2;
|
|
pt1.z -=dH + dTop1;
|
|
polyBotLeft.AppendNode(pt2);
|
|
polyBotLeft.AppendNode(pt1);
|
|
|
|
TGGeCurveSegment seg; // 剪力墙型心线
|
|
GetBaseLine(seg);
|
|
seg.StartPoint().z = 0.0;
|
|
seg.EndPoint().z = 0.0;
|
|
|
|
// 左墙面洞
|
|
TDPtrList<TGGePoly2D> lstHoleLeft;
|
|
AcGeVector3d vt = ptE - ptS;
|
|
vt.z = 0.0;
|
|
vt.normalize();
|
|
vt.rotateBy(PI / 2, AcGeVector3d::kZAxis);
|
|
AcGeMatrix3d mat;
|
|
double dWidth = 0.0;
|
|
GetAt(KEY_W, dWidth);
|
|
TGGePoly2D poly2d;
|
|
AcGePoint3d ptIns; // 墙洞插入点
|
|
TADSGePoint3d ptTemp;
|
|
TDbWallHole *pHole = NULL;
|
|
for (int i = 0; i < m_arHoleIds.length(); i++)
|
|
{
|
|
if (!IsHoleInWall(m_arHoleIds[i]))
|
|
{
|
|
continue;
|
|
}
|
|
|
|
acdbOpenObject(pHole, m_arHoleIds[i], AcDb::kForRead);
|
|
if (pHole != NULL)
|
|
{
|
|
poly2d.Reset();
|
|
pHole->GetOutline(poly2d);
|
|
double dHoleThick = 0.0;
|
|
pHole->GetAt(KEY_THICK, dHoleThick);
|
|
int nBore = 0;
|
|
pHole->GetAt(KEY_BORE, nBore);
|
|
pHole->Close();
|
|
|
|
if (nBore == 1) // 贯穿
|
|
{
|
|
mat.setToTranslation(vt * dWidth * 0.5);
|
|
}
|
|
else // 非贯穿
|
|
{
|
|
mat.setToTranslation(vt * dHoleThick * 0.5);
|
|
}
|
|
|
|
poly2d.TransformBy(mat);
|
|
TGGePoly2D *pPolyIn=new TGGePoly2D(poly2d);
|
|
lstHoleLeft.Append(pPolyIn);
|
|
}
|
|
}
|
|
|
|
dc.DrawShell(polyBotLeft, lstHoleLeft);
|
|
|
|
// 绘制右侧面
|
|
ptS = *poly[3], ptE = *poly[2]; // 右墙起点终点
|
|
TGGePoly2D polyBotRight(1);
|
|
polyBotRight.AppendNode(ptS);
|
|
polyBotRight.AppendNode(ptE);
|
|
pt1=ptS,pt2=ptE;
|
|
pt2.z -=dH + dTop2;
|
|
pt1.z -=dH + dTop1;
|
|
polyBotRight.AppendNode(pt2);
|
|
polyBotRight.AppendNode(pt1);
|
|
|
|
// 右墙面洞;
|
|
TDPtrList<TGGePoly2D> lstHoleRight;
|
|
pHole = NULL;
|
|
for (i = 0; i < m_arHoleIds.length(); i++)
|
|
{
|
|
if (!IsHoleInWall(m_arHoleIds[i]))
|
|
{
|
|
continue;
|
|
}
|
|
|
|
acdbOpenObject(pHole, m_arHoleIds[i], AcDb::kForRead);
|
|
if (pHole != NULL)
|
|
{
|
|
poly2d.Reset();
|
|
pHole->GetOutline(poly2d);
|
|
double dHoleThick = 0.0;
|
|
pHole->GetAt(KEY_THICK, dHoleThick);
|
|
int nBore = 0;
|
|
pHole->GetAt(KEY_BORE, nBore);
|
|
pHole->Close();
|
|
|
|
if (nBore == 1) // 贯穿
|
|
{
|
|
mat.setToTranslation(vt * dWidth * 0.5);
|
|
}
|
|
else // 非贯穿
|
|
{
|
|
mat.setToTranslation(vt * dHoleThick * 0.5);
|
|
}
|
|
poly2d.TransformBy(mat);
|
|
TGGePoly2D *pPolyIn=new TGGePoly2D(poly2d);
|
|
lstHoleRight.Append(pPolyIn);
|
|
}
|
|
}
|
|
|
|
dc.DrawShell(polyBotRight, lstHoleRight);
|
|
|
|
AcGeVector3d vtDir = AcGeVector3d::kZAxis;
|
|
// 两起点侧面
|
|
TGGePoly2D polyTemp;
|
|
polyTemp.AppendNode(*poly[0]);
|
|
polyTemp.AppendNode(*poly[3]);
|
|
polyTemp.AppendNode(*poly[3] - vtDir * (dH + dTop1));
|
|
polyTemp.AppendNode(*poly[0] - vtDir * (dH + dTop1));
|
|
dc.DrawShell(polyTemp);
|
|
|
|
// 两终点侧面
|
|
polyTemp.Reset();
|
|
polyTemp.AppendNode(*poly[1]);
|
|
polyTemp.AppendNode(*poly[2]);
|
|
polyTemp.AppendNode(*poly[2] - vtDir * (dH + dTop2));
|
|
polyTemp.AppendNode(*poly[1] - vtDir * (dH + dTop2));
|
|
dc.DrawShell(polyTemp);
|
|
|
|
// 绘制上下底面
|
|
dc.DrawShell(poly); // 上底面
|
|
for (i = 0; i < poly.Length(); i++)
|
|
{
|
|
poly[i]->z = pt.z;
|
|
*poly[i] -= vtDir * dH;
|
|
}
|
|
dc.DrawShell(poly); // 下底面
|
|
|
|
return Acad::eOk;
|
|
}
|
|
|
|
Acad::ErrorStatus TDbWall::DrawArcWall3d( TGGiExplodeDrawBase &dc ) const
|
|
{
|
|
TGGePoly2D poly;
|
|
GetPoly2dBehindIntegrate(poly);
|
|
if (poly.Length() != 4)
|
|
{
|
|
return Acad::eOk;
|
|
}
|
|
|
|
double dH = 0.0, dWidth = 0.0,dBugle = 0.0;
|
|
GetAt(KEY_H, dH);
|
|
|
|
//poly.SetElevation(poly[0]->z-dH);
|
|
AcGePoint3d pt;
|
|
GetAt(KEY_START, pt);
|
|
poly.SetElevation(pt.z-dH);
|
|
|
|
TGGeArc arcLeft, arcRight; // 左右弧线
|
|
TGGeLine line1,line2;
|
|
if (poly.Nth(0, line1, arcLeft) != ARC_SEGMENT || poly.Nth(2, line2, arcRight) != ARC_SEGMENT)
|
|
{
|
|
return Acad::eOk;
|
|
}
|
|
|
|
GetAt(KEY_W, dWidth);
|
|
GetAt(KEY_BULGE, dBugle);
|
|
AcGePoint3d ptS, ptE;
|
|
GetAt(KEY_START, ptS);
|
|
GetAt(KEY_END, ptE);
|
|
ptS.z -= dH;
|
|
ptE.z -= dH;
|
|
TGGeArc arcMid(ptS, ptE, dBugle);
|
|
|
|
TArc3DWall left(arcMid, dH , dWidth * 0.5, dWidth * 0.5);
|
|
|
|
// 洞, 需排序后操作
|
|
TDPtrList<TArcSection> holes;
|
|
TDbWallHole *pHole = NULL;
|
|
std::map<double, TArcSection*> mapHoles;
|
|
AcGePoint3d ptIns;
|
|
TGGeCurveSegment baseLine;
|
|
GetBaseLine(baseLine);
|
|
for (int i = 0; i < m_arHoleIds.length(); i++)
|
|
{
|
|
if (!IsHoleInWall(m_arHoleIds[i]))
|
|
{
|
|
continue;
|
|
}
|
|
|
|
acdbOpenObject(pHole, m_arHoleIds[i], AcDb::kForRead);
|
|
if (pHole != NULL)
|
|
{
|
|
TGGeCurveSegment seg;
|
|
TGGePoly2D poly;
|
|
pHole->GetOutlinePoly2D(pHole->GetBottomElev(), poly, seg);
|
|
TGGePoly2D poly2d;
|
|
pHole->GetOutline(poly2d);
|
|
pHole->GetAt(KEY_POS, ptIns);
|
|
|
|
double dHoleHeight = 0.0; // 洞高
|
|
pHole->GetAt(KEY_SUMH, dHoleHeight);
|
|
int nBore = 0;
|
|
pHole->GetAt(KEY_BORE, nBore);
|
|
pHole->Close();
|
|
if (poly2d.Length() != 4) // 弧墙时只处理矩形洞情况
|
|
{
|
|
continue;
|
|
}
|
|
|
|
double dH2 = fabs(seg.StartPoint().z - ptS.z); // 洞距墙体高度
|
|
seg.SetElevation(ptS.z);
|
|
|
|
if (seg.Is(CURVE_ARC))
|
|
{
|
|
TGGeArc arc(seg.StartPoint(),seg.EndPoint(), seg.GetBulge());
|
|
if (nBore == 0) // 当洞不贯穿时,以贯穿方式显示
|
|
{
|
|
// 调整洞的中心线使其在墙的中心线上
|
|
baseLine.SetElevation(seg.StartPoint().z);
|
|
TADSGePoint3d pt1, pt2, pt3;
|
|
baseLine.ProjectToMe(seg.GetStartPoint(), pt1);
|
|
baseLine.ProjectToMe(seg.GetEndPoint(), pt2);
|
|
baseLine.ProjectToMe(seg.MidPoint(), pt3);
|
|
arc.Set(pt1, pt3, pt2);
|
|
}
|
|
|
|
TArcSection *pSection = new TArcSection(arc, dH2, dHoleHeight, TRUE);
|
|
baseLine.SetElevation(ptIns.z);
|
|
double dDist = baseLine.PathDistance(ptIns);
|
|
mapHoles.insert(std::make_pair(dDist, pSection));
|
|
}
|
|
}
|
|
}
|
|
|
|
std::map<double, TArcSection*>::iterator it;
|
|
for (it = mapHoles.begin(); it != mapHoles.end(); it++)
|
|
{
|
|
holes.Append((*it).second);
|
|
}
|
|
left.MakeWall(dc, arcLeft, arcRight, holes);
|
|
|
|
AcGeVector3d vtDir = AcGeVector3d::kZAxis;
|
|
// 两起点侧面
|
|
TGGePoly2D polyTemp;
|
|
polyTemp.AppendNode(*poly[0]);
|
|
polyTemp.AppendNode(*poly[3]);
|
|
polyTemp.AppendNode(*poly[3] + vtDir * dH);
|
|
polyTemp.AppendNode(*poly[0] + vtDir * dH);
|
|
dc.DrawShell(polyTemp);
|
|
|
|
// 两终点侧面
|
|
polyTemp.Reset();
|
|
polyTemp.AppendNode(*poly[1]);
|
|
polyTemp.AppendNode(*poly[2]);
|
|
polyTemp.AppendNode(*poly[2] + vtDir * dH);
|
|
polyTemp.AppendNode(*poly[1] + vtDir * dH);
|
|
dc.DrawShell(polyTemp);
|
|
|
|
// 绘制上下底面
|
|
TGGePoly2D polyNew;
|
|
poly.Disperse1(polyNew, _AS_SYS_UNIT(g_nCirDeviation));
|
|
dc.DrawShell(polyNew); // 下底面
|
|
|
|
for (i = 0; i < polyNew.Length(); i++)
|
|
{
|
|
*polyNew[i] += vtDir * dH;
|
|
}
|
|
dc.DrawShell(polyNew); // 上底面
|
|
|
|
return Acad::eOk;
|
|
}
|
|
|
|
bool TDbWall::IsLinkColumn(bool bStart) const
|
|
{
|
|
// 查看端点是否发生融合
|
|
TBaseWallLine bwLine;
|
|
GetThisBaseWallLine(bwLine);
|
|
TGGeVisibilityPoly2D left = bwLine.GetLeftLine();
|
|
TGGeVisibilityPoly2D right = bwLine.GetRightLine();
|
|
TADSGePoint3d pt1, pt2; // 端点
|
|
if (bStart) // 起点
|
|
{
|
|
pt1 = *left[0];
|
|
pt2 = *right[0];
|
|
}
|
|
else // 终点
|
|
{
|
|
pt1 = *left[left.Length() - 1];
|
|
pt2 = *right[right.Length() - 1];
|
|
}
|
|
|
|
AcDbLine line(pt1, pt2);
|
|
AcGePoint3dArray ptArr;
|
|
TDbStruColumn *pStruColumn = NULL;
|
|
for (int i = 0; i < m_arColumnIds.length(); i++)
|
|
{
|
|
acdbOpenObject(pStruColumn, m_arColumnIds[i], AcDb::kForRead);
|
|
if (pStruColumn != NULL)
|
|
{
|
|
TGGePoly2D poly2d;
|
|
pStruColumn->GetOutline(poly2d);
|
|
pStruColumn->Close();
|
|
if (((pt1 & poly2d) == PR_EDGE || (pt1 & poly2d) == PR_INSIDE)
|
|
||((pt2 & poly2d) == PR_EDGE || (pt2 & poly2d) == PR_INSIDE))
|
|
{
|
|
return true;
|
|
}
|
|
|
|
AcDbCurve *pCurve = poly2d.AsAcDbCurve();
|
|
if (pCurve != NULL && pCurve->intersectWith(&line, AcDb::kOnBothOperands, ptArr) == Acad::eOk
|
|
&& ptArr.length() > 0)
|
|
{
|
|
return true;
|
|
}
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
void TDbWall::GetPoly2D(TGGePoly2D &poly2d) const
|
|
{
|
|
TBaseWallLine wallLine;
|
|
GetThisBaseWallLine(wallLine);
|
|
TGGeVisibilityPoly2D left, right;
|
|
left = wallLine.GetLeftLine();
|
|
right = wallLine.GetRightLine();
|
|
|
|
AcDbPolyline* pLwPoly = new AcDbPolyline();
|
|
double dBuge = 0.0;
|
|
int nIndex = 0;
|
|
for (int i = 0; i < left.Length(); i++)
|
|
{
|
|
dBuge = tan(*(left.m_ardbulges[i]) / 4.0);
|
|
pLwPoly->addVertexAt(nIndex, (*left[i]).AsAcGePoint2d(), dBuge);
|
|
++nIndex;
|
|
}
|
|
|
|
for (i = left.Length() - 1; i >= 0; i--)
|
|
{
|
|
if (i > 0)
|
|
{
|
|
dBuge = tan(*(right.m_ardbulges[i-1]) / 4.0) * (-1);
|
|
}
|
|
else
|
|
{
|
|
dBuge = 0.0;
|
|
}
|
|
pLwPoly->addVertexAt(nIndex, (*right[i]).AsAcGePoint2d(), dBuge);
|
|
++nIndex;
|
|
}
|
|
|
|
pLwPoly->setClosed(Adesk::kTrue);
|
|
poly2d.SetAcDbCurve(pLwPoly);
|
|
delete pLwPoly;
|
|
}
|
|
|
|
void TDbWall::GetBaseLine(TGGeCurveSegment &seg) const
|
|
{
|
|
AcGePoint3d ptS, ptE;
|
|
GetAt(KEY_START, ptS);
|
|
GetAt(KEY_END, ptE);
|
|
double dBulge = 0.0;
|
|
GetAt(KEY_BULGE,dBulge);
|
|
TGGeCurveSegment segTemp(ptS, ptE, dBulge);
|
|
seg = segTemp;
|
|
}
|
|
*/
|
|
void TDbWall::GetTotalWidth(double &dWidth)const
|
|
{
|
|
dWidth = GetWidth(0) + GetWidth(1);
|
|
}
|
|
|
|
// 获得总高度
|
|
void TDbWall::GetTotalHeight(double &dHeight)const
|
|
{
|
|
dHeight = GetHeight();
|
|
}
|
|
|
|
Acad::ErrorStatus TDbWall::SetStruWidth(double dLeftWidth , double dRightWidth)
|
|
{
|
|
assertWriteEnabled();
|
|
|
|
m_lWidth = dLeftWidth;
|
|
m_rWidth = dRightWidth;
|
|
/* double dOldLW = 0.0, dOldLeft = 0.0, dOldRight = 0.0;
|
|
GetAt(KEY_W, dOldLW);
|
|
|
|
dOldLeft = dOldLW*0.5;
|
|
GetAt(KEY_LWIDTH, dOldLeft);
|
|
|
|
dOldRight = dOldLW - dOldLeft;
|
|
if (fabs(dLeftWidth - dOldLeft) < _DIST_SNAP && fabs(dRightWidth - dOldRight) < _DIST_SNAP)
|
|
{
|
|
return Acad::eOk;
|
|
}
|
|
|
|
double dDist = (dLeftWidth - dRightWidth) - (dOldLeft - dOldRight);
|
|
dDist *= 0.5;
|
|
|
|
// 调整型心线位置即起点终点位置
|
|
double dBugle = 0.0;
|
|
GetAt(KEY_BULGE, dBugle);
|
|
AcGePoint3d ptS, ptE;
|
|
GetAt(KEY_START, ptS);
|
|
GetAt(KEY_END, ptE);
|
|
if (fabs(dBugle) < g_angleZero) // 直线
|
|
{
|
|
AcGeVector3d vt = ptS - ptE;
|
|
vt.normalize();
|
|
vt.rotateBy(-PI/2, AcGeVector3d::kZAxis);
|
|
ptS += vt * dDist;
|
|
ptE += vt * dDist;
|
|
}
|
|
else // 弧线
|
|
{
|
|
TGGeArc arc(ptS, ptE, dBugle);
|
|
AcGePoint3d ptCenter;
|
|
ptCenter = arc.GetCenterPt();
|
|
AcGeVector3d vt = ptCenter - ptS;
|
|
vt.normalize();
|
|
ptS += vt * dDist;
|
|
vt = ptCenter - ptE;
|
|
vt.normalize();
|
|
ptE += vt * dDist;
|
|
}
|
|
SetAt(KEY_START, ptS);
|
|
SetAt(KEY_END, ptE);*/
|
|
return Acad::eOk;
|
|
}
|
|
/*
|
|
Acad::ErrorStatus TDbWall::DrawWeightLine2d(TGGiExplodeDrawBase &dc) const
|
|
{
|
|
// 获取融合后的poly2d
|
|
TGGeVisibilityPoly2D poly;
|
|
GetIntegratedPoly2d(poly);
|
|
poly.Compress();
|
|
|
|
DrawWeightLine2d(dc, poly, true);
|
|
|
|
// 额外绘制融合洞增加的墙线
|
|
DrawWeightHoleSideLine2d(dc);
|
|
|
|
return Acad::eOk;
|
|
}
|
|
|
|
Acad::ErrorStatus TDbWall::DrawWeightLine2d(TGGiExplodeDrawBase &dc, TGGeVisibilityPoly2D &poly, bool bVal) const
|
|
{
|
|
int nNum = 1;
|
|
if (!bVal)
|
|
{
|
|
nNum = -1;
|
|
}
|
|
|
|
double dLineWidth = DocGetConWallLWeight()*GetPScale();
|
|
TGGePoly2D polyDest;
|
|
if (poly.PathArea() > 0) // 顺时针
|
|
{
|
|
poly.Offset(dLineWidth * nNum, polyDest);
|
|
}
|
|
else
|
|
{
|
|
poly.Offset(dLineWidth * (-1) * nNum, polyDest);
|
|
}
|
|
|
|
if (poly.Length() != polyDest.Length())
|
|
{
|
|
return Acad::eInvalidInput;
|
|
}
|
|
|
|
TGGePoly2D poly2dNew;
|
|
for (int i = 0; i < poly.Length() - 1; i++)
|
|
{
|
|
if (poly.GetVisibleAt(i) == AcDb::kInvisible)
|
|
{
|
|
continue;
|
|
}
|
|
|
|
poly2dNew.Reset();
|
|
poly2dNew.AppendNode(*poly[i], *(poly.m_ardbulges[i]));
|
|
poly2dNew.AppendNode(*poly[i+1]);
|
|
poly2dNew.AppendNode(*polyDest[i+1], *(polyDest.m_ardbulges[i]) * (-1));
|
|
poly2dNew.AppendNode(*polyDest[i]);
|
|
poly2dNew.SetClosed();
|
|
dc << TGGeSolid(poly2dNew);
|
|
}
|
|
|
|
if (poly.GetVisibleAt(poly.Length() - 1) == AcDb::kVisible)
|
|
{
|
|
poly2dNew.Reset();
|
|
poly2dNew.AppendNode(*poly[poly.Length() - 1], *(poly.m_ardbulges[poly.Length() - 1]));
|
|
poly2dNew.AppendNode(*poly[0]);
|
|
poly2dNew.AppendNode(*polyDest[0], *(polyDest.m_ardbulges[polyDest.Length() - 1]) * (-1));
|
|
poly2dNew.AppendNode(*polyDest[polyDest.Length() - 1]);
|
|
poly2dNew.SetClosed();
|
|
dc << TGGeSolid(poly2dNew);
|
|
}
|
|
|
|
return Acad::eOk;
|
|
}
|
|
|
|
|
|
|
|
void TDbWall::GetIntegratedPoly2d(TGGeVisibilityPoly2D &poly) const
|
|
{
|
|
// 双线绘制样式
|
|
TBaseWallLine bwlThis;
|
|
GetThisBaseWallLine(bwlThis);
|
|
|
|
// 融合剪力墙
|
|
TDPtrList<TBaseWallLine> arBaseWallLinesS, arBaseWallLinesM, arBaseWallLinesE;
|
|
GetAssocBaseWallLine(arBaseWallLinesS, arBaseWallLinesM, arBaseWallLinesE);
|
|
// 起点融合
|
|
TBaseWallIntegrateTool::IntegrateAtTail(true, bwlThis, arBaseWallLinesS);
|
|
// 终点融合
|
|
TBaseWallIntegrateTool::IntegrateAtTail(false, bwlThis, arBaseWallLinesE);
|
|
// 墙内融合
|
|
for (int i = 0; i < arBaseWallLinesM.Length(); i++)
|
|
{
|
|
TBaseWallIntegrateTool::Integrate(bwlThis,*arBaseWallLinesM[i]);
|
|
}
|
|
|
|
// 融合柱子
|
|
TDbStruColumn *pStruColumn = NULL;
|
|
for (i = 0; i < m_arColumnIds.length(); i++)
|
|
{
|
|
acdbOpenObject(pStruColumn, m_arColumnIds[i], AcDb::kForRead);
|
|
if (pStruColumn != NULL)
|
|
{
|
|
TGGePoly2D poly2d;
|
|
pStruColumn->GetOutline(poly2d);
|
|
pStruColumn->Close();
|
|
TBaseWallIntegrateTool::Integrate(bwlThis, poly2d);
|
|
}
|
|
}
|
|
|
|
// 融合洞
|
|
IntegrateWallHole(bwlThis);
|
|
|
|
// 生成poly2d
|
|
// 添加左线
|
|
TGGeVisibilityPoly2D left, right;
|
|
left = bwlThis.GetLeftLine();
|
|
right = bwlThis.GetRightLine();
|
|
for (i = 0; i < left.Length(); i++)
|
|
{
|
|
poly.AppendNode(*left[i], *(left.m_ardbulges[i]), left.GetVisibleAt(i));
|
|
}
|
|
|
|
// 添加终点封口线
|
|
int nLen = arBaseWallLinesE.Length();
|
|
bool bHasColumn = IsLinkColumn(false);
|
|
if (arBaseWallLinesE.Length() == 0 && !bHasColumn) // 终点封口
|
|
{
|
|
if (!(left.GetVisibleAt(left.Length() - 2) == AcDb::kInvisible && right.GetVisibleAt(right.Length() - 2) == AcDb::kInvisible))
|
|
{
|
|
poly.AppendNode(*left[left.Length() - 1]);
|
|
poly.AppendNode(*right[right.Length() - 1]);
|
|
}
|
|
}
|
|
else if (nLen == 1 && !bHasColumn) // 处理终点处有一个融合墙体时,墙体端点两点连线平行的情况
|
|
{
|
|
AcDbObjectId id;
|
|
GetWallId(false, id);
|
|
TGGeVisibilityPoly2D polyNew;
|
|
GetSideLine2d(false, id, bwlThis, polyNew);
|
|
polyNew.Compress();
|
|
for (int i = 0; i < polyNew.Length(); i++)
|
|
{
|
|
poly.AppendNode(*polyNew[i], *(polyNew.m_ardbulges[i]), polyNew.GetVisibleAt(i));
|
|
}
|
|
|
|
if (polyNew.Length() == 0)
|
|
{
|
|
poly.InsertNodeAt(*left[left.Length() - 1], AcDb::kInvisible); // 改变点的可见性
|
|
}
|
|
}
|
|
else if (nLen == 0 && bHasColumn) // 终点关联柱子
|
|
{
|
|
TGGeVisibilityPoly2D polyNew;
|
|
GetIntegratedPoly2dForColumn(false, polyNew);
|
|
polyNew.Compress();
|
|
for (int i = 0; i < polyNew.Length(); i++)
|
|
{
|
|
poly.AppendNode(*polyNew[i], *(polyNew.m_ardbulges[i]), polyNew.GetVisibleAt(i));
|
|
}
|
|
}
|
|
else
|
|
{
|
|
poly.InsertNodeAt(*left[left.Length() - 1], AcDb::kInvisible); // 改变点的可见性
|
|
}
|
|
|
|
// 添加右线
|
|
right.Reverse();
|
|
for (i = 0; i < right.Length(); i++)
|
|
{
|
|
poly.AppendNode(*right[i], *(right.m_ardbulges[i]), right.GetVisibleAt(i));
|
|
}
|
|
|
|
// 添加起点封口线
|
|
nLen = arBaseWallLinesS.Length();
|
|
bHasColumn = IsLinkColumn(true);
|
|
if (nLen == 0 && !bHasColumn) // 起点封口
|
|
{
|
|
if (!(left.GetVisibleAt(0) == AcDb::kInvisible && right.GetVisibleAt(0) == AcDb::kInvisible))
|
|
{
|
|
poly.AppendNode(*right[right.Length() - 1]); // right 已逆转方向
|
|
poly.AppendNode(*left[0]);
|
|
}
|
|
}
|
|
else if (nLen == 1 && !bHasColumn) // 处理起点处有一个融合墙体时,墙体端点两点连线平行的情况
|
|
{
|
|
AcDbObjectId id;
|
|
GetWallId(true, id);
|
|
TGGeVisibilityPoly2D polyNew;
|
|
GetSideLine2d(true, id, bwlThis, polyNew);
|
|
polyNew.Compress();
|
|
polyNew.Reverse();
|
|
for (int i = 0; i < polyNew.Length(); i++)
|
|
{
|
|
poly.AppendNode(*polyNew[i], *(polyNew.m_ardbulges[i]), polyNew.GetVisibleAt(i));
|
|
}
|
|
|
|
if (polyNew.Length() == 0)
|
|
{
|
|
poly.InsertNodeAt(*right[right.Length() - 1], AcDb::kInvisible); // 改变点的可见性
|
|
}
|
|
}
|
|
else if (nLen == 0 && bHasColumn) // 起点关联柱子
|
|
{
|
|
TGGeVisibilityPoly2D polyNew;
|
|
GetIntegratedPoly2dForColumn(true, polyNew);
|
|
polyNew.Compress();
|
|
polyNew.Reverse();
|
|
for (int i = 0; i < polyNew.Length(); i++)
|
|
{
|
|
poly.AppendNode(*polyNew[i], *(polyNew.m_ardbulges[i]), polyNew.GetVisibleAt(i));
|
|
}
|
|
}
|
|
else
|
|
{
|
|
poly.InsertNodeAt(*right[right.Length() - 1], AcDb::kInvisible); // 改变点的可见性
|
|
}
|
|
|
|
poly.SetClosed();
|
|
}
|
|
|
|
void TDbWall::GetIntegratedPoly2dForColumn(bool bStart, TGGeVisibilityPoly2D &poly) const
|
|
{
|
|
poly.Reset();
|
|
// 查看端点与柱子是否发生融合
|
|
TBaseWallLine bwLine;
|
|
GetThisBaseWallLine(bwLine);
|
|
TGGeVisibilityPoly2D left = bwLine.GetLeftLine();
|
|
TGGeVisibilityPoly2D right = bwLine.GetRightLine();
|
|
TADSGePoint3d pt1, pt2; // 端点
|
|
if (bStart) // 起点
|
|
{
|
|
pt1 = *left[0];
|
|
pt2 = *right[0];
|
|
}
|
|
else // 终点
|
|
{
|
|
pt1 = *left[left.Length() - 1];
|
|
pt2 = *right[right.Length() - 1];
|
|
}
|
|
|
|
pt1.z = 0.0;
|
|
pt2.z = 0.0;
|
|
|
|
AcDbLine line(pt1, pt2);
|
|
TDbStruColumn *pStruColumn = NULL;
|
|
for (int i = 0; i < m_arColumnIds.length(); i++)
|
|
{
|
|
acdbOpenObject(pStruColumn, m_arColumnIds[i], AcDb::kForRead);
|
|
if (pStruColumn != NULL)
|
|
{
|
|
TGGePoly2D poly2d;
|
|
pStruColumn->GetOutline(poly2d);
|
|
pStruColumn->Close();
|
|
poly2d.SetElevation(0.0);
|
|
bool bLink1 = (pt1 & poly2d) == PR_EDGE || (pt1 & poly2d) == PR_INSIDE;
|
|
bool bLink2 = (pt2 & poly2d) == PR_EDGE || (pt2 & poly2d) == PR_INSIDE;
|
|
// 端点只要一点与柱子相连时,墙体部分封口
|
|
if ((bLink1 && !bLink2) || (!bLink1 && bLink2))
|
|
{
|
|
TADSGePoint3d pt;
|
|
if (bLink1 && !bLink2)
|
|
{
|
|
pt = pt2;
|
|
}
|
|
else
|
|
{
|
|
pt = pt1;
|
|
}
|
|
|
|
AcDbLine line(pt1,pt2);
|
|
AcDbCurve *pCurve = poly2d.AsAcDbCurve();
|
|
AcGePoint3dArray arrPt;
|
|
line.intersectWith(pCurve, AcDb::kOnBothOperands, arrPt);
|
|
if (arrPt.length() == 1)
|
|
{
|
|
if (bLink1 && !bLink2)
|
|
{
|
|
poly.AppendNode(pt1, 0.0, AcDb::kInvisible);
|
|
poly.AppendNode(arrPt[0]);
|
|
poly.AppendNode(pt2);
|
|
}
|
|
else
|
|
{
|
|
poly.AppendNode(pt1);
|
|
poly.AppendNode(arrPt[0], 0.0, AcDb::kInvisible);
|
|
poly.AppendNode(pt2);
|
|
}
|
|
}
|
|
else if (arrPt.length() > 1)
|
|
{
|
|
std::map<double, TADSGePoint3d> data;
|
|
for (int i = 0; i < arrPt.length(); i++)
|
|
{
|
|
data.insert(std::make_pair(pt.Distance(arrPt[i]), arrPt[i]));
|
|
}
|
|
|
|
if (bLink1 && !bLink2)
|
|
{
|
|
poly.AppendNode(pt1, 0.0, AcDb::kInvisible);
|
|
poly.AppendNode((*data.begin()).second);
|
|
poly.AppendNode(pt2);
|
|
}
|
|
else
|
|
{
|
|
poly.AppendNode(pt1);
|
|
poly.AppendNode((*data.begin()).second, 0.0, AcDb::kInvisible);
|
|
poly.AppendNode(pt2);
|
|
}
|
|
}
|
|
|
|
break;
|
|
}
|
|
else if (!bLink1 && !bLink2) // 两点都与poly2d不相连
|
|
{
|
|
AcGePoint3dArray ptArr;
|
|
AcDbCurve *pCurve = poly2d.AsAcDbCurve();
|
|
if (pCurve != NULL)
|
|
{
|
|
pCurve->intersectWith(&line, AcDb::kOnBothOperands, ptArr);
|
|
if (ptArr.length() == 1)
|
|
{
|
|
poly.AppendNode(pt1);
|
|
poly.AppendNode(pt2);
|
|
break;
|
|
}
|
|
else if (ptArr.length() == 2)
|
|
{
|
|
double dDist1 = 0.0, dDist2 = 0.0;
|
|
dDist1 = pt1.Distance(ptArr[0]);
|
|
dDist2 = pt1.Distance(ptArr[1]);
|
|
if(dDist2 > dDist1)
|
|
{
|
|
poly.AppendNode(pt1);
|
|
poly.AppendNode(asDblArray(ptArr[0]), 0.0, AcDb::kInvisible);
|
|
poly.AppendNode(pt2);
|
|
}
|
|
else
|
|
{
|
|
poly.AppendNode(pt1);
|
|
poly.AppendNode(asDblArray(ptArr[1]), 0.0, AcDb::kInvisible);
|
|
poly.AppendNode(pt2);
|
|
}
|
|
|
|
dDist1 = pt2.Distance(ptArr[0]);
|
|
dDist2 = pt2.Distance(ptArr[1]);
|
|
if(dDist2 > dDist1)
|
|
{
|
|
poly.AppendNode(pt1, 0.0, AcDb::kInvisible);
|
|
poly.AppendNode(asDblArray(ptArr[0]));
|
|
poly.AppendNode(pt2);
|
|
}
|
|
else
|
|
{
|
|
poly.AppendNode(pt1, 0.0, AcDb::kInvisible);
|
|
poly.AppendNode(asDblArray(ptArr[1]));
|
|
poly.AppendNode(pt2);
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
if (poly.Length() == 0)
|
|
{
|
|
poly.AppendNode(pt1, 0.0, AcDb::kInvisible);
|
|
poly.AppendNode(pt2);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
void TDbWall::GetSideLine2d(bool bStart, const AcDbObjectId &idWall, const TBaseWallLine &wallLine, TGGeVisibilityPoly2D &poly) const
|
|
{
|
|
poly.Reset();
|
|
TDbWall *pWall = NULL;
|
|
acdbOpenObject(pWall, idWall, AcDb::kForRead);
|
|
if (pWall != NULL)
|
|
{
|
|
TBaseWallLine bwlThat;
|
|
pWall->GetThisBaseWallLine(bwlThat);
|
|
int nThatWeight = 0;
|
|
pWall->GetAt(KEY_WEIGHT, nThatWeight);
|
|
pWall->close();
|
|
|
|
// 判断墙线融合方式
|
|
TADSGePoint3d ptThat1,ptThat2;
|
|
TBaseWallLine bwlThis;
|
|
GetThisBaseWallLine(bwlThis);
|
|
int nType = TBaseWallIntegrateTool::IsIntegrateAtTail(bwlThat, bwlThis);
|
|
if (nType == 1) // 起始端相交
|
|
{
|
|
TGGeVisibilityPoly2D leftThat = bwlThat.GetLeftLine();
|
|
TGGeVisibilityPoly2D rightThat = bwlThat.GetRightLine();
|
|
ptThat1 = *leftThat[0];
|
|
ptThat2 = *rightThat[0];
|
|
}
|
|
else if (nType == 2) // 终止端相交
|
|
{
|
|
TGGeVisibilityPoly2D leftThat = bwlThat.GetLeftLine();
|
|
TGGeVisibilityPoly2D rightThat = bwlThat.GetRightLine();
|
|
ptThat1 = *leftThat[leftThat.Length() - 1];
|
|
ptThat2 = *rightThat[leftThat.Length() - 1];
|
|
}
|
|
else
|
|
{
|
|
return;
|
|
}
|
|
|
|
if (!!ptThat1 && !!ptThat2)
|
|
{
|
|
TADSGePoint3d ptThis1,ptThis2;
|
|
TGGeVisibilityPoly2D leftThis = bwlThis.GetLeftLine();
|
|
TGGeVisibilityPoly2D rightThis = bwlThis.GetRightLine();
|
|
if (bStart)
|
|
{
|
|
ptThis1 = *leftThis[0];
|
|
ptThis2 = *rightThis[0];
|
|
}
|
|
else
|
|
{
|
|
ptThis1 = *leftThis[leftThis.Length() - 1];
|
|
ptThis2 = *rightThis[rightThis.Length() - 1];
|
|
}
|
|
|
|
AcGeVector3d vtThat = ptThat1 - ptThat2;
|
|
AcGeVector3d vtThis = ptThis1 - ptThis2;
|
|
int nThisWeight = 0;
|
|
GetAt(KEY_WEIGHT, nThisWeight);
|
|
if (vtThis.isParallelTo(vtThat)) // 端点连线平行
|
|
{
|
|
if (nThisWeight < nThatWeight) // 比较优先级
|
|
{
|
|
poly.AppendNode(ptThis1);
|
|
poly.AppendNode(ptThis2);
|
|
}
|
|
else
|
|
{
|
|
bool bSuperposition = (ptThat1.Distance(ptThis1) < _DIST_SNAP && ptThat2.Distance(ptThis2) < _DIST_SNAP)
|
|
|| (ptThat1.Distance(ptThis2) < _DIST_SNAP && ptThat2.Distance(ptThis1) < _DIST_SNAP); // 融合端点两两重合
|
|
if (!bSuperposition)
|
|
{
|
|
// 将that的融合端点投影到this融合端点连线的直线上
|
|
std::vector<TADSGePoint3d> vecPt;
|
|
vecPt.push_back(ptThis1);
|
|
vecPt.push_back(ptThis2);
|
|
TADSGePoint3d pt;
|
|
TGGeLine line(ptThis1, ptThis2);
|
|
ptThat1.Project(&line, pt);
|
|
vecPt.push_back(pt);
|
|
ptThat2.Project(&line, pt);
|
|
vecPt.push_back(pt);
|
|
|
|
// 求两点间的距离
|
|
std::map<double, std::vector<TADSGePoint3d> > mapData;
|
|
std::vector<TADSGePoint3d> vecTemp;
|
|
std::vector<TADSGePoint3d>::iterator it1, it2;
|
|
for (it1 = vecPt.begin(); it1 != vecPt.end(); it1++)
|
|
{
|
|
it2 = it1;
|
|
++it2;
|
|
for (; it2 != vecPt.end(); it2++)
|
|
{
|
|
vecTemp.clear();
|
|
vecTemp.push_back(*it1);
|
|
vecTemp.push_back(*it2);
|
|
mapData.insert(std::make_pair((*it1).Distance(*it2), vecTemp));
|
|
}
|
|
}
|
|
|
|
// 获取距离最远的点
|
|
std::map<double, std::vector<TADSGePoint3d> >::iterator it;
|
|
it = mapData.end();
|
|
--it;
|
|
vecTemp.clear();
|
|
vecTemp.push_back((*it).second[0]);
|
|
vecTemp.push_back((*it).second[1]);
|
|
|
|
// 从vecPt中删除最远的两点
|
|
for (it1 = vecTemp.begin(); it1 != vecTemp.end(); it1++)
|
|
{
|
|
for (it2 = vecPt.begin(); it2 != vecPt.end(); it2++)
|
|
{
|
|
if ((*it1).Distance(*it2) < _DIST_SNAP)
|
|
{
|
|
vecPt.erase(it2);
|
|
break;;
|
|
}
|
|
}
|
|
}
|
|
|
|
// this的融合端点是否与最远点重合
|
|
if (ptThis1.Distance(vecTemp[0]) < _DIST_SNAP || ptThis1.Distance(vecTemp[1]) < _DIST_SNAP)
|
|
{
|
|
double dDist1 = ptThis1.Distance(vecPt[0]);
|
|
double dDist2 = ptThis1.Distance(vecPt[1]);
|
|
if (dDist1 < dDist2)
|
|
{
|
|
poly.AppendNode(ptThis1);
|
|
poly.AppendNode(vecPt[0], 0.0, AcDb::kInvisible);
|
|
}
|
|
else
|
|
{
|
|
poly.AppendNode(ptThis1);
|
|
poly.AppendNode(vecPt[1], 0.0, AcDb::kInvisible);
|
|
}
|
|
}
|
|
|
|
if (ptThis2.Distance(vecTemp[0]) < _DIST_SNAP || ptThis2.Distance(vecTemp[1]) < _DIST_SNAP)
|
|
{
|
|
double dDist1 = ptThis2.Distance(vecPt[0]);
|
|
double dDist2 = ptThis2.Distance(vecPt[1]);
|
|
if (dDist1 < dDist2)
|
|
{
|
|
poly.AppendNode(vecPt[0]);
|
|
poly.AppendNode(ptThis2);
|
|
}
|
|
else
|
|
{
|
|
poly.AppendNode(vecPt[1]);
|
|
poly.AppendNode(ptThis2);
|
|
}
|
|
}
|
|
|
|
if (poly.Length() == 0)
|
|
{
|
|
poly.AppendNode(ptThis1, 0.0, AcDb::kInvisible);
|
|
poly.AppendNode(ptThis2, 0.0, AcDb::kInvisible);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
else if (nThatWeight != nThisWeight) // 优先级不同
|
|
{
|
|
TGGeVisibilityPoly2D left = wallLine.GetLeftLine();
|
|
TGGeVisibilityPoly2D right = wallLine.GetRightLine();
|
|
if (bStart)
|
|
{
|
|
poly.AppendNode(*left[0]);
|
|
poly.AppendNode(*right[0]);
|
|
}
|
|
else
|
|
{
|
|
poly.AppendNode(*left[left.Length() - 1]);
|
|
poly.AppendNode(*right[right.Length() - 1]);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
Acad::ErrorStatus TDbWall::DrawWeightHoleSideLine2d( TGGiExplodeDrawBase &dc ) const
|
|
{
|
|
TBaseWallLine wallLine;
|
|
GetThisBaseWallLine(wallLine);
|
|
|
|
TGGeVisibilityPoly2D &left = wallLine.GetLeftLine();
|
|
TGGeVisibilityPoly2D &right = wallLine.GetRightLine();
|
|
|
|
double dWallWidth = 0.0;
|
|
GetAt(KEY_W, dWallWidth);
|
|
|
|
TDbWallHole holeNew;
|
|
TGGePoly2D polyNewHole;
|
|
|
|
double dLineWidth = DocGetConWallLWeight()*GetPScale();
|
|
for(int i = 0; i < m_arHoleIds.length(); i++)
|
|
{
|
|
TDbWallHole *pHole = NULL;
|
|
acdbOpenObject(pHole, m_arHoleIds[i], AcDb::kForRead);
|
|
if (pHole == NULL)
|
|
{
|
|
continue;
|
|
}
|
|
TGGePoly2D poly;
|
|
TGGeCurveSegment seg;
|
|
pHole->GetOutlinePoly2D(0.0, poly, seg);
|
|
int nHoleStyle = 0;
|
|
pHole->GetAt(KEY_BORE, nHoleStyle);
|
|
double dHoleWidth = 0.0;
|
|
pHole->GetAt(KEY_W, dHoleWidth);
|
|
holeNew.copyFrom(pHole);
|
|
pHole->close();
|
|
|
|
if (poly.Length() != 4)
|
|
{
|
|
continue;
|
|
}
|
|
|
|
// 修改新洞洞宽,洞厚
|
|
double dWidth = 0.0;
|
|
holeNew.GetAt(KEY_SUMB, dWidth);
|
|
dWidth += 2 * dLineWidth;
|
|
holeNew.SetAt(KEY_SUMB, dWidth);
|
|
double dThick = 0.0;
|
|
holeNew.GetAt(KEY_THICK, dThick);
|
|
dThick += dLineWidth;
|
|
holeNew.SetAt(KEY_THICK, dThick);
|
|
holeNew.GetOutlinePoly2D(0.0, polyNewHole, seg);
|
|
if (polyNewHole.Length() != 4)
|
|
{
|
|
continue;
|
|
}
|
|
|
|
bool bBore = true;
|
|
if (nHoleStyle == 0) // 不贯穿洞
|
|
{
|
|
bBore = false;
|
|
}
|
|
|
|
TGGeCurveSegment seg1, seg2;
|
|
poly.Nth(1, seg1);
|
|
poly.Nth(3, seg2);
|
|
TADSGePoint3d pt1, pt2, pt3, pt4;
|
|
seg1.GetStartPoint(pt1);
|
|
seg1.GetEndPoint(pt2);
|
|
seg2.GetStartPoint(pt3);
|
|
seg2.GetEndPoint(pt4);
|
|
|
|
if (!(PtIsOnPoly2d(pt1, left) && PtIsOnPoly2d(pt2, left) || PtIsOnPoly2d(pt3, right) && PtIsOnPoly2d(pt4, right)
|
|
|| PtIsOnPoly2d(pt3, left) && PtIsOnPoly2d(pt4, left) || PtIsOnPoly2d(pt1, right) && PtIsOnPoly2d(pt2, right)))
|
|
{
|
|
continue;
|
|
}
|
|
|
|
TGGeVisibilityPoly2D polyNew;
|
|
AcDbCurve *pCurve = poly.AsAcDbCurve();
|
|
polyNew.SetAcDbCurve(pCurve);
|
|
delete pCurve;
|
|
if (bBore)//贯穿洞
|
|
{
|
|
polyNew.SetVisibleAt(1, AcDb::kInvisible);
|
|
polyNew.SetVisibleAt(3, AcDb::kInvisible);
|
|
}
|
|
else //不贯穿洞
|
|
{
|
|
polyNew.SetVisibleAt(1, AcDb::kInvisible);
|
|
}
|
|
|
|
// 加粗处理
|
|
TGGePoly2D poly2dNew;
|
|
for (int i = 0; i < polyNew.Length() - 1; i++)
|
|
{
|
|
if (polyNew.GetVisibleAt(i) == AcDb::kInvisible)
|
|
{
|
|
continue;
|
|
}
|
|
|
|
poly2dNew.Reset();
|
|
poly2dNew.AppendNode(*polyNew[i], *(polyNew.m_ardbulges[i]));
|
|
poly2dNew.AppendNode(*polyNew[i+1]);
|
|
|
|
poly2dNew.AppendNode(*polyNewHole[i+1], *(polyNewHole.m_ardbulges[i]) * (-1));
|
|
poly2dNew.AppendNode(*polyNewHole[i]);
|
|
poly2dNew.SetClosed();
|
|
dc << TGGeSolid(poly2dNew);
|
|
}
|
|
|
|
if (polyNew.GetVisibleAt(polyNew.Length() - 1) == AcDb::kVisible)
|
|
{
|
|
poly2dNew.Reset();
|
|
poly2dNew.AppendNode(*polyNew[polyNew.Length() - 1], *(polyNew.m_ardbulges[polyNew.Length() - 1]));
|
|
poly2dNew.AppendNode(*polyNew[0]);
|
|
|
|
poly2dNew.AppendNode(*polyNewHole[0], *(polyNewHole.m_ardbulges[polyNewHole.Length() - 1]) * (-1));
|
|
poly2dNew.AppendNode(*polyNewHole[polyNewHole.Length() - 1]);
|
|
poly2dNew.SetClosed();
|
|
dc << TGGeSolid(poly2dNew);
|
|
}
|
|
|
|
}
|
|
return Acad::eOk;
|
|
}
|
|
|
|
void TDbWall::IntegrateWallHole(TBaseWallLine &wallLine) const
|
|
{
|
|
double dWallWidth = 0.0;
|
|
TGGeVisibilityPoly2D &left = wallLine.GetLeftLine();
|
|
TGGeVisibilityPoly2D &right = wallLine.GetRightLine();
|
|
|
|
GetAt(KEY_W, dWallWidth);
|
|
for(int i = 0; i < m_arHoleIds.length(); i++)
|
|
{
|
|
TDbWallHole *pHole = NULL;
|
|
acdbOpenObject(pHole, m_arHoleIds[i], AcDb::kForRead);
|
|
if (pHole == NULL)
|
|
{
|
|
continue;
|
|
}
|
|
|
|
int nShapeType = -1;
|
|
pHole->GetAt(KEY_SECTYP, nShapeType);
|
|
double dHoleR = 0.0;
|
|
pHole->GetAt(KEY_R, dHoleR);
|
|
if (fabs(dHoleR) > _DIST_SNAP && nShapeType != ST_RECT) // 弧墙只处理矩形洞
|
|
{
|
|
pHole->close();
|
|
continue;
|
|
}
|
|
|
|
TGGePoly2D poly;
|
|
TGGeCurveSegment seg;
|
|
pHole->GetOutlinePoly2D(0.0, poly, seg);
|
|
int nHoleStyle = 0;
|
|
pHole->GetAt(KEY_BORE, nHoleStyle);
|
|
int nSide = -1;
|
|
pHole->GetAt(KEY_HSIDE, nSide); // 不贯通时,位置标记
|
|
pHole->close();
|
|
|
|
if (poly.Length() != 4)
|
|
{
|
|
continue;
|
|
}
|
|
|
|
bool bBore = true;
|
|
if (nHoleStyle == 0) // 不贯穿洞
|
|
{
|
|
bBore = false;
|
|
}
|
|
|
|
if (bBore)//贯穿洞
|
|
{
|
|
TGGeCurveSegment seg1, seg2;
|
|
poly.Nth(1, seg1);
|
|
poly.Nth(3, seg2);
|
|
|
|
// 判断两条线哪条在左线, 哪条在右线 pt1, pt2 保存左线上的点
|
|
TADSGePoint3d pt1, pt2, pt3, pt4;
|
|
seg1.GetStartPoint(pt1);
|
|
seg1.GetEndPoint(pt2);
|
|
seg2.GetStartPoint(pt3);
|
|
seg2.GetEndPoint(pt4);
|
|
|
|
if (PtIsOnPoly2d(pt1, left) && PtIsOnPoly2d(pt2, left) && PtIsOnPoly2d(pt3, right) && PtIsOnPoly2d(pt4, right))
|
|
{
|
|
}
|
|
else if (PtIsOnPoly2d(pt3, left) && PtIsOnPoly2d(pt4, left) && PtIsOnPoly2d(pt1, right) && PtIsOnPoly2d(pt2, right))
|
|
{
|
|
TADSGePoint3d ptTemp;
|
|
ptTemp = pt1;
|
|
pt1 = pt3;
|
|
pt3 = ptTemp;
|
|
ptTemp = pt2;
|
|
pt2 = pt4;
|
|
pt4 = ptTemp;
|
|
}
|
|
else
|
|
{
|
|
continue;
|
|
}
|
|
|
|
// 判断两点中哪点离线的起点近
|
|
double dDist1 = 0.0, dDist2 = 0.0;
|
|
pt1.z = pt2.z = left[0]->z;
|
|
dDist1 = left.PathDistance2d(pt1);
|
|
dDist2 = left.PathDistance2d(pt2);
|
|
if (dDist1 < dDist2)
|
|
{
|
|
left.InsertNodeAt(pt1, AcDb::kInvisible);
|
|
left.InsertNodeAt(pt2);
|
|
}
|
|
else
|
|
{
|
|
left.InsertNodeAt(pt2, AcDb::kInvisible);
|
|
left.InsertNodeAt(pt1);
|
|
}
|
|
|
|
pt3.z = pt4.z = right[0]->z;
|
|
dDist1 = right.PathDistance2d(pt3);
|
|
dDist2 = right.PathDistance2d(pt4);
|
|
if (dDist1 < dDist2)
|
|
{
|
|
right.InsertNodeAt(pt3, AcDb::kInvisible);
|
|
right.InsertNodeAt(pt4);
|
|
}
|
|
else
|
|
{
|
|
right.InsertNodeAt(pt4, AcDb::kInvisible);
|
|
right.InsertNodeAt(pt3);
|
|
}
|
|
|
|
}
|
|
else//不贯穿洞
|
|
{
|
|
TGGeCurveSegment seg;
|
|
poly.Nth(1, seg);
|
|
TADSGePoint3d pt1, pt2;
|
|
seg.GetStartPoint(pt1);
|
|
seg.GetEndPoint(pt2);
|
|
|
|
if (nSide == 1 && PtIsOnPoly2d(pt1, left) && PtIsOnPoly2d(pt2, left)
|
|
|| nSide == 0 && PtIsOnPoly2d(pt1, right) && PtIsOnPoly2d(pt2, right))
|
|
{
|
|
double dDist1 = 0.0, dDist2 = 0.0;
|
|
pt1.z = pt2.z = left[0]->z;
|
|
if (nSide == 1)
|
|
{
|
|
dDist1 = left.PathDistance2d(pt1);
|
|
dDist2 = left.PathDistance2d(pt2);
|
|
}
|
|
else if (nSide == 0)
|
|
{
|
|
dDist1 = right.PathDistance2d(pt1);
|
|
dDist2 = right.PathDistance2d(pt2);
|
|
}
|
|
|
|
if (dDist1 < dDist2)
|
|
{
|
|
if (nSide == 1)
|
|
{
|
|
left.InsertNodeAt(pt1, AcDb::kInvisible);
|
|
left.InsertNodeAt(pt2);
|
|
}
|
|
else if (nSide == 0)
|
|
{
|
|
right.InsertNodeAt(pt1, AcDb::kInvisible);
|
|
right.InsertNodeAt(pt2);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (nSide == 1)
|
|
{
|
|
left.InsertNodeAt(pt2, AcDb::kInvisible);
|
|
left.InsertNodeAt(pt1);
|
|
}
|
|
else if (nSide == 0)
|
|
{
|
|
right.InsertNodeAt(pt2, AcDb::kInvisible);
|
|
right.InsertNodeAt(pt1);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
bool TDbWall::PtIsOnPoly2d(const TADSGePoint3d &pt, const TGGePoly2D &poly) const
|
|
{
|
|
AcDbPolyline *pCurve = static_cast<AcDbPolyline *>(poly.AsAcDbCurve());
|
|
if (pCurve == NULL)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
TADSGePoint3d ptTemp;
|
|
pCurve->getClosestPointTo(pt, ptTemp);
|
|
delete pCurve;
|
|
if (pt.Distance2d(ptTemp) < _DIST_SNAP)
|
|
{
|
|
return true;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
bool TDbWall::IsHoleInWall(const AcDbObjectId &idWall) const
|
|
{
|
|
bool bRet = false;
|
|
TDbWallHole *pHole = NULL;
|
|
Acad::ErrorStatus st =acdbOpenObject(pHole, idWall, AcDb::kForRead);
|
|
if (pHole != NULL)
|
|
{
|
|
AcGePoint3d ptIns;
|
|
pHole->GetAt(KEY_POS, ptIns);
|
|
double dHoleHeight = 0.0, dHoleWidth = 0.0;
|
|
pHole->GetAt(KEY_SUMH, dHoleHeight);
|
|
pHole->GetAt(KEY_SUMB, dHoleWidth);
|
|
pHole->close();
|
|
|
|
TGGeCurveSegment seg;
|
|
GetBaseLine(seg);
|
|
TADSGePoint3d ptTemp;
|
|
seg.ProjectToMe(ptIns, ptTemp);
|
|
if (ptTemp.Distance2d(ptIns) < _DIST_SNAP) // 插入点在型心线上
|
|
{
|
|
double dDist = ptTemp.Distance(ptIns);
|
|
bool bVal = ptIns.z < ptTemp.z; // 墙洞插入点在型心线下
|
|
ptIns.z = 0.0;
|
|
seg.StartPoint().z = 0.0;
|
|
seg.EndPoint().z = 0.0;
|
|
double dDist1 = seg.PathDistance(ptIns);
|
|
double dDist2 = seg.PathDistance(ptIns, 0);
|
|
double dWallHeight = 0.0;
|
|
GetAt(KEY_H, dWallHeight);
|
|
if (fabs(dDist1) >= dHoleWidth * 0.5 && fabs(dDist2) > dHoleWidth * 0.5
|
|
&& bVal && dDist >= dHoleHeight && dDist <= dWallHeight)
|
|
{
|
|
bRet = true;
|
|
}
|
|
}
|
|
}
|
|
return bRet;
|
|
}
|
|
|
|
void TDbWall::GetCoverSlab(AcDbObjectIdArray& idArr) const
|
|
{
|
|
//modify by cet 111206 多边形时部分遮挡有问题
|
|
//TBaseWallLine baseWallLine;
|
|
//GetThisBaseWallLine(baseWallLine);
|
|
//TGGeVisibilityPoly2D left = baseWallLine.GetLeftLine();
|
|
//TGGeVisibilityPoly2D right = baseWallLine.GetRightLine();
|
|
//left.SetElevation(0.0);
|
|
//right.SetElevation(0.0);
|
|
//AcDbPolyline *pLeft = static_cast<AcDbPolyline*>(left.AsAcDbCurve());
|
|
//if (pLeft == NULL)
|
|
//{
|
|
// return;
|
|
//}
|
|
|
|
//AcDbPolyline *pRight = static_cast<AcDbPolyline*>(right.AsAcDbCurve());
|
|
//if (pRight == NULL)
|
|
//{
|
|
// delete pLeft;
|
|
// return;
|
|
//}
|
|
|
|
//AcGePoint3dArray ptArrLeft, ptArrRight;
|
|
//AcGePoint3d pt;
|
|
//GetAt(KEY_START, pt);
|
|
//double dWallEle = pt.z;
|
|
//for (int i = 0; i < m_arSlabIds.length(); i++)
|
|
//{
|
|
// TDbStruFloorSlab *pSlab = NULL;
|
|
// acdbOpenObject(pSlab, m_arSlabIds[i], AcDb::kForRead);
|
|
// if (pSlab != NULL)
|
|
// {
|
|
// if (pSlab->GetTopElev() > dWallEle - _DIST_SNAP)
|
|
// {
|
|
// TGGePoly2D poly;
|
|
// pSlab->GetOutline(poly);
|
|
// poly.SetElevation(0.0);
|
|
// AcDbPolyline *pLine = static_cast<AcDbPolyline*>(poly.AsAcDbCurve());
|
|
// if (pLine != NULL)
|
|
// {
|
|
// ptArrLeft.setLogicalLength(0);
|
|
// ptArrRight.setLogicalLength(0);
|
|
// pLine->intersectWith(pLeft, AcDb::kOnBothOperands, ptArrLeft);
|
|
// pLine->intersectWith(pRight,AcDb::kOnBothOperands, ptArrRight);
|
|
|
|
// if (ptArrLeft.length() > 0 || ptArrRight.length() > 0)
|
|
// {
|
|
// idArr.append(m_arSlabIds[i]);
|
|
// }
|
|
// delete pLine;
|
|
// }
|
|
// }
|
|
// pSlab->close();
|
|
// }
|
|
//}
|
|
|
|
//delete pLeft;
|
|
//delete pRight;
|
|
TGGePoly2D poly;
|
|
GetPoly2D(poly);
|
|
poly.SetElevation(0.0);
|
|
AcDbPolyline *pWallLine = static_cast<AcDbPolyline*>(poly.AsAcDbCurve());
|
|
if (pWallLine == NULL)
|
|
{
|
|
return;
|
|
}
|
|
|
|
AcGePoint3dArray ptArr;
|
|
AcGePoint3d pt;
|
|
GetAt(KEY_START, pt);
|
|
double dWallEle = pt.z;
|
|
for (int i = 0; i < m_arSlabIds.length(); i++)
|
|
{
|
|
TDbStruFloorSlab *pSlab = NULL;
|
|
acdbOpenObject(pSlab, m_arSlabIds[i], AcDb::kForRead);
|
|
if (pSlab != NULL)
|
|
{
|
|
if (pSlab->GetTopElev() > dWallEle - _DIST_SNAP)
|
|
{
|
|
TGGePoly2D poly;
|
|
pSlab->GetOutline(poly);
|
|
poly.SetElevation(0.0);
|
|
AcDbPolyline *pLine = static_cast<AcDbPolyline*>(poly.AsAcDbCurve());
|
|
if (pLine != NULL)
|
|
{
|
|
ptArr.setLogicalLength(0);
|
|
pLine->intersectWith(pWallLine, AcDb::kOnBothOperands, ptArr);
|
|
|
|
if (ptArr.length() > 0)
|
|
{
|
|
idArr.append(m_arSlabIds[i]);
|
|
}
|
|
delete pLine;
|
|
}
|
|
}
|
|
pSlab->close();
|
|
}
|
|
}
|
|
delete pWallLine;
|
|
}
|
|
|
|
Acad::ErrorStatus TDbWall::DrawWallLine2dForCoverSlab(TGGiExplodeDrawBase &dc, const TGGeVisibilityPoly2D &poly) const
|
|
{
|
|
AcDbObjectIdArray idArr;
|
|
GetCoverSlab(idArr);
|
|
TGGeCurveSegment seg;
|
|
AcDb::Visibility eVal;
|
|
TDbStruFloorSlab *pSlab = NULL;
|
|
TGGePoly2D polySlab;
|
|
std::vector<TGGeCurveSegment> vecSeg1, vecSeg2; // 保存生成的实线虚线
|
|
for (int i = 0; i < poly.TotalSegments(); i++)
|
|
{
|
|
poly.Nth(i, seg, &eVal);
|
|
if (eVal == AcDb::kVisible)
|
|
{
|
|
for (int j = 0; j < idArr.length(); j++)
|
|
{
|
|
acdbOpenObject(pSlab, idArr[j], AcDb::kForRead);
|
|
if (pSlab != NULL)
|
|
{
|
|
polySlab.Reset();
|
|
pSlab->GetOutline(polySlab);
|
|
pSlab->close();
|
|
polySlab.SetElevation(0.0);
|
|
GetSegmentForSlab2d(polySlab, seg, vecSeg1, vecSeg2);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// 过滤,剪切实线虚线
|
|
FiltrateSegment(vecSeg1, vecSeg2);
|
|
|
|
std::vector<TGGeCurveSegment>::iterator it;
|
|
for (it = vecSeg1.begin(); it < vecSeg1.end(); it++)
|
|
{
|
|
dc << *it;
|
|
}
|
|
|
|
//Adesk::UInt16 nColor = dc.GetColor();
|
|
//dc.SetColor(1);
|
|
|
|
AcDbObjectId idOldLine = dc.GetLineTypeId();
|
|
dc.SetLineType(InitLineType(_T("DASHED"),database()));
|
|
|
|
for (it = vecSeg2.begin(); it < vecSeg2.end(); it++)
|
|
{
|
|
dc << *it;
|
|
}
|
|
dc.SetLineType(idOldLine);
|
|
//dc.SetColor(nColor);
|
|
|
|
return Acad::eOk;
|
|
}
|
|
|
|
void TDbWall::GetClipedPoly2d(std::vector<TGGePoly2D> &vecPoly) const
|
|
{
|
|
TGGePoly2D poly2d;
|
|
TDbStruColumn *pStruColumn = NULL;
|
|
for (int i = 0; i < m_arColumnIds.length(); i++)
|
|
{
|
|
acdbOpenObject(pStruColumn, m_arColumnIds[i], AcDb::kForRead);
|
|
if (pStruColumn != NULL)
|
|
{
|
|
poly2d.Reset();
|
|
pStruColumn->GetOutline(poly2d);
|
|
vecPoly.push_back(poly2d);
|
|
pStruColumn->Close();
|
|
}
|
|
}
|
|
|
|
TDbWallHole *pHole = NULL;
|
|
for (i = 0; i < m_arHoleIds.length(); i++)
|
|
{
|
|
acdbOpenObject(pHole, m_arHoleIds[i], AcDb::kForRead);
|
|
if (pHole != NULL)
|
|
{
|
|
poly2d.Reset();
|
|
pHole->GetOutlinePoly2D(pHole->GetBottomElev(), poly2d, TGGeCurveSegment());
|
|
vecPoly.push_back(poly2d);
|
|
pHole->close();
|
|
}
|
|
}
|
|
}
|
|
|
|
//将剪力墙的变换传递给墙洞
|
|
void TDbWall::ApplyTransformToHoles(const AcGeMatrix3d &xform)
|
|
{
|
|
AcDbObjectIdArray idArray;
|
|
if (acdbGetCurrentSelectionSet(idArray) != Acad::eOk)
|
|
{
|
|
return;
|
|
}
|
|
|
|
//整体移动,不作出额外判断
|
|
if (idArray.length() > 1000)
|
|
{
|
|
return;
|
|
}
|
|
|
|
for (int i = 0; i < m_arHoleIds.length(); i++)
|
|
{
|
|
AcDbObjectId id = m_arHoleIds[i];
|
|
if (idArray.contains(id))
|
|
{
|
|
continue;
|
|
}
|
|
|
|
TAcDbObjectPtr obj(id, AcDb::kForWrite);
|
|
if (!obj)
|
|
{
|
|
;
|
|
}
|
|
else
|
|
{
|
|
TDbWallHole *pWallHole = TDbWallHole::cast(obj.m_pObject);
|
|
if (pWallHole)
|
|
{
|
|
pWallHole->transformBy(xform);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
*/
|
|
|
|
// 墙宽标注
|
|
void TDbWall::DrawBH(TGGiExplodeDrawBase &dc) const
|
|
{
|
|
TDbText text;
|
|
|
|
// 设置文字样式
|
|
AcDbObjectId idWallBHStyl = DocGetWallBHStyle();
|
|
if(idWallBHStyl.isNull())
|
|
{
|
|
idWallBHStyl = InitTextStyle(TS_STANDARD);
|
|
}
|
|
text.SetStyleId(idWallBHStyl);
|
|
|
|
text.SetHeight(DocGetWallBHHigh()); // 设置文字高度
|
|
|
|
text.setColorIndex(DocGetWallBHColor()); // 设置文字颜色
|
|
|
|
text.SetAlignment(XExplodeDraw::kCenter); // 设置文字对齐方式
|
|
|
|
double dWallWidth = GetWidth(0) + GetWidth(1);// 得到墙宽
|
|
|
|
CString strText;
|
|
strText = Dist2Str(dWallWidth);
|
|
text.SetText(strText); // 设置文字内容
|
|
|
|
// 得到墙的起始点和结束点
|
|
TADSGePoint3d ptStart = m_startPoint, ptEnd = m_endPoint;
|
|
|
|
double dBulge = GetBulge(); // 得到墙的凸度, 根据凸度判断该墙是否是弧墙
|
|
|
|
double dDis = (DocGetWallBHDist() * GetPScale());// 得到文字到墙的距离(考虑图层比例)
|
|
double dTextDis = dWallWidth/2+dDis;
|
|
|
|
// 计算文字旋转角度
|
|
ads_real angle = ads_angle(ptStart, ptEnd);// 与x轴的夹角
|
|
if (angle - PI < g_angleZero)
|
|
{
|
|
if(angle - PI/2 > g_angleZero) // 90-180度文字的旋转角度
|
|
{
|
|
angle = ads_angle(ptEnd, ptStart);
|
|
|
|
if(fabs(dBulge) > g_angleZero) // 弧墙
|
|
{
|
|
dTextDis = -dTextDis;
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if(angle - 3*PI/2 < g_angleZero) // 180-270度时文字的旋转角度
|
|
{
|
|
angle = ads_angle(ptEnd, ptStart);
|
|
|
|
if(fabs(dBulge) > g_angleZero) // 弧墙
|
|
{
|
|
dTextDis = -dTextDis;
|
|
}
|
|
}
|
|
}
|
|
text.SetRotation(angle); // 设置文字的旋转角度
|
|
|
|
TADSGePoint3d ptTextAlign;
|
|
if(fabs(dBulge) > g_angleZero) // 弧墙
|
|
{
|
|
TGGeCurveSegment cvCenter = GetCenterLine(); // 得到墙的中心线
|
|
TADSGePoint3d ptCenter = cvCenter.GetArc().GetCenterPt();// 得到弧墙的圆心
|
|
TADSGePoint3d ptMid = cvCenter.MidPoint(); // 得到中心线的中心点
|
|
double dWallAngle = ads_angle(ptMid, ptCenter); // 得到中心墙线的中点与弧墙圆心的连线角度
|
|
ptTextAlign = TADSGePoint3d(ptMid, dWallAngle, dTextDis); // 得到文字的位置点
|
|
}
|
|
else
|
|
{
|
|
Midpoint(ptStart, ptEnd, ptTextAlign); // 得到墙的中点
|
|
ptTextAlign = TADSGePoint3d(ptTextAlign, angle+PI/2, dTextDis);// 与墙垂直方向
|
|
}
|
|
|
|
text.SetLocation(ptTextAlign); // 设置文字显示位置
|
|
text.ExplodeOrDraw2d(dc);
|
|
}
|
|
|
|
// 墙体构件编号标注
|
|
void TDbWall::DrawCLab(TGGiExplodeDrawBase &dc) const
|
|
{
|
|
CString strCLab = _T("Q1");
|
|
if(!GetSpecialtyDataReadOnly()->GetAt(KEY_CLAB, strCLab))
|
|
{
|
|
return;
|
|
}
|
|
|
|
TDbText text;
|
|
|
|
// 设置文字样式
|
|
AcDbObjectId idWallCLStyl = DocGetWallCLStyle();
|
|
if(idWallCLStyl.isNull())
|
|
{
|
|
idWallCLStyl = InitTextStyle(TS_STANDARD);
|
|
}
|
|
text.SetStyleId(idWallCLStyl);
|
|
|
|
text.SetHeight(DocGetWallBHHigh()); // 设置文字高度
|
|
|
|
text.setColorIndex(DocGetWallBHColor());// 设置文字颜色
|
|
|
|
text.SetAlignment(XExplodeDraw::kMiddle);// 设置文字对齐方式
|
|
|
|
text.SetText(strCLab); // 设置文字内容
|
|
|
|
// 得到墙体的起始位置和结束位置
|
|
AcGePoint3d ptStart = m_startPoint, ptEnd = m_endPoint;
|
|
|
|
double dBulge = GetBulge(); // 得到墙的凸度,根据凸度判断是否是弧墙
|
|
|
|
double dWallWidth = GetWidth(0) + GetWidth(1); // 得到墙宽
|
|
|
|
// 计算文字的旋转角度
|
|
ads_real angle = ads_angle(TADSGePoint3d(ptStart), TADSGePoint3d(ptEnd)); // 与x轴的夹角
|
|
if (angle - PI < g_angleZero) // 0-180度
|
|
{
|
|
if(angle - PI/2 > g_angleZero) // 180-90度时文字旋转角度
|
|
{
|
|
angle = ads_angle(TADSGePoint3d(ptEnd), TADSGePoint3d(ptStart));
|
|
|
|
if(fabs(dBulge) > g_angleZero) // 弧墙
|
|
{
|
|
dWallWidth = -dWallWidth;
|
|
}
|
|
}
|
|
}
|
|
else // 180-360度
|
|
{
|
|
if(angle - 3*PI/2 < g_angleZero) // 180-270度时文字的旋转角度
|
|
{
|
|
angle = ads_angle(TADSGePoint3d(ptEnd), TADSGePoint3d(ptStart));
|
|
|
|
if(fabs(dBulge) > g_angleZero) // 弧墙
|
|
{
|
|
dWallWidth = -dWallWidth;
|
|
}
|
|
}
|
|
}
|
|
text.SetRotation(angle); // 设置文字的旋转角度
|
|
|
|
TADSGePoint3d ptTextAlign; // 文字的对齐点
|
|
|
|
if(fabs(dBulge) > g_angleZero)
|
|
{
|
|
TGGeCurveSegment cvsegCenter = GetCenterLine(); // 得到墙的中心线
|
|
TADSGePoint3d ptCenter = cvsegCenter.GetArc().GetCenterPt();// 得到弧墙的圆心
|
|
TADSGePoint3d ptMid = cvsegCenter.MidPoint(); // 得到中心线的中心点
|
|
double dWallAngle = ads_angle(ptMid, ptCenter); // 得到中心线的中心点和圆心的角度
|
|
ptTextAlign = TADSGePoint3d(ptMid, dWallAngle, -dWallWidth); // 得到文字的位置点
|
|
}
|
|
else
|
|
{
|
|
Midpoint(ptStart, ptEnd, ptTextAlign); // 得到墙的中点
|
|
ptTextAlign = TADSGePoint3d(ptTextAlign, angle+PI/2, -dWallWidth); // 与墙垂直方向
|
|
}
|
|
|
|
text.SetLocation(ptTextAlign); // 设置文字的插入位置
|
|
|
|
|
|
text.setLayer(DocGetWallCLLayer()); // 设置文字图层
|
|
|
|
text.ExplodeOrDraw2d(dc);
|
|
}
|
|
|
|
// add by wjx on 111228
|
|
// 功能:得到中心线的中心点和圆心得连线的角度和距离
|
|
// [in]:dDis: 到墙边的距离
|
|
// return: 中心线的中点和圆心连线的角度
|
|
double TDbWall::GetCenetrAngle(double &dDis) const
|
|
{
|
|
double dBulge = GetBulge(); // 得到墙的凸度,根据凸度判断是否是弧墙
|
|
|
|
AcGePoint3d ptStart = m_startPoint, ptEnd = m_endPoint;
|
|
|
|
// 计算文字的旋转角度
|
|
ads_real angle = ads_angle(TADSGePoint3d(ptStart), TADSGePoint3d(ptEnd));// 与x轴的夹角
|
|
if (angle - PI < g_angleZero)
|
|
{
|
|
if(angle - PI/2 > g_angleZero) // 90-180度时文字的显示角度
|
|
{
|
|
angle = ads_angle(TADSGePoint3d(ptEnd), TADSGePoint3d(ptStart));
|
|
|
|
if(fabs(dBulge) > g_angleZero) // 弧墙
|
|
{
|
|
dDis = -dDis;
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if(angle - 3*PI/2 < g_angleZero) // 180-270度时文字的显示角度
|
|
{
|
|
angle = ads_angle(TADSGePoint3d(ptEnd), TADSGePoint3d(ptStart));
|
|
|
|
if(fabs(dBulge) > _DIST_SNAP) // 弧墙
|
|
{
|
|
dDis = -dDis;
|
|
}
|
|
}
|
|
}
|
|
|
|
double dBeamAngle = 0;
|
|
if(fabs(dBulge) > _DIST_SNAP) // 弧墙
|
|
{
|
|
TGGeCurveSegment cvsegCenter = GetCenterLine(); // 得到墙的中心线
|
|
TADSGePoint3d ptCenter = cvsegCenter.GetArc().GetCenterPt();// 得到弧墙的圆心
|
|
TADSGePoint3d ptMid = cvsegCenter.MidPoint(); // 得到弧墙中心线的中心点
|
|
dBeamAngle = ads_angle(ptMid, ptCenter); // 得到中心线的中心点和圆心得连线的角度
|
|
}
|
|
else
|
|
{
|
|
dBeamAngle = angle+PI/2;
|
|
}
|
|
|
|
return dBeamAngle;
|
|
}
|
|
|
|
// add by wjx on 1112228
|
|
// 确定左右端点,以x方向和y方向确定
|
|
// [in]: ptStart:墙的起始点
|
|
// [in]: ptEnd:墙的终止点
|
|
// return: 是否交换墙的起始点和终止点
|
|
BOOL TDbWall::GetLRPoint(XPoint &ptStart, XPoint &ptEnd)const
|
|
{
|
|
bool bSEFlag = true; // 取起始点的标志
|
|
if (fabs(ptStart.x - ptEnd.x) < _DIST_SNAP) // 竖向
|
|
{
|
|
if(ptStart.y - ptEnd.y > _DIST_SNAP)
|
|
{
|
|
XPoint ptTemp = ptStart;
|
|
ptStart = ptEnd;
|
|
ptEnd = ptTemp;
|
|
bSEFlag = false;
|
|
}
|
|
}
|
|
else if(ptStart.x - ptEnd.x > _DIST_SNAP) // 横向
|
|
{
|
|
XPoint ptTemp = ptStart;
|
|
ptStart = ptEnd;
|
|
ptEnd = ptTemp;
|
|
bSEFlag = false;
|
|
}
|
|
return bSEFlag;
|
|
}
|
|
|
|
// add by wjx on 111228
|
|
// 功能: 显示墙的荷载信息
|
|
void TDbWall::DrawWallLoad(TGGiExplodeDrawBase &dc) const
|
|
{
|
|
//if(NULL == g_pStruSubProject)
|
|
//{
|
|
// return;
|
|
//}
|
|
|
|
//add by xlc on 120112荷载显示控制
|
|
BOOL bShowGraphic = false; //显示图形
|
|
BOOL bShowLive = false; //显示活荷
|
|
BOOL bShowUnLive = false; //显示恒荷
|
|
|
|
if(g_nLoadDrawMode == BYOBJLOAD)
|
|
{
|
|
bShowGraphic = true;
|
|
bShowLive = bShowUnLive = DocGetShowLoadPara();
|
|
}
|
|
else
|
|
{
|
|
bShowGraphic = GetViewStyle(BYGRAPHIC);
|
|
bShowLive = GetViewStyle(BYVARYING);
|
|
bShowUnLive = GetViewStyle(BYUNVARYING);
|
|
}
|
|
|
|
//都不显示时直接返回
|
|
if (!(bShowGraphic||bShowLive||bShowUnLive))
|
|
{
|
|
return;
|
|
}
|
|
|
|
std::vector<TStruLoad> vecLoad;
|
|
GetLoadsArray(vecLoad);
|
|
int nSize = vecLoad.size();
|
|
if(nSize < 1)
|
|
{
|
|
return;
|
|
}
|
|
|
|
TStruLoad loadData;
|
|
|
|
// 画荷载图形
|
|
TGGeCurveSegment segCenter = GetCenterLine();
|
|
segCenter.SetElevation(0.0);
|
|
XPoint ptStart = segCenter.StartPoint();
|
|
XPoint ptEnd = segCenter.EndPoint();
|
|
BOOL bSwtchSEFlag = GetLRPoint(ptStart, ptEnd);
|
|
|
|
TPushProperty vProp(this, dc);
|
|
if (m_idLayerLoad.isValid())
|
|
{
|
|
dc.SetLayer(m_idLayerLoad);
|
|
}
|
|
|
|
// 计算移动方向
|
|
double dLoadDis = 0.0; // 荷载到墙的距离
|
|
double dAugle = 0.0;
|
|
TADSGePoint3d ptMid = segCenter.MidPoint(); // 得到墙中心线的中心点
|
|
XPoint ptInsert;
|
|
ads_matrix mat;
|
|
double dLoadLen = segCenter.GetLength();
|
|
double dTextDis = 300.0; // 文字到线的距离
|
|
|
|
// modify by wjx on 120314修改荷载位置
|
|
for(int i = 0; i < nSize; i++)
|
|
{
|
|
loadData = vecLoad[i];
|
|
if(bShowGraphic)
|
|
{
|
|
TGGeCurveSegment segSub, segTemp;
|
|
XPoint ptSToCenter, ptEtoCenter; // 映射到中心线上的点
|
|
switch (loadData.GetLoadType())
|
|
{
|
|
case TStruLoad::LT_ALL_H:
|
|
dLoadDis = 100.0; // 荷载到墙的距离
|
|
dAugle = GetCenetrAngle(dLoadDis);
|
|
ptInsert = TADSGePoint3d(ptMid, dAugle, dLoadDis);
|
|
ptMid.GetMoveMatrix(ptInsert, mat);
|
|
|
|
segTemp = segCenter;
|
|
segTemp.TransformBy(mat);
|
|
dc.DrawCurve(segTemp);
|
|
break;
|
|
case TStruLoad::LT_LEFT:
|
|
dLoadDis = 150.0; // 荷载到墙的距离
|
|
dAugle = GetCenetrAngle(dLoadDis);
|
|
ptInsert = TADSGePoint3d(ptMid, dAugle, dLoadDis);
|
|
ptMid.GetMoveMatrix(ptInsert, mat);
|
|
|
|
segCenter.GetSubSegment(ptStart, loadData.GetPara1()*1000, segTemp);
|
|
segCenter.GetSubSegment((bSwtchSEFlag)? segTemp.EndPoint(): segTemp.StartPoint(),
|
|
loadData.GetPara1()*1000, segSub);
|
|
|
|
segSub.TransformBy(mat);
|
|
dc.DrawCurve(segSub);
|
|
|
|
segTemp = segSub;
|
|
|
|
ptSToCenter = segTemp.GetStartPoint();
|
|
segCenter.ProjectToMe(ptSToCenter, ptSToCenter);
|
|
segSub = TGGeCurveSegment(ptSToCenter, segTemp.GetStartPoint(), 0);
|
|
dc.DrawCurve(segSub);
|
|
|
|
ptEtoCenter = segTemp.GetEndPoint();
|
|
segCenter.ProjectToMe(ptEtoCenter, ptEtoCenter);
|
|
segSub = TGGeCurveSegment(ptEtoCenter, segTemp.GetEndPoint(), 0);
|
|
dc.DrawCurve(segSub);
|
|
break;
|
|
case TStruLoad::LT_RIGHT:
|
|
dLoadDis = 150.0; // 荷载到墙的距离
|
|
dAugle = GetCenetrAngle(dLoadDis);
|
|
ptInsert = TADSGePoint3d(ptMid, dAugle, dLoadDis);
|
|
ptMid.GetMoveMatrix(ptInsert, mat);
|
|
|
|
segCenter.GetSubSegment(ptEnd, loadData.GetPara1()*1000, segTemp);
|
|
segCenter.GetSubSegment((!bSwtchSEFlag)? segTemp.EndPoint(): segTemp.StartPoint(),
|
|
loadData.GetPara1()*1000, segSub);
|
|
segSub.TransformBy(mat);
|
|
dc.DrawCurve(segSub);
|
|
|
|
segTemp = segSub;
|
|
|
|
ptSToCenter = segTemp.GetStartPoint();
|
|
segCenter.ProjectToMe(ptSToCenter, ptSToCenter);
|
|
segSub = TGGeCurveSegment(ptSToCenter, segTemp.GetStartPoint(), 0);
|
|
dc.DrawCurve(segSub);
|
|
|
|
ptEtoCenter = segTemp.GetEndPoint();
|
|
segCenter.ProjectToMe(ptEtoCenter, ptEtoCenter);
|
|
segSub = TGGeCurveSegment(ptEtoCenter, segTemp.GetEndPoint(), 0);
|
|
dc.DrawCurve(segSub);
|
|
break;
|
|
case TStruLoad::LT_FOCUS:
|
|
dAugle = ads_angle(ptStart, ptEnd);
|
|
ptMid.GetRotationMatrix(dAugle, mat);
|
|
|
|
dLoadDis = 200.0;
|
|
segCenter.GetSubSegment(ptStart, loadData.GetPara1()*1000*2, segTemp);
|
|
|
|
ptEtoCenter = (bSwtchSEFlag)? segTemp.EndPoint(): segTemp.GetStartPoint();
|
|
ptSToCenter = XPoint(ptEtoCenter.x, ptEtoCenter.y+dLoadDis,0);
|
|
segTemp = TGGeCurveSegment(ptSToCenter, ptEtoCenter, 0);
|
|
segTemp.TransformBy(mat);
|
|
dc.DrawCurve(segTemp);
|
|
|
|
segTemp = TGGeCurveSegment(ptEtoCenter, XPoint(ptEtoCenter.x-100, ptEtoCenter.y+100, 0.0), 0);
|
|
segTemp.TransformBy(mat);
|
|
dc.DrawCurve(segTemp);
|
|
|
|
segTemp = TGGeCurveSegment(ptEtoCenter, XPoint(ptEtoCenter.x+100, ptEtoCenter.y+100, 0.0), 0);
|
|
segTemp.TransformBy(mat);
|
|
dc.DrawCurve(segTemp);
|
|
break;
|
|
case TStruLoad::LT_TRAPE:
|
|
dLoadDis = 200.0; // 荷载到墙的距离
|
|
dAugle = GetCenetrAngle(dLoadDis);
|
|
ptInsert = TADSGePoint3d(ptMid, dAugle, dLoadDis);
|
|
ptMid.GetMoveMatrix(ptInsert, mat);
|
|
|
|
segCenter.GetSubSegment(ptMid, dLoadLen-loadData.GetPara1()*2*1000, segSub);
|
|
segSub.TransformBy(mat);
|
|
dc.DrawCurve(segSub);
|
|
|
|
segTemp = segSub;
|
|
|
|
ptSToCenter = (!bSwtchSEFlag)? segTemp.EndPoint(): segTemp.StartPoint();
|
|
segSub = TGGeCurveSegment(ptStart, ptSToCenter, 0);
|
|
dc.DrawCurve(segSub);
|
|
|
|
ptEtoCenter = (bSwtchSEFlag)? segTemp.EndPoint(): segTemp.StartPoint();
|
|
segSub = TGGeCurveSegment(ptEnd, ptEtoCenter, 0);
|
|
dc.DrawCurve(segSub);
|
|
break;
|
|
case TStruLoad::LT_TRIGON:
|
|
dLoadDis = 200.0;
|
|
dAugle = GetCenetrAngle(dLoadDis);
|
|
|
|
segCenter.GetSubSegment(ptStart, (loadData.GetPara1() + loadData.GetPara2())*2*1000, segTemp);
|
|
|
|
ptSToCenter = (bSwtchSEFlag)? segTemp.GetEndPoint(): segTemp.StartPoint();
|
|
ptInsert = TADSGePoint3d(ptSToCenter, dAugle, dLoadDis);
|
|
|
|
segCenter.GetSubSegment(ptStart, loadData.GetPara1()*2*1000, segTemp);
|
|
ptSToCenter = (bSwtchSEFlag)? segTemp.GetEndPoint(): segTemp.StartPoint();
|
|
segSub = TGGeCurveSegment(ptInsert, ptSToCenter, 0);
|
|
dc.DrawCurve(segSub);
|
|
|
|
// ptEtoCenter = segTemp.EndPoint();
|
|
segCenter.GetSubSegment(ptStart, (loadData.GetPara1()+loadData.GetPara2()*2)*2*1000, segTemp);
|
|
ptEtoCenter = (bSwtchSEFlag)? segTemp.GetEndPoint(): segTemp.StartPoint();
|
|
segSub = TGGeCurveSegment(ptInsert, ptEtoCenter, 0);
|
|
dc.DrawCurve(segSub);
|
|
break;
|
|
case TStruLoad::LT_FOLD:
|
|
dLoadDis = 250.0;
|
|
dAugle = GetCenetrAngle(dLoadDis);
|
|
|
|
// segCenter.GetSubSegment(ptMid, dLoadLen/3, segSub);
|
|
// segTemp = segSub;
|
|
segCenter.GetSubSegment(ptStart, loadData.GetPara2()*2*1000, segTemp);
|
|
|
|
ptInsert = (bSwtchSEFlag)? segTemp.EndPoint(): segTemp.StartPoint();
|
|
ptSToCenter = TADSGePoint3d(ptInsert, dAugle, dLoadDis-200);
|
|
segSub = TGGeCurveSegment(ptInsert, ptSToCenter, 0);
|
|
dc.DrawCurve(segSub);
|
|
|
|
segCenter.GetSubSegment(ptStart, (loadData.GetPara2()+loadData.GetPara3())*2*1000, segTemp);
|
|
ptInsert = (bSwtchSEFlag)? segTemp.EndPoint(): segTemp.StartPoint();
|
|
ptEtoCenter = TADSGePoint3d(ptInsert, dAugle, dLoadDis);
|
|
segSub = TGGeCurveSegment(ptInsert, ptEtoCenter, 0);
|
|
dc.DrawCurve(segSub);
|
|
|
|
segSub = TGGeCurveSegment(ptSToCenter, ptEtoCenter, 0);
|
|
dc.DrawCurve(segSub);
|
|
break;
|
|
case TStruLoad::LT_MOMENT:
|
|
dAugle = ads_angle(ptStart, ptEnd);
|
|
// ptMid.GetRotationMatrix(dAugle, mat);
|
|
|
|
dLoadDis = 200;
|
|
segCenter.GetSubSegment(ptStart, loadData.GetPara1()*2*1000, segTemp);
|
|
ptInsert = (bSwtchSEFlag)? segTemp.EndPoint(): segTemp.StartPoint();
|
|
ptEtoCenter = XPoint(ptInsert.x, ptInsert.y-dLoadDis/2,0);
|
|
ptSToCenter = XPoint(ptInsert.x, ptInsert.y+dLoadDis/2,0);
|
|
segTemp = TGGeCurveSegment(ptSToCenter, ptEtoCenter, -PI*5/4);
|
|
ptInsert.GetRotationMatrix(dAugle, mat);
|
|
segTemp.TransformBy(mat);
|
|
dc.DrawCurve(segTemp);
|
|
|
|
segTemp = TGGeCurveSegment(ptEtoCenter, XPoint(ptEtoCenter.x+100, ptEtoCenter.y+100, 0.0), 0);
|
|
segTemp.TransformBy(mat);
|
|
dc.DrawCurve(segTemp);
|
|
|
|
segTemp = TGGeCurveSegment(ptEtoCenter, XPoint(ptEtoCenter.x+100, ptEtoCenter.y-100, 0.0), 0);
|
|
segTemp.TransformBy(mat);
|
|
dc.DrawCurve(segTemp);
|
|
|
|
break;
|
|
}
|
|
}
|
|
|
|
// 显示文字
|
|
if ((loadData.GetLoadKind() == TStruLoad::LK_VARYING && bShowLive) //活荷
|
|
||(loadData.GetLoadKind() == TStruLoad::LK_UNVARYING && bShowUnLive) //恒荷
|
|
)
|
|
{
|
|
dAugle = ads_angle(ptStart, ptEnd);
|
|
DrawWallLoadText2d(loadData, dAugle, dTextDis, dc);
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
// add by wjx on 111228
|
|
// 功能: 设置显示荷载的文字
|
|
// [in]: loadData: 荷载信息
|
|
// [in]: dAugle: 线与x轴的夹角
|
|
// [in]: dDis: 荷载信息显示位置到线的距离
|
|
void TDbWall::DrawWallLoadText2d(TStruLoad loadData, double dAugle,
|
|
double &dDis, TGGiExplodeDrawBase &dc) const
|
|
{
|
|
int nKind = loadData.GetLoadKind(); // 荷载种类
|
|
|
|
// 设置文字
|
|
AcDbText text;
|
|
text.setHeight(DocGetLoadTextHeight());// 设置文字高度
|
|
|
|
// 得到中心线
|
|
TGGeCurveSegment segCenter = GetCenterLine();
|
|
segCenter.SetElevation(0.0);
|
|
XPoint ptMid = segCenter.MidPoint();
|
|
|
|
// 生成要显示的荷载文字
|
|
int nType = loadData.GetLoadType(); // 荷载类型
|
|
CString strLoadInfo;
|
|
if(nType == TStruLoad::LT_FOLD)
|
|
{
|
|
strLoadInfo.Format(_T("7*%s*%s*%s*%s"), TrimDoubleZero(loadData.GetValue()),
|
|
TrimDoubleZero(loadData.GetPara1()),
|
|
TrimDoubleZero(loadData.GetPara2()),
|
|
TrimDoubleZero(loadData.GetPara3()));
|
|
}
|
|
else if(nType == TStruLoad::LT_TRIGON)
|
|
{
|
|
strLoadInfo.Format(_T("6*%s*%s*%s"), TrimDoubleZero(loadData.GetValue()),
|
|
TrimDoubleZero(loadData.GetPara1()),
|
|
TrimDoubleZero(loadData.GetPara2()));
|
|
}
|
|
else if(nType == TStruLoad::LT_ALL_H)
|
|
{
|
|
strLoadInfo.Format(_T("1*%s"), TrimDoubleZero(loadData.GetValue()));
|
|
}
|
|
else
|
|
{
|
|
strLoadInfo.Format(_T("%d*s*%s"), nType, TrimDoubleZero(loadData.GetValue()),
|
|
TrimDoubleZero(loadData.GetPara1()));
|
|
}
|
|
|
|
text.setTextString(strLoadInfo);
|
|
|
|
TPushProperty vProp(this, dc);
|
|
if(nKind == TStruLoad::LK_UNVARYING)
|
|
{
|
|
if (m_idLayerLoadC.isValid())
|
|
{
|
|
dc.SetLayer(m_idLayerLoadC);
|
|
text.setLayer(m_idLayerLoadC);
|
|
}
|
|
}
|
|
else if(nKind == TStruLoad::LK_VARYING)
|
|
{
|
|
if (m_idLayerLoadL.isValid())
|
|
{
|
|
dc.SetLayer(m_idLayerLoadL);
|
|
text.setLayer(m_idLayerLoadL);
|
|
}
|
|
}
|
|
|
|
double dBugle = GetCenetrAngle(dDis); // 与墙线垂直方向与x轴夹角
|
|
|
|
text.setRotation(dAugle);
|
|
|
|
TADSGePoint3d ptInsert = TADSGePoint3d(ptMid, dBugle, dDis); // 得到墙中心线的中心点
|
|
text.setPosition(ptInsert);
|
|
dc.DrawEntity(text);
|
|
|
|
dDis += DocGetLoadTextHeight();
|
|
}
|
|
|
|
// 在线的中点位置画箭头
|
|
// [in]: seg:墙线
|
|
// [in]: nEdgeFlag: 0:起始点 1:中点 2:终止点
|
|
void TDbWall::DrawArrow3D(TGGeCurveSegment seg, TGGiExplodeDrawBase &dc, int nEdgeFalg)const
|
|
{
|
|
XPoint ptS;
|
|
|
|
if(nEdgeFalg == 1)
|
|
{
|
|
ptS= seg.MidPoint();
|
|
}
|
|
else if(nEdgeFalg == 0)
|
|
{
|
|
ptS = seg.StartPoint();
|
|
}
|
|
else
|
|
{
|
|
ptS = seg.EndPoint();
|
|
}
|
|
|
|
XPoint ptPro, ptTemp;
|
|
|
|
TGGeCurveSegment segCenter = GetCenterLine();
|
|
segCenter.ProjectToMe(ptS, ptPro);
|
|
|
|
TGGeCurveSegment segTemp(ptS, ptPro, 0);
|
|
dc.DrawCurve(segTemp);
|
|
|
|
ptTemp = ptPro;
|
|
TGGeCurveSegment segSub;
|
|
|
|
seg.GetSubSegment(ptS, 200, segSub);
|
|
|
|
segCenter.ProjectToMe(segSub.StartPoint(), ptPro);
|
|
segTemp = TGGeCurveSegment(XPoint(ptPro.x, ptPro.y, ptPro.z+100), ptTemp, 0);
|
|
dc.DrawCurve(segTemp);
|
|
|
|
segCenter.ProjectToMe(segSub.EndPoint(), ptPro);
|
|
segTemp = TGGeCurveSegment(XPoint(ptPro.x, ptPro.y, ptPro.z+100), ptTemp, 0);
|
|
dc.DrawCurve(segTemp);
|
|
}
|
|
|
|
// add by wjx 0n 111221
|
|
// 绘制3d荷载信息
|
|
void TDbWall::DrawWallLoad3D(TGGiExplodeDrawBase &dc)const
|
|
{
|
|
//if(NULL == g_pStruSubProject)
|
|
//{
|
|
// return;
|
|
//}
|
|
|
|
//add by xlc on 120112荷载显示控制
|
|
BOOL bShowGraphic = false; //显示图形
|
|
BOOL bShowLive = false; //显示活荷
|
|
BOOL bShowUnLive = false; //显示恒荷
|
|
|
|
if(g_nLoadDrawMode == BYOBJLOAD)
|
|
{
|
|
bShowGraphic = true;
|
|
bShowLive = bShowUnLive = DocGetShowLoadPara();
|
|
}
|
|
else
|
|
{
|
|
bShowGraphic = GetViewStyle(BYGRAPHIC);
|
|
bShowLive = GetViewStyle(BYVARYING);
|
|
bShowUnLive = GetViewStyle(BYUNVARYING);
|
|
}
|
|
|
|
//都不显示时直接返回
|
|
if (!(bShowGraphic||bShowLive||bShowUnLive))
|
|
{
|
|
return;
|
|
}
|
|
|
|
std::vector<TStruLoad> vecLoad;
|
|
GetLoadsArray(vecLoad);
|
|
int nSize = vecLoad.size();
|
|
if(nSize < 1)
|
|
{
|
|
return;
|
|
}
|
|
|
|
TStruLoad loadData;
|
|
int nColorOld = dc.GetColor();
|
|
dc.SetColor(1);
|
|
|
|
TGGeCurveSegment segCenter = GetCenterLine();// 墙的中心线
|
|
TGGeCurveSegment segSub, segCenterBak;
|
|
XPoint ptMid = segCenter.MidPoint();
|
|
XPoint ptStart = segCenter.GetStartPoint();
|
|
XPoint ptEnd = segCenter.GetEndPoint();
|
|
BOOL bSwitchSE = GetLRPoint(ptStart, ptEnd);// 确定起始点和终止点那个点在左侧或右侧
|
|
XPoint ptS, ptE, ptM; // 荷载图像上的起始,结束,中点
|
|
ads_matrix mat;
|
|
double dLoadLen = segCenter.GetLength();
|
|
double dZ = 500;
|
|
double dAugle = ads_angle(ptStart, ptEnd);
|
|
AcDbArc arcLine;
|
|
AcGeVector3d vecNormal = AcGeVector3d(0, 0, 1);
|
|
|
|
for(int k = 0; k < nSize; k++)
|
|
{
|
|
loadData = vecLoad[k];
|
|
if(bShowGraphic)
|
|
{
|
|
// modify by wjx on 120314 修改荷载位置
|
|
switch (loadData.GetLoadType())
|
|
{
|
|
case TStruLoad::LT_ALL_H:
|
|
ptM = XPoint(ptMid.x, ptMid.y, ptMid.z+300);
|
|
ptMid.GetMoveMatrix(ptM, mat);
|
|
segCenterBak = segCenter;
|
|
segCenterBak.TransformBy(mat);
|
|
dc.DrawCurve(segCenterBak);
|
|
|
|
DrawArrow3D(segCenterBak, dc);
|
|
segCenterBak.GetSubSegment(ptM, dLoadLen/2, segSub);
|
|
DrawArrow3D(segSub, dc, 0);
|
|
DrawArrow3D(segSub, dc, 2);
|
|
DrawArrow3D(segCenterBak, dc, 0);
|
|
DrawArrow3D(segCenterBak, dc, 2);
|
|
break;
|
|
case TStruLoad::LT_LEFT:
|
|
ptM = XPoint(ptMid.x, ptMid.y, ptMid.z+500);
|
|
ptMid.GetMoveMatrix(ptM, mat);
|
|
segCenter.GetSubSegment(ptStart, loadData.GetPara1()*1000, segCenterBak);
|
|
segCenter.GetSubSegment((bSwitchSE)? segCenterBak.EndPoint(): segCenterBak.StartPoint(),
|
|
loadData.GetPara1()*1000, segSub);
|
|
segSub.TransformBy(mat);
|
|
dc.DrawCurve(segSub);
|
|
|
|
segCenterBak = segSub;
|
|
|
|
ptM = segCenterBak.MidPoint();
|
|
|
|
DrawArrow3D(segCenterBak, dc);
|
|
segCenterBak.GetSubSegment(ptM, segCenterBak.GetLength()/2, segSub);
|
|
DrawArrow3D(segSub, dc, 0);
|
|
DrawArrow3D(segSub, dc, 2);
|
|
DrawArrow3D(segCenterBak, dc, 0);
|
|
DrawArrow3D(segCenterBak, dc, 2);
|
|
break;
|
|
case TStruLoad::LT_RIGHT:
|
|
ptM = XPoint(ptMid.x, ptMid.y, ptMid.z+500);
|
|
ptMid.GetMoveMatrix(ptM, mat);
|
|
segCenter.GetSubSegment(ptEnd, loadData.GetPara1()*1000, segCenterBak);
|
|
segCenter.GetSubSegment((bSwitchSE)? segCenterBak.StartPoint(): segCenterBak.EndPoint(),
|
|
loadData.GetPara1()*1000, segSub);
|
|
segSub.TransformBy(mat);
|
|
dc.DrawCurve(segSub);
|
|
|
|
segCenterBak = segSub;
|
|
|
|
ptM = segCenterBak.MidPoint();
|
|
|
|
DrawArrow3D(segCenterBak, dc);
|
|
segCenterBak.GetSubSegment(ptM, segCenterBak.GetLength()/2, segSub);
|
|
DrawArrow3D(segSub, dc, 0);
|
|
DrawArrow3D(segSub, dc, 2);
|
|
DrawArrow3D(segCenterBak, dc, 0);
|
|
DrawArrow3D(segCenterBak, dc, 2);
|
|
break;
|
|
case TStruLoad::LT_FOCUS:
|
|
ptM = XPoint(ptMid.x, ptMid.y, ptMid.z+400);
|
|
ptMid.GetMoveMatrix(ptM, mat);
|
|
/*segCenterBak = segCenter;*/
|
|
segCenter.GetSubSegment(ptStart, loadData.GetPara1() * 1000 * 2, segCenterBak);
|
|
segCenterBak.TransformBy(mat);
|
|
|
|
DrawArrow3D(segCenterBak, dc);
|
|
break;
|
|
case TStruLoad::LT_TRAPE:
|
|
ptM = XPoint(ptMid.x, ptMid.y, ptMid.z+500);
|
|
ptMid.GetMoveMatrix(ptM, mat);
|
|
// segCenter.GetSubSegment(ptMid, dLoadLen/3, segCenterBak);
|
|
segCenter.GetSubSegment(ptMid, dLoadLen - 2 * loadData.GetPara1()*1000, segCenterBak);
|
|
segCenterBak.TransformBy(mat);
|
|
dc.DrawCurve(segCenterBak);
|
|
|
|
DrawArrow3D(segCenterBak, dc, 0);
|
|
DrawArrow3D(segCenterBak, dc, 1);
|
|
DrawArrow3D(segCenterBak, dc, 2);
|
|
|
|
ptS = (!bSwitchSE)? segCenterBak.EndPoint(): segCenterBak.StartPoint();
|
|
segSub = TGGeCurveSegment(ptStart, ptS, 0);
|
|
dc.DrawCurve(segSub);
|
|
DrawArrow3D(segSub, dc);
|
|
|
|
ptE = (bSwitchSE)? segCenterBak.EndPoint(): segCenterBak.StartPoint();
|
|
segSub = TGGeCurveSegment(ptEnd, ptE, 0);
|
|
dc.DrawCurve(segSub);
|
|
DrawArrow3D(segSub, dc);
|
|
break;
|
|
case TStruLoad::LT_TRIGON:
|
|
segCenter.GetSubSegment(ptStart, (loadData.GetPara1() + loadData.GetPara2())*2*1000, segSub);
|
|
ptS = (bSwitchSE)? segSub.GetEndPoint(): segSub.GetStartPoint();
|
|
ptM = XPoint(ptS.x, ptS.y, ptS.z+400);
|
|
ptS.GetMoveMatrix(ptM, mat);
|
|
|
|
// segCenterBak = segCenter;
|
|
segCenter.GetSubSegment(ptS, loadData.GetPara2()*2*1000, segCenterBak);
|
|
segCenterBak.TransformBy(mat);
|
|
DrawArrow3D(segCenterBak, dc);
|
|
|
|
// segCenter.GetSubSegment(ptMid, dLoadLen/3, segSub);
|
|
// segCenterBak = segSub;
|
|
segCenter.GetSubSegment(ptStart, loadData.GetPara1()*2*1000, segCenterBak);
|
|
ptS = (bSwitchSE)? segCenterBak.EndPoint(): segCenterBak.StartPoint();
|
|
segSub = TGGeCurveSegment(ptM, ptS, 0);
|
|
dc.DrawCurve(segSub);
|
|
|
|
DrawArrow3D(segSub, dc);
|
|
|
|
segCenter.GetSubSegment(ptStart, (loadData.GetPara1() + loadData.GetPara2()*2)*2*1000, segCenterBak);
|
|
ptE = (bSwitchSE)? segCenterBak.EndPoint(): segCenterBak.StartPoint();
|
|
segSub = TGGeCurveSegment(ptM, ptE, 0);
|
|
dc.DrawCurve(segSub);
|
|
|
|
DrawArrow3D(segSub, dc);
|
|
break;
|
|
case TStruLoad::LT_FOLD:
|
|
// segCenter.GetSubSegment(ptMid, dLoadLen/4, segSub);
|
|
// segCenterBak = segSub;
|
|
segCenter.GetSubSegment(ptStart, loadData.GetPara2()*2*1000, segCenterBak);
|
|
|
|
ptS = (bSwitchSE)? segCenterBak.EndPoint(): segCenterBak.StartPoint();
|
|
ptS = XPoint(ptS.x, ptS.y, ptS.z+100);
|
|
|
|
ptE = (bSwitchSE)? segCenterBak.EndPoint(): segCenterBak.StartPoint();
|
|
ptE = XPoint(ptE.x, ptE.y, ptE.z+400);
|
|
|
|
segSub = TGGeCurveSegment(ptS, ptE, 0);
|
|
dc.DrawCurve(segSub);
|
|
|
|
DrawArrow3D(segSub, dc, 0);
|
|
DrawArrow3D(segSub, dc, 1);
|
|
DrawArrow3D(segSub, dc, 2);
|
|
break;
|
|
case TStruLoad::LT_MOMENT:
|
|
// arcLine.setCenter(ptMid);
|
|
segCenter.GetSubSegment(ptStart, loadData.GetPara1()*2*1000, segCenterBak);
|
|
ptM = (bSwitchSE)? segCenterBak.GetEndPoint(): segCenterBak.GetStartPoint();
|
|
arcLine.setCenter(ptM);
|
|
arcLine.setStartAngle(0);
|
|
arcLine.setEndAngle(PI*3/2);
|
|
arcLine.setRadius(200);
|
|
arcLine.setNormal(AcGeVector3d::kZAxis);
|
|
arcLine.setColorIndex(1);
|
|
dc.DrawEntity(arcLine);
|
|
|
|
arcLine.getEndPoint(ptE);
|
|
segSub = TGGeCurveSegment(ptE, ptMid, 0);
|
|
dc.DrawCurve(segSub);
|
|
segSub = TGGeCurveSegment(ptE, XPoint(ptM.x, ptM.y, ptM.z-200), 0);
|
|
dc.DrawCurve(segSub);
|
|
|
|
break;
|
|
}
|
|
}
|
|
|
|
if ((loadData.GetLoadKind() == TStruLoad::LK_VARYING && bShowLive) //活荷
|
|
||(loadData.GetLoadKind() == TStruLoad::LK_UNVARYING && bShowUnLive) //恒荷
|
|
)
|
|
{
|
|
DrawLoadText3D(loadData, dAugle, dZ, dc);
|
|
}
|
|
}
|
|
|
|
dc.SetColor(nColorOld);
|
|
}
|
|
|
|
void TDbWall::DrawLoadText3D(TStruLoad loadData, double dAugle, double &dZ, TGGiExplodeDrawBase &dc)const
|
|
{
|
|
int nKind = loadData.GetLoadKind(); // 荷载种类
|
|
|
|
//del by xlc on 120112显示控制移到外边了
|
|
//if(!GetViewStyle(nKind))
|
|
//{
|
|
// return;
|
|
//}
|
|
|
|
// 设置文字
|
|
AcDbText text;
|
|
text.setHeight(DocGetLoadTextHeight());// 设置文字高度
|
|
|
|
// 得到墙的中心线
|
|
TGGeCurveSegment segCenter = GetCenterLine();
|
|
XPoint ptMid = segCenter.MidPoint();
|
|
|
|
// 生成要显示的荷载文字
|
|
int nType = loadData.GetLoadType(); // 荷载类型
|
|
CString strLoadInfo;
|
|
if(nType == TStruLoad::LT_FOLD)
|
|
{
|
|
strLoadInfo.Format(_T("7*%s*%s*%s*%s"), TrimDoubleZero(loadData.GetValue()),
|
|
TrimDoubleZero(loadData.GetPara1()),TrimDoubleZero(loadData.GetPara2()),
|
|
TrimDoubleZero(loadData.GetPara3()));
|
|
}
|
|
else if(nType == TStruLoad::LT_TRIGON)
|
|
{
|
|
strLoadInfo.Format(_T("6*%s*%s*%s"), TrimDoubleZero(loadData.GetValue()),
|
|
TrimDoubleZero(loadData.GetPara1()), TrimDoubleZero(loadData.GetPara2()));
|
|
}
|
|
else if(nType == TStruLoad::LT_ALL_H)
|
|
{
|
|
strLoadInfo.Format(_T("1*%s"), TrimDoubleZero(loadData.GetValue()));
|
|
}
|
|
else
|
|
{
|
|
strLoadInfo.Format(_T("%d*%s*%s"), nType, TrimDoubleZero(loadData.GetValue()),
|
|
TrimDoubleZero(loadData.GetPara1()));
|
|
}
|
|
|
|
text.setTextString(strLoadInfo);
|
|
|
|
TPushProperty vProp(this, dc);
|
|
if(nKind == TStruLoad::LK_UNVARYING)
|
|
{
|
|
//text.setColorIndex(7);
|
|
if (m_idLayerLoadC.isValid())
|
|
{
|
|
dc.SetLayer(m_idLayerLoadC);
|
|
text.setLayer(m_idLayerLoadC);
|
|
}
|
|
}
|
|
else if(nKind == TStruLoad::LK_VARYING)
|
|
{
|
|
//text.setColorIndex(2);
|
|
if (m_idLayerLoadL.isValid())
|
|
{
|
|
dc.SetLayer(m_idLayerLoadL);
|
|
text.setLayer(m_idLayerLoadL);
|
|
}
|
|
}
|
|
|
|
text.setRotation(dAugle);
|
|
|
|
// 设置文字法向
|
|
if(_tcscmp(dc.Desc(), TGGiWorldViewportDraw::Descriptor())==0)
|
|
{
|
|
AcGiViewport &vp = ((TGGiWorldViewportDraw&)dc).m_pVd->viewport();
|
|
|
|
AcGePoint3d ptCamera, ptTarget;
|
|
vp.getCameraTarget(ptTarget);
|
|
vp.getCameraLocation(ptCamera);
|
|
|
|
AcGeVector3d vtViewDrt = ptCamera-ptTarget;
|
|
AcGeVector3d vtViewDir1= vp.viewDir();
|
|
|
|
AcGeVector3d vtCamera;
|
|
vp.getCameraUpVector(vtCamera);
|
|
|
|
vtViewDrt.normalize();
|
|
|
|
text.setNormal(vtViewDrt);
|
|
}
|
|
|
|
text.setPosition(XPoint(ptMid.x, ptMid.y, ptMid.z+dZ));
|
|
dc.DrawEntity(text);
|
|
|
|
dZ += DocGetLoadTextHeight();
|
|
}
|
|
/*
|
|
//墙可以合并的属性条件判断
|
|
BOOL TDbWall::CanMerge(AcDbObjectId idWall)
|
|
{
|
|
int nMatTyp, nMatTypOther;
|
|
GetAt(KEY_MATTYP, nMatTyp);
|
|
|
|
int nKind(0),nKindOther(0);
|
|
GetAt(KEY_KIND,nKind);
|
|
|
|
OPENOBJ_BEGIN(idWall, AcDb::kForRead, TDbWall, pEnt);
|
|
if (pEnt)
|
|
{
|
|
pEnt->GetAt(KEY_MATTYP, nMatTypOther);
|
|
if (nMatTyp - nMatTypOther != 0)
|
|
{
|
|
//材料不同
|
|
return FALSE;
|
|
}
|
|
|
|
pEnt->GetAt(KEY_KIND, nKindOther);
|
|
if(nKind != nKindOther)
|
|
{
|
|
//类别不同
|
|
return FALSE;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
return FALSE;
|
|
}
|
|
OPENOBJ_END();
|
|
|
|
return TRUE;
|
|
}*/
|
|
//add by xlc on 120118
|
|
//设置荷载数组
|
|
bool TDbWall::SetLoadsArray(const std::vector<TStruLoad>& vectLoads)
|
|
{
|
|
assertWriteEnabled();
|
|
ClearLoadsArray();
|
|
return SetAt(KEY_WALL, vectLoads);
|
|
}
|
|
//获得荷载数组
|
|
bool TDbWall::GetLoadsArray(std::vector<TStruLoad>& vectLoads)const
|
|
{
|
|
assertReadEnabled();
|
|
return GetAt(KEY_WALL, vectLoads);
|
|
}
|
|
//清除荷载数组
|
|
void TDbWall::ClearLoadsArray()
|
|
{
|
|
assertWriteEnabled();
|
|
RemoveLoadsKey(KEY_WALL);
|
|
}
|
|
|
|
bool TDbWall::SetAt(LPCTSTR pszKey,const std::vector<TStruLoad>& vectLoads)
|
|
{
|
|
assertWriteEnabled();
|
|
if (pszKey != NULL)
|
|
{
|
|
int nLength = vectLoads.size();
|
|
GetSpecialtyData()->SetAt(pszKey, nLength);
|
|
|
|
CString sSubKey;
|
|
for (int i = 0;i < nLength; i++)
|
|
{
|
|
sSubKey.Format(_T("%s%s%d"),pszKey, KEY_ENTTYPE, i);
|
|
GetSpecialtyData()->SetAt(sSubKey, vectLoads[i].GetEntType());
|
|
|
|
sSubKey.Format(_T("%s%s%d"),pszKey, KEY_LOADTYPE, i);
|
|
GetSpecialtyData()->SetAt(sSubKey, vectLoads[i].GetLoadType());
|
|
|
|
sSubKey.Format(_T("%s%s%d"),pszKey, KEY_LOADKIND, i);
|
|
GetSpecialtyData()->SetAt(sSubKey, vectLoads[i].GetLoadKind());
|
|
|
|
sSubKey.Format(_T("%s%s%d"),pszKey, KEY_LOADVAL, i);
|
|
GetSpecialtyData()->SetAt(sSubKey, vectLoads[i].GetValue());
|
|
|
|
sSubKey.Format(_T("%s%s%d"),pszKey, KEY_LOADPARA1, i);
|
|
GetSpecialtyData()->SetAt(sSubKey, vectLoads[i].GetPara1());
|
|
|
|
sSubKey.Format(_T("%s%s%d"),pszKey, KEY_LOADPARA2, i);
|
|
GetSpecialtyData()->SetAt(sSubKey, vectLoads[i].GetPara2());
|
|
|
|
sSubKey.Format(_T("%s%s%d"),pszKey, KEY_LOADPARA3, i);
|
|
GetSpecialtyData()->SetAt(sSubKey, vectLoads[i].GetPara3());
|
|
|
|
sSubKey.Format(_T("%s%s%d"),pszKey, KEY_LOADFORCEX, i);
|
|
GetSpecialtyData()->SetAt(sSubKey, vectLoads[i].GetForceX());
|
|
|
|
sSubKey.Format(_T("%s%s%d"),pszKey, KEY_LOADFORCEY, i);
|
|
GetSpecialtyData()->SetAt(sSubKey, vectLoads[i].GetForceY());
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
bool TDbWall::GetAt(LPCTSTR pszKey,std::vector<TStruLoad>& vectLoads)const
|
|
{
|
|
assertReadEnabled();
|
|
|
|
vectLoads.clear();
|
|
if (pszKey != NULL)
|
|
{
|
|
int nLength = 0;
|
|
GetSpecialtyDataReadOnly()->GetAt(pszKey, nLength);
|
|
|
|
CString sSubKey;
|
|
double dVal = 0;
|
|
int nVal = 0;
|
|
|
|
int i = 0;
|
|
while(nLength > 0)
|
|
{
|
|
TStruLoad struLoad;
|
|
sSubKey.Format(_T("%s%s%d"),pszKey, KEY_ENTTYPE, i);
|
|
if (GetSpecialtyDataReadOnly()->GetAt(sSubKey, nVal))
|
|
{
|
|
struLoad.SetEntType(nVal);
|
|
}
|
|
|
|
sSubKey.Format(_T("%s%s%d"),pszKey, KEY_LOADTYPE, i);
|
|
if (GetSpecialtyDataReadOnly()->GetAt(sSubKey, nVal))
|
|
{
|
|
struLoad.SetLoadType(nVal);
|
|
}
|
|
|
|
sSubKey.Format(_T("%s%s%d"),pszKey, KEY_LOADKIND, i);
|
|
if (GetSpecialtyDataReadOnly()->GetAt(sSubKey, nVal))
|
|
{
|
|
struLoad.SetLoadKind(nVal);
|
|
}
|
|
|
|
sSubKey.Format(_T("%s%s%d"),pszKey, KEY_LOADVAL, i);
|
|
if (GetSpecialtyDataReadOnly()->GetAt(sSubKey, dVal))
|
|
{
|
|
struLoad.SetValue(dVal);
|
|
}
|
|
|
|
sSubKey.Format(_T("%s%s%d"),pszKey, KEY_LOADPARA1, i);
|
|
if (GetSpecialtyDataReadOnly()->GetAt(sSubKey, dVal))
|
|
{
|
|
struLoad.SetPara1(dVal);
|
|
}
|
|
|
|
sSubKey.Format(_T("%s%s%d"),pszKey, KEY_LOADPARA2, i);
|
|
if (GetSpecialtyDataReadOnly()->GetAt(sSubKey, dVal))
|
|
{
|
|
struLoad.SetPara2(dVal);
|
|
}
|
|
|
|
sSubKey.Format(_T("%s%s%d"),pszKey, KEY_LOADPARA3, i);
|
|
if (GetSpecialtyDataReadOnly()->GetAt(sSubKey, dVal))
|
|
{
|
|
struLoad.SetPara3(dVal);
|
|
}
|
|
|
|
sSubKey.Format(_T("%s%s%d"),pszKey, KEY_LOADFORCEX, i);
|
|
if (GetSpecialtyDataReadOnly()->GetAt(sSubKey, dVal))
|
|
{
|
|
struLoad.SetForceX(dVal);
|
|
}
|
|
|
|
sSubKey.Format(_T("%s%s%d"),pszKey, KEY_LOADFORCEY, i);
|
|
if (GetSpecialtyDataReadOnly()->GetAt(sSubKey, dVal))
|
|
{
|
|
struLoad.SetForceY(dVal);
|
|
}
|
|
|
|
vectLoads.push_back(struLoad);
|
|
i++;
|
|
nLength--;
|
|
}
|
|
}
|
|
|
|
return (vectLoads.size() > 0);
|
|
}
|
|
|
|
void TDbWall::RemoveLoadsKey(LPCTSTR pszKey)
|
|
{
|
|
assertWriteEnabled();
|
|
if (pszKey != NULL)
|
|
{
|
|
int nLength = 0;
|
|
GetSpecialtyData()->GetAt(pszKey, nLength);
|
|
GetSpecialtyData()->RemoveAt(pszKey);
|
|
|
|
CString sSubKey;
|
|
for (int i = 0;i < nLength; i++)
|
|
{
|
|
sSubKey.Format(_T("%s%s%d"),pszKey, KEY_ENTTYPE, i);
|
|
GetSpecialtyData()->RemoveAt(sSubKey);
|
|
|
|
sSubKey.Format(_T("%s%s%d"),pszKey, KEY_LOADTYPE, i);
|
|
GetSpecialtyData()->RemoveAt(sSubKey);
|
|
|
|
sSubKey.Format(_T("%s%s%d"),pszKey, KEY_LOADKIND, i);
|
|
GetSpecialtyData()->RemoveAt(sSubKey);
|
|
|
|
sSubKey.Format(_T("%s%s%d"),pszKey, KEY_LOADVAL, i);
|
|
GetSpecialtyData()->RemoveAt(sSubKey);
|
|
|
|
sSubKey.Format(_T("%s%s%d"),pszKey, KEY_LOADPARA1, i);
|
|
GetSpecialtyData()->RemoveAt(sSubKey);
|
|
|
|
sSubKey.Format(_T("%s%s%d"),pszKey, KEY_LOADPARA2, i);
|
|
GetSpecialtyData()->RemoveAt(sSubKey);
|
|
|
|
sSubKey.Format(_T("%s%s%d"),pszKey, KEY_LOADPARA3, i);
|
|
GetSpecialtyData()->RemoveAt(sSubKey);
|
|
|
|
sSubKey.Format(_T("%s%s%d"),pszKey, KEY_LOADFORCEX, i);
|
|
GetSpecialtyData()->RemoveAt(sSubKey);
|
|
|
|
sSubKey.Format(_T("%s%s%d"),pszKey, KEY_LOADFORCEY, i);
|
|
GetSpecialtyData()->RemoveAt(sSubKey);
|
|
}
|
|
}
|
|
}
|
|
|
|
//荷载
|
|
AcDbObjectId TDbWall::GetLayerLoad() const
|
|
{
|
|
return m_idLayerLoad;
|
|
}
|
|
void TDbWall::SetLayerLoad(AcDbObjectId idLayer)
|
|
{
|
|
assertWriteEnabled();
|
|
m_idLayerLoad = idLayer;
|
|
}
|
|
|
|
//活荷值
|
|
AcDbObjectId TDbWall::GetLayerLoadL() const
|
|
{
|
|
return m_idLayerLoadL;
|
|
}
|
|
void TDbWall::SetLayerLoadL(AcDbObjectId idLayer)
|
|
{
|
|
assertWriteEnabled();
|
|
m_idLayerLoadL = idLayer;
|
|
}
|
|
|
|
//恒荷值
|
|
AcDbObjectId TDbWall::GetLayerLoadC() const
|
|
{
|
|
return m_idLayerLoadC;
|
|
}
|
|
void TDbWall::SetLayerLoadC(AcDbObjectId idLayer)
|
|
{
|
|
assertWriteEnabled();
|
|
m_idLayerLoadC = idLayer;
|
|
}
|
|
|
|
//文字样式
|
|
AcDbObjectId TDbWall::GetTextStyle() const
|
|
{
|
|
return m_idTextStyle;
|
|
}
|
|
void TDbWall::SetTextStyle(AcDbObjectId idLayer)
|
|
{
|
|
assertWriteEnabled();
|
|
m_idTextStyle = idLayer;
|
|
}
|
|
|
|
//文字样式
|
|
AcDbObjectId TDbWall::GetTextStyleRB() const
|
|
{
|
|
return m_idTextStyleRB;
|
|
}
|
|
void TDbWall::SetTextStyleRB(AcDbObjectId idLayer)
|
|
{
|
|
assertWriteEnabled();
|
|
m_idTextStyleRB = idLayer;
|
|
}
|
|
void TDbWall::GetAssocRelation( int nType, AcDbObjectIdArray& ar ) const
|
|
{
|
|
assertReadEnabled();
|
|
switch(nType)
|
|
{
|
|
case ASSOC_XY: // XY平面关联
|
|
{
|
|
break;
|
|
}
|
|
case ASSOC_Z: // Z平面关联
|
|
{
|
|
break;
|
|
}
|
|
case ASSOC_HOLE: // 关联洞
|
|
{
|
|
//ar = m_arHoleIds;
|
|
ar.setLogicalLength(0);
|
|
for (int i = 0; i < m_lstOpeningId.Length(); i++)
|
|
{
|
|
ar.append(m_lstOpeningId[i]);
|
|
}
|
|
break;
|
|
}
|
|
case ASSOC_SLAB:// 关联楼板
|
|
{
|
|
ar = m_arSlabIds;
|
|
break;
|
|
}
|
|
case ASSOC_COLU: // 关联柱
|
|
{
|
|
ar.setLogicalLength(0);
|
|
if (!!m_idColuStart)
|
|
{
|
|
ar.append(m_idColuStart);
|
|
}
|
|
|
|
if (!!m_idColuEnd)
|
|
{
|
|
ar.append(m_idColuEnd);
|
|
}
|
|
break;
|
|
}
|
|
case ASSOC_ALL: //所有关联
|
|
{
|
|
ar.setLogicalLength(0);
|
|
|
|
if (!!m_idColuStart)
|
|
{
|
|
ar.append(m_idColuStart);
|
|
}
|
|
|
|
if (!!m_idColuEnd)
|
|
{
|
|
ar.append(m_idColuEnd);
|
|
}
|
|
|
|
if (m_arSlabIds.length() > 0)
|
|
{
|
|
ar.append(m_arSlabIds);
|
|
}
|
|
|
|
for (int i = 0; i < m_lstOpeningId.Length(); i++)
|
|
{
|
|
ar.append(m_lstOpeningId[i]);
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
// 墙的榀数
|
|
void TDbWall::GetWallSplit(std::vector<CWallSplitInfo> &vecWallSplit)const
|
|
{
|
|
assertReadEnabled();
|
|
int iSize;
|
|
if( !GetSpecialtyDataReadOnly()->GetAt(KEY_WSPLIT, iSize) ) // 获取墙榀数
|
|
{
|
|
return ;
|
|
}
|
|
|
|
CString sIndex;
|
|
CWallSplitInfo wallSplit;
|
|
for( int i=0; i<iSize; i++ )
|
|
{
|
|
wallSplit.Reset();
|
|
sIndex.Format(_T("%s%d"), KEY_WSPLIT_HEIGHT, i+1);
|
|
GetSpecialtyDataReadOnly()->GetAt(sIndex, wallSplit.m_dHeight);
|
|
sIndex.Format(_T("%s%d"), KEY_WSPLIT_WIDTH, i+1);
|
|
GetSpecialtyDataReadOnly()->GetAt(sIndex, wallSplit.m_dWidth);
|
|
sIndex.Format(_T("%s%d"), KEY_WSPLIT_SECTSPAN, i+1);
|
|
GetSpecialtyDataReadOnly()->GetAt(sIndex, wallSplit.m_dSectSpan);
|
|
sIndex.Format(_T("%s%d"), KEY_WSPLIT_AXISPRESS, i+1);
|
|
GetSpecialtyDataReadOnly()->GetAt(sIndex, wallSplit.m_dAxisPress);
|
|
sIndex.Format(_T("%s%d"), KEY_WSPLIT_NORMSECT, i+1);
|
|
GetSpecialtyDataReadOnly()->GetAt(sIndex, wallSplit.m_dWallNormSect);
|
|
sIndex.Format(_T("%s%d"), KEY_WSPLIT_SLOPSECT, i+1);
|
|
GetSpecialtyDataReadOnly()->GetAt(sIndex, wallSplit.m_dWallSlopSect);
|
|
sIndex.Format(_T("%s%d"), KEY_WSPLIT_BODYREINH, i+1);
|
|
GetSpecialtyDataReadOnly()->GetAt(sIndex, wallSplit.m_dWallBodyReinH);
|
|
sIndex.Format(_T("%s%d"), KEY_WSPLIT_BODYREINV, i+1);
|
|
GetSpecialtyDataReadOnly()->GetAt(sIndex, wallSplit.m_dWallBodyReinV);
|
|
sIndex.Format(_T("%s%d"), KEY_WSPLIT_COUPBEAM, i+1);
|
|
GetSpecialtyDataReadOnly()->GetAt(sIndex, wallSplit.m_bCoupBeam);
|
|
sIndex.Format(_T("%s%d"), KEY_WSPLIT_BEAMREINU, i+1);
|
|
GetSpecialtyDataReadOnly()->GetAt(sIndex, wallSplit.m_dWallBeamReinU);
|
|
sIndex.Format(_T("%s%d"), KEY_WSPLIT_BEAMREIND, i+1);
|
|
GetSpecialtyDataReadOnly()->GetAt(sIndex, wallSplit.m_dWallBeamReinD);
|
|
sIndex.Format(_T("%s%d"), KEY_WSPLIT_BEAMREINS, i+1);
|
|
GetSpecialtyDataReadOnly()->GetAt(sIndex, wallSplit.m_dWallBeamStrrup);
|
|
sIndex.Format(_T("%sHP%d"), KEY_WSPLIT, i+1);
|
|
GetSpecialtyDataReadOnly()->GetAt(sIndex, wallSplit.m_dWallBodyReinHP);
|
|
sIndex.Format(_T("%sVP%d"), KEY_WSPLIT, i+1);
|
|
GetSpecialtyDataReadOnly()->GetAt(sIndex, wallSplit.m_dWallBodyReinVP);
|
|
|
|
vecWallSplit.push_back(wallSplit);
|
|
}
|
|
|
|
}
|
|
|
|
// 墙的榀数
|
|
void TDbWall::SetWallSplit(const std::vector<CWallSplitInfo> &vecWallSplit)
|
|
{
|
|
assertWriteEnabled();
|
|
int iSize = vecWallSplit.size();
|
|
if( !GetSpecialtyData()->SetAt(KEY_WSPLIT, iSize) ) // 获取墙榀数
|
|
{
|
|
return ;
|
|
}
|
|
|
|
CString sIndex;
|
|
CWallSplitInfo wallSplit;
|
|
for( int i=0; i<iSize; i++ )
|
|
{
|
|
wallSplit.Reset();
|
|
wallSplit = vecWallSplit[i];
|
|
sIndex.Format(_T("%s%d"), KEY_WSPLIT_HEIGHT, i+1);
|
|
GetSpecialtyData()->SetAt(sIndex, wallSplit.m_dHeight);
|
|
sIndex.Format(_T("%s%d"), KEY_WSPLIT_WIDTH, i+1);
|
|
GetSpecialtyData()->SetAt(sIndex, wallSplit.m_dWidth);
|
|
sIndex.Format(_T("%s%d"), KEY_WSPLIT_SECTSPAN, i+1);
|
|
GetSpecialtyData()->SetAt(sIndex, wallSplit.m_dSectSpan);
|
|
sIndex.Format(_T("%s%d"), KEY_WSPLIT_AXISPRESS, i+1);
|
|
GetSpecialtyData()->SetAt(sIndex, wallSplit.m_dAxisPress);
|
|
sIndex.Format(_T("%s%d"), KEY_WSPLIT_NORMSECT, i+1);
|
|
GetSpecialtyData()->SetAt(sIndex, wallSplit.m_dWallNormSect);
|
|
sIndex.Format(_T("%s%d"), KEY_WSPLIT_SLOPSECT, i+1);
|
|
GetSpecialtyData()->SetAt(sIndex, wallSplit.m_dWallSlopSect);
|
|
sIndex.Format(_T("%s%d"), KEY_WSPLIT_BODYREINH, i+1);
|
|
GetSpecialtyData()->SetAt(sIndex, wallSplit.m_dWallBodyReinH);
|
|
sIndex.Format(_T("%s%d"), KEY_WSPLIT_BODYREINV, i+1);
|
|
GetSpecialtyData()->SetAt(sIndex, wallSplit.m_dWallBodyReinV);
|
|
sIndex.Format(_T("%s%d"), KEY_WSPLIT_COUPBEAM, i+1);
|
|
GetSpecialtyData()->SetAt(sIndex, wallSplit.m_bCoupBeam);
|
|
sIndex.Format(_T("%s%d"), KEY_WSPLIT_BEAMREINU, i+1);
|
|
GetSpecialtyData()->SetAt(sIndex, wallSplit.m_dWallBeamReinU);
|
|
sIndex.Format(_T("%s%d"), KEY_WSPLIT_BEAMREIND, i+1);
|
|
GetSpecialtyData()->SetAt(sIndex, wallSplit.m_dWallBeamReinD);
|
|
sIndex.Format(_T("%s%d"), KEY_WSPLIT_BEAMREINS, i+1);
|
|
GetSpecialtyData()->SetAt(sIndex, wallSplit.m_dWallBeamStrrup);
|
|
sIndex.Format(_T("%sHP%d"), KEY_WSPLIT, i+1);
|
|
GetSpecialtyData()->SetAt(sIndex, wallSplit.m_dWallBodyReinHP);
|
|
sIndex.Format(_T("%sVP%d"), KEY_WSPLIT, i+1);
|
|
GetSpecialtyData()->SetAt(sIndex, wallSplit.m_dWallBodyReinVP);
|
|
}
|
|
}
|
|
|
|
void TDbWall::IsFloorCover(TGGeCurveSegment cvLeft, TGGeCurveSegment cvRight, BOOL& bLeft, BOOL& bRight)const
|
|
{
|
|
bLeft = bRight = FALSE;
|
|
|
|
if (DocGetSpaceDispMode() != 1) //1为俯视法
|
|
{
|
|
return;
|
|
}
|
|
|
|
TADSGePoint3d ptLeft = cvLeft.MidPoint(), ptRight = cvRight.MidPoint();
|
|
|
|
ptLeft.z = 0;
|
|
ptRight.z = 0;
|
|
|
|
for (int i = 0; i < m_arSlabIds.length(); i++)
|
|
{
|
|
OPENOBJ_BEGIN(m_arSlabIds[i],AcDb::kForRead, TDbStruFloorSlab, pEnt);
|
|
if (pEnt)
|
|
{
|
|
TGGePoly2D poly;
|
|
pEnt->GetOutline(poly);
|
|
|
|
poly.SetElevation(0);
|
|
if (!bLeft)
|
|
{
|
|
if ((ptLeft & poly) != PR_OUTSIDE)
|
|
{
|
|
bLeft = TRUE;
|
|
}
|
|
}
|
|
|
|
if (!bRight)
|
|
{
|
|
if ((ptRight & poly) != PR_OUTSIDE)
|
|
{
|
|
bRight = TRUE;
|
|
}
|
|
}
|
|
|
|
if (bLeft && bRight)
|
|
{
|
|
break;
|
|
}
|
|
}
|
|
OPENOBJ_END();
|
|
}
|
|
|
|
}
|
|
|
|
void TDbWall::MakeAssocRelation( AcDbObjectIdArray& ids )
|
|
{
|
|
assertWriteEnabled();
|
|
TPickEntSet ss(SS_FREE);
|
|
ads_name eName;
|
|
for (int i = 0; i < ids.length(); i++)
|
|
{
|
|
if (acdbGetAdsName(eName, ids[i]) == Acad::eOk)
|
|
{
|
|
ss += ids[i];
|
|
}
|
|
}
|
|
|
|
long nLenth = ss.Length();
|
|
if (nLenth < 1)
|
|
{
|
|
return;
|
|
}
|
|
|
|
TEntitySet ent;
|
|
|
|
TGGeCurveSegment cvLeft, cvRight;
|
|
GetSideCurve(cvLeft, cvRight);
|
|
|
|
TADSGePoint3d ptLeft,ptRight;
|
|
ptLeft = cvLeft.MidPoint();
|
|
ptRight = cvRight.MidPoint();
|
|
ptLeft.z = 0;
|
|
ptRight.z = 0;
|
|
|
|
bool bModFlg = false; //记录梁的中心线是否调整
|
|
double dGap(0);
|
|
AcDbObjectId idObj = AcDbObjectId::kNull;
|
|
|
|
for (long j = 0; j < nLenth; j++)
|
|
{
|
|
ent = ss[j];
|
|
|
|
if (ent.Is(_T("ATS_STRU_FLOORSLAB"))) // 板
|
|
{
|
|
OPENOBJ_BEGIN(ent, AcDb::kForRead, TDbStruFloorSlab, pEnt);
|
|
if (!pEnt)
|
|
{
|
|
continue;
|
|
}
|
|
|
|
TGGePoly2D polyDest;
|
|
pEnt->GetOutline(polyDest);
|
|
polyDest.SetElevation(0);
|
|
|
|
if ((ptLeft & polyDest) == PR_OUTSIDE && (ptRight & polyDest) == PR_OUTSIDE)
|
|
{
|
|
continue;
|
|
}
|
|
else
|
|
{
|
|
idObj = pEnt->objectId();
|
|
}
|
|
OPENOBJ_END();
|
|
|
|
if (!m_arSlabIds.contains(idObj))
|
|
{
|
|
m_arSlabIds.append(idObj);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
void TDbWall::RemoveAssocRelation( AcDbObjectId& id )
|
|
{
|
|
m_arSlabIds.remove(id);
|
|
}
|
|
#endif |