Files
envi-code/SourceCode/Code2026/inc/AdsXRx/XPoly2D.h
T
2026-09-28 15:28:50 +08:00

222 lines
4.8 KiB
C++

//-----------------------------------------------------------------------------+
// Copyright (C), 1998-2007, SH Software Co. Ltd.
// = FileName : XPoly2D
// = Version : ver2.0
// = Author : zjq
// = CreateDate : 2002-09-09
// = Description: XPoly2D类声明
// = Maintainers:
//
//-----------------------------------------------------------------------------+
#ifndef _XPOLY2D_H_
#define _XPOLY2D_H_
#ifndef _ENTITY_H_
#include "Entity.h"
#endif
#ifndef _XLINE_H_
#include "XLine.h"
#endif
#ifndef _XARC_H_
#include "XArc.h"
#endif
#ifndef _XCURVESEGMENT_H_
#include "XCurveSegment.h"
#endif
/*
#ifndef _XDIRECTIONCURVE_H_
#include "XDirectionCurve.h"
#endif
*/
#ifndef _XPOINT_H_
#include "XPoint.h"
#endif
#ifndef _XPOLY_H_
#include "XPoly.h"
#endif
#ifndef _DLIST_H_
#include "DList.h"
#endif
#ifndef _XPOINTLISTT_H_
#include "XPointList.h"
#endif
class XPoly3D;
class XCurveSegment;
class XDirectionCurve;
class GEOAPI XPoly2D : public XPointList, public XCurve
{
public:
XPoly2D();
XPoly2D(const Entity& entPline);
XPoly2D(int nflg);
XPoly2D(const XPoly2D & src);
virtual ~XPoly2D();
virtual bool IsKindOf(TEntityId entType) const;
virtual TEntityId Type() 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 XEntity* pSrc);
virtual void AppendNode(const XPoint &pt, ads_real dBulge = 0.0);
int operator ! () const;
XPoly2D& operator = (const XPoly2D &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(DList<double>& ardbulges);
int GetBulges(DList<double>& ardbulges);
DList<double>& GetBulges();
ads_real Distance3d(int nIndex) const;
ads_real Distance3d() const;
ads_real Distance2d(int nIndex) const;
ads_real Distance2d() const;
ads_real PathArea() const;
double PathDistance2d(XPoint ptHit) const;
int Nth(int nIndex, XLine &xline, XArc &xarc) const;
int Nth(int nIndex, XCurveSegment & cvCurve) const;
int Nth(int nIndex, XDirectionCurve &curve) 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, XPoint &ptRes, ads_real *dDrt = NULL) const;
int Polar3d(ads_real dis, XPoint &ptRes, XVector3D & vt) const;
int Make(LPCTSTR szLay = NULL) const;
int MakeSegments(LPCTSTR szLay = NULL) const;
int MakeSegment(int nIndex, LPCTSTR szLay = NULL) const;
//取得封闭PLINE内的一点或外的一点
XPoint GetPoint(int nIOFlag, ads_real dist);
XPoint GetInsidePoint();
int AppendSegment(const XCurveSegment &cvCurve, int bMinus = 0, int bFinal = 0);
int Compress(bool bUnionCurve = true);
int Offset(ads_real nDist, XPoly2D &destPoly) const;
int QuickOffset(ads_real nDist, XPoly2D &destPoly) const;
int Reverse();
int MapToPolygon1(XPoly &pts, double dDeviation);
int MapToPolygon(XPoly &pts, int nCirDiv = 30);
resbuf *Fence(int nCirDiv = 30);
resbuf *Polygon(int nCirDiv = 30);
int AsOpenPoly1(XPoly &pts, double dDeviation) const;
int AsOpenPoly(XPoly &pts, int nCirDiv = 30) const;
//离散化
void Disperse1(XPoly2D &polydestPoly, double dDeviation) const;
void Disperse(XPoly2D &polydestPoly, int nCirDiv = 30) const;
int CreatePface(int cirDivSegs, const TCHAR *szLay = NULL);
int GetExtend(ads_point lowPt, ads_point upPt) const;
int HitTestOnCurve(const XPoint &ptTest, double dTol = XGeLib::_DIST_SNAP) const;
void RemoveNode(long nIndex);
void InsertNodeAt(int nIndex, const XPoint &pt, double dBulge = 0.0);
void SetPointListAt(int nIndex, const XPoint& pt);
XPoint* GetPointListAt(int nIndex);
const XPoint& GetPointListAt(int nIndex) const;
void RemovePointListAt(int nIndex);
void AppendPointListAt(XPoint* pPt);
void TransformBy(const AcGeMatrix3d &mat);
XPoly3D PlaneToWcs(const AcGeVector3d& normal)const;
bool IsRegionInclude(const XPoly2D& poly)const;
bool IsRegionOverlap(const XPoly2D& poly)const;
public:
int m_nFlag;
DList<double> m_ardbulges;
};
/*
inline int XPoly2D::operator !() const
{
return (Length() < 2 ? 1 : 0);
}
inline int XPoly2D::IsValid(int nIndex) const
{
int nLen = Length();
if (nIndex < 0 || nIndex >= nLen)
{
return 0;
}
if (!(GetFlag() & 1) && nIndex == nLen - 1)
{
return 0;
}
return 1;
}
inline int XPoly2D::IsClosed() const
{
return ((GetFlag() & 0x01) ? 1 : 0);
}
inline int XPoly2D::TotalSegments() const
{
int nLen = Length();
return (GetFlag() & 1) ? nLen : nLen - 1;
}
inline double XPoly2D::Area() const
{
return fabs(PathArea());
}
*/
#endif