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

1766 lines
42 KiB
C++

#include "StdAfx.h"
#include "StdArx.h"
#include "TDbImpPipeBase.h"
#include "TDbFittingCreatorService.h"
#include "TDbExtentsEdge.h"
#include "TCoverBooleanOper.h"
#include "TDbInterfaceMsgWrite.h"
#include "TGripImp.h"
#include "dbproxy.h"
#include "geassign.h"
#include "acgi.h"
#include "math.h"
// #define VERSION_TDbPipeBase 1
#define VERSION_TDbPipeBase 2 // change by hh 2013-9-2 TXDataMap改在底层中进行读写 暖通图纸版本升级到2
TDb::GripAppData TDbPipeBase::s_gripAppData[GRIP_MAXNUM];
//{{AFX_ARX_MACRO
ACRX_DXF_DEFINE_MEMBERS( TDbPipeBase, TDbInterfacesObj,
AcDb::kDHL_CURRENT, AcDb::kMReleaseCurrent,
AcDbProxyEntity::kAllAllowedBits,
ATS_PIPEBASE, "图形无法解析, 请下载上华软件|网址: www.shanghuasoft.com");
//}}AFX_ARX_MACRO
IMPLEMENT_TENTBASE(TDbPipeBase);
TDbPipeBase::TDbPipeBase()
{
//{{AFX_ARX_DATA_INIT(TDbPipeBase)
//}}AFX_ARX_DATA_INIT
m_pImpPipeBase = NULL;
m_XDataMap.SetAt(KEY_DXF,_T("ATS_PIPEBASE"));
}
TDbPipeBase::~TDbPipeBase()
{
}
void TDbPipeBase::SetStartPoint(const AcGePoint3d& ptSta)
{
assertWriteEnabled();
ASSERT(m_pImpPipeBase != NULL);
AcGePoint3d ptOld = m_pImpPipeBase->StartPoint();
m_pImpPipeBase->SetStartPoint(ptSta);
if (!objectId().isNull())
{
UpdateCoverDisplay();
}
recordGraphicsModified();
}
AcGePoint3d TDbPipeBase::StartPoint() const
{
assertReadEnabled();
ASSERT(m_pImpPipeBase != NULL);
return m_pImpPipeBase->StartPoint();
}
void TDbPipeBase::SetEndPoint(const AcGePoint3d& ptEnd)
{
assertWriteEnabled();
ASSERT(m_pImpPipeBase != NULL);
AcGePoint3d ptOld = m_pImpPipeBase->EndPoint();
m_pImpPipeBase->SetEndPoint(ptEnd);
if (!objectId().isNull())
{
UpdateCoverDisplay();
}
recordGraphicsModified();
}
AcGePoint3d TDbPipeBase::EndPoint() const
{
assertReadEnabled();
ASSERT(m_pImpPipeBase != NULL);
return m_pImpPipeBase->EndPoint();
}
BOOL TDbPipeBase::GetInterface(int nIndex,TInterface& pipeInterface) const
{
assertReadEnabled();
ASSERT(m_pImpPipeBase != NULL);
return m_pImpPipeBase->GetInterface(nIndex,pipeInterface);
}
BOOL TDbPipeBase::GetInterface(const AcGePoint3d& ptCon,TInterface& pipeInterface) const
{
assertReadEnabled();
ASSERT(m_pImpPipeBase != NULL);
return m_pImpPipeBase->GetInterface(ptCon,pipeInterface);
}
BOOL TDbPipeBase::HasInterface(const AcGePoint3d& ptCon,const AcGeVector3d& vtDir)
{
assertReadEnabled();
ASSERT(m_pImpPipeBase != NULL);
return m_pImpPipeBase->HasInterface(ptCon,vtDir);
}
int TDbPipeBase::GetInterfaceCount() const
{
assertReadEnabled();
ASSERT(m_pImpPipeBase != NULL);
return m_pImpPipeBase->GetInterfaceCount();
}
BOOL TDbPipeBase::SetInterfaceRelation(const AcGePoint3d& ptConnect,const AcDbObjectId& idConnect)
{
assertWriteEnabled();
ASSERT(m_pImpPipeBase != NULL);
return m_pImpPipeBase->SetInterfaceRelation(ptConnect,idConnect);
}
BOOL TDbPipeBase::RemoveInterfaceRelation(const AcGePoint3d& ptConnect,const AcDbObjectId& idConnect)
{
assertWriteEnabled();
ASSERT(m_pImpPipeBase != NULL);
return m_pImpPipeBase->RemoveInterfaceRelation(ptConnect,idConnect);
}
BOOL TDbPipeBase::NotifyInterfaceToModify(const TInterfaceModifyMsg& iModiMsg,TInterfaceModifyMsgs& iModiMsgs)
{
assertWriteEnabled();
ASSERT(m_pImpPipeBase != NULL);
return m_pImpPipeBase->NotifyInterfaceToModify(iModiMsg,iModiMsgs);
}
// TDbXDataMap* TDbPipeBase::GetSpecialtyData()
// {
// if (isWriteEnabled())
// {
// assertWriteEnabled();
// }
// else
// {
// assertReadEnabled();
// }
// return &m_XDataMap;
// }
//
// TDbXDataMap* TDbPipeBase::GetSpecialtyDataReadOnly() const
// {
// assertReadEnabled();
// return (TDbXDataMap*)&m_XDataMap;
// }
Acad::ErrorStatus TDbPipeBase::setNormal(const AcGeVector3d& vtNorm)
{
assertWriteEnabled();
ASSERT(m_pImpPipeBase != NULL);
return m_pImpPipeBase->setNormal(vtNorm);
}
void TDbPipeBase::GetKindName(CString& sName)
{
assertReadEnabled();
m_XDataMap.GetAt(KEY_DXF,sName);
}
BOOL TDbPipeBase::MakeCurves(TComplexCurve& cplCurve) const
{
assertReadEnabled();
if (m_pImpPipeBase != NULL)
{
return m_pImpPipeBase->MakeCurves(cplCurve);
}
return FALSE;
}
BOOL TDbPipeBase::GetCurvesInSide(TComplexCurve& compCurve) const
{
assertReadEnabled();
if (m_pImpPipeBase != NULL)
{
return m_pImpPipeBase->GetCurvesInSide(compCurve);
}
return FALSE;
}
BOOL TDbPipeBase::MakePolyCurveFaces(AcDbVoidPtrArray& arFaces)
{
if (m_pImpPipeBase != NULL)
{
return m_pImpPipeBase->MakePolyCurveFaces(arFaces);
}
return FALSE;
}
AcDbPolyline* TDbPipeBase::MakePolyCurve() const
{
assertReadEnabled();
if (m_pImpPipeBase != NULL)
{
return m_pImpPipeBase->MakePolyCurve();
}
return NULL;
}
BOOL TDbPipeBase::AddCoverEdge(AcDbObjectId& id,TComplexCurve& curEdge)
{
assertWriteEnabled();
TDbExtentsEdge edage;
edage.SetOwnerId(id);
edage.SetEdage(curEdge);
m_arDbExtEdgs.Add(edage);
return TRUE;
}
BOOL TDbPipeBase::AddIdsCoverByMe(AcDbObjectId& id)
{
assertWriteEnabled();
int nFoundAt = -1;
if (!m_arIdCoverByMe.find(id,nFoundAt))
{
m_arIdCoverByMe.append(id);
}
return TRUE;
}
BOOL TDbPipeBase::GetIdsCoverByMe(AcDbObjectIdArray& arByMeIds)
{
assertReadEnabled();
arByMeIds.append(m_arIdCoverByMe);
for (int j = 0; j < m_lstClippedId.Length(); j++)
{
arByMeIds.append(*m_lstClippedId[j]);
}
return TRUE;
}
BOOL TDbPipeBase::RemoveCoverEdge(AcDbObjectId& id)
{
assertWriteEnabled();
if (id.isNull())
{
m_arDbExtEdgs.RemoveAll();
return TRUE;
}
// 加入的时候已经排序了;
for (int i = 0;i < m_arDbExtEdgs.GetCount();i++)
{
if (m_arDbExtEdgs.GetAt(i).GetOwnerId() == id)
{
m_arDbExtEdgs.RemoveAt(i);
break;
}
}
return TRUE;
}
BOOL TDbPipeBase::GetCoverEdgeIds(AcDbObjectIdArray& arIds)
{
assertReadEnabled();
for (int i = 0;i < m_arDbExtEdgs.GetCount();i++)
{
arIds.append(m_arDbExtEdgs.GetAt(i).GetOwnerId());
}
for (int j = 0; j < m_lstClipId.Length(); j++)
{
arIds.append(*m_lstClipId[j]);
}
return arIds.length() > 0;
}
BOOL TDbPipeBase::GetGeomExtentsEdge(TComplexCurve& crLoop)
{
assertReadEnabled();
if (m_pImpPipeBase != NULL)
{
AcDbPolyline* pPl = MakePolyCurve();
if (pPl != NULL)
{
double dBulge = 0.0;
TDb::TCurveElement curel;
memset(&curel,0,sizeof(TDb::TCurveElement));
int nVerts = pPl->numVerts();
for (int i = 0;i < nVerts - 1;i++)
{
pPl->getPointAt(i,curel.ptGe[0]);
dBulge = 0.0;
pPl->getBulgeAt(i,dBulge);
if (fabs(dBulge) < 1.e-10) // 直线
{
pPl->getPointAt(i + 1,curel.ptGe[1]);
curel.ptGe[2] = curel.ptGe[1];
crLoop.append(curel);
}
else //圆弧
{
double dPar1 = 0.0,dPar2 = 0.0;
pPl->getParamAtPoint(curel.ptGe[0],dPar1);
pPl->getPointAt(i + 1,curel.ptGe[2]);
AcGeCircArc3d geArc;
pPl->getArcSegAt(i,geArc);
curel.ptGe[0] = geArc.startPoint();
curel.ptGe[2] = geArc.endPoint();
dPar1 = geArc.paramOf(curel.ptGe[0]);
dPar2 = geArc.paramOf(curel.ptGe[2]);
curel.ptGe[1] = geArc.evalPoint((dPar2 + dPar1) / 2.0);
crLoop.append(curel);
}
}
if (pPl->isClosed())
{
//最后一段
memset(&curel,0,sizeof(TDb::TCurveElement));
pPl->getPointAt(nVerts - 1,curel.ptGe[0]);
double dBulge = 0.0;
pPl->getBulgeAt(nVerts - 1,dBulge);
if (fabs(dBulge) > 1.e-6) //ARC
{
double dEndPa = 0.0;
pPl->getEndParam(dEndPa);
dEndPa -= 0.2;
pPl->getPointAtParam(dEndPa,curel.ptGe[1]);
pPl->getPointAt(0,curel.ptGe[2]);
}
else
{
pPl->getPointAt(0,curel.ptGe[1]);
curel.ptGe[2] = curel.ptGe[1];
}
//if (curel.ptGe[0].distanceTo(curel.ptGe[1]) > AcGeContext::gTol.equalPoint())
if (curel.ptGe[0].distanceTo(curel.ptGe[1]) > g_globalTol.equalPoint()) // modify by cq TFS8208
{
crLoop.append(curel);
}
}
delete pPl;
}
}
return crLoop.length() > 0;
}
AcGeVector3d TDbPipeBase::normal() const
{
assertReadEnabled();
ASSERT(m_pImpPipeBase != NULL);
return m_pImpPipeBase->normal();
}
Acad::ErrorStatus TDbPipeBase::copyFrom(const AcRxObject* pSrc)
{
assertWriteEnabled();
if (pSrc != NULL)
{
TDbInterfacesObj::copyFrom(pSrc);
TDbPipeBase* pPipe = TDbPipeBase::cast(pSrc);
if (pPipe != NULL)
{
m_XDataMap.CopyFrom(&pPipe->m_XDataMap);
if (pPipe->database() != NULL)
setDatabaseDefaults(pPipe->database());
m_arDbExtEdgs.RemoveAll();
m_arDbExtEdgs.Add(pPipe->m_arDbExtEdgs);
m_arIdCoverByMe.setLogicalLength(0);
m_arIdCoverByMe.append(pPipe->m_arIdCoverByMe);
if (cloneMeForDragging())
m_XDataMap.SetAt(KEY_THISID,pPipe->objectId());
}
ReCreateByXDataMap();
}
return Acad::eOk;
}
Acad::ErrorStatus TDbPipeBase::subHandOverTo(AcDbObject* newObject)
{
assertWriteEnabled();
TDbPipeBase* pNewObj = TDbPipeBase::cast(newObject);
if (pNewObj != NULL)
{
AcGePoint3d ptSta = StartPoint();
AcGePoint3d ptEnd = EndPoint();
AcGePoint3d ptStaNew = pNewObj->StartPoint();
AcGePoint3d ptEndNew = pNewObj->EndPoint();
UpdateInterfaceRec(ptSta,ptStaNew);
UpdateInterfaceRec(ptEnd,ptEndNew);
}
return AcDbObject::subHandOverTo(newObject);
}
Acad::ErrorStatus TDbPipeBase::getPlane(AcGePlane& plan,AcDb::Planarity& planvt) const
{
AcGeVector3d vt = normal();
AcGeVector3d vtDir = EndPoint() - StartPoint();
AcGeLine3d line(AcGePoint3d::kOrigin,vtDir);
planvt = AcDb::kPlanar;
if ( AcGePlane::kXYPlane.isParallelTo(line) )
{
plan.set(TAuxTools::Mid(StartPoint(),EndPoint()) ,vt);
}
else
{
plan.set(EndPoint(),AcGePoint3d::kOrigin,StartPoint());
}
return Acad::eOk;
}
Acad::ErrorStatus TDbPipeBase::subDeepClone(AcDbObject* pOwnerObject,
AcDbObject*& pClonedObject,
AcDbIdMapping& idMap,
Adesk::Boolean isPrimary) const
{
assertReadEnabled();
Acad::ErrorStatus es = TDbInterfacesObj::subDeepClone(pOwnerObject, pClonedObject, idMap, isPrimary);
if (pClonedObject != NULL)
{
TDbPipeBase* pPipeBase = TDbPipeBase::cast(pClonedObject);
if (pPipeBase != NULL)
{
pPipeBase->GetSpecialtyData()->SetAt(KEY_DEEPCLONEFLAG,1);
}
}
if (pClonedObject != NULL)
{
TDbPipeBase* pBase = TDbPipeBase::cast(pClonedObject);
if (pBase != NULL)
{
TDbXDataMap* pMapClone = NULL;
const TDbXDataMap* pMapThis = &m_XDataMap;
if ( pBase != NULL)
{
pMapClone = &pBase->m_XDataMap;
}
if ( pMapThis != NULL)
{
pMapThis->BeginCloneXlation(pMapClone,idMap);
}
}
}
return es;
}
Acad::ErrorStatus TDbPipeBase::subWblockClone( AcRxObject* pOwnerObject,
AcDbObject*& pClonedObject,
AcDbIdMapping& idMap,
Adesk::Boolean isPrimary) const
{
assertReadEnabled();
Acad::ErrorStatus es = TDbInterfacesObj::subWblockClone(pOwnerObject, pClonedObject, idMap, isPrimary);
if (pClonedObject != NULL)
{
TDbPipeBase* pBase = TDbPipeBase::cast(pClonedObject);
if (pBase != NULL)
{
TDbXDataMap* pMapClone = NULL;
const TDbXDataMap* pMapThis = &m_XDataMap;
if ( pBase != NULL)
{
pMapClone = &pBase->m_XDataMap;
}
if ( pMapThis != NULL)
{
pMapThis->BeginCloneXlation(pMapClone,idMap);
}
}
}
return Acad::eOk;
}
Acad::ErrorStatus TDbPipeBase::dwgInFields(AcDbDwgFiler* pFiler)
{
assertWriteEnabled();
Acad::ErrorStatus es;
// Call dwgInFields from TDbInterfacesObj
if ((es = TDbInterfacesObj::dwgInFields(pFiler)) != Acad::eOk)
{
return es;
}
Adesk::UInt16 version;
pFiler->readItem(&version);
if (version > VERSION_TDbPipeBase)
return Acad::eMakeMeProxy;
AcDbSoftPointerId idSoft;
#if ADS > 20
int lLen = 0l;
#else
long lLen = 0l;
#endif
m_arDbExtEdgs.RemoveAll();
m_arIdCoverByMe.setLogicalLength(0);
TDbExtentsEdge edage;
int i = 0;
// change by hh 2013-9-2 TXDataMap 在基类中进行读取
/* switch (version)
{
case (1):
{
m_XDataMap.dwgInFields(pFiler);
m_XDataMap.SetAt(KEY_THISID,objectId());
pFiler->readInt32(&lLen);
for (i = 0;i < lLen;i++)
{
edage.dwgInFields(pFiler);
m_arDbExtEdgs.Add(edage);
}
pFiler->readInt32(&lLen);
for (i = 0;i < lLen;i++)
{
pFiler->readSoftPointerId(&idSoft);
m_arIdCoverByMe.append(idSoft);
}
ReCreateByXDataMap();
break;
}
default:
break;
}*/
// 版本2之前的图纸 需读取XDataMap
if(2 > version)
{
m_XDataMap.dwgInFields(pFiler);
m_XDataMap.SetAt(KEY_THISID,objectId());
}
pFiler->readInt32(&lLen);
for (i = 0;i < lLen;i++)
{
edage.dwgInFields(pFiler);
m_arDbExtEdgs.Add(edage);
}
pFiler->readInt32(&lLen);
for (i = 0;i < lLen;i++)
{
pFiler->readSoftPointerId(&idSoft);
m_arIdCoverByMe.append(idSoft);
}
ReCreateByXDataMap();
return pFiler->filerStatus();
}
BOOL TDbPipeBase::ReCreateByXDataMap()
{
assertWriteEnabled();
CString sService;
m_XDataMap.GetAt(KEY_FITSRV,sService);
TDbFittingCreatorService* pFitCreatorService = NULL;
pFitCreatorService = (TDbFittingCreatorService*)acrxServiceDictionary->at(sService);
if (pFitCreatorService != NULL)
{
TDbImpPipeBase* pNewPipe = NULL;
pNewPipe = pFitCreatorService->CreateSpecialPipe(&m_XDataMap,this);
if (pNewPipe != NULL)
{
if (m_pImpPipeBase != NULL)
m_pImpPipeBase->Destroy();
m_pImpPipeBase = pNewPipe;
return TRUE;
}
}
return FALSE;
}
void TDbPipeBase::UpdateNormal(const AcGePoint3d& ptOld,const AcGePoint3d& ptNew)
{
assertWriteEnabled();
if (m_pImpPipeBase != NULL)
{
m_pImpPipeBase->UpdateNormal(ptOld,ptNew);
}
}
Acad::ErrorStatus TDbPipeBase::dwgOutFields(AcDbDwgFiler* pFiler) const
{
assertReadEnabled();
Acad::ErrorStatus es;
// Call dwgOutFields from TDbInterfacesObj
if ((es = TDbInterfacesObj::dwgOutFields(pFiler)) != Acad::eOk)
{
return es;
}
// change by hh 2013-9-2 TXDataMap改在底层中进行读写
// pFiler->writeItem((Adesk::UInt16) VERSION_TDbPipeBase);
// m_XDataMap.dwgOutFields(pFiler);
// 另存为9版以下的图纸时 TXDataMap仍需自行写入
if (g_nSaveTArchVer <= 9)
{
// 版本号置为1
pFiler->writeItem((Adesk::UInt16)1);
m_XDataMap.dwgOutFields(pFiler);
}
else
{
pFiler->writeItem((Adesk::UInt16) VERSION_TDbPipeBase);
}
// 边界存储
long lLen = m_arDbExtEdgs.GetCount();
pFiler->writeInt32(lLen);
for (int i = 0;i < lLen;i++)
{
m_arDbExtEdgs.GetAt(i).dwgOutFields(pFiler);
}
lLen = m_arIdCoverByMe.length();
pFiler->writeInt32(lLen);
for (i = 0;i < lLen;i++)
{
pFiler->writeSoftPointerId(AcDbSoftPointerId(m_arIdCoverByMe.at(i)));
}
return pFiler->filerStatus();
}
Acad::ErrorStatus TDbPipeBase::dxfInFields(AcDbDxfFiler* pFiler)
{
assertWriteEnabled();
struct resbuf rb;
if ((TDbInterfacesObj::dxfInFields(pFiler) != Acad::eOk) ||
!pFiler->atSubclassData(_T("TDbPipeBase")))
return pFiler->filerStatus();
// Read version number.
pFiler->readItem(&rb);
if (rb.restype != AcDb::kDxfInt16)
{
pFiler->pushBackItem();
pFiler->setError(Acad::eInvalidDxfCode,
_T("Error: expected object version group code %d"),
AcDb::kDxfInt16);
return pFiler->filerStatus();
}
else
{
Adesk::UInt16 version = rb.resval.rint;
if (version > VERSION_TDbPipeBase)
return Acad::eMakeMeProxy;
}
return pFiler->filerStatus();
}
Acad::ErrorStatus TDbPipeBase::dxfOutFields(AcDbDxfFiler* pFiler) const
{
assertReadEnabled();
Acad::ErrorStatus es;
if ((es = TDbInterfacesObj::dxfOutFields(pFiler)) != Acad::eOk)
return es;
// Write subclass marker.
pFiler->writeItem(AcDb::kDxfSubclass, _T("TDbPipeBase"));
// Write version number.
pFiler->writeItem(AcDb::kDxfInt16, (Adesk::UInt16) VERSION_TDbPipeBase);
return es;
}
Acad::ErrorStatus TDbPipeBase::extend(Adesk::Boolean extendStart,
const AcGePoint3d& toPoint)
{
assertWriteEnabled();
Acad::ErrorStatus eSta = Acad::eOk;
if (m_pImpPipeBase != NULL)
{
eSta = m_pImpPipeBase->extend(extendStart,toPoint);
}
return eSta;
}
Acad::ErrorStatus TDbPipeBase::extend(double newParam)
{
assertWriteEnabled();
Acad::ErrorStatus eSta = Acad::eOk;
if (m_pImpPipeBase != NULL)
{
eSta = m_pImpPipeBase->extend(newParam);
}
return eSta;
}
Acad::ErrorStatus TDbPipeBase::getArea(double& x0) const
{
assertReadEnabled();
Acad::ErrorStatus eSta = Acad::eOk;
if (m_pImpPipeBase != NULL)
{
eSta = m_pImpPipeBase->getArea(x0);
}
return eSta;
}
Acad::ErrorStatus TDbPipeBase::subGetClassID(CLSID* pClsid) const
{
assertReadEnabled();
Acad::ErrorStatus eSta = Acad::eOk;
if (m_pImpPipeBase != NULL)
{
eSta = m_pImpPipeBase->getClassID(pClsid);
}
return eSta;
return Acad::eOk;
}
Acad::ErrorStatus TDbPipeBase::getClosestPointTo(const AcGePoint3d& givenPnt,
AcGePoint3d& pointOnCurve,
Adesk::Boolean extend) const
{
assertReadEnabled();
Acad::ErrorStatus eSta = Acad::eOk;
if (m_pImpPipeBase != NULL)
{
eSta = m_pImpPipeBase->getClosestPointTo(givenPnt,pointOnCurve,extend);
}
return eSta;
}
Acad::ErrorStatus TDbPipeBase::getClosestPointTo(const AcGePoint3d& givenPnt,
const AcGeVector3d& direction,
AcGePoint3d& pointOnCurve,
Adesk::Boolean extend) const
{
assertReadEnabled();
Acad::ErrorStatus eSta = Acad::eOk;
if (m_pImpPipeBase != NULL)
{
eSta = m_pImpPipeBase->getClosestPointTo(givenPnt,direction,pointOnCurve,extend);
}
return eSta;
}
Acad::ErrorStatus TDbPipeBase::getDistAtPoint(const AcGePoint3d& x0,
double& x1)const
{
assertReadEnabled();
Acad::ErrorStatus eSta = Acad::eOk;
if (m_pImpPipeBase != NULL)
{
eSta = m_pImpPipeBase->getDistAtPoint(x0,x1);
}
return eSta;
}
Acad::ErrorStatus TDbPipeBase::getDistAtParam( double param, double& dist ) const
{
assertReadEnabled();
Acad::ErrorStatus eSta = Acad::eOk;
if (m_pImpPipeBase != NULL)
{
eSta = m_pImpPipeBase->getDistAtParam(param, dist);
}
return eSta;
}
Acad::ErrorStatus TDbPipeBase::getEndParam(double& x0) const
{
assertReadEnabled();
Acad::ErrorStatus eSta = Acad::eOk;
if (m_pImpPipeBase != NULL)
{
eSta = m_pImpPipeBase->getEndParam(x0);
}
return eSta;
}
Acad::ErrorStatus TDbPipeBase::getEndPoint(AcGePoint3d& x0) const
{
assertReadEnabled();
Acad::ErrorStatus eSta = Acad::eOk;
if (m_pImpPipeBase != NULL)
{
eSta = m_pImpPipeBase->getEndPoint(x0);
}
return eSta;
}
Acad::ErrorStatus TDbPipeBase::getFirstDeriv(const AcGePoint3d& x0,
AcGeVector3d& firstDeriv) const
{
assertReadEnabled();
Acad::ErrorStatus eSta = Acad::eOk;
if (m_pImpPipeBase != NULL)
{
eSta = m_pImpPipeBase->getFirstDeriv(x0,firstDeriv);
}
return eSta;
}
Acad::ErrorStatus TDbPipeBase::getFirstDeriv(double param,
AcGeVector3d& firstDeriv) const
{
assertReadEnabled();
Acad::ErrorStatus eSta = Acad::eOk;
if (m_pImpPipeBase != NULL)
{
eSta = m_pImpPipeBase->getFirstDeriv(param,firstDeriv);
}
return eSta;
}
Acad::ErrorStatus TDbPipeBase::subGetGeomExtents(AcDbExtents& extents) const
{
assertReadEnabled();
Acad::ErrorStatus eSta = Acad::eOk;
if (m_pImpPipeBase != NULL)
{
eSta = m_pImpPipeBase->getGeomExtents(extents);
}
return eSta;
}
Acad::ErrorStatus TDbPipeBase::subMoveStretchPointsAt(const AcDbIntArray& indices,
const AcGeVector3d& offset)
{
assertWriteEnabled();
Acad::ErrorStatus eSta = Acad::eOk;
if (m_pImpPipeBase != NULL)
{
// mcl add.2010.11.09 忽略z标高差
AcGeVector3d vtOffset = offset;
if(TAuxTools::Is2DView())
vtOffset = offset.orthoProject(TAuxTools::GetUcsZvt());
eSta = m_pImpPipeBase->moveStretchPointsAt(indices, vtOffset);
}
return eSta;
}
Acad::ErrorStatus TDbPipeBase::subGetStretchPoints(AcGePoint3dArray& stretchPoints) const
{
Acad::ErrorStatus eSta = Acad::eOk;
if (m_pImpPipeBase != NULL)
{
eSta = m_pImpPipeBase->getStretchPoints(stretchPoints);
}
return eSta;
}
#if ADS>15
Acad::ErrorStatus TDbPipeBase::subGetGripPoints(AcDbGripDataPtrArray& grips,
const double viewSize,
const int gripSize,
const AcGeVector3d& curViewDir,
const int bitflags) const
{
assertReadEnabled();
if (m_pImpPipeBase != NULL)
{
AcDbIntArray osnapModes;
AcDbIntArray geomIds;
AcGePoint3dArray gripPoints;
Acad::ErrorStatus eSta = m_pImpPipeBase->getGripPoints(gripPoints,osnapModes,geomIds);
AcDbGripData* pGripData = NULL;
TDb::Position ePos;
CString sCmd = _T("");
GetGlobalContext(KEY_CABGRIPCMD,sCmd);
for (int i = 0;i < GRIP_MAXNUM && i < gripPoints.length();i++)
{
ePos = m_pImpPipeBase->ExplainGripIndex(i);
if (ePos >= TDb::eCommand0 && ePos <= TDb::eCommand3)
{
pGripData = new AcDbGripData;
memset(&s_gripAppData[i],0,sizeof(TDb::GripAppData));
s_gripAppData[i].nIndex = i;
s_gripAppData[i].ePos = ePos;
s_gripAppData[i].ptGrip = gripPoints.at(i);
_tcscpy(s_gripAppData[i].szTip,sCmd);
s_gripAppData[i].pOwner = (AcDbEntity*)this;
pGripData->setGripPoint(gripPoints.at(i));
pGripData->setAppData((void*)&s_gripAppData[i]);
pGripData->setWorldDraw(GripCback::WorldDrawfunc);
pGripData->setToolTipFunc(GripCback::GripToolTipFunc);
}
else
{
pGripData = new AcDbGripData;
memset(&s_gripAppData[i],0,sizeof(TDb::GripAppData));
s_gripAppData[i].nIndex = i;
s_gripAppData[i].ePos = ePos;
s_gripAppData[i].ptGrip = gripPoints.at(i);
_tcscpy(s_gripAppData[i].szTip,_T("拉伸夹点"));
s_gripAppData[i].pOwner = (AcDbEntity*)this;
pGripData->setGripPoint(gripPoints.at(i));
pGripData->setAppData((void*)&s_gripAppData[i]);
pGripData->setToolTipFunc(GripCback::GripToolTipFunc);
}
grips.append(pGripData);
}
return eSta;
}
return Acad::eOk;
}
Acad::ErrorStatus TDbPipeBase::subMoveGripPointsAt(const AcDbVoidPtrArray& gripAppData,
const AcGeVector3d& offset,
const int bitflags)
{
assertWriteEnabled();
TDb::GripAppData* pAppData = NULL;
AcDbIntArray arIndex;
int nSize = gripAppData.length();
for (int i = 0;i < gripAppData.length();i++)
{
pAppData = (TDb::GripAppData*)gripAppData.at(i);
arIndex.append(pAppData->nIndex);
}
Acad::ErrorStatus eSta = Acad::eOk;
if (m_pImpPipeBase != NULL)
{
// mcl add.2010.11.08 忽略z标高差
AcGeVector3d vtOffset = offset;
if(TAuxTools::Is2DView())
vtOffset = offset.orthoProject(TAuxTools::GetUcsZvt());
//只能在本平面移动夹点
if (normal().isParallelTo(AcGeVector3d::kZAxis))
{
vtOffset = offset.orthoProject(normal());
}
else
{
AcGeLineSeg3d line(AcGePoint3d::kOrigin,AcGePoint3d::kOrigin + normal() * 100.0);
if (AcGePlane::kXYPlane.isParallelTo(line)) //立管
{
}
else
{
vtOffset = offset.orthoProject(normal());
}
}
eSta = m_pImpPipeBase->moveGripPointsAt(arIndex,vtOffset);
}
return eSta;
}
#endif
Acad::ErrorStatus TDbPipeBase::subGetGripPoints(AcGePoint3dArray& gripPoints,
AcDbIntArray& osnapModes,
AcDbIntArray& geomIds) const
{
assertReadEnabled();
Acad::ErrorStatus eSta = Acad::eOk;
#if ADS==15
if (m_pImpPipeBase != NULL)
{
eSta = m_pImpPipeBase->getGripPoints(gripPoints,osnapModes,geomIds);
}
#endif
return eSta;
}
Acad::ErrorStatus TDbPipeBase::subMoveGripPointsAt(const AcDbIntArray& indices,
const AcGeVector3d& offset)
{
assertWriteEnabled();
Acad::ErrorStatus eSta = Acad::eOk;
#if ADS==15
if (m_pImpPipeBase != NULL)
{
// mcl add.2010.11.08 忽略z标高差
AcGeVector3d vtOffset = offset;
if(TAuxTools::Is2DView())
vtOffset = offset.orthoProject(TAuxTools::GetUcsZvt());
//只能在本平面移动夹点
if (normal().isParallelTo(AcGeVector3d::kZAxis))
{
vtOffset = offset.orthoProject(normal());
}
else
{
AcGeLineSeg3d line(AcGePoint3d::kOrigin,AcGePoint3d::kOrigin + normal() * 100.0);
if (AcGePlane::kXYPlane.isParallelTo(line)) //立管
{
}
else
{
vtOffset = offset.orthoProject(normal());
}
}
eSta = m_pImpPipeBase->moveGripPointsAt(indices,vtOffset);
}
#endif
return eSta;
}
Acad::ErrorStatus TDbPipeBase::getOffsetCurves(double offsetDist,
AcDbVoidPtrArray& offsetCurves) const
{
assertReadEnabled();
Acad::ErrorStatus eSta = Acad::eOk;
if (m_pImpPipeBase != NULL)
{
AcDbVoidPtrArray curvePtrs;
eSta = m_pImpPipeBase->getOffsetCurves(offsetDist,curvePtrs);
TDbPipeBase* pPipeBase = NULL;
AcDbLine* pLine = NULL;
for (int i = 0;i < curvePtrs.length();i++)
{
pLine = (AcDbLine*)curvePtrs.at(i);
if (pLine != NULL)
{
pPipeBase = (TDbPipeBase*)isA()->create();
if (pPipeBase != NULL)
{
pPipeBase->GetSpecialtyData()->CopyFrom(GetSpecialtyDataReadOnly());
pPipeBase->ReCreateByXDataMap();
pPipeBase->SetStartPoint(pLine->startPoint());
pPipeBase->SetEndPoint(pLine->endPoint());
pPipeBase->GetSpecialtyData()->SetAt(KEY_THISID,NULL);
offsetCurves.append(pPipeBase);
}
delete pLine;
}
}
}
return eSta;
}
Acad::ErrorStatus TDbPipeBase::getOffsetCurvesGivenPlaneNormal(const AcGeVector3d& vtNorm,double offsetDist,
AcDbVoidPtrArray& offsetCurves) const
{
assertReadEnabled();
Acad::ErrorStatus eSta = Acad::eOk;
if (m_pImpPipeBase != NULL)
{
AcDbVoidPtrArray curvePtrs;
eSta = m_pImpPipeBase->getOffsetCurvesGivenPlaneNormal(vtNorm,offsetDist,curvePtrs);
TDbPipeBase* pPipeBase = NULL;
AcDbLine* pLine = NULL;
for (int i = 0;i < curvePtrs.length();i++)
{
pLine = (AcDbLine*)curvePtrs.at(i);
if (pLine != NULL)
{
pPipeBase = (TDbPipeBase*)isA()->create();
if (pPipeBase != NULL)
{
pPipeBase->GetSpecialtyData()->CopyFrom(GetSpecialtyDataReadOnly());
pPipeBase->ReCreateByXDataMap();
pPipeBase->SetStartPoint(pLine->startPoint());
pPipeBase->SetEndPoint(pLine->endPoint());
pPipeBase->GetSpecialtyData()->SetAt(KEY_THISID,NULL);
offsetCurves.append(pPipeBase);
}
delete pLine;
}
}
}
return eSta;
}
Acad::ErrorStatus TDbPipeBase::subGetOsnapPoints(AcDb::OsnapMode osnapMode,
INT_PTR gsSelectionMark,
const AcGePoint3d& pickPoint,
const AcGePoint3d& lastPoint,
const AcGeMatrix3d& viewXform,
AcGePoint3dArray& snapPoints,
AcDbIntArray& geomIds) const
{
assertReadEnabled();
Acad::ErrorStatus eSta = Acad::eOk;
if (m_pImpPipeBase != NULL)
{
eSta = m_pImpPipeBase->getOsnapPoints( osnapMode,gsSelectionMark,
pickPoint,lastPoint,
viewXform,snapPoints,geomIds);
}
return eSta;
}
Acad::ErrorStatus TDbPipeBase::getParamAtDist(double dist,
double& param) const
{
assertReadEnabled();
Acad::ErrorStatus eSta = Acad::eOk;
if (m_pImpPipeBase != NULL)
{
eSta = m_pImpPipeBase->getParamAtDist(dist,param);
}
return eSta;
}
Acad::ErrorStatus TDbPipeBase::getParamAtPoint(const AcGePoint3d& x0,
double& x1)const
{
assertReadEnabled();
Acad::ErrorStatus eSta = Acad::eOk;
if (m_pImpPipeBase != NULL)
{
eSta = m_pImpPipeBase->getParamAtPoint(x0,x1);
}
return Acad::eOk;
}
Acad::ErrorStatus TDbPipeBase::getPointAtDist(double x0,
AcGePoint3d& x1) const
{
assertReadEnabled();
Acad::ErrorStatus eSta = Acad::eOk;
if (m_pImpPipeBase != NULL)
{
eSta = m_pImpPipeBase->getPointAtDist(x0,x1);
}
return eSta;
}
Acad::ErrorStatus TDbPipeBase::getPointAtParam(double x0,
AcGePoint3d& x1) const
{
assertReadEnabled();
Acad::ErrorStatus eSta = Acad::eOk;
if (m_pImpPipeBase != NULL)
{
eSta = m_pImpPipeBase->getPointAtParam(x0,x1);
}
return eSta;
}
Acad::ErrorStatus TDbPipeBase::getSplitCurves(const AcGeDoubleArray& params,
AcDbVoidPtrArray& curveSegments) const
{
assertReadEnabled();
Acad::ErrorStatus eSta = Acad::eOk;
if (m_pImpPipeBase != NULL)
{
AcDbVoidPtrArray curvePtrs;
eSta = m_pImpPipeBase->getSplitCurves(params,curvePtrs);
TDbPipeBase* pPipeBase = NULL;
AcDbLine* pLine = NULL;
for (int i = 0;i < curvePtrs.length();i++)
{
pLine = (AcDbLine*)curvePtrs.at(i);
if (pLine != NULL)
{
pPipeBase = (TDbPipeBase*)isA()->create();
if (pPipeBase != NULL)
{
pPipeBase->GetSpecialtyData()->CopyFrom(GetSpecialtyDataReadOnly());
pPipeBase->ReCreateByXDataMap();
pPipeBase->SetStartPoint(pLine->startPoint());
pPipeBase->SetEndPoint(pLine->endPoint());
pPipeBase->GetSpecialtyData()->SetAt(KEY_THISID,NULL);
pPipeBase->setLayer(layerId());
pPipeBase->SetDashLayer(DashLayer());
pPipeBase->SetCenterLayer(CenterLayer());
curveSegments.append(pPipeBase);
}
delete pLine;
}
}
}
return eSta;
}
Acad::ErrorStatus TDbPipeBase::getSplitCurves(const AcGePoint3dArray& points,
AcDbVoidPtrArray& curveSegments) const
{
assertReadEnabled();
Acad::ErrorStatus eSta = Acad::eOk;
if (m_pImpPipeBase != NULL)
{
AcDbVoidPtrArray curvePtrs;
eSta = m_pImpPipeBase->getSplitCurves(points,curvePtrs);
TDbPipeBase* pPipeBase = NULL;
AcDbLine* pLine = NULL;
for (int i = 0;i < curvePtrs.length();i++)
{
pLine = (AcDbLine*)curvePtrs.at(i);
if (pLine != NULL)
{
pPipeBase = (TDbPipeBase*)isA()->create();
if (pPipeBase != NULL)
{
pPipeBase->GetSpecialtyData()->CopyFrom(GetSpecialtyDataReadOnly());
pPipeBase->ReCreateByXDataMap();
pPipeBase->SetStartPoint(pLine->startPoint());
pPipeBase->SetEndPoint(pLine->endPoint());
pPipeBase->GetSpecialtyData()->SetAt(KEY_THISID,NULL);
pPipeBase->setLayer(layerId());
pPipeBase->SetDashLayer(DashLayer());
pPipeBase->SetCenterLayer(CenterLayer());
curveSegments.append(pPipeBase);
}
delete pLine;
}
}
}
return eSta;
}
Acad::ErrorStatus TDbPipeBase::getStartParam(double& x0) const
{
assertReadEnabled();
Acad::ErrorStatus eSta = Acad::eOk;
if (m_pImpPipeBase != NULL)
{
eSta = m_pImpPipeBase->getStartParam(x0);
}
return eSta;
}
Acad::ErrorStatus TDbPipeBase::getStartPoint(AcGePoint3d& x0) const
{
assertReadEnabled();
Acad::ErrorStatus eSta = Acad::eOk;
if (m_pImpPipeBase != NULL)
{
eSta = m_pImpPipeBase->getStartPoint(x0);
}
return eSta;
}
Acad::ErrorStatus TDbPipeBase::subGetTransformedCopy(const AcGeMatrix3d& xform,
AcDbEntity*& pEnt) const
{
assertReadEnabled();
pEnt = new TDbPipeBase;
pEnt->copyFrom(this);
pEnt->transformBy(xform);
return Acad::eOk;
}
//bsl 2012.1.6 支持64位将int改为INT_PTR
Acad::ErrorStatus TDbPipeBase::subIntersectWith(const AcDbEntity* pEnt,
AcDb::Intersect intType,
AcGePoint3dArray& points,
INT_PTR thisGsMarker,
INT_PTR otherGsMarker) const
{
assertReadEnabled();
Acad::ErrorStatus eSta = Acad::eOk;
if (m_pImpPipeBase != NULL)
{
eSta = m_pImpPipeBase->intersectWith(pEnt,intType,points,thisGsMarker,otherGsMarker);
}
return eSta;
}
//bsl 2012.1.6 支持64位将int改为INT_PTR
Acad::ErrorStatus TDbPipeBase::subIntersectWith(const AcDbEntity* pEnt,
AcDb::Intersect intType,
const AcGePlane& projPlane,
AcGePoint3dArray& points,
INT_PTR thisGsMarker,
INT_PTR otherGsMarker) const
{
assertReadEnabled();
Acad::ErrorStatus eSta = Acad::eOk;
if (m_pImpPipeBase != NULL)
{
eSta = m_pImpPipeBase->intersectWith(pEnt,intType,projPlane,points,thisGsMarker,otherGsMarker);
}
return eSta;
}
Acad::ErrorStatus TDbPipeBase::subTransformBy(const AcGeMatrix3d& xform)
{
assertWriteEnabled();
Acad::ErrorStatus eSta = Acad::eOk;
if (m_pImpPipeBase != NULL)
{
m_pImpPipeBase->GetSpecialtyData()->SetAt(KEY_DEEPCLONEFLAG,0);
// mcl add.2010.11.08 move 及复制时,忽略z标高差
// XString &sCmd=GetCurDocData()->m_sCurCommand;
// Lixl add 指针有效性判断2012-6-18
TArchPerDocData* pDoc = GetCurDocData();
if (NULL != pDoc)
{
XString &sCmd = pDoc->m_sCurCommand;
if((_tcsicmp(sCmd,_T("MOVE"))==0 || _tcsicmp(sCmd,_T("copy"))==0 || _tcsicmp(sCmd,_T("pasteclip"))==0)
&& TAuxTools::Is2DView())
{
//change by dyw 20141009 ucs下pasteclip命令的角度有问题
// AcGeVector3d vtNoneZ = xform.translation();
// vtNoneZ = vtNoneZ.orthoProject(TAuxTools::GetUcsZvt());
// return m_pImpPipeBase->transformBy(vtNoneZ);
AcGeVector3d vtNoneZ = xform.translation();
AcGeMatrix3d mat(xform);
if(fabs(vtNoneZ.x) > 0.0001 || fabs(vtNoneZ.y) > 0.0001)//2012-9-2 SR 修正:z轴位移除外
{
vtNoneZ.x = 0.0;
vtNoneZ.y = 0.0;
vtNoneZ.z *= -1;
AcGeMatrix3d mat1;
mat1.setToTranslation(vtNoneZ);
mat *= mat1;
}
return m_pImpPipeBase->transformBy(mat);
//change end
}
else
return m_pImpPipeBase->transformBy(xform);
}
else
return m_pImpPipeBase->transformBy(xform);
// eSta = m_pImpPipeBase->transformBy(xform);
}
return eSta;
}
static void FreeBuffer(AcDbVoidPtrArray& arCurves)
{
for (int i = 0;i < arCurves.length();i++)
{
AcDbEntity* pEnt = (AcDbEntity*)arCurves.at(i);
if (pEnt != NULL)
{
delete pEnt;
}
}
arCurves.setLogicalLength(0);
}
Acad::ErrorStatus TDbPipeBase::ExplodeOrDraw2d(XExplodeDraw &mode) const
{
assertReadEnabled();
if (m_pImpPipeBase != NULL)
{
double dPScale = GetPrintScale();
if (dPScale < 1.e-3) dPScale = 1.0;
BOOL bWeight = FALSE;
m_XDataMap.GetAt(KEY_EDAGEWEIGHT,bWeight);
BOOL bCenWeight = FALSE;
m_XDataMap.GetAt(KEY_CENLWEIGHT,bCenWeight);
//如果单线中心线显示;
BOOL nSingleLine = FALSE;
m_XDataMap.GetAt(KEY_SINGLE,nSingleLine);
if (nSingleLine)
{
// 获取实体自身原来的pl边界对象[源];
TComplexCurve compInside;
GetCurvesInSide(compInside);
compInside.setSubElementGsMark(0);
TDb::TCurveElement* pElTmpl = NULL;
if (!acrxServiceDictionary->has(KEY_FITCAB))
{
if (compInside.length() > 0)
pElTmpl = &compInside.first();
}
TDbExtentsEdge edage;
// 画被虚图元段.该部分由外部计算传入;
for (int i = 0;i < m_arDbExtEdgs.GetCount();i++)
{
edage = m_arDbExtEdgs.GetAt(i);
// 然后[源]实边界对象减去虚图元段;]
if (TCoverBooleanOper::BoolSubtract(compInside,edage))
{
// 画虚图元部分[被遮挡]
m_arDbExtEdgs.GetAt(i).ExplodeOrDraw2d(mode,layerId(),DashLayer(),CenterLayer(),pElTmpl,bWeight,bCenWeight,dPScale);
}
}
TDbExtentsEdge edge;
edge.SetEdage(compInside);
edge.ExplodeOrDraw2d(mode,layerId(),DashLayer(),CenterLayer(),NULL,bWeight,bCenWeight,dPScale);
return Acad::eOk;
}
if (m_arDbExtEdgs.GetCount() == 0)
{
TDbExtentsEdge edge;
// 获取实体自身原来的边界对象[源];
TComplexCurve compCurve;
MakeCurves(compCurve);
edge.SetEdage(compCurve);
edge.ExplodeOrDraw2d(mode,layerId(),DashLayer(),CenterLayer(),NULL,bWeight,bCenWeight,dPScale);
// 画减去虚段后剩下的实图元段;
TComplexCurve compInside;
GetCurvesInSide(compInside);
edge.SetEdage(compInside);
edge.ExplodeOrDraw2d(mode,layerId(),DashLayer(),CenterLayer(),NULL,bWeight,bCenWeight,dPScale);
}
else
{
// 获取实体自身原来的pl边界对象[源];
TComplexCurve compCurve,compInside;
MakeCurves(compCurve);
GetCurvesInSide(compInside);
TDb::TCurveElement* pElTmpl = NULL;
if (!acrxServiceDictionary->has(KEY_FITCAB))
{
if (compInside.length() > 0)
pElTmpl = &compInside.first();
}
// mcl add, 10.01.13,支持遮挡扩展区域
double dExtentLen(0.0);
if (this->isKindOf(TDbHvacDuct::desc()))
{
GetGlobalContext()->GetAt(HVAC_HIDEEXTENT, dExtentLen);
// add by hh 2011-01-05 从图纸中读取遮挡参数 避免全局参数对不同的图纸间的影响
TAuxTools::GetTHvacDataFromDwg(HVAC_HIDEEXTENT, dExtentLen);
// add by hh 2011-10-11 支持遮挡宽度随比例变化,并兼容旧版图纸(宽度小于10时认为是新版数据)
if(10 > dExtentLen && !EQUAL_ZERO(dExtentLen))
dExtentLen *= DocGetPScale();
}else
GetGlobalContext()->GetAt(KEY_CABLE_HIDEEXTENT, dExtentLen);
// add by hh 2014.8.7 确定是否要处理水管风管遮挡
BOOL bBreakPipe = FALSE;
if(!TAuxTools::GetTHvacDataFromDwg(HVAC_PIPEDUCTBREAK, bBreakPipe))
GetGlobalContext()->GetAt(HVAC_PIPEDUCTBREAK, bBreakPipe);
TDbExtentsEdge edage, edageExtent;
// 画被虚图元段.该部分由外部计算传入;
for (int i = 0;i < m_arDbExtEdgs.GetCount();i++)
{
edage = m_arDbExtEdgs.GetAt(i);
edageExtent = edage;
// change by hh 2014.8.7
// if (dExtentLen > 1e-3)
// edageExtent.ExtendStartAndEnd(dExtentLen);
if(dExtentLen > 1e-3)
{
// 不处理水管时 m_arDbExtEdgs不会出现水管实体
if(!bBreakPipe)
{
edageExtent.ExtendStartAndEnd(dExtentLen);
}
// 处理水管时,要先判断是否水管,水管的打断间距在edageExtent中已经计算好了,不需要再进行扩展
else
{
OPENOBJ_BEGIN(edage.m_idOwner, AcDb::kForRead, AcDbEntity, pPipe);
if(NULL != pPipe)
{
if(0 != _tcscmp(_T("TDbPipe"), pPipe->isA()->name()))
{
// 如果不是水管 按遮挡间距扩展
edageExtent.ExtendStartAndEnd(dExtentLen);
}
}
OPENOBJ_END();
}
}
// change end
// 然后[源]实边界对象减去虚图元段;]
if (TCoverBooleanOper::BoolSubtract(compCurve, edageExtent))
{
edage.ExplodeOrDraw2d(mode,layerId(),DashLayer(),CenterLayer(),pElTmpl,bWeight,bCenWeight,dPScale);
}
// 内部的中心线等分布线减去被遮挡的部分
TCoverBooleanOper::BoolSubtract(compInside, edageExtent);
}
/* TDbExtentsEdge edage;
// 画被虚图元段.该部分由外部计算传入;
for (int i = 0;i < m_arDbExtEdgs.GetCount();i++)
{
edage = m_arDbExtEdgs.GetAt(i);
// 然后[源]实边界对象减去虚图元段;]
if (TCoverBooleanOper::BoolSubtract(compCurve,edage))
{
// 画虚图元部分[被遮挡]
m_arDbExtEdgs.GetAt(i).ExplodeOrDraw2d(mode,layerId(),DashLayer(),CenterLayer(),&elTmpl,bWeight,bCenWeight,dPScale);
}
// 内部的中心线等分布线减去被遮挡的部分
TCoverBooleanOper::BoolSubtract(compInside,m_arDbExtEdgs.at(i));
}
*/
//确保去掉重复的画线 [补漏]
for (i = 0;i < m_arDbExtEdgs.GetCount();i++)
{
// 然后[源]实边界对象减去虚图元段;]
TCoverBooleanOper::BoolSubtract(compCurve,m_arDbExtEdgs.GetAt(i));
}
// 画减去虚段后剩下的实图元段;
TDbExtentsEdge edge;
edge.SetEdage(compCurve);
edge.ExplodeOrDraw2d(mode,layerId(),DashLayer(),CenterLayer(),NULL,bWeight,bCenWeight,dPScale);
// 画内部的中心线等分布线
edge.SetEdage(compInside);
edge.ExplodeOrDraw2d(mode,layerId(),DashLayer(),CenterLayer(),NULL,bWeight,bCenWeight,dPScale);
}
}
return Acad::eOk;
}
Acad::ErrorStatus TDbPipeBase::ExplodeOrDraw3d(XExplodeDraw &mode) const
{
assertReadEnabled();
if (m_pImpPipeBase != NULL)
{
m_pImpPipeBase->ExplodeOrDraw3d(mode);
return Acad::eOk;
}
return Acad::eNotImplementedYet;
}
void TDbPipeBase::subList() const
{
assertReadEnabled();
TDbInterfacesObj::subList();
if (m_pImpPipeBase != NULL)
{
m_pImpPipeBase->list();
}
}
BOOL TDbPipeBase::GetActiveViewPortInfo(AcGeVector3d& viewDir)
{
viewDir = AcGeVector3d::kZAxis;
struct resbuf rb;
memset (&rb, 0, sizeof (struct resbuf));
acedGetVar (_T("VIEWDIR"), &rb);
viewDir.set(rb.resval.rpoint[X], rb.resval.rpoint[Y], rb.resval.rpoint[Z]);
viewDir.normalize();
return TRUE;
}
void TDbPipeBase::GetTips(CMapStringToString& mapLable2Tip) const
{
assertReadEnabled();
if (m_pImpPipeBase != NULL)
{
m_pImpPipeBase->GetTips(mapLable2Tip);
}
}
TDb::Position TDbPipeBase::ExplainGripIndex(int nIndex) const
{
assertReadEnabled();
if (m_pImpPipeBase != NULL)
{
return m_pImpPipeBase->ExplainGripIndex(nIndex);
}
return TDb::eStart;
}
void TDbPipeBase::CopyPropertiesFrom(AcDbEntity *pSrc,unsigned gMatchFlag)
{
assertWriteEnabled();
TDbInterfacesObj::CopyPropertiesFrom(pSrc,gMatchFlag);
if (m_pImpPipeBase != NULL)
{
m_pImpPipeBase->CopyPropertiesFrom(pSrc,gMatchFlag);
}
}
void TDbPipeBase::CopyPropertiesTo(AcDbObjectId& idTgr,unsigned gMatchFlag)
{
assertReadEnabled();
if (m_pImpPipeBase != NULL)
{
m_pImpPipeBase->CopyPropertiesTo(idTgr,gMatchFlag);
}
}
void TDbPipeBase::CopyPropertiesTo(AcDbObjectIdArray& arIds,unsigned gMatchFlag)
{
assertReadEnabled();
if (m_pImpPipeBase != NULL)
{
m_pImpPipeBase->CopyPropertiesTo(arIds,gMatchFlag);
}
}
BOOL TDbPipeBase::OPMInfo(LPCTSTR pszName, TDb::OPMInfo* pInfo)
{
if (isWriteEnabled())
assertWriteEnabled();
else
assertReadEnabled();
if (m_pImpPipeBase != NULL)
{
return m_pImpPipeBase->OPMInfo(pszName, pInfo);
}
return FALSE;
}
BOOL TDbPipeBase::IsValid(TDbXDataMap* pXMap)
{
assertReadEnabled();
if (m_pImpPipeBase != NULL)
{
return m_pImpPipeBase->IsValid(pXMap);
}
return FALSE;
}
LRESULT TDbPipeBase::UserCall(long i,LPVOID pData)
{
return 0l;
}
Acad::ErrorStatus TDbPipeBase::subHighlight(const AcDbFullSubentPath& subId, const Adesk::Boolean highlightAll ) const
{
AcDbObjectId id = objectId();
return TDbInterfacesObj::subHighlight(subId,highlightAll);
}
int TDbPipeBase::GetXBaseShell(TXShell& xShell)
{
if (m_pImpPipeBase != NULL)
{
return m_pImpPipeBase->GetXBaseShell(xShell);
}
return 0;
}
int TDbPipeBase::GetBodyBox(AcDbExtents& ext)
{
if (m_pImpPipeBase != NULL)
{
return m_pImpPipeBase->GetBodyBox(ext);
}
return 0;
}
CString TDbPipeBase::GetXml(const AcGeMatrix3d& mat) const
{
if (m_pImpPipeBase == NULL)
return _T("");
HvacModelType eType(TDb::eModel);
TDbXDataMap* pMap = GetSpecialtyDataReadOnly();
if (NULL == pMap)
return _T("");
pMap->GetAt(HVAC_ModeType, (int&)eType);
if (TDb::eSystem == eType)
return _T("");
CString csXml = m_pImpPipeBase->GetXml(mat);
CString csBase = TEntityBase::GetXml(mat);
int nIndex = csXml.Find(_T("</TCH_"));
if (nIndex > -1)
csXml.Insert(nIndex, csBase);
return csXml;
}
bool TDbPipeBase::GetSection( const AcDbFace &face, const AcGeVector3d &vtPlaneSecDir,
std::vector<TObjSectionRecord> &sectionRecord, AcDbVoidPtrArray& arFillPtrs ) const
{
if (m_pImpPipeBase != NULL)
{
return m_pImpPipeBase->GetSection(face, vtPlaneSecDir, sectionRecord, arFillPtrs);
}
return false;
}
Acad::ErrorStatus TDbPipeBase::GetExtents( TADSGePoint3d &ptLow, TADSGePoint3d &ptUp ) const
{
if (m_pImpPipeBase != NULL)
return m_pImpPipeBase->GetExtents(ptLow, ptUp);
return Acad::eNotImplementedYet;
}