]> Creatis software - bbtkGEditor.git/blob - lib/EditorGraphicBBS/bbsKernelEditorGraphic/wxVtkSceneManager.h
c6f7a6b11468719bec613bf3d7e03722b71d654b
[bbtkGEditor.git] / lib / EditorGraphicBBS / bbsKernelEditorGraphic / wxVtkSceneManager.h
1 /*=========================================================================                                                                               
2 Program:   bbtk
3 Module:    $RCSfile$
4 Language:  C++
5 Date:      $Date$
6 Version:   $Revision$
7 =========================================================================*/
8
9 /* ---------------------------------------------------------------------
10
11 * Copyright (c) CREATIS-LRMN (Centre de Recherche en Imagerie Medicale)
12 * Authors : Eduardo Davila, Laurent Guigues, Jean-Pierre Roux
13 *
14 *  This software is governed by the CeCILL-B license under French law and 
15 *  abiding by the rules of distribution of free software. You can  use, 
16 *  modify and/ or redistribute the software under the terms of the CeCILL-B 
17 *  license as circulated by CEA, CNRS and INRIA at the following URL 
18 *  http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 
19 *  or in the file LICENSE.txt.
20 *
21 *  As a counterpart to the access to the source code and  rights to copy,
22 *  modify and redistribute granted by the license, users are provided only
23 *  with a limited warranty  and the software's author,  the holder of the
24 *  economic rights,  and the successive licensors  have only  limited
25 *  liability. 
26 *
27 *  The fact that you are presently reading this means that you have had
28 *  knowledge of the CeCILL-B license and that you accept its terms.
29 * ------------------------------------------------------------------------ */                                                                         
30
31
32
33 /**
34 *  \file 
35 *  \brief Class bbtk::BlackBox : abstract black-box interface. 
36 */
37
38 /**
39 * \class bbtk::wxVtkSceneManager
40 * \brief 
41 */
42
43 #ifndef __wxVtkSceneManager_h__
44 #define __wxVtkSceneManager_h__
45
46 //Includes same project
47 #include "GObjectsMVCFactory.h"
48 #include "Observer.h"
49 #include "GPortModel.h"
50 #include "GConnectorView.h"
51 #include "GConnectorModel.h"
52 #include "GConnectorController.h"
53 #include "vtkGPortView.h"
54 #include "manualConnectorContourView.h"
55 #include "manualConnectorContourController.h"
56 #include "wxGEditorTabPanel.h"
57
58 //Includes bbtk
59 #include <bbtkBlackBoxInputDescriptor.h>
60 #include <bbtkBlackBoxDescriptor.h>
61
62 //Includes creaMaracasVisu
63 #include <wxVtk3DBaseView.h>
64 #include <InteractorStyleMaracas.h>
65 #include <vtkInteractorStyleBaseView2D.h>
66 #include <manualContourControler.h>
67 #include <manualContourModel.h>
68
69 //Includes vtk
70 #include <vtkRenderWindow.h>
71 #include <vtkRenderWindowInteractor.h>
72 #include <vtkRenderer.h>
73 #include <vtkInteractorStyleImage.h>
74
75
76 //Includes std
77 #include <iostream>
78 #include <map>
79
80
81 namespace bbtk
82 {
83         class wxGEditorTabPanel;
84
85         class wxVtkSceneManager : public InteractorStyleMaracas , public Observer
86         {
87         public: 
88                 wxVtkSceneManager(wxGEditorTabPanel *parent, wxVtk3DBaseView *baseView, int idManager);
89                 ~wxVtkSceneManager();
90
91                 void configureBaseView();
92                 void createGBlackBox(int x, int y,std::string packageName, std::string boxName);
93                 void createGPort(int portType, int posinBox,GBlackBoxModel *blackBox);
94                 void createGInputPort(int portType, int posinBox,GBlackBoxModel *blackBox, BlackBoxInputDescriptor *desc);
95                 void createGOutputPort(int portType, int posinBox,GBlackBoxModel *blackBox, BlackBoxOutputDescriptor *desc);
96                 void createGConnector(GPortModel* startPort);
97
98                 void registerController(InteractorStyleMaracas *param);
99
100                 vtkRenderWindow* getRenderWindow();
101                 vtkRenderer* getRenderer();
102
103                 void disconnectDrop();
104                 
105                 virtual bool OnMouseMove();
106                 virtual bool  OnLeftButtonDown(); 
107                 virtual bool  OnLeftButtonUp();
108                 virtual bool OnRightButtonUp();
109
110                 virtual void update(int idController,int command);
111
112                 void displayBlackBoxInfo(std::string packageName, std::string boxName);
113                 
114         private:
115
116                 wxGEditorTabPanel *_parent;
117
118                 // Last controller created
119                 int _idLastController;
120
121                 // Id of the manager, the same of the panel
122                 int _idManager;
123
124                 // Boxes number in the scene
125                 int _numBoxes;
126
127                 // StartDragging
128                 bool _startDragging;
129
130                 wxVtk3DBaseView *_baseView;
131
132                 int _worldState;
133
134                 std::map<int,GObjectController*> _controllers;
135
136                 //Saves the id's of the selected objects in the controllers map
137                 std::vector<int> _selectedObjects;
138
139         protected:
140
141         };
142
143
144 }
145 // namespace bbtk
146 #endif
147