]> Creatis software - bbtkGEditor.git/blob - lib/EditorGraphicBBS/bbsKernelEditorGraphic/wxVtkSceneManager.h
Chango from GConnectorView to vtkGConnectorView ... The historique will be lost,...
[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 "vtkGConnectorView.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                 int createGBlackBox(int x, int y,std::string packageName, std::string boxType);
93                 GPortController* createGPort(int portType, std::string bbtkName, std::string bbtkType, int posinBox,GBlackBoxModel *blackBox);
94                 int createGInputPort(int portType, int posinBox,GBlackBoxModel *blackBox, BlackBoxInputDescriptor *desc);
95                 int createGOutputPort(int portType, int posinBox,GBlackBoxModel *blackBox, BlackBoxOutputDescriptor *desc);
96                 int createGConnector(GPortModel* startPort);
97
98                 void registerController(InteractorStyleMaracas *param);
99                 void unregisterController(InteractorStyleMaracas *param);
100
101                 vtkRenderWindow* getRenderWindow();
102                 vtkRenderer* getRenderer();
103
104                 void disconnectDrop();
105                 
106                 virtual bool OnChar();
107                 virtual bool OnMouseMove();
108                 virtual bool  OnLeftButtonDown(); 
109                 virtual bool  OnLeftButtonUp();
110                 virtual bool OnRightButtonUp();
111                 virtual bool OnLeftDClick();
112
113                 virtual void update(int idController,int command);
114
115                 void displayBlackBoxInfo(std::string packageName, std::string boxName);
116                 void updateStatusBar(std::string textStatus);
117                 std::string getDiagramScript();
118                 void deleteObject(int id);
119                 void deleteAllBoxes();
120                 void saveDiagram(std::string &content);
121                 void loadDiagram(ifstream &inputStream);
122                 void centerView();
123
124                 void refreshScene();
125                 std::vector<int> getBoxes();
126                 std::vector<int> getConnections();
127
128                 
129         private:
130
131                 wxGEditorTabPanel *_parent;
132
133                 // Id of the manager, the same of the panel
134                 int _idManager;
135
136                 // Boxes number in the scene
137                 int _numBoxes;
138
139                 // StartDragging
140                 bool _startDragging;
141
142                 wxVtk3DBaseView *_baseView;
143
144                 int _worldState;
145
146                 std::map<int,GObjectController*> _controllers;
147
148                 //Saves the id's of the selected objects in the controllers map
149                 std::vector<int> _selectedObjects;
150
151         protected:
152
153         };
154
155
156 }
157 // namespace bbtk
158 #endif
159