1 #ifndef __CPM__VTK__THREADEDDEFORMATIONOBSERVER__HXX__
2 #define __CPM__VTK__THREADEDDEFORMATIONOBSERVER__HXX__
4 #include <vtksys/SystemTools.hxx>
6 // -------------------------------------------------------------------------
8 void cpm::VTK::ThreadedDeformationObserver< F >::
9 Configure( vtkRenderWindow* w )
15 // -------------------------------------------------------------------------
17 void cpm::VTK::ThreadedDeformationObserver< F >::
18 Execute( itk::Object* caller, const itk::EventObject& evt )
20 this->Execute( const_cast< const itk::Object* >( caller ), evt );
23 // -------------------------------------------------------------------------
25 void cpm::VTK::ThreadedDeformationObserver< F >::
26 Execute( const itk::Object* caller, const itk::EventObject& evt )
28 typedef typename F::AllMeshUpdatedEvent _TAllMeshEvt;
30 if( this->m_Window == NULL )
33 const _TAllMeshEvt* mevt = dynamic_cast< const _TAllMeshEvt* >( &evt );
36 this->m_MutexLock->Lock( );
37 this->m_Window->MakeCurrent( );
38 this->m_Window->Render( );
39 #ifdef CPM_VTK_THREADEDDEFORMATION_ON_LINUX
41 ( Display* )( this->m_Window->GetGenericDisplayId( ) ), None, NULL
45 ( HDC__* )( this->m_Window->GetGenericDisplayId( ) ), NULL
48 this->m_MutexLock->Unlock( );
49 vtksys::SystemTools::Delay( 1 );
54 // -------------------------------------------------------------------------
56 cpm::VTK::ThreadedDeformationObserver< F >::
57 ThreadedDeformationObserver( )
61 this->m_MutexLock = vtkSmartPointer< vtkMutexLock >::New( );
64 // -------------------------------------------------------------------------
66 cpm::VTK::ThreadedDeformationObserver< F >::
67 ~ThreadedDeformationObserver( )
71 #endif // __CPM__VTK__THREADEDDEFORMATIONOBSERVER__HXX__