]> Creatis software - cpPlugins.git/blob - lib/cpPlugins/BaseWidget.cxx
...
[cpPlugins.git] / lib / cpPlugins / BaseWidget.cxx
1 #include <cpPlugins/BaseWidget.h>
2
3 // -------------------------------------------------------------------------
4 itk::ModifiedTimeType cpPlugins::BaseWidget::
5 GetMTime( ) const
6 {
7   // Let time only be managed by itk -> synch issues when data is
8   // represented by vtk
9   return( this->itk::Object::GetMTime( ) );
10 }
11
12 // -------------------------------------------------------------------------
13 const cpPlugins::BaseWidget::TMPRWidget* cpPlugins::BaseWidget::
14 GetMPRViewer( ) const
15 {
16   return( this->m_MPRViewer );
17 }
18
19 // -------------------------------------------------------------------------
20 const vtkRenderWindowInteractor* cpPlugins::BaseWidget::
21 GetSingleInteractor( ) const
22 {
23   return( this->m_SingleInteractor );
24 }
25
26 // -------------------------------------------------------------------------
27 void cpPlugins::BaseWidget::
28 SetMPRViewer( cpPlugins::BaseWidget::TMPRWidget* v )
29 {
30   if( this->m_MPRViewer != v )
31   {
32     this->m_MPRViewer = v;
33     this->Modified( );
34
35   } // fi
36 }
37
38 // -------------------------------------------------------------------------
39 void cpPlugins::BaseWidget::
40 SetSingleInteractor( vtkRenderWindowInteractor* i )
41 {
42   if( this->m_SingleInteractor != i )
43   {
44     this->m_SingleInteractor = i;
45     this->Modified( );
46
47   } // fi
48 }
49
50 // -------------------------------------------------------------------------
51 bool cpPlugins::BaseWidget::
52 IsInteractive( )
53 {
54   return( true );
55 }
56
57 // -------------------------------------------------------------------------
58 void cpPlugins::BaseWidget::
59 SetInteractionObjects( const std::vector< void* >& objs )
60 {
61   if( objs.size( ) > 0 )
62   {
63     vtkRenderWindowInteractor* rwi =
64       reinterpret_cast< vtkRenderWindowInteractor* >( objs[ 0 ] );
65     this->SetSingleInteractor( rwi );
66   }
67   if( objs.size( ) > 1 )
68   {
69     TMPRWidget* wdg = reinterpret_cast< TMPRWidget* >( objs[ 1 ] );
70     this->SetMPRViewer( wdg );
71
72   } // fi
73 }
74
75 // -------------------------------------------------------------------------
76 cpPlugins::BaseWidget::
77 BaseWidget( )
78   : Superclass( ),
79     m_MPRViewer( NULL ),
80     m_SingleInteractor( NULL )
81 {
82   this->m_Parameters.ConfigureAsString( "Text" );
83   this->m_Parameters.SetString( "Text", "" );
84 }
85
86 // -------------------------------------------------------------------------
87 cpPlugins::BaseWidget::
88 ~BaseWidget( )
89 {
90   // Warning: Qt's smartpointers require this to avoid segfaults
91   this->m_MPRViewer = NULL;
92   this->m_SingleInteractor = NULL;
93 }
94
95 // eof - $RCSfile$