86 lines
2.0 KiB
C++
86 lines
2.0 KiB
C++
//-----------------------------------------------------------------------------+
|
|
// Copyright (C), 1998-2007, SH Software Co. Ltd.
|
|
// = FileName : XPolygonEx类
|
|
// = Version : ver2.0
|
|
// = Author : zjq
|
|
// = CreateDate : 2002-09-09
|
|
// = Description: XPolygonEx类声明
|
|
// = Maintainers:
|
|
//
|
|
//-----------------------------------------------------------------------------+
|
|
#ifndef _XPOLYGONEX_H_
|
|
#define _XPOLYGONEX_H_
|
|
|
|
#ifndef _XPOLY_H_
|
|
#include "XPoly.h"
|
|
#endif
|
|
|
|
#ifndef _ENTITY_H_
|
|
#include "Entity.h"
|
|
#endif
|
|
|
|
#ifndef _XTRIANGLE_H_
|
|
#include "XTriangle.h"
|
|
#endif
|
|
|
|
#ifndef _LoopList_H_
|
|
#include "LoopList.h"
|
|
#endif
|
|
|
|
|
|
// 多边形的三角形化
|
|
class GEOAPI XPolygonEx : public XPoly
|
|
{
|
|
public:
|
|
XPolygonEx();
|
|
XPolygonEx(XPoly &src);
|
|
XPolygonEx(Entity &ent);
|
|
XPolygonEx(const XPolygonEx &src);
|
|
virtual ~XPolygonEx();
|
|
|
|
virtual bool IsKindOf(TEntityId entType) const;
|
|
virtual TEntityId Type() const;
|
|
virtual void CopyFrom(const XEntity* pSrc);
|
|
|
|
XPoint * operator [](int nIndex);
|
|
const XPoint & operator [](int nIndex) const;
|
|
XPolygonEx & operator = (const XPolygonEx &src);
|
|
|
|
// 求法向量,用来作为坐标变换
|
|
int GetNormal(XVector3D &vtNormal) const;
|
|
|
|
int Make(const TCHAR *szLay);
|
|
|
|
// b2D--TRUE, 已经是二维;否则是三维,需要坐标变换
|
|
int Trianglize(DList<XTriangle> &lstTris, BOOL b2D = FALSE) const;
|
|
int SubTrianglize(DList<XTriangle> &lstTris);
|
|
|
|
int GetInsidePoint(XPoint &ptRet, BOOL b2D = FALSE) const;
|
|
int SubGetInsidePoint(XPoint &ptRet);
|
|
|
|
//是否为凸多边形,2D
|
|
BOOL IsConvex() const;
|
|
BOOL IsVisible(int idx) const;
|
|
|
|
void Reset();
|
|
void Reverse();
|
|
void Ecs2Wcs(XVector3D vtEcs);
|
|
void Wcs2Ecs(XVector3D vtEcs);
|
|
|
|
void SetVisible(int idx, BOOL bVis);
|
|
|
|
void RemoveNode(int nIndex);
|
|
void AppendNode(const XPoint &pt, int nIndex = 1);
|
|
|
|
double GetEdgeLength(int idx) const;
|
|
double GetAngle(int idx) const;
|
|
XPoint GetVertex(int idx) const;
|
|
LoopList<int>& GetVisibleFlag();
|
|
|
|
public:
|
|
// 1--visible; 0-invisible
|
|
LoopList<int> m_lstVisibleFlag;
|
|
};
|
|
|
|
#endif
|