2293 lines
51 KiB
C++
2293 lines
51 KiB
C++
//------------------------------------------------------------------------+
|
|
// Copyright (C), 1998-2011, Beijing Tangent Software Co. Ltd.
|
|
// = FileName : TDbStruFloorSlab类
|
|
// = Version : ver1.0
|
|
// = Author : ywb
|
|
// = CreateDate : 2011-06-01
|
|
// = Description: 楼板类实现
|
|
// = Maintainers:
|
|
//
|
|
//------------------------------------------------------------------------+
|
|
|
|
#include "StdAfx.h"
|
|
#ifdef TASD
|
|
#include "TBaseWallIntegrateTool.h"
|
|
#include "TDbStruFloorSlab.h"
|
|
#include "TAsdKeyDefine.h"
|
|
#include "TDbStruSlabHole.h"
|
|
#include "TConfigInfo.h"
|
|
|
|
#define BOUNDARYSPACE 100 //固定边界两短线之间的长度
|
|
#define FIXBOUNDARYLEN 50 //固定边界时短线长度
|
|
|
|
ACRX_DXF_DEFINE_MEMBERS(ATSStruFloorSlab, ATSStruEntityBase, AcDb::kDHL_CURRENT,
|
|
AcDb::kMReleaseCurrent, 1, ATS_STRU_FLOORSLAB,
|
|
"ATS_STRU_FLOORSLAB图形无法解析, 请下载上华软件|网址: www.shanghuasoft.com");
|
|
IMPLEMENT_TENTBASE(TDbStruFloorSlab);
|
|
|
|
const Adesk::UInt8 TDbStruFloorSlab::g_nVersion = 1;
|
|
int nInclineColor = 3; // 斜板颜色
|
|
|
|
TDbStruFloorSlab::TDbStruFloorSlab()
|
|
{
|
|
m_polyOutline.Reset();
|
|
m_arAssocHoleIds.setLogicalLength(0);
|
|
m_arAssocZIds.setPhysicalLength(0);
|
|
m_arAssocWallIds.setLogicalLength(0);
|
|
GetSpecialtyData()->Empty();
|
|
}
|
|
|
|
TDbStruFloorSlab::~TDbStruFloorSlab()
|
|
{
|
|
m_polyOutline.Reset();
|
|
m_arAssocHoleIds.setLogicalLength(0);
|
|
m_arAssocZIds.setPhysicalLength(0);
|
|
m_arAssocWallIds.setLogicalLength(0);
|
|
GetSpecialtyData()->Empty();
|
|
}
|
|
|
|
Acad::ErrorStatus TDbStruFloorSlab::dwgInFields( AcDbDwgFiler* pFiler )
|
|
{
|
|
assertWriteEnabled();
|
|
Acad::ErrorStatus es = TDbStruEntityBase::dwgInFields(pFiler);
|
|
if (es != Acad::eOk)
|
|
return es;
|
|
|
|
// 版本号
|
|
Adesk::UInt8 nVer = 1;
|
|
pFiler->readItem(&nVer);
|
|
if (nVer > g_nVersion)
|
|
return Acad::eMakeMeProxy;
|
|
|
|
// 轮廓线
|
|
Adesk::UInt8 nCount = 0;
|
|
pFiler->readItem(&nCount);
|
|
AcGePoint3dArray arPt(nCount, nCount);
|
|
AcArray<double> arBulge(nCount, nCount);
|
|
Adesk::Int8 i = 0;
|
|
AcGePoint3d pt;
|
|
for (i = 0; i < nCount; ++i)
|
|
{
|
|
// 点
|
|
pt = AcGePoint3d::kOrigin;
|
|
pFiler->readPoint3d(&pt);
|
|
arPt.append(pt);
|
|
}
|
|
double dBulge(0);
|
|
for (i = 0; i < nCount; ++i)
|
|
{
|
|
// 凸度
|
|
pFiler->readDouble(&dBulge);
|
|
arBulge.append(dBulge);
|
|
}
|
|
|
|
m_polyOutline.Reset();
|
|
for (i = 0; i < nCount; ++i)
|
|
m_polyOutline.AppendNode(arPt.at(i), arBulge.at(i));
|
|
m_polyOutline.SetClosed();
|
|
|
|
// 关联对象数组
|
|
nCount = 0;
|
|
// xy平面关联对象ID数组
|
|
pFiler->readItem(&nCount);
|
|
AcDbSoftPointerId id = AcDbSoftPointerId::kNull;
|
|
m_arAssocHoleIds.setLogicalLength(0);
|
|
for(i = 0; i < nCount; i++)
|
|
{
|
|
pFiler->readItem(&id);
|
|
m_arAssocHoleIds.append(id);
|
|
}
|
|
// z平面关联对象ID数组
|
|
nCount = 0;
|
|
pFiler->readItem(&nCount);
|
|
m_arAssocZIds.setLogicalLength(0);
|
|
for(i = 0; i < nCount; i++)
|
|
{
|
|
pFiler->readItem(&id);
|
|
m_arAssocZIds.append(id);
|
|
}
|
|
|
|
// 关联墙
|
|
nCount = 0;
|
|
pFiler->readItem(&nCount);
|
|
m_arAssocWallIds.setLogicalLength(0);
|
|
for (i = 0; i < nCount; i++)
|
|
{
|
|
pFiler->readItem(&id);
|
|
m_arAssocWallIds.append(id);
|
|
}
|
|
|
|
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 TDbStruFloorSlab::dwgOutFields( AcDbDwgFiler* pFiler ) const
|
|
{
|
|
assertReadEnabled();
|
|
|
|
Acad::ErrorStatus es = TDbStruEntityBase::dwgOutFields(pFiler);
|
|
if (es != Acad::eOk)
|
|
return es;
|
|
|
|
pFiler->writeItem(g_nVersion);
|
|
|
|
Adesk::UInt8 nCount = m_polyOutline.Length();
|
|
pFiler->writeItem(nCount);
|
|
Adesk::UInt8 i = 0;
|
|
for (i = 0; i < nCount; ++i)
|
|
pFiler->writePoint3d(m_polyOutline.GetPointListAt(i));
|
|
for (i = 0; i < nCount; ++i)
|
|
pFiler->writeDouble(m_polyOutline.GetBulge(i));
|
|
|
|
nCount = (Adesk::UInt8)m_arAssocHoleIds.length();
|
|
pFiler->writeItem(nCount);
|
|
for(i = 0; i < nCount; i++)
|
|
{
|
|
pFiler->writeItem(AcDbSoftPointerId(m_arAssocHoleIds.at(i)));
|
|
}
|
|
|
|
nCount = (Adesk::UInt8)m_arAssocZIds.length();
|
|
pFiler->writeItem(nCount);
|
|
for (i = 0; i < nCount; i++)
|
|
{
|
|
pFiler->writeItem(AcDbSoftPointerId(m_arAssocZIds.at(i)));
|
|
}
|
|
|
|
nCount = (Adesk::UInt8)m_arAssocWallIds.length();
|
|
pFiler->writeItem(nCount);
|
|
for (i = 0; i < nCount; i++)
|
|
{
|
|
pFiler->writeItem(AcDbSoftPointerId(m_arAssocWallIds.at(i)));
|
|
}
|
|
|
|
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 TDbStruFloorSlab::dxfInFields( AcDbDxfFiler* pFiler )
|
|
{
|
|
assertWriteEnabled();
|
|
|
|
Acad::ErrorStatus es = TDbStruEntityBase::dxfInFields(pFiler);
|
|
if (es != Acad::eOk)
|
|
return es;
|
|
if (!pFiler->atSubclassData(_T("TDbStruFloorSlab")))
|
|
return Acad::eBadDxfSequence;
|
|
|
|
try
|
|
{
|
|
// Object Version
|
|
struct resbuf rb;
|
|
pFiler->readItem(&rb);
|
|
if (rb.restype != AcDb::kDxfInt8)
|
|
throw AcDb::kDxfInt8;
|
|
|
|
Adesk::Int16 version = rb.resval.rint;
|
|
if (version > g_nVersion)
|
|
return Acad::eMakeMeProxy;
|
|
}
|
|
catch (AcDb::DxfCode code)
|
|
{
|
|
pFiler->pushBackItem();
|
|
pFiler->setError(Acad::eInvalidDxfCode, _T("\nError: expected group code %d"), code);
|
|
return pFiler->filerStatus();
|
|
}
|
|
|
|
return pFiler->filerStatus();
|
|
}
|
|
|
|
Acad::ErrorStatus TDbStruFloorSlab::dxfOutFields( AcDbDxfFiler* pFiler ) const
|
|
{
|
|
assertReadEnabled();
|
|
|
|
Acad::ErrorStatus es = TDbStruEntityBase::dxfOutFields(pFiler);
|
|
if (es != Acad::eOk)
|
|
return es;
|
|
|
|
pFiler->writeItem(AcDb::kDxfSubclass, _T("TDbStruFloorSlab"));
|
|
pFiler->writeItem(AcDb::kDxfInt8, g_nVersion);
|
|
|
|
return pFiler->filerStatus();
|
|
}
|
|
|
|
Acad::ErrorStatus TDbStruFloorSlab::subGetOsnapPoints( AcDb::OsnapMode osnapMode,
|
|
INT_PTR gsSelectionMark,
|
|
const AcGePoint3d& pickPoint,
|
|
const AcGePoint3d& lastPoint,
|
|
const AcGeMatrix3d& viewXform,
|
|
AcGePoint3dArray& snapPoints,
|
|
AcDbIntArray& geomIds ) const
|
|
{
|
|
assertReadEnabled();
|
|
|
|
TDbStruEntityBase::subGetOsnapPoints(osnapMode, gsSelectionMark, pickPoint, lastPoint, viewXform, snapPoints, geomIds);
|
|
|
|
return Acad::eOk;
|
|
}
|
|
|
|
Acad::ErrorStatus TDbStruFloorSlab::subTransformBy( const AcGeMatrix3d& xform )
|
|
{
|
|
assertWriteEnabled();
|
|
Acad::ErrorStatus es = Acad::eOk;
|
|
es = TDbStruEntityBase::subTransformBy(xform);
|
|
|
|
m_polyOutline.TransformBy(xform);
|
|
|
|
AcGePoint3d ptPos = AcGePoint3d::kOrigin;
|
|
if (GetAt(KEY_POS, ptPos))
|
|
{
|
|
ptPos.transformBy(xform);
|
|
SetAt(KEY_POS, ptPos);
|
|
}
|
|
|
|
return es;
|
|
}
|
|
|
|
Acad::ErrorStatus TDbStruFloorSlab::subGetTransformedCopy( const AcGeMatrix3d& xform, AcDbEntity*& pEnt ) const
|
|
{
|
|
assertReadEnabled();
|
|
|
|
pEnt = new TDbStruFloorSlab;
|
|
pEnt->copyFrom(this);
|
|
pEnt->transformBy(xform);
|
|
|
|
return Acad::eOk;
|
|
}
|
|
|
|
Acad::ErrorStatus TDbStruFloorSlab::copyFrom( const AcRxObject* pSrc )
|
|
{
|
|
assertWriteEnabled();
|
|
|
|
if (pSrc != NULL)
|
|
{
|
|
TDbStruEntityBase::copyFrom(pSrc);
|
|
|
|
TDbStruFloorSlab* pStruSlab = TDbStruFloorSlab::cast(pSrc);
|
|
if (pStruSlab != NULL)
|
|
{
|
|
//setDatabaseDefaults(pStruSlab->database());
|
|
m_polyOutline.Reset();
|
|
m_polyOutline = pStruSlab->GetOutlinePoly();
|
|
GetSpecialtyData()->Empty();
|
|
GetSpecialtyData()->CopyFrom(pStruSlab->GetSpecialtyData());
|
|
}
|
|
}
|
|
|
|
return Acad::eOk;
|
|
}
|
|
|
|
Acad::ErrorStatus TDbStruFloorSlab::subGetGripPoints( AcGePoint3dArray& gripPoints, AcDbIntArray& osnapModes, AcDbIntArray& geomIds ) const
|
|
{
|
|
assertReadEnabled();
|
|
|
|
// 型心
|
|
AcGePoint3d ptPos = AcGePoint3d::kOrigin;
|
|
if (GetAt(KEY_POS, ptPos))
|
|
gripPoints.append(ptPos);
|
|
|
|
int nSlabType = 0;
|
|
GetAt(KEY_KIND, nSlabType);
|
|
if (nSlabType == 1) // 悬挑板
|
|
{
|
|
// 加入顶点
|
|
int nNum = m_polyOutline.Length();
|
|
for (int i = 0; i < nNum; i++)
|
|
{
|
|
gripPoints.append(m_polyOutline[i]);
|
|
}
|
|
|
|
// 边中点
|
|
nNum = m_polyOutline.TotalSegments();
|
|
TGGeCurveSegment seg;
|
|
for (i = 0; i < nNum; i++)
|
|
{
|
|
m_polyOutline.Nth(i, seg);
|
|
gripPoints.append(seg.MidPoint());
|
|
}
|
|
}
|
|
return Acad::eOk;
|
|
}
|
|
|
|
Acad::ErrorStatus TDbStruFloorSlab::subGetStretchPoints( AcGePoint3dArray& stretchPoints ) const
|
|
{
|
|
assertReadEnabled();
|
|
|
|
AcDbIntArray osnapModes;
|
|
AcDbIntArray geomIds;
|
|
return subGetGripPoints(stretchPoints, osnapModes, geomIds);
|
|
}
|
|
|
|
Acad::ErrorStatus TDbStruFloorSlab::subMoveGripPointsAt( const AcDbIntArray& indices, const AcGeVector3d& offset )
|
|
{
|
|
if (indices.length() == 0 || offset.isZeroLength())
|
|
return Acad::eOk;
|
|
|
|
assertWriteEnabled();
|
|
|
|
// 获得所有夹点
|
|
AcGePoint3dArray arGrip;
|
|
AcDbIntArray osnapModes;
|
|
AcDbIntArray geomIds;
|
|
subGetGripPoints(arGrip, osnapModes, geomIds);
|
|
const int idx = indices.at(0);
|
|
if (idx > arGrip.length())
|
|
return Acad::eOk;
|
|
|
|
// xoy平面
|
|
AcGeVector3d vtOffset(offset);
|
|
vtOffset.z = 0;
|
|
|
|
if (idx == 0)
|
|
{
|
|
// 中心位置点
|
|
AcGeMatrix3d mat = AcGeMatrix3d::kIdentity;
|
|
mat.setToTranslation(vtOffset);
|
|
|
|
TDbStruEntityBase::subTransformBy(mat);
|
|
m_polyOutline.TransformBy(mat);
|
|
|
|
AcGePoint3d ptPos = AcGePoint3d::kOrigin;
|
|
if (GetAt(KEY_POS, ptPos))
|
|
{
|
|
ptPos.transformBy(mat);
|
|
SetAt(KEY_POS, ptPos);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
int nSlabType = 0;
|
|
GetAt(KEY_KIND, nSlabType);
|
|
if (nSlabType == 1) // 悬挑板
|
|
{
|
|
int nNum = m_polyOutline.Length();
|
|
if (idx >= 1 && idx <= nNum) // 顶点
|
|
{
|
|
m_polyOutline[idx-1]->TransformBy(vtOffset);
|
|
}
|
|
else // 某边中心点
|
|
{
|
|
int nSegIndex = idx - nNum - 1;
|
|
if (nSegIndex < 0 || nSegIndex >= m_polyOutline.TotalSegments())
|
|
{
|
|
return Acad::eOk;
|
|
}
|
|
|
|
TGGeCurveSegment seg;
|
|
m_polyOutline.Nth(nSegIndex, seg);
|
|
int nLineType = seg.GetCurveType();
|
|
if ( nLineType == CURVE_LINE)
|
|
{
|
|
// 获取当前边后边的索引
|
|
int nNextIndex = 0;
|
|
if (nSegIndex == nNum - 1)
|
|
{
|
|
nNextIndex = 0;
|
|
}
|
|
else
|
|
{
|
|
nNextIndex = nSegIndex + 1;
|
|
}
|
|
m_polyOutline[nSegIndex]->TransformBy(vtOffset);
|
|
m_polyOutline[nNextIndex]->TransformBy(vtOffset);
|
|
}
|
|
else if (nLineType == CURVE_ARC)
|
|
{
|
|
TADSGePoint3d ptMid = seg.MidPoint();
|
|
ptMid += vtOffset;
|
|
TADSGePoint3d ptS = *m_polyOutline[nSegIndex];
|
|
TADSGePoint3d ptE;
|
|
if (nSegIndex == nNum - 1)
|
|
{
|
|
ptE = *m_polyOutline[0];
|
|
}
|
|
else
|
|
{
|
|
ptE = *m_polyOutline[nSegIndex + 1];
|
|
}
|
|
TGGeArc arc(ptS, ptMid, ptE);
|
|
double dbulge = arc.Bulge();
|
|
TADSGePoint3d ptS1;
|
|
arc.GetStartPoint(ptS1);
|
|
if (ptS1.Distance(ptS) > _DIST_SNAP)
|
|
{
|
|
dbulge = -dbulge;
|
|
}
|
|
*m_polyOutline.m_ardbulges[nSegIndex] = dbulge;
|
|
}
|
|
}
|
|
|
|
AcGePoint3d ptPos;
|
|
GetAt(KEY_POS, ptPos);
|
|
TADSGePoint3d ptLow, ptUp;
|
|
m_polyOutline.GetExtend(ptLow, ptUp);
|
|
TADSGePoint3d ptMid;
|
|
Midpoint(ptLow, ptUp, ptMid);
|
|
ptPos.x = ptMid.x;
|
|
ptPos.y = ptMid.y;
|
|
SetAt(KEY_POS, ptPos);
|
|
}
|
|
}
|
|
|
|
return Acad::eOk;
|
|
}
|
|
|
|
Acad::ErrorStatus TDbStruFloorSlab::subMoveStretchPointsAt( const AcDbIntArray& indices, const AcGeVector3d& offset )
|
|
{
|
|
return subMoveGripPointsAt(indices, offset);
|
|
}
|
|
|
|
Acad::ErrorStatus TDbStruFloorSlab::subGetClassID( CLSID* pClsid ) const
|
|
{
|
|
#if (ADS >= 17)
|
|
assertReadEnabled();
|
|
#endif
|
|
return Acad::eOk;
|
|
}
|
|
|
|
Acad::ErrorStatus TDbStruFloorSlab::subWblockClone( AcRxObject* pOwner, AcDbObject*& pClonedObject, AcDbIdMapping& idMap, Adesk::Boolean isPrimary ) const
|
|
{
|
|
assertReadEnabled();
|
|
Acad::ErrorStatus es = TDbStruEntityBase::subWblockClone(pOwner, pClonedObject, idMap, isPrimary);
|
|
if (es != Acad::eOk)
|
|
return es;
|
|
|
|
TDbStruFloorSlab *pSlab = TDbStruFloorSlab::cast(pClonedObject);
|
|
if (pSlab != NULL)
|
|
{
|
|
pSlab->m_polyOutline = m_polyOutline;
|
|
pSlab->GetSpecialtyData()->Empty();
|
|
*pSlab->GetSpecialtyData() = *GetSpecialtyDataReadOnly();
|
|
}
|
|
|
|
return Acad::eOk;
|
|
}
|
|
|
|
Acad::ErrorStatus TDbStruFloorSlab::subDeepClone( AcDbObject* pOwner, AcDbObject*& pClonedObject, AcDbIdMapping& idMap, Adesk::Boolean isPrimary ) const
|
|
{
|
|
Acad::ErrorStatus es = TDbStruEntityBase::subDeepClone(pOwner, pClonedObject, idMap, isPrimary);
|
|
if (es != Acad::eOk)
|
|
return es;
|
|
|
|
return Acad::eOk;
|
|
}
|
|
|
|
Acad::ErrorStatus TDbStruFloorSlab::GetGripText( int i, CString &cs ) const
|
|
{
|
|
assertReadEnabled();
|
|
|
|
int iCtrl = GetCtrlToggle();
|
|
int iShape(-1);
|
|
GetAt(KEY_SSHAPE, iShape);
|
|
|
|
if (i == 0)
|
|
{
|
|
cs = _T("移动");
|
|
}
|
|
|
|
return Acad::eOk;
|
|
}
|
|
|
|
Acad::ErrorStatus TDbStruFloorSlab::ExplodeOrDraw3d( TGGiExplodeDrawBase &dc ) const
|
|
{
|
|
assertReadEnabled();
|
|
|
|
if(m_polyOutline.Length() < 2)
|
|
{
|
|
return Acad::eOk;
|
|
}
|
|
|
|
// modify by wjx on 120105 设置斜板颜色
|
|
int nColor = dc.GetColor();
|
|
if(IsInclinedSlab())
|
|
{
|
|
dc.SetColor(nInclineColor);
|
|
}
|
|
|
|
TGGePoly2D plTop(m_polyOutline);
|
|
plTop.SetElevation(GetTopElev());
|
|
if (plTop.HasArcSegment())
|
|
{
|
|
TGGePoly2D poly;
|
|
plTop.Disperse(poly);
|
|
plTop = poly;
|
|
}
|
|
|
|
double dArea = plTop.PathArea();
|
|
if (dArea <= _DIST_SNAP)
|
|
{
|
|
plTop.Reverse();
|
|
}
|
|
|
|
if(g_bDetailMode)
|
|
{
|
|
const AcGePoint3d pt0 = *plTop[0];
|
|
const AcGePoint3d pt1 = *plTop[1];
|
|
const AcGePoint3d pt2 = *plTop[2];
|
|
AcGeVector3d vt1 = pt0 - pt1;
|
|
AcGeVector3d vt2 = pt2 - pt1;
|
|
vt1 = vt2.crossProduct(vt1);
|
|
vt1.normalize(); // 朝下
|
|
|
|
double dHigh(0);
|
|
GetAt(KEY_THICK, dHigh);
|
|
vt1 *= dHigh;
|
|
// 侧面
|
|
AcGePoint3dArray ptArr;
|
|
for(int i = 0; i < plTop.Length(); i++)
|
|
{
|
|
AcGePoint3d pt = *plTop[i];
|
|
ptArr.append(pt);
|
|
ptArr.append(pt + vt1);
|
|
}
|
|
AcGePoint3d pt = *plTop[0];
|
|
ptArr.append(pt);
|
|
ptArr.append(pt + vt1);
|
|
dc.DrawMesh(plTop.Length() + 1, 2, ptArr.asArrayPtr());
|
|
|
|
// 顶面
|
|
TDPtrList<TGGePoly2D> lstHole;
|
|
TDbStruSlabHole *pHole = NULL;
|
|
for (int i = 0; i < m_arAssocHoleIds.length(); i++)
|
|
{
|
|
acdbOpenObject(pHole, m_arAssocHoleIds[i], AcDb::kForRead);
|
|
if (pHole != NULL)
|
|
{
|
|
TGGePoly2D poly2d;
|
|
pHole->GetOutline(poly2d);
|
|
pHole->Close();
|
|
TGGePoly2D *pPolyIn=new TGGePoly2D(poly2d);
|
|
lstHole.Append(pPolyIn);
|
|
}
|
|
}
|
|
dc.DrawShell(plTop, lstHole);
|
|
|
|
// 底面
|
|
AcGeMatrix3d mat;
|
|
mat.setTranslation(vt1);
|
|
plTop.TransformBy(mat);
|
|
lstHole.Reset();
|
|
pHole = NULL;
|
|
for (i = 0; i < m_arAssocHoleIds.length(); i++)
|
|
{
|
|
acdbOpenObject(pHole, m_arAssocHoleIds[i], AcDb::kForRead);
|
|
if (pHole != NULL)
|
|
{
|
|
TGGePoly2D poly2d;
|
|
pHole->GetOutline(poly2d);
|
|
pHole->Close();
|
|
poly2d.TransformBy(mat);
|
|
TGGePoly2D *pPolyIn=new TGGePoly2D(poly2d);
|
|
lstHole.Append(pPolyIn);
|
|
}
|
|
}
|
|
dc.DrawShell(plTop, lstHole);
|
|
}
|
|
else
|
|
{
|
|
dc << plTop;
|
|
}
|
|
|
|
// modify by xlc on 120112荷载显示控制
|
|
if((DocGetSlabShowLoad() && g_nLoadDrawMode == BYOBJLOAD)|| g_nLoadDrawMode == SURFACELOAD)
|
|
{
|
|
DrawSlabLoad(dc, 1);
|
|
}
|
|
|
|
dc.SetColor(nColor);
|
|
|
|
return Acad::eOk;
|
|
}
|
|
|
|
Acad::ErrorStatus TDbStruFloorSlab::ExplodeOrDraw2d( TGGiExplodeDrawBase &dc ) const
|
|
{
|
|
assertReadEnabled();
|
|
int nSlabType = 0;
|
|
GetAt(KEY_KIND, nSlabType);
|
|
|
|
// modify by wjx on 120105 设置斜板颜色
|
|
int nColor = dc.GetColor();
|
|
if(IsInclinedSlab())
|
|
{
|
|
dc.SetColor(nInclineColor);
|
|
}
|
|
|
|
if (nSlabType == 0) // 普通板
|
|
{
|
|
TGGePoly2D poly(m_polyOutline);
|
|
poly.SetElevation(0.0); // 二维时z值置为0
|
|
|
|
AcDbObjectId idMe = objectId();
|
|
BOOL bHighlight = !idMe;
|
|
int nHLight = 0;
|
|
GetAt(KEY_HLGHT, nHLight);
|
|
if (nHLight == 1 || g_nLoadDrawMode == SURFACELOAD || g_nDrawModeSlab == 1)
|
|
{
|
|
bHighlight = TRUE;
|
|
}
|
|
|
|
if(bHighlight)
|
|
{
|
|
dc << poly;
|
|
}
|
|
|
|
//显示构件编号
|
|
//if(DocGetSlabShowCL())
|
|
{
|
|
DrawClab(dc);
|
|
}
|
|
|
|
//显示板厚尺寸
|
|
if(DocGetSlabShowBH())
|
|
{
|
|
DrawBH(dc);
|
|
}
|
|
}
|
|
else // 悬挑板
|
|
{
|
|
ExplodeOrDraw2d2(dc);
|
|
}
|
|
|
|
// modify by xlc on 120112荷载显示控制
|
|
if((DocGetSlabShowLoad() && g_nLoadDrawMode == BYOBJLOAD)|| g_nLoadDrawMode == SURFACELOAD)
|
|
{
|
|
DrawSlabLoad(dc, 0);
|
|
}
|
|
|
|
if (g_nDrawModeSlabBorder) //绘制边界属性
|
|
{
|
|
DrawBorder(dc);
|
|
}
|
|
|
|
dc.SetColor( nColor);
|
|
|
|
return Acad::eOk;
|
|
}
|
|
|
|
Acad::ErrorStatus TDbStruFloorSlab::ExplodeOrDraw2d2( TGGiExplodeDrawBase &dc ) const
|
|
{
|
|
assertReadEnabled();
|
|
int nNum = m_polyOutline.TotalSegments();
|
|
TGGeVisibilityPoly2D poly;
|
|
TGGeCurveSegment seg;
|
|
AcDb::Visibility visible;
|
|
for (int i = 0; i < nNum; i++)
|
|
{
|
|
if (IsVisibleAt(i)) // 可见
|
|
{
|
|
m_polyOutline.Nth(i, seg);
|
|
GetPoly(poly, seg);
|
|
poly.SetElevation(0.0);
|
|
for(int j = 0; j < poly.TotalSegments(); j++)
|
|
{
|
|
poly.Nth(j, seg, &visible);
|
|
if (visible == AcDb::kVisible)
|
|
{
|
|
dc << seg;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return Acad::eOk;
|
|
}
|
|
|
|
Acad::ErrorStatus TDbStruFloorSlab::GetExtents2d( TADSGePoint3d &ptLow, TADSGePoint3d &ptUp ) const
|
|
{
|
|
assertReadEnabled();
|
|
m_polyOutline.GetExtend(ptLow, ptUp);
|
|
ptLow.z = 0.0;
|
|
ptUp.z = 0.0;
|
|
return Acad::eOk;
|
|
}
|
|
|
|
Acad::ErrorStatus TDbStruFloorSlab::GetExtents( TADSGePoint3d &ptLow, TADSGePoint3d &ptUp ) const
|
|
{
|
|
assertReadEnabled();
|
|
|
|
GetExtents2d(ptLow, ptUp);
|
|
|
|
AcGePoint3d ptPos;
|
|
GetAt(KEY_POS, ptPos);
|
|
|
|
double dUpHigh(0);
|
|
GetAt(KEY_UPHIGH, dUpHigh);
|
|
ptUp.z = ptPos.z + dUpHigh;
|
|
|
|
double dThick(0);
|
|
GetAt(KEY_THICK, dThick);
|
|
ptLow.z = ptUp.z - dThick;
|
|
|
|
return Acad::eOk;
|
|
}
|
|
|
|
bool TDbStruFloorSlab::UnifyElevation( double dElevation )
|
|
{
|
|
SetTopElev(dElevation);
|
|
return true;
|
|
}
|
|
|
|
void TDbStruFloorSlab::GetTips(TDPtrList<TObjInfoUnit>& lstInfo) const
|
|
{
|
|
assertReadEnabled();
|
|
double dHeight(0);
|
|
GetAt(KEY_THICK, dHeight);
|
|
|
|
lstInfo.Append(new TObjInfoUnit(_T("板厚"), Dist2Str(dHeight)));
|
|
}
|
|
|
|
const TCHAR * TDbStruFloorSlab::GetDefaultLayer() const
|
|
{
|
|
int nSlabType = 0;
|
|
GetAt(KEY_KIND, nSlabType);
|
|
if (nSlabType == 1) // 悬挑板
|
|
{
|
|
return LAY_S_CSLA;
|
|
}
|
|
return LAY_S_SLAB_PLAN_LINE;
|
|
}
|
|
|
|
BOOL TDbStruFloorSlab::IsValid() const
|
|
{
|
|
assertReadEnabled();
|
|
|
|
double dHigh(0);
|
|
GetAt(KEY_THICK, dHigh);
|
|
if (dHigh <= _DIST_SNAP)
|
|
return FALSE;
|
|
|
|
if (m_polyOutline.IsClosed() != 1)
|
|
return FALSE;
|
|
|
|
if (m_polyOutline.IsSelfIntersect())
|
|
return FALSE;
|
|
|
|
if (m_polyOutline.Area() <= _DIST_SNAP)
|
|
return FALSE;
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
void TDbStruFloorSlab::CopyPropertiesFrom( AcDbEntity *pSrcEntity, unsigned gMatchFlag )
|
|
{
|
|
assertWriteEnabled();
|
|
|
|
TDbStruEntityBase::CopyPropertiesFrom(pSrcEntity, gMatchFlag);
|
|
TDbStruFloorSlab* pSlab = TDbStruFloorSlab::cast(pSrcEntity);
|
|
if (pSlab != NULL)
|
|
{
|
|
AcGePoint3d ptPos;
|
|
GetAt(KEY_POS, ptPos);
|
|
double dThickness(0);
|
|
GetAt(KEY_THICK, dThickness);
|
|
GetSpecialtyData()->Empty();
|
|
GetSpecialtyData()->CopyFrom(pSlab->GetSpecialtyData());
|
|
SetAt(KEY_POS, ptPos);
|
|
SetAt(KEY_THICK, dThickness);
|
|
|
|
if(database() == NULL ||
|
|
pSrcEntity->database() == NULL ||
|
|
database() == pSrcEntity->database())
|
|
{
|
|
m_idLayerLoad = pSlab->m_idLayerLoad;
|
|
m_idLayerLoadL = pSlab->m_idLayerLoadL;
|
|
m_idLayerLoadC = pSlab->m_idLayerLoadC;
|
|
m_idTextStyle = pSlab->m_idTextStyle;
|
|
m_idTextStyleRB = pSlab->m_idTextStyleRB;
|
|
}
|
|
}
|
|
}
|
|
|
|
bool TDbStruFloorSlab::GetStandardFaceBody( AcDbVoidPtrArray& arFacePtrs ) const
|
|
{
|
|
return false;
|
|
}
|
|
|
|
bool TDbStruFloorSlab::GetSafeProtectedSpace( AcDbVoidPtrArray& arFacePtrs ) const
|
|
{
|
|
return false;
|
|
}
|
|
|
|
bool TDbStruFloorSlab::GetSection( const AcDbFace &face,
|
|
const AcGeVector3d& vtPlaneSecDir,
|
|
std::vector<TObjSectionRecord> §ionRecords,
|
|
AcDbVoidPtrArray& arFillPtrs ) const
|
|
{
|
|
return false;
|
|
}
|
|
|
|
CString TDbStruFloorSlab::GetXml(const AcGeMatrix3d& mat) const
|
|
{
|
|
TXmlTree xmlTree;
|
|
POSITION posRoot = xmlTree.Insert(_T("ATS_STRU_FLOORSLAB"), NULL, NULL);
|
|
{
|
|
xmlTree.SetAttribute(posRoot, _T("name"), _T("楼板"));
|
|
xmlTree.SetAttribute(posRoot, _T("comment"), _T("上华对象名称"));
|
|
}
|
|
|
|
CString strText;
|
|
POSITION posItem1 = xmlTree.Insert(_T("Object_ID"), posRoot, NULL);
|
|
{
|
|
xmlTree.SetAttribute(posItem1, _T("name"), _T("对象编号"));
|
|
xmlTree.SetAttribute(posItem1, _T("comment"), _T("当前对象的句柄"));
|
|
strText.Format(_T("%ld"), objectId());
|
|
xmlTree.SetItemText(posItem1, strText);
|
|
}
|
|
|
|
POSITION posItem = NULL;
|
|
POSITION posItem2 = xmlTree.Insert(_T("Position"),posRoot, posItem1);
|
|
{
|
|
xmlTree.SetAttribute(posItem2, _T("name"), _T("位置点"));
|
|
AcGePoint3d ptPos;
|
|
GetAt(KEY_POS, ptPos);
|
|
TADSGePoint3d ptTransformBy = ptPos;
|
|
ptTransformBy.TransformBy(mat);
|
|
strText.Format(_T("%f,%f,%f"), ptTransformBy.x, ptTransformBy.y, ptTransformBy.z);
|
|
xmlTree.SetItemText(posItem, strText);
|
|
}
|
|
|
|
POSITION posItem3 = xmlTree.Insert(_T("UpHeight"), posRoot, posItem2);
|
|
{
|
|
double dHeight=0;
|
|
GetAt(KEY_UPHIGH, dHeight);
|
|
xmlTree.SetAttribute(posItem3, _T("name"), _T("抬板高度"));
|
|
xmlTree.SetAttribute(posItem3, _T("comment"), _T("楼板抬升高度"));
|
|
strText.Format(_T("%f"), dHeight);
|
|
xmlTree.SetItemText(posItem, strText);
|
|
}
|
|
|
|
POSITION posItem5 = xmlTree.Insert(_T("Thick"), posRoot, posItem3);
|
|
{
|
|
xmlTree.SetAttribute(posItem5, _T("name"), _T("楼板厚度"));
|
|
xmlTree.SetAttribute(posItem, _T("comment"), _T("楼板厚度"));
|
|
double dHeight=0;
|
|
GetAt(KEY_THICK, dHeight);
|
|
strText.Format(_T("%f"), dHeight);
|
|
xmlTree.SetItemText(posItem, strText);
|
|
}
|
|
|
|
POSITION posItem6 = xmlTree.Insert(_T("Link_Hole"),posRoot, posItem5);
|
|
{
|
|
xmlTree.SetAttribute(posItem3, _T("name"), _T("板洞"));
|
|
|
|
for (int i = 0; i < m_arAssocHoleIds.length(); i++)
|
|
{
|
|
posItem = xmlTree.Insert(_T("Link_ID"), posItem3, posItem);
|
|
xmlTree.SetAttribute(posItem, _T("name"), _T("洞口句柄"));
|
|
strText.Format(_T("%ld"), m_arAssocHoleIds[i]);
|
|
xmlTree.SetItemText(posItem, strText);
|
|
}
|
|
}
|
|
|
|
CString strBase = TEntityBase::GetXml(mat);
|
|
CString strXml = xmlTree.GetXml();
|
|
int nIndex = strXml.Find(_T("<Object_ID"));
|
|
strXml.Insert(nIndex, strBase);
|
|
|
|
return strXml;
|
|
}
|
|
|
|
void TDbStruFloorSlab::PostAssocMsg( TAssocMsg assocMsg ) const
|
|
{
|
|
|
|
}
|
|
|
|
void TDbStruFloorSlab::ReceiveAssocMsg( TAssocMsg assocMsg )
|
|
{
|
|
assertWriteEnabled();
|
|
#ifdef TESTCASE
|
|
AcDbObjectIdArray arId;
|
|
arId.append(assocMsg.GetAssocId());
|
|
MakeAssocRelation(arId);
|
|
return;
|
|
#endif
|
|
|
|
}
|
|
|
|
void TDbStruFloorSlab::MakeAssocRelation( AcDbObjectIdArray& ids )
|
|
{
|
|
assertWriteEnabled();
|
|
#ifdef TESTCASE
|
|
m_arAssocHoleIds.append(ids);
|
|
return;
|
|
#endif
|
|
|
|
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];
|
|
}
|
|
}
|
|
|
|
TGGePoly2D poly; //楼板面
|
|
GetOutline(poly);
|
|
poly.SetElevation(0);
|
|
|
|
double dGap(0);
|
|
TEntitySet ent;
|
|
AcDbObjectId idObj;
|
|
for (long j = 0; j < ss.Length(); j++)
|
|
{
|
|
ent = ss[j];
|
|
if (ent.Is(_T("ATS_STRUBEAM"))) //梁
|
|
{
|
|
OPENOBJ_BEGIN(ent, AcDb::kForRead, TDbBaseWall, pEnt);
|
|
if (!pEnt)
|
|
{
|
|
continue;
|
|
}
|
|
|
|
TGGePoly2D polyDest; //梁,墙平面线
|
|
pEnt->GetPoly2D(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_arAssocWallIds.contains(idObj))
|
|
{
|
|
m_arAssocWallIds.append(idObj);
|
|
}
|
|
}
|
|
else if (ent.Is(_T("ATS_WALL"))) //墙
|
|
{
|
|
OPENOBJ_BEGIN(ent, AcDb::kForRead, TDbWall, pEnt);
|
|
if (!pEnt)
|
|
{
|
|
continue;
|
|
}
|
|
|
|
TGGePoly2D polyDest; //梁,墙平面线
|
|
pEnt->GetOutlinePoly1(0, polyDest);
|
|
|
|
bool bRet = TBaseWallIntegrateTool::GetMinGap(poly, polyDest, dGap);
|
|
if(bRet && dGap < _DIST_SNAP)
|
|
{
|
|
idObj = pEnt->objectId();
|
|
}
|
|
else
|
|
{
|
|
continue;
|
|
}
|
|
OPENOBJ_END();
|
|
|
|
if (!m_arAssocWallIds.contains(idObj))
|
|
{
|
|
m_arAssocWallIds.append(idObj);
|
|
}
|
|
}
|
|
else if (ent.Is(_T("ATS_STRUSLABHOLE")))//板洞
|
|
{
|
|
OPENOBJ_BEGIN(ent, AcDb::kForRead, TDbStruSlabHole, 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_arAssocHoleIds.contains(idObj))
|
|
{
|
|
m_arAssocHoleIds.append(idObj);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// 不验证关系,直接建立关联关系
|
|
void TDbStruFloorSlab::MakeAssocRelationDirect(const AcDbObjectId& idObj)
|
|
{
|
|
assertWriteEnabled();
|
|
TPickEntSet ss(SS_FREE);
|
|
ss += idObj;
|
|
|
|
TEntitySet ent;
|
|
for (long i = 0; i < ss.Length(); i++)
|
|
{
|
|
ent = ss[i];
|
|
if (ent.Is(_T("ATS_STRUBEAM"))
|
|
||ent.Is(_T("ATS_WALL"))) // 梁,墙
|
|
{
|
|
if (!m_arAssocWallIds.contains(idObj))
|
|
{
|
|
m_arAssocWallIds.append(idObj);
|
|
}
|
|
}
|
|
else if (ent.Is(_T("ATS_STRUSLABHOLE"))) // 墙洞
|
|
{
|
|
if (!m_arAssocHoleIds.contains(idObj))
|
|
{
|
|
m_arAssocHoleIds.append(idObj);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
void TDbStruFloorSlab::RemoveAssocRelation( AcDbObjectId& id )
|
|
{
|
|
assertWriteEnabled();
|
|
m_arAssocHoleIds.remove(id);
|
|
m_arAssocWallIds.remove(id);
|
|
m_arAssocZIds.remove(id);
|
|
}
|
|
|
|
void TDbStruFloorSlab::GetAssocRelation( int nType, AcDbObjectIdArray& ar ) const
|
|
{
|
|
assertReadEnabled();
|
|
ar.setLogicalLength(0);
|
|
|
|
switch (nType)
|
|
{
|
|
case ASSOC_HOLE:
|
|
ar.append(m_arAssocHoleIds);
|
|
break;
|
|
case ASSOC_Z:
|
|
ar.append(m_arAssocZIds);
|
|
break;
|
|
case ASSOC_XY:
|
|
ar.append(m_arAssocWallIds);
|
|
break;
|
|
case ASSOC_ALL:
|
|
ar.append(m_arAssocHoleIds);
|
|
ar.append(m_arAssocWallIds);
|
|
ar.append(m_arAssocZIds);
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
}
|
|
|
|
void TDbStruFloorSlab::GetOutline( TGGePoly2D &poly ) const
|
|
{
|
|
assertReadEnabled();
|
|
poly = m_polyOutline;
|
|
}
|
|
|
|
const TGGePoly2D& TDbStruFloorSlab::GetOutlinePoly() const
|
|
{
|
|
assertReadEnabled();
|
|
return (TGGePoly2D&)m_polyOutline;
|
|
}
|
|
|
|
void TDbStruFloorSlab::SetOutlinePoly( const TGGePoly2D &poly )
|
|
{
|
|
assertWriteEnabled();
|
|
m_polyOutline = poly;
|
|
m_polyOutline.SetFlag(1); //需要外轮廓线闭合
|
|
if (m_polyOutline.PathArea() > 0) // 顺时针
|
|
{
|
|
m_polyOutline.Reverse();
|
|
}
|
|
}
|
|
|
|
double TDbStruFloorSlab::GetTopElev() const
|
|
{
|
|
assertReadEnabled();
|
|
AcGePoint3d ptPos = AcGePoint3d::kOrigin;
|
|
GetAt(KEY_POS, ptPos);
|
|
double dUpHigh = 0.0; // 抬板高度
|
|
GetAt(KEY_UPHIGH, dUpHigh);
|
|
return ptPos.z + dUpHigh;
|
|
}
|
|
|
|
void TDbStruFloorSlab::SetTopElev( double dElev )
|
|
{
|
|
assertWriteEnabled();
|
|
AcGePoint3d ptPos = AcGePoint3d::kOrigin;
|
|
GetAt(KEY_POS, ptPos);
|
|
ptPos.z = dElev;
|
|
SetAt(KEY_POS, ptPos);
|
|
}
|
|
|
|
bool TDbStruFloorSlab::IsVisibleAt( int idx ) const
|
|
{
|
|
assertReadEnabled();
|
|
ASSERT(idx < m_polyOutline.TotalSegments());
|
|
int nEdge = 0;
|
|
GetAt(KEY_RAILEDGE, nEdge);
|
|
int nTestBit = 0x01;
|
|
nTestBit <<= idx;
|
|
bool bVal = (nEdge&nTestBit) > 0;
|
|
return ((nEdge&nTestBit) > 0);
|
|
}
|
|
|
|
void TDbStruFloorSlab::SetVisibleAt( int idx, bool bHasRail )
|
|
{
|
|
assertWriteEnabled();
|
|
ASSERT(idx < m_polyOutline.TotalSegments());
|
|
int nEdge = 0;
|
|
GetAt(KEY_RAILEDGE, nEdge);
|
|
int nTestBit = 0x01;
|
|
nTestBit <<= idx;
|
|
if(bHasRail)
|
|
{
|
|
nEdge |= nTestBit;
|
|
}
|
|
else
|
|
{
|
|
nEdge &= ~nTestBit;
|
|
}
|
|
SetAt(KEY_RAILEDGE, nEdge);
|
|
}
|
|
|
|
void TDbStruFloorSlab::GetPoly( TGGeVisibilityPoly2D &poly, TGGeCurveSegment &seg ) const
|
|
{
|
|
seg.SetElevation(0.0);
|
|
TGGePoly2D polyTemp;
|
|
seg.AsPoly2D(polyTemp);
|
|
AcDbCurve *pCurve = polyTemp.AsAcDbCurve();
|
|
if (pCurve == NULL)
|
|
{
|
|
return;
|
|
}
|
|
|
|
TADSGePoint3d ptS = seg.StartPoint(), ptE = seg.EndPoint();
|
|
poly.Reset();
|
|
poly.SetAcDbCurve(pCurve);
|
|
TDbWall *pWall = NULL;
|
|
TGGePoly2D poly1;
|
|
AcDbCurve *pTemp = NULL;
|
|
AcGePoint3dArray arPt;
|
|
for (int i = 0; i < m_arAssocWallIds.length(); i++)
|
|
{
|
|
acdbOpenObject(pWall, m_arAssocWallIds[i], AcDb::kForRead);
|
|
if (pWall != NULL)
|
|
{
|
|
pWall->GetOutlinePoly(0,poly1);
|
|
pWall->close();
|
|
|
|
poly1.SetElevation(0.0);
|
|
pTemp = poly1.AsAcDbCurve();
|
|
if (pTemp != NULL)
|
|
{
|
|
arPt.setLogicalLength(0);
|
|
pTemp->intersectWith(pCurve, AcDb::kOnBothOperands, arPt);
|
|
delete pTemp;
|
|
pTemp = NULL;
|
|
|
|
if (arPt.length() == 2)
|
|
{
|
|
poly.InsertNodeAt(arPt[0], arPt[1], AcDb::kInvisible); // 设置为不可见
|
|
}
|
|
else if (arPt.length() == 1)
|
|
{
|
|
int nRet = ptS & poly1;
|
|
if (nRet == PR_EDGE || nRet == PR_INSIDE)
|
|
{
|
|
poly.InsertNodeAt(arPt[0], ptS, AcDb::kInvisible);
|
|
}
|
|
|
|
nRet = ptE & poly1;
|
|
if (nRet == PR_EDGE || nRet == PR_INSIDE)
|
|
{
|
|
poly.InsertNodeAt(arPt[0], ptE, AcDb::kInvisible);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
delete pCurve;
|
|
}
|
|
|
|
void TDbStruFloorSlab::AddAssocWallId( const AcDbObjectId &idWall )
|
|
{
|
|
m_arAssocWallIds.append(idWall);
|
|
}
|
|
|
|
void TDbStruFloorSlab::RemoveAssocWall()
|
|
{
|
|
m_arAssocWallIds.setLogicalLength(0);
|
|
}
|
|
|
|
|
|
// 显示板厚
|
|
void TDbStruFloorSlab::DrawBH(TGGiExplodeDrawBase &dc) const
|
|
{
|
|
assertReadEnabled();
|
|
TDbText text;
|
|
|
|
// 得到文字样式
|
|
AcDbObjectId idFloorBHStyl = DocGetSlabBHStyle();
|
|
if(idFloorBHStyl.isNull())
|
|
{
|
|
idFloorBHStyl = InitTextStyle(TS_STANDARD);
|
|
}
|
|
text.SetStyleId(idFloorBHStyl); // 设置文字样式
|
|
|
|
text.SetHeight(DocGetSlabBHHigh()); // 设置楼板尺寸文字高度
|
|
|
|
int nColor = IsInclinedSlab()? nInclineColor: DocGetSlabBHColor();
|
|
text.setColorIndex(nColor);// 设置尺寸文字颜色
|
|
|
|
text.SetAlignment(XExplodeDraw::kCenter);// 设置文字的对齐方式
|
|
|
|
CString strText;
|
|
if(1 == DocGetSlabShowBH()) // 显示板的标高和板厚
|
|
{
|
|
double dTHick, dEle;
|
|
GetAt(KEY_THICK, dTHick); // 得到板厚
|
|
CString strThick = Dist2Str(dTHick);
|
|
strText = strThick;
|
|
|
|
GetAt(KEY_UPHIGH, dEle); // 得到楼板的标高
|
|
if(fabs(dEle) > _DIST_SNAP) // 如果楼板的标高不为0则显示
|
|
{
|
|
CString strEle = Dist2Str(dEle);
|
|
strText += _T("/");
|
|
strText += strEle;
|
|
}
|
|
}
|
|
else if(2 == DocGetSlabShowBH()) // 荷载和荷载编号
|
|
{
|
|
|
|
}
|
|
text.SetText(strText); // 设置文字内容
|
|
|
|
AcGePoint3d ptInsert;
|
|
GetAt(KEY_POS, ptInsert); // 得到楼板的插入位置
|
|
ptInsert.z = 0;
|
|
ptInsert.y -= DocGetSlabBHHigh()*GetPScale();// 将文字显示的位置设置在楼板形心的下部
|
|
text.SetLocation(ptInsert); // 设置文字的插入位置
|
|
|
|
text.ExplodeOrDraw2d(dc);
|
|
}
|
|
|
|
// 显示板的构件编号
|
|
void TDbStruFloorSlab::DrawClab(TGGiExplodeDrawBase &dc) const
|
|
{
|
|
assertReadEnabled();
|
|
TDbText text;
|
|
|
|
// 得到文字样式ID
|
|
AcDbObjectId idFloorCLStyl = DocGetSlabCLStyle();
|
|
if(idFloorCLStyl.isNull())
|
|
{
|
|
idFloorCLStyl = InitTextStyle(TS_STANDARD);
|
|
}
|
|
text.SetStyleId(idFloorCLStyl); // 设置文字样式
|
|
|
|
text.SetHeight(DocGetSlabCLHigh()); // 设置文字高度
|
|
|
|
int nColor = IsInclinedSlab()? nInclineColor: DocGetSlabBHColor();
|
|
text.setColorIndex(nColor);// 设置文字颜色
|
|
|
|
text.SetAlignment(XExplodeDraw::kCenter);// 设置文字对齐方式
|
|
|
|
CString strText;
|
|
GetAt(KEY_CLAB, strText);
|
|
text.SetText(strText); // 得到楼板的构建编号
|
|
|
|
AcGePoint3d ptInsert;
|
|
GetAt(KEY_POS, ptInsert); // 得到楼板的插入位置
|
|
ptInsert.z = 0;
|
|
text.SetLocation(ptInsert); // 设置文字的插入位置
|
|
|
|
text.setLayer(DocGetSlabCLLayer()); // 设置文字图层
|
|
|
|
text.ExplodeOrDraw2d(dc); // 画文字对象
|
|
}
|
|
|
|
// add by wjx on 111226
|
|
// 绘制楼面荷载信息
|
|
void TDbStruFloorSlab::DrawSlabLoad(TGGiExplodeDrawBase &dc, int n2dOr3dFlag)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;
|
|
}
|
|
|
|
// modify by wjx on 120130 修改荷载的读取方式
|
|
std::vector<TStruLoad> vecLoad;
|
|
GetLoadsArray(vecLoad);
|
|
int nSize = vecLoad.size();
|
|
if(nSize < 1)
|
|
{
|
|
return;
|
|
}
|
|
|
|
TStruLoad loadData;
|
|
//int nColor = dc.GetColor();
|
|
TPushProperty vProp(this, dc);
|
|
if (m_idLayerLoad.isValid())
|
|
{
|
|
dc.SetLayer(m_idLayerLoad);
|
|
}
|
|
|
|
for(int i = 0; i < nSize; i++)
|
|
{
|
|
loadData = vecLoad[i];
|
|
|
|
if (bShowGraphic)
|
|
{
|
|
DrawSlabLoad2dOr3d(dc, loadData, n2dOr3dFlag);
|
|
}
|
|
|
|
if ((loadData.GetLoadKind() == TStruLoad::LK_VARYING && bShowLive) //活荷
|
|
||(loadData.GetLoadKind() == TStruLoad::LK_UNVARYING && bShowUnLive) //恒荷
|
|
)
|
|
{
|
|
DrawSlabLoadText2dOr3d(dc, loadData, n2dOr3dFlag);
|
|
}
|
|
}
|
|
//dc.SetColor(nColor);
|
|
|
|
// AcDbHandle hBeam;
|
|
// getAcDbHandle(hBeam);
|
|
// int nHandle = hBeam.low();
|
|
//
|
|
// // 在自然层中找到该句柄对应的荷载信息
|
|
// int nSize = g_pStruSubProject->m_vecFloorData.size();// 自然层数
|
|
// int nLoadSize = 0; // 自然层中荷载数量
|
|
// TStruEntLoads entLoad;
|
|
// bool bFind = false; // 是否找到荷载信息
|
|
// for(int i = 0; i < nSize; i++)
|
|
// {
|
|
// nLoadSize = g_pStruSubProject->m_vecFloorData[i].m_arEntLoads.size();
|
|
// for (int j = 0; j < nLoadSize; j++)
|
|
// {
|
|
// entLoad = g_pStruSubProject->m_vecFloorData[i].m_arEntLoads[j];
|
|
//
|
|
// if (entLoad.GetEntHandle().low() == nHandle)
|
|
// {
|
|
// bFind = true;
|
|
// int nColor = dc.GetColor();
|
|
// // 得到荷载数据
|
|
// int nLoadInfoCount = g_pStruSubProject->m_vecFloorData[i].m_arEntLoads[j].m_vecLoads.size();
|
|
// TStruLoad loadData;
|
|
// for(int k = 0; k < nLoadInfoCount; k++)
|
|
// {
|
|
// loadData = g_pStruSubProject->m_vecFloorData[i].m_arEntLoads[j].m_vecLoads[k];
|
|
//
|
|
// if (bShowGraphic)
|
|
// {
|
|
// DrawSlabLoad2dOr3d(dc, loadData, n2dOr3dFlag);
|
|
// }
|
|
//
|
|
// if ((loadData.GetLoadKind() == TStruLoad::LK_VARYING && bShowLive) //活荷
|
|
// ||(loadData.GetLoadKind() == TStruLoad::LK_UNVARYING && bShowUnLive) //恒荷
|
|
// )
|
|
// {
|
|
// DrawSlabLoadText2dOr3d(dc, loadData, n2dOr3dFlag);
|
|
// }
|
|
// }
|
|
// dc.SetColor(nColor);
|
|
// break;
|
|
// }
|
|
// }
|
|
//
|
|
// if(bFind)
|
|
// {
|
|
// break;
|
|
// }
|
|
// }
|
|
}
|
|
|
|
// add by wjx on 111226
|
|
// 绘制荷载
|
|
void TDbStruFloorSlab::DrawSlabLoad2dOr3d(TGGiExplodeDrawBase &dc, TStruLoad loadData, int n2dOr3dFlag) const
|
|
{
|
|
//if(!GetViewStyle(BYGRAPHIC))
|
|
//{
|
|
// return;
|
|
//}
|
|
|
|
//dc.SetColor(7);
|
|
TGGePoly2D poly = GetOutlinePoly();
|
|
|
|
TGGeCurveSegment segOne, segSec, segTemp;
|
|
|
|
XPoint pt[4], ptTemp;
|
|
|
|
// 得得到各方向的线
|
|
int nType = loadData.GetLoadType();
|
|
if(nType == 1 || nType == 2)
|
|
{
|
|
pt[0] = poly.GetPointListAt(0)->AsAcGePoint3d();
|
|
pt[1] = poly.GetPointListAt(1)->AsAcGePoint3d();
|
|
pt[2] = poly.GetPointListAt(2)->AsAcGePoint3d();
|
|
pt[3] = poly.GetPointListAt(3)->AsAcGePoint3d();
|
|
double dMin, dMax;
|
|
// 得到左侧的两个点和右侧的两个点
|
|
bool blSwitch = false;
|
|
for(int i = 0; i < 3; i++)
|
|
{
|
|
for(int j = 0; j < 3-i; j++)
|
|
{
|
|
dMin = pt[j].x;
|
|
dMax = pt[j+1].x;
|
|
|
|
if(dMin - dMax > _DIST_SNAP)
|
|
{
|
|
ptTemp = pt[j];
|
|
pt[j] = pt[j+1];
|
|
pt[j+1] = ptTemp;
|
|
|
|
blSwitch = true;
|
|
}
|
|
else if(fabs(dMin - dMax) <= _DIST_SNAP)
|
|
{
|
|
dMin = pt[j].y;
|
|
dMax = pt[j+1].y;
|
|
if(dMin - dMax > _DIST_SNAP)
|
|
{
|
|
ptTemp = pt[j];
|
|
pt[j] = pt[j+1];
|
|
pt[j+1] = ptTemp;
|
|
|
|
blSwitch = true;
|
|
}
|
|
}
|
|
}
|
|
|
|
if(!blSwitch)
|
|
{
|
|
break;
|
|
}
|
|
}
|
|
|
|
segOne = TGGeCurveSegment(pt[0], (nType == 1)? pt[1]: pt[2], 0);
|
|
segSec = TGGeCurveSegment((nType == 1)?pt[2]: pt[1], pt[3], 0);
|
|
|
|
segTemp = TGGeCurveSegment(pt[0], segOne.MidPoint(), 0);
|
|
ptTemp = segTemp.MidPoint();
|
|
|
|
segSec.ProjectToMe(ptTemp, ptTemp);
|
|
segTemp = TGGeCurveSegment(segTemp.MidPoint(), ptTemp, 0);
|
|
if(n2dOr3dFlag == 0)
|
|
{
|
|
segTemp.SetElevation(0.0);
|
|
}
|
|
dc.DrawCurve(segTemp);
|
|
|
|
segSec.ProjectToMe(segOne.MidPoint(), ptTemp);
|
|
segTemp = TGGeCurveSegment(segOne.MidPoint(), ptTemp, 0);
|
|
if(n2dOr3dFlag == 0)
|
|
{
|
|
segTemp.SetElevation(0.0);
|
|
}
|
|
if(nType == 1)
|
|
{
|
|
dc.DrawCurve(segTemp);
|
|
}
|
|
|
|
segTemp = TGGeCurveSegment((nType == 1)? pt[1]: pt[2], segOne.MidPoint(), 0);
|
|
ptTemp = segTemp.MidPoint();
|
|
segSec.ProjectToMe(ptTemp, ptTemp);
|
|
segTemp = TGGeCurveSegment(segTemp.MidPoint(), ptTemp, 0);
|
|
if(n2dOr3dFlag == 0)
|
|
{
|
|
segTemp.SetElevation(0.0);
|
|
}
|
|
dc.DrawCurve(segTemp);
|
|
}
|
|
else if(nType == 3)
|
|
{
|
|
poly.Nth(0, segOne);
|
|
poly.Nth(1, segSec);
|
|
|
|
TGGeCurveSegment segLeft, segRight;
|
|
TADSGePointDir2d ptL, ptR;
|
|
if(segOne.GetLength() - segSec.GetLength() < g_distZero)
|
|
{
|
|
poly.Nth(2, segSec);
|
|
}
|
|
else
|
|
{
|
|
poly.Nth(3, segOne);
|
|
}
|
|
|
|
if(n2dOr3dFlag == 0)
|
|
{
|
|
segOne.SetElevation(0.0);
|
|
segSec.SetElevation(0.0);
|
|
}
|
|
|
|
segTemp = TGGeCurveSegment(segOne.MidPoint(), segSec.MidPoint(), 0);
|
|
pt[0] = segOne.StartPoint();
|
|
pt[1] = segOne.EndPoint();
|
|
|
|
double dDis = segOne.GetLength()/2;
|
|
segTemp.Polar(dDis, ptL);
|
|
|
|
segOne = TGGeCurveSegment(pt[0], ptL, 0);
|
|
if(n2dOr3dFlag == 0)
|
|
{
|
|
segOne.SetElevation(0.0);
|
|
}
|
|
dc.DrawCurve(segOne);
|
|
|
|
segOne = TGGeCurveSegment(pt[1], ptL, 0);
|
|
dc.DrawCurve(segOne);
|
|
|
|
pt[0] = segSec.GetStartPoint();
|
|
pt[1] = segSec.GetEndPoint();
|
|
|
|
dDis = segTemp.GetLength() - segSec.GetLength()/2;
|
|
segTemp.Polar(dDis, ptR);
|
|
|
|
segOne = TGGeCurveSegment(pt[0], ptR, 0);
|
|
if(n2dOr3dFlag == 0)
|
|
{
|
|
segOne.SetElevation(0.0);
|
|
}
|
|
dc.DrawCurve(segOne);
|
|
|
|
segOne = TGGeCurveSegment(pt[1], ptR, 0);
|
|
if(n2dOr3dFlag == 0)
|
|
{
|
|
segOne.SetElevation(0.0);
|
|
}
|
|
dc.DrawCurve(segOne);
|
|
|
|
segOne = TGGeCurveSegment(ptL, ptR, 0);
|
|
if(n2dOr3dFlag == 0)
|
|
{
|
|
segOne.SetElevation(0.0);
|
|
}
|
|
dc.DrawCurve(segOne);
|
|
|
|
}
|
|
else if(nType == 4)
|
|
{
|
|
if(n2dOr3dFlag == 0)
|
|
{
|
|
poly.SetElevation(0.0);
|
|
}
|
|
TGGePoly2D polyOffset;
|
|
if (poly.Offset(-200.0, polyOffset) == RTNORM)
|
|
{
|
|
dc.DrawXPoly(polyOffset);
|
|
}
|
|
}
|
|
}
|
|
|
|
// add by wjx on 111227
|
|
// 绘制荷载的文字信息
|
|
void TDbStruFloorSlab::DrawSlabLoadText2dOr3d(TGGiExplodeDrawBase &dc, TStruLoad loadData,
|
|
int n2dOr3dFlag) const
|
|
{
|
|
int nKind = loadData.GetLoadKind(); // 荷载种类
|
|
|
|
//if(!GetViewStyle(nKind))
|
|
//{
|
|
// return;
|
|
//}
|
|
|
|
TGGePoly2D poly = GetOutlinePoly();
|
|
XPoint pt[4], ptTemp;
|
|
|
|
pt[0] = poly.GetPointListAt(0)->AsAcGePoint3d();
|
|
pt[1] = poly.GetPointListAt(1)->AsAcGePoint3d();
|
|
pt[2] = poly.GetPointListAt(2)->AsAcGePoint3d();
|
|
pt[3] = poly.GetPointListAt(3)->AsAcGePoint3d();
|
|
// 得到左侧的两个点和右侧的两个点
|
|
bool blSwitch = false;
|
|
for(int i = 0; i < 3; i++)
|
|
{
|
|
for(int j = 0; j < 3-i; j++)
|
|
{
|
|
if(pt[j].x > pt[j+1].x)
|
|
{
|
|
ptTemp = pt[j];
|
|
pt[j] = pt[j+1];
|
|
pt[j+1] = ptTemp;
|
|
|
|
blSwitch = true;
|
|
}
|
|
}
|
|
|
|
if(!blSwitch)
|
|
{
|
|
break;
|
|
}
|
|
}
|
|
|
|
TGGeCurveSegment segLeft = TGGeCurveSegment(pt[0], pt[1], 0);
|
|
TGGeCurveSegment segRight = TGGeCurveSegment(pt[2], pt[3], 0);
|
|
|
|
XPoint ptMidL = segLeft.MidPoint();
|
|
XPoint ptMidR = segRight.MidPoint();
|
|
|
|
double dAngle = ads_angle(ptMidL, ptMidR);
|
|
|
|
while(dAngle<0)
|
|
{
|
|
dAngle += PI;
|
|
}
|
|
|
|
while (dAngle > PI/2)
|
|
{
|
|
dAngle -= PI/2;
|
|
}
|
|
|
|
// 设置文字
|
|
AcDbText text;
|
|
text.setHeight(DocGetLoadTextHeight());// 设置文字高度
|
|
|
|
AcGePoint3d ptInsert;
|
|
GetAt(KEY_POS, ptInsert); // 得到楼板的插入位置
|
|
|
|
CString strNo, strLoadText;
|
|
GetAt(KEY_CLAB, strNo);
|
|
|
|
text.setTextString(strNo);
|
|
|
|
// modify by wjx on 120326
|
|
// strLoadText.Format(_T("%.1f"), loadData.GetValue());
|
|
strLoadText = TrimDoubleZero(loadData.GetValue());
|
|
|
|
XPoint ptText;
|
|
ads_matrix matMove, matRot;
|
|
|
|
if(n2dOr3dFlag == 0)
|
|
{
|
|
double dDis = fabs(pt[0].y-pt[1].y)/4.0;
|
|
|
|
XPoint(ptInsert).GetMoveMatrix(XPoint(ptInsert.x, ptInsert.y+dDis, ptInsert.z), matMove);
|
|
XPoint(ptInsert).GetRotationMatrix(dAngle, matRot);
|
|
ptText = XPoint(ptInsert);
|
|
ptText.TransformBy(matRot);
|
|
ptText.TransformBy(matMove);
|
|
|
|
text.setPosition(XPoint(ptText.x, ptText.y, 0));
|
|
text.setColorIndex(1);
|
|
dc.DrawEntity(text);
|
|
//text.setColorIndex(256);
|
|
|
|
text.setTextString(strLoadText);
|
|
|
|
TPushProperty vProp(this, dc);
|
|
|
|
if(nKind == TStruLoad::LK_UNVARYING)
|
|
{
|
|
text.setPosition(XPoint(ptInsert.x, ptInsert.y, 0));
|
|
//text.setColorIndex(7);
|
|
if (m_idLayerLoadC.isValid())
|
|
{
|
|
dc.SetLayer(m_idLayerLoadC);
|
|
text.setLayer(m_idLayerLoadC);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
XPoint(ptInsert).GetMoveMatrix(XPoint(ptInsert.x, ptInsert.y-dDis, ptInsert.z), matMove);
|
|
ptText = XPoint(ptInsert);
|
|
ptText.TransformBy(matRot);
|
|
ptText.TransformBy(matMove);
|
|
|
|
text.setPosition(XPoint(ptText.x, ptText.y, 0));
|
|
//text.setColorIndex(2);
|
|
if (m_idLayerLoadL.isValid())
|
|
{
|
|
dc.SetLayer(m_idLayerLoadL);
|
|
text.setLayer(m_idLayerLoadL);
|
|
}
|
|
}
|
|
dc.DrawEntity(text);
|
|
}
|
|
else
|
|
{
|
|
// 设置文字法向
|
|
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(ptInsert.x, ptInsert.y, ptInsert.z+2*DocGetLoadTextHeight()));
|
|
text.setColorIndex(1);
|
|
dc.DrawEntity(text);
|
|
|
|
text.setColorIndex(256);
|
|
text.setTextString(strLoadText);
|
|
TPushProperty vProp(this, dc);
|
|
if(nKind == TStruLoad::LK_UNVARYING)
|
|
{
|
|
text.setPosition(XPoint(ptInsert.x, ptInsert.y, ptInsert.z+DocGetLoadTextHeight()));
|
|
//text.setColorIndex(7);
|
|
if (m_idLayerLoadC.isValid())
|
|
{
|
|
dc.SetLayer(m_idLayerLoadC);
|
|
text.setLayer(m_idLayerLoadC);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
text.setPosition(ptInsert);
|
|
//text.setColorIndex(2);
|
|
if (m_idLayerLoadL.isValid())
|
|
{
|
|
dc.SetLayer(m_idLayerLoadL);
|
|
text.setLayer(m_idLayerLoadL);
|
|
}
|
|
}
|
|
dc.DrawEntity(text);
|
|
}
|
|
}
|
|
|
|
// add by wjx 0n 120105
|
|
// 判断是否为斜板
|
|
// return: TRUE:是斜板 FALSE:不是斜板
|
|
BOOL TDbStruFloorSlab::IsInclinedSlab()const
|
|
{
|
|
TGGePoly2D poly;
|
|
poly = GetOutlinePoly();
|
|
|
|
XPoint ptVertex;
|
|
int iPointNum = poly.Length(); // 得到poly的顶点个数
|
|
if(iPointNum > 0)
|
|
{
|
|
ptVertex = poly.GetPointListAt(0)->AsAcGePoint3d();
|
|
double dZ = ptVertex.z; // z坐标
|
|
for (int i = 1; i < iPointNum; i++)
|
|
{
|
|
ptVertex = poly.GetPointListAt(i)->AsAcGePoint3d();// 得到poly的第i个顶点
|
|
|
|
// 通过z坐标判断是否是斜板
|
|
if(fabs(dZ - ptVertex.z) > _DIST_SNAP)
|
|
{
|
|
return TRUE;
|
|
}
|
|
}
|
|
}
|
|
|
|
return FALSE;
|
|
}
|
|
|
|
void TDbStruFloorSlab::DrawBorder(TGGiExplodeDrawBase &dc)const
|
|
{
|
|
TGGeCurveSegment seg, segLeft, segRight;
|
|
TGGePoly2D poly;
|
|
GetOutline(poly);
|
|
|
|
int nBoundType = 0; //保存边界条件类型
|
|
Adesk::Int16 nOldColorIndex = dc.GetColor();
|
|
|
|
double dOffsetDis = 0.0; //偏移距离
|
|
int nSegNum = poly.TotalSegments();
|
|
int nSide = 0;
|
|
for (int i = 0; i < nSegNum; i++)
|
|
{
|
|
poly.Nth(i, seg);
|
|
|
|
if (!GetBound(i, nBoundType))//取得边界类型和边界
|
|
{
|
|
continue;
|
|
}
|
|
|
|
if (i == 0)
|
|
{
|
|
poly.Nth(nSegNum - 1, segLeft);
|
|
poly.Nth(i + 1, segRight);
|
|
}
|
|
else if (i == nSegNum - 1)
|
|
{
|
|
poly.Nth(i-1, segLeft);
|
|
poly.Nth(0, segRight);
|
|
}
|
|
else
|
|
{
|
|
poly.Nth(i - 1, segLeft);
|
|
poly.Nth(i + 1, segRight);
|
|
}
|
|
|
|
GetBoundSegment(seg, segLeft, segRight ,nSide);
|
|
|
|
TADSGePoint3d ptStart = seg.StartPoint();
|
|
TADSGePointDir2d ptDirS, ptDirE;
|
|
TADSGePoint3d ptS,ptE;
|
|
|
|
int nNum = 0;
|
|
double dLenth = 0.0;
|
|
double dSpaceLen = 0.0;
|
|
double dSegLenth = seg.GetLength();
|
|
double dBulge = seg.GetBulge();
|
|
|
|
switch(nBoundType) //边界类型
|
|
{
|
|
case FIXBOUNDARY: //固定边界
|
|
dc.SetColor(1);
|
|
dc.DrawXCurve(seg, 0);
|
|
|
|
nNum = dSegLenth / BOUNDARYSPACE;
|
|
|
|
//绘制短线
|
|
for (int n = 0; n < nNum - 1; n++)
|
|
{
|
|
dLenth = (n + 1) * dSegLenth / nNum;
|
|
seg.Polar(dLenth, ptDirS);
|
|
ptS = ptDirS.AsAcGePoint3d();
|
|
if (fabs(seg.GetBulge()) < _angSnap)
|
|
{
|
|
ads_polar(ptS, seg.Direction(ptS) + PI/2 , FIXBOUNDARYLEN, ptE);
|
|
}
|
|
else
|
|
{
|
|
ads_polar(ptS, nSide==OFFSET_LEFT ? seg.Direction(ptS) + PI/2 : seg.Direction(ptS) - PI/2 , FIXBOUNDARYLEN, ptE);
|
|
}
|
|
TGGeCurveSegment segTemp(ptS, ptE, 0.0);
|
|
dc.DrawXCurve(segTemp, 0);
|
|
}
|
|
break;
|
|
case SIMBOUNDARY: //简支边界
|
|
dc.SetColor(5);
|
|
dc.DrawXCurve(seg, 0);
|
|
break;
|
|
case FREEBOUNDARY: //自由边界
|
|
dc.SetColor(5);
|
|
dSpaceLen = 2 * BOUNDARYSPACE;//自由边界时短线和短线之间间距的长度
|
|
|
|
nNum = dSegLenth / dSpaceLen;
|
|
if (nNum%2 == 0) //为了保证将边界线偶数等分
|
|
{
|
|
nNum = nNum + 1;
|
|
}
|
|
|
|
dSpaceLen = dSegLenth / nNum;
|
|
|
|
//以一定距离绘制边界线
|
|
for (int j = 0; j < nNum; j = j + 2)
|
|
{
|
|
dLenth = j * dSpaceLen;
|
|
seg.Polar(dLenth, ptDirS);
|
|
ptS = ptDirS.AsAcGePoint3d();
|
|
seg.Polar(dLenth + dSpaceLen, ptDirE);
|
|
ptE = ptDirE.AsAcGePoint3d();
|
|
|
|
dBulge = dBulge / nNum;
|
|
|
|
TGGeCurveSegment segment(ptS, ptE, dBulge);
|
|
dc.DrawXCurve(segment, 0);
|
|
}
|
|
break;
|
|
default:
|
|
dc.SetColor(0);
|
|
dc.DrawXCurve(seg,0);
|
|
break;
|
|
}
|
|
}
|
|
dc.SetColor(nOldColorIndex);
|
|
}
|
|
void TDbStruFloorSlab::GetBoundSegment(TGGeCurveSegment &cvSeg, TGGeCurveSegment cvLeftSeg, TGGeCurveSegment cvRightSeg, int &nSide) const
|
|
{
|
|
AcDbObjectIdArray idArray;
|
|
GetAssocRelation(ASSOC_ALL, idArray);
|
|
|
|
TGGePoly2D poly;
|
|
GetOutline(poly); //楼板poly
|
|
TGGeCurveSegment cvBase; //求的所求线段左右两边直线
|
|
bool bLeft = false, bRight = false, bBase = false; //保存是否是所得的三根线
|
|
TADSGePoint3d ptLeftMid = cvLeftSeg.MidPoint(), ptRightMid = cvRightSeg.MidPoint(), ptSegMid = cvSeg.MidPoint();
|
|
double dWidth = 0;
|
|
|
|
TGGeCurveSegment segTemp = cvSeg;
|
|
TADSGePoint3d ptTemp;
|
|
for (int i = 0; i < idArray.length(); i++)
|
|
{
|
|
OPENOBJ_BEGIN(idArray[i], AcDb::kForRead, TDbBaseWall, pWall);
|
|
if (pWall == NULL)
|
|
{
|
|
continue;
|
|
}
|
|
|
|
cvBase = pWall->GetLongBaseLine();
|
|
pWall->GetTotalWidth(dWidth);
|
|
dWidth = dWidth / 2;
|
|
|
|
double dDist = cvBase.GetDist2Me(ptSegMid);
|
|
if (fabs(cvBase.GetDist2Me(ptSegMid)) < _DIST_SNAP
|
|
&& fabs(cvBase.MidPoint().Distance2d(ptSegMid)) < _DIST_SNAP)//将选择的楼板的边偏移到梁,或者墙边线上
|
|
{
|
|
nSide = GetOffsetSegment(cvSeg, poly, dWidth);
|
|
segTemp = cvSeg;
|
|
bBase = true;
|
|
}
|
|
else if (fabs(cvBase.GetDist2Me(ptLeftMid)) < _DIST_SNAP //将与cvSeg相邻的边进行偏移
|
|
&& fabs(cvBase.MidPoint().Distance2d(ptLeftMid)) < _DIST_SNAP)
|
|
{
|
|
GetOffsetSegment(cvLeftSeg, poly, dWidth);
|
|
bLeft = true;
|
|
}
|
|
else if (fabs(cvBase.GetDist2Me(ptRightMid)) < _DIST_SNAP //将与cvSeg相邻的另外一条边进行偏移
|
|
&& fabs(cvBase.MidPoint().Distance2d(ptRightMid)) < _DIST_SNAP)
|
|
{
|
|
GetOffsetSegment(cvRightSeg, poly, dWidth);
|
|
bRight = true;
|
|
}
|
|
|
|
if (bLeft && bRight && bBase)
|
|
{
|
|
break;
|
|
}
|
|
OPENOBJ_END();
|
|
}
|
|
|
|
TADSGePoint3d pt1, pt2;
|
|
int nInterNum = cvSeg.Intersection(cvLeftSeg, pt1, pt2);
|
|
|
|
if (nInterNum > 0) //如果有交点
|
|
{
|
|
if(nInterNum == 2) //如果有两个交点,需要求出两个交点中哪一个是需要使用的点
|
|
{
|
|
TADSGePoint3d ptS = cvLeftSeg.StartPoint(), ptE = cvLeftSeg.EndPoint();
|
|
double dDist1 = ptS.Distance2d(pt1);
|
|
|
|
//求出两个交点与cvleftseg的两个端点的距离最近
|
|
//说明这个交点是需要使用的交点
|
|
if (ptE.Distance2d(pt1) < dDist1)
|
|
{
|
|
dDist1 = ptE.Distance2d(pt1);
|
|
}
|
|
|
|
double dDist2 = ptS.Distance2d(pt2);
|
|
if (ptE.Distance2d(pt2) < dDist2)
|
|
{
|
|
dDist2 = ptE.Distance2d(pt2);
|
|
}
|
|
|
|
if (dDist1 > dDist2)
|
|
{
|
|
pt1 = pt2;
|
|
}
|
|
}
|
|
|
|
if (cvSeg.StartPoint().Distance2d(pt1) < cvSeg.EndPoint().Distance(pt1))
|
|
{
|
|
cvSeg.SetStartPoint(pt1);
|
|
}
|
|
else
|
|
{
|
|
cvSeg.SetEndPoint(pt1);
|
|
}
|
|
}
|
|
|
|
nInterNum = cvSeg.Intersection(cvRightSeg, pt1, pt2);
|
|
if (nInterNum > 0) //cvseg与cvRightSeg有交点
|
|
{
|
|
if (nInterNum == 2) //如果有两个交点,需要判断哪个交点是需要使用的交点
|
|
{
|
|
TADSGePoint3d ptS = cvRightSeg.StartPoint(), ptE = cvRightSeg.EndPoint();
|
|
double dDist1 = ptS.Distance2d(pt1);
|
|
|
|
if (ptE.Distance2d(pt1) < dDist1) //求ptE,ptS两点中离pt1最近的点
|
|
{
|
|
dDist1 = ptE.Distance2d(pt1);
|
|
}
|
|
|
|
double dDist2 = ptS.Distance2d(pt2);
|
|
if (ptE.Distance2d(pt2) < dDist2)
|
|
{
|
|
dDist2 = ptE.Distance2d(pt2);
|
|
}
|
|
|
|
if (dDist1 > dDist2)
|
|
{
|
|
pt1 = pt2;
|
|
}
|
|
}
|
|
|
|
if (cvSeg.StartPoint().Distance2d(pt1) < cvSeg.EndPoint().Distance(pt1))
|
|
{
|
|
cvSeg.SetStartPoint(pt1);
|
|
}
|
|
else
|
|
{
|
|
cvSeg.SetEndPoint(pt1);
|
|
}
|
|
}
|
|
|
|
//如果要是弧线边,需要处理bulge值
|
|
if (fabs(cvSeg.GetBulge()) > _angSnap)
|
|
{
|
|
//求出cvseg的长度,根据长度换算出cvseg的bulge值
|
|
double dDistance = segTemp.GetLength() - segTemp.PathDistance(cvSeg.EndPoint(), 0) - segTemp.PathDistance(cvSeg.StartPoint());
|
|
cvSeg.SetBulge(segTemp.GetBulge() * dDistance / segTemp.GetLength());
|
|
}
|
|
|
|
}
|
|
|
|
//add by lgy 20120706 该函数功能是对cvSeg进行偏移dOffsetDis,偏移后保证其仍在poly中
|
|
int TDbStruFloorSlab::GetOffsetSegment(TGGeCurveSegment &cvSeg, TGGePoly2D poly, double dOffsetDis) const
|
|
{
|
|
TGGeCurveSegment segTemp = cvSeg;
|
|
TADSGePoint3d ptTemp;
|
|
|
|
segTemp = segTemp.Offset(OFFSET_LEFT, dOffsetDis, LS_INFINITE);
|
|
ptTemp = segTemp.MidPoint();
|
|
int nSide = OFFSET_LEFT;
|
|
if ((ptTemp&poly) != PR_OUTSIDE)
|
|
{
|
|
cvSeg = segTemp;
|
|
}
|
|
else
|
|
{
|
|
cvSeg = cvSeg.Offset(OFFSET_RIGHT, dOffsetDis, LS_INFINITE);
|
|
nSide = OFFSET_RIGHT;
|
|
}
|
|
|
|
return nSide;
|
|
}
|
|
|
|
//add by xlc on 120118
|
|
//设置荷载数组
|
|
bool TDbStruFloorSlab::SetLoadsArray(const std::vector<TStruLoad>& vectLoads)
|
|
{
|
|
assertWriteEnabled();
|
|
ClearLoadsArray();
|
|
return SetAt(KEY_SLAB, vectLoads);
|
|
}
|
|
//获得荷载数组
|
|
bool TDbStruFloorSlab::GetLoadsArray(std::vector<TStruLoad>& vectLoads)const
|
|
{
|
|
assertReadEnabled();
|
|
return GetAt(KEY_SLAB, vectLoads);
|
|
}
|
|
//清除荷载数组
|
|
void TDbStruFloorSlab::ClearLoadsArray()
|
|
{
|
|
assertWriteEnabled();
|
|
RemoveLoadsKey(KEY_SLAB);
|
|
}
|
|
|
|
//add by xlc on 130621
|
|
//设置边界属性数组
|
|
bool TDbStruFloorSlab::SetBoundArray(const std::vector<int>& vectBound)
|
|
{
|
|
assertWriteEnabled();
|
|
ClearBoundArray();
|
|
|
|
int nLength = vectBound.size();
|
|
SetAt(KEY_BOUND, nLength);
|
|
|
|
CString sSubKey;
|
|
for (int i = 0;i < nLength; i++)
|
|
{
|
|
sSubKey.Format(_T("%s%d"), KEY_BOUND, i);
|
|
SetAt(sSubKey, vectBound[i]);
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
bool TDbStruFloorSlab::GetBoundArray(std::vector<int>& vectBound)const
|
|
{
|
|
assertReadEnabled();
|
|
|
|
vectBound.clear();
|
|
int nLength = 0;
|
|
GetAt(KEY_BOUND, nLength);
|
|
|
|
CString sSubKey;
|
|
double dVal = 0;
|
|
int nVal = 0;
|
|
|
|
int i = 0;
|
|
for(; i < nLength; i++)
|
|
{
|
|
sSubKey.Format(_T("%s%d"), KEY_BOUND, i);
|
|
if (GetAt(sSubKey, nVal))
|
|
{
|
|
vectBound.push_back(nVal);
|
|
}
|
|
}
|
|
|
|
return (vectBound.size() > 0);
|
|
}
|
|
void TDbStruFloorSlab::ClearBoundArray()
|
|
{
|
|
assertWriteEnabled();
|
|
|
|
int nLength = 0;
|
|
GetAt(KEY_BOUND, nLength);
|
|
GetSpecialtyData()->RemoveAt(KEY_BOUND);
|
|
|
|
CString sSubKey;
|
|
for (int i = 0;i < nLength; i++)
|
|
{
|
|
sSubKey.Format(_T("%s%d"),KEY_BOUND, i);
|
|
GetSpecialtyData()->RemoveAt(sSubKey);
|
|
}
|
|
}
|
|
|
|
void TDbStruFloorSlab::SetBound(int nIndex, int nVal)
|
|
{
|
|
assertWriteEnabled();
|
|
|
|
int nLength = 0;
|
|
GetAt(KEY_BOUND, nLength);
|
|
if (nIndex < nLength)
|
|
{
|
|
CString sSubKey;
|
|
sSubKey.Format(_T("%s%d"), KEY_BOUND, nIndex);
|
|
SetAt(sSubKey, nVal);
|
|
}
|
|
}
|
|
bool TDbStruFloorSlab::GetBound(int nIndex, int& nVal)const
|
|
{
|
|
assertReadEnabled();
|
|
|
|
nVal = FIXBOUNDARY;
|
|
int nLength = 0;
|
|
GetAt(KEY_BOUND, nLength);
|
|
if (nIndex < nLength)
|
|
{
|
|
CString sSubKey;
|
|
sSubKey.Format(_T("%s%d"), KEY_BOUND, nIndex);
|
|
return GetAt(sSubKey, nVal);
|
|
}
|
|
return false;
|
|
}
|
|
//荷载
|
|
AcDbObjectId TDbStruFloorSlab::GetLayerLoad() const
|
|
{
|
|
return m_idLayerLoad;
|
|
}
|
|
void TDbStruFloorSlab::SetLayerLoad(AcDbObjectId idLayer)
|
|
{
|
|
assertWriteEnabled();
|
|
m_idLayerLoad = idLayer;
|
|
}
|
|
|
|
//活荷值
|
|
AcDbObjectId TDbStruFloorSlab::GetLayerLoadL() const
|
|
{
|
|
return m_idLayerLoadL;
|
|
}
|
|
void TDbStruFloorSlab::SetLayerLoadL(AcDbObjectId idLayer)
|
|
{
|
|
assertWriteEnabled();
|
|
m_idLayerLoadL = idLayer;
|
|
}
|
|
|
|
//恒荷值
|
|
AcDbObjectId TDbStruFloorSlab::GetLayerLoadC() const
|
|
{
|
|
return m_idLayerLoadC;
|
|
}
|
|
void TDbStruFloorSlab::SetLayerLoadC(AcDbObjectId idLayer)
|
|
{
|
|
assertWriteEnabled();
|
|
m_idLayerLoadC = idLayer;
|
|
}
|
|
|
|
//文字样式
|
|
AcDbObjectId TDbStruFloorSlab::GetTextStyle() const
|
|
{
|
|
return m_idTextStyle;
|
|
}
|
|
void TDbStruFloorSlab::SetTextStyle(AcDbObjectId idLayer)
|
|
{
|
|
assertWriteEnabled();
|
|
m_idTextStyle = idLayer;
|
|
}
|
|
|
|
//文字样式
|
|
AcDbObjectId TDbStruFloorSlab::GetTextStyleRB() const
|
|
{
|
|
return m_idTextStyleRB;
|
|
}
|
|
void TDbStruFloorSlab::SetTextStyleRB(AcDbObjectId idLayer)
|
|
{
|
|
assertWriteEnabled();
|
|
m_idTextStyleRB = idLayer;
|
|
}
|
|
|
|
int TDbStruFloorSlab::GetFirstVersion()const
|
|
{
|
|
return 10;
|
|
}
|
|
bool TDbStruFloorSlab::IsModelEntity() const
|
|
{
|
|
return true;
|
|
}
|
|
|
|
|
|
void InitStruFloorSlab(bool bTrue)
|
|
{
|
|
if (bTrue)
|
|
{
|
|
TDbStruFloorSlab::rxInit();
|
|
acrxBuildClassHierarchy();
|
|
TDbStruFloorSlab::InitMatchProtocol(TRUE);
|
|
}
|
|
else
|
|
{
|
|
TDbStruFloorSlab::InitMatchProtocol(FALSE);
|
|
deleteAcRxClass(TDbStruFloorSlab::desc());
|
|
}
|
|
}
|
|
#endif |