]> Creatis software - cpPlugins.git/commitdiff
Mesh writer added.
authorLeonardo Flórez-Valencia <florez-l@javeriana.edu.co>
Wed, 12 Oct 2016 21:52:59 +0000 (16:52 -0500)
committerLeonardo Flórez-Valencia <florez-l@javeriana.edu.co>
Wed, 12 Oct 2016 21:52:59 +0000 (16:52 -0500)
plugins/IO/MeshWriter.cxx [new file with mode: 0644]
plugins/IO/MeshWriter.h [new file with mode: 0644]

diff --git a/plugins/IO/MeshWriter.cxx b/plugins/IO/MeshWriter.cxx
new file mode 100644 (file)
index 0000000..23921e0
--- /dev/null
@@ -0,0 +1,39 @@
+#include <plugins/IO/MeshWriter.h>
+#include <cpPlugins/DataObjects/Mesh.h>
+#include <vtkPolyDataWriter.h>
+
+// -------------------------------------------------------------------------
+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 (file)
index 0000000..4339e2b
--- /dev/null
@@ -0,0 +1,21 @@
+#ifndef __CPPLUGINSIO__MESHWRITER__H__
+#define __CPPLUGINSIO__MESHWRITER__H__
+
+#include <plugins/cpPluginsIO_Export.h>
+#include <cpPlugins/BaseObjects/ProcessObject.h>
+
+namespace cpPluginsIO
+{
+  /**
+   */
+  class cpPluginsIO_EXPORT MeshWriter
+    : public cpPlugins::BaseObjects::ProcessObject
+  {
+    cpPluginsObject( MeshWriter, cpPlugins::BaseObjects::ProcessObject, IO );
+  };
+
+} // ecapseman
+
+#endif // __CPPLUGINS__IO__MESHWRITER__H__
+
+// eof - $RCSfile$