1 #include <cpPlugins/Interface/Mesh.h>
5 #include <cpPlugins/Extensions/DataStructures/QuadEdgeMesh.h>
6 #include <cpPlugins/Extensions/Visualization/OpenGLMeshMapper.h>
8 // -------------------------------------------------------------------------
9 cpPlugins::Interface::Mesh::
16 // -------------------------------------------------------------------------
17 cpPlugins::Interface::Mesh::
20 if( this->m_Mapper != NULL ) this->m_Mapper->Delete( );
23 // -------------------------------------------------------------------------
24 std::string cpPlugins::Interface::Mesh::
27 return( "cpPlugins::Interface::Mesh" );
30 // -------------------------------------------------------------------------
31 void cpPlugins::Interface::Mesh::
32 SetDataObject( itk::DataObject* dobj )
34 this->Superclass::SetDataObject( dobj );
36 // WARNING: Only 2 and 3 dimensions at this moment
37 using namespace cpPlugins::Extensions;
38 typedef DataStructures::QuadEdgeMesh< float, 2 > _TF2;
39 typedef DataStructures::QuadEdgeMesh< double, 2 > _TD2;
40 typedef DataStructures::QuadEdgeMesh< float, 3 > _TF3;
41 typedef DataStructures::QuadEdgeMesh< double, 3 > _TD3;
43 if ( dynamic_cast< _TF2* >( dobj ) ) this->_Map< _TF2 >( );
44 else if( dynamic_cast< _TD2* >( dobj ) ) this->_Map< _TD2 >( );
45 else if( dynamic_cast< _TF3* >( dobj ) ) this->_Map< _TF3 >( );
46 else if( dynamic_cast< _TD3* >( dobj ) ) this->_Map< _TD3 >( );
49 // -------------------------------------------------------------------------
50 vtkMapper* cpPlugins::Interface::Mesh::
53 return( this->m_Mapper );
56 // -------------------------------------------------------------------------
58 void cpPlugins::Interface::Mesh::
62 cpPlugins::Extensions::Visualization::OpenGLMeshMapper< M >
65 if( this->m_Mapper != NULL ) this->m_Mapper->Delete( );
66 M* mesh = dynamic_cast< M* >( this->Superclass::GetDataObject( ) );
67 _TMapper* mapper = _TMapper::New( );
68 mapper->SetInputData( mesh );
69 this->m_Mapper = mapper;