74 lines
1.3 KiB
C++
74 lines
1.3 KiB
C++
#include "stdafx.h"
|
|
//#include <dbobjptr.h>
|
|
#include "TDbObjectPointer.h"
|
|
#include <gepnt2d.h>
|
|
|
|
#include "commonRoad.h"
|
|
#include "InterStruct.h"
|
|
#include "CADEnt.h"
|
|
|
|
//
|
|
// void CCADEnt::RoolBackErase()
|
|
// {
|
|
// if (!m_id.isNull())
|
|
// {
|
|
// RoolBackRemoveData(m_id);
|
|
// m_id.setNull();
|
|
// }
|
|
// }
|
|
|
|
BOOL CCADEnt::Erase()
|
|
{
|
|
if (!m_id.isNull())
|
|
{
|
|
AcDbObjectPointer<AcDbObject> pObj;
|
|
if (pObj.open(m_id, AcDb::kForWrite) == Acad::eOk)
|
|
{
|
|
pObj->erase();
|
|
m_id.setNull();
|
|
return TRUE;
|
|
}
|
|
}
|
|
|
|
m_id.setNull();
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
BOOL CCADEnt::IsErased() const
|
|
{
|
|
return m_id.isNull();
|
|
}
|
|
|
|
|
|
// 这里需要打开该ID,然后读取对应的数据
|
|
CLineCADEnt::CLineCADEnt(AcDbObjectId id)
|
|
: CCADEnt(id)
|
|
{
|
|
AcDbObjectPointer<AcDbLine> pLine;
|
|
if (pLine.open(id, AcDb::kForRead) == Acad::eOk)
|
|
{
|
|
AcGePoint2d ptStart = POINT_3D_TO_2D(pLine->startPoint());
|
|
AcGePoint2d ptEnd = POINT_3D_TO_2D(pLine->endPoint());
|
|
ptStart = AsMMUnitPoint2d(ptStart);
|
|
ptEnd = AsMMUnitPoint2d(ptEnd);
|
|
m_line.set(ptStart, ptEnd);
|
|
}
|
|
else
|
|
ASSERT(0);
|
|
}
|
|
|
|
|
|
// 这里需要打开该ID,然后读取对应的数据
|
|
CArcCADEnt::CArcCADEnt(AcDbObjectId id)
|
|
: CCADEnt(id)
|
|
{
|
|
AcDbObjectPointer<AcDbArc> pArc;
|
|
if (pArc.open(id, AcDb::kForRead) == Acad::eOk)
|
|
{
|
|
m_arc = DbArcToGeMM(*(pArc.object()));
|
|
}
|
|
else
|
|
ASSERT(0);
|
|
}
|