X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FcpPlugins%2FInterface%2FMesh.cxx;h=55114dd5ee26966471f3b4d52972e93d9737babd;hb=7c7bc497af96e7b5845be9a2fc277036ec752be9;hp=3bcb5afaa043e06f650bd07746055cad3578b101;hpb=d97da4c5884307e660b0ed9135f87cffff174b93;p=cpPlugins.git diff --git a/lib/cpPlugins/Interface/Mesh.cxx b/lib/cpPlugins/Interface/Mesh.cxx index 3bcb5af..55114dd 100644 --- a/lib/cpPlugins/Interface/Mesh.cxx +++ b/lib/cpPlugins/Interface/Mesh.cxx @@ -1,69 +1,114 @@ #include -#include +#include -#include -#include +// ------------------------------------------------------------------------- +void cpPlugins::Interface::Mesh:: +SetVTKMesh( vtkPolyData* mesh ) +{ + this->m_VTKObject = mesh; + this->Modified( ); +} + +// ------------------------------------------------------------------------- +vtkPolyData* cpPlugins::Interface::Mesh:: +GetVTKMesh( ) +{ + return( dynamic_cast< vtkPolyData* >( this->m_VTKObject.GetPointer( ) ) ); +} + +// ------------------------------------------------------------------------- +const vtkPolyData* cpPlugins::Interface::Mesh:: +GetVTKMesh( ) const +{ + return( + dynamic_cast< const vtkPolyData* >( this->m_VTKObject.GetPointer( ) ) + ); +} + +/* +void cpPlugins::Interface::Mesh:: +SetITKDataObject( itk::DataObject* o ) +{ + // TODO: conversion!!! + std::cout << "Mesh: SetITKDataObject " << std::endl; + std::exit( 1 ); +} + +// ------------------------------------------------------------------------- +void cpPlugins::Interface::Mesh:: +SetVTKDataObject( vtkDataObject* o ) +{ + if( dynamic_cast< vtkPolyData* >( o ) != NULL ) + { + this->m_VTKObject = o; + + // TODO: conversion!!! + } + else + this->m_VTKObject = NULL; +} + +// ------------------------------------------------------------------------- +vtkPolyData* cpPlugins::Interface::Mesh:: +GetVTKPolyData( ) +{ + return( dynamic_cast< vtkPolyData* >( this->m_VTKObject.GetPointer( ) ) ); +} + +// ------------------------------------------------------------------------- +const vtkPolyData* cpPlugins::Interface::Mesh:: +GetVTKPolyData( ) const +{ + return( + dynamic_cast< const vtkPolyData* >( this->m_VTKObject.GetPointer( ) ) + ); +} +*/ // ------------------------------------------------------------------------- cpPlugins::Interface::Mesh:: Mesh( ) - : Superclass( ), - m_Mapper( NULL ) + : Superclass( ) { + this->m_ClassName = "cpPlugins::Interface::Mesh"; + this->m_ClassCategory = "BasicObject"; } // ------------------------------------------------------------------------- cpPlugins::Interface::Mesh:: ~Mesh( ) { - if( this->m_Mapper != NULL ) this->m_Mapper->Delete( ); } // ------------------------------------------------------------------------- -std::string cpPlugins::Interface::Mesh:: -GetClassName( ) const +/* TODO +template< unsigned int D > +void cpPlugins::Interface::Mesh:: +_ITK_2_VTK_0( itk::DataObject* o ) { - return( "cpPlugins::Interface::Mesh" ); } // ------------------------------------------------------------------------- +template< class P, unsigned int D > void cpPlugins::Interface::Mesh:: -SetDataObject( itk::DataObject* dobj ) +_ITK_2_VTK_1( itk::DataObject* o ) { - 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 >( ); } // ------------------------------------------------------------------------- -vtkMapper* cpPlugins::Interface::Mesh:: -GetVTKMapper( ) const +template< unsigned int D > +void cpPlugins::Interface::Mesh:: +_VTK_2_ITK_0( itk::DataObject* o ) { - return( this->m_Mapper ); } // ------------------------------------------------------------------------- -template< class M > +template< class P, unsigned int D > void cpPlugins::Interface::Mesh:: -_Map( ) +_VTK_2_ITK_1( itk::DataObject* o ) { - typedef cpPlugins::Extensions::OpenGLMeshMapper< M > _TMapper; - - 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; } +*/ // eof - $RCSfile$