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.
74 lines
2.2 KiB
C++
74 lines
2.2 KiB
C++
#include "FITKCFDPostSliceSphere.h"
|
|
#include "FITKCFDPost3DManager.h"
|
|
#include "FITKCFDPostData.h"
|
|
|
|
#include "FITK_Kernel/FITKAppFramework/FITKAppFramework.h"
|
|
#include "FITK_Kernel/FITKAppFramework/FITKGlobalData.h"
|
|
|
|
#include <vtkCutter.h>
|
|
#include <vtkDataSetMapper.h>
|
|
#include <vtkSphere.h>
|
|
#include <vtkSmartPointer.h>
|
|
#include <vtkDataSet.h>
|
|
#include <vtkProperty.h>
|
|
#include <vtkUnstructuredGrid.h>
|
|
|
|
namespace Interface
|
|
{
|
|
FITKCFDPostSliceSphere::FITKCFDPostSliceSphere(int parentID)
|
|
{
|
|
_CFDPostParentID = parentID;
|
|
Interface::FITKCFDPost3DManager* dataManger = FITKAPP->getGlobalData()->getPostData<Interface::FITKCFDPostData>()->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();
|
|
}
|
|
} |