#include #include #include #include // ------------------------------------------------------------------------- std::string cpPlugins::Interface::Mesh:: GetClassName( ) const { return( "cpPlugins::Interface::Mesh" ); } // ------------------------------------------------------------------------- void cpPlugins::Interface::Mesh:: SetRealDataObject( itk::DataObject* dobj ) { this->Superclass::SetRealDataObject( dobj ); // NOTE: Only 2 and 3 dimensions at this moment using namespace cpPlugins::Extensions; typedef DataStructures::QuadEdgeMesh< float, 2 > _TF2; typedef DataStructures::QuadEdgeMesh< double, 2 > _TD2; typedef DataStructures::QuadEdgeMesh< float, 3 > _TF3; typedef DataStructures::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 { return( this->m_Mapper ); } // ------------------------------------------------------------------------- cpPlugins::Interface::Mesh:: Mesh( ) : Superclass( ), m_Mapper( NULL ) { } // ------------------------------------------------------------------------- cpPlugins::Interface::Mesh:: ~Mesh( ) { if( this->m_Mapper != NULL ) this->m_Mapper->Delete( ); } // ------------------------------------------------------------------------- template< class M > void cpPlugins::Interface::Mesh:: _Map( ) { typedef cpPlugins::Extensions::Visualization::OpenGLMeshMapper< M > _TMapper; if( this->m_Mapper != NULL ) this->m_Mapper->Delete( ); M* mesh = dynamic_cast< M* >( this->Superclass::GetRealDataObject( ) ); _TMapper* mapper = _TMapper::New( ); mapper->SetInputData( mesh ); this->m_Mapper = mapper; } // eof - $RCSfile$