1818 lines
39 KiB
C++
1818 lines
39 KiB
C++
#include "stdafx.h"
|
|
#include "AecDb3dRoadFitting.h"
|
|
#include "KTCADUtilityEx.h"
|
|
#include "MFCDbDwgFiler.h"
|
|
#include "KTTempTol.h"
|
|
#include "AecGripCback.h"
|
|
#include "_cgal.h"
|
|
|
|
extern CString IDCreate();
|
|
extern double AsOtherUnit(double dMM);
|
|
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;
|
|
|
|
extern AcGePoint3d GetClosetPointTo(AcGePoint3d& ptIn, AcGeVector3d& vtMaj, AcGeVector3d& vtMin, AcGePoint3d& ptMid, double dD);
|
|
extern AcGePoint3d MidPoint(const AcGePoint3d& pt1,const AcGePoint3d& pt2);
|
|
extern int GetSamplePoints(AcDbCurve* pCrv, AcGePoint3dArray& arPoints);
|
|
extern void PushGripMessage(GripMessage&);
|
|
|
|
extern AcGePoint3d GetArcMidPoint(AcDbArc* pArc);
|
|
extern DLLIMPEXP AcDbArc* FormatArc(const AcGePoint3d& ptGe1,const AcGePoint3d& ptGe2,const AcGePoint3d& ptGe3);
|
|
|
|
static void FreeBuffer(int n,AcDbVoidPtrArray& arEntPtrs)
|
|
{
|
|
AcDbEntity* pEnt = NULL;
|
|
while(arEntPtrs.length() > n )
|
|
{
|
|
pEnt = (AcDbEntity*)arEntPtrs.last();
|
|
if (pEnt != NULL)
|
|
{
|
|
pEnt->erase();
|
|
pEnt->close();
|
|
arEntPtrs.removeLast();
|
|
DELETE_PTR(pEnt);
|
|
}
|
|
}
|
|
}
|
|
|
|
Adesk::UInt32 AecDb3dRoadFitting::kCurrentVersionNumber = 2;
|
|
|
|
ACRX_DXF_DEFINE_MEMBERS (AecDb3dRoadFitting, AecDbEntityBase,
|
|
AcDb::kDHL_CURRENT, AcDb::kMReleaseCurrent,
|
|
AcDbProxyEntity::kNoOperation | AcDbProxyEntity::kDisableProxyWarning,
|
|
AEC_ROADFIT,
|
|
"AecDb3dRoadFitting"
|
|
"|Product Desc: shanghua earthworm app obj"
|
|
"|Company: shanghua inc"
|
|
"|WEB Address: www.shanghuasoft.com")
|
|
|
|
AecDb3dRoadFitting::AecDb3dRoadFitting(void)
|
|
{
|
|
m_pGripAppData = new AecGripData[GRIP_MAXNUM];
|
|
}
|
|
|
|
AecDb3dRoadFitting::~AecDb3dRoadFitting(void)
|
|
{
|
|
delete [] m_pGripAppData;
|
|
}
|
|
|
|
void AecDb3dRoadFitting::SetRoadParam(WPipe::RoadParam* pParam)
|
|
{
|
|
AssertWriteEnabled();
|
|
|
|
/*
|
|
typedef struct RoadParam
|
|
{
|
|
double dCar2W; //中间2车道宽
|
|
double dRRatio; //道路曲率半径,弯头,三四通
|
|
double dThick; //路厚度,经验数值
|
|
double dGrade; //路面横坡度1.5-2.5%
|
|
}ROADPARAM;
|
|
*/
|
|
|
|
if (pParam != NULL)
|
|
{
|
|
m_mapSpecXData.SetAt(KEY_W,pParam->dSize[0]);
|
|
|
|
m_mapSpecXData.SetAt(KEY_SIZE1,pParam->dSize[0]);
|
|
m_mapSpecXData.SetAt(KEY_SIZE2,pParam->dSize[1]);
|
|
m_mapSpecXData.SetAt(KEY_SIZE3,pParam->dSize[2]);
|
|
m_mapSpecXData.SetAt(KEY_SIZE4,pParam->dSize[3]);
|
|
|
|
m_mapSpecXData.SetAt(KEY_RAD,pParam->dRRatio);
|
|
m_mapSpecXData.SetAt(KEY_THICK,pParam->dThick);
|
|
m_mapSpecXData.SetAt(KEY_GRAD,pParam->dGrade);
|
|
m_mapSpecXData.SetAt(PIPE_SPEC,pParam->szSpec);
|
|
}
|
|
}
|
|
|
|
bool AecDb3dRoadFitting::GetRoadParam(WPipe::RoadParam& rp) const
|
|
{
|
|
assertReadEnabled();
|
|
|
|
m_mapSpecXData.GetAt(KEY_W,rp.dSize[0]);
|
|
|
|
BOOL bRelt = m_mapSpecXData.GetAt(KEY_SIZE1,rp.dSize[0]);
|
|
m_mapSpecXData.GetAt(KEY_SIZE2,rp.dSize[1]);
|
|
m_mapSpecXData.GetAt(KEY_SIZE3,rp.dSize[2]);
|
|
m_mapSpecXData.GetAt(KEY_SIZE4,rp.dSize[3]);
|
|
|
|
m_mapSpecXData.GetAt(KEY_RAD,rp.dRRatio);
|
|
m_mapSpecXData.GetAt(KEY_THICK,rp.dThick);
|
|
m_mapSpecXData.GetAt(KEY_GRAD,rp.dGrade);
|
|
|
|
CString sTemp;
|
|
m_mapSpecXData.GetAt(PIPE_SPEC,sTemp);
|
|
_tcscpy(rp.szSpec,sTemp);
|
|
|
|
AcGePoint3d ptMid;
|
|
m_mapSpecXData.GetAt(KEY_MID, ptMid);
|
|
rp.m_dEl = ptMid.z;
|
|
rp.m_nAlign = 1;
|
|
|
|
return bRelt ? true : false;
|
|
}
|
|
|
|
//标准创建
|
|
bool AecDb3dRoadFitting::Create()
|
|
{
|
|
AssertWriteEnabled();
|
|
|
|
bool bSuccess = false;
|
|
|
|
int nType = 0;
|
|
m_mapSpecXData.GetAt(KEY_RUNTIME,nType);
|
|
EFittingType eType = (EFittingType)nType;
|
|
switch( eType )
|
|
{
|
|
case eElbow:
|
|
{
|
|
bSuccess = CreateElbow2d();
|
|
break;
|
|
}
|
|
case eReduceElbow:
|
|
{
|
|
bSuccess = CreateReduceElbow2d();
|
|
break;
|
|
}
|
|
case eTee:
|
|
{
|
|
bSuccess = CreateTee();
|
|
break;
|
|
}
|
|
case eCross:
|
|
{
|
|
bSuccess = CreateCross();
|
|
break;
|
|
}
|
|
case eWye:
|
|
{
|
|
break;
|
|
}
|
|
case eLateral:
|
|
{
|
|
break;
|
|
}
|
|
case eReduce:
|
|
{
|
|
bSuccess = CreateReduce();
|
|
break;
|
|
}
|
|
case eMultInf:
|
|
{
|
|
break;
|
|
}
|
|
default:
|
|
break;
|
|
}
|
|
return bSuccess;
|
|
}
|
|
|
|
void AecDb3dRoadFitting::SetMInfRoad(AecComplexCurve& cmplOut)
|
|
{
|
|
AssertWriteEnabled();
|
|
m_mapSpecXData.SetAt(KEY_RUNTIME,eMultInf);
|
|
m_cmplOutSide.append(cmplOut);
|
|
}
|
|
|
|
bool AecDb3dRoadFitting::CreateElbow2d()
|
|
{
|
|
AssertWriteEnabled();
|
|
|
|
AcGeVector3d vtMaj, vtMin;
|
|
AcGePoint3d ptMid;
|
|
double dDn = 0.0, dRatio = 1.0, dSweepAngle = PI / 2.0, dThick = 0.35;
|
|
|
|
m_mapSpecXData.GetAt(KEY_MAJBR, vtMaj);
|
|
m_mapSpecXData.GetAt(KEY_MINBR, vtMin);
|
|
m_mapSpecXData.GetAt(KEY_MID, ptMid);
|
|
|
|
m_mapSpecXData.GetAt(PIPE_DN, dDn);
|
|
|
|
m_mapSpecXData.GetAt(PIPE_RATIO, dRatio);
|
|
m_mapSpecXData.GetAt(PIPE_ELBOWANG, dSweepAngle);
|
|
m_mapSpecXData.GetAt(PIPE_THICK, dThick);
|
|
|
|
AcGeVector3d vtNorm = vtMin.crossProduct(vtMaj);
|
|
AcDbCurve* pTemp = NULL;
|
|
double dR = dDn;
|
|
AcGePoint3d ptFr;
|
|
|
|
AcDbArc* pArcElbow = KTCADUtilityEx::FormatArc(vtMaj, vtMin, ptMid, ptFr, dSweepAngle, dR, dRatio);
|
|
if (pArcElbow != NULL)//可以合成ARC
|
|
{
|
|
AcGePoint3d ptGe[2];
|
|
|
|
//如果是俯视图
|
|
if (vtNorm.isParallelTo(AcGeVector3d::kZAxis))//水平
|
|
{
|
|
dR = pArcElbow->radius();
|
|
AcDbArc* pArcOut = (AcDbArc*)pArcElbow->clone();
|
|
AcDbArc* pArcIn = (AcDbArc*)pArcElbow->clone();
|
|
|
|
pArcOut->setRadius(dR + 0.5 * dDn);
|
|
pArcIn->setRadius(dR - 0.5 * dDn);
|
|
|
|
AecEqui::AecCurveElement el;
|
|
|
|
m_cmplOutSide.removeAll();
|
|
|
|
//隐藏的元素用于记录接口
|
|
pArcOut->getStartPoint(ptGe[0]);
|
|
pArcIn->getStartPoint(ptGe[1]);
|
|
memset(&el,0,sizeof(AecEqui::AecCurveElement));
|
|
el.ptGe[0] = ptGe[0];
|
|
el.ptGe[1] = ptGe[1];
|
|
el.ptGe[2] = el.ptGe[1];
|
|
el.bHided = TRUE;
|
|
m_cmplOutSide.append(el);
|
|
|
|
pArcOut->getEndPoint(ptGe[0]);
|
|
pArcIn->getEndPoint(ptGe[1]);
|
|
el.ptGe[0] = ptGe[0];
|
|
el.ptGe[1] = ptGe[1];
|
|
el.ptGe[2] = el.ptGe[1];
|
|
el.bHided = TRUE;
|
|
m_cmplOutSide.append(el);
|
|
|
|
memset(&el,0,sizeof(AecEqui::AecCurveElement));
|
|
AecComplexCurve::MakeElement(el,pArcIn);
|
|
m_cmplOutSide.append(el);
|
|
|
|
memset(&el,0,sizeof(AecEqui::AecCurveElement));
|
|
AecComplexCurve::MakeElement(el,pArcOut);
|
|
m_cmplOutSide.append(el);
|
|
|
|
delete pArcOut;
|
|
delete pArcIn;
|
|
delete pArcElbow;
|
|
return true;
|
|
}
|
|
delete pArcElbow;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
bool AecDb3dRoadFitting::CreateReduceElbow2d()
|
|
{
|
|
AssertWriteEnabled();
|
|
|
|
AcGeVector3d vtMaj, vtMin;
|
|
AcGePoint3d ptMid;
|
|
double dDn = 0.0, dRatio = 1.0, dSweepAngle = PI / 2.0, dThick = 0.35,dTDn = 0.0;
|
|
|
|
m_mapSpecXData.GetAt(KEY_MAJBR, vtMaj);
|
|
m_mapSpecXData.GetAt(KEY_MINBR, vtMin);
|
|
m_mapSpecXData.GetAt(KEY_MID, ptMid);
|
|
|
|
m_mapSpecXData.GetAt(PIPE_DN, dDn);
|
|
dTDn = dDn;
|
|
m_mapSpecXData.GetAt(PIPE_TDN, dTDn);
|
|
|
|
m_mapSpecXData.GetAt(PIPE_RATIO, dRatio);
|
|
m_mapSpecXData.GetAt(PIPE_ELBOWANG, dSweepAngle);
|
|
m_mapSpecXData.GetAt(PIPE_THICK, dThick);
|
|
|
|
AcGeVector3d vtNorm = vtMin.crossProduct(vtMaj);
|
|
AcDbCurve* pTemp = NULL;
|
|
double dR = dDn;
|
|
AcGePoint3d ptFr;
|
|
|
|
AcDbArc* pArcElbow = KTCADUtilityEx::FormatArc(vtMaj, vtMin, ptMid, ptFr, dSweepAngle, dR, dRatio);
|
|
if (pArcElbow != NULL)//可以合成ARC
|
|
{
|
|
AcGePoint3d ptGe[2];
|
|
|
|
//如果是俯视图
|
|
if (vtNorm.isParallelTo(AcGeVector3d::kZAxis))//水平
|
|
{
|
|
dR = pArcElbow->radius();
|
|
|
|
AcGePoint3d ptArc[3];
|
|
pArcElbow->getStartPoint(ptArc[0]);
|
|
pArcElbow->getEndPoint(ptArc[2]);
|
|
ptArc[1] = GetArcMidPoint(pArcElbow);
|
|
|
|
AcGeVector3d vtM;
|
|
pArcElbow->getFirstDeriv(ptArc[0],vtM);
|
|
|
|
if (!vtM.isParallelTo(vtMaj))
|
|
{
|
|
AcGePoint3d ptTmp = ptArc[0];
|
|
ptArc[0] = ptArc[2];
|
|
ptArc[2] = ptTmp;
|
|
}
|
|
|
|
AcGePoint3d ptCen = pArcElbow->center();
|
|
AcGeVector3d vtO = ptArc[0] - ptCen;
|
|
vtO.normalize();
|
|
|
|
double dMDn = (dDn + dTDn) * 0.5;
|
|
|
|
AcGePoint3d ptOut[3];
|
|
ptOut[0] = ptArc[0] + vtO * 0.5 * dDn;
|
|
|
|
vtO = ptArc[2] - ptCen;
|
|
vtO.normalize();
|
|
ptOut[2] = ptArc[2] + vtO * 0.5 * dTDn;
|
|
|
|
vtO = ptArc[1] - ptCen;
|
|
vtO.normalize();
|
|
ptOut[1] = ptArc[1] + vtO * 0.5 * dMDn;
|
|
|
|
AcDbArc* pArcOut = FormatArc(ptOut[0],ptOut[1],ptOut[2]);
|
|
|
|
|
|
AcGePoint3d ptIn[3];
|
|
vtO = ptArc[0] - ptCen;
|
|
vtO.normalize();
|
|
|
|
ptIn[0] = ptArc[0] - vtO * 0.5 * dDn;
|
|
|
|
vtO = ptArc[2] - ptCen;
|
|
vtO.normalize();
|
|
ptIn[2] = ptArc[2] - vtO * 0.5 * dTDn;
|
|
|
|
vtO = ptArc[1] - ptCen;
|
|
vtO.normalize();
|
|
ptIn[1] = ptArc[1] - vtO * 0.5 * dMDn;
|
|
|
|
AcDbArc* pArcIn = FormatArc(ptIn[0],ptIn[1],ptIn[2]);
|
|
|
|
if (pArcElbow != NULL && pArcIn != NULL && pArcOut != NULL)
|
|
{
|
|
AecEqui::AecCurveElement el;
|
|
m_cmplOutSide.removeAll();
|
|
|
|
//隐藏的元素用于记录接口
|
|
pArcOut->getStartPoint(ptGe[0]);
|
|
pArcIn->getStartPoint(ptGe[1]);
|
|
memset(&el,0,sizeof(AecEqui::AecCurveElement));
|
|
el.ptGe[0] = ptGe[0];
|
|
el.ptGe[1] = ptGe[1];
|
|
el.ptGe[2] = el.ptGe[1];
|
|
el.bHided = TRUE;
|
|
m_cmplOutSide.append(el);
|
|
|
|
pArcOut->getEndPoint(ptGe[0]);
|
|
pArcIn->getEndPoint(ptGe[1]);
|
|
el.ptGe[0] = ptGe[0];
|
|
el.ptGe[1] = ptGe[1];
|
|
el.ptGe[2] = el.ptGe[1];
|
|
el.bHided = TRUE;
|
|
m_cmplOutSide.append(el);
|
|
|
|
memset(&el,0,sizeof(AecEqui::AecCurveElement));
|
|
AecComplexCurve::MakeElement(el,pArcIn);
|
|
m_cmplOutSide.append(el);
|
|
|
|
memset(&el,0,sizeof(AecEqui::AecCurveElement));
|
|
AecComplexCurve::MakeElement(el,pArcOut);
|
|
m_cmplOutSide.append(el);
|
|
|
|
delete pArcOut;
|
|
delete pArcIn;
|
|
delete pArcElbow;
|
|
return true;
|
|
}
|
|
}
|
|
delete pArcElbow;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
bool AecDb3dRoadFitting::CharferArc(AecEqui::AecCurveElement& el,AecEqui::AecCurveElement& elT,AecEqui::AecCurveElement& elArc,const AcGePoint3d& ptInt,double dR)
|
|
{
|
|
AcDbLine* pLn1 = NULL;
|
|
AcDbLine* pLn2 = NULL;
|
|
|
|
AecComplexCurve::MakeLine(el,pLn1);
|
|
AecComplexCurve::MakeLine(elT,pLn2);
|
|
|
|
if (pLn1 != NULL && pLn2 != NULL)
|
|
{
|
|
AcDbArc* pArc = CharferArc(pLn1,pLn2,ptInt,dR);
|
|
if (pArc != NULL)
|
|
{
|
|
if ( AecComplexCurve::MakeElement(elArc,pArc) )
|
|
{
|
|
AecComplexCurve::MakeElement(el,pLn1);
|
|
AecComplexCurve::MakeElement(elT,pLn2);
|
|
|
|
delete pLn1;
|
|
delete pLn2;
|
|
return true;
|
|
}
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
AcDbArc* AecDb3dRoadFitting::CharferArc(AcDbLine*& pLn1,AcDbLine*& pLn2,const AcGePoint3d& ptInt,double dR)
|
|
{
|
|
if (pLn1 != NULL && pLn2 != NULL)
|
|
{
|
|
AcDbLine ln1Bk;
|
|
ln1Bk.setStartPoint(pLn1->startPoint());
|
|
ln1Bk.setEndPoint(pLn1->endPoint());
|
|
|
|
AcDbLine ln2Bk;
|
|
ln2Bk.setStartPoint(pLn2->startPoint());
|
|
ln2Bk.setEndPoint(pLn2->endPoint());
|
|
|
|
bool bRes1 = (pLn1->endPoint().distanceTo(ptInt)) < 1.e-1 ? true : false;
|
|
bool bRes2 = (pLn2->endPoint().distanceTo(ptInt)) < 1.e-1 ? true : false;
|
|
|
|
AcGeVector3d vt1 = ( bRes1 ? pLn1->startPoint() : pLn1->endPoint() ) - ptInt;
|
|
AcGeVector3d vt2 = ( bRes2 ? pLn2->startPoint() : pLn2->endPoint() ) - ptInt;
|
|
|
|
vt1.normalize();
|
|
vt2.normalize();
|
|
|
|
//角平分线
|
|
AcGeVector3d vt3 = vt1 + vt2;
|
|
vt3.normalize();
|
|
|
|
AcGePoint3d ptT = ptInt + vt3 * 100.0;
|
|
AcGePoint3d ptT1;
|
|
pLn1->getClosestPointTo(ptT,ptT1,Adesk::kTrue);
|
|
|
|
AcGePoint3d ptT2;
|
|
pLn2->getClosestPointTo(ptT,ptT2,Adesk::kTrue);
|
|
|
|
AcGeVector3d vtT1 = ptT1 - ptT;
|
|
vtT1.normalize();
|
|
vtT1 *= dR;
|
|
ptT1 -= vtT1;
|
|
|
|
AcGeVector3d vtT2 = ptT2 - ptT;
|
|
vtT2.normalize();
|
|
vtT2 *= dR;
|
|
ptT2 -= vtT2;
|
|
|
|
AcGeLine3d ln1(ptT1,vt1);
|
|
AcGeLine3d ln2(ptT2,vt2);
|
|
|
|
//倒圆圆心
|
|
if ( ln1.intersectWith(ln2,ptT) )
|
|
{
|
|
pLn1->getClosestPointTo(ptT,ptT1,Adesk::kTrue);
|
|
pLn2->getClosestPointTo(ptT,ptT2,Adesk::kTrue);
|
|
|
|
ptT -= vt3 * dR;
|
|
AcDbArc* pArc = KTCADUtilityEx::FormatArc(ptT1,ptT,ptT2);
|
|
if (pArc != NULL)
|
|
{
|
|
vt1 = ptT1 - ptInt;
|
|
vt2 = ptT2 - ptInt;
|
|
|
|
AcGeVector3d vt11 = ( bRes1 ? pLn1->startPoint() : pLn1->endPoint() ) - ptT1;
|
|
AcGeVector3d vt22 = ( bRes2 ? pLn2->startPoint() : pLn2->endPoint() ) - ptT2;
|
|
|
|
if (vt11.isCodirectionalTo(vt1))//pLn1有预留
|
|
{
|
|
if (bRes1)
|
|
pLn1->setEndPoint(ptT1);
|
|
else
|
|
pLn1->setStartPoint(ptT1);
|
|
}
|
|
else//超出,取极限
|
|
{
|
|
delete pArc;
|
|
pArc = NULL;
|
|
acutPrintf(_T("\n曲率半径过大!"));
|
|
|
|
//降低曲率半径,保证直边
|
|
for (int ii = 1;ii < 10;ii++)
|
|
{
|
|
dR *= (1 - 0.1 * ii);
|
|
|
|
pLn1->setStartPoint(ln1Bk.startPoint());
|
|
pLn1->setEndPoint(ln1Bk.endPoint());
|
|
pLn2->setStartPoint(ln2Bk.startPoint());
|
|
pLn2->setEndPoint(ln2Bk.endPoint());
|
|
|
|
pArc = CharferArc(pLn1,pLn2,ptInt,dR);
|
|
if (pArc != NULL)
|
|
{
|
|
return pArc;
|
|
}
|
|
}
|
|
}
|
|
|
|
if (vt22.isCodirectionalTo(vt2))//pLn2有预留
|
|
{
|
|
if (bRes2)
|
|
pLn2->setEndPoint(ptT2);
|
|
else
|
|
pLn2->setStartPoint(ptT2);
|
|
}
|
|
else//超出,取极限
|
|
{
|
|
if (pArc != NULL)
|
|
delete pArc;
|
|
pArc = NULL;
|
|
acutPrintf(_T("\n曲率半径过大!采用自适应曲率!"));
|
|
|
|
pLn1->setStartPoint(ln1Bk.startPoint());
|
|
pLn1->setEndPoint(ln1Bk.endPoint());
|
|
|
|
|
|
//降低曲率半径,保证直边
|
|
for (int ii = 1;ii < 10;ii++)
|
|
{
|
|
dR *= (1 - 0.1 * ii);
|
|
|
|
pLn1->setStartPoint(ln1Bk.startPoint());
|
|
pLn1->setEndPoint(ln1Bk.endPoint());
|
|
pLn2->setStartPoint(ln2Bk.startPoint());
|
|
pLn2->setEndPoint(ln2Bk.endPoint());
|
|
|
|
pArc = CharferArc(pLn1,pLn2,ptInt,dR);
|
|
if (pArc != NULL)
|
|
{
|
|
return pArc;
|
|
}
|
|
}
|
|
}
|
|
return pArc;
|
|
}
|
|
}
|
|
}
|
|
return NULL;
|
|
}
|
|
|
|
bool AecDb3dRoadFitting::CreateTee()
|
|
{
|
|
AssertWriteEnabled();
|
|
|
|
AcGeVector3d vtMaj,vtMin;
|
|
AcGePoint3d ptMid;
|
|
double dDn = 0.0,dRatio = 1.0,dSweepAngle = PI / 2.0,dThick = 0.35;
|
|
double dLen1 = 0.0,dLen2 = 0.0,dTDn = 0.0;
|
|
|
|
m_mapSpecXData.GetAt(KEY_MAJBR, vtMaj);
|
|
m_mapSpecXData.GetAt(KEY_MINBR, vtMin);
|
|
m_mapSpecXData.GetAt(KEY_MID, ptMid);
|
|
m_mapSpecXData.GetAt(PIPE_DN, dDn);
|
|
m_mapSpecXData.GetAt(PIPE_TDN, dTDn);
|
|
m_mapSpecXData.GetAt(PIPE_THICK, dThick);
|
|
m_mapSpecXData.GetAt(PIPE_RATIO, dRatio);
|
|
m_mapSpecXData.GetAt(KEY_L, dLen1);
|
|
m_mapSpecXData.GetAt(KEY_T, dLen2);
|
|
|
|
double dRR = dDn * dRatio;
|
|
AcGePoint3d ptCen = ptMid;
|
|
|
|
vtMaj.normalize();
|
|
vtMin.normalize();
|
|
|
|
AcGeVector3d vtNorm = vtMin.crossProduct(vtMaj);
|
|
if (vtNorm.isParallelTo(AcGeVector3d::kZAxis))
|
|
{
|
|
AcGePoint3d ptGe1,ptGe2;
|
|
AcGeVector3d vtLine = vtMaj;
|
|
vtLine.normalize();
|
|
|
|
//中心线
|
|
ptGe1 = ptCen - vtLine * dLen1;
|
|
ptGe2 = ptCen + vtLine * dLen1;
|
|
|
|
AcGePoint3d ptGe3 = ptMid;
|
|
AcGeVector3d vtT = vtMin;
|
|
vtT.normalize();
|
|
ptGe3 += dLen2 * vtT;
|
|
|
|
//轮廓线
|
|
AcGePoint3d ptGe[8];
|
|
/*
|
|
0-----------------1
|
|
3 4
|
|
2------| |------5
|
|
| |
|
|
|6 |7
|
|
*/
|
|
|
|
double dAngle = vtMin.angleTo(vtMaj,vtNorm);
|
|
double dLTDn = dTDn / sin(dAngle);
|
|
double dLDn = dDn / sin(dAngle);
|
|
|
|
AcGeVector3d vtV = vtMin;
|
|
vtV = vtMin.orthoProject(vtMaj);
|
|
vtV.normalize();
|
|
|
|
AcGePoint3d ptGe4 = ptMid + vtMin * dLDn * 0.5;
|
|
|
|
ptGe[0] = ptGe1 - vtV * dDn * 0.5;
|
|
ptGe[1] = ptGe2 - vtV * dDn * 0.5;
|
|
|
|
ptGe[2] = ptGe[0] + vtV * dDn;
|
|
ptGe[5] = ptGe[1] + vtV * dDn;
|
|
|
|
ptGe[3] = ptGe4 - vtMaj * dLTDn * 0.5;
|
|
ptGe[4] = ptGe4 + vtMaj * dLTDn * 0.5;
|
|
|
|
//ptGe[3] = ptGe[2] + vtMaj * (dLen1 - dLTDn * 0.5);
|
|
//ptGe[4] = ptGe[5] - vtMaj * (dLen1 - dLTDn * 0.5);
|
|
|
|
AcGeVector3d vtM = vtMaj.orthoProject(vtMin);
|
|
vtM.normalize();
|
|
|
|
ptGe4 += vtMin * (dLen2 - dLDn * 0.5);
|
|
ptGe[6] = ptGe4 - vtM * dTDn * 0.5;
|
|
ptGe[7] = ptGe4 + vtM * dTDn * 0.5;
|
|
|
|
//ptGe[6] = ptGe[3] + vtMin * (dLen2 - dLDn * 0.5);
|
|
//ptGe[7] = ptGe[4] + vtMin * (dLen2 - dLDn * 0.5);
|
|
|
|
//L 方向
|
|
AcDbLine* pOutLine[8];
|
|
pOutLine[0] = new AcDbLine;
|
|
pOutLine[0]->setStartPoint(ptGe[0]);
|
|
pOutLine[0]->setEndPoint(ptGe[1]);
|
|
|
|
pOutLine[1] = new AcDbLine;//
|
|
pOutLine[1]->setStartPoint(ptGe[2]);
|
|
pOutLine[1]->setEndPoint(ptGe[3]);
|
|
|
|
pOutLine[2] = new AcDbLine;//
|
|
pOutLine[2]->setStartPoint(ptGe[4]);
|
|
pOutLine[2]->setEndPoint(ptGe[5]);
|
|
|
|
pOutLine[3] = NULL;
|
|
pOutLine[4] = NULL;
|
|
|
|
//T 方向
|
|
pOutLine[5] = new AcDbLine;//
|
|
pOutLine[5]->setStartPoint(ptGe[3]);
|
|
pOutLine[5]->setEndPoint(ptGe[6]);
|
|
|
|
pOutLine[6] = new AcDbLine;//
|
|
pOutLine[6]->setStartPoint(ptGe[4]);
|
|
pOutLine[6]->setEndPoint(ptGe[7]);
|
|
|
|
pOutLine[7] = NULL;
|
|
|
|
//倒圆
|
|
AcDbArc* pArc1 = NULL;
|
|
pArc1 = CharferArc(pOutLine[1],pOutLine[5],ptGe[3],dRR);
|
|
|
|
AcDbArc* pArc2 = NULL;
|
|
pArc2 = CharferArc(pOutLine[2],pOutLine[6],ptGe[4],dRR);
|
|
|
|
AecEqui::AecCurveElement el;
|
|
memset(&el,0,sizeof(AecEqui::AecCurveElement));
|
|
|
|
for (int i = 0;i < 8;i++)
|
|
{
|
|
if (pOutLine[i] != NULL)
|
|
{
|
|
el.ptGe[0] = pOutLine[i]->startPoint();
|
|
el.ptGe[1] = pOutLine[i]->endPoint();
|
|
el.ptGe[2] = el.ptGe[1];
|
|
m_cmplOutSide.append(el);
|
|
}
|
|
}
|
|
|
|
if (pArc1 != NULL)
|
|
{
|
|
if ( AecComplexCurve::MakeElement(el,pArc1) )
|
|
{
|
|
m_cmplOutSide.append(el);
|
|
}
|
|
}
|
|
|
|
if (pArc2 != NULL)
|
|
{
|
|
if ( AecComplexCurve::MakeElement(el,pArc2) )
|
|
{
|
|
m_cmplOutSide.append(el);
|
|
}
|
|
}
|
|
|
|
//隐藏的元素用于记录接口
|
|
el.ptGe[0] = ptGe[0];
|
|
el.ptGe[1] = ptGe[2];
|
|
el.ptGe[2] = el.ptGe[1];
|
|
el.bHided = TRUE;
|
|
m_cmplOutSide.append(el);
|
|
|
|
el.ptGe[0] = ptGe[1];
|
|
el.ptGe[1] = ptGe[5];
|
|
el.ptGe[2] = el.ptGe[1];
|
|
el.bHided = TRUE;
|
|
m_cmplOutSide.append(el);
|
|
|
|
el.ptGe[0] = ptGe[6];
|
|
el.ptGe[1] = ptGe[7];
|
|
el.ptGe[2] = el.ptGe[1];
|
|
el.bHided = TRUE;
|
|
m_cmplOutSide.append(el);
|
|
}
|
|
return true;
|
|
}
|
|
|
|
bool AecDb3dRoadFitting::CreateCross()
|
|
{
|
|
AssertWriteEnabled();
|
|
|
|
AcGeVector3d vtMaj,vtMin;
|
|
AcGePoint3d ptMid;
|
|
double dDn = 0.0,dRatio = 1.0,dThick = 0.35;
|
|
double dLen1 = 0.0,dLen2 = 0.0,dTDn = 0.0;
|
|
m_mapSpecXData.GetAt(KEY_MAJBR, vtMaj);
|
|
m_mapSpecXData.GetAt(KEY_MINBR, vtMin);
|
|
m_mapSpecXData.GetAt(KEY_MID, ptMid);
|
|
m_mapSpecXData.GetAt(PIPE_DN, dDn);
|
|
m_mapSpecXData.GetAt(PIPE_TDN, dTDn);
|
|
m_mapSpecXData.GetAt(PIPE_THICK, dThick);
|
|
m_mapSpecXData.GetAt(KEY_L, dLen1);
|
|
m_mapSpecXData.GetAt(KEY_T, dLen2);
|
|
m_mapSpecXData.GetAt(PIPE_RATIO, dRatio);
|
|
|
|
double dR = dRatio * dDn;
|
|
|
|
AcGePoint3d ptCen(0, 0, 0);
|
|
AcGePoint3d ptSta,ptEnd;
|
|
vtMaj.normalize();
|
|
vtMin.normalize();
|
|
|
|
AcGeVector3d vtNorm = vtMaj.crossProduct(vtMin);
|
|
if (vtNorm.isParallelTo(AcGeVector3d::kZAxis))//水平
|
|
{
|
|
/* 9 10
|
|
| |
|
|
7__| 11|__0
|
|
8
|
|
__5 2 __1
|
|
6 | |
|
|
4| |3
|
|
*/
|
|
AcGePoint3d ptGeT,ptGe[13];
|
|
AcGeVector3d vtR = vtMin;
|
|
vtR.normalize();
|
|
AcGeVector3d vtM = vtMaj;
|
|
vtM.normalize();
|
|
|
|
ptGeT = ptMid + dLen1 * vtM;
|
|
ptGe[0] = ptGeT + dDn * 0.5 * vtR;
|
|
ptGe[1] = ptGeT - dDn * 0.5 * vtR;
|
|
|
|
ptGe[2] = ptGe[1] - (dLen1 - dTDn * 0.5) * vtM;
|
|
ptGe[11] = ptGe[0] - (dLen1 - dTDn * 0.5) * vtM;
|
|
|
|
ptGe[3] = ptGe[2] - (dLen2 - dDn * 0.5) * vtR;
|
|
ptGe[10] = ptGe[11] + (dLen2 - dDn * 0.5) * vtR;
|
|
|
|
ptGe[4] = ptGe[3] - dTDn * vtM;
|
|
ptGe[9] = ptGe[10] - dTDn * vtM;
|
|
|
|
ptGe[8] = ptGe[11] - dTDn * vtM;
|
|
ptGe[5] = ptGe[2] - dTDn * vtM;
|
|
|
|
ptGe[7] = ptGe[8] - (dLen1 - dTDn * 0.5) * vtM;
|
|
ptGe[6] = ptGe[5] - (dLen1 - dTDn * 0.5) * vtM;
|
|
ptGe[12] = ptGe[0];
|
|
|
|
//轮廓线
|
|
AcDbLine* pOutLine[8];
|
|
pOutLine[0] = new AcDbLine(ptGe[1],ptGe[2]);
|
|
pOutLine[1] = new AcDbLine(ptGe[2],ptGe[3]);
|
|
|
|
pOutLine[2] = new AcDbLine(ptGe[4],ptGe[5]);
|
|
pOutLine[3] = new AcDbLine(ptGe[5],ptGe[6]);
|
|
|
|
pOutLine[4] = new AcDbLine(ptGe[7],ptGe[8]);
|
|
pOutLine[5] = new AcDbLine(ptGe[8],ptGe[9]);
|
|
|
|
pOutLine[6] = new AcDbLine(ptGe[10],ptGe[11]);
|
|
pOutLine[7] = new AcDbLine(ptGe[11],ptGe[0]);
|
|
|
|
AecEqui::AecCurveElement el;
|
|
memset(&el,0,sizeof(AecEqui::AecCurveElement));
|
|
|
|
AcDbArc* pArc = CharferArc(pOutLine[0],pOutLine[1],ptGe[2],dR);
|
|
if (pArc != NULL)
|
|
{
|
|
if ( AecComplexCurve::MakeElement(el,pArc) )
|
|
{
|
|
m_cmplOutSide.append(el);
|
|
}
|
|
}
|
|
|
|
pArc = CharferArc(pOutLine[2],pOutLine[3],ptGe[5],dR);
|
|
if (pArc != NULL)
|
|
{
|
|
if ( AecComplexCurve::MakeElement(el,pArc) )
|
|
{
|
|
m_cmplOutSide.append(el);
|
|
}
|
|
}
|
|
|
|
pArc = CharferArc(pOutLine[4],pOutLine[5],ptGe[8],dR);
|
|
if (pArc != NULL)
|
|
{
|
|
if ( AecComplexCurve::MakeElement(el,pArc) )
|
|
{
|
|
m_cmplOutSide.append(el);
|
|
}
|
|
}
|
|
|
|
pArc = CharferArc(pOutLine[6],pOutLine[7],ptGe[11],dR);
|
|
if (pArc != NULL)
|
|
{
|
|
if ( AecComplexCurve::MakeElement(el,pArc) )
|
|
{
|
|
m_cmplOutSide.append(el);
|
|
}
|
|
}
|
|
|
|
for (int i = 0;i < 8;i++)
|
|
{
|
|
if (pOutLine[i] != NULL)
|
|
{
|
|
el.ptGe[0] = pOutLine[i]->startPoint();
|
|
el.ptGe[1] = pOutLine[i]->endPoint();
|
|
el.ptGe[2] = el.ptGe[1];
|
|
m_cmplOutSide.append(el);
|
|
}
|
|
}
|
|
|
|
/* 9 10
|
|
| |
|
|
7__| 11|__0
|
|
8
|
|
__5 2 __1
|
|
6 | |
|
|
4| |3
|
|
*/
|
|
|
|
//隐藏的元素用于记录接口
|
|
el.ptGe[0] = ptGe[6];
|
|
el.ptGe[1] = ptGe[7];
|
|
el.ptGe[2] = el.ptGe[1];
|
|
el.bHided = TRUE;
|
|
m_cmplOutSide.append(el);
|
|
|
|
el.ptGe[0] = ptGe[0];
|
|
el.ptGe[1] = ptGe[1];
|
|
el.ptGe[2] = el.ptGe[1];
|
|
el.bHided = TRUE;
|
|
m_cmplOutSide.append(el);
|
|
|
|
el.ptGe[0] = ptGe[3];
|
|
el.ptGe[1] = ptGe[4];
|
|
el.ptGe[2] = el.ptGe[1];
|
|
el.bHided = TRUE;
|
|
m_cmplOutSide.append(el);
|
|
|
|
el.ptGe[0] = ptGe[9];
|
|
el.ptGe[1] = ptGe[10];
|
|
el.ptGe[2] = el.ptGe[1];
|
|
el.bHided = TRUE;
|
|
m_cmplOutSide.append(el);
|
|
}
|
|
return true;
|
|
}
|
|
|
|
bool AecDb3dRoadFitting::CreateReduce()
|
|
{
|
|
assertReadEnabled();
|
|
AcGePoint3d ptSta, ptEnd, ptMid;
|
|
AcDbObjectId id1, id2;
|
|
AcGeVector3d vtMaj, vtNorm;
|
|
double dDn = 0.0, dOd = 0.0, dThk = 0.0;
|
|
double dEDn = 0.0, dEOd = 0.0;
|
|
int nDir = 0;
|
|
BOOL bSuccess = FALSE;
|
|
CString strTemp, sMaterial;
|
|
|
|
m_mapSpecXData.GetAt(KEY_MAJBR, vtMaj);
|
|
m_mapSpecXData.GetAt(KEY_NORMAL, vtNorm);
|
|
m_mapSpecXData.GetAt(KEY_START, ptSta);
|
|
m_mapSpecXData.GetAt(KEY_END, ptEnd);
|
|
|
|
m_mapSpecXData.GetAt(PIPE_DN, dDn);
|
|
m_mapSpecXData.GetAt(PIPE_OD, dOd);
|
|
m_mapSpecXData.GetAt(PIPE_EDN, dEDn);
|
|
m_mapSpecXData.GetAt(PIPE_EOD, dEOd);
|
|
m_mapSpecXData.GetAt(PIPE_THICK, dThk);
|
|
|
|
double dD1 = dDn, dD2 = dEDn;
|
|
|
|
AcGeLine3d ln3d(ptSta,10.0 * vtMaj);
|
|
AcGePoint3d ptGe[2];
|
|
|
|
|
|
if (ln3d.isParallelTo(AcGePlane::kXYPlane)) //
|
|
{
|
|
AcGeVector3d vt = vtMaj;
|
|
vtMaj.normalize();
|
|
vt.normalize();
|
|
vt.rotateBy(PI / 2.0,AcGeVector3d::kZAxis);
|
|
|
|
AcGePoint3d ptGeOutLine1[2],ptGeOutLine2[2];
|
|
AcGePoint3d ptGePipe[2];
|
|
|
|
ptGePipe[0] = ptSta;
|
|
ptGePipe[1] = ptEnd;
|
|
|
|
ptGeOutLine1[0] = ptGePipe[0];
|
|
ptGeOutLine1[0] += vt * dDn / 2.0; // 画公称d
|
|
|
|
ptGeOutLine1[1] = ptGePipe[1];
|
|
ptGeOutLine1[1] += vt * dEDn / 2.0; // 画公称d
|
|
|
|
ptGeOutLine2[0] = ptGePipe[0];
|
|
ptGeOutLine2[0] -= vt * dDn / 2.0; // 画公称d
|
|
|
|
ptGeOutLine2[1] = ptGePipe[1];
|
|
ptGeOutLine2[1] -= vt * dEDn / 2.0; // 画公称d
|
|
|
|
// 双线,轮廓平行XY面
|
|
AecEqui::AecCurveElement el;
|
|
memset(&el, 0, sizeof(AecEqui::AecCurveElement));
|
|
|
|
el.ptGe[0] = ptGeOutLine1[0];
|
|
el.ptGe[1] = ptGeOutLine1[1];
|
|
el.ptGe[2] = el.ptGe[1];
|
|
m_cmplOutSide.append(el);
|
|
|
|
el.ptGe[0] = ptGeOutLine2[0];
|
|
el.ptGe[1] = ptGeOutLine2[1];
|
|
el.ptGe[2] = el.ptGe[1];
|
|
m_cmplOutSide.append(el);
|
|
|
|
//隐藏的元素用于记录接口
|
|
el.ptGe[0] = ptGeOutLine1[0];
|
|
el.ptGe[1] = ptGeOutLine2[0];
|
|
el.ptGe[2] = el.ptGe[1];
|
|
el.bHided = TRUE;
|
|
m_cmplOutSide.append(el);
|
|
|
|
el.ptGe[0] = ptGeOutLine1[1];
|
|
el.ptGe[1] = ptGeOutLine2[1];
|
|
el.ptGe[2] = el.ptGe[1];
|
|
el.bHided = TRUE;
|
|
m_cmplOutSide.append(el);
|
|
}
|
|
return true;
|
|
}
|
|
|
|
//环岛
|
|
void AecDb3dRoadFitting::SetRoundabout(AcDbPolyline* pPl)
|
|
{
|
|
AssertWriteEnabled();
|
|
|
|
int nFr = m_cmplInSide.length();
|
|
|
|
if (pPl != NULL && pPl->isClosed())
|
|
{
|
|
AcDbVoidPtrArray arSubCrv;
|
|
pPl->explode(arSubCrv);
|
|
|
|
AcDbCurve* pCurve = NULL;
|
|
for (int i = 0;i < arSubCrv.length();i++)
|
|
{
|
|
pCurve = (AcDbCurve*)arSubCrv.at(i);
|
|
m_cmplInSide.append(pCurve);
|
|
delete pCurve;
|
|
}
|
|
}
|
|
|
|
//设置标高
|
|
WPipe::RoadParam rp;
|
|
memset(&rp, 0, sizeof(WPipe::RoadParam));
|
|
GetRoadParam(rp);
|
|
|
|
for (int i = nFr;i < m_cmplInSide.length();i++)
|
|
{
|
|
AecEqui::AecCurveElement& el = m_cmplInSide.atByRef(i);
|
|
el.ptGe[0].z = rp.m_dEl; el.ptGe[1].z = rp.m_dEl; el.ptGe[2].z = rp.m_dEl;
|
|
}
|
|
}
|
|
|
|
void AecDb3dRoadFitting::RemoveRoundabout()
|
|
{
|
|
AssertWriteEnabled();
|
|
m_cmplInSide.removeAll();
|
|
}
|
|
|
|
void AecDb3dRoadFitting::RemoveAll()
|
|
{
|
|
AssertWriteEnabled();
|
|
m_cmplOutSide.removeAll();
|
|
}
|
|
|
|
Acad::ErrorStatus AecDb3dRoadFitting::dwgInFields(AcDbDwgFiler* pFiler)
|
|
{
|
|
AssertWriteEnabled();
|
|
|
|
//----- Read parent class information first.
|
|
Acad::ErrorStatus es = Acad::eOk;
|
|
if ( !pFiler->isKindOf(CMFCDbDwgFiler::desc()))
|
|
{
|
|
es = AecDbEntityBase::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 > AecDb3dRoadFitting::kCurrentVersionNumber )
|
|
return (Acad::eMakeMeProxy);
|
|
|
|
m_mapSpecXData.dwgInFields(pFiler);
|
|
|
|
pFiler->readInt16(&m_nInfActive);
|
|
|
|
TCHAR* pszTmp = NULL;
|
|
pFiler->readString(&pszTmp);
|
|
if (pszTmp != NULL)
|
|
{
|
|
m_sGUID = pszTmp;
|
|
}
|
|
|
|
m_cmplOutSide.removeAll();
|
|
m_cmplInSide.removeAll();
|
|
|
|
m_cmplOutSide.dwgInFields(pFiler);
|
|
m_cmplInSide.dwgInFields(pFiler);
|
|
|
|
return pFiler->filerStatus();
|
|
}
|
|
|
|
Acad::ErrorStatus AecDb3dRoadFitting::dwgOutFields(AcDbDwgFiler* pFiler) const
|
|
{
|
|
assertReadEnabled();
|
|
|
|
//----- Save parent class information first.
|
|
Acad::ErrorStatus es = Acad::eOk;
|
|
if ( !pFiler->isKindOf(CMFCDbDwgFiler::desc()))
|
|
{
|
|
es = AecDbEntityBase::dwgOutFields (pFiler) ;
|
|
if ( es != Acad::eOk )
|
|
return (es) ;
|
|
}
|
|
|
|
//----- Object version number needs to be saved first
|
|
if ( (es =pFiler->writeUInt32 (AecDb3dRoadFitting::kCurrentVersionNumber)) != Acad::eOk )
|
|
return (es) ;
|
|
|
|
m_mapSpecXData.dwgOutFields(pFiler);
|
|
|
|
pFiler->writeInt16(m_nInfActive);
|
|
pFiler->writeString((LPCTSTR)m_sGUID);
|
|
|
|
m_cmplOutSide.dwgOutFields(pFiler);
|
|
m_cmplInSide.dwgOutFields(pFiler);
|
|
|
|
return (pFiler->filerStatus());
|
|
}
|
|
|
|
Acad::ErrorStatus AecDb3dRoadFitting::dxfInFields(AcDbDxfFiler* pFiler)
|
|
{
|
|
return Acad::eOk;
|
|
}
|
|
|
|
Acad::ErrorStatus AecDb3dRoadFitting::dxfOutFields(AcDbDxfFiler* pFiler) const
|
|
{
|
|
return Acad::eOk;
|
|
}
|
|
|
|
void AecDb3dRoadFitting::subList() const
|
|
{
|
|
AecDbEntityBase::subList();
|
|
acutPrintf(_T("\n道路分支段"));
|
|
m_mapSpecXData.List();
|
|
}
|
|
|
|
Acad::ErrorStatus AecDb3dRoadFitting::copyFrom(const AcRxObject* pSrc)
|
|
{
|
|
AssertWriteEnabled();
|
|
|
|
AecDb3dRoadFitting* pFit = AecDb3dRoadFitting::cast(pSrc);
|
|
if (pFit != NULL)
|
|
{
|
|
m_mapSpecXData.Empty();
|
|
m_mapSpecXData.CopyFrom(&pFit->m_mapSpecXData);
|
|
|
|
m_nInfActive = pFit->m_nInfActive;
|
|
m_sGUID = IDCreate();
|
|
m_bActive = pFit->m_bActive;
|
|
|
|
m_cmplOutSide.removeAll();
|
|
m_cmplOutSide.copyFrom(pFit->m_cmplOutSide);
|
|
|
|
m_cmplInSide.removeAll();
|
|
m_cmplInSide.copyFrom(pFit->m_cmplInSide);
|
|
}
|
|
return Acad::eOk;
|
|
}
|
|
|
|
Acad::ErrorStatus AecDb3dRoadFitting::subTransformBy(const AcGeMatrix3d& xform)
|
|
{
|
|
AssertWriteEnabled();
|
|
|
|
//...
|
|
m_cmplOutSide.transformBy(xform);
|
|
m_cmplInSide.transformBy(xform);
|
|
|
|
AcGePoint3d ptMid;
|
|
if ( m_mapSpecXData.GetAt(KEY_MID, ptMid) )
|
|
{
|
|
ptMid.transformBy(xform);
|
|
m_mapSpecXData.SetAt(KEY_MID,ptMid);
|
|
}
|
|
return Acad::eOk;
|
|
}
|
|
|
|
#if ARX>16
|
|
Acad::ErrorStatus AecDb3dRoadFitting::subGetGripPoints( AcDbGripDataPtrArray& grips,
|
|
const double curViewUnitSize,
|
|
const int gripSize,
|
|
const AcGeVector3d& curViewDir,
|
|
const int bitflags) const
|
|
{
|
|
assertReadEnabled();
|
|
|
|
AcGePoint3dArray gripPoints;
|
|
ImpGetGripPoints(gripPoints,bitflags);
|
|
|
|
AcDbGripData* pGripData = NULL;
|
|
CString sCmd = GetGripCmd();//绘制道路
|
|
EPosition ePos;
|
|
for (int i = 0;i < GRIP_MAXNUM && i < gripPoints.length();i++)
|
|
{
|
|
ePos = ExplainGripIndex(i);
|
|
if (ePos >= eCommand0 && ePos <= eCommand19)
|
|
{
|
|
memset(&m_pGripAppData[i],0,sizeof(AecGripData));
|
|
m_pGripAppData[i].nIndex = i;
|
|
m_pGripAppData[i].ePos = ePos;
|
|
m_pGripAppData[i].nColor = kWhite;
|
|
m_pGripAppData[i].ptGrip = gripPoints.at(i);
|
|
_tcscpy(m_pGripAppData[i].szTip,sCmd);
|
|
_tcscpy(m_pGripAppData[i].szID,_T(""));
|
|
m_pGripAppData[i].pOwner = (AcDbEntity*)this;
|
|
m_pGripAppData[i].idHost = this->objectId();
|
|
|
|
pGripData = new AcDbGripData;
|
|
pGripData->setGripPoint(gripPoints.at(i));
|
|
pGripData->setAppData((void*)&m_pGripAppData[i]);
|
|
pGripData->setWorldDraw(AecGripCback::WorldDrawfunc);
|
|
pGripData->setToolTipFunc(AecGripCback::GripToolTipFunc);
|
|
}
|
|
else
|
|
{
|
|
memset(&m_pGripAppData[i],0,sizeof(AecGripData));
|
|
m_pGripAppData[i].nIndex = i;
|
|
m_pGripAppData[i].ePos = ePos;
|
|
m_pGripAppData[i].nColor = kBlue;
|
|
m_pGripAppData[i].ptGrip = gripPoints.at(i);
|
|
_tcscpy(m_pGripAppData[i].szTip,_T("道路拉伸夹点"));
|
|
_tcscpy(m_pGripAppData[i].szID,_T(""));
|
|
m_pGripAppData[i].pOwner = (AcDbEntity*)this;
|
|
m_pGripAppData[i].idHost = this->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);
|
|
}
|
|
return Acad::eOk;
|
|
}
|
|
|
|
EPosition AecDb3dRoadFitting::ExplainGripIndex(int nIndex) const
|
|
{
|
|
int nInfs = GetInterfaceCount();
|
|
if (nIndex < nInfs)
|
|
{
|
|
return (EPosition)( eCommand0 + nIndex );
|
|
}
|
|
|
|
if (nIndex == nInfs)
|
|
return eMid;
|
|
|
|
return eStart;
|
|
}
|
|
|
|
LPCTSTR AecDb3dRoadFitting::GetGripCmd() const
|
|
{
|
|
assertReadEnabled();
|
|
return _T("sp_roadadd");
|
|
}
|
|
|
|
Acad::ErrorStatus AecDb3dRoadFitting::subGetStretchPoints(AcGePoint3dArray& stretchPoints) const
|
|
{
|
|
assertReadEnabled();
|
|
|
|
AcGePoint3d ptMid;
|
|
if ( m_mapSpecXData.GetAt(KEY_MID, ptMid) )
|
|
{
|
|
stretchPoints.append(ptMid);
|
|
}
|
|
return Acad::eOk;
|
|
}
|
|
|
|
Acad::ErrorStatus AecDb3dRoadFitting::subMoveGripPointsAt(const AcDbVoidPtrArray& appData, const AcGeVector3d& offset, const int bitflags)
|
|
{
|
|
AssertWriteEnabled();
|
|
|
|
AecGripData* pAppData = NULL;
|
|
AcDbIntArray arIndex;
|
|
|
|
if ( !appData.isEmpty() )
|
|
{
|
|
pAppData = (AecGripData*)appData.first();
|
|
arIndex.append(pAppData->nIndex);
|
|
}
|
|
else
|
|
{
|
|
return Acad::eOk;
|
|
}
|
|
|
|
AecInterface inf;
|
|
GripMessage msg;
|
|
memset(&msg,0,sizeof(GripMessage));
|
|
//reset
|
|
msg.nSegindex = -1;
|
|
msg.nType = -1;
|
|
msg.idHost.setNull();
|
|
msg.pParam = 0;
|
|
msg.nData = -1;
|
|
_tcscpy(msg.szLockId, _T("0"));//锁定id,如果有
|
|
msg.fData = 0;
|
|
msg.nSegindex = 0;
|
|
msg.nSubSegIndex = 0;
|
|
msg.vtOffset.set(0,0,0);
|
|
msg.ptGrip.set(0,0,0);
|
|
|
|
AcGeVector3d vtOffset = offset;
|
|
AcGePoint3d ptHit = pAppData->ptGrip;
|
|
|
|
AcGeMatrix3d xformM;
|
|
xformM.setToTranslation(vtOffset);
|
|
|
|
int nGripIndex = arIndex.first();
|
|
|
|
EPosition ePos = ExplainGripIndex(nGripIndex);
|
|
|
|
if (ePos >= eCommand0 && ePos <= eCommand20)
|
|
{
|
|
//接口夹点
|
|
msg.nType = eCommand0;
|
|
msg.nData = nGripIndex;
|
|
GetInterface(msg.nData,inf);
|
|
msg.ptGrip = inf.ptPos;
|
|
msg.idHost = pAppData->idHost;
|
|
msg.vtOffset = vtOffset;
|
|
|
|
PushGripMessage(msg);
|
|
|
|
CString sCmd = GetGripCmd();
|
|
if (!sCmd.IsEmpty())
|
|
{
|
|
acedPostCommand(_T("\x03"));
|
|
sCmd += _T("\n");
|
|
acedPostCommand(sCmd);
|
|
}
|
|
}
|
|
else if (ePos == eMid)
|
|
{
|
|
//整体移动
|
|
transformBy(xformM);
|
|
}
|
|
else//重合夹点移动
|
|
{
|
|
for (int i = 0;i < m_cmplOutSide.length();i++)
|
|
{
|
|
AecEqui::AecCurveElement& elO = m_cmplOutSide.atByRef(i);
|
|
|
|
for (int ii = 0;ii < 3;ii++)
|
|
{
|
|
if ( elO.ptGe[ii].distanceTo(ptHit) < 1.e-2)
|
|
{
|
|
elO.ptGe[ii] += offset;
|
|
if (elO.bHided)
|
|
{
|
|
elO.bHided = FALSE;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
for (int i = 0;i < m_cmplInSide.length();i++)
|
|
{
|
|
AecEqui::AecCurveElement& elI = m_cmplInSide.atByRef(i);
|
|
|
|
for (int ii = 0;ii < 3;ii++)
|
|
{
|
|
if ( elI.ptGe[ii].distanceTo(ptHit) < 1.e-2)
|
|
{
|
|
elI.ptGe[ii] += offset;
|
|
if (elI.bHided)
|
|
{
|
|
elI.bHided = FALSE;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return Acad::eOk;
|
|
}
|
|
|
|
Acad::ErrorStatus AecDb3dRoadFitting::subMoveStretchPointsAt(const AcDbIntArray& indices,const AcGeVector3d& offset)
|
|
{
|
|
AssertWriteEnabled();
|
|
|
|
if (!indices.isEmpty())
|
|
{
|
|
AcGePoint3d ptMid;
|
|
if ( m_mapSpecXData.GetAt(KEY_MID,ptMid) )
|
|
{
|
|
ptMid += offset;
|
|
m_mapSpecXData.SetAt(KEY_MID,ptMid);
|
|
}
|
|
|
|
for (int i = 0;i < m_cmplOutSide.length();i++)
|
|
{
|
|
AecEqui::AecCurveElement& el = m_cmplOutSide.atByRef(i);
|
|
for (int ii = 0;ii < 3;ii++)
|
|
{
|
|
el.ptGe[ii] += offset;
|
|
}
|
|
}
|
|
|
|
for (int i = 0;i < m_cmplInSide.length();i++)
|
|
{
|
|
AecEqui::AecCurveElement& el = m_cmplInSide.atByRef(i);
|
|
for (int ii = 0;ii < 3;ii++)
|
|
{
|
|
el.ptGe[ii] += offset;
|
|
}
|
|
}
|
|
|
|
//接口点更新
|
|
//...
|
|
}
|
|
return Acad::eOk;
|
|
}
|
|
|
|
void AecDb3dRoadFitting::GetGripText(int nPos, CString& sText)
|
|
{
|
|
sText = _T("节点");
|
|
}
|
|
#endif
|
|
|
|
Acad::ErrorStatus AecDb3dRoadFitting::ImpGetGripPoints(AcGePoint3dArray& gripPoints,const int bitflags) const
|
|
{
|
|
assertReadEnabled();
|
|
|
|
//先添加管嘴点
|
|
AcArray<AecInterface> arInfs;
|
|
GetInterface(arInfs);
|
|
|
|
for (int i = 0;i < arInfs.length();i++)
|
|
{
|
|
const AecInterface& inf = arInfs.at(i);
|
|
gripPoints.append(inf.ptPos);
|
|
}
|
|
|
|
AcGePoint3d ptMid;
|
|
m_mapSpecXData.GetAt(KEY_MID, ptMid);
|
|
gripPoints.append(ptMid);
|
|
|
|
int nGripindex = 0;
|
|
|
|
//调整的夹点
|
|
KTTempTol tol(1.e-3);
|
|
for (int i = 0;i < m_cmplOutSide.length();i++)
|
|
{
|
|
const AecEqui::AecCurveElement& el = m_cmplOutSide.atByCstRef(i);
|
|
|
|
for (int ii = 0;ii < 3;ii++)
|
|
{
|
|
if (gripPoints.find(el.ptGe[ii]) == -1)
|
|
{
|
|
nGripindex = gripPoints.append(el.ptGe[ii]);
|
|
}
|
|
}
|
|
}
|
|
|
|
for (int i = 0;i < m_cmplInSide.length();i++)
|
|
{
|
|
const AecEqui::AecCurveElement& el = m_cmplInSide.atByCstRef(i);
|
|
|
|
for (int ii = 0;ii < 3;ii++)
|
|
{
|
|
if (gripPoints.find(el.ptGe[ii]) == -1)
|
|
{
|
|
nGripindex = gripPoints.append(el.ptGe[ii]);
|
|
}
|
|
}
|
|
}
|
|
return Acad::eOk;
|
|
}
|
|
|
|
Acad::ErrorStatus AecDb3dRoadFitting::Draw2d(AcGiDraw &dc) const
|
|
{
|
|
assertReadEnabled();
|
|
|
|
//管线系统屏蔽掉
|
|
if ( dc.IsDragging() )
|
|
{
|
|
//return Acad::eOk;
|
|
}
|
|
|
|
AcDbObjectId idOld = dc.GetLayerId();
|
|
AcDbObjectId idOldLt = dc.GetLineTypeId();
|
|
int nCrBk = dc.GetColor();
|
|
|
|
AcDbObjectId idLay = dc.GetLayerId();
|
|
dc.SetLayer(layerId());
|
|
|
|
if (Has2DBuffer())
|
|
{
|
|
AcDbObjectId idLn = linetypeId();
|
|
AcDbObjectId idLay = layerId();
|
|
int nColorE = nCrBk;
|
|
AcDbEntity* pEnt = NULL;
|
|
|
|
const AcDbVoidPtrArray &ar2D = Get2DBuffer();
|
|
for (int i = 0;i < ar2D.length();i++)
|
|
{
|
|
pEnt = (AcDbEntity*)ar2D.at(i);
|
|
dc.SetLayer(idLay);
|
|
dc.DrawEntity(*pEnt);
|
|
}
|
|
dc.SetLayer(idOld);
|
|
return Acad::eOk;
|
|
}
|
|
|
|
dc.SetLayer(idLay);
|
|
AcDbCurve* pCurve = NULL;
|
|
for (int i = 0;i < m_cmplOutSide.length();i++)
|
|
{
|
|
const AecEqui::AecCurveElement& el = m_cmplOutSide.atByCstRef(i);
|
|
if (!el.bHided)
|
|
{
|
|
pCurve = NULL;
|
|
AecComplexCurve::MakeCurve((AecEqui::AecCurveElement&)el,pCurve);
|
|
|
|
dc.DrawEntity(*pCurve);
|
|
Add2DBuffer(pCurve);
|
|
}
|
|
}
|
|
|
|
for (int i = 0;i < m_cmplInSide.length();i++)
|
|
{
|
|
const AecEqui::AecCurveElement& el = m_cmplInSide.atByCstRef(i);
|
|
|
|
pCurve = NULL;
|
|
AecComplexCurve::MakeCurve((AecEqui::AecCurveElement&)el,pCurve);
|
|
|
|
dc.DrawEntity(*pCurve);
|
|
Add2DBuffer(pCurve);
|
|
}
|
|
dc.SetLayer(idOld);
|
|
return Acad::eOk;
|
|
}
|
|
|
|
static CString getTrait(const double &x, const double &y)
|
|
{
|
|
CString str(_T(""));
|
|
str.Format(_T("%.4f-%.4f"), x, y);
|
|
return str;
|
|
}
|
|
|
|
static double getZ(const std::map<CString, double> &traits
|
|
, const double &x
|
|
, const double &y)
|
|
{
|
|
std::map<CString, double>::const_iterator it = traits.find(getTrait(x, y));
|
|
if (it != traits.end())
|
|
return it->second;
|
|
return .0;
|
|
}
|
|
|
|
Acad::ErrorStatus AecDb3dRoadFitting::Draw3d(AcGiDraw &dc) const
|
|
{
|
|
assertReadEnabled();
|
|
|
|
//管线系统屏蔽掉
|
|
if ( dc.IsDragging() )
|
|
{
|
|
//return Acad::eOk;
|
|
}
|
|
|
|
//图层
|
|
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 (Has3DBuffer())
|
|
{
|
|
AcDbEntity* pEnt = NULL;
|
|
const AcDbVoidPtrArray &ar3D = Get3DBuffer();
|
|
for (int i = 0;i < ar3D.length();i++)
|
|
{
|
|
pEnt = (AcDbEntity*)ar3D.at(i);
|
|
dc.DrawEntity(*pEnt);
|
|
}
|
|
|
|
dc.SetLayer(idLay);
|
|
dc.SetColor(nCrBk);
|
|
return Acad::eOk;
|
|
}
|
|
|
|
AcDbRegion* pRegOut = MakeRegion(1);
|
|
AcDbRegion* pRegIn = MakeRegion(0);
|
|
|
|
if (pRegIn != NULL)
|
|
{
|
|
if (pRegOut != NULL)
|
|
{
|
|
AcDbRegion* pRegInCln = (AcDbRegion*)pRegIn->clone();
|
|
if ( Acad::eOk == pRegOut->booleanOper(AcDb::kBoolSubtract,pRegInCln) )
|
|
{
|
|
//贴图沥青
|
|
dc.DrawEntity(pRegOut);
|
|
Add3DBuffer(pRegOut);
|
|
}
|
|
else
|
|
{
|
|
//...
|
|
}
|
|
}
|
|
|
|
//贴图绿地
|
|
pRegIn->setColorIndex(kGreen);
|
|
dc.DrawEntity(pRegIn);
|
|
Add3DBuffer(pRegIn);
|
|
}
|
|
else
|
|
{
|
|
if (pRegOut != NULL)
|
|
{
|
|
//贴图沥青
|
|
dc.DrawEntity(pRegOut);
|
|
Add3DBuffer(pRegOut);
|
|
}
|
|
}
|
|
|
|
DrawRoadBordLine(dc,kWhite,TRUE);
|
|
DrawRoadBordLine(dc,kWhite,FALSE);
|
|
|
|
return Acad::eOk;
|
|
}
|
|
|
|
AcDbRegion* AecDb3dRoadFitting::MakeRegion(int nPos) const
|
|
{
|
|
const AecComplexCurve* pCmpl = &m_cmplOutSide;
|
|
if (nPos == 0)
|
|
{
|
|
pCmpl = &m_cmplInSide;
|
|
}
|
|
|
|
//设置标高
|
|
WPipe::RoadParam rp;
|
|
memset(&rp, 0, sizeof(WPipe::RoadParam));
|
|
GetRoadParam(rp);
|
|
|
|
AcDbVoidPtrArray arCurPtrs;
|
|
AecEqui::AecCurveElement elT;
|
|
AcDbCurve* pCurve = NULL;
|
|
for (int i = 0;i < pCmpl->length();i++)
|
|
{
|
|
const AecEqui::AecCurveElement& el = pCmpl->atByCstRef(i);
|
|
memcpy(&elT, &el, sizeof(AecEqui::AecCurveElement));
|
|
|
|
if (nPos == 0)
|
|
{
|
|
elT.ptGe[0].z = rp.m_dEl; elT.ptGe[1].z = rp.m_dEl; elT.ptGe[2].z = rp.m_dEl;
|
|
}
|
|
pCurve = NULL;
|
|
AecComplexCurve::MakeCurve(elT,pCurve);
|
|
|
|
arCurPtrs.append(pCurve);
|
|
}
|
|
|
|
AcDbVoidPtrArray arRegPtrs;
|
|
AcDbRegion::createFromCurves(arCurPtrs,arRegPtrs);
|
|
|
|
FreeBuffer(0,arCurPtrs);
|
|
|
|
if (!arRegPtrs.isEmpty())
|
|
{
|
|
return (AcDbRegion*)arRegPtrs.first();
|
|
}
|
|
return NULL;
|
|
}
|
|
|
|
void AecDb3dRoadFitting::DrawRoadBordLine(AcGiDraw &dc,int nColor,BOOL bOutOrSide) const
|
|
{
|
|
WPipe::RoadParam rp;
|
|
memset(&rp,0,sizeof(WPipe::RoadParam));
|
|
|
|
if ( GetRoadParam(rp) )
|
|
{
|
|
double dW = 200.0;//100毫米宽
|
|
dW = AsOtherUnit(dW);
|
|
|
|
const AecComplexCurve* pCmpl = &m_cmplOutSide;
|
|
if (!bOutOrSide)
|
|
pCmpl = &m_cmplInSide;
|
|
|
|
AcDbVoidPtrArray arCurPtrs,arResult;
|
|
|
|
AcDbCurve* pCurve = NULL;
|
|
for (int i = 0;i < pCmpl->length();i++)
|
|
{
|
|
const AecEqui::AecCurveElement& el = pCmpl->atByCstRef(i);
|
|
|
|
pCurve = NULL;
|
|
if ( AecComplexCurve::MakeCurve(el,pCurve) )
|
|
{
|
|
arCurPtrs.append(pCurve);
|
|
}
|
|
}
|
|
|
|
AcDbCurve* pPlCrv = KTCADUtilityEx::ConvertBoundCurve(arCurPtrs,arResult);
|
|
if (pPlCrv != NULL)
|
|
{
|
|
AcDbPolyline* pPl = AcDbPolyline::cast(pPlCrv);
|
|
if (pPl != NULL)
|
|
{
|
|
pPl->setConstantWidth(dW);
|
|
pPl->setColorIndex(nColor);
|
|
pPl->setElevation(rp.m_dEl);
|
|
dc.DrawEntity(pPl);
|
|
Add3DBuffer(pPl);
|
|
}
|
|
}
|
|
FreeBuffer(0,arCurPtrs);
|
|
}
|
|
}
|
|
|
|
AecDbObjXDataMap* AecDb3dRoadFitting::GetSpecialtyData(AcDb::OpenMode bMode/* = AcDb::kForWrite*/)
|
|
{
|
|
switch(bMode)
|
|
{
|
|
case AcDb::kForRead:
|
|
{
|
|
assertReadEnabled();
|
|
break;
|
|
}
|
|
case AcDb::kForWrite:
|
|
{
|
|
if (!isWriteEnabled())
|
|
{
|
|
upgradeOpen();
|
|
}
|
|
assertWriteEnabled();
|
|
break;
|
|
}
|
|
case AcDb::kForNotify:
|
|
{
|
|
assertReadEnabled();
|
|
}
|
|
default:
|
|
break;
|
|
}
|
|
return &m_mapSpecXData;
|
|
}
|
|
|
|
const AecDbObjXDataMap* AecDb3dRoadFitting::GetSpecialtyData() const
|
|
{
|
|
assertReadEnabled();
|
|
return &m_mapSpecXData;
|
|
}
|
|
|
|
bool AecDb3dRoadFitting::GetInterface(AcArray<AecInterface>& arInfs) const
|
|
{
|
|
assertReadEnabled();
|
|
|
|
AcGePoint3d ptMid;
|
|
if ( m_mapSpecXData.GetAt(KEY_MID, ptMid) )
|
|
{
|
|
AecInterface inf;
|
|
memset(&inf,0,sizeof(AecInterface));
|
|
|
|
AcGeVector3d vtT;
|
|
for (int i = 0;i < m_cmplOutSide.length();i++)
|
|
{
|
|
const AecEqui::AecCurveElement& el = m_cmplOutSide.atByCstRef(i);
|
|
if (el.bHided)
|
|
{
|
|
inf.vtDir = el.ptGe[2] - el.ptGe[0];
|
|
inf.vtDir.rotateBy(PI/2.0,AcGeVector3d::kZAxis);
|
|
|
|
inf.ptPos = MidPoint((AcGePoint3d&)el.ptGe[0],(AcGePoint3d&)el.ptGe[2]);
|
|
|
|
vtT = inf.ptPos - ptMid;
|
|
if (inf.vtDir.dotProduct(vtT) < 1.e-10)
|
|
inf.vtDir.negate();
|
|
|
|
inf.dSize1 = el.ptGe[0].distanceTo(el.ptGe[2]);
|
|
inf.dSize2 = inf.dSize1;
|
|
inf.nSectType = eCircle;
|
|
inf.nLevel = i;
|
|
inf.idOwner = objectId();
|
|
inf.dGasket = 0;
|
|
arInfs.append(inf);
|
|
}
|
|
}
|
|
}
|
|
return Acad::eOk;
|
|
}
|
|
|
|
bool AecDb3dRoadFitting::GetInterface(int nIndex,AecInterface& inf) const
|
|
{
|
|
assertReadEnabled();
|
|
|
|
AcArray<AecInterface> arInfs;
|
|
GetInterface(arInfs);
|
|
|
|
if (nIndex > -1 && nIndex < arInfs.length())
|
|
{
|
|
inf = arInfs.at(nIndex);
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
int AecDb3dRoadFitting::GetInterfaceCount() const
|
|
{
|
|
assertReadEnabled();
|
|
|
|
AcArray<AecInterface> arInfs;
|
|
GetInterface(arInfs);
|
|
|
|
return arInfs.length();
|
|
}
|
|
|
|
int AecDb3dRoadFitting::GetActiveInf() const
|
|
{
|
|
assertReadEnabled();
|
|
return 0;
|
|
}
|
|
|
|
void AecDb3dRoadFitting::SetActiveInf(int nIndex)
|
|
{
|
|
}
|
|
|
|
void AecDb3dRoadFitting::LockInf(int nInf)
|
|
{
|
|
|
|
}
|
|
|
|
void AecDb3dRoadFitting::NewGUID()
|
|
{
|
|
assertWriteEnabled();
|
|
m_sGUID = IDCreate();
|
|
}
|
|
|
|
bool AecDb3dRoadFitting::TransformAssocInf(int nInf,const AcGeMatrix3d& xform)
|
|
{
|
|
AssertWriteEnabled();
|
|
|
|
//FITTING件没有橡皮拉伸特征,固定整体移动
|
|
AecInterface inf;
|
|
if ( GetInterface(nInf,inf) )
|
|
{
|
|
AcGeVector3d vtDir = inf.vtDir;
|
|
AcGePoint3d pt1 = inf.ptPos;
|
|
pt1.transformBy(xform);
|
|
|
|
//AcGeVector3d vt2 = pt1 - inf.ptPos;
|
|
//if (vt2.isParallelTo(vtDir))
|
|
//{
|
|
// return false;
|
|
//}
|
|
|
|
subTransformBy(xform);
|
|
return true;//继续发消息
|
|
}
|
|
return false;//不继续发消息
|
|
}
|