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()
46 printf ("EED %p wxGEditorTabPanel 1 ()\n" , this );
49 //=========================================================================
50 wxGEditorTabPanel::wxGEditorTabPanel(wxWindow *parent,int id):wxPanel(parent),wxTextDropTarget()
52 printf ("EED %p wxGEditorTabPanel 2 ()\n" , this );
54 _panelAUIMgr = new wxAuiManager(this);
59 //=========================================================================
60 wxGEditorTabPanel::~wxGEditorTabPanel()
62 printf ("EED %p ~wxGEditorTabPanel()\n" , this );
63 //ED02JUIN2010 _sceneManager->disconnectDrop();
65 _panelsManager->VerifyLastTabPanel();
69 //=========================================================================
70 void wxGEditorTabPanel::initWxVtkCanvas()
72 wxVtk3DBaseView *baseview = new wxVtk3DBaseView(this);
73 baseview->Configure();
74 _sceneManager=new wxVtkSceneManager(this,baseview,_id);
78 printf("RaC-EED 21-06-2010 wxGEditorTabPanel::initWxVtkCanvas Remove the panelAUIMgr, and change to a normal sizer inside the wxGEditorTabPanel\n");
79 _panelAUIMgr->AddPane((wxWindow*)baseview->GetWxVTKRenderWindowInteractor(),wxAuiPaneInfo().Fixed().CenterPane());
81 _panelAUIMgr->Update();
84 //=========================================================================
86 bool wxGEditorTabPanel::OnDropText(wxCoord x, wxCoord y, const wxString& data)
88 std::string packageName="";
89 std::string boxType="";
91 wxString foo( (data) );
93 strcpy( str, (const char*)foo.mb_str(wxConvUTF8) );
97 result = strtok( str, delims );
98 packageName += result;
100 result = strtok( NULL, delims );
103 _sceneManager->createGBlackBox(x,y,packageName, boxType);
108 //=========================================================================
110 void wxGEditorTabPanel::setPanelsManager(wxTabPanelsManager* panelsManager)
112 _panelsManager = panelsManager;
115 //=========================================================================
117 void wxGEditorTabPanel::displayBlackBoxInfo(std::string packageName, std::string boxName)
119 _panelsManager->displayBlackBoxInfo(packageName,boxName);
122 //=========================================================================
124 void wxGEditorTabPanel::updateStatusBar(std::string textStatus)
126 _panelsManager->updateStatusBar(textStatus);
129 //=========================================================================
131 std::string wxGEditorTabPanel::getDiagramBBS(bool wln)
133 return _sceneManager->getDiagramBBS(wln);
136 //=========================================================================
138 std::string wxGEditorTabPanel::saveComplexBoxBBS()
140 return _sceneManager->saveComplexBoxBBS();
143 //=========================================================================
145 void wxGEditorTabPanel::editBlackBox(GBlackBoxModel *bbmodel)
147 _panelsManager->editBlackBox(bbmodel);
150 //=========================================================================
152 void wxGEditorTabPanel::deleteAllBoxes()
154 _sceneManager->deleteAllBoxes();
157 //=========================================================================
159 void wxGEditorTabPanel::centerView()
161 _sceneManager->centerView();
164 //=========================================================================
166 void wxGEditorTabPanel::saveDiagram(std::string &content)
168 _sceneManager->saveDiagram(content);
171 //=========================================================================
173 void wxGEditorTabPanel::loadDiagram(ifstream &inputStream)
175 _sceneManager->loadDiagram(inputStream);
178 //=========================================================================
180 int wxGEditorTabPanel::getPanelId()
185 //=========================================================================
187 bool wxGEditorTabPanel::isComplexBox()
189 return _sceneManager->isComplexBox();
192 //=========================================================================
194 void wxGEditorTabPanel::setComplexBox(bool val)
196 _sceneManager->setComplexBox(val);
199 //=========================================================================
201 void wxGEditorTabPanel::addComplexInputPort(std::string portName)
203 _sceneManager->createGComplexBoxInputPort(portName);
206 //=========================================================================
208 void wxGEditorTabPanel::addComplexOutputPort(std::string portName)
210 _sceneManager->createGComplexBoxOutputPort(portName);
213 //=========================================================================
215 std::map<int,GObjectController*> wxGEditorTabPanel::getSelectedObjects()
217 return _sceneManager->getSelectedObjects();
220 //=========================================================================
222 void wxGEditorTabPanel::addObjects(std::map<int,GObjectController*> objectsMap)
224 _sceneManager->addObjects(objectsMap);
227 //=========================================================================
229 int wxGEditorTabPanel::getNumSelectedObjects()
231 return _sceneManager->getNumSelectedObjects();
234 //=========================================================================
237 wxVtkSceneManager* wxGEditorTabPanel::getSceneManager()
239 return _sceneManager;
242 //=========================================================================
243 std::string wxGEditorTabPanel::GetCbName()
245 return _sceneManager->GetCbName();
249 //=========================================================================
250 std::string wxGEditorTabPanel::GetCbPackageName()
252 return _sceneManager->GetCbPackageName();
255 //=========================================================================
256 std::string wxGEditorTabPanel::GetAuthor()
258 return _sceneManager->GetAuthor();
261 //=========================================================================
262 std::string wxGEditorTabPanel::GetDescription()
264 return _sceneManager->GetDescription();
267 //=========================================================================
268 std::string wxGEditorTabPanel::GetCategory()
270 return _sceneManager->GetCategory();
273 //=========================================================================
274 void wxGEditorTabPanel::SetCbName(std::string cbName)
276 _sceneManager->SetCbName( cbName );
279 //=========================================================================
280 void wxGEditorTabPanel::SetCbPackageName(std::string packagename)
282 _sceneManager->SetCbPackageName( packagename );
286 //=========================================================================
287 void wxGEditorTabPanel::SetAuthor(std::string author)
289 _sceneManager->SetAuthor( author );
293 //=========================================================================
294 void wxGEditorTabPanel::SetCategory(std::string category)
296 _sceneManager->SetCategory( category );
300 //=========================================================================
301 void wxGEditorTabPanel::SetDescription(std::string description)
303 _sceneManager->SetDescription( description );
313 } // EO namespace bbtk