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.

72 lines
2.6 KiB
C++

#include "OperatorsDelete.h"
#include "OperatorsInterface/GraphEventOperator.h"
#include "OperatorsInterface/ParaWidgetInterfaceOperator.h"
#include "PostGraphAdaptor/PostGraphObjectManager.h"
#include "PostGraphAdaptor/PostGraphObjectBase.h"
#include "PostGraphAdaptor/PostGraphObjectAgent.h"
#include "FITK_Kernel/FITKAppFramework/FITKAppFramework.h"
#include "FITK_Kernel/FITKAppFramework/FITKGlobalData.h"
#include "FITK_Interface/FITKInterfaceCFDPost/FITKAbstractCFDPostData.h"
#include "FITK_Interface/FITKInterfaceCFDPost/FITKCFDPost3DManager.h"
#include "FITK_Interface/FITKInterfaceCFDPost/FITKCFDPostData.h"
namespace OperModel
{
OperatorsDelete::OperatorsDelete()
{
}
bool OperatorsDelete::execGUI()
{
int objID = -1;
argValue(objID_String, objID);
if (objID <= 0)return false;
Interface::FITKCFDPost3DManager* dataManager = FITKAPP->getGlobalData()->getPostData<Interface::FITKCFDPostData>()->getPostDataManager();
if (dataManager == nullptr)return false;
Interface::PostGraphObjectManager* actorManager = Interface::PostGraphObjectManager::getInstance();
if (actorManager == nullptr)return false;
//删除渲染数据
int actorID = -1;
for (int i = 0; i < actorManager->getDataCount(); i++) {
Interface::PostGraphObjectAgent* agent = actorManager->getDataByIndex(i);
if (agent == nullptr)continue;
Interface::PostGraphObjectBase* graphObj = agent->getGraphObject();
if (graphObj == nullptr)continue;
if (graphObj->getPostID() == objID) {
actorID = agent->getDataObjectID();
break;
}
}
actorManager->removeDataByID(actorID);
//删除vtk数据
dataManager->removeDataByID(objID);
return true;
}
bool OperatorsDelete::execProfession()
{
//更新渲染窗口
EventOper::GraphEventOperator* graphOper = FITKOPERREPO->getOperatorT<EventOper::GraphEventOperator>("OperGraphPreprocess");
if (graphOper) {
graphOper->reRender();
}
//更新树界面
EventOper::ParaWidgetInterfaceOperator* treeOper = FITKOPERREPO->getOperatorT<EventOper::ParaWidgetInterfaceOperator>("ModelTreeEvent");
if (treeOper) {
treeOper->updateTree();
}
//更新界面
EventOper::ParaWidgetInterfaceOperator* infoOper = FITKOPERREPO->getOperatorT<EventOper::ParaWidgetInterfaceOperator>("OperatorsWidget");
if (infoOper) {
infoOper->CurrentObjectChange(-1);
}
return true;
}
}