#pragma once //文件加载和文件相关信息的管理类 using namespace std; const CString g_csLogFile = _T("C:\\DwgCompare_LogFile_图纸比对记录.txt");//比对记录文件路径 class CDwgCompareDbInfo { public: CDwgCompareDbInfo(void); virtual ~CDwgCompareDbInfo(void); public: //读取文件 BOOL LoadFile(const CString sName, const CString sPath); //读取文件,只保留entPoly范围内的实体 BOOL LoadFile(const CString sName, const CString sPath, XPoly2D poly); //从pDb导出ObjIds中的实体到m_pDb BOOL LoadDb(CString& csFilePath, AcDbDatabase*& pDb, const AcDbObjectIdArray& ObjIds, AcGePoint3d& ptBase); void InitLayerInfo(); //读取文件中的所有图层 void GetAllLayer(std::vector& vtLayer) const; //获取所有图层 CString GetFileName() const; CString GetFilePath() const; AcDbDatabase * GetDb() const; int InitEntCount(); //模型空间实体个数 int GetEntCount() const; protected: int GetEntCountInBlock(AcDbObjectId& idBlock, std::map& mapBlock); //统计块内实体数量 protected: CString m_sName; //文件名,包括扩展名 CString m_sPath; //文件路径 AcDbDatabase * m_pDb; //加载的文件 vector m_vtLayerAll; //所有图层 int m_iEntCount; //需要比对的实体数量 }; class CDwgCompareDbMgr : public CDwgCompareDbInfo { public: CDwgCompareDbMgr(void); ~CDwgCompareDbMgr(void); public: void Init(); void GetCmpLayer(std::vector& vtLayer) const; //获取符合比对条件的图层,图层信息只在这个DB对象中有效 void SetCompareLayer(std::vector& vtLayer); //设置比对图层 public: //满足条件,比对需要首先对图层进行打开,解冻,解锁操作 BOOL m_bAllLayer; //比对所有图层 BOOL m_bCmpClosedLayer; //比对关闭的图层 BOOL m_bCmpFrozenLayer; //比对冻结的图层 BOOL m_bCmpLockedlayer; //比对锁定的图层 protected: vector m_vtLayerCmp; //比对的图层 };