774 lines
18 KiB
C++
774 lines
18 KiB
C++
#include "stdafx.h"
|
|
#include "AecDbEwFlexiblePipe.h"
|
|
#include "AecGripCback.h"
|
|
#include "AecDb3dRoadAxisLine.h"
|
|
#include "GiDrawUtility.h"
|
|
|
|
|
|
extern void XDataMapToPipeParam(const AecDbObjXDataMap *pXDataMapSrc, WPipe::PipeParam *pParamL);
|
|
extern double PixelToWcs(int nPixel);
|
|
extern AcDbPolyline *FormatPolyline(AcGePoint3d *ppPts, int nCount);
|
|
|
|
static const Adesk::UInt16 kColorByBlock = 0;
|
|
static const Adesk::UInt16 kRed = 1;
|
|
static const Adesk::UInt16 kYellow = 2;
|
|
static const Adesk::UInt16 kGreen = 3;
|
|
static const Adesk::UInt16 kCyan = 4;
|
|
static const Adesk::UInt16 kBlue = 5;
|
|
static const Adesk::UInt16 kMagenta = 6;
|
|
static const Adesk::UInt16 kWhite = 7;
|
|
static const Adesk::UInt16 kColorByLayer = 256;
|
|
|
|
#ifndef GRIPPT_RESP_FROM_EWFIT
|
|
#define GRIPPT_RESP_FROM_EWFIT 1394
|
|
#endif
|
|
|
|
Adesk::UInt32 AecDbEwFlexiblePipe::kCurrentVersionNumber = 1;
|
|
|
|
ACRX_DXF_DEFINE_MEMBERS(AecDbEwFlexiblePipe, AecDbEwPipeBase,
|
|
AcDb::kDHL_CURRENT, AcDb::kMReleaseCurrent,
|
|
AcDbProxyEntity::kNoOperation | AcDbProxyEntity::kDisableProxyWarning,
|
|
AEC_EWFPIPE,
|
|
"AecDbEwFlexiblePipe"
|
|
"|Product Desc: shanghua earthworm app obj"
|
|
"|Company: shanghua inc"
|
|
"|WEB Address: www.shanghuasoft.com")
|
|
|
|
|
|
AecDbEwFlexiblePipe::AecDbEwFlexiblePipe(void)
|
|
{
|
|
m_mapSpecXData.SetAt(KEY_NAME, _T("柔性类管"));
|
|
}
|
|
|
|
AecDbEwFlexiblePipe::~AecDbEwFlexiblePipe(void)
|
|
{
|
|
|
|
}
|
|
|
|
void AecDbEwFlexiblePipe::SetPipeParam(WPipe::PipeParam *pParam)
|
|
{
|
|
AssertWriteEnabled();
|
|
|
|
if (pParam != NULL)
|
|
{
|
|
m_mapSpecXData.SetAt(PIPE_EAPP, (int)pParam->m_app);
|
|
m_mapSpecXData.SetAt(PIPE_DRAWDIR, pParam->m_eD); //绘制类型
|
|
m_mapSpecXData.SetAt(KEY_2DSTYLE, 2); //双线
|
|
m_mapSpecXData.SetAt(KEY_SINGLE, 0);
|
|
m_mapSpecXData.SetAt(PIPE_D, pParam->m_dD);
|
|
SetSection(pParam->m_dD, pParam->m_dThick);
|
|
|
|
m_mapSpecXData.SetAt(PIPE_DN, pParam->m_dDN);
|
|
m_mapSpecXData.SetAt(PIPE_OD, pParam->m_dOD);
|
|
m_mapSpecXData.SetAt(PIPE_TDN, pParam->m_dDN);
|
|
m_mapSpecXData.SetAt(PIPE_TOD, pParam->m_dOD);
|
|
m_mapSpecXData.SetAt(PIPE_RATIO, pParam->m_dRRatio);
|
|
m_mapSpecXData.SetAt(PIPE_THICK, pParam->m_dThick);
|
|
m_mapSpecXData.SetAt(PIPE_MATERIAL, pParam->szMertial);
|
|
m_mapSpecXData.SetAt(PIPE_MATERIALFT, pParam->szMertialFit);
|
|
|
|
m_mapSpecXData.SetAt(PIPE_ELBOWFLG, FALSE);
|
|
m_mapSpecXData.SetAt(PIPE_BWELDDOT, FALSE);
|
|
m_mapSpecXData.SetAt(DOC_PLOTWIDTH, 1.0);
|
|
m_mapSpecXData.SetAt(DOC_WELDDIA, 2.0);
|
|
m_mapSpecXData.SetAt(PIPE_ZONE, pParam->szZoneNo);
|
|
m_mapSpecXData.SetAt(PIPE_INSTHICK, 10.0);
|
|
m_mapSpecXData.SetAt(PIPE_NO, pParam->szPipeno);
|
|
m_mapSpecXData.SetAt(KEY_NO, pParam->szNo);
|
|
m_mapSpecXData.SetAt(DOC_INSMATER, pParam->szInsMtr);
|
|
m_mapSpecXData.SetAt(PIPE_DESCR, pParam->szDescr);
|
|
m_mapSpecXData.SetAt(PIPE_SYS, pParam->szSys);
|
|
m_mapSpecXData.SetAt(PIPE_PIDD, 100.0);//设置pid画法的直径
|
|
m_mapSpecXData.SetAt(PIPE_LEVEL, pParam->szLevel);
|
|
|
|
m_mapSpecXData.SetAt(PIPE_CONNECT, pParam->m_nConnectType);
|
|
m_mapSpecXData.SetAt(PIPE_INTERFACED, pParam->m_dInterfaceD);
|
|
m_mapSpecXData.SetAt(PIPE_INTERFACED2, pParam->m_dInterfaceD2);
|
|
m_mapSpecXData.SetAt(PIPE_INTERFACEL, pParam->m_dInterfaceL);
|
|
m_mapSpecXData.SetAt(PIPE_INTERFACEL2, pParam->m_dInterfaceL2);
|
|
|
|
m_mapSpecXData.SetAt(PIPE_FLANGF, pParam->m_szEndF);
|
|
m_mapSpecXData.SetAt(PIPE_GASKET, pParam->m_szGastInf);
|
|
m_mapSpecXData.SetAt(PIPE_EL, pParam->m_dEl);
|
|
}
|
|
}
|
|
|
|
WPipe::PipeParam *AecDbEwFlexiblePipe::GetPipeParam() const
|
|
{
|
|
assertReadEnabled();
|
|
|
|
WPipe::PipeParam *pParamL = new WPipe::PipeParam;
|
|
const AecDbObjXDataMap *pXDataMapSrc = &m_mapSpecXData;
|
|
|
|
XDataMapToPipeParam(pXDataMapSrc, pParamL);
|
|
|
|
return pParamL;
|
|
}
|
|
|
|
Acad::ErrorStatus AecDbEwFlexiblePipe::dwgInFields(AcDbDwgFiler *pFiler)
|
|
{
|
|
assertWriteEnabled();
|
|
|
|
//----- Read parent class information first.
|
|
Acad::ErrorStatus es = AecDbEwPipeBase::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 > AecDbEwFlexiblePipe::kCurrentVersionNumber)
|
|
return (Acad::eMakeMeProxy);
|
|
|
|
return pFiler->filerStatus();
|
|
}
|
|
|
|
Acad::ErrorStatus AecDbEwFlexiblePipe::dwgOutFields(AcDbDwgFiler *pFiler) const
|
|
{
|
|
assertReadEnabled();
|
|
|
|
//----- Save parent class information first.
|
|
Acad::ErrorStatus es = AecDbEwPipeBase::dwgOutFields(pFiler);
|
|
if (es != Acad::eOk)
|
|
return (es);
|
|
|
|
//----- Object version number needs to be saved first
|
|
if ((es = pFiler->writeUInt32(AecDbEwFlexiblePipe::kCurrentVersionNumber)) != Acad::eOk)
|
|
return (es);
|
|
|
|
return pFiler->filerStatus();
|
|
}
|
|
|
|
Acad::ErrorStatus AecDbEwFlexiblePipe::dxfInFields(AcDbDxfFiler *pFiler)
|
|
{
|
|
return Acad::eOk;
|
|
}
|
|
|
|
Acad::ErrorStatus AecDbEwFlexiblePipe::dxfOutFields(AcDbDxfFiler *pFiler) const
|
|
{
|
|
return Acad::eOk;
|
|
}
|
|
|
|
#if ARX>16
|
|
void AecDbEwFlexiblePipe::subList() const
|
|
{
|
|
//acutPrintf(_T("\n管线:"));
|
|
AecDbEwPipeBase::subList();
|
|
}
|
|
|
|
Acad::ErrorStatus AecDbEwFlexiblePipe::ImpGetGripPonts(AcGePoint3dArray &gripPoints, const int bitflags) const
|
|
{
|
|
assertReadEnabled();
|
|
|
|
if (m_pBaseCurve != NULL)
|
|
{
|
|
AcDbIntArray osnapModes, geomIds;
|
|
AecDb3dRoadAxisLine *pRoadALn = AecDb3dRoadAxisLine::cast(m_pBaseCurve);
|
|
if (pRoadALn != NULL)
|
|
{
|
|
pRoadALn->ImpGetGripPoints(gripPoints, osnapModes, geomIds);
|
|
}
|
|
else
|
|
{
|
|
m_pBaseCurve->getGripPoints(gripPoints, osnapModes, geomIds);
|
|
}
|
|
|
|
//后面的是断管符号
|
|
//断管符号
|
|
AcGePoint3d ptGeBK, ptGeT;
|
|
CString sIndex;
|
|
for (int i = 0; i < PIPE_BROKENNUM; i++)
|
|
{
|
|
sIndex.Format(_T("BKOP%d"), i);
|
|
if (m_mapSpecXData.GetAt(sIndex, ptGeBK))
|
|
{
|
|
//开始
|
|
m_pBaseCurve->getPointAtDist(ptGeBK.x, ptGeT);
|
|
gripPoints.append(ptGeT);
|
|
|
|
//中间
|
|
m_pBaseCurve->getPointAtDist(ptGeBK.x + ptGeBK.y * 0.5, ptGeT);
|
|
gripPoints.append(ptGeT);
|
|
|
|
//结束
|
|
m_pBaseCurve->getPointAtDist(ptGeBK.x + ptGeBK.y, ptGeT);
|
|
gripPoints.append(ptGeT);
|
|
}
|
|
}
|
|
}
|
|
return Acad::eOk;
|
|
}
|
|
|
|
Acad::ErrorStatus AecDbEwFlexiblePipe::subGetGripPoints(AcDbGripDataPtrArray &grips,
|
|
const double curViewUnitSize,
|
|
const int gripSize,
|
|
const AcGeVector3d &curViewDir,
|
|
const int bitflags) const
|
|
{
|
|
assertReadEnabled();
|
|
|
|
if (m_pBaseCurve != NULL)
|
|
{
|
|
AcGePoint3dArray gripPoints;
|
|
ImpGetGripPonts(gripPoints, bitflags);
|
|
|
|
int nColor = kBlue;
|
|
AcDbGripData *pGripData = NULL;
|
|
|
|
CString sCmd = GetGripCmd();
|
|
EPosition ePos;
|
|
for (int i = 0; i < GRIP_MAXNUM && i < gripPoints.length(); i++)
|
|
{
|
|
ePos = ExplainGripIndex(i);
|
|
{
|
|
memset(&m_pGripAppData[i], 0, sizeof(AecGripData));
|
|
m_pGripAppData[i].nIndex = i;
|
|
m_pGripAppData[i].ePos = ePos;
|
|
m_pGripAppData[i].nColor = nColor;
|
|
m_pGripAppData[i].ptGrip = gripPoints.at(i);
|
|
_tcscpy(m_pGripAppData[i].szTip, _T("拉伸夹点"));
|
|
_tcscpy(m_pGripAppData[i].szID, m_sGUID);
|
|
m_pGripAppData[i].pOwner = (AcDbEntity *)this;
|
|
m_pGripAppData[i].idHost = objectId();
|
|
|
|
pGripData = new AcDbGripData;
|
|
pGripData->setGripPoint(gripPoints.at(i));
|
|
pGripData->setAppData((void *)&m_pGripAppData[i]);
|
|
pGripData->setWorldDraw(AecGripCback::WorldDrawfunc);
|
|
pGripData->setToolTipFunc(AecGripCback::GripToolTipFunc);
|
|
}
|
|
grips.append(pGripData);
|
|
}
|
|
|
|
//调用基类加入单击修改
|
|
SubAddHitEditGrip(grips);
|
|
|
|
//动态标注
|
|
//直线,半径 标注风格
|
|
if (!grips.isEmpty())
|
|
{
|
|
SubAddDimPoints(grips, curViewDir);
|
|
}
|
|
}
|
|
return Acad::eOk;
|
|
}
|
|
|
|
EPosition AecDbEwFlexiblePipe::ExplainGripIndex(int nIndex) const
|
|
{
|
|
EPosition ePos = eStart;
|
|
return ePos;
|
|
}
|
|
|
|
Acad::ErrorStatus AecDbEwFlexiblePipe::SubAddDimPoints(AcDbGripDataPtrArray &grips, const AcGeVector3d &curViewDir) const
|
|
{
|
|
return Acad::eOk;
|
|
}
|
|
|
|
Acad::ErrorStatus AecDbEwFlexiblePipe::subMoveGripPointsAt(const AcDbVoidPtrArray &appData, const AcGeVector3d &offset, const int bitflags)
|
|
{
|
|
AssertWriteEnabled();
|
|
|
|
if (HitOnGripEdit(appData))
|
|
{
|
|
return Acad::eOk;
|
|
}
|
|
|
|
if (m_pBaseCurve != NULL)
|
|
{
|
|
AcGePoint3dArray gripPoints;
|
|
AcDbIntArray osnapModes, geomIds;
|
|
|
|
AecDb3dRoadAxisLine *pRoadALn = AecDb3dRoadAxisLine::cast(m_pBaseCurve);
|
|
if (pRoadALn != NULL)
|
|
{
|
|
pRoadALn->ImpGetGripPoints(gripPoints, osnapModes, geomIds);
|
|
}
|
|
else
|
|
{
|
|
m_pBaseCurve->getGripPoints(gripPoints, osnapModes, geomIds);
|
|
}
|
|
|
|
AecGripData *pAppData = NULL;
|
|
AcDbIntArray arIndex;
|
|
|
|
if (!appData.isEmpty())
|
|
{
|
|
pAppData = (AecGripData *)appData.first();
|
|
arIndex.append(pAppData->nIndex);
|
|
}
|
|
else
|
|
{
|
|
return Acad::eOk;
|
|
}
|
|
|
|
int nGripIndex = arIndex.first();
|
|
if (nGripIndex < gripPoints.length())
|
|
{
|
|
//直线中点的移动,关联拉伸,类似管线,由 AecDb3dRoadAxisLine 实现...
|
|
/*AecDb3dRoadAxisLine *pRoadAxLn = AecDb3dRoadAxisLine::cast(m_pBaseCurve);
|
|
if (pRoadAxLn != NULL)
|
|
{
|
|
|
|
}*/
|
|
if (pRoadALn != NULL)
|
|
{
|
|
return pRoadALn->ImpMoveGripPointsAt(arIndex,geomIds,offset);
|
|
}
|
|
else
|
|
{
|
|
//const AcDbIntArray &indices,
|
|
// const AcGeVector3d &offset
|
|
|
|
return m_pBaseCurve->moveGripPointsAt(arIndex, offset);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
AcGeMatrix3d xformM;
|
|
xformM.setToTranslation(offset);
|
|
|
|
if (nGripIndex > 5) //断管符号移动
|
|
{
|
|
nGripIndex -= 6;
|
|
return moveGripBrokenOpen(nGripIndex, offset);
|
|
}
|
|
}
|
|
}
|
|
return Acad::eOk;
|
|
}
|
|
|
|
Acad::ErrorStatus AecDbEwFlexiblePipe::moveGripBrokenOpen(int nBrokenGrip, const AcGeVector3d &offset)
|
|
{
|
|
AssertWriteEnabled();
|
|
return Acad::eOk;
|
|
}
|
|
|
|
void AecDbEwFlexiblePipe::GetGripText(int nPos, CString &sText)
|
|
{
|
|
|
|
}
|
|
#endif
|
|
|
|
extern bool GetSamplePoints(AcDbCurve *pSubCrv, double dFitLen, AcGePoint3dArray &arSubPts);
|
|
AcDbPolyline* AecDbEwFlexiblePipe::OrtherProject2XY(AcDbCurve* pCrv, double dW)
|
|
{
|
|
AcDbLine *pLn = AcDbLine::cast(pCrv);
|
|
if (pLn != NULL)
|
|
{
|
|
AcGePoint3d ptS = pLn->startPoint();
|
|
AcGePoint3d ptE = pLn->endPoint();
|
|
ptS.z = 0.0; ptE.z = 0.0;
|
|
|
|
if (ptS.distanceTo(ptE) > 1.e-3)
|
|
{
|
|
AcDbPolyline *pPl = new AcDbPolyline;
|
|
pPl->setNormal(AcGeVector3d::kZAxis);
|
|
pPl->addVertexAt(0, ptS.convert2d(AcGePlane::kXYPlane));
|
|
pPl->addVertexAt(1, ptE.convert2d(AcGePlane::kXYPlane));
|
|
pPl->setElevation(0);
|
|
pPl->setConstantWidth(dW);
|
|
return pPl;
|
|
}
|
|
}
|
|
|
|
AcDbArc *pArc = AcDbArc::cast(pCrv);
|
|
if (pArc != NULL)
|
|
{
|
|
if (AcGeVector3d::kZAxis.isParallelTo(pArc->normal()))
|
|
{
|
|
double dSta = pArc->startAngle();
|
|
double dEnd = pArc->endAngle();
|
|
if (dSta > dEnd) dSta += 2.0 * PI;
|
|
double dSweep = dEnd - dSta;
|
|
|
|
double dBug = tan(0.25 * dSweep);
|
|
AcGePoint3d ptS, ptE;
|
|
pArc->getStartPoint(ptS);
|
|
pArc->getEndPoint(ptE);
|
|
|
|
AcDbPolyline *pPl = new AcDbPolyline;
|
|
pPl->setNormal(AcGeVector3d::kZAxis);
|
|
pPl->addVertexAt(0, ptS.convert2d(AcGePlane::kXYPlane),dBug);
|
|
pPl->addVertexAt(1, ptE.convert2d(AcGePlane::kXYPlane));
|
|
pPl->setElevation(0);
|
|
pPl->setConstantWidth(dW);
|
|
return pPl;
|
|
}
|
|
else
|
|
{
|
|
AcDbCurve *pProj = NULL;
|
|
pArc->getOrthoProjectedCurve(AcGePlane::kXYPlane, pProj);
|
|
|
|
if (pProj != NULL)
|
|
{
|
|
return OrtherProject2XY(pProj, dW);
|
|
}
|
|
}
|
|
}
|
|
|
|
AcDbSpline *pSp = AcDbSpline::cast(pCrv);
|
|
if (pSp != NULL)
|
|
{
|
|
//样点化
|
|
AcGePoint3dArray arPts;
|
|
GetSamplePoints(pSp, dW, arPts);
|
|
|
|
AcDbPolyline *pPl = FormatPolyline(arPts.asArrayPtr(), arPts.length());
|
|
if (pPl != NULL)
|
|
{
|
|
pPl->setNormal(AcGeVector3d::kZAxis);
|
|
pPl->setElevation(0);
|
|
pPl->setConstantWidth(dW);
|
|
}
|
|
return pPl;
|
|
}
|
|
return NULL;
|
|
}
|
|
|
|
//AEC 派生
|
|
Acad::ErrorStatus AecDbEwFlexiblePipe::Draw2d(AcGiDraw &dc) const
|
|
{
|
|
assertReadEnabled();
|
|
|
|
//显示有宽度的二维线,投影 XY 面
|
|
|
|
//图层
|
|
AcDbObjectId idLay = dc.GetLayerId();
|
|
dc.SetLayer(layerId());
|
|
int nCrBk = dc.GetColor();
|
|
|
|
int nColor = nCrBk;
|
|
if (m_mapSpecXData.GetAt(_T("COLOR"), nColor))
|
|
{
|
|
dc.SetColor(nColor);
|
|
}
|
|
|
|
if (IsActive())
|
|
{
|
|
nColor = kMagenta;
|
|
m_mapSpecXData.GetAt(KEY_ACTIVECR, nColor);
|
|
dc.SetColor(nColor);
|
|
}
|
|
|
|
if (Has2DBuffer())
|
|
{
|
|
Draw2DBuffers(dc);
|
|
return Acad::eOk;
|
|
}
|
|
|
|
double dSize1 = 0.0;
|
|
int nDrawGradient = 0;
|
|
|
|
//单线宽度
|
|
int nStyle = 0;
|
|
if (m_mapSpecXData.GetAt(KEY_2DSTYLE, nStyle))
|
|
{
|
|
m_mapSpecXData.GetAt(KEY_SINGLEW, dSize1);
|
|
|
|
//是否绘制坡度线
|
|
m_mapSpecXData.GetAt(KEY_DRAWGRAD, nDrawGradient);
|
|
}
|
|
else
|
|
{
|
|
m_mapSpecXData.GetAt(KEY_SIZE1, dSize1);
|
|
}
|
|
|
|
AcDbRegion *pReg = GetSection();
|
|
if (pReg == NULL)
|
|
{
|
|
acutPrintf(_T("\nError : FlexiblePipe section not set!"));
|
|
return Acad::eOk;
|
|
}
|
|
|
|
AcGePoint3d ptCen;
|
|
m_mapSpecXData.GetAt(KEY_SECCEN, ptCen);;
|
|
|
|
AecDb3dRoadAxisLine *pRoadAL = AecDb3dRoadAxisLine::cast(m_pBaseCurve);
|
|
if (pRoadAL != NULL)
|
|
{
|
|
AecDb3dRoadAxisLine road;
|
|
road.copyFrom(pRoadAL);
|
|
|
|
AcGePoint2d ptDRatio;
|
|
if (road.ReadDandRatio(ptDRatio))
|
|
{
|
|
road.Create3dRoadAxisLine(ptDRatio.x,ptDRatio.y);
|
|
}
|
|
|
|
AecDbEwPipeBase pipe;
|
|
pipe.SetSection(pReg, ptCen);
|
|
|
|
for (int i = 0; i < road.GetCurveSegCount(); i++)
|
|
{
|
|
AcDbCurve *pCrv = road.GetCurveSeg(i);
|
|
if (pCrv != NULL)
|
|
{
|
|
//投影,变成有宽度的 acdbpolyline
|
|
AcDbPolyline *pPl = OrtherProject2XY(pCrv, dSize1);
|
|
if (pPl != NULL)
|
|
{
|
|
pPl->setLayer(layerId());
|
|
dc.DrawEntity(pPl);
|
|
Add2DBuffer(pPl);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
AcDbLine *pLn = AcDbLine::cast(m_pBaseCurve);
|
|
if (pLn != NULL)
|
|
{
|
|
AecDbEwPipeBase pipe;
|
|
pipe.SetSection(pReg, ptCen);
|
|
|
|
//投影,变成有宽度的 acdbpolyline
|
|
AcDbPolyline *pPl = OrtherProject2XY(pLn, dSize1);
|
|
if (pPl != NULL)
|
|
{
|
|
pPl->setLayer(layerId());
|
|
dc.DrawEntity(pPl);
|
|
Add2DBuffer(pPl);
|
|
}
|
|
}
|
|
|
|
AcDbArc *pArc = AcDbArc::cast(m_pBaseCurve);
|
|
if (pArc != NULL)
|
|
{
|
|
AecDbEwPipeBase pipe;
|
|
pipe.SetSection(pReg, ptCen);
|
|
|
|
//投影,变成有宽度的 acdbpolyline
|
|
AcDbPolyline *pPl = OrtherProject2XY(pArc, dSize1);
|
|
if (pPl != NULL)
|
|
{
|
|
pPl->setLayer(layerId());
|
|
dc.DrawEntity(pPl);
|
|
Add2DBuffer(pPl);
|
|
}
|
|
}
|
|
|
|
AcDbSpline *pSp = AcDbSpline::cast(m_pBaseCurve);
|
|
if (pSp != NULL)
|
|
{
|
|
AecDbEwPipeBase pipe;
|
|
pipe.SetSection(pReg, ptCen);
|
|
|
|
//投影,变成有宽度的 acdbpolyline
|
|
AcDbPolyline *pPl = OrtherProject2XY(pSp, dSize1);
|
|
if (pPl != NULL)
|
|
{
|
|
pPl->setLayer(layerId());
|
|
dc.DrawEntity(pPl);
|
|
Add2DBuffer(pPl);
|
|
}
|
|
}
|
|
|
|
AcDbPolyline *pPl = AcDbPolyline::cast(m_pBaseCurve);
|
|
if (pPl != NULL)
|
|
{
|
|
AecDbEwPipeBase pipe;
|
|
pipe.SetSection(pReg, ptCen);
|
|
|
|
AcDbVoidPtrArray arCurPtrs;
|
|
pPl->explode(arCurPtrs);
|
|
|
|
AcDbCurve *pCrv = NULL;
|
|
for (int i = 0;i < arCurPtrs.length();i++)
|
|
{
|
|
pCrv = (AcDbCurve *)arCurPtrs.at(i);
|
|
|
|
//投影,变成有宽度的 acdbpolyline
|
|
AcDbPolyline *pPlT = OrtherProject2XY(pCrv, dSize1);
|
|
if (pPlT != NULL)
|
|
{
|
|
pPl->setLayer(layerId());
|
|
dc.DrawEntity(pPlT);
|
|
Add2DBuffer(pPlT);
|
|
}
|
|
|
|
DELETE_PTR(pCrv);
|
|
}
|
|
}
|
|
|
|
DELETE_PTR(pReg);
|
|
|
|
return Acad::eOk;
|
|
}
|
|
|
|
Acad::ErrorStatus AecDbEwFlexiblePipe::Draw3d(AcGiDraw &dc) const
|
|
{
|
|
assertReadEnabled();
|
|
|
|
AcCmTransparency tr = transparency();
|
|
AcCmTransparency oldTr = dc.SetTransparency(tr);
|
|
|
|
//图层
|
|
AcDbObjectId idLay = dc.GetLayerId();
|
|
dc.SetLayer(layerId());
|
|
int nCrBk = dc.GetColor();
|
|
|
|
int nColor = nCrBk;
|
|
if (m_mapSpecXData.GetAt(_T("COLOR"), nColor))
|
|
{
|
|
dc.SetColor(nColor);
|
|
}
|
|
|
|
if (IsActive())
|
|
{
|
|
nColor = kMagenta;
|
|
if (m_mapSpecXData.GetAt(KEY_ACTIVECR, nColor))
|
|
{
|
|
if (nColor < 0)
|
|
nColor = colorIndex();
|
|
}
|
|
dc.SetColor(nColor);
|
|
}
|
|
|
|
//AcDb3dSolid
|
|
if (Has3DBuffer())
|
|
{
|
|
Draw3DBuffers(dc);
|
|
return Acad::eOk;
|
|
}
|
|
|
|
AcDbRegion *pReg = GetSection();
|
|
if (pReg == NULL)
|
|
{
|
|
acutPrintf(_T("\nError : FlexiblePipe section not set!"));
|
|
return Acad::eOk;
|
|
}
|
|
|
|
AcGePoint3d ptCen;
|
|
m_mapSpecXData.GetAt(KEY_SECCEN, ptCen);
|
|
|
|
AecDb3dRoadAxisLine *pRoadAL = AecDb3dRoadAxisLine::cast(m_pBaseCurve);
|
|
if (pRoadAL != NULL)
|
|
{
|
|
AecDb3dRoadAxisLine road;
|
|
road.copyFrom(pRoadAL);
|
|
|
|
AcGePoint2d ptDRatio;
|
|
if (road.ReadDandRatio(ptDRatio))
|
|
{
|
|
road.Create3dRoadAxisLine(ptDRatio.x, ptDRatio.y);
|
|
}
|
|
|
|
//--> CurveSeg + pipebase
|
|
AecDbEwPipeBase pipe;
|
|
AcDbVoidPtrArray ar3DEnPtrs;
|
|
pipe.SetSection(pReg,ptCen);
|
|
|
|
AcDb3dPolyline * pPl3d = road.ConvertTo3dPline();
|
|
if (pPl3d != NULL)
|
|
{
|
|
pipe.SetBaseCurve(pPl3d);
|
|
pipe.Draw3d(dc);
|
|
|
|
delete pPl3d;
|
|
|
|
const AcDbVoidPtrArray &arDraw3d = pipe.Get3DBuffer();
|
|
ar3DEnPtrs.append(arDraw3d);
|
|
pipe.Clean3DBufferNoDel();
|
|
}
|
|
|
|
AcDbEntity *pEnt = NULL;
|
|
for (int i = 0;i < ar3DEnPtrs.length();i++)
|
|
{
|
|
pEnt = (AcDbEntity*)ar3DEnPtrs.at(i);
|
|
pEnt->setLayer(layerId());
|
|
dc.DrawEntity(pEnt);
|
|
Add3DBuffer(pEnt);
|
|
}
|
|
}
|
|
|
|
AcDbLine *pLn = AcDbLine::cast(m_pBaseCurve);
|
|
AcDbArc *pArc = AcDbArc::cast(m_pBaseCurve);
|
|
AcDbSpline *pSp = AcDbSpline::cast(m_pBaseCurve);
|
|
if (pLn != NULL || pArc != NULL || pSp != NULL)
|
|
{
|
|
AcDbVoidPtrArray ar3DEnPtrs;
|
|
AecDbEwPipeBase pipe;
|
|
pipe.SetSection(pReg, ptCen);
|
|
|
|
pipe.SetBaseCurve(m_pBaseCurve);
|
|
pipe.Draw3d(dc);
|
|
const AcDbVoidPtrArray &arDraw3d = pipe.Get3DBuffer();
|
|
ar3DEnPtrs.append(arDraw3d);
|
|
pipe.Clean3DBufferNoDel();
|
|
|
|
AcDbEntity *pEnt = NULL;
|
|
for (int i = 0; i < ar3DEnPtrs.length(); i++)
|
|
{
|
|
pEnt = (AcDbEntity *)ar3DEnPtrs.at(i);
|
|
pEnt->setLayer(layerId());
|
|
dc.DrawEntity(pEnt);
|
|
Add3DBuffer(pEnt);
|
|
}
|
|
}
|
|
|
|
AcDbPolyline *pPl = AcDbPolyline::cast(m_pBaseCurve);
|
|
if (pPl != NULL)
|
|
{
|
|
AecDbEwPipeBase pipe;
|
|
pipe.SetSection(pReg, ptCen);
|
|
pipe.SetBaseCurve(pPl);
|
|
|
|
pipe.Draw3d(dc);
|
|
|
|
const AcDbVoidPtrArray &arDraw3d = pipe.Get3DBuffer();
|
|
AcDbVoidPtrArray ar3DEnPtrs;
|
|
ar3DEnPtrs.append(arDraw3d);
|
|
pipe.Clean3DBufferNoDel();
|
|
|
|
AcDbEntity *pEnt = NULL;
|
|
for (int i = 0; i < ar3DEnPtrs.length(); i++)
|
|
{
|
|
pEnt = (AcDbEntity *)ar3DEnPtrs.at(i);
|
|
pEnt->setLayer(layerId());
|
|
dc.DrawEntity(pEnt);
|
|
Add3DBuffer(pEnt);
|
|
}
|
|
}
|
|
|
|
if (pReg != NULL) delete pReg;
|
|
return Acad::eOk;
|
|
}
|
|
|
|
bool AecDbEwFlexiblePipe::TransformAssocInf(int nInf, const AcGeMatrix3d &xform)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
LPCTSTR AecDbEwFlexiblePipe::GetGripCmd() const
|
|
{
|
|
return NULL;
|
|
}
|
|
|
|
//剖切提取,符号法,对于管线构件
|
|
bool AecDbEwFlexiblePipe::GetSectionDraw(AcGePlane &plan, const AcGeVector3d &vtTo, AcDbVoidPtrArray &arRegionPtrs) const
|
|
{
|
|
return false;
|
|
}
|
|
|
|
int AecDbEwFlexiblePipe::ComparedTo(AecDbCurveBase *pCurOther) const
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
SHJson::WValue& AecDbEwFlexiblePipe::ToJson(bool bExprotGeo) const
|
|
{
|
|
SHJson::WValue &js = AecDbCurveBase::ToJson(bExprotGeo);
|
|
return js;
|
|
}
|
|
|
|
bool AecDbEwFlexiblePipe::ByJson(const SHJson::WValue &v)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
bool AecDbEwFlexiblePipe::GetBimInfoTip(CString &sInfoTip) const
|
|
{
|
|
return false;
|
|
} |