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 wxGEditorTabPanel::wxGEditorTabPanel 0\n");
53 printf ("EED %p wxGEditorTabPanel 2 ()\n" , this );
55 _panelAUIMgr = new wxAuiManager(this);
58 printf("EED wxGEditorTabPanel::wxGEditorTabPanel 1\n");
61 //=========================================================================
62 wxGEditorTabPanel::~wxGEditorTabPanel()
64 printf ("EED %p ~wxGEditorTabPanel()\n" , this );
65 //ED02JUIN2010 _sceneManager->disconnectDrop();
67 _panelsManager->VerifyLastTabPanel();
74 //=========================================================================
75 void wxGEditorTabPanel::initWxVtkCanvas()
77 printf("EED wxGEditorTabPanel::initWxVtkCanvas 0\n");
78 wxVtk3DBaseView *baseview = new wxVtk3DBaseView(this);
79 baseview->Configure();
80 _sceneManager=new wxVtkSceneManager(this,baseview,_id);
84 printf("RaC-EED 21-06-2010 wxGEditorTabPanel::initWxVtkCanvas Remove the panelAUIMgr, and change to a normal sizer inside the wxGEditorTabPanel\n");
85 _panelAUIMgr->AddPane((wxWindow*)baseview->GetWxVTKRenderWindowInteractor(),wxAuiPaneInfo().Fixed().CenterPane());
87 _panelAUIMgr->Update();
88 printf("EED wxGEditorTabPanel::initWxVtkCanvas 1\n");
91 //=========================================================================
93 bool wxGEditorTabPanel::OnDropText(wxCoord x, wxCoord y, const wxString& data)
95 std::string packageName="";
96 std::string boxType="";
98 wxString foo( (data) );
100 strcpy( str, (const char*)foo.mb_str(wxConvUTF8) );
104 result = strtok( str, delims );
105 packageName += result;
107 result = strtok( NULL, delims );
110 _sceneManager->createGBlackBox(x,y,packageName, boxType);
115 //=========================================================================
117 void wxGEditorTabPanel::setPanelsManager(wxTabPanelsManager* panelsManager)
119 _panelsManager = panelsManager;
122 //=========================================================================
124 void wxGEditorTabPanel::displayBlackBoxInfo(std::string packageName, std::string boxName)
126 _panelsManager->displayBlackBoxInfo(packageName,boxName);
129 //=========================================================================
131 void wxGEditorTabPanel::updateStatusBar(std::string textStatus)
133 _panelsManager->updateStatusBar(textStatus);
136 //=========================================================================
138 std::string wxGEditorTabPanel::getDiagramBBS(bool wln)
140 return _sceneManager->getDiagramBBS(wln);
143 //=========================================================================
145 std::string wxGEditorTabPanel::saveComplexBoxBBS()
147 return _sceneManager->saveComplexBoxBBS();
150 //=========================================================================
152 void wxGEditorTabPanel::editBlackBox(GBlackBoxModel *bbmodel)
154 _panelsManager->editBlackBox(bbmodel);
157 //=========================================================================
159 void wxGEditorTabPanel::deleteAllBoxes()
161 _sceneManager->deleteAllBoxes();
164 //=========================================================================
166 void wxGEditorTabPanel::centerView()
170 _sceneManager->centerView();
174 //=========================================================================
176 void wxGEditorTabPanel::saveDiagram(std::string &content, const std::string &path) //DFCH
178 this->SetFullPath(path);
179 _sceneManager->saveDiagram(content);
182 //=========================================================================
184 void wxGEditorTabPanel::loadDiagram(ifstream &inputStream, const std::string &path) //DFCH
186 this->SetFullPath(path);
187 _sceneManager->loadDiagram(inputStream);
190 //=========================================================================
192 int wxGEditorTabPanel::getPanelId()
197 //=========================================================================
199 bool wxGEditorTabPanel::isComplexBox()
201 return _sceneManager->isComplexBox();
204 //=========================================================================
206 void wxGEditorTabPanel::setComplexBox(bool val)
208 _sceneManager->setComplexBox(val);
211 //=========================================================================
213 void wxGEditorTabPanel::addComplexInputPort(std::string portName)
215 _sceneManager->createGComplexBoxInputPort(portName);
218 //=========================================================================
220 void wxGEditorTabPanel::addComplexOutputPort(std::string portName)
222 _sceneManager->createGComplexBoxOutputPort(portName);
225 //=========================================================================
227 std::map<int,GObjectController*> wxGEditorTabPanel::getSelectedObjects()
229 return _sceneManager->getSelectedObjects();
232 //=========================================================================
234 void wxGEditorTabPanel::addObjects(std::map<int,GObjectController*> objectsMap)
236 _sceneManager->addObjects(objectsMap);
239 //=========================================================================
241 int wxGEditorTabPanel::getNumSelectedObjects()
243 return _sceneManager->getNumSelectedObjects();
246 //=========================================================================
249 wxVtkSceneManager* wxGEditorTabPanel::getSceneManager()
251 return _sceneManager;
254 //=========================================================================
255 std::string wxGEditorTabPanel::GetCbName()
257 return _sceneManager->GetCbName();
261 //=========================================================================
262 std::string wxGEditorTabPanel::GetCbPackageName()
264 return _sceneManager->GetCbPackageName();
267 //=========================================================================
268 std::string wxGEditorTabPanel::GetAuthor()
270 return _sceneManager->GetAuthor();
273 //=========================================================================
274 std::string wxGEditorTabPanel::GetDescription()
276 return _sceneManager->GetDescription();
279 //=========================================================================
280 std::string wxGEditorTabPanel::GetCategory()
282 return _sceneManager->GetCategory();
285 //=========================================================================
286 void wxGEditorTabPanel::SetCbName(std::string cbName)
288 _sceneManager->SetCbName( cbName );
291 //=========================================================================
292 void wxGEditorTabPanel::SetCbPackageName(std::string packagename)
294 _sceneManager->SetCbPackageName( packagename );
298 //=========================================================================
299 void wxGEditorTabPanel::SetAuthor(std::string author)
301 _sceneManager->SetAuthor( author );
305 //=========================================================================
306 void wxGEditorTabPanel::SetCategory(std::string category)
308 _sceneManager->SetCategory( category );
312 //=========================================================================
313 void wxGEditorTabPanel::SetDescription(std::string description)
315 _sceneManager->SetDescription( description );
317 //=========================================================================
319 void wxGEditorTabPanel::SetFullPath( const std::string& fullpath )
321 this->_fullPath = fullpath;
323 //=========================================================================
325 void wxGEditorTabPanel::SetFileName( const std::string& filename )
327 this->_fileName = filename;
329 //=========================================================================
331 std::string wxGEditorTabPanel::GetFullPath( )
333 return( this->_fullPath );
335 //=========================================================================
337 std::string wxGEditorTabPanel::GetFileName( )
339 return( this->_fileName );
345 } // EO namespace bbtk