88 lines
1.9 KiB
C++
88 lines
1.9 KiB
C++
//-----------------------------------------------------------------------------+
|
|
// Copyright (C), 1998-2007, SH Software Co. Ltd.
|
|
// = FileName : XDcPline 类
|
|
// = Version : ver2.0
|
|
// = Author : zjq
|
|
// = CreateDate : 2002-09-09
|
|
// = Description: XDcPline 定义
|
|
// = Maintainers:
|
|
//
|
|
//-----------------------------------------------------------------------------+
|
|
#include "StdAfx.h"
|
|
#include "XDcPline.h"
|
|
#include "XGlobalCurveFunc.h"
|
|
|
|
XDcPline::XDcPline(const XPoly2D &poly,double lw)
|
|
: m_poly(poly),m_nLineWeight(lw)
|
|
{
|
|
|
|
}
|
|
|
|
XDcPline::XDcPline(const AcDbPolyline &pline)
|
|
{
|
|
m_poly.SetAcDbCurve((AcDbPolyline*)&pline);
|
|
m_nLineWeight = 0;
|
|
|
|
pline.getConstantWidth(m_nLineWeight);
|
|
}
|
|
|
|
AcDbEntity *XDcPline::CreateAcDbEntity()const
|
|
{
|
|
AcDbPolyline *pline = new AcDbPolyline;
|
|
PolyConvert(m_poly, *pline);
|
|
pline->setConstantWidth(m_nLineWeight);
|
|
|
|
return pline;
|
|
}
|
|
|
|
void XDcPline::CutBy(const XPoly2D &poly,DList<XDcObject>&lstIn,DList<XDcObject>&lstOut,DList<XDcObject>&lstEdge)const
|
|
{
|
|
DList<XCurveSegment> lstSeg,lstIn0,lstOut0,lstEdge0;
|
|
ExplodePoly2D(m_poly,lstSeg);
|
|
PolyClip(lstSeg,poly,lstIn0,lstOut0,lstEdge0);
|
|
|
|
for (long i = 0; i < lstIn0.Length(); i++)
|
|
{
|
|
XPoly2D poly1;
|
|
lstIn0[i]->AsPoly2D(poly1);
|
|
|
|
lstIn.Append(new XDcPline(poly1,m_nLineWeight));
|
|
}
|
|
|
|
for (long i = 0; i < lstOut0.Length(); i++)
|
|
{
|
|
XPoly2D poly1;
|
|
lstOut0[i]->AsPoly2D(poly1);
|
|
|
|
lstOut.Append(new XDcPline(poly1,m_nLineWeight));
|
|
}
|
|
|
|
for (long i = 0; i < lstEdge0.Length(); i++)
|
|
{
|
|
XPoly2D poly1;
|
|
lstEdge0[i]->AsPoly2D(poly1);
|
|
|
|
lstEdge.Append(new XDcPline(poly1,m_nLineWeight));
|
|
}
|
|
}
|
|
|
|
XPoly2D XDcPline::GetPoly() const
|
|
{
|
|
return m_poly;
|
|
}
|
|
|
|
void XDcPline::SetPoly(const XPoly2D poly)
|
|
{
|
|
m_poly = poly;
|
|
}
|
|
|
|
double XDcPline::GetLineWeight()const
|
|
{
|
|
return m_nLineWeight;
|
|
}
|
|
|
|
void XDcPline::SetLineWeight(const double dLineWeight)
|
|
{
|
|
m_nLineWeight = dLineWeight;
|
|
}
|