76 lines
1.9 KiB
C++
76 lines
1.9 KiB
C++
//-------------------------------------------------------------------------------------------------------+
|
|
// Copyright (C), 1998-2007, Beijing Tangent Software Co. Ltd.
|
|
// = FileName : TGPolygon2D 类
|
|
// = Version : ver2.0
|
|
// = Author : wlw
|
|
// = CreateDate : 2002-09-09
|
|
// = Description: TGPolygon2D 声明 多边形域
|
|
// = Maintainers:
|
|
//
|
|
//-------------------------------------------------------------------------------------------------------+
|
|
#ifndef _TGPOLYGON2D_H_
|
|
#define _TGPOLYGON2D_H_
|
|
|
|
#ifndef _TGREGION2D_H_
|
|
#include "TGRegion2D.h"
|
|
#endif
|
|
|
|
#ifndef _TGPOINT_H_
|
|
#include "TGPoint.h"
|
|
#endif
|
|
|
|
#ifndef _TGMLINE2D_H_
|
|
#include "TGMLine2D.h"
|
|
#endif
|
|
|
|
#ifndef _TGOBJECTLIST_H_
|
|
#include "TGObjectList.h"
|
|
#endif
|
|
|
|
class TGObject;
|
|
class TGPolygonEx2D;
|
|
|
|
class GEOAPI TGPolygon2D : public TGRegion2D
|
|
{
|
|
DECLARE_RUN_TIME_CLASS(TGPolygon2D)
|
|
public:
|
|
//contruct
|
|
TGPolygon2D(long vertexNum = 0);
|
|
TGPolygon2D(const TGMLine2D& ml,bool bCheck=true);
|
|
virtual ~TGPolygon2D();
|
|
|
|
//override TGRegion2D
|
|
virtual void CutBy(const TPGeCurve2D& curve,TGObjectList& left,TGObjectList& right) const;
|
|
virtual void SubtractBy(const TGRegion2D& face,TGObjectList& res) const;
|
|
|
|
virtual TGRegion2D* Union(const TGRegion2D& face) const;
|
|
virtual TPGeCurve2D* GetBoundary(long i) const;
|
|
|
|
//边界有效、封闭、逆时针、不自交
|
|
virtual bool IsValid() const;
|
|
|
|
//分解为TGNPolygon2D
|
|
virtual TGObject* Clone() const;
|
|
|
|
virtual bool Inter(const TGRegion2D& face,TGObjectList& res) const;
|
|
|
|
virtual bool Explode(TGObjectList& res) const;
|
|
|
|
//query
|
|
TGMLine2D& Outline() const;
|
|
bool IsConcave() const;
|
|
TGPoint Center() const;
|
|
|
|
//operate
|
|
bool Inter(const TGPolygon2D& poly,TGObjectList& res) const;
|
|
void SubtractBy(const TGPolygon2D& poly,TGObjectList& res) const;
|
|
void SubtractBy(const TGPolygonEx2D* pPoly,TGObjectList& res) const;
|
|
|
|
TGRegion2D* Union(const TGPolygon2D& poly) const;
|
|
|
|
protected:
|
|
TGMLine2D mLine;
|
|
|
|
};
|
|
#endif
|