]> Creatis software - cpPlugins.git/blob - lib/cpExtensions/QT/RendererWidget.h
2a5b145f2b3502896347293995d068a7fece07bb
[cpPlugins.git] / lib / cpExtensions / QT / RendererWidget.h
1 #ifndef __cpExtensions__QT__RendererWidget__h__
2 #define __cpExtensions__QT__RendererWidget__h__
3
4 #include <cpExtensions/Config.h>
5 #include <cpExtensions/QT/ActorsWidgetInterface.h>
6 #include <vtkSmartPointer.h>
7 #include <map>
8 #include <set>
9 #include <string>
10
11 // -------------------------------------------------------------------------
12 class vtkCamera;
13 class vtkInteractorStyle;
14 class vtkOrientationMarkerWidget;
15 class vtkProp;
16 class vtkPropCollection;
17
18 // -------------------------------------------------------------------------
19 namespace cpExtensions
20 {
21   namespace Visualization
22   {
23     class LUTImageActor;
24     class WindowLevelImageActor;
25   }
26
27   namespace QT
28   {
29     /**
30      */
31     class cpExtensions_EXPORT RendererWidget
32       : public cpExtensions_QVTKWidget,
33         public ActorsWidgetInterface
34     {
35       Q_OBJECT;
36     public:
37       typedef RendererWidget          Self;
38       typedef cpExtensions_QVTKWidget Superclass;
39       typedef ActorsWidgetInterface   Superclass2;
40
41       typedef std::set< vtkSmartPointer< vtkProp > > TProps;
42       typedef std::map< std::string, TProps >        TPropCollection;
43
44       typedef cpExtensions::Visualization::LUTImageActor         TLUTActor;
45       typedef cpExtensions::Visualization::WindowLevelImageActor TWLActor;
46
47     public:
48       explicit RendererWidget(
49         QWidget* parent = NULL, Qt::WindowFlags f = 0
50         );
51       virtual ~RendererWidget( );
52
53       int GetQuadrant( ) const;
54       void SetQuadrant( int q );
55
56       vtkRenderer* GetRenderer( );
57       const vtkRenderer* GetRenderer( ) const;
58
59       vtkInteractorStyle* GetStyle( );
60       const vtkInteractorStyle* GetStyle( ) const;
61       void SetStyle( vtkInteractorStyle* style );
62
63       vtkCamera* GetActiveCamera( );
64       const vtkCamera* GetActiveCamera( ) const;
65
66       void AddViewProp( vtkProp* prop, const std::string& name = "" );
67       void AddViewProps(
68         vtkPropCollection* props, const std::string& name = ""
69         );
70       void AddAuxViewProp( vtkProp* prop, const std::string& name = "" );
71       void AddAuxViewProps(
72         vtkPropCollection* props, const std::string& name = ""
73         );
74
75       TProps& GetViewProps( const std::string& name );
76       const TProps& GetViewProps( const std::string& name ) const;
77       TProps& GetAuxViewProps( const std::string& name );
78       const TProps& GetAuxViewProps( const std::string& name ) const;
79
80       void RemoveViewProps( const std::string& name );
81       void RemoveViewProps( );
82
83       virtual void HideViewProps( const std::string& name );
84       virtual void ShowViewProps( const std::string& name );
85
86       virtual void ResetCamera( );
87       virtual void Render( );
88
89       virtual std::set< vtkRenderWindowInteractor* > GetInteractors( ) const cpExtensions_OVERRIDE;
90       virtual std::set< std::string > GetActorsNames( ) const cpExtensions_OVERRIDE;
91       virtual bool IsWindowLevelImageActor( const std::string& name ) const cpExtensions_OVERRIDE;
92       virtual bool IsLUTImageActor( const std::string& name ) const cpExtensions_OVERRIDE;
93       virtual bool Is3DActor( const std::string& name ) const cpExtensions_OVERRIDE;
94
95       virtual void GetScalarRange( const std::string& name, double r[ 2 ] ) const cpExtensions_OVERRIDE;
96       virtual void GetWindowLevel( const std::string& name, double wl[ 2 ] ) const cpExtensions_OVERRIDE;
97       virtual double GetWindow( const std::string& name ) const cpExtensions_OVERRIDE;
98       virtual double GetLevel( const std::string& name ) const cpExtensions_OVERRIDE;
99       virtual char GetImageInterpolation( const std::string& name ) const cpExtensions_OVERRIDE;
100
101       virtual void GetColor( const std::string& name, double& r, double& g, double& b ) const cpExtensions_OVERRIDE;
102       virtual double GetOpacity( const std::string& name ) const cpExtensions_OVERRIDE;
103       virtual double GetPointSize( const std::string& name ) const cpExtensions_OVERRIDE;
104       virtual double GetLineWidth( const std::string& name ) const cpExtensions_OVERRIDE;
105       virtual int GetRepresentation( const std::string& name ) const cpExtensions_OVERRIDE;
106
107       virtual void SetScalarRange( const std::string& name, double r[ 2 ] ) cpExtensions_OVERRIDE;
108       virtual void SetScalarRange( const std::string& name, double min, double max ) cpExtensions_OVERRIDE;
109       virtual void SetWindowLevel( const std::string& name, double wl[ 2 ] ) cpExtensions_OVERRIDE;
110       virtual void SetWindowLevel( const std::string& name, double w, double l ) cpExtensions_OVERRIDE;
111       virtual void SetWindow( const std::string& name, double w ) cpExtensions_OVERRIDE;
112       virtual void SetLevel( const std::string& name, double l ) cpExtensions_OVERRIDE;
113       virtual void SetImageInterpolation( const std::string& name, char i ) cpExtensions_OVERRIDE;
114
115       virtual void SetColor( const std::string& name, double r, double g, double b ) cpExtensions_OVERRIDE;
116       virtual void SetOpacity( const std::string& name, double o ) cpExtensions_OVERRIDE;
117       virtual void SetPointSize( const std::string& name, double s ) cpExtensions_OVERRIDE;
118       virtual void SetLineWidth( const std::string& name, double w ) cpExtensions_OVERRIDE;
119       virtual void SetRepresentationToPoints( const std::string& name ) cpExtensions_OVERRIDE;
120       virtual void SetRepresentationToSurface( const std::string& name ) cpExtensions_OVERRIDE;
121       virtual void SetRepresentationToWireframe( const std::string& name ) cpExtensions_OVERRIDE;
122
123     protected:
124       vtkSmartPointer< vtkRenderer >                m_Renderer;
125       vtkSmartPointer< vtkOrientationMarkerWidget > m_Marker;
126       int m_Quadrant;
127
128       TPropCollection m_ViewProps;
129       TPropCollection m_AuxViewProps;
130     };
131
132   } // ecapseman
133
134 } // ecapseman
135
136 #endif // __cpExtensions__QT__RendererWidget__h__
137
138 // eof - $RCSfile$