FEM: Draft architecture of post data extraction with histogram example
This commit is contained in:
@@ -32,8 +32,11 @@
|
||||
#include <vtkStructuredGrid.h>
|
||||
#include <vtkUniformGrid.h>
|
||||
#include <vtkUnstructuredGrid.h>
|
||||
#include <vtkTable.h>
|
||||
#include <vtkXMLTableWriter.h>
|
||||
#include <vtkXMLDataSetWriter.h>
|
||||
#include <vtkXMLMultiBlockDataWriter.h>
|
||||
#include <vtkXMLTableReader.h>
|
||||
#include <vtkXMLMultiBlockDataReader.h>
|
||||
#include <vtkXMLImageDataReader.h>
|
||||
#include <vtkXMLPolyDataReader.h>
|
||||
@@ -243,6 +246,9 @@ void PropertyPostDataObject::createDataObjectByExternalType(vtkSmartPointer<vtkD
|
||||
case VTK_MULTIPIECE_DATA_SET:
|
||||
m_dataObject = vtkSmartPointer<vtkMultiPieceDataSet>::New();
|
||||
break;
|
||||
case VTK_TABLE:
|
||||
m_dataObject = vtkSmartPointer<vtkTable>::New();
|
||||
break;
|
||||
default:
|
||||
throw Base::TypeError("Unsupported VTK data type");
|
||||
};
|
||||
@@ -313,6 +319,9 @@ void PropertyPostDataObject::Save(Base::Writer& writer) const
|
||||
case VTK_MULTIBLOCK_DATA_SET:
|
||||
extension = "zip";
|
||||
break;
|
||||
case VTK_TABLE:
|
||||
extension = ".vtt";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
};
|
||||
@@ -382,13 +391,16 @@ void PropertyPostDataObject::SaveDocFile(Base::Writer& writer) const
|
||||
xmlWriter = vtkSmartPointer<vtkXMLMultiBlockDataWriter>::New();
|
||||
xmlWriter->SetInputDataObject(m_dataObject);
|
||||
xmlWriter->SetFileName(datafile.filePath().c_str());
|
||||
xmlWriter->SetDataModeToBinary();
|
||||
}
|
||||
else if (m_dataObject->IsA("vtkTable")) {
|
||||
xmlWriter = vtkSmartPointer<vtkXMLTableWriter>::New();
|
||||
xmlWriter->SetInputDataObject(m_dataObject);
|
||||
xmlWriter->SetFileName(fi.filePath().c_str());
|
||||
}
|
||||
else {
|
||||
xmlWriter = vtkSmartPointer<vtkXMLDataSetWriter>::New();
|
||||
xmlWriter->SetInputDataObject(m_dataObject);
|
||||
xmlWriter->SetFileName(fi.filePath().c_str());
|
||||
xmlWriter->SetDataModeToBinary();
|
||||
|
||||
#ifdef VTK_CELL_ARRAY_V2
|
||||
// Looks like an invalid data object that causes a crash with vtk9
|
||||
@@ -399,6 +411,7 @@ void PropertyPostDataObject::SaveDocFile(Base::Writer& writer) const
|
||||
}
|
||||
#endif
|
||||
}
|
||||
xmlWriter->SetDataModeToBinary();
|
||||
|
||||
if (xmlWriter->Write() != 1) {
|
||||
// Note: Do NOT throw an exception here because if the tmp. file could
|
||||
@@ -481,6 +494,9 @@ void PropertyPostDataObject::RestoreDocFile(Base::Reader& reader)
|
||||
else if (extension == "vti") {
|
||||
xmlReader = vtkSmartPointer<vtkXMLImageDataReader>::New();
|
||||
}
|
||||
else if (extension == "vtt") {
|
||||
xmlReader = vtkSmartPointer<vtkXMLTableReader>::New();
|
||||
}
|
||||
else if (extension == "zip") {
|
||||
|
||||
// first unzip the file into a datafolder
|
||||
|
||||
Reference in New Issue
Block a user