233 lines
5.2 KiB
C++
233 lines
5.2 KiB
C++
#include "stdafx.h"
|
|
#include "AecDbExtendedEntity.h"
|
|
|
|
|
|
ACRX_DXF_DEFINE_MEMBERS(AecDbExtendedEntity, AecDbBDPipeBase,
|
|
AcDb::kDHL_CURRENT, AcDb::kMReleaseCurrent,
|
|
AcDbProxyEntity::kNoOperation | AcDbProxyEntity::kDisableProxyWarning,
|
|
AEC_DBEXTENDENT,
|
|
"AecDbExtendedEntity"
|
|
"|Product Desc: shanghua earthworm app obj"
|
|
"|Company: shanghua inc"
|
|
"|WEB Address: www.shanghuasoft.com")
|
|
|
|
Adesk::UInt32 AecDbExtendedEntity::kCurrentVersionNumber = 1;
|
|
|
|
AecDbExtendedEntity::AecDbExtendedEntity()
|
|
{
|
|
m_mapSpecXData.SetAt(KEY_NAME, _T("槽型池壁"));
|
|
}
|
|
|
|
AecDbExtendedEntity::~AecDbExtendedEntity() { }
|
|
|
|
Acad::ErrorStatus AecDbExtendedEntity::subExplode(AcDbVoidPtrArray & entitySet) const
|
|
{
|
|
return Acad::eNotImplementedYet;
|
|
}
|
|
|
|
void AecDbExtendedEntity::subList() const
|
|
{
|
|
assertReadEnabled();
|
|
acutPrintf(_T("\n名称:槽型池壁"));
|
|
AecDbBDPipeBase::subList();
|
|
}
|
|
|
|
Acad::ErrorStatus AecDbExtendedEntity::copyFrom(const AcRxObject * pSrc)
|
|
{
|
|
return AecDbBDPipeBase::copyFrom(pSrc);
|
|
}
|
|
|
|
Acad::ErrorStatus AecDbExtendedEntity::subTransformBy(const AcGeMatrix3d & xform)
|
|
{
|
|
return AecDbBDPipeBase::subTransformBy(xform);
|
|
}
|
|
|
|
Acad::ErrorStatus AecDbExtendedEntity::dwgInFields(AcDbDwgFiler * pFiler)
|
|
{
|
|
AssertWriteEnabled();
|
|
|
|
//----- Read parent class information first.
|
|
Acad::ErrorStatus es = Acad::eOk;
|
|
es = AecDbBDPipeBase::dwgInFields(pFiler);
|
|
if (es != Acad::eOk)
|
|
return (es);
|
|
|
|
//----- Object version number needs to be read first
|
|
Adesk::UInt32 version(0);
|
|
if ((es = pFiler->readUInt32(&version)) != Acad::eOk)
|
|
return (es);
|
|
|
|
if (version > AecDbExtendedEntity::kCurrentVersionNumber)
|
|
return Acad::eMakeMeProxy;
|
|
|
|
return Acad::eOk;
|
|
}
|
|
|
|
Acad::ErrorStatus AecDbExtendedEntity::dwgOutFields(AcDbDwgFiler * pFiler) const
|
|
{
|
|
assertReadEnabled();
|
|
|
|
//----- Save parent class information first.
|
|
Acad::ErrorStatus es = Acad::eOk;
|
|
es = AecDbBDPipeBase::dwgOutFields(pFiler);
|
|
if (es != Acad::eOk)
|
|
return (es);
|
|
|
|
//----- Object version number needs to be saved first
|
|
if ((es = pFiler->writeUInt32(AecDbExtendedEntity::kCurrentVersionNumber)) != Acad::eOk)
|
|
return (es);
|
|
|
|
return Acad::eOk;
|
|
}
|
|
|
|
Acad::ErrorStatus AecDbExtendedEntity::dxfInFields(AcDbDxfFiler * pFiler)
|
|
{
|
|
return AecDbBDPipeBase::dxfInFields(pFiler);
|
|
}
|
|
|
|
Acad::ErrorStatus AecDbExtendedEntity::dxfOutFields(AcDbDxfFiler * pFiler) const
|
|
{
|
|
return AecDbBDPipeBase::dxfOutFields(pFiler);
|
|
}
|
|
|
|
void AecDbExtendedEntity::GetGripText(int nPos, CString & sText)
|
|
{
|
|
switch (nPos)
|
|
{
|
|
case 0:
|
|
sText = _T("移动起点");
|
|
break;
|
|
case 1:
|
|
sText = _T("平移");
|
|
break;
|
|
case 2:
|
|
sText = _T("移动终点");
|
|
default:
|
|
break;
|
|
}
|
|
}
|
|
|
|
Acad::ErrorStatus AecDbExtendedEntity::subGetGripPoints(AcDbGripDataPtrArray & grips, const double curViewUnitSize, const int gripSize, const AcGeVector3d & curViewDir, const int bitflags) const
|
|
{
|
|
return Acad::eNotImplementedYet;
|
|
}
|
|
|
|
Acad::ErrorStatus AecDbExtendedEntity::subGetGripPoints(AcGePoint3dArray & gripPoints, AcDbIntArray & osnapModes, AcDbIntArray & geomIds) const
|
|
{
|
|
return AecDbBDPipeBase::subGetGripPoints(gripPoints, osnapModes, geomIds);
|
|
}
|
|
|
|
Acad::ErrorStatus AecDbExtendedEntity::subMoveGripPointsAt(const AcDbIntArray & indices, const AcGeVector3d & offset)
|
|
{
|
|
AssertWriteEnabled();
|
|
AcGeMatrix3d mat;
|
|
mat.setToTranslation(offset);
|
|
subTransformBy(mat);
|
|
return Acad::eOk;
|
|
}
|
|
|
|
Acad::ErrorStatus AecDbExtendedEntity::Draw2d(AcGiDraw & dc) const
|
|
{
|
|
assertReadEnabled();
|
|
|
|
int clr(256), oldclr;
|
|
m_mapSpecXData.GetAt(_T("COLOR"), clr);
|
|
oldclr = dc.GetColor();
|
|
dc.SetColor(clr);
|
|
|
|
DrawDTYG2D(dc);
|
|
|
|
if (Has2DBuffer())
|
|
{
|
|
Draw2DBuffers(dc);
|
|
return Acad::eOk;
|
|
}
|
|
|
|
AecDbBDPipeBase::Draw2d(dc);
|
|
return Acad::eOk;
|
|
}
|
|
|
|
Acad::ErrorStatus AecDbExtendedEntity::Draw3d(AcGiDraw & dc) const
|
|
{
|
|
assertReadEnabled();
|
|
|
|
int clr(256), oldclr;
|
|
m_mapSpecXData.GetAt(_T("COLOR"), clr);
|
|
oldclr = dc.GetColor();
|
|
dc.SetColor(clr);
|
|
|
|
if (Has3DBuffer())
|
|
{
|
|
Draw3DBuffers(dc);
|
|
return Acad::eOk;
|
|
}
|
|
|
|
return DrawByPipebase(dc);
|
|
}
|
|
|
|
Acad::ErrorStatus AecDbExtendedEntity::DrawByPipebase(AcGiDraw & dc) const
|
|
{
|
|
return AecDbBDPipeBase::Draw3d(dc);
|
|
}
|
|
|
|
SHJson::WValue& AecDbExtendedEntity::ToJson(bool bExprotGeo) const
|
|
{
|
|
using namespace SHJson;
|
|
return AecDbBDPipeBase::ToJson(bExprotGeo);
|
|
}
|
|
|
|
bool AecDbExtendedEntity::ByJson(const SHJson::WValue &v)
|
|
{
|
|
AssertWriteEnabled();
|
|
return AecDbBDPipeBase::ByJson(v);
|
|
}
|
|
|
|
double AecDbExtendedEntity::getElevation()
|
|
{
|
|
assertReadEnabled();
|
|
double dElev(.0);
|
|
AcDbCurve *pCurve = GetBaseCurve();
|
|
if (!pCurve) return dElev;
|
|
do
|
|
{
|
|
if (pCurve->isA() != AcDbPolyline::desc()) break;
|
|
dElev = ((AcDbPolyline*)pCurve)->elevation();
|
|
} while (false);
|
|
|
|
DELETE_PTR(pCurve);
|
|
return dElev;
|
|
}
|
|
|
|
bool AecDbExtendedEntity::setElevation(const double &dEle)
|
|
{
|
|
AssertWriteEnabled();
|
|
bool bRel(false);
|
|
AcDbCurve *pCurve = GetBaseCurve();
|
|
if (!pCurve) return bRel;
|
|
|
|
do
|
|
{
|
|
if (pCurve->isA() != AcDbPolyline::desc()) break;
|
|
((AcDbPolyline*)pCurve)->setElevation(dEle);
|
|
SetBaseCurve(pCurve);
|
|
bRel = true;
|
|
} while (false);
|
|
DELETE_PTR(pCurve);
|
|
return bRel;
|
|
}
|
|
|
|
double AecDbExtendedEntity::getSectionThick()
|
|
{
|
|
assertReadEnabled();
|
|
double dWallThick(.0);
|
|
AcDbRegion *pReg = GetSection();
|
|
if (pReg)
|
|
{
|
|
AcDbExtents ext;
|
|
Acad::ErrorStatus es = pReg->getGeomExtents(ext);
|
|
if (es == Acad::eOk)
|
|
dWallThick = ext.maxPoint().x - ext.minPoint().x;
|
|
}
|
|
return dWallThick;
|
|
}
|