From: Leonardo Flórez-Valencia Date: Wed, 12 Oct 2016 21:52:59 +0000 (-0500) Subject: Mesh writer added. X-Git-Tag: v0.1~85 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?p=cpPlugins.git;a=commitdiff_plain;h=06ace6bbbd569c3ca466699d4adf3c293a2e2bb4 Mesh writer added. --- diff --git a/plugins/IO/MeshWriter.cxx b/plugins/IO/MeshWriter.cxx new file mode 100644 index 0000000..23921e0 --- /dev/null +++ b/plugins/IO/MeshWriter.cxx @@ -0,0 +1,39 @@ +#include +#include +#include + +// ------------------------------------------------------------------------- +cpPluginsIO::MeshWriter:: +MeshWriter( ) + : Superclass( ) +{ + this->_ConfigureInput< cpPlugins::DataObjects::Mesh >( "Input", true, false ); + this->m_Parameters.Clear( ); + this->m_Parameters.ConfigureAsSaveFileName( "FileName" ); + this->m_Parameters.SetAcceptedFileExtensions( + "FileName", + "Mesh files (*.vtk)" + ); +} + +// ------------------------------------------------------------------------- +cpPluginsIO::MeshWriter:: +~MeshWriter( ) +{ +} + +// ------------------------------------------------------------------------- +void cpPluginsIO::MeshWriter:: +_GenerateData( ) +{ + auto mesh = this->GetInputData< vtkPolyData >( "Input" ); + if( mesh == NULL ) + this->_Error( "Invalid input image." ); + + auto f = this->_CreateVTK< vtkPolyDataWriter >( ); + f->SetFileName( this->m_Parameters.GetSaveFileName( "FileName" ).c_str( ) ); + f->SetInputData( mesh ); + f->Update( ); +} + +// eof - $RCSfile$ diff --git a/plugins/IO/MeshWriter.h b/plugins/IO/MeshWriter.h new file mode 100644 index 0000000..4339e2b --- /dev/null +++ b/plugins/IO/MeshWriter.h @@ -0,0 +1,21 @@ +#ifndef __CPPLUGINSIO__MESHWRITER__H__ +#define __CPPLUGINSIO__MESHWRITER__H__ + +#include +#include + +namespace cpPluginsIO +{ + /** + */ + class cpPluginsIO_EXPORT MeshWriter + : public cpPlugins::BaseObjects::ProcessObject + { + cpPluginsObject( MeshWriter, cpPlugins::BaseObjects::ProcessObject, IO ); + }; + +} // ecapseman + +#endif // __CPPLUGINS__IO__MESHWRITER__H__ + +// eof - $RCSfile$