1170 lines
27 KiB
C++
1170 lines
27 KiB
C++
#include "StdAfx.h"
|
|
#include "StdArx.h"
|
|
#include "dbproxy.h"
|
|
#include "geassign.h"
|
|
#include "acgi.h"
|
|
#include "TDbFitting.h"
|
|
#include "TDbImpFitting.h"
|
|
#include "TGripImp.h"
|
|
|
|
// #define VERSION_TDBFITTINGBASE 1
|
|
#define VERSION_TDBFITTINGBASE 2 // change by hh 2013-9-2 TXDataMap改在底层中进行读写 暖通图纸版本升级到2
|
|
|
|
// TDb::GripAppData TDbFittingBase::s_gripAppData[10];
|
|
TDb::GripAppData TDbFittingBase::s_gripAppData[GRIP_MAXNUM_FITTING];
|
|
|
|
//{{AFX_ARX_MACRO
|
|
ACRX_DXF_DEFINE_MEMBERS( TDbFittingBase, TDbInterfacesObj,
|
|
AcDb::kDHL_CURRENT, AcDb::kMReleaseCurrent,
|
|
AcDbProxyEntity::kAllAllowedBits,
|
|
ATS_DBFITTINGBASE, "图形无法解析, 请下载上华软件|网址: www.shanghuasoft.com");
|
|
//}}AFX_ARX_MACRO
|
|
IMPLEMENT_TENTBASE(TDbFittingBase);
|
|
|
|
TDbFittingBase::TDbFittingBase()
|
|
{
|
|
//{{AFX_ARX_DATA_INIT(TDbFittingBase)
|
|
//}}AFX_ARX_DATA_INIT
|
|
m_pImpFitting = new TDbImpFitting(this);
|
|
}
|
|
|
|
TDbFittingBase::~TDbFittingBase()
|
|
{
|
|
if (m_pImpFitting != NULL)
|
|
{
|
|
delete m_pImpFitting;
|
|
}
|
|
}
|
|
|
|
BOOL TDbFittingBase::GetInterface(int nIndex,TInterface& pipeInterface) const
|
|
{
|
|
assertReadEnabled();
|
|
if (m_pImpFitting != NULL)
|
|
{
|
|
return m_pImpFitting->GetInterface(nIndex,pipeInterface);
|
|
}
|
|
return FALSE;
|
|
}
|
|
|
|
BOOL TDbFittingBase::GetInterface(const AcGePoint3d& ptCon,TInterface& pipeInterface) const
|
|
{
|
|
assertReadEnabled();
|
|
if (m_pImpFitting != NULL)
|
|
{
|
|
return m_pImpFitting->GetInterface(ptCon,pipeInterface);
|
|
}
|
|
return FALSE;
|
|
}
|
|
|
|
BOOL TDbFittingBase::HasInterface(const AcGePoint3d& ptCon,const AcGeVector3d& vtDir)
|
|
{
|
|
assertReadEnabled();
|
|
if (m_pImpFitting != NULL)
|
|
{
|
|
return m_pImpFitting->HasInterface(ptCon,vtDir);
|
|
}
|
|
return FALSE;
|
|
}
|
|
|
|
int TDbFittingBase::GetInterfaceCount() const
|
|
{
|
|
assertReadEnabled();
|
|
if (m_pImpFitting != NULL)
|
|
{
|
|
return m_pImpFitting->GetInterfaceCount();
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
BOOL TDbFittingBase::SetInterfaceRelation(const AcGePoint3d& ptConnect,const AcDbObjectId& idConnect)
|
|
{
|
|
assertWriteEnabled();
|
|
if (m_pImpFitting != NULL)
|
|
{
|
|
return m_pImpFitting->SetInterfaceRelation(ptConnect,idConnect);
|
|
}
|
|
return FALSE;
|
|
}
|
|
|
|
BOOL TDbFittingBase::SetInterfaceRelation(const AcGePoint3d& ptConnect,const AcDbObjectId& idConnect1,const AcDbObjectId& idConnect2)
|
|
{
|
|
assertWriteEnabled();
|
|
if (m_pImpFitting != NULL)
|
|
{
|
|
return m_pImpFitting->SetInterfaceRelation(ptConnect,idConnect1,idConnect2);
|
|
}
|
|
return FALSE;
|
|
}
|
|
|
|
BOOL TDbFittingBase::RemoveInterfaceRelation(const AcGePoint3d& ptConnect,const AcDbObjectId& idConnect)
|
|
{
|
|
assertWriteEnabled();
|
|
if (m_pImpFitting != NULL)
|
|
{
|
|
return m_pImpFitting->RemoveInterfaceRelation(ptConnect,idConnect);
|
|
}
|
|
return FALSE;
|
|
}
|
|
|
|
BOOL TDbFittingBase::NotifyInterfaceToModify(const TInterfaceModifyMsg& iModiMsg,TInterfaceModifyMsgs& iModiMsgs)
|
|
{
|
|
assertWriteEnabled();
|
|
if (m_pImpFitting != NULL)
|
|
{
|
|
return m_pImpFitting->NotifyInterfaceToModify(iModiMsg,iModiMsgs);
|
|
}
|
|
return FALSE;
|
|
}
|
|
|
|
// TDbXDataMap* TDbFittingBase::GetSpecialtyData()
|
|
// {
|
|
// if (m_pImpFitting != NULL)
|
|
// {
|
|
// if (isWriteEnabled())
|
|
// {
|
|
// assertWriteEnabled();
|
|
// }
|
|
// else
|
|
// {
|
|
// assertReadEnabled();
|
|
// }
|
|
// return m_pImpFitting->GetSpecialtyData();
|
|
// }
|
|
// return NULL;
|
|
// }
|
|
//
|
|
// TDbXDataMap* TDbFittingBase::GetSpecialtyDataReadOnly() const
|
|
// {
|
|
// assertReadEnabled();
|
|
// if (m_pImpFitting != NULL)
|
|
// {
|
|
// return m_pImpFitting->GetSpecialtyData();
|
|
// }
|
|
// return NULL;
|
|
// }
|
|
|
|
void TDbFittingBase::GetKindName(CString& sName)
|
|
{
|
|
assertReadEnabled();
|
|
sName = _T("TCH_DBFITTING");
|
|
if (m_pImpFitting != NULL)
|
|
{
|
|
m_pImpFitting->GetKindName(sName);
|
|
}
|
|
}
|
|
|
|
BOOL TDbFittingBase::ReCreateByXDataMap()
|
|
{
|
|
assertWriteEnabled();
|
|
if (m_pImpFitting != NULL)
|
|
{
|
|
return m_pImpFitting->ReCreateByXDataMap();
|
|
}
|
|
return FALSE;
|
|
}
|
|
|
|
BOOL TDbFittingBase::AddCoverEdge(AcDbObjectId& id,TComplexCurve& curEdge)
|
|
{
|
|
assertWriteEnabled();
|
|
|
|
if (m_pImpFitting != NULL)
|
|
{
|
|
return m_pImpFitting->AddCoverEdge(id,curEdge);
|
|
}
|
|
return FALSE;
|
|
}
|
|
|
|
BOOL TDbFittingBase::RemoveCoverEdge(AcDbObjectId& id)
|
|
{
|
|
assertWriteEnabled();
|
|
if (m_pImpFitting != NULL)
|
|
{
|
|
return m_pImpFitting->RemoveCoverEdge(id);
|
|
}
|
|
return FALSE;
|
|
}
|
|
|
|
BOOL TDbFittingBase::GetCoverEdgeIds(AcDbObjectIdArray& arIds)
|
|
{
|
|
assertReadEnabled();
|
|
if (m_pImpFitting != NULL)
|
|
{
|
|
return m_pImpFitting->GetCoverEdgeIds(arIds);
|
|
}
|
|
return FALSE;
|
|
}
|
|
|
|
BOOL TDbFittingBase::AddIdsCoverByMe(AcDbObjectId& id)
|
|
{
|
|
assertWriteEnabled();
|
|
|
|
if (m_pImpFitting != NULL)
|
|
{
|
|
return m_pImpFitting->AddIdsCoverByMe(id);
|
|
}
|
|
return FALSE;
|
|
}
|
|
|
|
BOOL TDbFittingBase::GetIdsCoverByMe(AcDbObjectIdArray& arByMeIds)
|
|
{
|
|
assertReadEnabled();
|
|
if (m_pImpFitting != NULL)
|
|
{
|
|
return m_pImpFitting->GetIdsCoverByMe(arByMeIds);
|
|
}
|
|
return FALSE;
|
|
}
|
|
|
|
BOOL TDbFittingBase::GetGeomExtentsEdge(TComplexCurve& crLoop)
|
|
{
|
|
assertReadEnabled();
|
|
if (m_pImpFitting != NULL)
|
|
{
|
|
return m_pImpFitting->GetGeomExtentsEdge(crLoop);
|
|
}
|
|
return FALSE;
|
|
}
|
|
|
|
Acad::ErrorStatus TDbFittingBase::setNormal(const AcGeVector3d& vtNorm)
|
|
{
|
|
assertWriteEnabled();
|
|
if (m_pImpFitting != NULL)
|
|
{
|
|
return m_pImpFitting->setNormal(vtNorm);
|
|
}
|
|
return Acad::eOk;
|
|
}
|
|
|
|
AcGeVector3d TDbFittingBase::normal() const
|
|
{
|
|
assertReadEnabled();
|
|
if (m_pImpFitting != NULL)
|
|
{
|
|
return m_pImpFitting->normal();
|
|
}
|
|
return AcGeVector3d::kZAxis;
|
|
}
|
|
|
|
Acad::ErrorStatus TDbFittingBase::copyFrom(const AcRxObject* pSrc)
|
|
{
|
|
assertWriteEnabled();
|
|
|
|
TDbInterfacesObj::copyFrom(pSrc);
|
|
|
|
Acad::ErrorStatus eState = Acad::eNotImplementedYet;
|
|
if (m_pImpFitting != NULL)
|
|
{
|
|
TDbFittingBase* pFitting = TDbFittingBase::cast(pSrc);
|
|
if (pFitting != NULL)
|
|
{
|
|
eState = m_pImpFitting->copyFrom(pFitting->m_pImpFitting);
|
|
|
|
if (cloneMeForDragging())
|
|
m_pImpFitting->GetSpecialtyData()->SetAt(KEY_THISID,pFitting->objectId());
|
|
}
|
|
}
|
|
return Acad::eOk;
|
|
}
|
|
|
|
void TDbFittingBase::subList() const
|
|
{
|
|
assertReadEnabled();
|
|
|
|
TDbInterfacesObj::subList();
|
|
if (m_pImpFitting != NULL)
|
|
{
|
|
m_pImpFitting->list();
|
|
}
|
|
}
|
|
|
|
Acad::ErrorStatus TDbFittingBase::subDeepClone( AcDbObject* pOwnerObject,
|
|
AcDbObject*& pClonedObject,
|
|
AcDbIdMapping& idMap,
|
|
Adesk::Boolean isPrimary) const
|
|
{
|
|
assertReadEnabled();
|
|
|
|
Acad::ErrorStatus es = TDbInterfacesObj::subDeepClone(pOwnerObject,pClonedObject,idMap,isPrimary);
|
|
if (pClonedObject != NULL)
|
|
{
|
|
TDbFittingBase* pFitt = TDbFittingBase::cast(pClonedObject);
|
|
if (pFitt != NULL)
|
|
{
|
|
pFitt->UserCall(KEY_USER_CALL, NULL); // 目前仅用于暖通法兰,删除接口。mcl 090916
|
|
pFitt->GetSpecialtyData()->SetAt(KEY_DEEPCLONEFLAG, 1);
|
|
}
|
|
}
|
|
if (pClonedObject != NULL)
|
|
{
|
|
TDbFittingBase* pBase = TDbFittingBase::cast(pClonedObject);
|
|
if (pBase != NULL)
|
|
{
|
|
TDbXDataMap* pMapClone = NULL;
|
|
TDbXDataMap* pMapThis = m_pImpFitting->GetSpecialtyData();
|
|
|
|
if ( pBase->m_pImpFitting != NULL)
|
|
{
|
|
pMapClone = pBase->m_pImpFitting->GetSpecialtyData();
|
|
}
|
|
|
|
if ( pMapThis != NULL)
|
|
{
|
|
pMapThis->BeginCloneXlation(pMapClone,idMap);
|
|
}
|
|
}
|
|
}
|
|
return es;
|
|
}
|
|
|
|
|
|
Acad::ErrorStatus TDbFittingBase::subWblockClone( AcRxObject* pOwnerObject,
|
|
AcDbObject*& pClonedObject,
|
|
AcDbIdMapping& idMap,
|
|
Adesk::Boolean isPrimary) const
|
|
{
|
|
|
|
assertReadEnabled();
|
|
|
|
Acad::ErrorStatus es = TDbInterfacesObj::subWblockClone(pOwnerObject, pClonedObject, idMap, isPrimary);
|
|
if (pClonedObject != NULL)
|
|
{
|
|
TDbFittingBase* pBase = TDbFittingBase::cast(pClonedObject);
|
|
if (pBase != NULL)
|
|
{
|
|
TDbXDataMap* pMapClone = NULL;
|
|
TDbXDataMap* pMapThis = m_pImpFitting->GetSpecialtyData();
|
|
|
|
if ( pBase->m_pImpFitting != NULL)
|
|
{
|
|
pMapClone = pBase->m_pImpFitting->GetSpecialtyData();
|
|
}
|
|
|
|
if ( pMapThis != NULL)
|
|
{
|
|
pMapThis->BeginCloneXlation(pMapClone,idMap);
|
|
}
|
|
}
|
|
}
|
|
return Acad::eOk;
|
|
}
|
|
|
|
Acad::ErrorStatus TDbFittingBase::dwgInFields(AcDbDwgFiler* pFiler)
|
|
{
|
|
assertWriteEnabled();
|
|
Acad::ErrorStatus es;
|
|
|
|
// Call dwgInFields from TDbInterfacesObj
|
|
if ((es = TDbInterfacesObj::dwgInFields(pFiler)) != Acad::eOk)
|
|
{
|
|
return es;
|
|
}
|
|
|
|
// Read version number.
|
|
Adesk::UInt16 version;
|
|
pFiler->readItem(&version);
|
|
if (version > VERSION_TDBFITTINGBASE)
|
|
return Acad::eMakeMeProxy;
|
|
|
|
AcDbSoftPointerId idThis;
|
|
/*switch (version)
|
|
{
|
|
case (1):
|
|
{
|
|
pFiler->readItem(&idThis);
|
|
m_pImpFitting->dwgInFields(pFiler);
|
|
if (m_pImpFitting->GetSpecialtyData() != NULL)
|
|
{
|
|
m_pImpFitting->GetSpecialtyData()->SetAt(KEY_THISID,idThis);
|
|
}
|
|
break;
|
|
}
|
|
default:
|
|
break;
|
|
}*/
|
|
|
|
// add by hh 2013-9-2 设置图纸版本 用于在Imp类中处理版本问题
|
|
pFiler->readItem(&idThis);
|
|
m_pImpFitting->SetVersion(version);
|
|
m_pImpFitting->dwgInFields(pFiler);
|
|
if(2 > version)
|
|
{
|
|
if (m_pImpFitting->GetSpecialtyData() != NULL)
|
|
{
|
|
m_pImpFitting->GetSpecialtyData()->SetAt(KEY_THISID,idThis);
|
|
}
|
|
}
|
|
|
|
return pFiler->filerStatus();
|
|
}
|
|
|
|
Acad::ErrorStatus TDbFittingBase::dwgOutFields(AcDbDwgFiler* pFiler) const
|
|
{
|
|
assertReadEnabled();
|
|
Acad::ErrorStatus es;
|
|
|
|
// Call dwgOutFields from TDbInterfacesObj
|
|
if ((es = TDbInterfacesObj::dwgOutFields(pFiler)) != Acad::eOk)
|
|
{
|
|
return es;
|
|
}
|
|
|
|
// Write version number.
|
|
// change by hh 2013-9-2 另存为9以下图纸时,版本号置为1
|
|
// pFiler->writeItem((Adesk::UInt16) VERSION_TDBFITTINGBASE);
|
|
if (g_nSaveTArchVer <= 9)
|
|
pFiler->writeItem((Adesk::UInt16) 1);
|
|
else
|
|
pFiler->writeItem((Adesk::UInt16) VERSION_TDBFITTINGBASE);
|
|
|
|
pFiler->writeItem(AcDbSoftPointerId(objectId()));
|
|
m_pImpFitting->dwgOutFields(pFiler);
|
|
|
|
return pFiler->filerStatus();
|
|
}
|
|
|
|
Acad::ErrorStatus TDbFittingBase::dxfInFields(AcDbDxfFiler* pFiler)
|
|
{
|
|
assertWriteEnabled();
|
|
struct resbuf rb;
|
|
|
|
if ((TDbInterfacesObj::dxfInFields(pFiler) != Acad::eOk) ||
|
|
!pFiler->atSubclassData(_T("TDbFittingBase")))
|
|
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_TDBFITTINGBASE)
|
|
return Acad::eMakeMeProxy;
|
|
}
|
|
return pFiler->filerStatus();
|
|
}
|
|
|
|
Acad::ErrorStatus TDbFittingBase::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("TDbFittingBase"));
|
|
|
|
// Write version number.
|
|
pFiler->writeItem(AcDb::kDxfInt16, (Adesk::UInt16) VERSION_TDBFITTINGBASE);
|
|
return es;
|
|
}
|
|
|
|
Acad::ErrorStatus TDbFittingBase::extend(Adesk::Boolean extendStart,
|
|
const AcGePoint3d& toPoint)
|
|
{
|
|
assertWriteEnabled();
|
|
|
|
if (m_pImpFitting != NULL)
|
|
{
|
|
return m_pImpFitting->extend(extendStart,toPoint);
|
|
}
|
|
return Acad::eOk;
|
|
}
|
|
|
|
Acad::ErrorStatus TDbFittingBase::extend(double newParam)
|
|
{
|
|
assertWriteEnabled();
|
|
|
|
if (m_pImpFitting != NULL)
|
|
{
|
|
m_pImpFitting->extend(newParam);
|
|
}
|
|
return Acad::eOk;
|
|
}
|
|
|
|
Acad::ErrorStatus TDbFittingBase::subGetClassID(CLSID* pClsid) const
|
|
{
|
|
assertReadEnabled();
|
|
if (m_pImpFitting != NULL)
|
|
{
|
|
m_pImpFitting->getClassID(pClsid);
|
|
}
|
|
return Acad::eOk;
|
|
}
|
|
|
|
Acad::ErrorStatus TDbFittingBase::getClosestPointTo(const AcGePoint3d& givenPnt,
|
|
AcGePoint3d& pointOnCurve,
|
|
Adesk::Boolean extend) const
|
|
{
|
|
assertReadEnabled();
|
|
|
|
if (m_pImpFitting != NULL)
|
|
{
|
|
return m_pImpFitting->getClosestPointTo(givenPnt,pointOnCurve,extend);
|
|
}
|
|
return Acad::eInvalidInput;
|
|
}
|
|
|
|
Acad::ErrorStatus TDbFittingBase::getClosestPointTo(const AcGePoint3d& givenPnt,
|
|
const AcGeVector3d& direction,
|
|
AcGePoint3d& pointOnCurve,
|
|
Adesk::Boolean extend) const
|
|
{
|
|
assertReadEnabled();
|
|
|
|
if (m_pImpFitting != NULL)
|
|
{
|
|
return m_pImpFitting->getClosestPointTo(givenPnt,direction,pointOnCurve,extend);
|
|
}
|
|
return Acad::eInvalidInput;
|
|
}
|
|
|
|
Acad::ErrorStatus TDbFittingBase::getDistAtParam(double param,
|
|
double& dist) const
|
|
{
|
|
assertReadEnabled();
|
|
|
|
if (m_pImpFitting != NULL)
|
|
{
|
|
return m_pImpFitting->getDistAtParam(param,dist);
|
|
}
|
|
return Acad::eInvalidInput;
|
|
}
|
|
|
|
Acad::ErrorStatus TDbFittingBase::getDistAtPoint(const AcGePoint3d& x0,
|
|
double& x1)const
|
|
{
|
|
assertReadEnabled();
|
|
|
|
if (m_pImpFitting != NULL)
|
|
{
|
|
return m_pImpFitting->getDistAtPoint(x0,x1);
|
|
}
|
|
return Acad::eInvalidInput;
|
|
}
|
|
|
|
Acad::ErrorStatus TDbFittingBase::getEndParam(double& x0) const
|
|
{
|
|
assertReadEnabled();
|
|
|
|
if (m_pImpFitting != NULL)
|
|
{
|
|
return m_pImpFitting->getEndParam(x0);
|
|
}
|
|
return Acad::eInvalidInput;
|
|
}
|
|
|
|
Acad::ErrorStatus TDbFittingBase::getEndPoint(AcGePoint3d& x0) const
|
|
{
|
|
assertReadEnabled();
|
|
if (m_pImpFitting != NULL)
|
|
{
|
|
return m_pImpFitting->getEndPoint(x0);
|
|
}
|
|
return Acad::eInvalidInput;
|
|
}
|
|
|
|
Acad::ErrorStatus TDbFittingBase::getFirstDeriv(const AcGePoint3d& x0,
|
|
AcGeVector3d& firstDeriv) const
|
|
{
|
|
assertReadEnabled();
|
|
if (m_pImpFitting != NULL)
|
|
{
|
|
return m_pImpFitting->getFirstDeriv(x0,firstDeriv);
|
|
}
|
|
return Acad::eInvalidInput;
|
|
}
|
|
|
|
Acad::ErrorStatus TDbFittingBase::getFirstDeriv(double param,
|
|
AcGeVector3d& firstDeriv) const
|
|
{
|
|
assertReadEnabled();
|
|
if (m_pImpFitting != NULL)
|
|
{
|
|
return m_pImpFitting->getFirstDeriv(param,firstDeriv);
|
|
}
|
|
return Acad::eInvalidInput;
|
|
}
|
|
|
|
Acad::ErrorStatus TDbFittingBase::subGetGeomExtents(AcDbExtents& extents) const
|
|
{
|
|
assertReadEnabled();
|
|
if (m_pImpFitting != NULL)
|
|
{
|
|
return m_pImpFitting->getGeomExtents(extents);
|
|
}
|
|
return Acad::eInvalidInput;
|
|
}
|
|
|
|
Acad::ErrorStatus TDbFittingBase::subGetGripPoints(AcGePoint3dArray& gripPoints,
|
|
AcDbIntArray& osnapModes,
|
|
AcDbIntArray& geomIds) const
|
|
{
|
|
assertReadEnabled();
|
|
#if ADS==15
|
|
if (m_pImpFitting != NULL)
|
|
{
|
|
return m_pImpFitting->getGripPoints(gripPoints,osnapModes,geomIds);
|
|
}
|
|
#endif
|
|
return Acad::eInvalidInput;
|
|
}
|
|
|
|
Acad::ErrorStatus TDbFittingBase::subMoveGripPointsAt(const AcDbIntArray& indices,
|
|
const AcGeVector3d& offset)
|
|
{
|
|
assertWriteEnabled();
|
|
|
|
if (m_pImpFitting != NULL)
|
|
{
|
|
// mcl add.2010.11.08 忽略z标高差
|
|
if(TAuxTools::Is2DView())
|
|
{
|
|
AcGeVector3d vtNoneZ = offset.orthoProject(TAuxTools::GetUcsZvt());
|
|
return m_pImpFitting->moveGripPointsAt(indices, vtNoneZ);
|
|
}
|
|
else
|
|
return m_pImpFitting->moveGripPointsAt(indices,offset);
|
|
}
|
|
return Acad::eInvalidInput;
|
|
}
|
|
|
|
#if ADS>15
|
|
Acad::ErrorStatus TDbFittingBase::subGetGripPoints(AcDbGripDataPtrArray& grips,
|
|
const double viewSize,
|
|
const int gripSize,
|
|
const AcGeVector3d& curViewDir,
|
|
const int bitflags) const
|
|
{
|
|
|
|
assertReadEnabled();
|
|
if (m_pImpFitting != NULL)
|
|
{
|
|
AcDbIntArray osnapModes;
|
|
AcDbIntArray geomIds;
|
|
AcGePoint3dArray gripPoints;
|
|
Acad::ErrorStatus eSta = m_pImpFitting->getGripPoints(gripPoints,osnapModes,geomIds);
|
|
|
|
AcDbGripData* pGripData = NULL;
|
|
TDb::Position ePos;
|
|
|
|
CString sCmd = _T("");
|
|
GetGlobalContext(KEY_CABGRIPCMD,sCmd);
|
|
|
|
// for (int i = 0;i < gripPoints.length();i++) // mcl changed by below .检查夹点数目
|
|
for (int i = 0;i < gripPoints.length() && i < GRIP_MAXNUM_FITTING; i++)
|
|
{
|
|
ePos = m_pImpFitting->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 TDbFittingBase::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_pImpFitting != NULL)
|
|
{
|
|
// mcl add.2010.09.21 忽略z标高差
|
|
if(TAuxTools::Is2DView())
|
|
{
|
|
AcGeVector3d vtNoneZ = offset.orthoProject(TAuxTools::GetUcsZvt());
|
|
eSta = m_pImpFitting->moveGripPointsAt(arIndex, vtNoneZ);
|
|
}
|
|
else
|
|
eSta = m_pImpFitting->moveGripPointsAt(arIndex,offset);
|
|
}
|
|
return eSta;
|
|
}
|
|
#endif
|
|
|
|
Acad::ErrorStatus TDbFittingBase::getOffsetCurves(double offsetDist,
|
|
AcDbVoidPtrArray& offsetCurves) const
|
|
{
|
|
assertReadEnabled();
|
|
if (m_pImpFitting != NULL)
|
|
{
|
|
return m_pImpFitting->getOffsetCurves(offsetDist,offsetCurves);
|
|
}
|
|
return Acad::eInvalidInput;
|
|
}
|
|
|
|
Acad::ErrorStatus TDbFittingBase::subGetOsnapPoints(AcDb::OsnapMode osnapMode,
|
|
INT_PTR gsSelectionMark,
|
|
const AcGePoint3d& pickPoint,
|
|
const AcGePoint3d& lastPoint,
|
|
const AcGeMatrix3d& viewXform,
|
|
AcGePoint3dArray& snapPoints,
|
|
AcDbIntArray& geomIds) const
|
|
{
|
|
assertReadEnabled();
|
|
if (m_pImpFitting != NULL)
|
|
{
|
|
return m_pImpFitting->getOsnapPoints(osnapMode,gsSelectionMark,pickPoint,
|
|
lastPoint,viewXform,snapPoints,geomIds);
|
|
}
|
|
return Acad::eInvalidInput;
|
|
}
|
|
|
|
Acad::ErrorStatus TDbFittingBase::getParamAtDist(double dist,
|
|
double& param) const
|
|
{
|
|
assertReadEnabled();
|
|
if (m_pImpFitting != NULL)
|
|
{
|
|
return m_pImpFitting->getParamAtDist(dist,param);
|
|
}
|
|
return Acad::eInvalidInput;
|
|
}
|
|
|
|
Acad::ErrorStatus TDbFittingBase::getParamAtPoint(const AcGePoint3d& x0,
|
|
double& x1)const
|
|
{
|
|
assertReadEnabled();
|
|
|
|
if (m_pImpFitting != NULL)
|
|
{
|
|
return m_pImpFitting->getParamAtPoint(x0,x1);
|
|
}
|
|
return Acad::eInvalidInput;
|
|
}
|
|
|
|
Acad::ErrorStatus TDbFittingBase::getPointAtDist(double x0,
|
|
AcGePoint3d& x1) const
|
|
{
|
|
assertReadEnabled();
|
|
if (m_pImpFitting != NULL)
|
|
{
|
|
return m_pImpFitting->getPointAtDist(x0,x1);
|
|
}
|
|
return Acad::eInvalidInput;
|
|
}
|
|
|
|
Acad::ErrorStatus TDbFittingBase::getPointAtParam(double x0,
|
|
AcGePoint3d& x1) const
|
|
{
|
|
assertReadEnabled();
|
|
if (m_pImpFitting != NULL)
|
|
{
|
|
return m_pImpFitting->getPointAtParam(x0,x1);
|
|
}
|
|
return Acad::eInvalidInput;
|
|
}
|
|
|
|
Acad::ErrorStatus TDbFittingBase::getSplitCurves(const AcGeDoubleArray& params,
|
|
AcDbVoidPtrArray& curveSegments) const
|
|
{
|
|
assertReadEnabled();
|
|
if (m_pImpFitting != NULL)
|
|
{
|
|
return m_pImpFitting->getSplitCurves(params,curveSegments);
|
|
}
|
|
return Acad::eInvalidInput;
|
|
}
|
|
|
|
Acad::ErrorStatus TDbFittingBase::getSplitCurves(const AcGePoint3dArray& points,
|
|
AcDbVoidPtrArray& curveSegments) const
|
|
{
|
|
assertReadEnabled();
|
|
if (m_pImpFitting != NULL)
|
|
{
|
|
return m_pImpFitting->getSplitCurves(points,curveSegments);
|
|
}
|
|
return Acad::eInvalidInput;
|
|
}
|
|
|
|
Acad::ErrorStatus TDbFittingBase::getStartParam(double& x0) const
|
|
{
|
|
assertReadEnabled();
|
|
if (m_pImpFitting != NULL)
|
|
{
|
|
return m_pImpFitting->getStartParam(x0);
|
|
}
|
|
return Acad::eInvalidInput;
|
|
}
|
|
|
|
Acad::ErrorStatus TDbFittingBase::getStartPoint(AcGePoint3d& x0) const
|
|
{
|
|
assertReadEnabled();
|
|
if (m_pImpFitting != NULL)
|
|
{
|
|
return m_pImpFitting->getStartPoint(x0);
|
|
}
|
|
return Acad::eInvalidInput;
|
|
}
|
|
|
|
Acad::ErrorStatus TDbFittingBase::subGetStretchPoints(AcGePoint3dArray& stretchPoints) const
|
|
{
|
|
assertReadEnabled();
|
|
if (m_pImpFitting != NULL)
|
|
{
|
|
return m_pImpFitting->getStretchPoints(stretchPoints);
|
|
}
|
|
return Acad::eInvalidInput;
|
|
}
|
|
|
|
Acad::ErrorStatus TDbFittingBase::subGetTransformedCopy(const AcGeMatrix3d& xform,AcDbEntity*& pEnt) const
|
|
{
|
|
assertReadEnabled();
|
|
|
|
pEnt = new TDbFittingBase;
|
|
(TDbFittingBase*)pEnt->copyFrom(this);
|
|
pEnt->transformBy(xform);
|
|
|
|
return Acad::eOk;
|
|
}
|
|
|
|
Acad::ErrorStatus TDbFittingBase::subIntersectWith( const AcDbEntity* pEnt,
|
|
AcDb::Intersect intType,
|
|
AcGePoint3dArray& points,
|
|
INT_PTR thisGsMarker,
|
|
INT_PTR otherGsMarker) const
|
|
{
|
|
assertReadEnabled();
|
|
|
|
if (m_pImpFitting != NULL)
|
|
{
|
|
return m_pImpFitting->intersectWith(pEnt,intType,
|
|
points,thisGsMarker,
|
|
otherGsMarker);
|
|
}
|
|
return Acad::eInvalidInput;
|
|
}
|
|
|
|
Acad::ErrorStatus TDbFittingBase::subIntersectWith( const AcDbEntity* pEnt,
|
|
AcDb::Intersect intType,
|
|
const AcGePlane& projPlane,
|
|
AcGePoint3dArray& points,
|
|
INT_PTR thisGsMarker,
|
|
INT_PTR otherGsMarker) const
|
|
{
|
|
assertReadEnabled();
|
|
if (m_pImpFitting != NULL)
|
|
{
|
|
return m_pImpFitting->intersectWith(pEnt,intType,projPlane,points,thisGsMarker,otherGsMarker);
|
|
}
|
|
return Acad::eInvalidInput;
|
|
}
|
|
|
|
Acad::ErrorStatus TDbFittingBase::subMoveStretchPointsAt(const AcDbIntArray& indices,
|
|
const AcGeVector3d& offset)
|
|
{
|
|
assertWriteEnabled();
|
|
if (m_pImpFitting != NULL)
|
|
{
|
|
// mcl add.2010.11.09 忽略z标高差
|
|
AcGeVector3d vtOffset = offset;
|
|
if(TAuxTools::Is2DView())
|
|
vtOffset = offset.orthoProject(TAuxTools::GetUcsZvt());
|
|
|
|
return m_pImpFitting->moveStretchPointsAt(indices, vtOffset);
|
|
}
|
|
return Acad::eInvalidInput;
|
|
}
|
|
|
|
Acad::ErrorStatus TDbFittingBase::subTransformBy(const AcGeMatrix3d& xform)
|
|
{
|
|
assertWriteEnabled();
|
|
if (m_pImpFitting != NULL)
|
|
{
|
|
m_pImpFitting->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_pImpFitting->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_pImpFitting->transformBy(mat);
|
|
}
|
|
else
|
|
return m_pImpFitting->transformBy(xform);
|
|
}
|
|
else
|
|
return m_pImpFitting->transformBy(xform);
|
|
}
|
|
return Acad::eNotImplementedYet;
|
|
}
|
|
|
|
Acad::ErrorStatus TDbFittingBase::ExplodeOrDraw2d(XExplodeDraw &mode) const
|
|
{
|
|
assertReadEnabled();
|
|
if (m_pImpFitting != NULL)
|
|
{
|
|
return m_pImpFitting->ExplodeOrDraw2d(mode);
|
|
}
|
|
return Acad::eNotImplementedYet;
|
|
}
|
|
|
|
Acad::ErrorStatus TDbFittingBase::ExplodeOrDraw3d(XExplodeDraw &mode) const
|
|
{
|
|
assertReadEnabled();
|
|
if (m_pImpFitting != NULL)
|
|
{
|
|
m_pImpFitting->ExplodeOrDraw3d(mode);
|
|
return Acad::eOk;
|
|
}
|
|
return Acad::eNotImplementedYet;
|
|
}
|
|
|
|
BOOL TDbFittingBase::MakeCurves(TComplexCurve& cplCurve) const
|
|
{
|
|
assertReadEnabled();
|
|
if (m_pImpFitting != NULL)
|
|
{
|
|
return m_pImpFitting->MakeCurves(cplCurve);
|
|
}
|
|
return FALSE;
|
|
}
|
|
|
|
BOOL TDbFittingBase::GetCurvesInSide(TComplexCurve& compCurve) const
|
|
{
|
|
assertReadEnabled();
|
|
if (m_pImpFitting != NULL)
|
|
{
|
|
return m_pImpFitting->GetCurvesInSide(compCurve);
|
|
}
|
|
return FALSE;
|
|
}
|
|
|
|
AcDbPolyline* TDbFittingBase::MakePolyCurve() const
|
|
{
|
|
assertReadEnabled();
|
|
if (m_pImpFitting != NULL)
|
|
{
|
|
return m_pImpFitting->MakePolyCurve();
|
|
}
|
|
return NULL;
|
|
}
|
|
|
|
BOOL TDbFittingBase::MakePolyCurveFaces(AcDbVoidPtrArray& arFaces)
|
|
{
|
|
assertReadEnabled();
|
|
if (m_pImpFitting != NULL)
|
|
{
|
|
return m_pImpFitting->MakePolyCurveFaces(arFaces);
|
|
}
|
|
return NULL;
|
|
}
|
|
|
|
void TDbFittingBase::GetTips(CMapStringToString& mapLable2Tip) const
|
|
{
|
|
assertReadEnabled();
|
|
if (m_pImpFitting != NULL)
|
|
{
|
|
m_pImpFitting->GetTips(mapLable2Tip);
|
|
}
|
|
}
|
|
|
|
TDb::Position TDbFittingBase::ExplainGripIndex(int nIndex) const
|
|
{
|
|
assertReadEnabled();
|
|
if (m_pImpFitting != NULL)
|
|
{
|
|
return m_pImpFitting->ExplainGripIndex(nIndex);
|
|
}
|
|
return TDb::eStart;
|
|
}
|
|
|
|
BOOL TDbFittingBase::OPMInfo(LPCTSTR pszName, TDb::OPMInfo* pInfo)
|
|
{
|
|
if (isWriteEnabled())
|
|
assertWriteEnabled();
|
|
else
|
|
assertReadEnabled();
|
|
|
|
if (m_pImpFitting != NULL)
|
|
{
|
|
return m_pImpFitting->OPMInfo(pszName, pInfo);
|
|
}
|
|
|
|
return FALSE;
|
|
}
|
|
|
|
BOOL TDbFittingBase::IsValid(TDbXDataMap* pXMap)
|
|
{
|
|
assertReadEnabled();
|
|
|
|
if (m_pImpFitting != NULL)
|
|
{
|
|
return m_pImpFitting->IsValid(pXMap);
|
|
}
|
|
|
|
return FALSE;
|
|
}
|
|
|
|
LRESULT TDbFittingBase::UserCall(long i,LPVOID pData)
|
|
{
|
|
assertWriteEnabled();
|
|
|
|
if (m_pImpFitting != NULL)
|
|
{
|
|
return m_pImpFitting->UserCall(i,pData);
|
|
}
|
|
return 0l;
|
|
}
|
|
|
|
Acad::ErrorStatus TDbFittingBase::subErase( Adesk::Boolean erasing )
|
|
{
|
|
Acad::ErrorStatus eState = TDbInterfacesObj::subErase(erasing);
|
|
if (eState == Acad::eOk)
|
|
{
|
|
if (m_pImpFitting != NULL)
|
|
m_pImpFitting->OnSubErase(erasing);
|
|
}
|
|
|
|
return eState;
|
|
}
|
|
|
|
int TDbFittingBase::GetXBaseShell(TXShell& xShell)
|
|
{
|
|
if (m_pImpFitting != NULL)
|
|
{
|
|
return m_pImpFitting->GetXBaseShell(xShell);
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
int TDbFittingBase::GetBodyBox(AcDbExtents& ext)
|
|
{
|
|
if (m_pImpFitting != NULL)
|
|
{
|
|
return m_pImpFitting->GetBodyBox(ext);
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
CString TDbFittingBase::GetXml(const AcGeMatrix3d& mat) const
|
|
{
|
|
if (m_pImpFitting == NULL)
|
|
return _T("");
|
|
|
|
TDbXDataMap* pMap = GetSpecialtyDataReadOnly();
|
|
if (NULL == pMap)
|
|
return _T("");
|
|
|
|
HvacModelType eType(TDb::eModel);
|
|
pMap->GetAt(HVAC_ModeType, (int&)eType);
|
|
if (TDb::eSystem == eType)
|
|
return _T("");
|
|
|
|
CString csXml = m_pImpFitting->GetXml(mat);
|
|
CString csBase = TEntityBase::GetXml(mat);
|
|
int nIndex = csXml.Find(_T("</TCH_"));
|
|
if (nIndex > -1)
|
|
csXml.Insert(nIndex, csBase);
|
|
|
|
return csXml;
|
|
}
|
|
|
|
bool TDbFittingBase::GetSection( const AcDbFace &face, const AcGeVector3d &vtPlaneSecDir,
|
|
std::vector<TObjSectionRecord> §ionRecord, AcDbVoidPtrArray& arFillPtrs ) const
|
|
{
|
|
if (m_pImpFitting != NULL)
|
|
return m_pImpFitting->GetSection(face, vtPlaneSecDir, sectionRecord, arFillPtrs);
|
|
|
|
return false;
|
|
}
|
|
|
|
Acad::ErrorStatus TDbFittingBase::GetExtents( TADSGePoint3d &ptLow, TADSGePoint3d &ptUp ) const
|
|
{
|
|
if (m_pImpFitting != NULL)
|
|
return m_pImpFitting->GetExtents(ptLow, ptUp);
|
|
|
|
return Acad::eNotImplementedYet;
|
|
}
|
|
|
|
// add by hh 2014-08-06 支持管件与水管遮挡
|
|
Acad::ErrorStatus TDbFittingBase::GetClipBoundary(TGGePoly2D& poly)const
|
|
{
|
|
if(NULL == m_pImpFitting)
|
|
return Acad::eNotImplementedYet;
|
|
|
|
return m_pImpFitting->GetClipBoundary(poly);
|
|
}
|
|
|
|
bool TDbFittingBase::IsMeClip() const
|
|
{
|
|
if(NULL == m_pImpFitting)
|
|
return false;
|
|
|
|
return m_pImpFitting->IsMeClip();
|
|
}
|
|
|
|
bool TDbFittingBase::IsClipMe(const TEntityBase* pEn)const//ok是否被裁剪
|
|
{
|
|
if(NULL == m_pImpFitting)
|
|
return false;
|
|
|
|
return m_pImpFitting->IsClipMe(pEn);
|
|
}
|