1051 lines
25 KiB
C++
1051 lines
25 KiB
C++
#include "stdafx.h"
|
|
#include "StdArx.h"
|
|
#include "dbproxy.h"
|
|
#include "geassign.h"
|
|
#include "acgi.h"
|
|
#include "TDbEquipment.h"
|
|
#include "TDbImpEquipment.h"
|
|
#include "TGripImp.h"
|
|
#include "dbobjptr.h"
|
|
|
|
#ifdef _DEBUG
|
|
#undef THIS_FILE
|
|
static char THIS_FILE[]=__FILE__;
|
|
#define new DEBUG_NEW
|
|
#endif
|
|
|
|
// #define VERSION_TDBEQUIPMENTBASE 1
|
|
#define VERSION_TDBEQUIPMENTBASE 2 // change by hh 2013-9-2 TXDataMap改在底层中进行读写 暖通图纸版本升级到2
|
|
|
|
//TDb::GripAppData TDbEquipmentBase::s_gripAppData[10]; mcl changed by below
|
|
TDb::GripAppData TDbEquipmentBase::s_gripAppData[GRIP_MAXNUM_EQUIP];
|
|
|
|
//{{AFX_ARX_MACRO
|
|
ACRX_DXF_DEFINE_MEMBERS( TDbEquipmentBase, TDbInterfacesObj,
|
|
AcDb::kDHL_CURRENT, AcDb::kMReleaseCurrent,
|
|
AcDbProxyEntity::kAllAllowedBits,
|
|
ATS_DBEQUIPMENTBASE, "图形无法解析, 请下载上华软件|网址: www.shanghuasoft.com");
|
|
//}}AFX_ARX_MACRO
|
|
IMPLEMENT_TENTBASE(TDbEquipmentBase);
|
|
|
|
TDbEquipmentBase::TDbEquipmentBase()
|
|
{
|
|
//{{AFX_ARX_DATA_INIT(TDbEquipmentBase)
|
|
//}}AFX_ARX_DATA_INIT
|
|
m_pImpEquipment = new TDbImpEquipment(this);
|
|
}
|
|
|
|
TDbEquipmentBase::~TDbEquipmentBase()
|
|
{
|
|
if (m_pImpEquipment != NULL)
|
|
delete m_pImpEquipment;
|
|
}
|
|
|
|
BOOL TDbEquipmentBase::GetInterface(int nIndex,TInterface& pipeInterface) const
|
|
{
|
|
assertReadEnabled();
|
|
if (m_pImpEquipment != NULL)
|
|
{
|
|
return m_pImpEquipment->GetInterface(nIndex,pipeInterface);
|
|
}
|
|
return FALSE;
|
|
}
|
|
|
|
BOOL TDbEquipmentBase::GetInterface(const AcGePoint3d& ptCon,TInterface& pipeInterface) const
|
|
{
|
|
assertReadEnabled();
|
|
if (m_pImpEquipment != NULL)
|
|
{
|
|
return m_pImpEquipment->GetInterface(ptCon,pipeInterface);
|
|
}
|
|
return FALSE;
|
|
}
|
|
|
|
BOOL TDbEquipmentBase::HasInterface(const AcGePoint3d& ptCon,const AcGeVector3d& vtDir)
|
|
{
|
|
assertReadEnabled();
|
|
if (m_pImpEquipment != NULL)
|
|
{
|
|
return m_pImpEquipment->HasInterface(ptCon,vtDir);
|
|
}
|
|
return FALSE;
|
|
}
|
|
|
|
int TDbEquipmentBase::GetInterfaceCount() const
|
|
{
|
|
assertReadEnabled();
|
|
if (m_pImpEquipment != NULL)
|
|
{
|
|
return m_pImpEquipment->GetInterfaceCount();
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
BOOL TDbEquipmentBase::SetInterfaceRelation(const AcGePoint3d& ptConnect,const AcDbObjectId& idConnect)
|
|
{
|
|
assertWriteEnabled();
|
|
if (m_pImpEquipment != NULL)
|
|
{
|
|
return m_pImpEquipment->SetInterfaceRelation(ptConnect,idConnect);
|
|
}
|
|
return FALSE;
|
|
}
|
|
|
|
BOOL TDbEquipmentBase::RemoveInterfaceRelation(const AcGePoint3d& ptConnect,const AcDbObjectId& idConnect)
|
|
{
|
|
assertWriteEnabled();
|
|
if (m_pImpEquipment != NULL)
|
|
{
|
|
return m_pImpEquipment->RemoveInterfaceRelation(ptConnect,idConnect);
|
|
}
|
|
return FALSE;
|
|
}
|
|
|
|
BOOL TDbEquipmentBase::NotifyInterfaceToModify(const TInterfaceModifyMsg& iModiMsg,TInterfaceModifyMsgs& iModiMsgs)
|
|
{
|
|
assertWriteEnabled();
|
|
if (m_pImpEquipment != NULL)
|
|
{
|
|
return m_pImpEquipment->NotifyInterfaceToModify(iModiMsg,iModiMsgs);
|
|
}
|
|
return FALSE;
|
|
}
|
|
|
|
// TDbXDataMap* TDbEquipmentBase::GetSpecialtyData()
|
|
// {
|
|
// if (m_pImpEquipment != NULL)
|
|
// {
|
|
// if (isWriteEnabled())
|
|
// {
|
|
// assertWriteEnabled();
|
|
// }
|
|
// else
|
|
// {
|
|
// assertReadEnabled();
|
|
// }
|
|
// return m_pImpEquipment->GetSpecialtyData();
|
|
// }
|
|
// return NULL;
|
|
// }
|
|
//
|
|
// TDbXDataMap* TDbEquipmentBase::GetSpecialtyDataReadOnly() const
|
|
// {
|
|
// assertReadEnabled();
|
|
// if (m_pImpEquipment != NULL)
|
|
// {
|
|
// return m_pImpEquipment->GetSpecialtyData();
|
|
// }
|
|
// return NULL;
|
|
// }
|
|
|
|
BOOL TDbEquipmentBase::AddCoverEdge(AcDbObjectId& id,TComplexCurve& curEdge)
|
|
{
|
|
assertWriteEnabled();
|
|
|
|
if (m_pImpEquipment != NULL)
|
|
return m_pImpEquipment->AddCoverEdge(id, curEdge);
|
|
|
|
return FALSE;
|
|
}
|
|
|
|
BOOL TDbEquipmentBase::RemoveCoverEdge(AcDbObjectId& id)
|
|
{
|
|
assertWriteEnabled();
|
|
|
|
if (m_pImpEquipment != NULL)
|
|
return m_pImpEquipment->RemoveCoverEdge(id);
|
|
|
|
return FALSE;
|
|
}
|
|
|
|
BOOL TDbEquipmentBase::GetGeomExtentsEdge(TComplexCurve& crLoop)
|
|
{
|
|
assertReadEnabled();
|
|
if (m_pImpEquipment != NULL)
|
|
return m_pImpEquipment->GetGeomExtentsEdge(crLoop);
|
|
|
|
return FALSE;
|
|
}
|
|
|
|
BOOL TDbEquipmentBase::GetCoverEdgeIds(AcDbObjectIdArray& arIds)
|
|
{
|
|
assertReadEnabled();
|
|
if (m_pImpEquipment != NULL)
|
|
return m_pImpEquipment->GetCoverEdgeIds(arIds);
|
|
|
|
return FALSE;
|
|
}
|
|
|
|
BOOL TDbEquipmentBase::AddIdsCoverByMe(AcDbObjectId& id)
|
|
{
|
|
assertWriteEnabled();
|
|
|
|
if (m_pImpEquipment != NULL)
|
|
return m_pImpEquipment->AddIdsCoverByMe(id);
|
|
|
|
return FALSE;
|
|
}
|
|
|
|
BOOL TDbEquipmentBase::GetIdsCoverByMe(AcDbObjectIdArray& arByMeIds)
|
|
{
|
|
assertReadEnabled();
|
|
|
|
if (m_pImpEquipment != NULL)
|
|
return m_pImpEquipment->GetIdsCoverByMe(arByMeIds);
|
|
|
|
return FALSE;
|
|
}
|
|
|
|
BOOL TDbEquipmentBase::ReCreateByXDataMap()
|
|
{
|
|
assertWriteEnabled();
|
|
if (m_pImpEquipment != NULL)
|
|
{
|
|
return m_pImpEquipment->ReCreateByXDataMap();
|
|
}
|
|
return FALSE;
|
|
}
|
|
|
|
Acad::ErrorStatus TDbEquipmentBase::setNormal(const AcGeVector3d& vtNorm)
|
|
{
|
|
assertWriteEnabled();
|
|
if (m_pImpEquipment != NULL)
|
|
{
|
|
return m_pImpEquipment->setNormal(vtNorm);
|
|
}
|
|
return Acad::eNotImplementedYet;
|
|
}
|
|
|
|
AcGeVector3d TDbEquipmentBase::normal() const
|
|
{
|
|
assertReadEnabled();
|
|
if (m_pImpEquipment != NULL)
|
|
{
|
|
return m_pImpEquipment->normal();
|
|
}
|
|
return AcGeVector3d::kZAxis;
|
|
}
|
|
|
|
TDb::Position TDbEquipmentBase::ExplainGripIndex(int nIndex) const
|
|
{
|
|
if (m_pImpEquipment != NULL)
|
|
{
|
|
return m_pImpEquipment->ExplainGripIndex(nIndex);
|
|
}
|
|
return TDb::eStart;
|
|
}
|
|
|
|
Acad::ErrorStatus TDbEquipmentBase::GetGripText(int i, CString &cs) const
|
|
{
|
|
assertReadEnabled();
|
|
if (m_pImpEquipment != NULL)
|
|
{
|
|
m_pImpEquipment->GetGripText(i,cs);
|
|
}
|
|
return Acad::eOk;
|
|
}
|
|
|
|
void TDbEquipmentBase::GetTips(CMapStringToString& mapLable2Tip) const
|
|
{
|
|
assertReadEnabled();
|
|
if (m_pImpEquipment != NULL)
|
|
{
|
|
m_pImpEquipment->GetTips(mapLable2Tip);
|
|
}
|
|
}
|
|
|
|
Acad::ErrorStatus TDbEquipmentBase::SetTransform(const AcGeMatrix3d& xform)
|
|
{
|
|
assertWriteEnabled();
|
|
if (m_pImpEquipment != NULL)
|
|
{
|
|
return m_pImpEquipment->SetTransform(xform);
|
|
}
|
|
return Acad::eOutOfMemory;
|
|
}
|
|
|
|
AcGeMatrix3d TDbEquipmentBase::GetTransform() const
|
|
{
|
|
assertReadEnabled();
|
|
if (m_pImpEquipment != NULL)
|
|
{
|
|
return m_pImpEquipment->GetTransform();
|
|
}
|
|
return AcGeMatrix3d::kIdentity;
|
|
}
|
|
|
|
|
|
|
|
Acad::ErrorStatus TDbEquipmentBase::copyFrom(const AcRxObject* pSrc)
|
|
{
|
|
assertWriteEnabled();
|
|
|
|
TDbInterfacesObj::copyFrom(pSrc);
|
|
|
|
Acad::ErrorStatus eState = Acad::eNotImplementedYet;
|
|
if (m_pImpEquipment != NULL)
|
|
{
|
|
TDbEquipmentBase* pFitting = TDbEquipmentBase::cast(pSrc);
|
|
if (pFitting != NULL)
|
|
{
|
|
eState = m_pImpEquipment->copyFrom(pFitting->m_pImpEquipment);
|
|
|
|
if (cloneMeForDragging())
|
|
m_pImpEquipment->GetSpecialtyData()->SetAt(KEY_THISID,pFitting->objectId());
|
|
}
|
|
}
|
|
return Acad::eOk;
|
|
}
|
|
|
|
BOOL TDbEquipmentBase::MakeCurves(TComplexCurve& cplCurve) const
|
|
{
|
|
assertReadEnabled();
|
|
if (m_pImpEquipment != NULL)
|
|
{
|
|
return m_pImpEquipment->MakeCurves(cplCurve);
|
|
}
|
|
return FALSE;
|
|
}
|
|
|
|
BOOL TDbEquipmentBase::GetCurvesInSide(TComplexCurve& compCurve) const
|
|
{
|
|
assertReadEnabled();
|
|
if (m_pImpEquipment != NULL)
|
|
{
|
|
return m_pImpEquipment->GetCurvesInSide(compCurve);
|
|
}
|
|
return FALSE;
|
|
}
|
|
|
|
AcDbPolyline* TDbEquipmentBase::MakePolyCurve() const
|
|
{
|
|
assertReadEnabled();
|
|
if (m_pImpEquipment != NULL)
|
|
{
|
|
return m_pImpEquipment->MakePolyCurve();
|
|
}
|
|
return NULL;
|
|
}
|
|
|
|
BOOL TDbEquipmentBase::MakePolyCurveFaces(AcDbVoidPtrArray& arFaces)
|
|
{
|
|
assertReadEnabled();
|
|
if (m_pImpEquipment != NULL)
|
|
{
|
|
return m_pImpEquipment->MakePolyCurveFaces(arFaces);
|
|
}
|
|
return FALSE;
|
|
}
|
|
|
|
void TDbEquipmentBase::GetKindName(CString& sName)
|
|
{
|
|
assertReadEnabled();
|
|
sName = _T("TCH_DBEQUIPMENT");
|
|
if (m_pImpEquipment != NULL)
|
|
{
|
|
m_pImpEquipment->GetKindName(sName);
|
|
}
|
|
}
|
|
|
|
Acad::ErrorStatus TDbEquipmentBase::ExplodeOrDraw3d(XExplodeDraw &mode) const
|
|
{
|
|
assertReadEnabled();
|
|
if (m_pImpEquipment != NULL)
|
|
{
|
|
m_pImpEquipment->ExplodeOrDraw3d(mode);
|
|
return Acad::eOk;
|
|
}
|
|
return Acad::eNotImplementedYet;
|
|
}
|
|
|
|
Acad::ErrorStatus TDbEquipmentBase::ExplodeOrDraw2d(XExplodeDraw &mode) const
|
|
{
|
|
assertReadEnabled();
|
|
if (m_pImpEquipment != NULL)
|
|
{
|
|
// add begin
|
|
AcDbLayerTableRecordPointer pLayer(this->layerId(), AcDb::kForRead);
|
|
if (pLayer.openStatus() == Acad::eOk && pLayer->isOff())
|
|
{
|
|
return Acad::eOk;
|
|
}
|
|
// add end by cq 2016-10-17 图层关闭时,实体不显示,不进行绘制(打印时,也不会绘制)
|
|
return m_pImpEquipment->ExplodeOrDraw2d(mode);
|
|
}
|
|
return Acad::eOk;
|
|
}
|
|
|
|
Acad::ErrorStatus TDbEquipmentBase::subTransformBy(const AcGeMatrix3d& xform)
|
|
{
|
|
assertWriteEnabled();
|
|
if (m_pImpEquipment != NULL)
|
|
{
|
|
m_pImpEquipment->GetSpecialtyData()->SetAt(KEY_DEEPCLONEFLAG,0);
|
|
// mcl add.2010.11.08 move 及复制时,忽略z标高差
|
|
// Lixl add 指针有效性判断,防止9.0打开8.5空气机组图纸崩溃 2012-6-8
|
|
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_pImpEquipment->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_pImpEquipment->transformBy(mat);
|
|
//change end
|
|
}
|
|
}
|
|
return m_pImpEquipment->transformBy(xform);
|
|
}
|
|
return Acad::eNotImplementedYet;
|
|
}
|
|
|
|
// add by zh 2013-5-23 解决空气机组Move出错
|
|
Acad::ErrorStatus TDbEquipmentBase::TransformBy(const AcGeMatrix3d& xform)
|
|
{
|
|
assertWriteEnabled();
|
|
if (m_pImpEquipment != NULL)
|
|
{
|
|
return m_pImpEquipment->transformBy(xform);
|
|
}
|
|
return Acad::eNotImplementedYet;
|
|
}
|
|
|
|
Acad::ErrorStatus TDbEquipmentBase::subIntersectWith(const AcDbEntity* pEnt,
|
|
AcDb::Intersect intType,
|
|
const AcGePlane& projPlane,
|
|
AcGePoint3dArray& points,
|
|
INT_PTR thisGsMarker,
|
|
INT_PTR otherGsMarker) const
|
|
{
|
|
assertReadEnabled();
|
|
if (m_pImpEquipment != NULL)
|
|
{
|
|
return m_pImpEquipment->intersectWith(pEnt,intType,projPlane,points,thisGsMarker,otherGsMarker);
|
|
}
|
|
return Acad::eNotImplementedYet;
|
|
}
|
|
|
|
Acad::ErrorStatus TDbEquipmentBase::subIntersectWith(const AcDbEntity* pEnt,
|
|
AcDb::Intersect intType,
|
|
AcGePoint3dArray& points,
|
|
INT_PTR thisGsMarker,
|
|
INT_PTR otherGsMarker) const
|
|
{
|
|
assertReadEnabled();
|
|
if (m_pImpEquipment != NULL)
|
|
{
|
|
return m_pImpEquipment->intersectWith(pEnt,intType,points,thisGsMarker,otherGsMarker);
|
|
}
|
|
return Acad::eNotImplementedYet;
|
|
}
|
|
|
|
Acad::ErrorStatus TDbEquipmentBase::subGetTransformedCopy( const AcGeMatrix3d& xform,
|
|
AcDbEntity*& pEnt) const
|
|
{
|
|
assertReadEnabled();
|
|
|
|
pEnt = new TDbEquipmentBase;
|
|
(TDbEquipmentBase*)pEnt->copyFrom(this);
|
|
pEnt->transformBy(xform);
|
|
|
|
return Acad::eOk;
|
|
}
|
|
|
|
Acad::ErrorStatus TDbEquipmentBase::subGetOsnapPoints(AcDb::OsnapMode osnapMode,
|
|
INT_PTR gsSelectionMark,
|
|
const AcGePoint3d& pickPoint,
|
|
const AcGePoint3d& lastPoint,
|
|
const AcGeMatrix3d& viewXform,
|
|
AcGePoint3dArray& snapPoints,
|
|
AcDbIntArray& geomIds) const
|
|
{
|
|
assertReadEnabled();
|
|
if (m_pImpEquipment != NULL)
|
|
{
|
|
return m_pImpEquipment->getOsnapPoints(osnapMode,gsSelectionMark,pickPoint,lastPoint,viewXform,snapPoints,geomIds);
|
|
}
|
|
return Acad::eNotImplementedYet;
|
|
}
|
|
|
|
Acad::ErrorStatus TDbEquipmentBase::subGetGripPoints(AcGePoint3dArray& gripPoints,
|
|
AcDbIntArray& osnapModes,
|
|
AcDbIntArray& geomIds) const
|
|
{
|
|
assertReadEnabled();
|
|
#if ADS==15
|
|
if (m_pImpEquipment != NULL)
|
|
{
|
|
return m_pImpEquipment->getGripPoints(gripPoints,osnapModes,geomIds);
|
|
}
|
|
#endif
|
|
return Acad::eInvalidInput;
|
|
}
|
|
|
|
Acad::ErrorStatus TDbEquipmentBase::subGetStretchPoints(AcGePoint3dArray& stretchPoints) const
|
|
{
|
|
assertReadEnabled();
|
|
if (m_pImpEquipment != NULL)
|
|
{
|
|
m_pImpEquipment->getStretchPoints(stretchPoints);
|
|
return Acad::eOk;
|
|
}
|
|
return Acad::eOk;
|
|
}
|
|
|
|
Acad::ErrorStatus TDbEquipmentBase::subMoveGripPointsAt(const AcDbIntArray& indices,
|
|
const AcGeVector3d& offset)
|
|
{
|
|
assertWriteEnabled();
|
|
|
|
if (m_pImpEquipment != NULL)
|
|
{
|
|
// mcl add 2010.11.08 忽略z标高差
|
|
// XString &sCmd=GetCurDocData()->m_sCurCommand;
|
|
// Lixl add 指针有效性判断2012-6-8
|
|
TArchPerDocData* pDoc = GetCurDocData();
|
|
if (NULL != pDoc)
|
|
{
|
|
XString &sCmd = pDoc->m_sCurCommand;
|
|
if(TAuxTools::Is2DView())
|
|
{
|
|
AcGeVector3d vtNoneZ = offset.orthoProject(TAuxTools::GetUcsZvt());
|
|
return m_pImpEquipment->moveGripPointsAt(indices, vtNoneZ);
|
|
}
|
|
else
|
|
return m_pImpEquipment->moveGripPointsAt(indices,offset);
|
|
}
|
|
else
|
|
return m_pImpEquipment->moveGripPointsAt(indices,offset);
|
|
}
|
|
return Acad::eInvalidInput;
|
|
}
|
|
|
|
Acad::ErrorStatus TDbEquipmentBase::subMoveStretchPointsAt( const AcDbIntArray& indices,
|
|
const AcGeVector3d& offset)
|
|
{
|
|
assertWriteEnabled();
|
|
if (objectId().isValid())
|
|
{
|
|
int i(0);
|
|
}
|
|
if (m_pImpEquipment != NULL)
|
|
{
|
|
// mcl add.2010.11.09 忽略z标高差
|
|
AcGeVector3d vtOffset = offset;
|
|
if(TAuxTools::Is2DView())
|
|
vtOffset = offset.orthoProject(TAuxTools::GetUcsZvt());
|
|
|
|
return m_pImpEquipment->moveStretchPointsAt(indices, vtOffset);
|
|
}
|
|
return Acad::eOk;
|
|
}
|
|
|
|
#if ADS>15
|
|
Acad::ErrorStatus TDbEquipmentBase::subGetGripPoints(AcDbGripDataPtrArray& grips,
|
|
const double viewSize,
|
|
const int gripSize,
|
|
const AcGeVector3d& curViewDir,
|
|
const int bitflags) const
|
|
{
|
|
|
|
assertReadEnabled();
|
|
if (m_pImpEquipment != NULL)
|
|
{
|
|
AcDbIntArray osnapModes;
|
|
AcDbIntArray geomIds;
|
|
AcGePoint3dArray gripPoints;
|
|
Acad::ErrorStatus eSta = m_pImpEquipment->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_EQUIP;i++)
|
|
{
|
|
ePos = m_pImpEquipment->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 TDbEquipmentBase::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_pImpEquipment != NULL)
|
|
{
|
|
// mcl add 2010.11.08 忽略z标高差
|
|
// XString &sCmd=GetCurDocData()->m_sCurCommand;
|
|
// Lixl add 指针有效性判断2012-6-18
|
|
TArchPerDocData* pDoc = GetCurDocData();
|
|
if (NULL != pDoc)
|
|
{
|
|
XString &sCmd = pDoc->m_sCurCommand;
|
|
if(TAuxTools::Is2DView())
|
|
{
|
|
AcGeVector3d vtNoneZ = offset.orthoProject(TAuxTools::GetUcsZvt());
|
|
eSta = m_pImpEquipment->moveGripPointsAt(arIndex, vtNoneZ);
|
|
}
|
|
else
|
|
eSta = m_pImpEquipment->moveGripPointsAt(arIndex,offset);
|
|
}
|
|
else
|
|
eSta = m_pImpEquipment->moveGripPointsAt(arIndex,offset);
|
|
}
|
|
return eSta;
|
|
}
|
|
#endif
|
|
|
|
Acad::ErrorStatus TDbEquipmentBase::subGetGeomExtents(AcDbExtents& extents) const
|
|
{
|
|
assertReadEnabled();
|
|
if (m_pImpEquipment != NULL)
|
|
{
|
|
return m_pImpEquipment->getGeomExtents(extents);
|
|
}
|
|
return Acad::eNotImplementedYet;
|
|
}
|
|
|
|
Acad::ErrorStatus TDbEquipmentBase::subGetClassID(CLSID* pClsid) const
|
|
{
|
|
assertReadEnabled();
|
|
if (m_pImpEquipment != NULL)
|
|
{
|
|
m_pImpEquipment->getClassID(pClsid);
|
|
}
|
|
return Acad::eOk;
|
|
}
|
|
|
|
Acad::ErrorStatus TDbEquipmentBase::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("TDbEquipmentBase"));
|
|
|
|
// Write version number.
|
|
pFiler->writeItem(AcDb::kDxfInt16, (Adesk::UInt16) VERSION_TDBEQUIPMENTBASE);
|
|
return es;
|
|
}
|
|
|
|
Acad::ErrorStatus TDbEquipmentBase::dxfInFields(AcDbDxfFiler* pFiler)
|
|
{
|
|
assertWriteEnabled();
|
|
struct resbuf rb;
|
|
|
|
if ((TDbInterfacesObj::dxfInFields(pFiler) != Acad::eOk) ||
|
|
!pFiler->atSubclassData(_T("TDbEquipmentBase")))
|
|
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_TDBEQUIPMENTBASE)
|
|
return Acad::eMakeMeProxy;
|
|
}
|
|
return pFiler->filerStatus();
|
|
}
|
|
|
|
Acad::ErrorStatus TDbEquipmentBase::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_TDBEQUIPMENTBASE);
|
|
if (g_nSaveTArchVer <= 9)
|
|
pFiler->writeItem((Adesk::UInt16) 1);
|
|
else
|
|
pFiler->writeItem((Adesk::UInt16) VERSION_TDBEQUIPMENTBASE);
|
|
|
|
pFiler->writeItem(AcDbSoftPointerId(objectId()));
|
|
m_pImpEquipment->dwgOutFields(pFiler);
|
|
return pFiler->filerStatus();
|
|
}
|
|
|
|
Acad::ErrorStatus TDbEquipmentBase::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_TDBEQUIPMENTBASE)
|
|
return Acad::eMakeMeProxy;
|
|
|
|
AcDbSoftPointerId idThis;
|
|
/*switch (version)
|
|
{
|
|
case (1):
|
|
{
|
|
pFiler->readItem(&idThis);
|
|
m_pImpEquipment->dwgInFields(pFiler);
|
|
if (m_pImpEquipment->GetSpecialtyData() != NULL)
|
|
{
|
|
m_pImpEquipment->GetSpecialtyData()->SetAt(KEY_THISID,idThis);
|
|
}
|
|
break;
|
|
}
|
|
default:
|
|
break;
|
|
}*/
|
|
// add by hh 2013-9-2 设置图纸版本 用于在Imp类中处理版本问题
|
|
pFiler->readItem(&idThis);
|
|
m_pImpEquipment->SetVersion(version);
|
|
m_pImpEquipment->dwgInFields(pFiler);
|
|
if(2 > version)
|
|
{
|
|
if (m_pImpEquipment->GetSpecialtyData() != NULL)
|
|
{
|
|
m_pImpEquipment->GetSpecialtyData()->SetAt(KEY_THISID,idThis);
|
|
}
|
|
}
|
|
|
|
return pFiler->filerStatus();
|
|
}
|
|
|
|
Acad::ErrorStatus TDbEquipmentBase::subDeepClone(AcDbObject* pOwnerObject,
|
|
AcDbObject*& pClonedObject,
|
|
AcDbIdMapping& idMap,
|
|
Adesk::Boolean isPrimary) const
|
|
{
|
|
assertReadEnabled();
|
|
Acad::ErrorStatus es = TDbInterfacesObj::subDeepClone(pOwnerObject,pClonedObject,idMap,isPrimary);
|
|
if (pClonedObject != NULL)
|
|
{
|
|
TDbEquipmentBase* pFitt = TDbEquipmentBase::cast(pClonedObject);
|
|
if (pFitt != NULL)
|
|
{
|
|
pFitt->UserCall(KEY_USER_CALL, NULL); // 目前仅用于暖通阀门,删除接口。mcl 090916
|
|
pFitt->GetSpecialtyData()->SetAt(KEY_DEEPCLONEFLAG,1);
|
|
}
|
|
}
|
|
|
|
// add by hh 2011-12-07
|
|
if (pClonedObject != NULL)
|
|
{
|
|
TDbEquipmentBase* pBase = TDbEquipmentBase::cast(pClonedObject);
|
|
if (pBase != NULL)
|
|
{
|
|
TDbXDataMap* pMapClone = NULL;
|
|
TDbXDataMap* pMapThis = m_pImpEquipment->GetSpecialtyData();
|
|
|
|
if ( pBase->m_pImpEquipment != NULL)
|
|
{
|
|
pMapClone = pBase->m_pImpEquipment->GetSpecialtyData();
|
|
}
|
|
|
|
if ( pMapThis != NULL)
|
|
{
|
|
pMapThis->BeginCloneXlation(pMapClone,idMap);
|
|
}
|
|
}
|
|
}
|
|
return es;
|
|
}
|
|
|
|
Acad::ErrorStatus TDbEquipmentBase::subWblockClone( AcRxObject* pOwnerObject,
|
|
AcDbObject*& pClonedObject,
|
|
AcDbIdMapping& idMap,
|
|
Adesk::Boolean isPrimary) const
|
|
{
|
|
assertReadEnabled();
|
|
|
|
Acad::ErrorStatus es = TDbInterfacesObj::subWblockClone(pOwnerObject, pClonedObject, idMap, isPrimary);
|
|
if (pClonedObject != NULL)
|
|
{
|
|
TDbEquipmentBase* pBase = TDbEquipmentBase::cast(pClonedObject);
|
|
if (pBase != NULL)
|
|
{
|
|
TDbXDataMap* pMapClone = NULL;
|
|
TDbXDataMap* pMapThis = m_pImpEquipment->GetSpecialtyData();
|
|
|
|
if ( pBase->m_pImpEquipment != NULL)
|
|
{
|
|
pMapClone = pBase->m_pImpEquipment->GetSpecialtyData();
|
|
}
|
|
|
|
if ( pMapThis != NULL)
|
|
{
|
|
pMapThis->BeginCloneXlation(pMapClone,idMap);
|
|
}
|
|
}
|
|
}
|
|
return Acad::eOk;
|
|
}
|
|
|
|
void TDbEquipmentBase::subList() const
|
|
{
|
|
assertReadEnabled();
|
|
if (m_pImpEquipment != NULL)
|
|
{
|
|
m_pImpEquipment->list();
|
|
}
|
|
}
|
|
|
|
BOOL TDbEquipmentBase::OPMInfo(LPCTSTR pszName, TDb::OPMInfo* pInfo)
|
|
{
|
|
if (isWriteEnabled())
|
|
assertWriteEnabled();
|
|
else
|
|
assertReadEnabled();
|
|
|
|
if (m_pImpEquipment != NULL)
|
|
{
|
|
return m_pImpEquipment->OPMInfo(pszName, pInfo);
|
|
}
|
|
|
|
return FALSE;
|
|
}
|
|
|
|
// TSubText* TDbEquipmentBase::HitTestText(XPoint pt)const
|
|
// {
|
|
// return NULL;
|
|
// TSubText *pSubText = TDbInterfacesObj::HitTestText(pt);
|
|
// if (pSubText != NULL)
|
|
// pSubText->SetMultiLine(true);
|
|
//
|
|
// return pSubText;
|
|
// }
|
|
|
|
void TDbEquipmentBase::SetSubText(long i,CString sText)
|
|
{
|
|
assertWriteEnabled();
|
|
if (m_pImpEquipment != NULL)
|
|
{
|
|
m_pImpEquipment->SetSubText(i,sText);
|
|
}
|
|
}
|
|
|
|
|
|
BOOL TDbEquipmentBase::IsValid(TDbXDataMap* pXMap)
|
|
{
|
|
assertReadEnabled();
|
|
|
|
if (m_pImpEquipment != NULL)
|
|
{
|
|
return m_pImpEquipment->IsValid(pXMap);
|
|
}
|
|
|
|
return FALSE;
|
|
}
|
|
|
|
Acad::ErrorStatus TDbEquipmentBase::getSplitCurves(const AcGeDoubleArray& params, AcDbVoidPtrArray& curveSegments) const
|
|
{
|
|
assertReadEnabled();
|
|
return Acad::eOk;
|
|
}
|
|
|
|
Acad::ErrorStatus TDbEquipmentBase::getSplitCurves(const AcGePoint3dArray& points, AcDbVoidPtrArray& curveSegments) const
|
|
{
|
|
assertReadEnabled();
|
|
return Acad::eOk;
|
|
}
|
|
|
|
Acad::ErrorStatus TDbEquipmentBase::getParamAtPoint(const AcGePoint3d& pt, double& dParam) const
|
|
{
|
|
assertReadEnabled();
|
|
return Acad::eOk;
|
|
}
|
|
|
|
Acad::ErrorStatus TDbEquipmentBase::getDistAtParam( double param, double& dist ) const
|
|
{
|
|
assertReadEnabled();
|
|
dist = 0.1; // 避免cad2010.PURGE命令清理长度为0的线时,被删除
|
|
return Acad::eOk;
|
|
}
|
|
|
|
Acad::ErrorStatus TDbEquipmentBase::subErase( Adesk::Boolean erasing )
|
|
{
|
|
Acad::ErrorStatus eState = TDbInterfacesObj::subErase(erasing);
|
|
if (eState == Acad::eOk)
|
|
{
|
|
if (m_pImpEquipment != NULL)
|
|
m_pImpEquipment->OnSubErase(erasing);
|
|
}
|
|
|
|
return eState;
|
|
}
|
|
|
|
LRESULT TDbEquipmentBase::UserCall( long i,LPVOID pData )
|
|
{
|
|
assertWriteEnabled();
|
|
|
|
if (m_pImpEquipment != NULL)
|
|
return m_pImpEquipment->UserCall(i,pData);
|
|
|
|
return 0l;
|
|
}
|
|
|
|
int TDbEquipmentBase::GetXBaseShell(TXShell& xShell)
|
|
{
|
|
if (m_pImpEquipment != NULL)
|
|
{
|
|
return m_pImpEquipment->GetXBaseShell(xShell);
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
int TDbEquipmentBase::GetBodyBox(AcDbExtents& ext)
|
|
{
|
|
if (m_pImpEquipment != NULL)
|
|
{
|
|
return m_pImpEquipment->GetBodyBox(ext);
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
CString TDbEquipmentBase::GetXml(const AcGeMatrix3d& mat) const
|
|
{
|
|
if (m_pImpEquipment == 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_pImpEquipment->GetXml(mat);
|
|
CString csBase = TEntityBase::GetXml(mat);
|
|
int nIndex = csXml.Find(_T("</TCH_"));
|
|
if (nIndex > -1)
|
|
csXml.Insert(nIndex, csBase);
|
|
|
|
return csXml;
|
|
}
|
|
|
|
bool TDbEquipmentBase::GetSection(const AcDbFace &face, const AcGeVector3d &vtPlaneSecDir,
|
|
std::vector<TObjSectionRecord> §ionRecord, AcDbVoidPtrArray& arFillPtrs) const
|
|
{
|
|
if(NULL == m_pImpEquipment)
|
|
return false;
|
|
|
|
return m_pImpEquipment->GetSection(face, vtPlaneSecDir, sectionRecord, arFillPtrs);
|
|
}
|
|
|
|
Acad::ErrorStatus TDbEquipmentBase::GetExtents(TADSGePoint3d &ptLow, TADSGePoint3d &ptUp) const
|
|
{
|
|
if(NULL == m_pImpEquipment)
|
|
return Acad::eNotImplementedYet;
|
|
|
|
return m_pImpEquipment->GetExtents(ptLow, ptUp);
|
|
}
|
|
|
|
// add by hh 2014-08-06 支持设备与水管遮挡
|
|
Acad::ErrorStatus TDbEquipmentBase::GetClipBoundary(TGGePoly2D& poly)const
|
|
{
|
|
if(NULL == m_pImpEquipment)
|
|
return Acad::eNotImplementedYet;
|
|
|
|
return m_pImpEquipment->GetClipBoundary(poly);
|
|
}
|
|
|
|
bool TDbEquipmentBase::IsMeClip() const
|
|
{
|
|
if(NULL == m_pImpEquipment)
|
|
return false;
|
|
|
|
return m_pImpEquipment->IsMeClip();
|
|
}
|
|
|
|
bool TDbEquipmentBase::IsClipMe(const TEntityBase* pEnt)const//ok是否被裁剪
|
|
{
|
|
if(NULL == m_pImpEquipment)
|
|
return false;
|
|
|
|
return m_pImpEquipment->IsClipMe(pEnt);
|
|
}
|