]> Creatis software - cpPlugins.git/blobdiff - lib/cpPlugins/Interface/Mesh.cxx
median filter added
[cpPlugins.git] / lib / cpPlugins / Interface / Mesh.cxx
index 3bcb5afaa043e06f650bd07746055cad3578b101..8507a4b52a2e0f385b3b60c306a0d4428e1afc5a 100644 (file)
@@ -1,69 +1,65 @@
 #include <cpPlugins/Interface/Mesh.h>
 
-#include <vtkMapper.h>
-
-#include <cpPlugins/Extensions/QuadEdgeMesh.h>
-#include <cpPlugins/Extensions/OpenGLMeshMapper.h>
+#include <vtkPolyData.h>
 
 // -------------------------------------------------------------------------
-cpPlugins::Interface::Mesh::
-Mesh( )
-  : Superclass( ),
-    m_Mapper( NULL )
+void cpPlugins::Interface::Mesh::
+SetVTKMesh( vtkPolyData* mesh )
 {
+  this->m_VTKObject = mesh;
+
+  this->m_Mapper = vtkSmartPointer< vtkPolyDataMapper >::New( );
+  this->m_Actor = vtkSmartPointer< vtkActor >::New( );
+
+  this->m_Mapper->SetInputData( mesh );
+  this->m_Actor->SetMapper( this->m_Mapper );
+
+  this->Modified( );
 }
 
 // -------------------------------------------------------------------------
-cpPlugins::Interface::Mesh::
-~Mesh( )
+vtkPolyData* cpPlugins::Interface::Mesh::
+GetVTKMesh( )
 {
-  if( this->m_Mapper != NULL ) this->m_Mapper->Delete( );
+  return( dynamic_cast< vtkPolyData* >( this->m_VTKObject.GetPointer( ) ) );
 }
 
 // -------------------------------------------------------------------------
-std::string cpPlugins::Interface::Mesh::
-GetClassName( ) const
+const vtkPolyData* cpPlugins::Interface::Mesh::
+GetVTKMesh( ) const
 {
-  return( "cpPlugins::Interface::Mesh" );
+  return(
+    dynamic_cast< const vtkPolyData* >( this->m_VTKObject.GetPointer( ) )
+    );
 }
 
 // -------------------------------------------------------------------------
-void cpPlugins::Interface::Mesh::
-SetDataObject( itk::DataObject* dobj )
+vtkActor* cpPlugins::Interface::Mesh::
+GetVTKActor( )
 {
-  this->Superclass::SetDataObject( dobj );
-  
-  // WARNING: Only 2 and 3 dimensions at this moment
-  typedef cpPlugins::Extensions::QuadEdgeMesh< float, 2 >  _TF2;
-  typedef cpPlugins::Extensions::QuadEdgeMesh< double, 2 > _TD2;
-  typedef cpPlugins::Extensions::QuadEdgeMesh< float, 3 >  _TF3;
-  typedef cpPlugins::Extensions::QuadEdgeMesh< double, 3 > _TD3;
-
-  if     ( dynamic_cast< _TF2* >( dobj ) ) this->_Map< _TF2 >( );
-  else if( dynamic_cast< _TD2* >( dobj ) ) this->_Map< _TD2 >( );
-  else if( dynamic_cast< _TF3* >( dobj ) ) this->_Map< _TF3 >( );
-  else if( dynamic_cast< _TD3* >( dobj ) ) this->_Map< _TD3 >( );
+  return( this->m_Actor );
 }
 
 // -------------------------------------------------------------------------
-vtkMapper* cpPlugins::Interface::Mesh::
-GetVTKMapper( ) const
+const vtkActor* cpPlugins::Interface::Mesh::
+GetVTKActor( ) const
 {
-  return( this->m_Mapper );
+  return( this->m_Actor );
 }
 
 // -------------------------------------------------------------------------
-template< class M >
-void cpPlugins::Interface::Mesh::
-_Map( )
+cpPlugins::Interface::Mesh::
+Mesh( )
+  : Superclass( )
 {
-  typedef cpPlugins::Extensions::OpenGLMeshMapper< M > _TMapper;
+  this->m_ClassName = "cpPlugins::Interface::Mesh";
+  this->m_ClassCategory = "BasicObject";
+}
 
-  if( this->m_Mapper != NULL ) this->m_Mapper->Delete( );
-  M* mesh = dynamic_cast< M* >( this->Superclass::GetDataObject( ) );
-  _TMapper* mapper = _TMapper::New( );
-  mapper->SetInputData( mesh );
-  this->m_Mapper = mapper;
+// -------------------------------------------------------------------------
+cpPlugins::Interface::Mesh::
+~Mesh( )
+{
 }
 
 // eof - $RCSfile$