152 lines
4.4 KiB
C++
152 lines
4.4 KiB
C++
#pragma once
|
||
#include "EntitySet.h"
|
||
#include "GeLine.h"
|
||
#include "GeArc.h"
|
||
#include "GeCurveSegment.h"
|
||
#include "ADSGePoint3d.h"
|
||
#include "GePoly.h"
|
||
#include "superList.h"
|
||
#include "ADSGePointList.h"
|
||
|
||
class GePoly3D;
|
||
class GeCurveSegment;
|
||
class GeDirectionCurve;
|
||
|
||
class GePoly2D : public ADSGePointList, public GeCurve
|
||
{
|
||
public:
|
||
|
||
GePoly2D();
|
||
GePoly2D(const EntitySet& entPline);
|
||
GePoly2D(int nflg);
|
||
GePoly2D(const GePoly2D & src);
|
||
|
||
virtual ~GePoly2D();
|
||
|
||
virtual bool IsKindOf(TEntityId entType) const;
|
||
virtual TEntityId Type() const;
|
||
|
||
// add by xlc on 110413
|
||
virtual double GetLength()const; //曲线长度
|
||
|
||
virtual double Area() const;
|
||
virtual void Reset();
|
||
virtual bool SetAcDbCurve(AcDbCurve* pCurve);
|
||
|
||
virtual AcDbCurve* AsAcDbCurve()const;
|
||
virtual AcDbRegion *AsRegion() const;
|
||
virtual void CopyFrom(const GeEntity* pSrc);
|
||
|
||
virtual int Nth(int nIndex, GeLine &xline, GeArc &xarc, AcDb::Visibility *pVal = NULL) const;
|
||
virtual int Nth(int nIndex, GeCurveSegment & cvCurve, AcDb::Visibility *pVal = NULL) const;
|
||
virtual int Nth(int nIndex, GeDirectionCurve &curve, AcDb::Visibility *pVal = NULL) const;
|
||
|
||
virtual int Reverse();
|
||
virtual int Compress(bool bUnionCurve = true);
|
||
|
||
virtual int Make(LPCTSTR szLay = NULL) const;
|
||
virtual int MakeSegments(LPCTSTR szLay = NULL) const;
|
||
virtual int MakeSegment(int nIndex, LPCTSTR szLay = NULL) const;
|
||
|
||
virtual void TransformBy(const AcGeMatrix3d &mat);
|
||
virtual void RemoveNode(long nIndex);
|
||
virtual void InsertNodeAt(int nIndex, const ADSGePoint3d &pt, double dBulge = 0.0, AcDb::Visibility eVal = AcDb::kVisible);
|
||
virtual void InsertNodeAt(const ADSGePoint3d &ptOn, AcDb::Visibility eVal = AcDb::kVisible);
|
||
virtual void AppendNode(const ADSGePoint3d &pt, ads_real dBulge = 0.0, AcDb::Visibility eVal = AcDb::kVisible);
|
||
|
||
int operator ! () const;
|
||
GePoly2D& operator = (const GePoly2D &src);
|
||
|
||
void SetFlag(int nFlag);
|
||
int GetFlag() const;
|
||
|
||
void AppendBugle(ads_real dBugle);
|
||
void RemoveBugle(int nIndex);
|
||
|
||
double GetBulge(int nIndex) const;
|
||
void SetBulge(int nIndex, double dBugle);
|
||
|
||
int SetBulges(PtrList<double>& ardbulges);
|
||
int GetBulges(PtrList<double>& ardbulges);
|
||
PtrList<double>& GetBulges();
|
||
|
||
|
||
ads_real Distance3d(int nIndex) const;
|
||
ads_real Distance3d() const;
|
||
ads_real Distance2d(int nIndex) const;
|
||
ads_real Distance2d() const;
|
||
|
||
// 求路径面积有正负之分,不闭合时为路径与X轴之间的区域面积,正负无实际意义
|
||
// 闭合时,路径围成的面积,为正表示曲线是顺时针方向的
|
||
ads_real PathArea() const;
|
||
|
||
double PathDistance2d(ADSGePoint3d ptHit) const;
|
||
|
||
|
||
//是否自交
|
||
BOOL IsSelfIntersect() const;
|
||
int IsValid(int nIndex) const;
|
||
|
||
int IsClosed() const;
|
||
bool SetClosed();
|
||
|
||
int HasArcSegment() const;
|
||
|
||
int TotalSegments() const;
|
||
|
||
int Polar2d(ads_real dis, ADSGePoint3d &ptRes, ads_real *dDrt = NULL) const;
|
||
int Polar3d(ads_real dis, ADSGePoint3d &ptRes, TVector3D & vt) const;
|
||
|
||
//取得封闭PLINE内的一点或外的一点
|
||
ADSGePoint3d GetPoint(int nIOFlag, ads_real dist);
|
||
ADSGePoint3d GetInsidePoint();
|
||
|
||
int AppendSegment(const GeCurveSegment &cvCurve, int bMinus = 0, int bFinal = 0);
|
||
// 消除路径的重合点,bUnionCurve为true时合并共线点
|
||
|
||
// 路径偏移,各段分别偏移,再求交点,构成偏移线
|
||
int Offset(ads_real nDist, GePoly2D &destPoly) const;
|
||
// 路径偏移,各顶点计算偏移,再求顶点的圆心角(弧段),构成偏移线
|
||
int QuickOffset(ads_real nDist, GePoly2D &destPoly) const;
|
||
|
||
int MapToPolygon1(GePoly &pts, double dDeviation);
|
||
int MapToPolygon(GePoly &pts, int nCirDiv = 30);
|
||
|
||
resbuf *Fence(int nCirDiv = 30);
|
||
resbuf *Polygon(int nCirDiv = 30);
|
||
|
||
int AsOpenPoly1(GePoly &pts, double dDeviation) const;
|
||
int AsOpenPoly(GePoly &pts, int nCirDiv = 30) const;
|
||
|
||
//离散化
|
||
void Disperse1(GePoly2D &polydestPoly, double dDeviation) const;
|
||
void Disperse(GePoly2D &polydestPoly, int nCirDiv = 30) const;
|
||
|
||
int CreatePface(int cirDivSegs, const TCHAR *szLay = NULL);
|
||
|
||
int GetExtend(ads_point lowPt, ads_point upPt) const;
|
||
|
||
//返回值nRet,
|
||
//nRet>0时表示的是输入点在第几个顶点上
|
||
//nRet<0时|nRet|表示的是输入点在第几条边上
|
||
//nRet=0表示不在线上
|
||
int HitTestOnCurve(const ADSGePoint3d &ptTest, double dTol) const;
|
||
|
||
void SetPointListAt(int nIndex, const ADSGePoint3d& pt);
|
||
|
||
ADSGePoint3d* GetPointListAt(int nIndex);
|
||
const ADSGePoint3d& GetPointListAt(int nIndex) const;
|
||
|
||
void RemovePointListAt(int nIndex);
|
||
void AppendPointListAt(ADSGePoint3d* pPt);
|
||
|
||
GePoly3D PlaneToWcs(const AcGeVector3d& normal)const;
|
||
|
||
bool IsRegionInclude(const GePoly2D& poly)const;
|
||
bool IsRegionOverlap(const GePoly2D& poly)const;
|
||
|
||
public:
|
||
|
||
int m_nFlag;
|
||
PtrList<double> m_ardbulges;
|
||
}; |