]> Creatis software - cpPlugins.git/blob - lib/cpPlugins/Extensions/Visualization/MPRWithDifferentWindows.h
addfad7084afdf3276b754dc4a6f458d87abaf95
[cpPlugins.git] / lib / cpPlugins / Extensions / Visualization / MPRWithDifferentWindows.h
1 #ifndef __CPPLUGINS__EXTENSIONS__VISUALIZATION__MPRWITHDIFFERENTWINDOWS__H__
2 #define __CPPLUGINS__EXTENSIONS__VISUALIZATION__MPRWITHDIFFERENTWINDOWS__H__
3
4 #include <cpPlugins/Extensions/Visualization/MPRActors.h>
5 #include <cpPlugins/Extensions/Visualization/ImageInteractorStyle.h>
6 #include <cpPlugins/Extensions/cpPlugins_Extensions_Export.h>
7
8 #include <vtkImageData.h>
9 #include <vtkRenderer.h>
10 #include <vtkRenderWindow.h>
11 #include <vtkSmartPointer.h>
12
13 // -------------------------------------------------------------------------
14 #define cpPlugins_MPRWithDifferentWindows_ObserverMacro( e )    \
15 inline void Add##e##Observer( vtkCommand* observer )            \
16 {                                                               \
17   for( int i = 0; i < 3; ++i )                                  \
18     if( this->m_Styles[ i ].GetPointer( ) != NULL )             \
19       this->m_Styles[ i ]->Add##e##Observer( observer );        \
20 }                                                               \
21 inline void Remove##e##Observer( vtkCommand* observer )         \
22 {                                                               \
23   for( int i = 0; i < 3; ++i )                                  \
24     if( this->m_Styles[ i ].GetPointer( ) != NULL )             \
25       this->m_Styles[ i ]->Remove##e##Observer( observer );     \
26 }                                                               \
27 inline void Remove##e##Observers( )                             \
28 {                                                               \
29   for( int i = 0; i < 3; ++i )                                  \
30     if( this->m_Styles[ i ].GetPointer( ) != NULL )             \
31       this->m_Styles[ i ]->Remove##e##Observers( );             \
32 }
33
34 namespace cpPlugins
35 {
36   namespace Extensions
37   {
38     namespace Visualization
39     {
40       /**
41        */
42       class cpPlugins_Extensions_EXPORT MPRWithDifferentWindows
43       {
44       public:
45         typedef cpPlugins::Extensions::Visualization::
46         MPRActors TMPRActors;
47         typedef cpPlugins::Extensions::Visualization::
48         ImageInteractorStyle TStyle;
49
50       public:
51         cpPlugins_MPRWithDifferentWindows_ObserverMacro( DoubleClick );
52         cpPlugins_MPRWithDifferentWindows_ObserverMacro( Cursor );
53         cpPlugins_MPRWithDifferentWindows_ObserverMacro( Radius );
54
55       public:
56         MPRWithDifferentWindows(
57           vtkRenderWindow* xWin = NULL,
58           vtkRenderWindow* yWin = NULL,
59           vtkRenderWindow* zWin = NULL,
60           vtkRenderWindow* auxWin = NULL
61           );
62         virtual ~MPRWithDifferentWindows( );
63
64         void SetImage( vtkImageData* image );
65         void SetModeToNavigation( );
66         void SetModeToDeformation( );
67
68         void ResetCamera( const int& id );
69         void ResetCameras( );
70         void Render( const int& id );
71         void RenderAll( );
72
73         vtkRenderer* GetRenderer( const int& id ) const;
74
75         void Add3DActor( vtkProp3D* prop );
76
77       protected:
78         // Inputs
79         vtkRenderWindow* m_Windows[ 4 ];
80
81         // Internal pipelines
82         vtkSmartPointer< TMPRActors >  m_MPRActors;
83         vtkSmartPointer< vtkRenderer > m_Renderers[ 4 ];
84         vtkSmartPointer< TStyle >      m_Styles[ 3 ];
85       };
86
87     } // ecapseman
88
89   } // ecapseman
90
91 } // ecapseman
92
93 #endif // __CPPLUGINS__EXTENSIONS__VISUALIZATION__MPRWITHDIFFERENTWINDOWS__H__
94
95
96 // eof - $RCSfile$