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.

42 lines
1.1 KiB
C++

#pragma once
#include <list>
#include <map>
#include <string>
#include <vector>
using std::string;
//读取和操作dfd图件
class GBaseObj;
class AFX_EXT_CLASS GDfdMap
{
public:
GDfdMap();
virtual ~GDfdMap();
void ClearAll(void);
int ReadFile(const char* fname);
//获取指定层下所有元素
int GetElements(std::list<GBaseObj*>& dstObjs, string layername, bool bIncludingSublayers = true);
//获取所有元素
std::list<GBaseObj*>& GetElements();
int GetLayers(std::vector<string>& layers);
void InsertObj(GBaseObj* pobj, const string& strLayer, COLORREF color);
string InsertLayer(string layername);
//implementations
protected:
string GetParentLayer(string curLayer);
int GetSubLayers(string parentLayer ,std::list<string>& sublayers);
void InsertObj(GBaseObj* pobj);
//layerdst是否为scr的子层
bool IsSubLayer(string layerscr, string layerdst);
protected:
typedef std::list<GBaseObj*>::iterator OBJITER;
std::list<GBaseObj*> m_elements;
std::string m_tmpLayer;
COLORREF m_tmpColor;
std::map<string, std::list<GBaseObj*> > m_mapLayerObjs; //层位和对应元素
};