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.

66 lines
1.4 KiB
C++

#ifndef XJOSGOBJMANAGER_H
#define XJOSGOBJMANAGER_H
#include "XJOSGObject/XJOSGObject.h"
#include <osgViewer/Viewer>
class CXJOSGViewInternal;
class CXJOSGObjManager;
class SelectionManager;
class CXJOSGObjManager
{
public:
CXJOSGObjManager();
CXJOSGObjManager(osgViewer::Viewer* pviewer);
~CXJOSGObjManager();
/*视图对象的创建与更新*/
int UpdateObjectView(CXJObject *obj, EOSGUpdateType updateType = UPDATE_ALL);
//创建场景视图中的对象
int CreateObjectView(CXJObject *obj);
//删除对象的显示对象和显示节点
void CXJOSGObjManager::DeleteObjectView(CXJObject *pobj);
//查询map容器中是否存在此对象
bool HasItemInMap(CXJObject *pobj);
//清空map容器
void FreeMap() {m_mapOm3D.clear();}
void SetSelectionManager(SelectionManager* sm) {m_selectionManager = sm;}
void SetViewInternal(CXJOSGViewInternal* pParent){m_pParent = pParent;}
/***视图对象与内核对象的转换**/
CXJOSGObject* GetObjectView(const CXJObject * obj);
CXJOSGObject* GetObjectView(int omkey);
int GetViewObject(CXJOSGObject* obj);
int GetViewObject(int osgKey);
CXJOSGObject* GetViewPointer(int osgKey);
//搜索所有显示的视图对象
void GetDisplayedObjects(std::vector<CXJOSGObject*>& displayedList);
private:
std::map<int, CXJOSGObject*> m_mapOm3D;
osgViewer::Viewer* m_pViewer;
SelectionManager* m_selectionManager;
osg::Group* m_3DModelLayer;
osg::Group* m_tempModelLayer;
CXJOSGViewInternal* m_pParent;
};
#endif