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.
AppFlowPost/PostGraphAdaptor/PostGraphObjectManager.cpp

60 lines
1.8 KiB
C++

#include "PostGraphObjectManager.h"
#include "PostGraphObjectAgent.h"
#include "PostGraphObjectBase.h"
#include "FITK_Interface/FITKInterfaceCFDPost/FITKAbstractCFDPostData.h"
namespace Interface
{
PostGraphObjectManager* PostGraphObjectManager::_instance = nullptr;
QMutex PostGraphObjectManager::m_mutex;
PostGraphObjectBase* PostGraphObjectManager::getGraphObjectBase(FITKAbstractCFDPostData* postData)
{
if (postData == nullptr)return nullptr;
for (int i = 0; i < this->getDataCount(); i++) {
PostGraphObjectAgent* agent = this->getDataByIndex(i);
if (agent == nullptr)continue;
PostGraphObjectBase* base = agent->getGraphObject();
if(base == nullptr)continue;
if (base->getPostID() == postData->getDataObjectID()) {
return base;
}
}
return nullptr;
}
PostGraphObjectBase* PostGraphObjectManager::getGraphObjectBase(int PostDataID)
{
if (PostDataID == -1)return nullptr;
for (int i = 0; i < this->getDataCount(); i++) {
PostGraphObjectAgent* agent = this->getDataByIndex(i);
if (agent == nullptr)continue;
PostGraphObjectBase* base = agent->getGraphObject();
if (base == nullptr)continue;
if (base->getPostID() == PostDataID) {
return base;
}
}
return nullptr;
}
PostGraphLightManager* PostGraphObjectManager::getGraphLightManager()
{
return _postLightManager;
}
void PostGraphObjectManager::initialize()
{
_postLightManager = new PostGraphLightManager();
}
void PostGraphObjectManager::finalize()
{
if (_postLightManager) {
delete _postLightManager;
_postLightManager = nullptr;
}
}
}