77 lines
1.6 KiB
C++
77 lines
1.6 KiB
C++
#include "StdAfx.h"
|
|
#include "GeDbPolyline.h"
|
|
#include "globalFunc.h"
|
|
|
|
GeDbPolyline::GeDbPolyline(const GePoly2D &poly,double lw)
|
|
: m_poly(poly),m_nLineWeight(lw)
|
|
{
|
|
|
|
}
|
|
|
|
GeDbPolyline::GeDbPolyline(const AcDbPolyline &pline)
|
|
{
|
|
m_poly.SetAcDbCurve((AcDbPolyline*)&pline);
|
|
m_nLineWeight = 0;
|
|
|
|
pline.getConstantWidth(m_nLineWeight);
|
|
}
|
|
|
|
AcDbEntity *GeDbPolyline::CreateAcDbEntity()const
|
|
{
|
|
AcDbPolyline *pline = new AcDbPolyline;
|
|
GlobalFunc::PolyConvert(m_poly, *pline);
|
|
pline->setConstantWidth(m_nLineWeight);
|
|
|
|
return pline;
|
|
}
|
|
|
|
void GeDbPolyline::CutBy(const GePoly2D &poly,PtrList<GeDbCurveEntity>&lstIn,PtrList<GeDbCurveEntity>&lstOut,PtrList<GeDbCurveEntity>&lstEdge)const
|
|
{
|
|
PtrList<GeCurveSegment> lstSeg,lstIn0,lstOut0,lstEdge0;
|
|
GlobalFunc::ExplodePoly2D(m_poly,lstSeg);
|
|
GlobalFunc::PolyClip(lstSeg,poly,lstIn0,lstOut0,lstEdge0);
|
|
|
|
for (long i = 0; i < lstIn0.Length(); i++)
|
|
{
|
|
GePoly2D poly1;
|
|
lstIn0[i]->AsPoly2D(poly1);
|
|
|
|
lstIn.Append(new GeDbPolyline(poly1,m_nLineWeight));
|
|
}
|
|
|
|
for (i = 0; i < lstOut0.Length(); i++)
|
|
{
|
|
GePoly2D poly1;
|
|
lstOut0[i]->AsPoly2D(poly1);
|
|
|
|
lstOut.Append(new GeDbPolyline(poly1,m_nLineWeight));
|
|
}
|
|
|
|
for (i = 0; i < lstEdge0.Length(); i++)
|
|
{
|
|
GePoly2D poly1;
|
|
lstEdge0[i]->AsPoly2D(poly1);
|
|
|
|
lstEdge.Append(new GeDbPolyline(poly1,m_nLineWeight));
|
|
}
|
|
}
|
|
|
|
GePoly2D GeDbPolyline::GetPoly() const
|
|
{
|
|
return m_poly;
|
|
}
|
|
|
|
void GeDbPolyline::SetPoly(const GePoly2D poly)
|
|
{
|
|
m_poly = poly;
|
|
}
|
|
|
|
double GeDbPolyline::GetLineWeight()const
|
|
{
|
|
return m_nLineWeight;
|
|
}
|
|
|
|
void GeDbPolyline::SetLineWeight(const double dLineWeight)
|
|
{
|
|
m_nLineWeight = dLineWeight;
|
|
} |