#ifndef __CPM__VTK__THREADEDDEFORMATIONOBSERVER__HXX__ #define __CPM__VTK__THREADEDDEFORMATIONOBSERVER__HXX__ #include // ------------------------------------------------------------------------- template< class F > void cpm::VTK::ThreadedDeformationObserver< F >:: Configure( vtkRenderWindow* w ) { this->m_Window = w; this->Modified( ); } // ------------------------------------------------------------------------- template< class F > void cpm::VTK::ThreadedDeformationObserver< F >:: Execute( itk::Object* caller, const itk::EventObject& evt ) { this->Execute( const_cast< const itk::Object* >( caller ), evt ); } // ------------------------------------------------------------------------- template< class F > void cpm::VTK::ThreadedDeformationObserver< F >:: Execute( const itk::Object* caller, const itk::EventObject& evt ) { typedef typename F::AllMeshUpdatedEvent _TAllMeshEvt; if( this->m_Window == NULL ) return; const _TAllMeshEvt* mevt = dynamic_cast< const _TAllMeshEvt* >( &evt ); if( mevt != NULL ) { this->m_MutexLock->Lock( ); this->m_Window->MakeCurrent( ); this->m_Window->Render( ); #ifdef CPM_VTK_THREADEDDEFORMATION_ON_LINUX glXMakeCurrent( ( Display* )( this->m_Window->GetGenericDisplayId( ) ), None, NULL ); #else wglMakeCurrent( ( HDC__* )( this->m_Window->GetGenericDisplayId( ) ), NULL ); #endif this->m_MutexLock->Unlock( ); vtksys::SystemTools::Delay( 1 ); } // fi } // ------------------------------------------------------------------------- template< class F > cpm::VTK::ThreadedDeformationObserver< F >:: ThreadedDeformationObserver( ) : Superclass( ), m_Window( NULL ) { this->m_MutexLock = vtkSmartPointer< vtkMutexLock >::New( ); } // ------------------------------------------------------------------------- template< class F > cpm::VTK::ThreadedDeformationObserver< F >:: ~ThreadedDeformationObserver( ) { } #endif // __CPM__VTK__THREADEDDEFORMATIONOBSERVER__HXX__ // eof - $RCSfile$