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);
72 _panelAUIMgr->AddPane((wxWindow*)baseview->GetWxVTKRenderWindowInteractor(),wxAuiPaneInfo().Fixed().CenterPane());
75 _panelAUIMgr->Update();
78 //=========================================================================
80 bool wxGEditorTabPanel::OnDropText(wxCoord x, wxCoord y, const wxString& data)
82 std::string packageName="";
83 std::string boxName="";
85 wxString foo( (data) );
87 strcpy( str, (const char*)foo.mb_str(wxConvUTF8) );
91 result = strtok( str, delims );
92 packageName += result;
94 result = strtok( NULL, delims );
97 _sceneManager->createGBlackBox(x,y,packageName, boxName);
102 //=========================================================================
104 void wxGEditorTabPanel::setPanelsManager(wxTabPanelsManager* panelsManager)
106 _panelsManager = panelsManager;
109 //=========================================================================
111 void wxGEditorTabPanel::displayBlackBoxInfo(std::string packageName, std::string boxName)
113 _panelsManager->displayBlackBoxInfo(packageName,boxName);
116 //=========================================================================
118 void wxGEditorTabPanel::updateStatusBar(std::string textStatus)
120 _panelsManager->updateStatusBar(textStatus);
123 //=========================================================================
125 std::string wxGEditorTabPanel::getDiagramBBS()
127 return _sceneManager->getDiagramBBS();
130 //=========================================================================
132 std::string wxGEditorTabPanel::saveComplexBoxBBS(std::string cbName,std::string cbAuthor,std::string cbCategory,std::string cbDescription)
134 return _sceneManager->saveComplexBoxBBS(cbName,cbAuthor,cbCategory,cbDescription);
137 //=========================================================================
139 void wxGEditorTabPanel::editBlackBox(GBlackBoxModel *bbmodel)
141 _panelsManager->editBlackBox(bbmodel);
144 //=========================================================================
146 void wxGEditorTabPanel::editDiagramParameters(wxVtkSceneManager* scene)
148 _panelsManager->editDiagramParameters(scene);
151 //=========================================================================
153 void wxGEditorTabPanel::deleteAllBoxes()
155 _sceneManager->deleteAllBoxes();
158 //=========================================================================
160 void wxGEditorTabPanel::centerView()
162 _sceneManager->centerView();
165 //=========================================================================
167 void wxGEditorTabPanel::saveDiagram(std::string &content)
169 _sceneManager->saveDiagram(content);
172 //=========================================================================
174 void wxGEditorTabPanel::loadDiagram(ifstream &inputStream)
176 _sceneManager->loadDiagram(inputStream);
179 //=========================================================================
181 int wxGEditorTabPanel::getPanelId()
186 //=========================================================================
188 bool wxGEditorTabPanel::isComplexBox()
190 return _sceneManager->isComplexBox();
193 //=========================================================================
195 void wxGEditorTabPanel::setComplexBox(bool val)
197 _sceneManager->setComplexBox(val);
200 //=========================================================================
202 void wxGEditorTabPanel::addComplexInputPort(std::string portName)
204 _sceneManager->createGComplexBoxInputPort(portName);
207 //=========================================================================
209 void wxGEditorTabPanel::addComplexOutputPort(std::string portName)
211 _sceneManager->createGComplexBoxOutputPort(portName);
214 //=========================================================================
216 std::map<int,GObjectController*> wxGEditorTabPanel::getSelectedObjects()
218 return _sceneManager->getSelectedObjects();
221 //=========================================================================
223 void wxGEditorTabPanel::addObjects(std::map<int,GObjectController*> objectsMap)
225 _sceneManager->addObjects(objectsMap);
228 //=========================================================================
230 int wxGEditorTabPanel::getNumSelectedObjects()
232 return _sceneManager->getNumSelectedObjects();
235 //=========================================================================
237 } // EO namespace bbtk