X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FcpPlugins%2FInterface%2FMesh.cxx;h=8507a4b52a2e0f385b3b60c306a0d4428e1afc5a;hb=c3c3da5217b6eb255db9c0424f22d4e01250901e;hp=3bcb5afaa043e06f650bd07746055cad3578b101;hpb=d97da4c5884307e660b0ed9135f87cffff174b93;p=cpPlugins.git diff --git a/lib/cpPlugins/Interface/Mesh.cxx b/lib/cpPlugins/Interface/Mesh.cxx index 3bcb5af..8507a4b 100644 --- a/lib/cpPlugins/Interface/Mesh.cxx +++ b/lib/cpPlugins/Interface/Mesh.cxx @@ -1,69 +1,65 @@ #include -#include - -#include -#include +#include // ------------------------------------------------------------------------- -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$