////////////////////////////////////////////////////////////////////////////// //文件 Layer.h //主要功能: // 所有外扩类的基类,由此类派生的类可由COne类进行管理,使用CXy统一读写等 // //程序编写: 2009-10-07 ///////////////////////////////////////////////////////////////////////////// #pragma once #include "..\DrawModel\baseobject.h" #include ".\xydc.h" //从此类扩展的元素类型ID值必须>=100 class AFX_EXT_CLASS CBaseExtend : public CBaseObject { public: CBaseExtend(void); virtual ~CBaseExtend(void); /** @brief 绘制对象本身 */ virtual void Draw(CXyDC& dc); /** @brief 克隆该对象*/ virtual CBaseExtend* CreateClone(); /** @brief 保存为DML格式 */ virtual void WriteDML(CFile &fw, const short& ver, int nBaseTabNum); /** @brief 保存为PCG格式 */ virtual void WritePCG(CFile &fw, const short& ver, int nBaseTabNum); /** @brief 根据偏移矩阵修改参数 */ virtual void Transform(CXyDC* pDC, float* matrix, BOOL bUndo); /** @brief type为校正类型,比如两点校位、四点校位等;pValue为类对象指针,如CCalibrate2、CCalibrate4等 */ virtual void Calibrate(int type, void* pValue); /** @brief 交换XY坐标 */ virtual void ExchangeXY(void); /** @brief 转换到指定投影坐标 */ virtual void ExchangeXY(CProjection& xyz); virtual void ScaleProperty(double sx, double sy); /** @brief mode=0:加,1:减,2:乘,3:除 */ virtual void ScaleCoordinate(double sx, double sy, int mode); virtual CXy* GetParentXY() { return NULL; } //ggff2025 virtual void SetParentXY(CXy* pxy) { } //ggff2025 virtual void Draw(CXyDC& dc, void* pHowToView) { }; virtual int ReadPCG(CFile &fr, const short& ver); /** @brief 处理组合块符号没有加载到当前符号 */ virtual int ReadPCGEx(CFile &fr, const short &ver, void *pXy = nullptr); virtual int ReadPCG(CKXmlParse& xp, const short& ver); /** @brief 处理组合块符号没有加载到当前符号 */ virtual int ReadPCGEx(CKXmlParse& xp, const short &ver, void *pXy = nullptr); }; class AFX_EXT_CLASS CBaseExtendType { public: CBaseExtendType(void) {}; virtual CBaseExtend* CreateExtendObject(int nType) { return NULL; }; //根据指定类型生成对像,类型ID号必须>=100 virtual int GetExtendType(LPCTSTR lpszKey) {return 0;}; //根据指定字符串生成对像类型,类型ID号必须>=100 virtual CString GetTypeName() { return m_TypeName; }; virtual int GetTypeID() { return m_nType; }; CString m_TypeName; //ggff20250326 add int m_nType; }; class AFX_EXT_CLASS CBaseExtendManager { public: CBaseExtendManager(void); ~CBaseExtendManager(void); void AddBaseExtend(CBaseExtendType* pet); void ClearBaseExtend(); CPtrList m_listExtend; //基础扩展类 CBaseExtend* CreateExtendObject(int nType); int GetExtendType(LPCTSTR lpszKey); CString GetTypeNameFromTypeID(int nType); //BOOL IsExtendType(int nType); }; extern CBaseExtendManager m_baseExtendManager; extern "C" AFX_EXT_API CBaseExtendManager * WINAPI AfxGetBaseExtendManager();