//-----------------------------------------------------------------------------+ // Copyright (C), 1998-2007, SH Software Co. Ltd. // = FileName : CHole.h // = Version : ver2.0 // = Author : zjq // = CreateDate : 2002-09-09 // = Description: 类的声明 // = Maintainers: // //-----------------------------------------------------------------------------+ #ifndef _HOLE_H_ #define _HOLE_H_ #ifndef _C3DFACE_H_ #include "C3DFace.h" #endif #ifndef _DLIST_H_ #include "DList.h" #endif #ifndef _XTRIANGLE_H_ #include "XTriangle.h" #endif #ifndef _XPOLY2D_H_ #include "XPoly2D.h" #endif #ifndef _XPOLYGONEX_H_ #include "XPolygonEx.h" #endif #ifndef _BPLOYGON_H_ #include "CPloygon.h" #endif #ifndef _CENTITY_H_ #include "CEntity.h" #endif class CBNode; class GEOAPI CHole { public: CHole(); virtual ~CHole(); //构造边界线链表,用基线描述边界,第一个链表为外边,其余为内边 BOOL ConstructEdgeList(); //单连通化\然后三角化,返回3DFACE BOOL SimplifyToFace(C3DFaceList& face3DList); //将空从左到右\从下到上排序 BOOL SortHolesInXY(); //将外边界变为逆时针,内边界顺时针,并且按X从小到大排序 BOOL SortNodesAlongClockWise(); CBNode* GetADivideNode(CPloygon* pEdge,CPloygon* pEdge1,CBNode* pNode); //在边界pEdge上选择一个适当的顶点,它和pNode的连线不与任何其他边界相交(包括pEdge和pEdge1) //因此可将多边形一分为二 //创建孔洞 void CreateHoles(); //单连通化\然后三角化,返回3DFACE BOOL SimplifyToTriangle(DList &lstRes); //构造边界线链表,用基线描述边界,第一个链表为外边,其余为内边 BOOL ConstructEdgeList(const DList &lstHole); //构造边界线链表,用基线描述边界,第一个链表为外边,其余为内边 BOOL ConstructEdgeList(const DList &lstHole); //构造边界线链表,用基线描述边界,第一个链表为外边,其余为内边 BOOL ConstructEdgeList(const XPoly2D &out, const DList &lstHole); //构造边界线链表,用基线描述边界,第一个链表为外边,其余为内边 BOOL ConstructEdgeList(const XPolygonEx &out, const DList &lstHole); //构造边界线链表,用基线描述边界,第一个链表为外边,其余为内边 BOOL ConstructEdgeList(const XPolygonEx &out, const DList &lstHole); BOOL GetTriangles(DList &lstRes); BOOL FormatEdgeList(); BOOL FormatEdgeListAuto(); public: //区域各边链表 TBPolygonList m_RegionLst; //基线插入基点 AcGePoint3d m_insertPt; private: BOOL CreateReference(AcGePoint3d org,CString& BlockTableRecordName,double rotAng,CString layerName = _T("")); //构造块名 BOOL BlockName(CString& blockName); //根据entLst创建块 BOOL CreateBlock(CEntityList& entLst,CString& blockName,AcDbObjectId& blockId,AcGePoint3d org); //返回层layerName的记录ID AcDbObjectId GetLayerRecordId(CString layerName); //只删除C3DFface对象,不删除其AcDbFace对象 void ReleaseC3DFaceList(C3DFaceList& c3dfaceLst); //只删除CEntity对象,不删除其AcDbEntity对象 void ReleaseCEntityList(CEntityList& centityLst); //将链表中的所有实体的层设置为layerName void SetLayerOfEntities(CEntityList& entLst,CString layerName, int colorNum = 7); //层layerName是否存在于数据库中 BOOL IsLayerExistInDb(CString layerName); //设置层,如果不存在则新建。 BOOL SetLayer(CString layerName, int colorNum = 0); //新建层layerName。 BOOL NewLayer(CString& layerName, int colorNum = 0, BOOL bFreeze = 0); //将C3DFaceList转换为CEntityList void C3DFaceList2EntityList(C3DFaceList& c3dFaceLst,CEntityList& entLst); //将层冻结 BOOL SetLayerFrozen(CString layerName, bool bFreeze = 1); //将层关闭 BOOL SetLayerOff(CString layerName, bool bOff = 1); }; #endif