407 lines
8.5 KiB
C++
407 lines
8.5 KiB
C++
//------------------------------------------------------------------------+
|
|
// Copyright (C), 1998-2011, Beijing Tangent Software Co. Ltd.
|
|
// = FileName : TDbStruHole类
|
|
// = Version : ver1.0
|
|
// = Author : ywb
|
|
// = CreateDate : 2011-05-07
|
|
// = Description: 结构洞类实现
|
|
// = Maintainers:
|
|
//
|
|
//------------------------------------------------------------------------+
|
|
|
|
#include "StdAfx.h"
|
|
#ifdef TASD
|
|
#include "TDbStruHole.h"
|
|
#include "TAsdKeyDefine.h"
|
|
|
|
|
|
ACRX_NO_CONS_DEFINE_MEMBERS(TDbStruHole, TDbStruEntityBase);
|
|
IMPLEMENT_TENTBASE(TDbStruHole);
|
|
|
|
const Adesk::UInt8 TDbStruHole::g_nVersion = 1;
|
|
|
|
TDbStruHole::TDbStruHole()
|
|
{
|
|
m_polySection.Reset();
|
|
GetSpecialtyData()->Empty();
|
|
}
|
|
|
|
TDbStruHole::~TDbStruHole()
|
|
{
|
|
m_polySection.Reset();
|
|
GetSpecialtyData()->Empty();
|
|
}
|
|
|
|
Acad::ErrorStatus TDbStruHole::dwgInFields( AcDbDwgFiler* pFiler )
|
|
{
|
|
assertWriteEnabled();
|
|
Acad::ErrorStatus es = TDbStruEntityBase::dwgInFields(pFiler);
|
|
if (es != Acad::eOk)
|
|
return es;
|
|
|
|
// 1. 版本号
|
|
Adesk::UInt8 nVer = 1;
|
|
pFiler->readItem(&nVer);
|
|
if (nVer > g_nVersion)
|
|
return Acad::eMakeMeProxy;
|
|
|
|
// 2. 轮廓线
|
|
Adesk::UInt8 nCount = 0;
|
|
pFiler->readItem(&nCount);
|
|
if (nCount > 0)
|
|
{
|
|
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_polySection.Reset();
|
|
for (i = 0; i < nCount; ++i)
|
|
m_polySection.AppendNode(arPt.at(i), arBulge.at(i));
|
|
m_polySection.SetClosed();
|
|
}
|
|
|
|
return pFiler->filerStatus();
|
|
}
|
|
|
|
Acad::ErrorStatus TDbStruHole::dwgOutFields( AcDbDwgFiler* pFiler ) const
|
|
{
|
|
Acad::ErrorStatus es = TDbStruEntityBase::dwgOutFields(pFiler);
|
|
if (es != Acad::eOk)
|
|
return es;
|
|
|
|
pFiler->writeItem(g_nVersion);
|
|
Adesk::UInt8 nCount = m_polySection.Length();
|
|
pFiler->writeItem(nCount);
|
|
if (nCount > 0)
|
|
{
|
|
Adesk::UInt8 i = 0;
|
|
for (i = 0; i < nCount; ++i)
|
|
pFiler->writePoint3d(m_polySection.GetPointListAt(i));
|
|
for (i = 0; i < nCount; ++i)
|
|
pFiler->writeDouble(m_polySection.GetBulge(i));
|
|
}
|
|
|
|
return pFiler->filerStatus();
|
|
}
|
|
|
|
Acad::ErrorStatus TDbStruHole::dxfInFields( AcDbDxfFiler* pFiler )
|
|
{
|
|
assertWriteEnabled();
|
|
|
|
Acad::ErrorStatus es = TDbStruEntityBase::dxfInFields(pFiler);
|
|
if (es != Acad::eOk)
|
|
return es;
|
|
if (!pFiler->atSubclassData(_T("TDbStruHole")))
|
|
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 TDbStruHole::dxfOutFields( AcDbDxfFiler* pFiler ) const
|
|
{
|
|
assertReadEnabled();
|
|
|
|
Acad::ErrorStatus es = TDbStruEntityBase::dxfOutFields(pFiler);
|
|
if (es != Acad::eOk)
|
|
return es;
|
|
|
|
pFiler->writeItem(AcDb::kDxfSubclass, _T("TDbStruHole"));
|
|
pFiler->writeItem(AcDb::kDxfInt8, g_nVersion);
|
|
|
|
return pFiler->filerStatus();
|
|
}
|
|
|
|
Acad::ErrorStatus TDbStruHole::subGetOsnapPoints(AcDb::OsnapMode osnapMode, INT_PTR gsSelectionMark, const AcGePoint3d& pickPoint,
|
|
const AcGePoint3d& lastPoint, const AcGeMatrix3d& viewXform, AcGePoint3dArray& snapPoints,
|
|
AcDbIntArray& geomIds) const
|
|
{
|
|
assertReadEnabled();
|
|
return Acad::eOk;
|
|
}
|
|
|
|
Acad::ErrorStatus TDbStruHole::subTransformBy( const AcGeMatrix3d& xform )
|
|
{
|
|
assertWriteEnabled();
|
|
Acad::ErrorStatus es = Acad::eOk;
|
|
es = TDbStruEntityBase::subTransformBy(xform);
|
|
return es;
|
|
}
|
|
|
|
Acad::ErrorStatus TDbStruHole::subGetTransformedCopy( const AcGeMatrix3d& xform, AcDbEntity*& pEnt ) const
|
|
{
|
|
assertReadEnabled();
|
|
return Acad::eOk;
|
|
}
|
|
|
|
Acad::ErrorStatus TDbStruHole::copyFrom( const AcRxObject* pSrc )
|
|
{
|
|
assertWriteEnabled();
|
|
return Acad::eOk;
|
|
}
|
|
|
|
Acad::ErrorStatus TDbStruHole::subGetGripPoints( AcGePoint3dArray& gripPoints, AcDbIntArray& osnapModes, AcDbIntArray& geomIds ) const
|
|
{
|
|
return Acad::eOk;
|
|
}
|
|
|
|
Acad::ErrorStatus TDbStruHole::subGetStretchPoints( AcGePoint3dArray& stretchPoints ) const
|
|
{
|
|
return Acad::eOk;
|
|
}
|
|
|
|
Acad::ErrorStatus TDbStruHole::subMoveGripPointsAt( const AcDbIntArray& indices, const AcGeVector3d& offset )
|
|
{
|
|
return Acad::eOk;
|
|
}
|
|
|
|
Acad::ErrorStatus TDbStruHole::subMoveStretchPointsAt( const AcDbIntArray& indices, const AcGeVector3d& offset )
|
|
{
|
|
return Acad::eOk;
|
|
}
|
|
|
|
Acad::ErrorStatus TDbStruHole::subGetClassID( CLSID* pClsid ) const
|
|
{
|
|
assertReadEnabled();
|
|
|
|
return Acad::eOk;
|
|
}
|
|
|
|
Acad::ErrorStatus TDbStruHole::subWblockClone( AcRxObject* pOwner, AcDbObject*& pClonedObject, AcDbIdMapping& idMap, Adesk::Boolean isPrimary ) const
|
|
{
|
|
Acad::ErrorStatus es = TDbStruEntityBase::subWblockClone(pOwner, pClonedObject, idMap, isPrimary);
|
|
if (es != Acad::eOk)
|
|
return es;
|
|
|
|
return Acad::eOk;
|
|
}
|
|
|
|
Acad::ErrorStatus TDbStruHole::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;
|
|
|
|
assertReadEnabled();
|
|
|
|
return Acad::eOk;
|
|
}
|
|
|
|
Acad::ErrorStatus TDbStruHole::GetGripText( int i, CString &cs ) const
|
|
{
|
|
assertReadEnabled();
|
|
|
|
return Acad::eOk;
|
|
}
|
|
|
|
Acad::ErrorStatus TDbStruHole::ExplodeOrDraw3d( TGGiExplodeDrawBase &dc ) const
|
|
{
|
|
return Acad::eOk;
|
|
}
|
|
|
|
Acad::ErrorStatus TDbStruHole::ExplodeOrDraw2d( TGGiExplodeDrawBase &dc ) const
|
|
{
|
|
return Acad::eOk;
|
|
}
|
|
|
|
Acad::ErrorStatus TDbStruHole::GetExtents2d( TADSGePoint3d &ptLow, TADSGePoint3d &ptUp ) const
|
|
{
|
|
assertReadEnabled();
|
|
return Acad::eOk;
|
|
}
|
|
|
|
Acad::ErrorStatus TDbStruHole::GetExtents( TADSGePoint3d &ptLow, TADSGePoint3d &ptUp ) const
|
|
{
|
|
assertReadEnabled();
|
|
return Acad::eOk;
|
|
}
|
|
|
|
bool TDbStruHole::UnifyElevation( double dElevation )
|
|
{
|
|
return true;
|
|
}
|
|
|
|
void TDbStruHole::GetTips( TDPtrList<TObjInfoUnit> & ) const
|
|
{
|
|
assertReadEnabled();
|
|
|
|
}
|
|
|
|
const TCHAR * TDbStruHole::GetDefaultLayer() const
|
|
{
|
|
return NULL;
|
|
}
|
|
|
|
BOOL TDbStruHole::IsValid() const
|
|
{
|
|
assertReadEnabled();
|
|
return TRUE;
|
|
}
|
|
|
|
void TDbStruHole::CopyPropertiesFrom( AcDbEntity *pSrcEntity, unsigned gMatchFlag )
|
|
{
|
|
assertWriteEnabled();
|
|
|
|
TDbStruEntityBase::CopyPropertiesFrom(pSrcEntity, gMatchFlag);
|
|
}
|
|
|
|
bool TDbStruHole::GetStandardFaceBody( AcDbVoidPtrArray& arFacePtrs ) const
|
|
{
|
|
assertReadEnabled();
|
|
|
|
return true;
|
|
}
|
|
|
|
bool TDbStruHole::GetSafeProtectedSpace( AcDbVoidPtrArray& arFacePtrs ) const
|
|
{
|
|
assertReadEnabled();
|
|
|
|
return true;
|
|
}
|
|
|
|
bool TDbStruHole::GetSection( const AcDbFace &face, const AcGeVector3d& vtPlaneSecDir,
|
|
std::vector<TObjSectionRecord> §ionRecords, AcDbVoidPtrArray& arFillPtrs ) const
|
|
{
|
|
return false;
|
|
}
|
|
|
|
CString TDbStruHole::GetXml(const AcGeMatrix3d& mat) const
|
|
{
|
|
return _T("");
|
|
}
|
|
|
|
void TDbStruHole::PostAssocMsg( TAssocMsg assocMsg ) const
|
|
{
|
|
|
|
}
|
|
|
|
void TDbStruHole::ReceiveAssocMsg( TAssocMsg assocMsg )
|
|
{
|
|
|
|
}
|
|
|
|
void TDbStruHole::MakeAssocRelation( AcDbObject& ids )
|
|
{
|
|
|
|
}
|
|
|
|
void TDbStruHole::MakeAssocRelation(AcDbObjectIdArray& ids)
|
|
{
|
|
|
|
}
|
|
|
|
// 不验证关系,直接建立关联关系
|
|
void TDbStruHole::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_WALL")) //墙
|
|
||ent.Is(_T("ATS_STRU_FLOORSLAB"))) // 板
|
|
{
|
|
SetAt(KEY_ASSOC, idObj);
|
|
}
|
|
}
|
|
}
|
|
void TDbStruHole::RemoveAssocRelation( AcDbObjectId& id )
|
|
{
|
|
|
|
}
|
|
|
|
void TDbStruHole::GetAssocRelation( AcDbObjectId& idAssoc ) const
|
|
{
|
|
|
|
}
|
|
|
|
void TDbStruHole::GetAssocRelation(int nType, AcDbObjectIdArray& idAssoc) const
|
|
{
|
|
|
|
}
|
|
|
|
// x--宽度, y--宽度, z--转角
|
|
TADSGePoint3d TDbStruHole::GetParameters() const
|
|
{
|
|
return TADSGePoint3d();
|
|
}
|
|
// 洞截面轮廓
|
|
void TDbStruHole::GetOutline(TGGePoly2D &poly) const //ok
|
|
{
|
|
|
|
}
|
|
const TGGePoly2D& TDbStruHole::GetOutlinePoly() const //ok
|
|
{
|
|
return m_polySection;
|
|
}
|
|
void TDbStruHole::SetOutlinePoly(const TGGePoly2D &poly) //ok
|
|
{
|
|
|
|
}
|
|
|
|
// 底标高
|
|
double TDbStruHole::GetBottomElev() const //ok
|
|
{
|
|
return 0.0;
|
|
}
|
|
|
|
void TDbStruHole::SetBottomElev(double dElev) //ok
|
|
{
|
|
|
|
}
|
|
int TDbStruHole::GetFirstVersion()const
|
|
{
|
|
return 10;
|
|
}
|
|
bool TDbStruHole::IsModelEntity() const
|
|
{
|
|
return true;
|
|
}
|
|
|
|
void InitDbStruHole(bool bTrue)
|
|
{
|
|
if (bTrue)
|
|
{
|
|
TDbStruHole::rxInit();
|
|
}
|
|
else
|
|
{
|
|
deleteAcRxClass(TDbStruHole::desc());
|
|
}
|
|
}
|
|
#endif |