729 lines
17 KiB
C++
729 lines
17 KiB
C++
#include "stdafx.h"
|
|
#include "TDbImpEquipment.h"
|
|
#include "TImpSpecEquipment.h"
|
|
#include "TDbFittingCreatorService.h"
|
|
#include "TCoverBooleanOper.h"
|
|
|
|
#ifdef _DEBUG
|
|
#undef THIS_FILE
|
|
static char THIS_FILE[]=__FILE__;
|
|
#define new DEBUG_NEW
|
|
#endif
|
|
|
|
// TDbImpEquipment::TDbImpEquipment(AcDbEntity* pEnt)
|
|
TDbImpEquipment::TDbImpEquipment(TDbEquipmentBase* pEnt)
|
|
: m_XDataMap(*pEnt->GetSpecialtyData())
|
|
{
|
|
m_pSpecEquipment = NULL;
|
|
m_pOwnerEnt = pEnt;
|
|
m_nDwgVersion = 1;
|
|
}
|
|
|
|
TDbImpEquipment::~TDbImpEquipment()
|
|
{
|
|
if (m_pSpecEquipment != NULL)
|
|
{
|
|
m_pSpecEquipment->Destroy();
|
|
}
|
|
}
|
|
|
|
void TDbImpEquipment::SetVersion(int nVersion)
|
|
{
|
|
m_nDwgVersion = nVersion;
|
|
}
|
|
|
|
BOOL TDbImpEquipment::GetInterface(int nIndex,TInterface& pipeInterface) const
|
|
{
|
|
if (m_pSpecEquipment != NULL)
|
|
{
|
|
return m_pSpecEquipment->GetInterface(nIndex,pipeInterface);
|
|
}
|
|
return FALSE;
|
|
}
|
|
|
|
BOOL TDbImpEquipment::GetInterface(const AcGePoint3d& ptCon,TInterface& pipeInterface) const
|
|
{
|
|
if (m_pSpecEquipment != NULL)
|
|
{
|
|
return m_pSpecEquipment->GetInterface(ptCon,pipeInterface);
|
|
}
|
|
return FALSE;
|
|
}
|
|
|
|
BOOL TDbImpEquipment::HasInterface(const AcGePoint3d& ptCon,const AcGeVector3d& vtDir)
|
|
{
|
|
if (m_pSpecEquipment != NULL)
|
|
{
|
|
return m_pSpecEquipment->HasInterface(ptCon,vtDir);
|
|
}
|
|
return FALSE;
|
|
}
|
|
|
|
int TDbImpEquipment::GetInterfaceCount() const
|
|
{
|
|
if (m_pSpecEquipment != NULL)
|
|
{
|
|
return m_pSpecEquipment->GetInterfaceCount();
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
BOOL TDbImpEquipment::SetInterfaceRelation(const AcGePoint3d& ptConnect,const AcDbObjectId& idConnect)
|
|
{
|
|
if (m_pSpecEquipment != NULL)
|
|
{
|
|
return m_pSpecEquipment->SetInterfaceRelation(ptConnect,idConnect);
|
|
}
|
|
return FALSE;
|
|
}
|
|
|
|
BOOL TDbImpEquipment::RemoveInterfaceRelation(const AcGePoint3d& ptConnect,const AcDbObjectId& idConnect)
|
|
{
|
|
if (m_pSpecEquipment != NULL)
|
|
{
|
|
return m_pSpecEquipment->RemoveInterfaceRelation(ptConnect,idConnect);
|
|
}
|
|
return FALSE;
|
|
}
|
|
|
|
BOOL TDbImpEquipment::NotifyInterfaceToModify(const TInterfaceModifyMsg& iModiMsg,TInterfaceModifyMsgs& iModiMsgs)
|
|
{
|
|
if (m_pSpecEquipment != NULL)
|
|
{
|
|
return m_pSpecEquipment->NotifyInterfaceToModify(iModiMsg,iModiMsgs);
|
|
}
|
|
return FALSE;
|
|
}
|
|
|
|
TDbXDataMap* TDbImpEquipment::GetSpecialtyData()
|
|
{
|
|
return &m_XDataMap;
|
|
}
|
|
|
|
BOOL TDbImpEquipment::AddCoverEdge(AcDbObjectId& id,TComplexCurve& curEdge)
|
|
{
|
|
TDbExtentsEdge edage;
|
|
edage.SetOwnerId(id);
|
|
edage.SetEdage(curEdge);
|
|
m_arDbExtEdgs.Add(edage);
|
|
|
|
return m_arDbExtEdgs.GetCount() > 0;
|
|
}
|
|
|
|
BOOL TDbImpEquipment::RemoveCoverEdge(AcDbObjectId& id)
|
|
{
|
|
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 TDbImpEquipment::GetCoverEdgeIds(AcDbObjectIdArray& arIds)
|
|
{
|
|
for (int i = 0;i < m_arDbExtEdgs.GetCount();i++)
|
|
{
|
|
arIds.append(m_arDbExtEdgs.GetAt(i).GetOwnerId());
|
|
}
|
|
|
|
return arIds.length() > 0;
|
|
}
|
|
|
|
BOOL TDbImpEquipment::AddIdsCoverByMe(AcDbObjectId& id)
|
|
{
|
|
int nFoundAt = -1;
|
|
if (!m_arIdCoverByMe.find(id,nFoundAt))
|
|
{
|
|
m_arIdCoverByMe.append(id);
|
|
}
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
BOOL TDbImpEquipment::GetIdsCoverByMe(AcDbObjectIdArray& arByMeIds)
|
|
{
|
|
arByMeIds.append(m_arIdCoverByMe);
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
BOOL TDbImpEquipment::GetGeomExtentsEdge(TComplexCurve& crLoop)
|
|
{
|
|
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;
|
|
}
|
|
|
|
Acad::ErrorStatus TDbImpEquipment::setNormal(const AcGeVector3d& vtNorm)
|
|
{
|
|
if (m_pSpecEquipment != NULL)
|
|
{
|
|
return m_pSpecEquipment->setNormal(vtNorm);
|
|
}
|
|
return Acad::eNotImplementedYet;
|
|
}
|
|
|
|
AcGeVector3d TDbImpEquipment::normal() const
|
|
{
|
|
if (m_pSpecEquipment != NULL)
|
|
{
|
|
return m_pSpecEquipment->normal();
|
|
}
|
|
return AcGeVector3d::kZAxis;
|
|
}
|
|
|
|
BOOL TDbImpEquipment::MakeCurves(TComplexCurve& cplCurve) const
|
|
{
|
|
if (m_pSpecEquipment != NULL)
|
|
{
|
|
return m_pSpecEquipment->MakeCurves(cplCurve);
|
|
}
|
|
return FALSE;
|
|
}
|
|
|
|
BOOL TDbImpEquipment::GetCurvesInSide(TComplexCurve& compCurve) const
|
|
{
|
|
if (m_pSpecEquipment != NULL)
|
|
{
|
|
return m_pSpecEquipment->GetCurvesInSide(compCurve);
|
|
}
|
|
|
|
return FALSE;
|
|
}
|
|
|
|
AcDbPolyline* TDbImpEquipment::MakePolyCurve() const
|
|
{
|
|
if (m_pSpecEquipment != NULL)
|
|
{
|
|
return m_pSpecEquipment->MakePolyCurve();
|
|
}
|
|
return NULL;
|
|
}
|
|
|
|
BOOL TDbImpEquipment::MakePolyCurveFaces(AcDbVoidPtrArray& arFaces)
|
|
{
|
|
if (m_pSpecEquipment != NULL)
|
|
{
|
|
return m_pSpecEquipment->MakePolyCurveFaces(arFaces);
|
|
}
|
|
return FALSE;
|
|
}
|
|
|
|
void TDbImpEquipment::GetKindName(CString& sName)
|
|
{
|
|
sName = _T("TCH_DBEQUIPMENT");
|
|
if (m_pSpecEquipment != NULL)
|
|
{
|
|
m_pSpecEquipment->GetKindName(sName);
|
|
}
|
|
}
|
|
|
|
void TDbImpEquipment::GetTips(CMapStringToString& mapLable2Tip) const
|
|
{
|
|
if (m_pSpecEquipment != NULL)
|
|
{
|
|
m_pSpecEquipment->GetTips(mapLable2Tip);
|
|
}
|
|
}
|
|
|
|
Acad::ErrorStatus TDbImpEquipment::SetTransform(const AcGeMatrix3d& xform)
|
|
{
|
|
m_XDataMap.SetAt(KEY_XFORM,xform);
|
|
return Acad::eOutOfMemory;
|
|
}
|
|
|
|
AcGeMatrix3d TDbImpEquipment::GetTransform() const
|
|
{
|
|
AcGeMatrix3d xfrom = AcGeMatrix3d::kIdentity;
|
|
m_XDataMap.GetAt(KEY_XFORM,xfrom);
|
|
return xfrom;
|
|
}
|
|
|
|
TDb::Position TDbImpEquipment::ExplainGripIndex(int nIndex) const
|
|
{
|
|
if (m_pSpecEquipment != NULL)
|
|
{
|
|
return m_pSpecEquipment->ExplainGripIndex(nIndex);
|
|
}
|
|
return TDb::eStart;
|
|
}
|
|
|
|
Acad::ErrorStatus TDbImpEquipment::GetGripText(int i, CString &cs) const
|
|
{
|
|
if (m_pSpecEquipment != NULL)
|
|
{
|
|
return m_pSpecEquipment->GetGripText(i,cs);
|
|
}
|
|
return Acad::eOk;
|
|
}
|
|
|
|
Acad::ErrorStatus TDbImpEquipment::ExplodeOrDraw3d(XExplodeDraw &mode) const
|
|
{
|
|
if (m_pSpecEquipment != NULL)
|
|
{
|
|
m_pSpecEquipment->ExplodeOrDraw3d(mode);
|
|
return Acad::eOk;
|
|
}
|
|
return Acad::eNotImplementedYet;
|
|
}
|
|
|
|
void TDbImpEquipment::list() const
|
|
{
|
|
if (m_pSpecEquipment != NULL)
|
|
{
|
|
m_pSpecEquipment->list();
|
|
}
|
|
}
|
|
|
|
Acad::ErrorStatus TDbImpEquipment::ExplodeOrDraw2d(XExplodeDraw &mode) const
|
|
{
|
|
if (m_pSpecEquipment != NULL && !m_pSpecEquipment->ExplodeOrDraw2d(mode))
|
|
{
|
|
BOOL bWeight = FALSE;
|
|
m_XDataMap.GetAt(KEY_EDAGEWEIGHT,bWeight);
|
|
|
|
BOOL bCenWeight = FALSE;
|
|
m_XDataMap.GetAt(KEY_CENLWEIGHT,bCenWeight);
|
|
|
|
AcDbObjectId idReal = ((TDbInterfacesObj*)m_pOwnerEnt)->layerId();
|
|
AcDbObjectId idDash = ((TDbInterfacesObj*)m_pOwnerEnt)->DashLayer();
|
|
AcDbObjectId idCent = ((TDbInterfacesObj*)m_pOwnerEnt)->CenterLayer();
|
|
|
|
double dPScale = ((TDbInterfacesObj*)m_pOwnerEnt)->GetPrintScale();
|
|
if (dPScale < 1.e-3)
|
|
dPScale = 1.0;
|
|
|
|
if (m_arDbExtEdgs.GetCount() == 0)
|
|
{
|
|
TDbExtentsEdge edge;
|
|
|
|
//获取实体自身原来的边界对象[源];
|
|
TComplexCurve compCurve;
|
|
MakeCurves(compCurve);
|
|
edge.SetEdage(compCurve);
|
|
edge.ExplodeOrDraw2d(mode,idReal,idDash,idCent,NULL,bWeight,bCenWeight,dPScale);
|
|
|
|
//画减去虚段后剩下的实图元段;
|
|
TComplexCurve compInside;
|
|
GetCurvesInSide(compInside);
|
|
|
|
edge.SetEdage(compInside);
|
|
edge.ExplodeOrDraw2d(mode,idReal,idDash,idCent,NULL,bWeight,bCenWeight,dPScale);
|
|
}
|
|
else
|
|
{
|
|
//获取实体自身原来的pl边界对象[源];
|
|
TComplexCurve compCurve,compInside;
|
|
MakeCurves(compCurve);
|
|
GetCurvesInSide(compInside);
|
|
|
|
TDb::TCurveElement elTmpl;
|
|
memset(&elTmpl,0,sizeof(TDb::TCurveElement));
|
|
if (compInside.length() > 0)
|
|
elTmpl = compInside.first();
|
|
|
|
//画被虚图元段.该部分由外部计算传入;
|
|
for (int i = 0;i < m_arDbExtEdgs.GetCount();i++)
|
|
{
|
|
// 然后[源]实边界对象减去虚图元段;]
|
|
if (TCoverBooleanOper::BoolSubtract(compCurve,m_arDbExtEdgs.GetAt(i)))
|
|
{
|
|
// 画虚图元部分[被遮挡]
|
|
m_arDbExtEdgs.GetAt(i).ExplodeOrDraw2d(mode,idReal,idDash,idCent,&elTmpl,bWeight,bCenWeight,dPScale);
|
|
}
|
|
|
|
// 内部的中心线等分布线减去被遮挡的部分
|
|
TCoverBooleanOper::BoolSubtract(compInside,m_arDbExtEdgs.GetAt(i));
|
|
}
|
|
|
|
//画减去虚段后剩下的实图元段;
|
|
TDbExtentsEdge edge;
|
|
edge.SetEdage(compCurve);
|
|
edge.ExplodeOrDraw2d(mode,idReal,idDash,idCent,NULL,bWeight,bCenWeight,dPScale);
|
|
|
|
// 画内部的中心线等分布线
|
|
edge.SetEdage(compInside);
|
|
edge.ExplodeOrDraw2d(mode,idReal,idDash,idCent,NULL,bWeight,bCenWeight,dPScale);
|
|
}
|
|
}
|
|
m_pSpecEquipment->ExplodeOrDrawText2d(mode);
|
|
return Acad::eOk;
|
|
}
|
|
|
|
Acad::ErrorStatus TDbImpEquipment::transformBy(const AcGeMatrix3d& xform)
|
|
{
|
|
if (m_pSpecEquipment != NULL)
|
|
{
|
|
return m_pSpecEquipment->transformBy(xform);
|
|
}
|
|
return Acad::eNotImplementedYet;
|
|
}
|
|
|
|
Acad::ErrorStatus TDbImpEquipment::moveGripPointsAt(const AcDbIntArray& indices,
|
|
const AcGeVector3d& offset)
|
|
{
|
|
if (m_pSpecEquipment != NULL)
|
|
{
|
|
return m_pSpecEquipment->moveGripPointsAt(indices,offset);
|
|
}
|
|
return Acad::eNotImplementedYet;
|
|
}
|
|
|
|
Acad::ErrorStatus TDbImpEquipment::getStretchPoints(AcGePoint3dArray& stretchPoints) const
|
|
{
|
|
if (m_pSpecEquipment != NULL)
|
|
{
|
|
m_pSpecEquipment->getStretchPoints(stretchPoints);
|
|
return Acad::eOk;
|
|
}
|
|
return Acad::eOk;
|
|
}
|
|
|
|
|
|
Acad::ErrorStatus TDbImpEquipment::moveStretchPointsAt(const AcDbIntArray& indices,
|
|
const AcGeVector3d& offset)
|
|
{
|
|
if (m_pSpecEquipment != NULL)
|
|
{
|
|
return m_pSpecEquipment->moveStretchPointsAt(indices,offset);
|
|
}
|
|
return Acad::eOk;
|
|
}
|
|
|
|
Acad::ErrorStatus TDbImpEquipment::intersectWith(const AcDbEntity* pEnt,
|
|
AcDb::Intersect intType,
|
|
const AcGePlane& projPlane,
|
|
AcGePoint3dArray& points,
|
|
INT_PTR thisGsMarker,
|
|
INT_PTR otherGsMarker) const
|
|
{
|
|
if (m_pSpecEquipment != NULL)
|
|
{
|
|
return m_pSpecEquipment->intersectWith(pEnt,intType,projPlane,points,thisGsMarker,otherGsMarker);
|
|
}
|
|
return Acad::eNotImplementedYet;
|
|
}
|
|
|
|
Acad::ErrorStatus TDbImpEquipment::intersectWith(const AcDbEntity* pEnt,
|
|
AcDb::Intersect intType,
|
|
AcGePoint3dArray& points,
|
|
INT_PTR thisGsMarker,
|
|
INT_PTR otherGsMarker) const
|
|
{
|
|
if (m_pSpecEquipment != NULL)
|
|
{
|
|
return m_pSpecEquipment->intersectWith(pEnt,intType,points,thisGsMarker,otherGsMarker);
|
|
}
|
|
return Acad::eNotImplementedYet;
|
|
}
|
|
|
|
Acad::ErrorStatus TDbImpEquipment::getOsnapPoints(AcDb::OsnapMode osnapMode,
|
|
INT_PTR gsSelectionMark,
|
|
const AcGePoint3d& pickPoint,
|
|
const AcGePoint3d& lastPoint,
|
|
const AcGeMatrix3d& viewXform,
|
|
AcGePoint3dArray& snapPoints,
|
|
AcDbIntArray& geomIds) const
|
|
{
|
|
if (m_pSpecEquipment != NULL)
|
|
{
|
|
return m_pSpecEquipment->getOsnapPoints(osnapMode,gsSelectionMark,pickPoint,lastPoint,viewXform,snapPoints,geomIds);
|
|
}
|
|
return Acad::eNotImplementedYet;
|
|
}
|
|
|
|
Acad::ErrorStatus TDbImpEquipment::getGripPoints(AcGePoint3dArray& gripPoints,
|
|
AcDbIntArray& osnapModes,
|
|
AcDbIntArray& geomIds) const
|
|
{
|
|
if (m_pSpecEquipment != NULL)
|
|
{
|
|
return m_pSpecEquipment->getGripPoints(gripPoints,osnapModes,geomIds);
|
|
}
|
|
return Acad::eNotImplementedYet;
|
|
}
|
|
|
|
Acad::ErrorStatus TDbImpEquipment::getGeomExtents(AcDbExtents& extents) const
|
|
{
|
|
// mcl changdd 2011.2.14 解决自由复制(上华拷贝)找不到基点而导致设备消失(位置很远)问题
|
|
int nRet = GetBodyBox(extents);
|
|
if (1 == nRet)
|
|
{
|
|
return Acad::eOk;
|
|
}
|
|
|
|
// if (m_pSpecEquipment != NULL)
|
|
// {
|
|
// return m_pSpecEquipment->getGeomExtents(extents);
|
|
// }
|
|
|
|
return Acad::eNotImplementedYet;
|
|
}
|
|
|
|
Acad::ErrorStatus TDbImpEquipment::getClassID(CLSID* pClsid) const
|
|
{
|
|
if (m_pSpecEquipment != NULL)
|
|
{
|
|
return m_pSpecEquipment->getClassID(pClsid);
|
|
}
|
|
return Acad::eNotImplementedYet;
|
|
}
|
|
|
|
Acad::ErrorStatus TDbImpEquipment::explode(AcDbVoidPtrArray& entitySet) const
|
|
{
|
|
if (m_pSpecEquipment != NULL)
|
|
{
|
|
return m_pSpecEquipment->explode(entitySet);
|
|
}
|
|
return Acad::eNotImplementedYet;
|
|
}
|
|
|
|
Acad::ErrorStatus TDbImpEquipment::dxfOutFields(AcDbDxfFiler* pFiler) const
|
|
{
|
|
return Acad::eOutOfMemory;
|
|
}
|
|
|
|
Acad::ErrorStatus TDbImpEquipment::dxfInFields(AcDbDxfFiler* pFiler)
|
|
{
|
|
return Acad::eOutOfMemory;
|
|
}
|
|
|
|
Acad::ErrorStatus TDbImpEquipment::dwgOutFields(AcDbDwgFiler* pFiler) const
|
|
{
|
|
// Write version number.
|
|
// change by hh 2013-9-2 TXDataMap改在底层中进行读写
|
|
// m_XDataMap.dwgOutFields(pFiler);
|
|
if (g_nSaveTArchVer <= 9)
|
|
{
|
|
m_XDataMap.dwgOutFields(pFiler);
|
|
}
|
|
return Acad::eOk;
|
|
}
|
|
|
|
Acad::ErrorStatus TDbImpEquipment::copyFrom(const TDbImpEquipment* pSrc)
|
|
{
|
|
if (pSrc != NULL)
|
|
{
|
|
m_XDataMap.CopyFrom(&pSrc->m_XDataMap);
|
|
ReCreateByXDataMap();
|
|
return Acad::eOk;
|
|
}
|
|
return Acad::eInvalidInput;
|
|
}
|
|
|
|
Acad::ErrorStatus TDbImpEquipment::dwgInFields(AcDbDwgFiler* pFiler)
|
|
{
|
|
// change by hh 2013-9-2 版本小于2时 才读取XDataMap
|
|
// m_XDataMap.dwgInFields(pFiler);
|
|
if(2 > m_nDwgVersion)
|
|
{
|
|
m_XDataMap.dwgInFields(pFiler);
|
|
}
|
|
ReCreateByXDataMap();
|
|
return Acad::eOk;
|
|
}
|
|
|
|
BOOL TDbImpEquipment::ReCreateByXDataMap()
|
|
{
|
|
CString sService;
|
|
m_XDataMap.GetAt(KEY_FITSRV,sService);
|
|
|
|
TDbFittingCreatorService* pFitCreatorService = NULL;
|
|
pFitCreatorService = (TDbFittingCreatorService*)acrxServiceDictionary->at(sService);
|
|
if (pFitCreatorService != NULL)
|
|
{
|
|
TImpSpecEquipment* pNewFitting = NULL;
|
|
pNewFitting = pFitCreatorService->CreateSpecialEquipment(&m_XDataMap,m_pOwnerEnt);
|
|
if (pNewFitting != NULL)
|
|
{
|
|
if (m_pSpecEquipment != NULL)
|
|
m_pSpecEquipment->Destroy();
|
|
m_pSpecEquipment = pNewFitting;
|
|
return TRUE;
|
|
}
|
|
}
|
|
return FALSE;
|
|
}
|
|
|
|
BOOL TDbImpEquipment::OPMInfo(LPCTSTR pszName, TDb::OPMInfo* pInfo)
|
|
{
|
|
if (m_pSpecEquipment != NULL)
|
|
{
|
|
return m_pSpecEquipment->OPMInfo(pszName, pInfo);
|
|
}
|
|
|
|
return FALSE;
|
|
}
|
|
|
|
BOOL TDbImpEquipment::IsValid(TDbXDataMap* pXMap)
|
|
{
|
|
if (m_pSpecEquipment != NULL)
|
|
{
|
|
return m_pSpecEquipment->IsValid(pXMap);
|
|
}
|
|
|
|
return FALSE;
|
|
}
|
|
|
|
void TDbImpEquipment::SetSubText(long i,CString sText)
|
|
{
|
|
if (m_pSpecEquipment != NULL)
|
|
{
|
|
m_pSpecEquipment->SetSubText(i,sText);
|
|
}
|
|
}
|
|
|
|
void TDbImpEquipment::OnSubErase( Adesk::Boolean erasing )
|
|
{
|
|
if (m_pSpecEquipment != NULL)
|
|
m_pSpecEquipment->OnSubErase(erasing);
|
|
}
|
|
|
|
LRESULT TDbImpEquipment::UserCall( long i,LPVOID pData )
|
|
{
|
|
if (m_pSpecEquipment != NULL)
|
|
return m_pSpecEquipment->UserCall(i, pData);
|
|
|
|
return 0l;
|
|
}
|
|
|
|
int TDbImpEquipment::GetXBaseShell(TXShell& xShell)
|
|
{
|
|
if (m_pSpecEquipment != NULL)
|
|
{
|
|
return m_pSpecEquipment->GetXBaseShell(xShell);
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
int TDbImpEquipment::GetBodyBox( AcDbExtents& ext ) const
|
|
{
|
|
if (m_pSpecEquipment != NULL)
|
|
{
|
|
return m_pSpecEquipment->GetBodyBox(ext);
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
CString TDbImpEquipment::GetXml(const AcGeMatrix3d& mat) const
|
|
{
|
|
return m_pSpecEquipment->GetXml(mat);
|
|
}
|
|
|
|
bool TDbImpEquipment::GetSection(const AcDbFace &face, const AcGeVector3d &vtPlaneSecDir,
|
|
std::vector<TObjSectionRecord> §ionRecord, AcDbVoidPtrArray& arFillPtrs) const
|
|
{
|
|
return m_pSpecEquipment->GetSection(face, vtPlaneSecDir, sectionRecord, arFillPtrs);
|
|
}
|
|
|
|
Acad::ErrorStatus TDbImpEquipment::GetExtents(TADSGePoint3d &ptLow, TADSGePoint3d &ptUp) const
|
|
{
|
|
return m_pSpecEquipment->GetExtents(ptLow, ptUp);
|
|
}
|
|
|
|
// add by hh 2014-08-06 支持设备与水管遮挡
|
|
Acad::ErrorStatus TDbImpEquipment::GetClipBoundary(TGGePoly2D& poly)const
|
|
{
|
|
if(NULL == m_pSpecEquipment)
|
|
return Acad::eNotImplementedYet;
|
|
return m_pSpecEquipment->GetClipBoundary(poly);
|
|
}
|
|
|
|
bool TDbImpEquipment::IsMeClip() const
|
|
{
|
|
if(NULL == m_pSpecEquipment)
|
|
return false;
|
|
return m_pSpecEquipment->IsMeClip();
|
|
}
|
|
|
|
bool TDbImpEquipment::IsClipMe(const TEntityBase* pEnt)const//ok是否被裁剪
|
|
{
|
|
if(NULL == m_pSpecEquipment)
|
|
return false;
|
|
return m_pSpecEquipment->IsClipMe(pEnt);
|
|
}
|