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 "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"
59 #include <bbtkBlackBoxInputDescriptor.h>
60 #include <bbtkBlackBoxDescriptor.h>
62 //Includes creaMaracasVisu
63 #include <wxVtk3DBaseView.h>
64 #include <InteractorStyleMaracas.h>
65 #include <vtkInteractorStyleBaseView2D.h>
66 #include <manualContourControler.h>
67 #include <manualContourModel.h>
70 #include <vtkRenderWindow.h>
71 #include <vtkRenderWindowInteractor.h>
72 #include <vtkRenderer.h>
73 #include <vtkInteractorStyleImage.h>
83 class wxGEditorTabPanel;
85 class wxVtkSceneManager : public InteractorStyleMaracas , public Observer
88 wxVtkSceneManager(wxGEditorTabPanel *parent, wxVtk3DBaseView *baseView, int idManager);
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);
98 void registerController(InteractorStyleMaracas *param);
99 void unregisterController(InteractorStyleMaracas *param);
101 vtkRenderWindow* getRenderWindow();
102 vtkRenderer* getRenderer();
104 void disconnectDrop();
106 virtual bool OnChar();
107 virtual bool OnMouseMove();
108 virtual bool OnLeftButtonDown();
109 virtual bool OnLeftButtonUp();
110 virtual bool OnRightButtonUp();
111 virtual bool OnLeftDClick();
113 virtual void update(int idController,int command);
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);
125 std::vector<int> getBoxes();
126 std::vector<int> getConnections();
131 wxGEditorTabPanel *_parent;
133 // Id of the manager, the same of the panel
136 // Boxes number in the scene
142 wxVtk3DBaseView *_baseView;
146 std::map<int,GObjectController*> _controllers;
148 //Saves the id's of the selected objects in the controllers map
149 std::vector<int> _selectedObjects;