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.
54 lines
1.4 KiB
C++
54 lines
1.4 KiB
C++
#include "FITKFluidVTKViewAdaptorModel.h"
|
|
|
|
// Graph and data
|
|
#include "FITKFluidVTKGraphObjectModel.h"
|
|
#include "FITK_Interface/FITKInterfaceGeometry/FITKAbsGeoCommand.h"
|
|
|
|
namespace Exchange
|
|
{
|
|
bool FITKFluidVTKViewAdaptorModel::update()
|
|
{
|
|
if (!_dataObj)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
// If do not need to update and the output is not empty,
|
|
// it means the output has been created, so return true.
|
|
if (!m_needUpdate)
|
|
{
|
|
return (m_outputData != nullptr);
|
|
}
|
|
|
|
// Down cast the input data.
|
|
Interface::FITKAbsGeoCommand* model = dynamic_cast<Interface::FITKAbsGeoCommand*>(_dataObj);
|
|
if (!model)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
// If output is exist, then delete it and create a new one.
|
|
if (m_outputData)
|
|
{
|
|
delete m_outputData;
|
|
m_outputData = nullptr;
|
|
}
|
|
|
|
// The output data object for view
|
|
FITKFluidVTKGraphObjectModel* outputData = new FITKFluidVTKGraphObjectModel(model);
|
|
|
|
m_needUpdate = false;
|
|
|
|
// If the actor count is 0, then this graph object is invalid.
|
|
if (outputData->getActorCount() == 0)
|
|
{
|
|
delete outputData;
|
|
return false;
|
|
}
|
|
|
|
m_outputData = outputData;
|
|
|
|
return true;
|
|
}
|
|
} // namespace Exchange
|