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::wxVtkSceneManager .
36 #include "wxVtkSceneManager.h"
38 #include <vtkPolygon.h>
39 #include <vtkUnstructuredGrid.h>
43 //=========================================================================
44 wxVtkSceneManager::wxVtkSceneManager(wxGEditorTabPanel *parent,
45 wxVtk3DBaseView *baseView, int idManager) {
46 _cbName = "ComplexBoxName";
47 _cbPackageName = "PackageName";
48 _Author = "Author ??";
50 _Description = "Description ??";
54 _idManager = idManager;
56 _startDragging = false;
57 _isComplexBox = false;
59 if (_baseView != NULL) {
62 "RaC-EED 21-06-2010 %p wxVtkSceneManager::wxVtkSceneManager If you comment this line, the drag and drop functionnality is not initialized.\n",
65 _baseView->GetWxVTKRenderWindowInteractor()->SetDropTarget((wxDropTarget*)parent);
69 _worldState = NOTHING_HAPPENS;
70 registerController(this);
73 _idConnectionInCreation = -1;
78 //=========================================================================
80 void wxVtkSceneManager::disconnectDrop() {
81 printf("EED %p ~wxVtkSceneManager::disconnectDrop()\n", this);
82 //EED02JUIN2010 _baseView->GetWxVTKRenderWindowInteractor()->SetDropTarget(NULL);
83 // _baseView->GetWxVTKRenderWindowInteractor()->SetDropTarget( new tmpClasswxTextDropTarget() );
86 //=========================================================================
88 wxVtkSceneManager::~wxVtkSceneManager() {
90 printf("EED %p ~wxVtkSceneManager()\n", this);
95 //=========================================================================
97 void wxVtkSceneManager::configureBaseView() {
98 printf("EED wxVtkSceneManager::configureBaseView 0\n");
99 vtkInteractorStyleBaseView2D *interactorstylebaseview =
100 vtkInteractorStyleBaseView2D::New();
102 _baseView->SetInteractorStyleBaseView(interactorstylebaseview);
104 // Important to activate the 2D interaction system
105 wxVTKRenderWindowInteractor *iren =
106 _baseView->GetWxVTKRenderWindowInteractor();
107 interactorstylebaseview->SetInteractor(iren);
108 iren->SetInteractorStyle(interactorstylebaseview);
109 interactorstylebaseview->SetwxVtkBaseView(_baseView);
111 _baseView->GetRenderer()->GetActiveCamera()->ParallelProjectionOn();
112 _baseView->GetRenderer()->ResetCamera(-100, 100, -100, 100, 800, 1100);
114 _baseView->GetRenderer()->SetBackground(0.9, 0.9, 0.9);
115 _baseView->GetRenderer()->GradientBackgroundOn();
116 _baseView->Refresh();
119 _textActor = vtkTextActor3D::New();
120 _textActor->SetPosition(-9999, -9999, 900);
121 _textActor->SetInput("<void>");
122 _textActor->GetTextProperty()->SetFontSize(60);
123 _textActor->GetTextProperty()->BoldOn();
124 _textActor->GetTextProperty()->SetColor(PORTTEXT_NH_R, PORTTEXT_NH_G,
127 _baseView->GetRenderer()->AddActor(_textActor);
129 // Actor Fill_Port_Text
136 vtkPolygon *aPolygon = vtkPolygon::New();
137 _fillObjectActor = vtkActor::New();
139 _pts = vtkPoints::New();
141 double w = 100, h = 10, b = h / 15, t = 3;
142 _pts->SetNumberOfPoints(21);
143 _pts->InsertPoint(0, xInic + w * 0.33 - t / 2, yInic, zInic);
144 _pts->InsertPoint(1, xInic + w * 0.33, yInic - t, zInic);
145 _pts->InsertPoint(2, xInic + w * 0.33 + t / 2, yInic, zInic);
146 _pts->InsertPoint(3, xInic + w * 0.33 + t / 2, yInic, zInic);
147 _pts->InsertPoint(4, xInic + w - b * 4, yInic + b * 0, zInic);
149 _pts->InsertPoint(5, xInic + w - b * 4, yInic + b * 0, zInic);
150 _pts->InsertPoint(6, xInic + w - b * 2, yInic + b * 1, zInic);
151 _pts->InsertPoint(7, xInic + w - b * 1, yInic + b * 2, zInic);
152 _pts->InsertPoint(8, xInic + w - b * 0, yInic + b * 4, zInic);
154 _pts->InsertPoint(9, xInic + w - b * 0, yInic + h - b * 4, zInic);
155 _pts->InsertPoint(10, xInic + w - b * 1, yInic + h - b * 2, zInic);
156 _pts->InsertPoint(11, xInic + w - b * 2, yInic + h - b * 1, zInic);
157 _pts->InsertPoint(12, xInic + w - b * 4, yInic + h - b * 0, zInic);
159 _pts->InsertPoint(13, xInic + b * 4, yInic + h - b * 0, zInic);
160 _pts->InsertPoint(14, xInic + b * 2, yInic + h - b * 1, zInic);
161 _pts->InsertPoint(15, xInic + b * 1, yInic + h - b * 2, zInic);
162 _pts->InsertPoint(16, xInic + b * 0, yInic + h - b * 4, zInic);
164 _pts->InsertPoint(17, xInic + b * 0, yInic + b * 4, zInic);
165 _pts->InsertPoint(18, xInic + b * 1, yInic + b * 2, zInic);
166 _pts->InsertPoint(19, xInic + b * 2, yInic + b * 1, zInic);
167 _pts->InsertPoint(20, xInic + b * 4, yInic + b * 0, zInic);
169 aPolygon->GetPointIds()->SetNumberOfIds(21);
170 for (int i = 0; i < 21; i++) {
171 aPolygon->GetPointIds()->SetId(i, i);
174 vtkUnstructuredGrid *aPolygonGrid = vtkUnstructuredGrid::New();
175 aPolygonGrid->Allocate(1, 1);
176 aPolygonGrid->InsertNextCell(aPolygon->GetCellType(),
177 aPolygon->GetPointIds());
178 aPolygonGrid->SetPoints(_pts);
179 _aPolygonMapper = vtkDataSetMapper::New();
180 _aPolygonMapper->SetInput(aPolygonGrid);
181 _fillObjectActor->SetMapper(_aPolygonMapper);
182 _fillObjectActor->GetProperty()->SetColor(PORTFILL_NH_R, PORTFILL_NH_G,
184 _fillObjectActor->GetProperty()->SetOpacity(0);
185 _aPolygonMapper->Modified();
187 _baseView->GetRenderer()->AddActor(_fillObjectActor);
188 printf("EED wxVtkSceneManager::configureBaseView 1\n");
191 //=========================================================================
193 std::string wxVtkSceneManager::generateANewNameForABox() {
194 std::stringstream boxname;
195 if (_numBoxes < 10) {
196 boxname << "Box0" << _numBoxes;
198 boxname << "Box" << _numBoxes;
201 return boxname.str();
204 //=========================================================================
206 std::string wxVtkSceneManager::findANewNameForABox() {
207 std::string boxname = generateANewNameForABox();
209 while (boxExist(boxname) == true) {
210 boxname = generateANewNameForABox();
216 //=========================================================================
217 void wxVtkSceneManager::configGBlackBox(int idBox, double xIn, double yIn,
218 double zIn, std::string name, bool boxExecutable, double xEn,
219 double yEn, double zEn) {
220 GObjectController *cont = _controllers[idBox];
221 GBlackBoxModel *bbmod = (GBlackBoxModel*) cont->getModel();
222 bbmod->setBBTKName(name);
223 bbmod->setInicPoint(xIn, yIn, zIn);
224 bbmod->setFinalPoint(xEn, yEn, zEn);
225 bbmod->setExecutable(boxExecutable);
227 bbmod->notifyObservers(_idManager);
231 //=========================================================================
233 int wxVtkSceneManager::createGBlackBox(int x, int y, std::string packageName,
234 std::string boxType) {
235 _worldState = NOTHING_HAPPENS;
236 //EED int windowWidth = _baseView->GetRenWin()->GetSize()[0];
237 int windowHeight = _baseView->GetRenWin()->GetSize()[1];
239 int type = GBLACKBOX;
241 //Create the MVC Objects
245 (GBlackBoxModel*) GObjectsMVCFactory::getInstance()->createGObjectModel(
247 vtkGObjectView *view =
248 GObjectsMVCFactory::getInstance()->createGObjectView(type);
249 GObjectController* controller =
250 GObjectsMVCFactory::getInstance()->createGObjectController(type);
252 BlackBoxDescriptor::Pointer descriptor =
253 GObjectsMVCFactory::getInstance()->getBlackBoxDescriptor(
254 packageName, boxType);
256 //Prepares the initial model
257 //The coordinates obtained are the following. Top-Left:x=0,y=0 Bottom-Right:x=width,y=height
260 double yy = windowHeight - y;
262 //z value is not important yet, because it is only used a parallel projection
264 _baseView->TransCoordScreenToWorld(xx, yy, zz);
265 model->setInicPoint(xx, yy, zz);
267 std::stringstream stream;
269 std::string newBoxName;
270 newBoxName = findANewNameForABox();
272 stream << newBoxName;
274 std::string arraystring = stream.str();
276 model->setBBTKName(arraystring);
277 model->setBBTKType(boxType);
278 model->setBBTKPackage(packageName);
280 model->addObserver(view);
281 model->addObserver(this);
283 //Iterate and create the input ports
284 std::map<std::string, BlackBoxInputDescriptor*> descriptorInMap =
285 descriptor->GetInputDescriptorMap();
286 std::map<std::string, BlackBoxInputDescriptor*>::iterator itInput;
289 for (itInput = descriptorInMap.begin(); itInput != descriptorInMap.end(); ++itInput) {
290 BlackBoxInputDescriptor *desc = itInput->second;
291 createGInputPort(GINPUTPORT, i, model, desc);
295 //Iterate and create the output ports
296 std::map<std::string, BlackBoxOutputDescriptor*> descriptorOutMap =
297 descriptor->GetOutputDescriptorMap();
298 std::map<std::string, BlackBoxOutputDescriptor*>::iterator itOutput;
301 for (itOutput = descriptorOutMap.begin(); itOutput
302 != descriptorOutMap.end(); ++itOutput) {
303 BlackBoxOutputDescriptor *desc = itOutput->second;
304 createGOutputPort(GOUTPUTPORT, i, model, desc);
308 //Associates the view with the correspondent renderer and the model.
309 //(NOTE: Refresh is only made by the view)
310 view->setModel(model);
311 view->setBaseView(_baseView);
312 view->initVtkObjects();
314 //Associates the controller with the correspondent model and view
315 controller->setModelAndView(model, view);
317 //Resgiter change to the observers of the actual model
318 model->notifyObservers(_idManager);
320 int newId = addObjectController(controller);
326 //=========================================================================
328 int wxVtkSceneManager::createGComplexBoxInputPort(std::string inputName) {
329 //EED int windowWidth=_baseView->GetRenWin()->GetSize()[0];
330 int windowHeight = _baseView->GetRenWin()->GetSize()[1];
332 int type = GCOMPLEXINPUTPORT;
334 //Create the MVC Objects
338 (GComplexBoxPortModel*) GObjectsMVCFactory::getInstance()->createGObjectModel(
340 vtkGObjectView *view =
341 GObjectsMVCFactory::getInstance()->createGObjectView(type);
342 GObjectController* controller =
343 GObjectsMVCFactory::getInstance()->createGObjectController(type);
345 //Prepares the initial model
348 double yy = windowHeight - 5;
350 //z value is not important yet, because it is only used a parallel projection
352 printf("EED wxVtkSceneManager::createGComplexBoxInputPort 900-450\n");
354 _baseView->TransCoordScreenToWorld(xx, yy, zz);
355 model->setInicPoint(xx, yy, zz);
357 model->setBBTKName(inputName);
358 model->setBBTKType("ComplexInputPort");
359 model->setComplexPortType(type);
361 model->addObserver(view);
362 model->addObserver(this);
364 //create the output port
365 GPortController* portController = createGPort(GOUTPUTPORT, inputName,
366 "ComplexInputPort", 0, model);
367 model->addOutputPort((GPortModel*) portController->getModel());
369 //Associates the view with the correspondent renderer and the model.
370 //(NOTE: Refresh is only made by the view)
371 view->setModel(model);
372 view->setBaseView(_baseView);
373 view->initVtkObjects();
375 //Associates the controller with the correspondent model and view
376 controller->setModelAndView(model, view);
378 //Resgiter change to the observers of the actual model
379 model->notifyObservers(_idManager);
381 int newId = addObjectController(controller);
385 //=========================================================================
387 int wxVtkSceneManager::createGComplexBoxOutputPort(std::string outputName) {
388 //EED int windowWidth=_baseView->GetRenWin()->GetSize()[0];
389 int windowHeight = _baseView->GetRenWin()->GetSize()[1];
391 int type = GCOMPLEXOUTPUTPORT;
393 //Create the MVC Objects
397 (GComplexBoxPortModel*) GObjectsMVCFactory::getInstance()->createGObjectModel(
399 vtkGObjectView *view =
400 GObjectsMVCFactory::getInstance()->createGObjectView(type);
401 GObjectController *controller =
402 GObjectsMVCFactory::getInstance()->createGObjectController(type);
404 //Prepares the initial model
407 double yy = windowHeight - 5;
409 //z value is not important yet, because it is only used a parallel projection
412 printf("EED wxVtkSceneManager::createGComplexBoxOutputPort 900-450\n");
414 _baseView->TransCoordScreenToWorld(xx, yy, zz);
415 model->setInicPoint(xx, yy, zz);
417 model->setBBTKName(outputName);
418 model->setBBTKType("ComplexOutputPort");
419 model->setComplexPortType(type);
421 model->addObserver(view);
422 model->addObserver(this);
424 //create the output port
425 GPortController* portController = createGPort(GINPUTPORT, outputName,
426 "ComplexInputPort", 0, model);
427 model->addInputPort((GPortModel*) portController->getModel());
429 //Associates the view with the correspondent renderer and the model.
430 //(NOTE: Refresh is only made by the view)
431 view->setModel(model);
432 view->setBaseView(_baseView);
433 view->initVtkObjects();
435 //Associates the controller with the correspondent model and view
436 controller->setModelAndView(model, view);
438 //Resgiter change to the observers of the actual model
439 model->notifyObservers(_idManager);
441 int newId = addObjectController(controller);
445 //=========================================================================
447 int wxVtkSceneManager::createGInputPort(int portType, int posinBox,
448 GBoxModel *blackBox, BlackBoxInputDescriptor *desc) {
449 GPortController* portController = createGPort(portType, desc->GetName(),
450 desc->GetTypeName(), posinBox, blackBox);
451 blackBox->addInputPort((GPortModel*) portController->getModel());
452 return portController->getId();
455 //=========================================================================
457 int wxVtkSceneManager::createGOutputPort(int portType, int posinBox,
458 GBoxModel *blackBox, BlackBoxOutputDescriptor *desc) {
459 GPortController* portController = createGPort(portType, desc->GetName(),
460 desc->GetTypeName(), posinBox, blackBox);
461 blackBox->addOutputPort((GPortModel*) portController->getModel());
462 return portController->getId();
465 //=========================================================================
467 GPortController* wxVtkSceneManager::createGPort(int portType,
468 std::string bbtkName, std::string bbtkType, int posInBox,
469 GBoxModel *blackBox) {
472 //Create the MVC Objects
475 (GPortModel*) GObjectsMVCFactory::getInstance()->createGObjectModel(
477 vtkGObjectView *view =
478 GObjectsMVCFactory::getInstance()->createGObjectView(type);
479 GObjectController* controller =
480 GObjectsMVCFactory::getInstance()->createGObjectController(type);
482 model->registerInBox(blackBox, portType, posInBox);
484 model->setBBTKType(bbtkType);
485 model->setBBTKName(bbtkName);
487 model->addObserver(view);
488 model->addObserver(this);
490 //Associates the view with the correspondent renderer and the model.
491 //(NOTE: Refresh is only made by the view)
492 view->setModel(model);
493 view->setBaseView(_baseView);
494 view->initVtkObjects();
496 //Associates the controller with the correspondent model and view
497 controller->setModelAndView(model, view);
499 model->notifyObservers(_idManager);
501 addObjectController(controller);
503 return (GPortController*) controller;
506 //=========================================================================
508 int wxVtkSceneManager::createGConnector(GPortModel* startPort) {
509 int type = GCONNECTOR;
511 manualConnectorContourController* manContourControl =
512 new manualConnectorContourController();
513 manualConnectorContourView* manContourView =
514 new manualConnectorContourView();
515 manualContourModel* manContourModel = new manualContourModel();
517 GConnectorController* connectorcontroller = new GConnectorController();
518 GConnectorModel* connectorModel = new GConnectorModel();
519 vtkGConnectorView* connectorView = new vtkGConnectorView();
520 connectorModel->setGObjectType(type);
522 manContourModel->SetCloseContour(false);
523 connectorModel->setStartPort(startPort);
525 manContourView->SetModel(manContourModel);
526 manContourView->SetWxVtkBaseView(_baseView);
527 manContourView->SetRange(0.5);
528 manContourView->SetZ(900);
530 manContourView->SetColorNormalContour(0, 0, 1);
531 manContourView->SetColorEditContour(0.5, 0.5, 0.5);
532 manContourView->SetColorSelectContour(1, 0.8, 0);
533 manContourView->SetWidthLine(1);
534 manContourView->SetShowText(false);
536 manContourControl->SetModelView(manContourModel, manContourView);
538 manContourControl->CreateNewManualContour();
540 manContourView->RefreshContour();
543 connectorModel->getInicPoint(x, y, z);
545 manContourControl->SetState(1);
546 manContourModel->SetCloseContour(false);
548 manContourModel->AddPoint(x, y, z);
549 manContourView->AddPoint();
551 manContourModel->AddPoint(x, y, z);
552 manContourView->AddPoint();
554 int bak = manContourControl->GetNumberOfPointsManualContour() - 1;
555 manContourControl->_bakIdPoint = bak;
556 manContourView->Refresh();
558 manContourControl->SetMoving(false);
560 connectorcontroller->setModelAndView(connectorModel, connectorView);
562 int newId = addObjectController(connectorcontroller);
564 connectorcontroller->setManualContourController(manContourControl);
565 connectorModel->setManualContourModel(manContourModel);
566 connectorView->setManualContourView(manContourView);
567 connectorView->setModel(connectorModel);
568 connectorView->setBaseView(_baseView);
570 connectorModel->addObserver(connectorView);
571 connectorModel->addObserver(this);
576 //=========================================================================
578 void wxVtkSceneManager::registerController(InteractorStyleMaracas *param) {
579 vtkInteractorStyleBaseView
580 * baseViewControlManager =
581 (vtkInteractorStyleBaseView*) _baseView->GetInteractorStyleBaseView();
582 baseViewControlManager->AddInteractorStyleMaracas(param);
585 //=========================================================================
587 void wxVtkSceneManager::unregisterController(InteractorStyleMaracas *param) {
588 vtkInteractorStyleBaseView
589 * baseViewControlManager =
590 (vtkInteractorStyleBaseView*) _baseView->GetInteractorStyleBaseView();
591 baseViewControlManager->RemoveInteractorStyleMaracas(param);
594 //=========================================================================
596 vtkRenderer* wxVtkSceneManager::getRenderer() {
597 return _baseView->GetRenderer();
600 //=========================================================================
602 vtkRenderWindow* wxVtkSceneManager::getRenderWindow() {
603 return _baseView->GetRenWin();
605 //=========================================================================
608 //=========================================================================
609 int wxVtkSceneManager::GetIndexInSelected(int idControler) {
611 for (int i = 0; i < (int) _selectedObjects.size(); i++) {
612 if (_selectedObjects[i] == idControler) {
619 //=========================================================================
621 void wxVtkSceneManager::update(int idController, int command) {
623 if (command != NO_COMMAND) {
624 if (command == ADD_TO_SELECTED) {
625 //EEDBorrame GObjectController* cont = _controllers[idController];
627 if (GetIndexInSelected(idController) == -1) {
628 _selectedObjects.push_back(idController);
632 // bool foundID=false;
633 // for (int i=0; i<(int)_selectedObjects.size() && foundID==false; i++)
635 // if(_selectedObjects[i]==idController)
642 // _selectedObjects.push_back(idController);
645 } else if (command == REMOVE_FROM_SELECTED) {
646 int index = GetIndexInSelected(idController);
648 _selectedObjects.erase(_selectedObjects.begin() + index);
650 } else if (command == INIT_CREATION_CONTOUR) {
651 _worldState = INIT_CREATION_CONTOUR;
652 GObjectController* cont = _controllers[idController];
653 GPortModel* startOutputPort = (GPortModel*) cont->getModel();
655 // The last one is the controller of the connector
656 std::map<int, GObjectController*>::iterator it2;
658 for (it2 = _controllers.begin(); it2 != _controllers.end(); ++it2) {
659 GObjectController *cont = it2->second;
660 if (cont->getGObjectType() == GPORT) {
661 GPortModel* port = (GPortModel*) cont->getModel();
662 if (port->getPortType() == GINPUTPORT) {
663 cont->SetActive(true);
665 cont->getView()->setState(NOTHING_HAPPENS);
666 cont->getModel()->notifyObservers(_idManager);
667 cont->SetActive(false);
670 cont->getView()->setState(NOTHING_HAPPENS);
671 cont->getModel()->notifyObservers(_idManager);
672 cont->SetActive(false);
675 _selectedObjects.clear();
676 _idConnectionInCreation = createGConnector(startOutputPort);
677 } else if (command == FIN_CREATION_CONTOUR && _worldState
678 == INIT_CREATION_CONTOUR) {
679 _worldState = NOTHING_HAPPENS;
680 //int id = _controllers.size()-1;
681 GObjectController *cont = _controllers[_idConnectionInCreation];
682 GConnectorModel *modelContour = (GConnectorModel*) cont->getModel();
683 GObjectController *finPort = _controllers[idController];
685 if (finPort->getGObjectType() == GPORT) {
686 GPortModel* modelPort = (GPortModel*) finPort->getModel();
687 modelContour->setEndPort(modelPort);
690 manualConnectorContourController
692 ((GConnectorController*) cont)->getManualContourController();
693 manualConnectorContourView
695 (manualConnectorContourView*) manCont->GetManualViewBaseContour();
698 std::map<int, GObjectController*>::iterator it2;
700 for (it2 = _controllers.begin(); it2 != _controllers.end(); ++it2) {
701 GObjectController *cont = it2->second;
702 if (cont->getView() != NULL) {
703 cont->getView()->setState(NOTHING_HAPPENS);
704 cont->getModel()->notifyObservers(_idManager);
706 cont->SetActive(true);
714 //=========================================================================
716 bool wxVtkSceneManager::OnMouseMove() {
718 bool okStatusMessage = false;
719 bool okPortMessage = false;
720 wxVTKRenderWindowInteractor *wxVTKiren;
722 = _vtkInteractorStyleBaseView->GetWxVtk3DBaseView()->GetWxVTKRenderWindowInteractor();
723 wxVTKiren->GetEventPosition(X, Y);
725 if (_worldState == DRAG_OBJECTS) {
726 for (int i = 0; i < (int) _selectedObjects.size(); i++) {
727 int id = _selectedObjects[i];
728 GObjectController* cont = _controllers[id];
729 if (_startDragging) {
730 cont->getView()->setStartDragging(true);
732 cont->getView()->moveObject(X, Y);
733 cont->getView()->setState(DRAG);
734 cont->getModel()->notifyObservers(_idManager);
737 std::map<int, GObjectController*>::iterator it;
739 for (it = _controllers.begin(); it != _controllers.end(); ++it) {
740 GObjectController *desc = it->second;
741 if (desc->getGObjectType() == GCONNECTOR) {
742 vtkGConnectorView* vconn = (vtkGConnectorView*) desc->getView();
743 vconn->updateStartEndPoints();
747 _startDragging = false;
749 } else if (_worldState == NOTHING_HAPPENS || _worldState
750 == INIT_CREATION_CONTOUR) {
751 std::map<int, GObjectController*>::iterator it;
753 for (it = _controllers.begin(); it != _controllers.end(); ++it) {
754 GObjectController *desc = it->second;
755 int type = desc->getGObjectType();
756 int state = desc->getView()->getState();
757 desc->getModel()->getCenter(px, py, pz);
759 if (state == HIGHLIGHTED) {
760 okStatusMessage = true;
761 updateStatusBar(desc->getStatusText());
762 if (type == GBLACKBOX) {
763 GBlackBoxModel *mod = (GBlackBoxModel*) desc->getModel();
764 _parent->displayBlackBoxInfo(mod->getBBTKPackage(),
769 okPortMessage = true;
771 _textActor->SetInput(desc->getStatusText().c_str());
772 _textActor->SetScale(0.1);
773 _textActor->SetPosition(px - 25, py + 1, pz + 2);
778 _fillObjectActor->SetScale(1);
779 _fillObjectActor->GetProperty()->SetOpacity(0.50);
780 _fillObjectActor->SetPosition(px, py, 1);
781 _aPolygonMapper->Modified();
784 } // for controllers it
787 if (okStatusMessage == false) {
791 if (okPortMessage == false) {
792 _textActor->SetScale(0.0001);
793 _fillObjectActor->SetScale(0.0001);
798 //=========================================================================
800 bool wxVtkSceneManager::OnLeftButtonDown() {
802 if (_worldState == INIT_CREATION_CONTOUR) {
803 bool isOverPort = false;
804 std::map<int, GObjectController*>::iterator it;
805 for (it = _controllers.begin(); it != _controllers.end() && isOverPort
807 GObjectController *desc = it->second;
808 if (desc->getGObjectType() == GPORT) {
809 GPortModel *portmod = (GPortModel*) desc->getModel();
810 vtkGObjectView *portView = desc->getView();
811 if (portmod->getPortType() == GINPUTPORT
812 && portView->getState() == HIGHLIGHTED) {
818 if (isOverPort == false) {
820 UnSelectBlackBoxes();
823 } else { //_worldState
825 _worldState = DRAG_OBJECTS;
826 _startDragging = true;
829 _vtkInteractorStyleBaseView->GetInteractor()->GetShiftKey();
831 _vtkInteractorStyleBaseView->GetInteractor()->GetControlKey();
832 ctrlkey = ctrlkey + shiftkey;
834 GObjectController *cont = GetGBlackBoxControlerPointedByMouse();
836 if (GetGBlackBoxControlerPointedByMouse() != NULL) {
837 int state = cont->getView()->getState();
838 if ((ctrlkey == 0) && (state == HIGHLIGHTED)) {
839 UnSelectBlackBoxes();
842 for (int i = 0; i < (int) _selectedObjects.size(); i++) {
843 int id = _selectedObjects[i];
844 GObjectController* cont = _controllers[id];
845 cont->getView()->setState(DRAG);
846 cont->getModel()->notifyObservers(_idManager);
849 } // if _selectedObjects.size
855 //=========================================================================
857 bool wxVtkSceneManager::OnLeftButtonUp() {
858 if (_worldState == DRAG_OBJECTS) {
859 _worldState = NOTHING_HAPPENS;
861 for (int i = 0; i < (int) _selectedObjects.size(); i++) {
862 int id = _selectedObjects[i];
863 GObjectController* cont = _controllers[id];
864 cont->getView()->setState(SELECTED);
865 cont->getModel()->notifyObservers(_idManager);
871 //=========================================================================
872 void wxVtkSceneManager::CancelConnection() {
873 if (_worldState == INIT_CREATION_CONTOUR) {
874 _worldState = NOTHING_HAPPENS;
875 //int lastId = _controllers.size()-1;
877 GConnectorController *connector =
878 (GConnectorController*) _controllers[_idConnectionInCreation];
879 connector->removeFromScene();
880 unregisterController(connector);
881 _controllers.erase(_idConnectionInCreation);
883 std::map<int, GObjectController*>::iterator it;
884 for (it = _controllers.begin(); it != _controllers.end(); ++it) {
885 GObjectController *desc = it->second;
886 desc->SetActive(true);
887 desc->getView()->setState(NOTHING_HAPPENS);
888 desc->getModel()->notifyObservers(_idManager);
893 //=========================================================================
895 bool wxVtkSceneManager::OnRightButtonUp() {
896 if (_worldState == INIT_CREATION_CONTOUR) {
899 UnSelectBlackBoxes();
903 //=========================================================================
905 GObjectController *wxVtkSceneManager::GetGBlackBoxControlerPointedByMouse() {
906 GObjectController *result = NULL;
908 wxVTKRenderWindowInteractor *wxVTKiren;
910 = _vtkInteractorStyleBaseView->GetWxVtk3DBaseView()->GetWxVTKRenderWindowInteractor();
911 wxVTKiren->GetEventPosition(X, Y);
913 std::map<int, GObjectController*>::iterator it;
915 for (it = _controllers.begin(); it != _controllers.end(); ++it) {
916 GObjectController *cont = it->second;
917 int type = cont->getGObjectType();
919 if (cont->getView()->isPointInside(X, Y) == true) {
920 if (type == GBLACKBOX) {
923 } // if isPointInside
928 //=========================================================================
929 void wxVtkSceneManager::UnSelectBlackBoxes() {
930 for (int i = 0; i < (int) _selectedObjects.size(); i++) {
931 int id = _selectedObjects[i];
932 GObjectController* control = _controllers[id];
933 control->getView()->setState(NOTHING_HAPPENS);
934 }// for _selectedObjects
935 _selectedObjects.clear();
938 //=========================================================================
939 bool wxVtkSceneManager::OnLeftDClick() {
940 GObjectController *cont = GetGBlackBoxControlerPointedByMouse();
942 UnSelectBlackBoxes();
943 _parent->editBlackBox((GBlackBoxModel*) cont->getModel());
949 wxVTKRenderWindowInteractor *wxVTKiren;
950 wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk3DBaseView()->GetWxVTKRenderWindowInteractor();
951 wxVTKiren->GetEventPosition(X,Y);
953 std::map<int, GObjectController*>::iterator it;
955 bool clickOnObject = false;
957 for(it = _controllers.begin(); it != _controllers.end() && clickOnObject==false; ++it)
959 GObjectController *cont = it->second;
960 int type = cont->getGObjectType();
962 if(cont->getView()->isPointInside(X,Y))
966 for (int i=0; i< (int)_selectedObjects.size(); i++)
968 int id = _selectedObjects[i];
969 GObjectController* control = _controllers[id];
970 control->getView()->setState(NOTHING_HAPPENS);
972 _selectedObjects.clear();
974 GBlackBoxModel *bbmodel = (GBlackBoxModel*)cont->getModel();
975 _parent->editBlackBox(bbmodel);
977 clickOnObject = true;
981 if(clickOnObject==false)
983 //_parent->editDiagramParameters(this);
989 //=========================================================================
991 bool wxVtkSceneManager::OnChar() {
992 char keyCode = _vtkInteractorStyleBaseView->GetInteractor()-> GetKeyCode();
994 // KeyCode 127 : Delete Key
995 // KeyCode 8 : Backspace Key
996 if (keyCode == 8 || keyCode == 127) {
997 if (_selectedObjects.size() > 0) {
998 for (int i = 0; i < (int) _selectedObjects.size(); i++) {
999 int id = _selectedObjects[i];
1000 std::map<int, GObjectController*>::iterator it;
1001 it = _controllers.find(id);
1002 if (it != _controllers.end()) {
1006 _selectedObjects.clear();
1013 //=========================================================================
1015 void wxVtkSceneManager::AddControlerToBeRemove(
1016 std::vector<int> *controllersToRemove, int id) {
1020 for (i = 0; i < (int) controllersToRemove->size(); i++) {
1021 if (id == (*controllersToRemove)[i]) {
1027 controllersToRemove->push_back(id);
1032 //=========================================================================
1034 void wxVtkSceneManager::deleteObject(int id) {
1035 GObjectController *control = _controllers[id];
1036 std::vector<int> controllersToRemove;
1038 if (control->getGObjectType() == GBLACKBOX || control->getGObjectType()
1039 == GCOMPLEXINPUTPORT || control->getGObjectType()
1040 == GCOMPLEXOUTPUTPORT) {
1041 GBoxModel *bbmod = (GBoxModel*) control->getModel();
1042 std::vector<GPortModel*> inputs = bbmod->getInputPorts();
1044 bool boxConnected = false;
1046 // Add box input controllers to be removed
1047 for (int i = 0; i < (int) inputs.size(); i++) {
1048 AddControlerToBeRemove(&controllersToRemove,
1049 inputs[i]->getObjectId());
1050 if (inputs[i]->isConnected()) {
1051 boxConnected = true;
1055 std::vector<GPortModel*> outputs = bbmod->getOutputPorts();
1057 // Add box output controllers to be removed
1058 for (int i = 0; i < (int) outputs.size(); i++) {
1059 AddControlerToBeRemove(&controllersToRemove,
1060 outputs[i]->getObjectId());
1061 if (outputs[i]->isConnected()) {
1062 boxConnected = true;
1066 // Add connection controllers to be removed
1067 std::map<int, GObjectController*>::iterator it;
1068 for (it = _controllers.begin(); it != _controllers.end(); ++it) {
1069 GObjectController *cont = it->second;
1070 int type = cont->getGObjectType();
1071 if (type == GCONNECTOR) {
1072 GConnectorModel *conMod = (GConnectorModel*) cont->getModel();
1073 if (conMod->getStartPort() != NULL
1074 && conMod->getStartPort()->getParentBox()->getObjectId()
1075 == bbmod->getObjectId()) {
1076 AddControlerToBeRemove(&controllersToRemove,
1077 conMod->getObjectId());
1079 if (conMod->getEndPort() != NULL
1080 && conMod->getEndPort()->getParentBox()->getObjectId()
1081 == bbmod->getObjectId()) {
1082 AddControlerToBeRemove(&controllersToRemove,
1083 conMod->getObjectId());
1088 // Add box controller to be removed
1089 AddControlerToBeRemove(&controllersToRemove, bbmod->getObjectId());
1090 } else if (control->getGObjectType() == GCONNECTOR) {
1091 GConnectorModel *conMod = (GConnectorModel*) control->getModel();
1092 AddControlerToBeRemove(&controllersToRemove, conMod->getObjectId());
1095 std::map<int, GObjectController*>::iterator it;
1097 for (int i = 0; i < (int) controllersToRemove.size(); i++) {
1098 int key = controllersToRemove[i];
1099 it = _controllers.find(key);
1100 GObjectController *cont = _controllers[key];
1102 cont->removeFromScene();
1103 unregisterController((InteractorStyleMaracas*) cont);
1104 _controllers.erase(it);
1109 //=========================================================================
1111 void wxVtkSceneManager::displayBlackBoxInfo(std::string packageName,
1112 std::string boxName) {
1113 _parent->displayBlackBoxInfo(packageName, boxName);
1116 //=========================================================================
1118 void wxVtkSceneManager::updateStatusBar(std::string textStatus) {
1119 _parent->updateStatusBar(textStatus);
1122 //=========================================================================
1123 std::string wxVtkSceneManager::LineNumber(bool withLineNumber, int &value) {
1124 std::string result = "";
1125 if (withLineNumber == true) {
1127 stringstream StrStream;
1129 std::string strValue = StrStream.str();
1132 } else if (value < 100) {
1136 result += strValue + ": ";
1140 //=========================================================================
1142 bool wxVtkSceneManager::MakeBoxExecutable() {
1143 std::map<int, GObjectController*> selected = getSelectedObjects();
1145 std::map<int, GObjectController*>::iterator it = selected.end();
1147 GObjectController* lastSelected = it->second;
1148 //GObjectController* lastSelected = selected[selected.size()-1];
1151 vtkGObjectView* view = (vtkGObjectView*) lastSelected->getView();
1152 GBlackBoxModel *bbmodel = (GBlackBoxModel*) lastSelected->getModel();
1153 view->setState(HIGHLIGHTED);
1154 if (bbmodel->isExecutable()) {
1155 bbmodel->setExecutable(false);
1157 bbmodel->setExecutable(true);
1159 bbmodel->notifyObservers(lastSelected->getId());
1167 //=========================================================================
1169 std::string wxVtkSceneManager::getDiagramBBS(bool wln) {
1170 bool existsExec = false;
1172 std::vector<std::string> packages;
1173 std::vector<int> boxes;
1174 std::vector<int> connections;
1175 std::vector<int> execBoxes;
1177 std::map<int, GObjectController*>::iterator it;
1179 for (it = _controllers.begin(); it != _controllers.end(); ++it) {
1180 GObjectController *desc = it->second;
1181 int type = desc->getGObjectType();
1183 if (type == GBLACKBOX) {
1184 GBlackBoxModel *mod = (GBlackBoxModel*) desc->getModel();
1186 std::string pkg = mod->getBBTKPackage();
1187 bool existsPkg = false;
1188 for (int t = 0; t < (int) packages.size() && existsPkg == false; t++) {
1189 if (packages[t] == pkg) {
1194 packages.push_back(pkg);
1197 boxes.push_back(it->first);
1198 if (mod->isExecutable()) {
1199 execBoxes.push_back(it->first);
1202 } else if (type == GCONNECTOR) {
1203 connections.push_back(it->first);
1208 std::string script = "";
1209 script += LineNumber(wln, lnNmbr) + "# BBTK GEditor Script\n";
1210 script += LineNumber(wln, lnNmbr) + "# ----------------------\n";
1211 script += LineNumber(wln, lnNmbr) + "\n";
1213 script += LineNumber(wln, lnNmbr) + "include std\n"; // EED
1214 script += LineNumber(wln, lnNmbr) + "include itkvtk\n"; // EED
1216 for (i = 0; i < (int) packages.size(); i++) {
1217 script += LineNumber(wln, lnNmbr);
1218 script += "include ";
1219 script += packages[i];
1223 script += LineNumber(wln, lnNmbr);
1228 script += LineNumber(wln, lnNmbr);
1229 script += "author \"";
1233 script += LineNumber(wln, lnNmbr);
1234 script += "description \"";
1235 script += _Description;
1238 script += LineNumber(wln, lnNmbr);
1239 script += "category \"";
1240 script += _Category;
1243 script += LineNumber(wln, lnNmbr);
1246 // script+="include std\n"; // JPR
1248 for (i = 0; i < (int) boxes.size(); i++) {
1249 script += LineNumber(wln, lnNmbr);
1252 GObjectController *control = _controllers[id];
1253 GBlackBoxModel *model = (GBlackBoxModel*) control->getModel();
1255 script += model->getBBTKType();
1257 script += model->getBBTKName();
1260 std::vector<GPortModel*> inputs = model->getInputPorts();
1261 for (int j = 0; j < (int) inputs.size(); j++) {
1262 GPortModel* inputPort = inputs[j];
1263 if (inputPort->isValueSet()) {
1264 script += LineNumber(wln, lnNmbr);
1266 script += model->getBBTKName();
1268 script += inputPort->getBBTKName();
1270 script += inputPort->getValue();
1275 script += LineNumber(wln, lnNmbr);
1280 script += LineNumber(wln, lnNmbr);
1283 for (i = 0; i < (int) connections.size(); i++) {
1284 script += LineNumber(wln, lnNmbr);
1285 script += "connect ";
1286 int id = connections[i];
1287 GObjectController *control = _controllers[id];
1288 GConnectorModel *model = (GConnectorModel*) control->getModel();
1290 //Start Connection info
1291 GPortModel *start = model->getStartPort();
1292 script += start->getParentBox()->getBBTKName();
1294 script += start->getBBTKName();
1298 //End Connection info
1299 GPortModel *end = model->getEndPort();
1300 script += end->getParentBox()->getBBTKName();
1302 script += end->getBBTKName();
1307 script += LineNumber(wln, lnNmbr);
1309 for (i = 0; i < (int) execBoxes.size(); i++) {
1310 script += LineNumber(wln, lnNmbr);
1312 int id = execBoxes[i];
1313 GObjectController *control = _controllers[id];
1314 GBlackBoxModel *model = (GBlackBoxModel*) control->getModel();
1316 script += model->getBBTKName();
1325 //=========================================================================
1327 std::string wxVtkSceneManager::saveComplexBoxBBS() {
1328 std::vector<std::string> packages;
1329 std::vector<int> boxes;
1330 std::vector<int> connections;
1331 std::vector<int> execBoxes;
1333 std::map<int, GObjectController*>::iterator it;
1335 for (it = _controllers.begin(); it != _controllers.end(); ++it) {
1336 GObjectController *desc = it->second;
1337 int type = desc->getGObjectType();
1339 if (type == GBLACKBOX) {
1340 GBlackBoxModel *mod = (GBlackBoxModel*) desc->getModel();
1342 std::string pkg = mod->getBBTKPackage();
1343 bool existsPkg = false;
1344 for (int t = 0; t < (int) packages.size() && existsPkg == false; t++) {
1345 if (packages[t] == pkg) {
1350 packages.push_back(pkg);
1353 boxes.push_back(it->first);
1354 if (mod->isExecutable()) {
1355 execBoxes.push_back(it->first);
1357 } else if (type == GCONNECTOR) {
1358 connections.push_back(it->first);
1362 std::string script = "";
1364 script += "include std\n"; // EED
1365 script += "include itkvtk\n"; // EED
1367 for (i = 0; i < (int) packages.size(); i++) {
1368 script += "include ";
1369 script += packages[i];
1374 // Definition of a complex box
1375 script += "define ";
1376 script += _cbName + " " + _cbPackageName;
1380 script += "author \"";
1384 script += "description \"";
1385 script += _Description;
1389 script += "category \"";
1390 script += _Category;
1395 for (i = 0; i < (int) boxes.size(); i++) {
1398 GObjectController *control = _controllers[id];
1399 GBlackBoxModel *model = (GBlackBoxModel*) control->getModel();
1401 script += model->getBBTKType();
1403 script += model->getBBTKName();
1406 std::vector<GPortModel*> inputs = model->getInputPorts();
1407 for (int j = 0; j < (int) inputs.size(); j++) {
1408 GPortModel* inputPort = inputs[j];
1409 if (inputPort->isValueSet()) {
1411 script += model->getBBTKName();
1413 script += inputPort->getBBTKName();
1415 script += inputPort->getValue();
1423 // Create connections in the script. If the connection is made with a complex port, it is created the input or output
1425 std::string complexInputs = "";
1426 std::string complexOutputs = "";
1429 for (i = 0; i < (int) connections.size(); i++) {
1430 int id = connections[i];
1431 GObjectController *control = _controllers[id];
1432 GConnectorModel *model = (GConnectorModel*) control->getModel();
1435 GPortModel *start = model->getStartPort();
1436 GBoxModel *startBox = start->getParentBox();
1438 GPortModel *end = model->getEndPort();
1439 GBoxModel *endBox = end->getParentBox();
1441 if (startBox->getGObjectType() == GCOMPLEXINPUTPORT) {
1442 complexInputs += "input ";
1443 complexInputs += startBox->getBBTKName();
1445 complexInputs += " ";
1446 complexInputs += endBox->getBBTKName();
1447 complexInputs += ".";
1448 complexInputs += end->getBBTKName();
1450 complexInputs += " ";
1451 complexInputs += "\" \"";
1453 complexInputs += "\n";
1454 } else if (endBox->getGObjectType() == GCOMPLEXOUTPUTPORT) {
1455 complexOutputs += "output ";
1456 complexOutputs += endBox->getBBTKName();
1458 complexOutputs += " ";
1459 complexOutputs += startBox->getBBTKName();
1460 complexOutputs += ".";
1461 complexOutputs += start->getBBTKName();
1463 complexOutputs += " ";
1464 complexOutputs += "\" \"";
1466 complexOutputs += "\n";
1468 script += "connect ";
1469 script += startBox->getBBTKName();
1471 script += start->getBBTKName();
1475 //End Connection info
1476 script += endBox->getBBTKName();
1478 script += end->getBBTKName();
1486 for (i = 0; i < (int) execBoxes.size(); i++) {
1488 int id = execBoxes[i];
1489 GObjectController *control = _controllers[id];
1490 GBlackBoxModel *model = (GBlackBoxModel*) control->getModel();
1492 script += model->getBBTKName();
1497 script += "# Complex input ports\n";
1498 script += complexInputs;
1501 script += "# Complex output ports\n";
1502 script += complexOutputs;
1505 script += "endefine";
1511 //=========================================================================
1513 void wxVtkSceneManager::deleteAllBoxes() {
1514 std::map<int, GObjectController*>::iterator it;
1515 for (it = _controllers.begin(); it != _controllers.end(); ++it) {
1516 GObjectController *cont = it->second;
1517 cont->removeFromScene();
1518 unregisterController((InteractorStyleMaracas*) cont);
1520 _selectedObjects.clear();
1521 _controllers.clear();
1525 //=========================================================================
1528 void wxVtkSceneManager::refresh() {
1529 _baseView->Refresh();
1531 //=========================================================================
1533 void wxVtkSceneManager::refreshScene() {
1534 _baseView->RefreshView();
1537 //=========================================================================
1539 void wxVtkSceneManager::centerView() {
1541 _baseView->GetRenderer()->GetActiveCamera()->GetFocalPoint(temp);
1542 _baseView->GetRenderer()->GetActiveCamera()->SetFocalPoint(0, 0, temp[2]);
1543 _baseView->GetRenderer()->GetActiveCamera()->GetPosition(temp);
1544 _baseView->GetRenderer()->GetActiveCamera()->SetPosition(0, 0, temp[2]);
1545 _baseView->RefreshView();
1549 //=========================================================================
1551 void wxVtkSceneManager::saveDiagram(std::string &content) {
1554 content += "CATEGORY:";
1555 content += GetCategory();
1558 content += "DESCRIPTION:";
1559 content += GetDescription();
1562 content += "AUTHOR:";
1563 content += GetAuthor();
1566 //Print info IF COMPLEX BOX
1567 content += "COMPLEXBOX:";
1568 if (_isComplexBox) {
1569 content += "TRUE\n";
1571 content += "COMPLEXBOXNAME:";
1572 content += GetCbName();
1575 content += "PACKAGENAME:";
1576 content += GetCbPackageName();
1579 //Print info complex input ports
1580 std::vector<int> inputs = getComplexInputPorts();
1581 int insize = inputs.size();
1582 content += "COMPLEXINPUTS:";
1583 sprintf(buffer, "%d", insize);
1587 for (int i = 0; i < insize; i++) {
1589 GObjectController *cont = _controllers[id];
1590 cont->getModel()->save(content);
1593 //Print info complex output ports
1594 std::vector<int> outputs = getComplexOutputPorts();
1595 int outsize = outputs.size();
1596 content += "COMPLEXOUTPUTS:";
1597 sprintf(buffer, "%d", outsize);
1601 for (int i = 0; i < outsize; i++) {
1602 int id = outputs[i];
1603 GObjectController *cont = _controllers[id];
1604 cont->getModel()->save(content);
1608 content += "FALSE\n";
1612 std::vector<int> boxes = getBlackBoxes();
1613 int bsize = boxes.size();
1614 content += "BOXES:";
1615 sprintf(buffer, "%d", bsize);
1619 for (int i = 0; i < bsize; i++) {
1621 GObjectController *cont = _controllers[id];
1622 cont->getModel()->save(content);
1626 std::vector<int> connections = getConnections();
1627 int csize = connections.size();
1628 content += "CONNECTIONS:";
1629 sprintf(buffer, "%d", csize);
1633 for (int i = 0; i < csize; i++) {
1634 int id = connections[i];
1635 GObjectController *cont = _controllers[id];
1636 cont->getModel()->save(content);
1641 //=========================================================================
1643 void wxVtkSceneManager::loadDiagram(ifstream &inputStream) {
1645 std::string version = "<void>";
1646 std::string line = "";
1647 char delims[] = ":";
1648 char *result = NULL;
1649 getline(inputStream, line);
1652 while (!inputStream.eof()) {
1653 if (line == "" || line[0] == '#') {
1654 getline(inputStream, line);
1655 if (line == "# - BBTKGEditor v 1.0 BBG BlackBox Diagram file") {
1656 version = line.substr(18, 3);
1658 if (line == "# - BBTKGEditor v 1.1 BBG BlackBox Diagram file") {
1659 version = line.substr(18, 3);
1661 if (line == "# - BBTKGEditor v 1.2 BBG BlackBox Diagram file") {
1662 version = line.substr(18, 3);
1664 } else if (line == "APP_START") {
1670 printf("EED wxVtkSceneManager::loadDiagram version=%s\n", version.c_str());
1674 if ((version != "1.0") && (version != "1.1")) {
1675 getline(inputStream, line);//CATEGORY:<category of the box>
1676 char categoryTmp[30];
1677 strcpy(categoryTmp, line.c_str());
1678 result = strtok(categoryTmp, delims);
1679 result = strtok(NULL, delims);
1680 SetCategory(result);
1682 getline(inputStream, line);//DESCRIPTION:<description of the box>
1683 char descriptionTmp[1024];
1684 strcpy(descriptionTmp, line.c_str());
1685 result = strtok(descriptionTmp, delims);
1686 result = strtok(NULL, delims);
1687 SetDescription(result);
1689 getline(inputStream, line);//AUTHOR:<author>
1690 char authorTmp[255];
1691 strcpy(authorTmp, line.c_str());
1692 result = strtok(authorTmp, delims);
1693 result = strtok(NULL, delims);
1698 getline(inputStream, line);//COMPLEX_BOX:TRUE|FALSE
1699 char complexTmp[30];
1700 strcpy(complexTmp, line.c_str());
1701 result = strtok(complexTmp, delims);
1702 result = strtok(NULL, delims);
1703 std::string isComplexBox(result);
1705 if (isComplexBox == "TRUE") {
1706 _isComplexBox = true;
1708 if ((version != "1.0") && (version != "1.1")) {
1709 getline(inputStream, line);//COMPLEXNAME:<name of the complex box>
1710 char complexboxnameTmp[255];
1711 strcpy(complexboxnameTmp, line.c_str());
1712 result = strtok(complexboxnameTmp, delims);
1713 result = strtok(NULL, delims);
1716 getline(inputStream, line);//PACKAGENAME:<name of the package of the box>
1717 char packagenameTmp[255];
1718 strcpy(packagenameTmp, line.c_str());
1719 result = strtok(packagenameTmp, delims);
1720 result = strtok(NULL, delims);
1721 SetCbPackageName(result);
1724 //-----------------------
1725 //- COMPLEX INPUT PORTS
1726 //-----------------------
1727 getline(inputStream, line);//COMPLEXINPUTS:num
1729 strcpy(inputs, line.c_str());
1730 result = strtok(inputs, delims);
1731 result = strtok(NULL, delims);
1734 std::istringstream inps(result);
1737 for (int i = 0; i < numInputs; i++) {
1739 getline(inputStream, line);//COMPLEX_PORT
1740 getline(inputStream, line);//name
1741 std::string inputPortName(line);
1744 getline(inputStream, line);//xInic:yInic:zInic
1746 strcpy(coord, line.c_str());
1747 result = strtok(coord, delims);//xInic
1748 std::string xInic(result);
1749 result = strtok(NULL, delims);//yInic
1750 std::string yInic(result);
1751 result = strtok(NULL, delims);//zInic
1752 std::string zInic(result);
1754 double xIn, yIn, zIn;
1755 std::istringstream xSt(xInic);
1757 std::istringstream ySt(yInic);
1759 std::istringstream zSt(zInic);
1762 getline(inputStream, line);//FIN_COMPLEX_PORT
1764 configGComBoxInputOutputPort(true, inputPortName, xIn, yIn, zIn);
1766 } // for input complex box
1769 //-----------------------
1770 //- COMPLEX OUTPUT PORTS
1771 //-----------------------
1773 getline(inputStream, line);//COMPLEXOUTPUTS:num
1775 strcpy(outputs, line.c_str());
1776 result = strtok(outputs, delims);
1777 result = strtok(NULL, delims);
1780 std::istringstream outps(result);
1781 outps >> numOutputs;
1783 for (int i = 0; i < numOutputs; i++) {
1785 getline(inputStream, line);//COMPLEX_PORT
1786 getline(inputStream, line);//name
1787 std::string outputPortName(line);
1790 getline(inputStream, line);//xInic:yInic:zInic
1792 strcpy(coord, line.c_str());
1793 result = strtok(coord, delims);//xInic
1794 std::string xInic(result);
1795 result = strtok(NULL, delims);//yInic
1796 std::string yInic(result);
1797 result = strtok(NULL, delims);//zInic
1798 std::string zInic(result);
1800 double xIn, yIn, zIn;
1801 std::istringstream xSt(xInic);
1803 std::istringstream ySt(yInic);
1805 std::istringstream zSt(zInic);
1808 getline(inputStream, line);//FIN_COMPLEX_PORT
1810 configGComBoxInputOutputPort(false, outputPortName, xIn, yIn,
1813 } // for output complex box
1818 getline(inputStream, line);//BOXES:num
1820 strcpy(boxes, line.c_str());
1821 result = strtok(boxes, delims);
1822 result = strtok(NULL, delims);
1825 std::istringstream is(result);
1828 for (int i = 0; i < numBoxes; i++) {
1830 getline(inputStream, line);//BOX
1831 getline(inputStream, line);//package:type:name
1833 strcpy(box, line.c_str());
1834 result = strtok(box, delims);//package
1835 std::string package(result);
1836 result = strtok(NULL, delims);//type
1837 std::string type(result);
1838 result = strtok(NULL, delims);//name
1839 std::string name(result);
1841 getline(inputStream, line);//ISEXEC:TRUE|FALSE
1843 strcpy(exec, line.c_str());
1844 result = strtok(exec, delims);//ISEXEC
1845 result = strtok(NULL, delims);//TRUE|FALSE
1846 std::string isExec(result);
1849 getline(inputStream, line);//xInic:yInic:zInic
1851 strcpy(coord, line.c_str());
1852 result = strtok(coord, delims);//xInic
1853 std::string xInic(result);
1854 result = strtok(NULL, delims);//yInic
1855 std::string yInic(result);
1856 result = strtok(NULL, delims);//zInic
1857 std::string zInic(result);
1859 double xIn, yIn, zIn;
1860 std::istringstream xSt(xInic);
1862 std::istringstream ySt(yInic);
1864 std::istringstream zSt(zInic);
1868 getline(inputStream, line);//xEnd:yEnd:zEnd
1869 strcpy(coord, line.c_str());
1870 result = strtok(coord, delims);//xEnd
1871 std::string xEnd(result);
1872 result = strtok(NULL, delims);//yEnd
1873 std::string yEnd(result);
1874 result = strtok(NULL, delims);//zEnd
1875 std::string zEnd(result);
1877 double xEn, yEn, zEn;
1878 std::istringstream xEt(xEnd);
1880 std::istringstream yEt(yEnd);
1882 std::istringstream zEt(zEnd);
1885 bool boxExecutable = false;
1886 if (isExec == "TRUE") {
1887 boxExecutable = true;
1890 int idBox = createGBlackBox(xIn, yIn, package, type);
1891 configGBlackBox(idBox, xIn, yIn, zIn, name, boxExecutable, xEn,
1894 GObjectController *cont = _controllers[idBox];
1895 GBlackBoxModel *bbmod = (GBlackBoxModel*) cont->getModel();
1898 getline(inputStream, line);//PORT o FIN_BOX
1899 std::string port = line.substr(0, 4);
1900 while (port == "PORT") {
1901 getline(inputStream, line);//name:value
1903 strcpy(poort, line.c_str());
1904 result = strtok(poort, delims);//name
1905 std::string name(result);
1906 result = strtok(NULL, delims);//value
1907 std::string value(result);
1909 bbmod->setValueToInput(name, value);
1911 getline(inputStream, line);//PORT o FIN_BOX
1912 port = line.substr(0, 4);
1915 //EED bbmod->notifyObservers(_idManager);
1920 getline(inputStream, line);//CONNECTIONS:num
1922 strcpy(conns, line.c_str());
1923 result = strtok(conns, delims);
1924 result = strtok(NULL, delims);
1927 std::istringstream isCons(result);
1930 for (int i = 0; i < numConns; i++) {
1932 getline(inputStream, line);//CONNECTION
1933 getline(inputStream, line);//Startbox.PortName:EndBox.PortName
1936 strcpy(connec, line.c_str());
1937 result = strtok(connec, delims);
1938 std::string nameStartBox(result);
1939 result = strtok(NULL, delims);
1940 std::string nameStartPort(result);
1941 result = strtok(NULL, delims);
1942 std::string nameEndBox(result);
1943 result = strtok(NULL, delims);
1944 std::string nameEndPort(result);
1946 int idCon = configGConnetion(nameStartBox, nameStartPort,
1947 nameEndBox, nameEndPort);
1949 if (version != "1.0") {
1950 //Readding control points of the manualContour
1952 GConnectorController *tempp =
1953 (GConnectorController*) _controllers[idCon];
1954 GConnectorModel *conMod = (GConnectorModel*) tempp->getModel();
1955 vtkGConnectorView *conView =
1956 (vtkGConnectorView*) tempp->getView();
1957 getline(inputStream, line); //NumberOfControlPoints:##
1958 strcpy(conns, line.c_str());
1959 result = strtok(conns, delims);
1960 result = strtok(NULL, delims);
1962 int numberOfControlPoints;
1963 std::istringstream isCons(result);
1964 isCons >> numberOfControlPoints;
1966 for (int ii = 0; ii < numberOfControlPoints; ii++) {
1967 getline(inputStream, line); //XX:YY:ZZ
1969 strcpy(connec, line.c_str());
1972 result = strtok(connec, delims);
1973 std::istringstream isPointX(result);
1975 result = strtok(NULL, delims);
1976 std::istringstream isPointY(result);
1978 result = strtok(NULL, delims);
1979 std::istringstream isPointZ(result);
1982 conMod->getManualContourModel()->InsertPoint_id(ii + 1, px,
1984 conView->getManualContourView()->AddPoint();
1994 //=========================================================================
1997 //=========================================================================
1998 void wxVtkSceneManager::configGComBoxInputOutputPort(bool inputoutput,
1999 std::string portName, double xIn, double yIn, double zIn) {
2001 if (inputoutput == true) {
2002 idPort = createGComplexBoxInputPort(portName);
2004 idPort = createGComplexBoxOutputPort(portName);
2006 GObjectController *cont = _controllers[idPort];
2007 GBoxModel *cbmod = (GBoxModel*) cont->getModel();
2008 cbmod->setInicPoint(xIn, yIn, zIn);
2009 cbmod->notifyObservers(_idManager);
2011 //=========================================================================
2014 //=========================================================================
2015 GBoxModel* wxVtkSceneManager::findGBox(std::string boxname) {
2019 GBoxModel *boxModel = NULL;
2020 std::vector<int> lstB = getBlackBoxes();
2021 for (j = 0; j < (int) lstB.size(); j++) {
2023 bMod = (GBoxModel*) _controllers[idB]->getModel();
2024 if (_controllers[idB]->getModel()->getBBTKName() == boxname) {
2029 if ((_isComplexBox) && (boxModel == NULL)) {
2030 std::vector<int> lstInputs = getComplexInputPorts();
2031 for (j = 0; j < (int) lstInputs.size(); j++) {
2033 bMod = (GBoxModel*) _controllers[idB]->getModel();
2034 if (_controllers[idB]->getModel()->getBBTKName() == boxname) {
2039 std::vector<int> lstOutputs = getComplexOutputPorts();
2040 for (j = 0; j < (int) lstOutputs.size(); j++) {
2041 int idB = lstOutputs[j];
2042 bMod = (GBoxModel*) _controllers[idB]->getModel();
2043 if (_controllers[idB]->getModel()->getBBTKName() == boxname) {
2053 //=========================================================================
2056 int wxVtkSceneManager::configGConnetion(std::string nameStartBox,
2057 std::string nameStartPort, std::string nameEndBox,
2058 std::string nameEndPort) {
2060 GBoxModel *boxModel;
2061 GPortModel *startP = NULL;
2062 GPortModel *endP = NULL;
2064 boxModel = findGBox(nameStartBox);
2065 if (boxModel != NULL) {
2066 startP = boxModel->getOutputPort(nameStartPort);
2069 boxModel = findGBox(nameEndBox);
2070 if (boxModel != NULL) {
2071 endP = boxModel->getInputPort(nameEndPort);
2075 int idCon = createGConnector(startP);
2076 _worldState = NOTHING_HAPPENS;
2077 GConnectorController *tempp = (GConnectorController*) _controllers[idCon];
2079 GConnectorModel *conMod = (GConnectorModel*) tempp->getModel();
2080 vtkGConnectorView *conView = (vtkGConnectorView*) tempp->getView();
2081 tempp->endContourCreation();
2082 conMod->setEndPort(endP);
2083 conView->updateStartEndPoints();
2087 //=========================================================================
2089 bool wxVtkSceneManager::boxExist(std::string boxname) {
2091 std::map<int, GObjectController*>::iterator it;
2092 for (it = _controllers.begin(); it != _controllers.end(); ++it) {
2093 GObjectController *cont = it->second;
2094 if (cont->getModel()->getBBTKName() == boxname) {
2101 //=========================================================================
2103 std::vector<int> wxVtkSceneManager::getBlackBoxes() {
2104 std::vector<int> vect;
2105 std::map<int, GObjectController*>::iterator it;
2106 for (it = _controllers.begin(); it != _controllers.end(); ++it) {
2107 GObjectController *cont = it->second;
2108 if (cont->getGObjectType() == GBLACKBOX) {
2109 vect.push_back(cont->getId());
2115 //=========================================================================
2117 std::vector<int> wxVtkSceneManager::getComplexInputPorts() {
2118 std::vector<int> vect;
2119 std::map<int, GObjectController*>::iterator it;
2120 for (it = _controllers.begin(); it != _controllers.end(); ++it) {
2121 GObjectController *cont = it->second;
2122 if (cont->getGObjectType() == GCOMPLEXINPUTPORT) {
2123 vect.push_back(cont->getId());
2129 //=========================================================================
2131 std::vector<int> wxVtkSceneManager::getComplexOutputPorts() {
2132 std::vector<int> vect;
2133 std::map<int, GObjectController*>::iterator it;
2134 for (it = _controllers.begin(); it != _controllers.end(); ++it) {
2135 GObjectController *cont = it->second;
2136 if (cont->getGObjectType() == GCOMPLEXOUTPUTPORT) {
2137 vect.push_back(cont->getId());
2143 //=========================================================================
2145 std::vector<int> wxVtkSceneManager::getConnections() {
2146 std::vector<int> vect;
2147 std::map<int, GObjectController*>::iterator it;
2148 for (it = _controllers.begin(); it != _controllers.end(); ++it) {
2149 GObjectController *cont = it->second;
2150 if (cont->getGObjectType() == GCONNECTOR) {
2151 vect.push_back(cont->getId());
2157 //=========================================================================
2159 bool wxVtkSceneManager::isComplexBox() {
2160 return _isComplexBox;
2163 //=========================================================================
2165 void wxVtkSceneManager::setComplexBox(bool val) {
2166 _isComplexBox = val;
2169 //=========================================================================
2171 int wxVtkSceneManager::addObjectController(GObjectController* objController) {
2172 //Register the controller of the new object
2173 registerController((InteractorStyleMaracas*) objController);
2174 //Add the object to the objects list
2175 int newId = _contLastId;//_controllers.size();
2176 objController->setId(newId);
2177 _controllers[newId] = objController;
2179 << "DFCH: int wxVtkSceneManager::addObjectController(GObjectController* objController) ---- _contLastId = "
2180 << _contLastId << std::endl;
2185 //=========================================================================
2187 int wxVtkSceneManager::getNumSelectedObjects() {
2188 return _selectedObjects.size();
2191 //=========================================================================
2193 std::map<int, GObjectController*> wxVtkSceneManager::getSelectedObjects() {
2194 std::map<int, GObjectController*> mapSelected;
2196 std::map<int, GObjectController*>::iterator it;
2197 for (it = _controllers.begin(); it != _controllers.end(); ++it) {
2198 GObjectController *cont = it->second;
2199 if (cont->getGObjectType() == GBLACKBOX && cont->getView()->getState()
2201 mapSelected[cont->getId()] = cont;
2205 std::map<int, GObjectController*>::iterator it2;
2206 for (it2 = _controllers.begin(); it2 != _controllers.end(); ++it2) {
2207 GObjectController *cont = it2->second;
2208 if (cont->getGObjectType() == GCONNECTOR) {
2209 GConnectorModel* cmod = (GConnectorModel*) cont->getModel();
2210 GBoxModel* endPortParentBox = cmod->getEndPort()->getParentBox();
2211 GBoxModel* startPortParentBox =
2212 cmod->getStartPort()->getParentBox();
2214 std::map<int, GObjectController*>::iterator iterOBJ1 =
2215 mapSelected.find(startPortParentBox->getObjectId());
2216 std::map<int, GObjectController*>::iterator iterOBJ2 =
2217 mapSelected.find(endPortParentBox->getObjectId());
2219 if (iterOBJ1 != mapSelected.end() && iterOBJ2 != mapSelected.end()) {
2220 int ID = cont->getId();
2221 mapSelected[ID] = cont;
2228 //=========================================================================
2230 void wxVtkSceneManager::addObjects(std::map<int, GObjectController*> objectsMap) {
2232 std::map<int, int> oldIdNewIdBoxes;
2233 std::vector<int> connections;
2235 std::map<int, GObjectController*>::iterator it;
2236 for (it = objectsMap.begin(); it != objectsMap.end(); ++it) {
2237 GObjectController *cont = it->second;
2238 int type = cont->getGObjectType();
2240 if (type == GBLACKBOX) {
2242 double xInic, yInic, zInic;
2243 GBlackBoxModel* copyBox = (GBlackBoxModel*) cont->getModel();
2244 copyBox->getInicPoint(xInic, yInic, zInic);
2245 int idBox = createGBlackBox(0, 0, copyBox->getBBTKPackage(),
2246 copyBox->getBBTKType());
2248 int idcB = copyBox->getObjectId();
2249 oldIdNewIdBoxes[idcB] = idBox;
2250 cont = _controllers[idBox];
2251 GBlackBoxModel* newbox = (GBlackBoxModel*) cont->getModel();
2252 newbox->setInicPoint(xInic, yInic, zInic);
2253 int num = newbox->getNumInputPorts();
2254 for (int j = 0; j < num; j++) {
2255 newbox->setValueToInputPort(j, copyBox->getValueInputPort(j));
2257 newbox->notifyObservers(_idManager);
2258 } else if (type == GCONNECTOR) {
2259 int idCon = cont->getId();
2260 connections.push_back(idCon);
2265 for (int i = 0; i < (int) connections.size(); i++) {
2266 int objId = connections[i];
2267 GObjectController *cont = objectsMap[objId];
2268 GConnectorModel* connectModel = (GConnectorModel*) cont->getModel();
2270 GPortModel* startPort = connectModel->getStartPort();
2271 int startPortIndex = startPort->getPosInBox();
2272 GPortModel* endPort = connectModel->getEndPort();
2273 int endPortIndex = endPort->getPosInBox();
2275 GBlackBoxModel* startPortParentBox =
2276 (GBlackBoxModel*) startPort->getParentBox();
2277 GBlackBoxModel* endPortParentBox =
2278 (GBlackBoxModel*) endPort->getParentBox();
2280 int idNewStartBox = oldIdNewIdBoxes[startPortParentBox->getObjectId()];
2281 int idNewEndBox = oldIdNewIdBoxes[endPortParentBox->getObjectId()];
2283 GBlackBoxModel* newStartBox =
2284 (GBlackBoxModel*) _controllers[idNewStartBox]->getModel();
2285 GBlackBoxModel* newEndBox =
2286 (GBlackBoxModel*) _controllers[idNewEndBox]->getModel();
2288 GPortModel* newStartPort = newStartBox->getOutputPort(startPortIndex);
2289 GPortModel* newEndPort = newEndBox->getInputPort(endPortIndex);
2291 // Creates connection
2292 int idCon = createGConnector(newStartPort);
2293 GConnectorController *tempp =
2294 (GConnectorController*) _controllers[idCon];
2295 GConnectorModel *conMod = (GConnectorModel*) tempp->getModel();
2296 vtkGConnectorView *conView = (vtkGConnectorView*) tempp->getView();
2297 tempp->endContourCreation();
2298 conMod->setEndPort(newEndPort);
2299 conView->updateStartEndPoints();
2302 std::map<int, int>::iterator itIds;
2303 for (itIds = oldIdNewIdBoxes.begin(); itIds != oldIdNewIdBoxes.end(); ++itIds) {
2304 int idOld = itIds->first;
2305 int idNew = itIds->second;
2307 GBlackBoxModel* oldBox =
2308 (GBlackBoxModel*) objectsMap[idOld]->getModel();
2309 GBlackBoxModel* newBox =
2310 (GBlackBoxModel*) _controllers[idNew]->getModel();
2312 std::vector<int> oldInputConnections = oldBox->getConnectedInputs();
2313 std::vector<int> oldOutputConnections = oldBox->getConnectedOutputs();
2314 std::vector<int> newInputConnections = newBox->getConnectedInputs();
2315 std::vector<int> newOutputConnections = newBox->getConnectedOutputs();
2317 for (int k = 0; k < (int) oldInputConnections.size(); k++) {
2319 //EED int toCreate=-1;
2320 for (int l = 0; l < (int) newInputConnections.size() && !exist; l++) {
2321 if (oldInputConnections[k] == newInputConnections[l]) {
2326 if (exist == false) {
2327 //Create complex input
2328 int posInBox = oldInputConnections[k];
2329 GPortModel* inputPort = oldBox->getInputPort(posInBox);
2330 std::string inputPortName = inputPort->getBBTKName();
2331 int idInputPort = createGComplexBoxInputPort(inputPortName);
2332 GObjectController *cont = _controllers[idInputPort];
2333 GBoxModel *cbmod = (GBoxModel*) cont->getModel();
2334 double xIn, yIn, zIn;
2335 inputPort->getInicPoint(xIn, yIn, zIn);
2337 cbmod->setInicPoint(xIn, yIn, zIn);
2338 cbmod->notifyObservers(_idManager);
2340 GPortModel* inputPortEnd = newBox->getInputPort(posInBox);
2342 // Creates connection
2343 int idCon = createGConnector(cbmod->getOutputPort(0));
2344 GConnectorController *tempp =
2345 (GConnectorController*) _controllers[idCon];
2346 GConnectorModel *conMod = (GConnectorModel*) tempp->getModel();
2347 vtkGConnectorView *conView =
2348 (vtkGConnectorView*) tempp->getView();
2349 tempp->endContourCreation();
2350 conMod->setEndPort(inputPortEnd);
2351 conView->updateStartEndPoints();
2357 for (int k = 0; k < (int) oldOutputConnections.size(); k++) {
2359 //EED int toCreate=-1;
2360 for (int l = 0; l < (int) newOutputConnections.size() && !exist; l++) {
2361 if (oldOutputConnections[k] == newOutputConnections[l]) {
2366 if (exist == false) {
2367 //Create complex output
2368 int posInBox = oldOutputConnections[k];
2369 GPortModel* outputPort = oldBox->getOutputPort(posInBox);
2370 std::string outputPortName = outputPort->getBBTKName();
2371 int idOutputPort = createGComplexBoxOutputPort(outputPortName);
2372 GObjectController *cont = _controllers[idOutputPort];
2373 GBoxModel *cbmod = (GBoxModel*) cont->getModel();
2374 double xIn, yIn, zIn;
2375 outputPort->getInicPoint(xIn, yIn, zIn);
2377 cbmod->setInicPoint(xIn, yIn, zIn);
2378 cbmod->notifyObservers(_idManager);
2380 GPortModel* outputPortEnd = newBox->getOutputPort(posInBox);
2382 // Creates connection
2383 int idCon = createGConnector(outputPortEnd);
2384 GConnectorController *tempp =
2385 (GConnectorController*) _controllers[idCon];
2386 GConnectorModel *conMod = (GConnectorModel*) tempp->getModel();
2387 vtkGConnectorView *conView =
2388 (vtkGConnectorView*) tempp->getView();
2389 tempp->endContourCreation();
2390 conMod->setEndPort(cbmod->getInputPort(0));
2391 conView->updateStartEndPoints();
2401 //=========================================================================
2402 void wxVtkSceneManager::SetCbName(std::string cbName) {
2404 if (_cbName == "") {
2405 _cbName = "<complex box name>";
2409 //=========================================================================
2410 std::string wxVtkSceneManager::GetCbName() {
2414 //=========================================================================
2415 void wxVtkSceneManager::SetCbPackageName(std::string packagename) {
2416 _cbPackageName = packagename;
2417 if (_cbPackageName == "") {
2418 _cbPackageName = "<package name of the complex box>";
2422 //=========================================================================
2423 std::string wxVtkSceneManager::GetCbPackageName() {
2424 return _cbPackageName;
2427 //=========================================================================
2428 void wxVtkSceneManager::SetAuthor(std::string author) {
2430 if (_Author == "") {
2431 _Author = "<author of the box>";
2435 //=========================================================================
2436 std::string wxVtkSceneManager::GetAuthor() {
2440 //=========================================================================
2441 void wxVtkSceneManager::SetCategory(std::string category) {
2442 _Category = category;
2443 if (_Category == "") {
2444 _Category = "<category of the box>";
2448 //=========================================================================
2449 std::string wxVtkSceneManager::GetCategory() {
2453 //=========================================================================
2454 void wxVtkSceneManager::SetDescription(std::string description) {
2455 _Description = description;
2456 if (_Description == "") {
2457 _Description = "<description of the box>";
2461 //=========================================================================
2462 std::string wxVtkSceneManager::GetDescription() {
2463 return _Description;
2466 //=========================================================================
2469 } // EO namespace bbtk