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.
95 lines
1.8 KiB
C++
95 lines
1.8 KiB
C++
#pragma once
|
|
|
|
#include "OMExport.h"
|
|
#include "XJObject.h"
|
|
#include "OMUndoRedo.h"
|
|
#include <assert.h>
|
|
#include <map>
|
|
#include <vector>
|
|
|
|
|
|
class CXJObjectManager;
|
|
class OMPeriodicLattice;
|
|
|
|
enum {MAX_MANAGER_NUM = 2000};
|
|
|
|
//声明导出函数
|
|
extern "C" XJ_OM_EXPORT CXJObjectManager* GetObjectManager(int index = 0);
|
|
|
|
class XJ_OM_EXPORT CXJObjectManager
|
|
{
|
|
public:
|
|
//单例模式,获得对象管理指针
|
|
static CXJObjectManager* GetInstance();
|
|
~CXJObjectManager();
|
|
|
|
//获取二维点阵数据对象
|
|
OMPeriodicLattice* GetPeriodicLattice();
|
|
|
|
//通过给定要创建对象的类型,来创建对象
|
|
CXJObject* CreateObject(EXJObjectType type);
|
|
|
|
CXJObject* GetObjectByKey(int key);
|
|
|
|
//undo/redo
|
|
void StartCommand();
|
|
void EndCommand();
|
|
void AddUndoData(const BBox& bbox,
|
|
const std::vector<uint64_t>& idxList,
|
|
const std::vector<double>& valList);
|
|
|
|
//用于记录网格参数
|
|
void AddMeshDataInfo(double isopStep, int markStep, double zMin, double zMax, double isoplethMin, double isoplethMax);
|
|
void Undo();
|
|
void Redo();
|
|
void ClearUndoRedo();
|
|
|
|
unsigned int GetUndoCurStep();
|
|
unsigned int GetUndoCount();
|
|
private:
|
|
CXJObjectManager();
|
|
|
|
//创建基础对象
|
|
CXJObject* CreateBaseObject(EXJObjectType type, bool istempObj = false);
|
|
|
|
//产生一个唯一的int类型的数字
|
|
int CreateOmKey();
|
|
private:
|
|
//自身单例模式
|
|
static CXJObjectManager* m_pInstance;
|
|
|
|
//对象查询表
|
|
std::map<int, CXJObject*> m_mapObjects;
|
|
|
|
//点阵数据
|
|
OMPeriodicLattice* m_periodicLattice;
|
|
|
|
//undo、redo
|
|
OMUndoRedo* m_pUndoRedo;
|
|
};
|
|
|
|
class XJ_OM_EXPORT CXJObserver
|
|
{
|
|
public:
|
|
CXJObserver(){};
|
|
virtual~CXJObserver(void){};
|
|
|
|
public:
|
|
//virtual int Update(int key, EXJObjectUpdateType updateType) = 0;
|
|
void SetManageIndex(int managerIndex){m_managerIndex = managerIndex;}
|
|
int GetManagerIndex() {return m_managerIndex;}
|
|
|
|
protected:
|
|
int m_managerIndex;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|