#include "FITKCFDPostSliceSphere.h" #include "FITKCFDPost3DManager.h" #include "FITKCFDPostData.h" #include "FITK_Kernel/FITKAppFramework/FITKAppFramework.h" #include "FITK_Kernel/FITKAppFramework/FITKGlobalData.h" #include #include #include #include #include #include #include namespace Interface { FITKCFDPostSliceSphere::FITKCFDPostSliceSphere(int parentID) { _CFDPostParentID = parentID; Interface::FITKCFDPost3DManager* dataManger = FITKAPP->getGlobalData()->getPostData()->getPostDataManager(); if (dataManger == nullptr)return; Interface::FITKAbstractCFDPostData* parentData = dataManger->getDataByID(_CFDPostParentID); if (parentData == nullptr)return; _sphere = vtkSphere::New(); _sliceDataSet = vtkCutter::New(); _sliceDataSet->SetInputConnection(parentData->getOutputPort()); _sliceDataSet->SetCutFunction(_sphere); vtkDataSetMapper* mapper = vtkDataSetMapper::New(); mapper->SetInputConnection(_sliceDataSet->GetOutputPort()); _mappers.append(mapper); } FITKCFDPostSliceSphere::~FITKCFDPostSliceSphere() { if (_sphere) { _sphere->Delete(); _sphere = nullptr; } if (_sliceDataSet) { _sliceDataSet->Delete(); _sliceDataSet = nullptr; } } FITKPostDataType FITKCFDPostSliceSphere::getPostDataType() { return Interface::FITKPostDataType::Post_SliceSphere; } vtkDataSet* FITKCFDPostSliceSphere::getOutput() { if (_sliceDataSet == nullptr)return nullptr; return _sliceDataSet->GetOutput(); } void FITKCFDPostSliceSphere::setValue(double* origin, double radius) { if (_sphere == nullptr)return; _sphere->SetCenter(origin); _sphere->SetRadius(radius); } void FITKCFDPostSliceSphere::getValue(double* origin, double& radius) { if (_sphere == nullptr)return; _sphere->GetCenter(origin); radius = _sphere->GetRadius(); } }