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 * ------------------------------------------------------------------------ */
33 * \brief Class bbtk::wxGEditorTabPanel .
37 #include "wxGEditorTabPanel.h"
43 //=========================================================================
44 wxGEditorTabPanel::wxGEditorTabPanel()
48 //=========================================================================
49 wxGEditorTabPanel::wxGEditorTabPanel(wxWindow *parent,int id):wxPanel(parent),wxTextDropTarget()
52 _panelAUIMgr = new wxAuiManager(this);
57 //=========================================================================
58 wxGEditorTabPanel::~wxGEditorTabPanel()
60 _sceneManager->disconnectDrop();
63 //=========================================================================
64 void wxGEditorTabPanel::initWxVtkCanvas()
66 wxVtk3DBaseView *baseview = new wxVtk3DBaseView(this);
67 baseview->Configure();
69 _sceneManager=new wxVtkSceneManager(this,baseview,_id);
71 _panelAUIMgr->AddPane((wxWindow*)baseview->GetWxVTKRenderWindowInteractor(),wxAuiPaneInfo().Fixed().CenterPane());
72 _panelAUIMgr->Update();
75 //=========================================================================
77 bool wxGEditorTabPanel::OnDropText(wxCoord x, wxCoord y, const wxString& data)
79 std::string packageName="";
80 std::string boxName="";
82 wxString foo( (data) );
84 strcpy( str, (const char*)foo.mb_str(wxConvUTF8) );
88 result = strtok( str, delims );
89 packageName += result;
91 result = strtok( NULL, delims );
94 _sceneManager->createGBlackBox(x,y,packageName, boxName);
99 //=========================================================================
101 void wxGEditorTabPanel::setPanelsManager(wxTabPanelsManager* panelsManager)
103 _panelsManager = panelsManager;
106 //=========================================================================
108 void wxGEditorTabPanel::displayBlackBoxInfo(std::string packageName, std::string boxName)
110 _panelsManager->displayBlackBoxInfo(packageName,boxName);
113 //=========================================================================
115 void wxGEditorTabPanel::updateStatusBar(std::string textStatus)
117 _panelsManager->updateStatusBar(textStatus);
120 //=========================================================================
122 std::string wxGEditorTabPanel::getDiagramBBS()
124 return _sceneManager->getDiagramBBS();
127 //=========================================================================
129 std::string wxGEditorTabPanel::saveComplexBoxBBS(std::string cbName,std::string cbAuthor,std::string cbCategory,std::string cbDescription)
131 return _sceneManager->saveComplexBoxBBS(cbName,cbAuthor,cbCategory,cbDescription);
134 //=========================================================================
136 void wxGEditorTabPanel::editBlackBox(GBlackBoxModel *bbmodel)
138 _panelsManager->editBlackBox(bbmodel);
141 //=========================================================================
143 void wxGEditorTabPanel::editDiagramParameters(wxVtkSceneManager* scene)
145 _panelsManager->editDiagramParameters(scene);
148 //=========================================================================
150 void wxGEditorTabPanel::deleteAllBoxes()
152 _sceneManager->deleteAllBoxes();
155 //=========================================================================
157 void wxGEditorTabPanel::centerView()
159 _sceneManager->centerView();
162 //=========================================================================
164 void wxGEditorTabPanel::saveDiagram(std::string &content)
166 _sceneManager->saveDiagram(content);
169 //=========================================================================
171 void wxGEditorTabPanel::loadDiagram(ifstream &inputStream)
173 _sceneManager->loadDiagram(inputStream);
176 //=========================================================================
178 int wxGEditorTabPanel::getPanelId()
183 //=========================================================================
185 bool wxGEditorTabPanel::isComplexBox()
187 return _sceneManager->isComplexBox();
190 //=========================================================================
192 void wxGEditorTabPanel::setComplexBox(bool val)
194 _sceneManager->setComplexBox(val);
197 //=========================================================================
199 void wxGEditorTabPanel::addComplexInputPort(std::string portName)
201 _sceneManager->createGComplexBoxInputPort(portName);
204 //=========================================================================
206 void wxGEditorTabPanel::addComplexOutputPort(std::string portName)
208 _sceneManager->createGComplexBoxOutputPort(portName);
211 //=========================================================================
213 std::map<int,GObjectController*> wxGEditorTabPanel::getSelectedObjects()
215 return _sceneManager->getSelectedObjects();
218 //=========================================================================
220 void wxGEditorTabPanel::addObjects(std::map<int,GObjectController*> objectsMap)
222 _sceneManager->addObjects(objectsMap);
225 //=========================================================================
227 int wxGEditorTabPanel::getNumSelectedObjects()
229 return _sceneManager->getNumSelectedObjects();
232 //=========================================================================
234 } // EO namespace bbtk