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)
178 this->SetFullPath(content);
179 std::cout<<"wxGEditorTabPanel: " << content <<std::endl;
180 //std::cout<<"wxGEditorTabPanel Real: " << this->_fullPath <<std::endl;
181 _sceneManager->saveDiagram(content);
184 //=========================================================================
186 void wxGEditorTabPanel::loadDiagram(ifstream &inputStream)
188 _sceneManager->loadDiagram(inputStream);
191 //=========================================================================
193 int wxGEditorTabPanel::getPanelId()
198 //=========================================================================
200 bool wxGEditorTabPanel::isComplexBox()
202 return _sceneManager->isComplexBox();
205 //=========================================================================
207 void wxGEditorTabPanel::setComplexBox(bool val)
209 _sceneManager->setComplexBox(val);
212 //=========================================================================
214 void wxGEditorTabPanel::addComplexInputPort(std::string portName)
216 _sceneManager->createGComplexBoxInputPort(portName);
219 //=========================================================================
221 void wxGEditorTabPanel::addComplexOutputPort(std::string portName)
223 _sceneManager->createGComplexBoxOutputPort(portName);
226 //=========================================================================
228 std::map<int,GObjectController*> wxGEditorTabPanel::getSelectedObjects()
230 return _sceneManager->getSelectedObjects();
233 //=========================================================================
235 void wxGEditorTabPanel::addObjects(std::map<int,GObjectController*> objectsMap)
237 _sceneManager->addObjects(objectsMap);
240 //=========================================================================
242 int wxGEditorTabPanel::getNumSelectedObjects()
244 return _sceneManager->getNumSelectedObjects();
247 //=========================================================================
250 wxVtkSceneManager* wxGEditorTabPanel::getSceneManager()
252 return _sceneManager;
255 //=========================================================================
256 std::string wxGEditorTabPanel::GetCbName()
258 return _sceneManager->GetCbName();
262 //=========================================================================
263 std::string wxGEditorTabPanel::GetCbPackageName()
265 return _sceneManager->GetCbPackageName();
268 //=========================================================================
269 std::string wxGEditorTabPanel::GetAuthor()
271 return _sceneManager->GetAuthor();
274 //=========================================================================
275 std::string wxGEditorTabPanel::GetDescription()
277 return _sceneManager->GetDescription();
280 //=========================================================================
281 std::string wxGEditorTabPanel::GetCategory()
283 return _sceneManager->GetCategory();
286 //=========================================================================
287 void wxGEditorTabPanel::SetCbName(std::string cbName)
289 _sceneManager->SetCbName( cbName );
292 //=========================================================================
293 void wxGEditorTabPanel::SetCbPackageName(std::string packagename)
295 _sceneManager->SetCbPackageName( packagename );
299 //=========================================================================
300 void wxGEditorTabPanel::SetAuthor(std::string author)
302 _sceneManager->SetAuthor( author );
306 //=========================================================================
307 void wxGEditorTabPanel::SetCategory(std::string category)
309 _sceneManager->SetCategory( category );
313 //=========================================================================
314 void wxGEditorTabPanel::SetDescription(std::string description)
316 _sceneManager->SetDescription( description );
318 //=========================================================================
320 void wxGEditorTabPanel::SetFullPath( const std::string& fullpath )
322 this->_fullPath = fullpath;
324 //=========================================================================
326 void wxGEditorTabPanel::SetFileName( const std::string& filename )
328 this->_fileName = filename;
330 //=========================================================================
332 std::string wxGEditorTabPanel::GetFullPath( )
334 return( this->_fullPath );
336 //=========================================================================
338 std::string wxGEditorTabPanel::GetFileName( )
340 return( this->_fileName );
346 } // EO namespace bbtk