You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
# pragma once
# ifndef AFX_EXT_CLASS
# define AFX_EXT_CLASS Q_DECL_IMPORT
# endif
# include <vector>
# include <set>
using std : : vector ;
using std : : set ;
# include "InterfaceElements.h"
/*@file: PolygonTree.h
* @desc: 用于生成多边形之间包含关系树状图
* @date: 2023.3.11
*/
//多边形层级关系表 vector<int>中有四个元素 表示 0、下一个条, 1、前一条, 2、孩子 3、父亲
using MyHierarchy = vector < vector < int > > ;
class CMyCurve ;
class CPolygonTree ;
class AFX_EXT_CLASS CPolygonTreeInterface
{
public :
CPolygonTreeInterface ( void ) ;
~ CPolygonTreeInterface ( void ) ;
//vector<CPolyline*>& GetPolygons(void);
//MyHierarchy& GetHierarchy(void);
void Create ( float filterArea = - 1 ) ;
void AddPolygon ( CPolyline * pc ) ;
void SetPolygons ( vector < CPolyline * > & pgns ) ;
//设置层级关系
void SetHierarchy ( MyHierarchy & hier ) ;
//清空 m_polygons 和m_hierarchy
void Clear ( void ) ;
vector < CPolyline * > & GetResultPolygons ( void ) ;
CPolyline & GetCombinedPolygon ( void ) ;
protected :
//由层级关系生成,返回个数
int CreateWithHierarchy ( float filterArea ) ;
CMyCurve * m_virtualRoot ; //虚拟根节点
vector < CMyCurve * > m_srcPolygons ; //多边形曲线
MyHierarchy m_hierarchy ; //层级关系
CPolyline m_combinedPolygon ; //结果多边形合并后的一条曲线
vector < CPolyline * > m_rstPolygons ; //生成的结果多边形
private :
CPolygonTree * m_pgnTree ;
} ;