]> Creatis software - bbtk.git/blob - packages/wxvtk/src/bbwxvtkViewer3D.h
#3127 BBTK Feature New Normal - branch changeWx28to30 compilation with wxWidgets3
[bbtk.git] / packages / wxvtk / src / bbwxvtkViewer3D.h
1 /*
2  # ---------------------------------------------------------------------
3  #
4  # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
5  #                        pour la SantÈ)
6  # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
7  # Previous Authors : Laurent Guigues, Jean-Pierre Roux
8  # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
9  #
10  #  This software is governed by the CeCILL-B license under French law and
11  #  abiding by the rules of distribution of free software. You can  use,
12  #  modify and/ or redistribute the software under the terms of the CeCILL-B
13  #  license as circulated by CEA, CNRS and INRIA at the following URL
14  #  http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
15  #  or in the file LICENSE.txt.
16  #
17  #  As a counterpart to the access to the source code and  rights to copy,
18  #  modify and redistribute granted by the license, users are provided only
19  #  with a limited warranty  and the software's author,  the holder of the
20  #  economic rights,  and the successive licensors  have only  limited
21  #  liability.
22  #
23  #  The fact that you are presently reading this means that you have had
24  #  knowledge of the CeCILL-B license and that you accept its terms.
25  # ------------------------------------------------------------------------ */
26
27
28 /*=========================================================================
29                                                                                 
30   Program:   bbtk
31   Module:    $RCSfile: bbwxvtkViewer3D.h,v $
32   Language:  C++
33   Date:      $Date: 2012/11/16 08:52:36 $
34   Version:   $Revision: 1.15 $
35  
36 =========================================================================*//**
37  * \brief Short description in one line
38  * 
39  * Long description which 
40  * can span multiple lines
41  */
42 /**
43  * \file 
44  * \brief Pattern for the definition of a new type of Node (header)
45  */
46 /**
47  * \class bbtk::NodePatern 
48  * \brief Pattern for the definition of a new type of Node 
49  */
50
51
52 #ifdef _USE_WXWIDGETS_
53 #ifdef _USE_VTK_
54
55
56 #ifndef __bbWxViewer3D_h__
57 #define __bbWxViewer3D_h__
58
59 #include <vtkRenderer.h>
60 #include <vtkRenderWindow.h>
61 #include <vtkInteractorStyleTrackballCamera.h>
62
63 #include "bbtkWxBlackBox.h"
64 #include "creawxVTKRenderWindowInteractor.h"
65
66
67
68
69 namespace bbwxvtk
70 {
71   class Viewer3D; 
72   //--------------------------------------------------------------------------
73   class Viewer3DWidget : public wxPanel
74   {
75   public:
76     Viewer3DWidget(Viewer3D* box, wxWindow *parent, bool stereo);
77     ~Viewer3DWidget();
78
79     void Update();
80     vtkRenderer *GetRenderer();
81     crea::wxVTKRenderWindowInteractor * GetInteractor();
82     virtual void Refresh(bool eraseBackground = true, const wxRect* rect = NULL);
83
84   private:
85     Viewer3D                                                    *mBox;
86     vtkRenderer                                 *renderer;
87     vtkRenderWindow                             *renderwindow;
88     vtkInteractorStyleTrackballCamera   *interactorstyle;
89     crea::wxVTKRenderWindowInteractor   *wxvtkrenderwindowinteractor;
90   };
91   
92   //------------------------------------------------------------------------
93   //------------------------------------------------------------------------
94   //------------------------------------------------------------------------
95   
96   class /*BBTK_EXPORT*/ Viewer3D : public bbtk::WxBlackBox
97   {    
98     BBTK_BLACK_BOX_INTERFACE(Viewer3D,bbtk::WxBlackBox);
99     BBTK_DECLARE_INPUT(In1, vtkProp3D *);
100     BBTK_DECLARE_INPUT(In2, vtkProp3D *);
101     BBTK_DECLARE_INPUT(In3, vtkProp3D *);
102     BBTK_DECLARE_INPUT(In4, vtkProp3D *);
103     BBTK_DECLARE_INPUT(In5, vtkProp3D *);
104     BBTK_DECLARE_INPUT(Obs1, vtkInteractorObserver *);
105     BBTK_DECLARE_INPUT(Obs2, vtkInteractorObserver *);
106     BBTK_DECLARE_INPUT(Obs3, vtkInteractorObserver *);
107     BBTK_DECLARE_INPUT(Obs4, vtkInteractorObserver *);
108     BBTK_DECLARE_INPUT(Obs5, vtkInteractorObserver *);
109     BBTK_DECLARE_INPUT(Stereo, bool);
110     BBTK_DECLARE_INPUT(BackgroundColor,std::vector<double>);
111     BBTK_DECLARE_OUTPUT(Renderer,vtkRenderer*);
112     BBTK_DECLARE_OUTPUT(Interactor,crea::wxVTKRenderWindowInteractor*);
113     BBTK_PROCESS(Process);
114     BBTK_CREATE_WIDGET(CreateWidget);
115     BBTK_ON_SHOW_WIDGET(OnShowWidget);
116   
117     void Process();
118     void CreateWidget(wxWindow*);
119     void OnShowWidget();
120
121     void DisableObservers();
122
123   protected:
124     bool firsttime;
125   };
126    
127   //=================================================================
128   // UserBlackBox description
129   BBTK_BEGIN_DESCRIBE_BLACK_BOX(Viewer3D,bbtk::WxBlackBox);
130   BBTK_NAME("Viewer3D");
131   BBTK_AUTHOR("eduardo.davila@creatis.insa-lyon.fr");
132   BBTK_DESCRIPTION("3D Viewer widget (vtk)");
133   BBTK_CATEGORY("viewer");
134   BBTK_INPUT(Viewer3D,BackgroundColor,"Render background's color",std::vector<double>,"");
135   BBTK_INPUT(Viewer3D,In1,"Input actor",vtkProp3D *,"");
136   BBTK_INPUT(Viewer3D,In2,"Input actor",vtkProp3D *,"");
137   BBTK_INPUT(Viewer3D,In3,"Input actor",vtkProp3D *,"");
138   BBTK_INPUT(Viewer3D,In4,"Input actor",vtkProp3D *,"");
139   BBTK_INPUT(Viewer3D,In5,"Input actor",vtkProp3D *,"");
140   BBTK_INPUT(Viewer3D,Obs1,"Input observer",vtkInteractorObserver *,"");
141   BBTK_INPUT(Viewer3D,Obs2,"Input observer",vtkInteractorObserver *,"");
142   BBTK_INPUT(Viewer3D,Obs3,"Input observer",vtkInteractorObserver *,"");
143   BBTK_INPUT(Viewer3D,Obs4,"Input observer",vtkInteractorObserver *,"");
144   BBTK_INPUT(Viewer3D,Obs5,"Input observer",vtkInteractorObserver *,"");
145   BBTK_INPUT(Viewer3D,Stereo,"Stereo with Red-Blue filter.  False/True  (default False)",bool,"");
146   BBTK_OUTPUT(Viewer3D,Renderer,"Renderer to which actors can be added.",vtkRenderer*,"");
147   BBTK_OUTPUT(Viewer3D,Interactor,"Interactor with which vtk widgets can interact",crea::wxVTKRenderWindowInteractor*,"");
148   BBTK_END_DESCRIBE_BLACK_BOX(Viewer3D);
149   //=================================================================
150
151
152 }//namespace bbtk
153
154 #endif  //__bbtkWxViewer3D_h__
155
156 #endif //_USE_VTK_
157 #endif //_USE_WXWIDGETS_
158