51 lines
1.2 KiB
C++
51 lines
1.2 KiB
C++
#include "StdAfx.h"
|
|
#include "GeDbCurveSegEntity.h"
|
|
#include "globalFunc.h"
|
|
|
|
GeDbCurveSegEntity::GeDbCurveSegEntity(const AcDbLine& line)
|
|
{
|
|
m_startPoint = line.startPoint();
|
|
m_endPoint = line.endPoint();
|
|
m_dBulge = 0;
|
|
}
|
|
|
|
GeDbCurveSegEntity::GeDbCurveSegEntity(const AcDbArc&arc)
|
|
{
|
|
ADSGePoint3d ptCen = arc.center();
|
|
TVector3D vtNormal = arc.normal();
|
|
ptCen = GlobalFunc::Wcs2Ecs(ptCen, vtNormal);
|
|
|
|
GeArc ar(ptCen, arc.radius(), arc.startAngle(), arc.endAngle());
|
|
|
|
GeCurveSegment seg;
|
|
seg = ar;
|
|
|
|
*this = seg;
|
|
}
|
|
|
|
AcDbEntity *GeDbCurveSegEntity::CreateAcDbEntity()const
|
|
{
|
|
return AsAcDbCurve();
|
|
}
|
|
|
|
void GeDbCurveSegEntity::CutBy(const GePoly2D &poly,PtrList<GeDbCurveEntity>&lstIn,PtrList<GeDbCurveEntity>&lstOut,PtrList<GeDbCurveEntity>&lstEdge)const
|
|
{
|
|
PtrList<GeCurveSegment> lstSeg,lstIn0,lstOut0,lstEdge0;
|
|
lstSeg.Append(new GeCurveSegment(*this));
|
|
GlobalFunc::PolyClip(lstSeg,poly,lstIn0,lstOut0,lstEdge0);
|
|
|
|
for (long i = 0; i < lstIn0.Length(); i++)
|
|
{
|
|
lstIn.Append(new GeDbCurveSegEntity(*lstIn0[i]));
|
|
}
|
|
|
|
for (i = 0; i < lstOut0.Length(); i++)
|
|
{
|
|
lstOut.Append(new GeDbCurveSegEntity(*lstOut0[i]));
|
|
}
|
|
|
|
for (i = 0; i < lstEdge0.Length(); i++)
|
|
{
|
|
lstEdge.Append(new GeDbCurveSegEntity(*lstEdge0[i]));
|
|
}
|
|
} |