From 06ace6bbbd569c3ca466699d4adf3c293a2e2bb4 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Leonardo=20Fl=C3=B3rez-Valencia?= Date: Wed, 12 Oct 2016 16:52:59 -0500 Subject: [PATCH] Mesh writer added. --- plugins/IO/MeshWriter.cxx | 39 +++++++++++++++++++++++++++++++++++++++ plugins/IO/MeshWriter.h | 21 +++++++++++++++++++++ 2 files changed, 60 insertions(+) create mode 100644 plugins/IO/MeshWriter.cxx create mode 100644 plugins/IO/MeshWriter.h 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$ -- 2.45.0