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();
66 //=========================================================================
67 void wxGEditorTabPanel::initWxVtkCanvas()
69 wxVtk3DBaseView *baseview = new wxVtk3DBaseView(this);
70 baseview->Configure();
71 _sceneManager=new wxVtkSceneManager(this,baseview,_id);
73 printf("RaC-EED 21-06-2010 wxGEditorTabPanel::initWxVtkCanvas Remove the panelAUIMgr, and change to a normal sizer inside the wxGEditorTabPanel\n");
74 _panelAUIMgr->AddPane((wxWindow*)baseview->GetWxVTKRenderWindowInteractor(),wxAuiPaneInfo().Fixed().CenterPane());
77 _panelAUIMgr->Update();
80 //=========================================================================
82 bool wxGEditorTabPanel::OnDropText(wxCoord x, wxCoord y, const wxString& data)
84 std::string packageName="";
85 std::string boxType="";
87 wxString foo( (data) );
89 strcpy( str, (const char*)foo.mb_str(wxConvUTF8) );
93 result = strtok( str, delims );
94 packageName += result;
96 result = strtok( NULL, delims );
99 _sceneManager->createGBlackBox(x,y,packageName, boxType);
104 //=========================================================================
106 void wxGEditorTabPanel::setPanelsManager(wxTabPanelsManager* panelsManager)
108 _panelsManager = panelsManager;
111 //=========================================================================
113 void wxGEditorTabPanel::displayBlackBoxInfo(std::string packageName, std::string boxName)
115 _panelsManager->displayBlackBoxInfo(packageName,boxName);
118 //=========================================================================
120 void wxGEditorTabPanel::updateStatusBar(std::string textStatus)
122 _panelsManager->updateStatusBar(textStatus);
125 //=========================================================================
127 std::string wxGEditorTabPanel::getDiagramBBS()
129 return _sceneManager->getDiagramBBS();
132 //=========================================================================
134 std::string wxGEditorTabPanel::saveComplexBoxBBS(std::string cbName,std::string cbAuthor,std::string cbCategory,std::string cbDescription)
136 return _sceneManager->saveComplexBoxBBS(cbName,cbAuthor,cbCategory,cbDescription);
139 //=========================================================================
141 void wxGEditorTabPanel::editBlackBox(GBlackBoxModel *bbmodel)
143 _panelsManager->editBlackBox(bbmodel);
146 //=========================================================================
148 void wxGEditorTabPanel::deleteAllBoxes()
150 _sceneManager->deleteAllBoxes();
153 //=========================================================================
155 void wxGEditorTabPanel::centerView()
157 _sceneManager->centerView();
160 //=========================================================================
162 void wxGEditorTabPanel::saveDiagram(std::string &content)
164 _sceneManager->saveDiagram(content);
167 //=========================================================================
169 void wxGEditorTabPanel::loadDiagram(ifstream &inputStream)
171 _sceneManager->loadDiagram(inputStream);
174 //=========================================================================
176 int wxGEditorTabPanel::getPanelId()
181 //=========================================================================
183 bool wxGEditorTabPanel::isComplexBox()
185 return _sceneManager->isComplexBox();
188 //=========================================================================
190 void wxGEditorTabPanel::setComplexBox(bool val)
192 _sceneManager->setComplexBox(val);
195 //=========================================================================
197 void wxGEditorTabPanel::addComplexInputPort(std::string portName)
199 _sceneManager->createGComplexBoxInputPort(portName);
202 //=========================================================================
204 void wxGEditorTabPanel::addComplexOutputPort(std::string portName)
206 _sceneManager->createGComplexBoxOutputPort(portName);
209 //=========================================================================
211 std::map<int,GObjectController*> wxGEditorTabPanel::getSelectedObjects()
213 return _sceneManager->getSelectedObjects();
216 //=========================================================================
218 void wxGEditorTabPanel::addObjects(std::map<int,GObjectController*> objectsMap)
220 _sceneManager->addObjects(objectsMap);
223 //=========================================================================
225 int wxGEditorTabPanel::getNumSelectedObjects()
227 return _sceneManager->getNumSelectedObjects();
230 //=========================================================================
233 wxVtkSceneManager* wxGEditorTabPanel::getSceneManager()
235 return _sceneManager;
239 } // EO namespace bbtk