]> Creatis software - cpPlugins.git/blob - lib/cpPlugins/Interface/BaseMPRWindow.h
d0509671da4676f607e378eff898a5c88ae27bbe
[cpPlugins.git] / lib / cpPlugins / Interface / BaseMPRWindow.h
1 #ifndef __CPPLUGINS__INTERFACE__BASEMPRWINDOW__H__
2 #define __CPPLUGINS__INTERFACE__BASEMPRWINDOW__H__
3
4 #include <cpPlugins/Interface/cpPlugins_Interface_Export.h>
5 #include <cpPlugins/Interface/Config.h>
6
7 #ifdef cpPlugins_Interface_QT4
8
9 #include <set>
10 #include <string>
11 #include <vector>
12
13 #include <QApplication>
14 #include <QMenu>
15 #include <QVTKWidget.h>
16
17 #include <vtkSmartPointer.h>
18
19 #include <cpExtensions/QT/QuadSplitter.h>
20 #include <cpExtensions/Visualization/MPRObjects.h>
21 #include <cpPlugins/Interface/Interface.h>
22 #include <cpPlugins/Interface/ProcessObject.h>
23 #include <cpPlugins/Interface/Image.h>
24 #include <cpPlugins/Interface/Mesh.h>
25
26 namespace cpPlugins
27 {
28   namespace Interface
29   {
30     /**
31      */
32     class cpPlugins_Interface_EXPORT BaseMPRWindow
33       : public cpExtensions::QT::QuadSplitter
34     {
35       Q_OBJECT;
36
37     public:
38       typedef cpPlugins::Interface::Interface     TInterface;
39       typedef cpPlugins::Interface::ProcessObject TProcessObject;
40       typedef cpPlugins::Interface::DataObject    TDataObject;
41       typedef cpPlugins::Interface::Image         TImage;
42       typedef cpPlugins::Interface::Mesh          TMesh;
43
44       typedef std::vector< TImage::Pointer > TImages;
45       typedef std::vector< TMesh::Pointer >  TMeshes;
46       typedef std::set< std::string >     TOrderedStringContainer;
47       typedef std::map< std::string, std::set< std::string > > TFilters;
48
49     public:
50       explicit BaseMPRWindow( QWidget* parent = 0 );
51       virtual ~BaseMPRWindow( );
52
53       void DialogLoadPlugins( );
54       void AssociatePluginsToMenu(
55         QMenu* menu, QObject* obj, const char* slot
56         );
57
58       inline void Block( )
59         {
60           QApplication::setOverrideCursor( Qt::WaitCursor );
61           this->setEnabled( false );
62         }
63       inline void Unblock( )
64         {
65           QApplication::restoreOverrideCursor( );
66           this->setEnabled( true );
67         }
68
69       bool LoadPlugins( const std::string& fname );
70       void LoadPlugins( );
71       bool LoadImage( );
72       bool LoadMesh( );
73
74       void ExecuteFilter(
75         const std::string& name,
76         int input_id, int output_id = -1
77         );
78
79       void ClearAll( );
80
81     protected:
82       void _UpdatePlugins( );
83
84     protected:
85       typedef cpExtensions::Visualization::MPRObjects TMPRObjects;
86       vtkSmartPointer< TMPRObjects > m_MPRObjects;
87
88       QVTKWidget* m_XVTK;
89       QVTKWidget* m_YVTK;
90       QVTKWidget* m_ZVTK;
91       QVTKWidget* m_WVTK;
92
93       TInterface m_Interface;
94       TOrderedStringContainer m_LoadedPlugins;
95       std::string m_LastLoadedPlugin;
96
97       TProcessObject::Pointer m_ImageReader;
98       TProcessObject::Pointer m_ImageWriter;
99       TProcessObject::Pointer m_MeshReader;
100       TProcessObject::Pointer m_MeshWriter;
101       TFilters m_Filters;
102
103       TImages m_Images;
104       TMeshes m_Meshes;
105     };
106
107   } // ecapseman
108
109 } // ecapseman
110
111 #endif // cpPlugins_Interface_QT4
112
113 #endif // __CPPLUGINS__INTERFACE__BASEMPRWINDOW__H__
114
115 // eof - $RCSfile$