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