]> Creatis software - bbtk.git/blob - packages/wxvtk/src/bbwxvtkViewer3D.h
1.6
[bbtk.git] / packages / wxvtk / src / bbwxvtkViewer3D.h
1 /*=========================================================================
2                                                                                 
3   Program:   bbtk
4   Module:    $RCSfile: bbwxvtkViewer3D.h,v $
5   Language:  C++
6   Date:      $Date: 2009/05/28 08:12:18 $
7   Version:   $Revision: 1.14 $
8                                                                                 
9   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
10   l'Image). All rights reserved. See Doc/License.txt or
11   http://www.creatis.insa-lyon.fr/Public/bbtk/License.html for details.
12                                                                                 
13      This software is distributed WITHOUT ANY WARRANTY; without even
14      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15      PURPOSE.  See the above copyright notices for more information.
16                                                                                 
17 =========================================================================*//**
18  * \brief Short description in one line
19  * 
20  * Long description which 
21  * can span multiple lines
22  */
23 /**
24  * \file 
25  * \brief Pattern for the definition of a new type of Node (header)
26  */
27 /**
28  * \class bbtk::NodePatern 
29  * \brief Pattern for the definition of a new type of Node 
30  */
31
32
33 #ifdef _USE_WXWIDGETS_
34 #ifdef _USE_VTK_
35
36
37 #ifndef __bbWxViewer3D_h__
38 #define __bbWxViewer3D_h__
39
40 #include <vtkRenderer.h>
41 #include <vtkRenderWindow.h>
42 #include <vtkInteractorStyleTrackballCamera.h>
43
44 #include "bbtkWxBlackBox.h"
45 #include "wxVTKRenderWindowInteractor.h"
46
47
48
49
50 namespace bbwxvtk
51 {
52   class Viewer3D; 
53   //--------------------------------------------------------------------------
54   class Viewer3DWidget : public wxPanel
55   {
56   public:
57     Viewer3DWidget(Viewer3D* box, wxWindow *parent, bool stereo);
58     ~Viewer3DWidget();
59
60     void Update();
61     vtkRenderer *GetRenderer();
62     wxVTKRenderWindowInteractor * GetInteractor();
63     virtual void Refresh(bool eraseBackground = true, const wxRect* rect = NULL);
64
65   private:
66     Viewer3D*            mBox;
67     vtkRenderer                  *renderer;
68     vtkRenderWindow              *renderwindow;
69     vtkInteractorStyleTrackballCamera *interactorstyle;
70     wxVTKRenderWindowInteractor  *wxvtkrenderwindowinteractor;
71   };
72   
73   //------------------------------------------------------------------------
74   //------------------------------------------------------------------------
75   //------------------------------------------------------------------------
76   
77   class /*BBTK_EXPORT*/ Viewer3D : public bbtk::WxBlackBox
78   {    
79     BBTK_BLACK_BOX_INTERFACE(Viewer3D,bbtk::WxBlackBox);
80     BBTK_DECLARE_INPUT(In1, vtkProp3D *);
81     BBTK_DECLARE_INPUT(In2, vtkProp3D *);
82     BBTK_DECLARE_INPUT(In3, vtkProp3D *);
83     BBTK_DECLARE_INPUT(In4, vtkProp3D *);
84     BBTK_DECLARE_INPUT(In5, vtkProp3D *);
85     BBTK_DECLARE_INPUT(Obs1, vtkInteractorObserver *);
86     BBTK_DECLARE_INPUT(Obs2, vtkInteractorObserver *);
87     BBTK_DECLARE_INPUT(Obs3, vtkInteractorObserver *);
88     BBTK_DECLARE_INPUT(Obs4, vtkInteractorObserver *);
89     BBTK_DECLARE_INPUT(Obs5, vtkInteractorObserver *);
90     BBTK_DECLARE_INPUT(Stereo, bool);
91     BBTK_DECLARE_OUTPUT(Renderer,vtkRenderer*);
92     BBTK_DECLARE_OUTPUT(Interactor,wxVTKRenderWindowInteractor*);
93     BBTK_PROCESS(Process);
94     BBTK_CREATE_WIDGET(CreateWidget);
95     BBTK_ON_SHOW_WIDGET(OnShowWidget);
96   
97     void Process();
98     void CreateWidget(wxWindow*);
99     void OnShowWidget();
100
101     void DisableObservers();
102
103   protected:
104     bool firsttime;
105   };
106    
107   //=================================================================
108   // UserBlackBox description
109   BBTK_BEGIN_DESCRIBE_BLACK_BOX(Viewer3D,bbtk::WxBlackBox);
110   BBTK_NAME("Viewer3D");
111   BBTK_AUTHOR("eduardo.davila@creatis.insa-lyon.fr");
112   BBTK_DESCRIPTION("3D Viewer widget (vtk)");
113   BBTK_CATEGORY("viewer");
114   BBTK_INPUT(Viewer3D,In1,"Input actor",vtkProp3D *,"");
115   BBTK_INPUT(Viewer3D,In2,"Input actor",vtkProp3D *,"");
116   BBTK_INPUT(Viewer3D,In3,"Input actor",vtkProp3D *,"");
117   BBTK_INPUT(Viewer3D,In4,"Input actor",vtkProp3D *,"");
118   BBTK_INPUT(Viewer3D,In5,"Input actor",vtkProp3D *,"");
119   BBTK_INPUT(Viewer3D,Obs1,"Input observer",vtkInteractorObserver *,"");
120   BBTK_INPUT(Viewer3D,Obs2,"Input observer",vtkInteractorObserver *,"");
121   BBTK_INPUT(Viewer3D,Obs3,"Input observer",vtkInteractorObserver *,"");
122   BBTK_INPUT(Viewer3D,Obs4,"Input observer",vtkInteractorObserver *,"");
123   BBTK_INPUT(Viewer3D,Obs5,"Input observer",vtkInteractorObserver *,"");
124   BBTK_INPUT(Viewer3D,Stereo,"Stereo with Red-Blue filter.  False/True  (default False)",bool,"");
125   BBTK_OUTPUT(Viewer3D,Renderer,"Renderer to which actors can be added.",vtkRenderer*,"");
126   BBTK_OUTPUT(Viewer3D,Interactor,"Interactor with which vtk widgets can interact",wxVTKRenderWindowInteractor*,"");
127   BBTK_END_DESCRIBE_BLACK_BOX(Viewer3D);
128   //=================================================================
129
130
131 }//namespace bbtk
132
133 #endif  //__bbtkWxViewer3D_h__
134
135 #endif //_USE_VTK_
136 #endif //_USE_WXWIDGETS_
137