1 /*=========================================================================
7 =========================================================================*/
9 /* ---------------------------------------------------------------------
11 * Copyright (c) CREATIS-LRMN (Centre de Recherche en Imagerie Medicale)
12 * Authors : Eduardo Davila, Laurent Guigues, Jean-Pierre Roux
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.
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
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 * ------------------------------------------------------------------------ */
35 * \brief Class bbtk::BlackBox : abstract black-box interface.
39 * \class bbtk::wxVtkSceneManager
43 #ifndef __wxVtkSceneManager_h__
44 #define __wxVtkSceneManager_h__
46 //Includes same project
47 #include "GObjectsMVCFactory.h"
49 #include "GBoxModel.h"
50 #include "GComplexBoxPortModel.h"
51 #include "GPortModel.h"
52 #include "vtkGConnectorView.h"
53 #include "GConnectorModel.h"
54 #include "GConnectorController.h"
55 #include "vtkGPortView.h"
56 #include "manualConnectorContourView.h"
57 #include "manualConnectorContourController.h"
58 #include "wxGEditorTabPanel.h"
61 #include <bbtkBlackBoxInputDescriptor.h>
62 #include <bbtkBlackBoxDescriptor.h>
64 //Includes creaMaracasVisu
65 #include <wxVtk3DBaseView.h>
66 #include <InteractorStyleMaracas.h>
67 #include <vtkInteractorStyleBaseView2D.h>
68 #include <manualContourControler.h>
69 #include <manualContourModel.h>
72 #include <vtkRenderWindow.h>
73 #include <vtkRenderWindowInteractor.h>
74 #include <vtkRenderer.h>
75 #include <vtkInteractorStyleImage.h>
85 class wxGEditorTabPanel;
87 class wxVtkSceneManager : public InteractorStyleMaracas , public Observer
90 wxVtkSceneManager(wxGEditorTabPanel *parent, wxVtk3DBaseView *baseView, int idManager);
93 void configureBaseView();
94 int createGBlackBox(int x, int y,std::string packageName, std::string boxType);
95 int createGComplexBoxInputPort(std::string inputName);
96 int createGComplexBoxOutputPort(std::string outputName);
97 GPortController* createGPort(int portType, std::string bbtkName, std::string bbtkType, int posinBox,GBoxModel *blackBox);
98 int createGInputPort(int portType, int posinBox,GBoxModel *blackBox, BlackBoxInputDescriptor *desc);
99 int createGOutputPort(int portType, int posinBox,GBoxModel *blackBox, BlackBoxOutputDescriptor *desc);
100 int createGConnector(GPortModel* startPort);
102 void registerController(InteractorStyleMaracas *param);
103 void unregisterController(InteractorStyleMaracas *param);
105 vtkRenderWindow* getRenderWindow();
106 vtkRenderer* getRenderer();
108 void disconnectDrop();
110 virtual bool OnChar();
111 virtual bool OnMouseMove();
112 virtual bool OnLeftButtonDown();
113 virtual bool OnLeftButtonUp();
114 virtual bool OnRightButtonUp();
115 virtual bool OnLeftDClick();
117 virtual void update(int idController,int command);
119 void displayBlackBoxInfo(std::string packageName, std::string boxName);
120 void updateStatusBar(std::string textStatus);
121 std::string getDiagramBBS();
122 std::string saveComplexBoxBBS(std::string cbName,std::string cbAuthor="",std::string cbCategory="",std::string cbDescription="");
123 void deleteObject(int id);
124 void deleteAllBoxes();
125 void saveDiagram(std::string &content);
126 void loadDiagram(ifstream &inputStream);
130 std::vector<int> getBlackBoxes();
131 std::vector<int> getConnections();
132 std::vector<int> getComplexInputPorts();
133 std::vector<int> getComplexOutputPorts();
135 std::map<int,GObjectController*> getSelectedObjects();
136 int getNumSelectedObjects();
139 void setComplexBox(bool val);
141 int addObjectController(GObjectController* objController);
142 void addObjects(std::map<int,GObjectController*> objectsMap);
147 wxGEditorTabPanel *_parent;
149 // Id of the manager, the same of the panel
152 // Boxes number in the scene
158 wxVtk3DBaseView *_baseView;
162 std::map<int,GObjectController*> _controllers;
164 //Saves the id's of the selected objects in the controllers map
165 std::vector<int> _selectedObjects;