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();
71 //=========================================================================
72 void wxGEditorTabPanel::initWxVtkCanvas()
74 printf("EED wxGEditorTabPanel::initWxVtkCanvas 0\n");
75 wxVtk3DBaseView *baseview = new wxVtk3DBaseView(this);
76 baseview->Configure();
77 _sceneManager=new wxVtkSceneManager(this,baseview,_id);
81 printf("RaC-EED 21-06-2010 wxGEditorTabPanel::initWxVtkCanvas Remove the panelAUIMgr, and change to a normal sizer inside the wxGEditorTabPanel\n");
82 _panelAUIMgr->AddPane((wxWindow*)baseview->GetWxVTKRenderWindowInteractor(),wxAuiPaneInfo().Fixed().CenterPane());
84 _panelAUIMgr->Update();
85 printf("EED wxGEditorTabPanel::initWxVtkCanvas 1\n");
88 //=========================================================================
90 bool wxGEditorTabPanel::OnDropText(wxCoord x, wxCoord y, const wxString& data)
92 std::string packageName="";
93 std::string boxType="";
95 wxString foo( (data) );
97 strcpy( str, (const char*)foo.mb_str(wxConvUTF8) );
101 result = strtok( str, delims );
102 packageName += result;
104 result = strtok( NULL, delims );
107 _sceneManager->createGBlackBox(x,y,packageName, boxType);
112 //=========================================================================
114 void wxGEditorTabPanel::setPanelsManager(wxTabPanelsManager* panelsManager)
116 _panelsManager = panelsManager;
119 //=========================================================================
121 void wxGEditorTabPanel::displayBlackBoxInfo(std::string packageName, std::string boxName)
123 _panelsManager->displayBlackBoxInfo(packageName,boxName);
126 //=========================================================================
128 void wxGEditorTabPanel::updateStatusBar(std::string textStatus)
130 _panelsManager->updateStatusBar(textStatus);
133 //=========================================================================
135 std::string wxGEditorTabPanel::getDiagramBBS(bool wln)
137 return _sceneManager->getDiagramBBS(wln);
140 //=========================================================================
142 std::string wxGEditorTabPanel::saveComplexBoxBBS()
144 return _sceneManager->saveComplexBoxBBS();
147 //=========================================================================
149 void wxGEditorTabPanel::editBlackBox(GBlackBoxModel *bbmodel)
151 _panelsManager->editBlackBox(bbmodel);
154 //=========================================================================
156 void wxGEditorTabPanel::deleteAllBoxes()
158 _sceneManager->deleteAllBoxes();
161 //=========================================================================
163 void wxGEditorTabPanel::centerView()
165 _sceneManager->centerView();
168 //=========================================================================
170 void wxGEditorTabPanel::saveDiagram(std::string &content)
172 _sceneManager->saveDiagram(content);
175 //=========================================================================
177 void wxGEditorTabPanel::loadDiagram(ifstream &inputStream)
179 _sceneManager->loadDiagram(inputStream);
182 //=========================================================================
184 int wxGEditorTabPanel::getPanelId()
189 //=========================================================================
191 bool wxGEditorTabPanel::isComplexBox()
193 return _sceneManager->isComplexBox();
196 //=========================================================================
198 void wxGEditorTabPanel::setComplexBox(bool val)
200 _sceneManager->setComplexBox(val);
203 //=========================================================================
205 void wxGEditorTabPanel::addComplexInputPort(std::string portName)
207 _sceneManager->createGComplexBoxInputPort(portName);
210 //=========================================================================
212 void wxGEditorTabPanel::addComplexOutputPort(std::string portName)
214 _sceneManager->createGComplexBoxOutputPort(portName);
217 //=========================================================================
219 std::map<int,GObjectController*> wxGEditorTabPanel::getSelectedObjects()
221 return _sceneManager->getSelectedObjects();
224 //=========================================================================
226 void wxGEditorTabPanel::addObjects(std::map<int,GObjectController*> objectsMap)
228 _sceneManager->addObjects(objectsMap);
231 //=========================================================================
233 int wxGEditorTabPanel::getNumSelectedObjects()
235 return _sceneManager->getNumSelectedObjects();
238 //=========================================================================
241 wxVtkSceneManager* wxGEditorTabPanel::getSceneManager()
243 return _sceneManager;
246 //=========================================================================
247 std::string wxGEditorTabPanel::GetCbName()
249 return _sceneManager->GetCbName();
253 //=========================================================================
254 std::string wxGEditorTabPanel::GetCbPackageName()
256 return _sceneManager->GetCbPackageName();
259 //=========================================================================
260 std::string wxGEditorTabPanel::GetAuthor()
262 return _sceneManager->GetAuthor();
265 //=========================================================================
266 std::string wxGEditorTabPanel::GetDescription()
268 return _sceneManager->GetDescription();
271 //=========================================================================
272 std::string wxGEditorTabPanel::GetCategory()
274 return _sceneManager->GetCategory();
277 //=========================================================================
278 void wxGEditorTabPanel::SetCbName(std::string cbName)
280 _sceneManager->SetCbName( cbName );
283 //=========================================================================
284 void wxGEditorTabPanel::SetCbPackageName(std::string packagename)
286 _sceneManager->SetCbPackageName( packagename );
290 //=========================================================================
291 void wxGEditorTabPanel::SetAuthor(std::string author)
293 _sceneManager->SetAuthor( author );
297 //=========================================================================
298 void wxGEditorTabPanel::SetCategory(std::string category)
300 _sceneManager->SetCategory( category );
304 //=========================================================================
305 void wxGEditorTabPanel::SetDescription(std::string description)
307 _sceneManager->SetDescription( description );
317 } // EO namespace bbtk