From 56cbba59d070c955c4aab46e59908ab82f5e390d Mon Sep 17 00:00:00 2001 From: davila <> Date: Sun, 3 Oct 2010 11:42:12 +0000 Subject: [PATCH] *** empty log message *** --- .../bbsKernelEditorGraphic/GlobalConstants.h | 37 +- .../GBlackBoxController.cxx | 133 ++-- .../GBlackBoxController.h | 31 +- .../bbsVtkGUIEditorGraphic/GBoxController.cxx | 53 +- .../GConnectorController.cxx | 54 +- .../GObjectController.cxx | 51 +- .../GObjectController.h | 42 +- .../GPortController.cxx | 28 +- .../bbtkwxGUIEditorGraphicBBS.cxx | 174 ++--- .../wxBlackBoxEditionDialog.cxx | 78 +- .../wxGEditorTabPanel.cxx | 52 +- .../bbsWxGUIEditorGraphic/wxGEditorTabPanel.h | 40 +- .../wxTabPanelsManager.cxx | 58 +- .../wxTabPanelsManager.h | 41 +- .../wxVtkSceneManager.cxx | 665 +++++++++++------- .../bbsWxGUIEditorGraphic/wxVtkSceneManager.h | 48 +- 16 files changed, 904 insertions(+), 681 deletions(-) diff --git a/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GlobalConstants.h b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GlobalConstants.h index f03d48d..639485d 100644 --- a/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GlobalConstants.h +++ b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GlobalConstants.h @@ -1,4 +1,4 @@ -/*========================================================================= +/*========================================================================= Program: bbtk Module: $RCSfile$ Language: C++ @@ -11,22 +11,22 @@ Version: $Revision$ * Copyright (c) CREATIS-LRMN (Centre de Recherche en Imagerie Medicale) * Authors : Eduardo Davila, Laurent Guigues, Jean-Pierre Roux * -* This software is governed by the CeCILL-B license under French law and -* abiding by the rules of distribution of free software. You can use, -* modify and/ or redistribute the software under the terms of the CeCILL-B -* license as circulated by CEA, CNRS and INRIA at the following URL -* http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html +* This software is governed by the CeCILL-B license under French law and +* abiding by the rules of distribution of free software. You can use, +* modify and/ or redistribute the software under the terms of the CeCILL-B +* license as circulated by CEA, CNRS and INRIA at the following URL +* http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html * or in the file LICENSE.txt. * * As a counterpart to the access to the source code and rights to copy, * modify and redistribute granted by the license, users are provided only * with a limited warranty and the software's author, the holder of the * economic rights, and the successive licensors have only limited -* liability. +* liability. * * The fact that you are presently reading this means that you have had * knowledge of the CeCILL-B license and that you accept its terms. -* ------------------------------------------------------------------------ */ +* ------------------------------------------------------------------------ */ /**** @@ -71,10 +71,11 @@ namespace bbtk const int INIT_CREATION_CONTOUR = 202; const int FIN_CREATION_CONTOUR = 203; const int ADD_TO_SELECTED = 204; - const int DRAG_OBJECTS = 205; - const int EDIT_BLACKBOX = 206; - - + const int REMOVE_FROM_SELECTED = 205; + const int DRAG_OBJECTS = 206; + const int EDIT_BLACKBOX = 207; + + //// COLORS (object_state_(R|G|B)) //Object Border colors @@ -98,7 +99,7 @@ namespace bbtk const double BOXBORDER_DRAG_R = 0.75; const double BOXBORDER_DRAG_G = 0.75; const double BOXBORDER_DRAG_B = 0.75; - + const double BOXBORDER_SELECTED_R = 0.45; const double BOXBORDER_SELECTED_G = 0.45; const double BOXBORDER_SELECTED_B = 0.00; @@ -125,7 +126,7 @@ namespace bbtk const double BOXFILL_DRAG_R = 0.75; const double BOXFILL_DRAG_G = 0.75; const double BOXFILL_DRAG_B = 0.75; - + const double BOXFILL_SELECTED_R = 0.65; const double BOXFILL_SELECTED_G = 0.65; const double BOXFILL_SELECTED_B = 0.05; @@ -133,15 +134,15 @@ namespace bbtk //Object Text colors - + const double PORTFILL_NH_R = 0.0; const double PORTFILL_NH_G = 0.0; const double PORTFILL_NH_B = 0.0; - + const double PORTTEXT_NH_R = 1.0; const double PORTTEXT_NH_G = 1.0; const double PORTTEXT_NH_B = 0.0; - + const double BOXTEXT_NH_R = 0.25; const double BOXTEXT_NH_G = 0.0; const double BOXTEXT_NH_B = 0.0; @@ -173,7 +174,7 @@ namespace bbtk const int ID_SAVE_AS_COMPLEXBOX = 1011; const int ID_COPY_TO_COMPLEXDIAGRAM = 1012; const int ID_BTNBOX = 1013; - + const int wxID_NOTEBOOK = 1013; } diff --git a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GBlackBoxController.cxx b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GBlackBoxController.cxx index 93e06fa..6cf2b9c 100644 --- a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GBlackBoxController.cxx +++ b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GBlackBoxController.cxx @@ -1,4 +1,4 @@ -/*========================================================================= +/*========================================================================= Program: bbtk Module: $RCSfile$ Language: C++ @@ -11,26 +11,26 @@ Version: $Revision$ * Copyright (c) CREATIS-LRMN (Centre de Recherche en Imagerie Medicale) * Authors : Eduardo Davila, Laurent Guigues, Jean-Pierre Roux * -* This software is governed by the CeCILL-B license under French law and -* abiding by the rules of distribution of free software. You can use, -* modify and/ or redistribute the software under the terms of the CeCILL-B -* license as circulated by CEA, CNRS and INRIA at the following URL -* http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html +* This software is governed by the CeCILL-B license under French law and +* abiding by the rules of distribution of free software. You can use, +* modify and/ or redistribute the software under the terms of the CeCILL-B +* license as circulated by CEA, CNRS and INRIA at the following URL +* http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html * or in the file LICENSE.txt. * * As a counterpart to the access to the source code and rights to copy, * modify and redistribute granted by the license, users are provided only * with a limited warranty and the software's author, the holder of the * economic rights, and the successive licensors have only limited -* liability. +* liability. * * The fact that you are presently reading this means that you have had * knowledge of the CeCILL-B license and that you accept its terms. -* ------------------------------------------------------------------------ */ +* ------------------------------------------------------------------------ */ /** -* \file -* \brief Class bbtk::GBlackBoxController +* \file +* \brief Class bbtk::GBlackBoxController */ @@ -43,7 +43,7 @@ namespace bbtk //========================================================================= GBlackBoxController::GBlackBoxController() { - + } //========================================================================= @@ -54,7 +54,9 @@ namespace bbtk bool GBlackBoxController::OnMouseMove() { - + +printf("EED GBlackBoxController::OnMouseMove START \n"); + if ( _vtkInteractorStyleBaseView!=NULL) { int X,Y; @@ -63,73 +65,118 @@ namespace bbtk _wxVTKiren->GetEventPosition( X , Y ); int state = _view->getState(); - + //Evaluate new state - + if(state == NOTHING_HAPPENS) { if(_view->isPointInside(X,Y)) { - _view->setState(HIGHLIGHTED); - } - } + _view->setState(HIGHLIGHTED); + } + } // state + if( state==HIGHLIGHTED) { if(!_view->isPointInside(X,Y)) { _view->setState(NOTHING_HAPPENS); } - } - + } // state + + + if ((state==DRAG) && (_isLeftClickDown==true) ) + { + _objHasBeenMoved=true; + } // state + +printf("EED GBlackBoxController::OnMouseMove state=%d\n", state); _model->notifyObservers(getId()); - + } return true; } //========================================================================= - + bool GBlackBoxController::OnLeftButtonDown() { + _objHasBeenMoved = false; + _isLeftClickDown = true; + bool ok=true; int state = _view->getState(); - +printf("EED GBlackBoxController::OnLeftButtonDown state=%d \n", state); //Evaluate new state if(state == HIGHLIGHTED) +//EED3oct2010 if ( (state == HIGHLIGHTED) && (ctrlkey==1 ) ) { - _isLeftClickDown=true; + ok=false; _view->setState(SELECTED); _model->notifyObservers(getId(),ADD_TO_SELECTED); } - return true; - } - //========================================================================= - - bool GBlackBoxController::OnLeftButtonUp() - { + int X,Y; wxVTKRenderWindowInteractor *wxVTKiren; wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk3DBaseView()->GetWxVTKRenderWindowInteractor(); wxVTKiren->GetEventPosition(X,Y); + int ctrlkey=_vtkInteractorStyleBaseView->GetInteractor()->GetControlKey(); + if ( (state==DRAG) && (ctrlkey==1) && (_view->isPointInside(X,Y)==true) ) + { + _view->setState(NOTHING_HAPPENS); + _model->notifyObservers(getId(),REMOVE_FROM_SELECTED); + } + +printf("EED GBlackBoxController::OnLeftButtonDown END\n" ); + + return ok; + + } + + //========================================================================= + + bool GBlackBoxController::OnLeftButtonUp() + { + _isLeftClickDown = false; + int state = _view->getState(); +printf("EED GBlackBoxController::OnLeftButtonUp START state=%d \n", state); - int state = _view->getState(); - //Evaluate new state - if(_isLeftClickDown) - { - _isLeftClickDown=false; - if(_view->isPointInside(X,Y)) - { + +//EED Borrame +// int X,Y; +// wxVTKRenderWindowInteractor *wxVTKiren; +// wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk3DBaseView()->GetWxVTKRenderWindowInteractor(); +// wxVTKiren->GetEventPosition(X,Y); +// if(_isLeftClickDown) +// { +// _isLeftClickDown=false; +// if(_view->isPointInside(X,Y)) +// { // It is supposed that I'm always inside even if the box is in drag - _view->setState(SELECTED); - _model->notifyObservers(getId()); - } +// _view->setState(SELECTED); +// _model->notifyObservers(getId()); +// } +// } + + + + int ctrlkey=_vtkInteractorStyleBaseView->GetInteractor()->GetControlKey(); + + if ( (state==SELECTED) && (ctrlkey==0) && (_objHasBeenMoved==false)) + { + _view->setState(NOTHING_HAPPENS); + _model->notifyObservers(getId(),REMOVE_FROM_SELECTED); } + + +printf("EED GBlackBoxController::OnLeftButtonUp END state=%d \n", state); + return true; - + } - + //========================================================================= bool GBlackBoxController::OnRightButtonUp() @@ -159,11 +206,11 @@ namespace bbtk } else { - bbmodel->setExecutable(true); + bbmodel->setExecutable(true); } bbmodel->notifyObservers(getId()); } - + return true; } diff --git a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GBlackBoxController.h b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GBlackBoxController.h index 5a97e90..6a611ce 100644 --- a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GBlackBoxController.h +++ b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GBlackBoxController.h @@ -1,4 +1,4 @@ -/*========================================================================= +/*========================================================================= Program: bbtk Module: $RCSfile$ Language: C++ @@ -11,28 +11,28 @@ Version: $Revision$ * Copyright (c) CREATIS-LRMN (Centre de Recherche en Imagerie Medicale) * Authors : Eduardo Davila, Laurent Guigues, Jean-Pierre Roux * -* This software is governed by the CeCILL-B license under French law and -* abiding by the rules of distribution of free software. You can use, -* modify and/ or redistribute the software under the terms of the CeCILL-B -* license as circulated by CEA, CNRS and INRIA at the following URL -* http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html +* This software is governed by the CeCILL-B license under French law and +* abiding by the rules of distribution of free software. You can use, +* modify and/ or redistribute the software under the terms of the CeCILL-B +* license as circulated by CEA, CNRS and INRIA at the following URL +* http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html * or in the file LICENSE.txt. * * As a counterpart to the access to the source code and rights to copy, * modify and redistribute granted by the license, users are provided only * with a limited warranty and the software's author, the holder of the * economic rights, and the successive licensors have only limited -* liability. +* liability. * * The fact that you are presently reading this means that you have had * knowledge of the CeCILL-B license and that you accept its terms. -* ------------------------------------------------------------------------ */ +* ------------------------------------------------------------------------ */ /** -* \file -* \brief Class bbtk::GBlackBoxController : +* \file +* \brief Class bbtk::GBlackBoxController : */ /**** @@ -61,19 +61,20 @@ namespace bbtk class GBlackBoxController : public GBoxController { - public: + public: //Constructors GBlackBoxController(); ~GBlackBoxController(); - + //Public methods - + private: //Attributes + bool _objHasBeenMoved; //Private Methods @@ -81,9 +82,9 @@ namespace bbtk // Methods from InteractorStyleMaracas virtual bool OnMouseMove(); - virtual bool OnLeftButtonDown(); + virtual bool OnLeftButtonDown(); virtual bool OnLeftButtonUp(); - virtual bool OnMiddleButtonDown(); + virtual bool OnMiddleButtonDown(); virtual bool OnRightButtonUp(); diff --git a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GBoxController.cxx b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GBoxController.cxx index bd3b652..52e80a2 100644 --- a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GBoxController.cxx +++ b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GBoxController.cxx @@ -1,4 +1,4 @@ -/*========================================================================= +/*========================================================================= Program: bbtk Module: $RCSfile$ Language: C++ @@ -11,26 +11,26 @@ Version: $Revision$ * Copyright (c) CREATIS-LRMN (Centre de Recherche en Imagerie Medicale) * Authors : Eduardo Davila, Laurent Guigues, Jean-Pierre Roux * -* This software is governed by the CeCILL-B license under French law and -* abiding by the rules of distribution of free software. You can use, -* modify and/ or redistribute the software under the terms of the CeCILL-B -* license as circulated by CEA, CNRS and INRIA at the following URL -* http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html +* This software is governed by the CeCILL-B license under French law and +* abiding by the rules of distribution of free software. You can use, +* modify and/ or redistribute the software under the terms of the CeCILL-B +* license as circulated by CEA, CNRS and INRIA at the following URL +* http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html * or in the file LICENSE.txt. * * As a counterpart to the access to the source code and rights to copy, * modify and redistribute granted by the license, users are provided only * with a limited warranty and the software's author, the holder of the * economic rights, and the successive licensors have only limited -* liability. +* liability. * * The fact that you are presently reading this means that you have had * knowledge of the CeCILL-B license and that you accept its terms. -* ------------------------------------------------------------------------ */ +* ------------------------------------------------------------------------ */ /** -* \file -* \brief Class bbtk::GBoxController +* \file +* \brief Class bbtk::GBoxController */ @@ -43,7 +43,7 @@ namespace bbtk //========================================================================= GBoxController::GBoxController() { - + } //========================================================================= @@ -54,24 +54,24 @@ namespace bbtk bool GBoxController::OnMouseMove() { - + if ( _vtkInteractorStyleBaseView!=NULL) { int X,Y; wxVTKRenderWindowInteractor *_wxVTKiren; - _wxVTKiren= _vtkInteractorStyleBaseView->GetWxVtk3DBaseView()->GetWxVTKRenderWindowInteractor(); + _wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk3DBaseView()->GetWxVTKRenderWindowInteractor(); _wxVTKiren->GetEventPosition( X , Y ); int state = _view->getState(); - + //Evaluate new state - + if(state == NOTHING_HAPPENS) { if(_view->isPointInside(X,Y)) { - _view->setState(HIGHLIGHTED); - } + _view->setState(HIGHLIGHTED); + } } if( state==HIGHLIGHTED) { @@ -80,32 +80,35 @@ namespace bbtk _view->setState(NOTHING_HAPPENS); } } - + _model->notifyObservers(getId()); - + } return true; } //========================================================================= - + bool GBoxController::OnLeftButtonDown() { + bool ok=true; +printf("EED GBoxController::OnLeftButtonDown \n"); int state = _view->getState(); - + //Evaluate new state if(state == HIGHLIGHTED) { + ok=false; _isLeftClickDown=true; _view->setState(SELECTED); _model->notifyObservers(getId(),ADD_TO_SELECTED); } - return true; + return ok; } //========================================================================= - + bool GBoxController::OnLeftButtonUp() { int X,Y; @@ -126,9 +129,9 @@ namespace bbtk } } return true; - + } - + //========================================================================= bool GBoxController::OnRightButtonUp() diff --git a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GConnectorController.cxx b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GConnectorController.cxx index c9d8f74..c97055f 100644 --- a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GConnectorController.cxx +++ b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GConnectorController.cxx @@ -1,4 +1,4 @@ -/*========================================================================= +/*========================================================================= Program: bbtk Module: $RCSfile$ Language: C++ @@ -11,26 +11,26 @@ Version: $Revision$ * Copyright (c) CREATIS-LRMN (Centre de Recherche en Imagerie Medicale) * Authors : Eduardo Davila, Laurent Guigues, Jean-Pierre Roux * -* This software is governed by the CeCILL-B license under French law and -* abiding by the rules of distribution of free software. You can use, -* modify and/ or redistribute the software under the terms of the CeCILL-B -* license as circulated by CEA, CNRS and INRIA at the following URL -* http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html +* This software is governed by the CeCILL-B license under French law and +* abiding by the rules of distribution of free software. You can use, +* modify and/ or redistribute the software under the terms of the CeCILL-B +* license as circulated by CEA, CNRS and INRIA at the following URL +* http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html * or in the file LICENSE.txt. * * As a counterpart to the access to the source code and rights to copy, * modify and redistribute granted by the license, users are provided only * with a limited warranty and the software's author, the holder of the * economic rights, and the successive licensors have only limited -* liability. +* liability. * * The fact that you are presently reading this means that you have had * knowledge of the CeCILL-B license and that you accept its terms. -* ------------------------------------------------------------------------ */ +* ------------------------------------------------------------------------ */ /** -* \file -* \brief Class bbtk::GConnectorController +* \file +* \brief Class bbtk::GConnectorController */ @@ -56,7 +56,7 @@ namespace bbtk bool GConnectorController::OnMouseMove() { - + if ( _vtkInteractorStyleBaseView!=NULL) { int X,Y; @@ -64,27 +64,27 @@ namespace bbtk _wxVTKiren= _vtkInteractorStyleBaseView->GetWxVtk3DBaseView()->GetWxVTKRenderWindowInteractor(); _wxVTKiren->GetEventPosition( X , Y ); - if ( (_vtkInteractorStyleBaseView->GetInteractor()->GetControlKey()==0) &&(_vtkInteractorStyleBaseView->GetInteractor()->GetShiftKey()==0) ) + if ( (_vtkInteractorStyleBaseView->GetInteractor()->GetControlKey()==0) &&(_vtkInteractorStyleBaseView->GetInteractor()->GetShiftKey()==0) ) { _controller->MouseMove(X,Y); } - + } return true; } //========================================================================= - + bool GConnectorController::OnLeftButtonDown() { - + if ( _vtkInteractorStyleBaseView!=NULL ) { int X,Y; wxVTKRenderWindowInteractor *wxVTKiren; wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk3DBaseView()->GetWxVTKRenderWindowInteractor(); wxVTKiren->GetEventPosition(X,Y); - + _controller->SetKeyBoardMoving( false ); _controller->MouseClickLeft(X,Y); @@ -109,14 +109,14 @@ namespace bbtk _view->setState(SELECTED); _model->notifyObservers(getId(),ADD_TO_SELECTED); } - + } return true; } - + //========================================================================= - + bool GConnectorController::OnLeftDClick() { @@ -132,24 +132,26 @@ namespace bbtk } return true; } - + //========================================================================= - + bool GConnectorController::OnRightButtonDown() { +printf ("GConnectorController::OnRightButtonDown 1 \n" ); if( _vtkInteractorStyleBaseView!= NULL ) { int X,Y; wxVTKRenderWindowInteractor *wxVTKiren; wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk3DBaseView()->GetWxVTKRenderWindowInteractor(); wxVTKiren->GetEventPosition(X, Y); - + _controller->MouseClickRight(X,Y); - + } +printf ("GConnectorController::OnRightButtonDown 2 \n" ); return true; } - + //========================================================================= bool GConnectorController::OnRightButtonUp() @@ -185,7 +187,7 @@ namespace bbtk } //========================================================================= - + void GConnectorController::setManualContourController(manualConnectorContourController* controller) { _controller = controller; @@ -193,7 +195,7 @@ namespace bbtk } //========================================================================= - + void GConnectorController::removeFromScene() { GConnectorModel *conMod = (GConnectorModel*)_model; diff --git a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GObjectController.cxx b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GObjectController.cxx index 645997b..43f57c7 100644 --- a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GObjectController.cxx +++ b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GObjectController.cxx @@ -1,4 +1,4 @@ -/*========================================================================= +/*========================================================================= Program: bbtk Module: $RCSfile$ Language: C++ @@ -11,26 +11,26 @@ Version: $Revision$ * Copyright (c) CREATIS-LRMN (Centre de Recherche en Imagerie Medicale) * Authors : Eduardo Davila, Laurent Guigues, Jean-Pierre Roux * -* This software is governed by the CeCILL-B license under French law and -* abiding by the rules of distribution of free software. You can use, -* modify and/ or redistribute the software under the terms of the CeCILL-B -* license as circulated by CEA, CNRS and INRIA at the following URL -* http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html +* This software is governed by the CeCILL-B license under French law and +* abiding by the rules of distribution of free software. You can use, +* modify and/ or redistribute the software under the terms of the CeCILL-B +* license as circulated by CEA, CNRS and INRIA at the following URL +* http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html * or in the file LICENSE.txt. * * As a counterpart to the access to the source code and rights to copy, * modify and redistribute granted by the license, users are provided only * with a limited warranty and the software's author, the holder of the * economic rights, and the successive licensors have only limited -* liability. +* liability. * * The fact that you are presently reading this means that you have had * knowledge of the CeCILL-B license and that you accept its terms. -* ------------------------------------------------------------------------ */ +* ------------------------------------------------------------------------ */ /** -* \file -* \brief Class bbtk::GObjectController +* \file +* \brief Class bbtk::GObjectController */ @@ -43,11 +43,11 @@ namespace bbtk //========================================================================= GObjectController::GObjectController() { - + } //========================================================================= - + GObjectController::~GObjectController() { } @@ -69,14 +69,14 @@ namespace bbtk _wxVTKiren= _vtkInteractorStyleBaseView->GetWxVtk3DBaseView()->GetWxVTKRenderWindowInteractor(); _wxVTKiren->GetEventPosition( X , Y ); int state = _view->getState(); - + //Evaluate new state if( state == NOTHING_HAPPENS) { if(_view->isPointInside(X,Y)) { - _view->setState(HIGHLIGHTED); - } + _view->setState(HIGHLIGHTED); + } } if( state==HIGHLIGHTED) { @@ -85,19 +85,19 @@ namespace bbtk _view->setState(NOTHING_HAPPENS); } } - + _model->notifyObservers(getId()); - + return true; } //========================================================================= - + bool GObjectController::OnLeftButtonDown()//virtual { int state = _view->getState(); - + //Evaluate new state if(state == HIGHLIGHTED) { @@ -108,15 +108,14 @@ namespace bbtk } //========================================================================= - + bool GObjectController::OnLeftButtonUp()//virtual { - return true; } //========================================================================= - + bool GObjectController::OnLeftDClick()//virtual { @@ -124,7 +123,7 @@ namespace bbtk } //========================================================================= - + bool GObjectController::OnMiddleButtonDown()//virtual { return true; @@ -134,7 +133,7 @@ namespace bbtk void GObjectController::moveObject(int X,int Y) { - _view->moveObject(X,Y); + _view->moveObject(X,Y); } //========================================================================= @@ -145,7 +144,7 @@ namespace bbtk } //========================================================================= - + GObjectModel* GObjectController::getModel() { return _model; @@ -166,7 +165,7 @@ namespace bbtk } //========================================================================= - + void GObjectController::setId(int id) { _model->setObjectId(id); diff --git a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GObjectController.h b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GObjectController.h index 519248c..deaa7d8 100644 --- a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GObjectController.h +++ b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GObjectController.h @@ -1,4 +1,4 @@ -/*========================================================================= +/*========================================================================= Program: bbtk Module: $RCSfile$ Language: C++ @@ -11,28 +11,28 @@ Version: $Revision$ * Copyright (c) CREATIS-LRMN (Centre de Recherche en Imagerie Medicale) * Authors : Eduardo Davila, Laurent Guigues, Jean-Pierre Roux * -* This software is governed by the CeCILL-B license under French law and -* abiding by the rules of distribution of free software. You can use, -* modify and/ or redistribute the software under the terms of the CeCILL-B -* license as circulated by CEA, CNRS and INRIA at the following URL -* http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html +* This software is governed by the CeCILL-B license under French law and +* abiding by the rules of distribution of free software. You can use, +* modify and/ or redistribute the software under the terms of the CeCILL-B +* license as circulated by CEA, CNRS and INRIA at the following URL +* http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html * or in the file LICENSE.txt. * * As a counterpart to the access to the source code and rights to copy, * modify and redistribute granted by the license, users are provided only * with a limited warranty and the software's author, the holder of the * economic rights, and the successive licensors have only limited -* liability. +* liability. * * The fact that you are presently reading this means that you have had * knowledge of the CeCILL-B license and that you accept its terms. -* ------------------------------------------------------------------------ */ +* ------------------------------------------------------------------------ */ /** -* \file -* \brief Class bbtk::GObjectController : +* \file +* \brief Class bbtk::GObjectController : */ /**** @@ -58,15 +58,15 @@ Version: $Revision$ namespace bbtk { - class GObjectController : public InteractorStyleMaracas + class GObjectController : public InteractorStyleMaracas { - public: + public: //Constructors GObjectController(); ~GObjectController(); - + //Public methods void setModelAndView(GObjectModel* model, vtkGObjectView* view); @@ -82,23 +82,23 @@ namespace bbtk // Same ObjectID from the model int getId(); void setId(int id); - + virtual void removeFromScene(); private: //Attributes - - + + //Private Methods protected: - //Protected Attributes + //Protected Attributes - GObjectModel* _model; - vtkGObjectView* _view; + GObjectModel *_model; + vtkGObjectView *_view; bool _isLeftClickDown; @@ -106,10 +106,10 @@ namespace bbtk // Methods from InteractorStyleMaracas virtual bool OnMouseMove(); - virtual bool OnLeftButtonDown(); + virtual bool OnLeftButtonDown(); virtual bool OnLeftButtonUp(); virtual bool OnLeftDClick(); - virtual bool OnMiddleButtonDown(); + virtual bool OnMiddleButtonDown(); virtual void moveObject(int X,int Y); diff --git a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GPortController.cxx b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GPortController.cxx index c15a276..6f51645 100644 --- a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GPortController.cxx +++ b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GPortController.cxx @@ -1,4 +1,4 @@ -/*========================================================================= +/*========================================================================= Program: bbtk Module: $RCSfile$ Language: C++ @@ -11,26 +11,26 @@ Version: $Revision$ * Copyright (c) CREATIS-LRMN (Centre de Recherche en Imagerie Medicale) * Authors : Eduardo Davila, Laurent Guigues, Jean-Pierre Roux * -* This software is governed by the CeCILL-B license under French law and -* abiding by the rules of distribution of free software. You can use, -* modify and/ or redistribute the software under the terms of the CeCILL-B -* license as circulated by CEA, CNRS and INRIA at the following URL -* http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html +* This software is governed by the CeCILL-B license under French law and +* abiding by the rules of distribution of free software. You can use, +* modify and/ or redistribute the software under the terms of the CeCILL-B +* license as circulated by CEA, CNRS and INRIA at the following URL +* http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html * or in the file LICENSE.txt. * * As a counterpart to the access to the source code and rights to copy, * modify and redistribute granted by the license, users are provided only * with a limited warranty and the software's author, the holder of the * economic rights, and the successive licensors have only limited -* liability. +* liability. * * The fact that you are presently reading this means that you have had * knowledge of the CeCILL-B license and that you accept its terms. -* ------------------------------------------------------------------------ */ +* ------------------------------------------------------------------------ */ /** -* \file -* \brief Class bbtk::GPortController +* \file +* \brief Class bbtk::GPortController */ @@ -54,9 +54,9 @@ namespace bbtk bool GPortController::OnLeftButtonDown() { - + int state = _view->getState(); - + //Evaluate new state if(state == HIGHLIGHTED) { @@ -88,7 +88,7 @@ namespace bbtk { _view->setState(NOTHING_HAPPENS); } - _isLeftClickDown=false; + _isLeftClickDown=false; } return true; @@ -96,7 +96,7 @@ namespace bbtk //========================================================================= - + } // EO namespace bbtk diff --git a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.cxx b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.cxx index 75b6c25..848ca2e 100644 --- a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.cxx +++ b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.cxx @@ -1,4 +1,4 @@ -/*========================================================================= +/*========================================================================= Program: bbtk Module: $RCSfile$ Language: C++ @@ -11,26 +11,26 @@ Version: $Revision$ * Copyright (c) CREATIS-LRMN (Centre de Recherche en Imagerie Medicale) * Authors : Eduardo Davila, Laurent Guigues, Jean-Pierre Roux * -* This software is governed by the CeCILL-B license under French law and -* abiding by the rules of distribution of free software. You can use, -* modify and/ or redistribute the software under the terms of the CeCILL-B -* license as circulated by CEA, CNRS and INRIA at the following URL -* http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html +* This software is governed by the CeCILL-B license under French law and +* abiding by the rules of distribution of free software. You can use, +* modify and/ or redistribute the software under the terms of the CeCILL-B +* license as circulated by CEA, CNRS and INRIA at the following URL +* http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html * or in the file LICENSE.txt. * * As a counterpart to the access to the source code and rights to copy, * modify and redistribute granted by the license, users are provided only * with a limited warranty and the software's author, the holder of the * economic rights, and the successive licensors have only limited -* liability. +* liability. * * The fact that you are presently reading this means that you have had * knowledge of the CeCILL-B license and that you accept its terms. -* ------------------------------------------------------------------------ */ +* ------------------------------------------------------------------------ */ /** -* \file -* \brief Class bbtk::WxInterfaceEditorGraphicBBS . +* \file +* \brief Class bbtk::WxInterfaceEditorGraphicBBS . */ #include "bbtkwxGUIEditorGraphicBBS.h" @@ -51,7 +51,7 @@ namespace bbtk { _frameAUIMgr = new wxAuiManager(this); - + /*std::string datadir( crea::System::GetExecutablePath() ); std::string datadir ("."); @@ -59,13 +59,13 @@ namespace bbtk cout<<"RaC //TODO wxGUIEditorGraphicBBS constructor.Initialize datadir with crea::System::GetExecutablePath() ."<AddTool(ID_ADDCOMPLEXBOXOUTPUT,_T("Add output to Complex box"),bmp_complexoutputport, wxNullBitmap, wxITEM_NORMAL,_T("Add output Complex box"), _T("Add output Complex box")); toolbar->EnableTool(ID_ADDCOMPLEXBOXINPUT,false); toolbar->EnableTool(ID_ADDCOMPLEXBOXOUTPUT,false); - + toolbar->SetMargins( 2, 2 ); toolbar->Realize(); SetToolBar(toolbar); @@ -151,7 +151,7 @@ namespace bbtk //TO FIX THE PATH OF BBTK BIN IN ORDER TO USE REGENERATE EXECUTABLES //RegenerateAll(); _helpHtmlBrowser = new WxGUIHtmlBrowser(this,wxSize(200,0)); - _frameAUIMgr->AddPane(_helpHtmlBrowser,wxAuiPaneInfo().Right().MinSize(200,200)); + _frameAUIMgr->AddPane(_helpHtmlBrowser,wxAuiPaneInfo().Right().MinSize(200,200)); } //========================================================================= @@ -175,13 +175,13 @@ namespace bbtk // Create Help menu and its items wxMenu *editMenu = new wxMenu; - editMenu->Append(ID_COPY_TO_COMPLEXDIAGRAM, _T("Copy selected to complex box"), _T("Creates a new complex box diagram with selected boxes")); + editMenu->Append(ID_COPY_TO_COMPLEXDIAGRAM, _T("Copy selected to complex box"), _T("Creates a new complex box diagram with selected boxes")); Connect(ID_COPY_TO_COMPLEXDIAGRAM,wxEVT_COMMAND_MENU_SELECTED,wxCommandEventHandler(wxGUIEditorGraphicBBS::OnCopySelectedToComplexDiagram)); // Create Help menu and its items wxMenu *helpMenu = new wxMenu; - helpMenu->Append(wxID_ABOUT, _T("&About..."), _T("About")); + helpMenu->Append(wxID_ABOUT, _T("&About..."), _T("About")); // Append the created menu to the menu bar wxMenuBar *menuBar = new wxMenuBar(); @@ -190,7 +190,7 @@ namespace bbtk menuBar->Append(helpMenu, _T("&Help")); // Attach this menu bar to the frame - SetMenuBar(menuBar); + SetMenuBar(menuBar); } //========================================================================= @@ -198,16 +198,16 @@ namespace bbtk { _notebook = new wxAuiNotebook(this,wxID_NOTEBOOK,wxDefaultPosition,wxDefaultSize,wxAUI_NB_TOP|wxAUI_NB_TAB_MOVE|wxAUI_NB_CLOSE_ON_ACTIVE_TAB|wxAUI_NB_TAB_FIXED_WIDTH|wxAUI_NB_WINDOWLIST_BUTTON); _tabsMgr = new wxTabPanelsManager(this); - _frameAUIMgr->AddPane(_notebook,wxAuiPaneInfo().CenterPane()); + _frameAUIMgr->AddPane(_notebook,wxAuiPaneInfo().CenterPane()); } - + //========================================================================= void wxGUIEditorGraphicBBS::initPackageBrowser() { _pkgBrowser = new WxGUIPackageBrowser2(this); _pkgBrowser->IncludeAll(); - _frameAUIMgr->AddPane(_pkgBrowser,wxAuiPaneInfo().Left().MinSize(200,200).CloseButton(false)); + _frameAUIMgr->AddPane(_pkgBrowser,wxAuiPaneInfo().Left().MinSize(200,200).CloseButton(false)); } //================================================================ @@ -222,8 +222,8 @@ namespace bbtk { mess = "Regenerating doc for all packages"; } - - mess += " ... please wait"; + + mess += " ... please wait"; SetStatusText( std2wx(mess) ); @@ -252,12 +252,12 @@ namespace bbtk wxOK | wxICON_INFORMATION); */ } - else + else { SetStatusText( _T("Done !")); wxString err(_T("An error occured while running '")); err += bbtk::std2wx(command) + _T("'"); - wxMessageBox(err,_T("Regenerate package doc"),wxOK | wxICON_ERROR); + wxMessageBox(err,_T("Regenerate package doc"),wxOK | wxICON_ERROR); } } @@ -290,19 +290,19 @@ namespace bbtk wxOK | wxICON_INFORMATION); */ } - else + else { SetStatusText( _T("Done !")); wxString err(_T("An error occured while running '")); err += bbtk::std2wx(command) + _T("'"); - wxMessageBox(err,_T("Regenerate boxes lists"),wxOK | wxICON_ERROR); + wxMessageBox(err,_T("Regenerate boxes lists"),wxOK | wxICON_ERROR); } } - + //================================================================ void wxGUIEditorGraphicBBS::RegenerateAll() { - DoRegeneratePackageDoc("-a"); + DoRegeneratePackageDoc("-a"); DoRegenerateBoxesLists(); } @@ -349,7 +349,7 @@ namespace bbtk std::string separator = ConfigurationFile::GetInstance().Get_file_separator (); std::string dir = ConfigurationFile::GetInstance().Get_default_temp_dir(); std::string filename = dir + separator + "tmp_bbtk.bbs"; - + ofstream tempFile; tempFile.open(filename.c_str()); tempFile << script; @@ -357,17 +357,17 @@ namespace bbtk std::string command = "\""+ crea::System::GetExecutablePath(); - + #ifdef MACOSX command += separator + "../../../bbi.app/Contents/MacOS"; #endif - + #ifdef WIN32 command += "\""; #endif - - /* - + + /* + //command += ConfigurationFile::GetInstance().Get_bin_path(); //EED command +="C:/temp/bbtkBIN/RelWithDebInfo//"; //EED command +="C:/Program Files/CreaTools/bbtk-0.9.5/bin"; @@ -375,7 +375,7 @@ namespace bbtk #ifdef MACOSX command += separator + "usr/local/bin/bbi.app/Contents/MacOS/bbi\" "; - #else + #else command +="."; command += separator + "bbi\" "; #endif @@ -387,18 +387,18 @@ namespace bbtk #endif command += " & "; - + printf ("RaC wxGUIEditorGraphicBBS::executeScript %s \n" , command.c_str() ); system( command.c_str() ); } //========================================================================= - // EVENT HANDLERS + // EVENT HANDLERS //========================================================================= void wxGUIEditorGraphicBBS::OnCreateNewTab(wxCommandEvent& event) { - _tabsMgr->addNewTab(); + _tabsMgr->addNewTab(); refreshGUIControls(); } @@ -406,16 +406,17 @@ namespace bbtk void wxGUIEditorGraphicBBS::OnExecuteActualDiagram(wxCommandEvent& event) { - std::string script = _tabsMgr->getActualDiagramBBS(); - cout<<"RaC wxGUIEditorGraphicBBS::executeActualDiagram SCRIPT"<getActualDiagramBBS(true); + cout<getActualDiagramBBS(false); + executeScript(script2); } - + //========================================================================= - // HANDLERS + // HANDLERS //========================================================================= void wxGUIEditorGraphicBBS::OnOpenBBS(wxCommandEvent& event) { @@ -423,12 +424,12 @@ namespace bbtk if (openFileDialog->ShowModal() == wxID_OK) { wxString fileName = openFileDialog->GetPath( ); - - + + _tabsMgr->addNewTab(); - bbtk::InterpreterBBS::Pointer I = bbtk::InterpreterBBS::New( this->_tabsMgr->getActualTabPanel()->getSceneManager() , _pkgBrowser->GetFactory()); - + bbtk::InterpreterBBS::Pointer I = bbtk::InterpreterBBS::New( this->_tabsMgr->getActualTabPanel()->getSceneManager() , _pkgBrowser->GetFactory()); + // We tell the interpreter to throw exceptions on error I->SetThrow(true); // Interpret the file supposed to define a box called 'Processing' @@ -443,14 +444,14 @@ namespace bbtk if (saveFileDialog->ShowModal() == wxID_OK) { wxString fileName = saveFileDialog->GetPath( ); - + ofstream file; -//EED file.open(fileName.c_str()); +//EED file.open(fileName.c_str()); file.open( (const char*) (fileName.mb_str()) ); std::string content=""; - + // writing file header content += "# ----------------------------------\n"; content += "# - BBTKGEditor v 1.0 BBS BlackBox Script\n"; @@ -473,20 +474,20 @@ namespace bbtk { wxString fileName = nameDialog->GetValue(); cbName=(const char*) (fileName.mb_str()); - } + } if(!cbName.empty()) - { + { wxFileDialog * saveFileDialog = new wxFileDialog(this ,wxT("Save Complex Box BBS") ,wxEmptyString, wxString( cbName.c_str(), wxConvUTF8),wxT("*.bbs"), wxSAVE | wxOVERWRITE_PROMPT); if (saveFileDialog->ShowModal() == wxID_OK) { wxString fileName = saveFileDialog->GetPath(); - + ofstream file; file.open( (const char*) (fileName.mb_str()) ); std::string content=""; - + // writing file header content += "# ----------------------------------\n"; content += "# - BBTKGEditor v 1.1 BBS BlackBox Script (Complex Box)\n"; @@ -508,12 +509,12 @@ namespace bbtk if (saveFileDialog->ShowModal() == wxID_OK) { wxString fileName = saveFileDialog->GetPath(); - + ofstream file; file.open( (const char*) (fileName.mb_str()) ); std::string content=""; - + // writing file header content += "# ----------------------------------\n"; content += "# - BBTKGEditor v 1.0 BBG BlackBox Diagram file\n"; @@ -525,7 +526,7 @@ namespace bbtk content += "# ----------------------------------\n"; content += "\n"; content += "APP_START\n"; - _tabsMgr->saveActualDiagram(content); + _tabsMgr->saveActualDiagram(content); content += "APP_END\n"; file << content; file.close(); @@ -543,7 +544,7 @@ namespace bbtk toolbar->ToggleTool(ID_BTNCOMPLEXBOX,true); toolbar->EnableTool(ID_ADDCOMPLEXBOXINPUT,true); toolbar->EnableTool(ID_ADDCOMPLEXBOXOUTPUT,true); - + GetMenuBar()->GetMenu(0)->Enable(ID_SAVE_AS_COMPLEXBOX,true); GetMenuBar()->GetMenu(0)->Enable(ID_SAVE_AS_BBS,false); } @@ -556,7 +557,7 @@ namespace bbtk GetMenuBar()->GetMenu(0)->Enable(ID_SAVE_AS_COMPLEXBOX,false); GetMenuBar()->GetMenu(0)->Enable(ID_SAVE_AS_BBS,true); } - + if(_tabsMgr->getNumActualSelectedObjects()>0) { GetMenuBar()->GetMenu(1)->Enable(ID_COPY_TO_COMPLEXDIAGRAM,true); @@ -589,14 +590,14 @@ namespace bbtk //========================================================================= - + void wxGUIEditorGraphicBBS::OnOpenDiagram(wxCommandEvent& event) { wxFileDialog * openFileDialog = new wxFileDialog(this,wxT("Open diagram"),wxEmptyString,wxT(""),wxT("*.bbg"),wxOPEN|wxFILE_MUST_EXIST); if (openFileDialog->ShowModal() == wxID_OK) { wxString fileName = openFileDialog->GetPath(); - + ifstream inputStream; //EED inputStream.open(fileName.c_str()); @@ -606,30 +607,39 @@ namespace bbtk _tabsMgr->addNewTab(); _tabsMgr->loadDiagram(inputStream); - + inputStream.close(); } refreshGUIControls(); } //========================================================================= - - + + void wxGUIEditorGraphicBBS::OnClickBtnBox(wxCommandEvent& event) { + BlackBoxDescriptor *bbDes = _pkgBrowser->GetActualSelected(); - std::string typeName = bbDes->GetTypeName(); - std::string packageName = bbDes->GetPackage()->GetName(); + if (bbDes!=NULL) + { + std::string typeName = bbDes->GetTypeName(); + std::string packageName = bbDes->GetPackage()->GetName(); + - this->_tabsMgr->getActualTabPanel()->getSceneManager()->createGBlackBox(50,50,packageName, typeName); - this->_tabsMgr->getActualTabPanel()->getSceneManager()->refresh(); - - printf("EED wxGUIEditorGraphicBBS::OnClickBtnBox \n"); + wxGEditorTabPanel *pnl = this->_tabsMgr->getActualTabPanel(); + + if (pnl!=NULL) + { + wxVtkSceneManager *scn = pnl->getSceneManager(); + scn->createGBlackBox(50,50,packageName, typeName); + scn->refresh(); + } // if pnl + }// if bbDes } - + //========================================================================= - + void wxGUIEditorGraphicBBS::OnClickBtnComplexBox(wxCommandEvent& event) { wxToolBar* toolbar = GetToolBar(); @@ -642,13 +652,13 @@ namespace bbtk { _tabsMgr->setActualDiagramComplexBox(false); } - refreshGUIControls(); + refreshGUIControls(); } //========================================================================= void wxGUIEditorGraphicBBS::OnAddComplexBoxInput(wxCommandEvent& event) - { + { wxTextEntryDialog *nameDialog = new wxTextEntryDialog(this,wxT("Name of input port")); if (nameDialog->ShowModal() == wxID_OK) { @@ -658,7 +668,7 @@ namespace bbtk std::string portName=(const char*) (fileName.mb_str()); _tabsMgr->addActualDiagramComplexInputPort(portName); } - } + } } //========================================================================= @@ -674,7 +684,7 @@ namespace bbtk std::string portName=(const char*) (fileName.mb_str()); _tabsMgr->addActualDiagramComplexOutputPort(portName); } - } + } } //========================================================================= diff --git a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxBlackBoxEditionDialog.cxx b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxBlackBoxEditionDialog.cxx index db678ab..b6e2850 100644 --- a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxBlackBoxEditionDialog.cxx +++ b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxBlackBoxEditionDialog.cxx @@ -1,4 +1,4 @@ -/*========================================================================= +/*========================================================================= Program: bbtk Module: $RCSfile$ Language: C++ @@ -11,26 +11,26 @@ Version: $Revision$ * Copyright (c) CREATIS-LRMN (Centre de Recherche en Imagerie Medicale) * Authors : Eduardo Davila, Laurent Guigues, Jean-Pierre Roux * -* This software is governed by the CeCILL-B license under French law and -* abiding by the rules of distribution of free software. You can use, -* modify and/ or redistribute the software under the terms of the CeCILL-B -* license as circulated by CEA, CNRS and INRIA at the following URL -* http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html +* This software is governed by the CeCILL-B license under French law and +* abiding by the rules of distribution of free software. You can use, +* modify and/ or redistribute the software under the terms of the CeCILL-B +* license as circulated by CEA, CNRS and INRIA at the following URL +* http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html * or in the file LICENSE.txt. * * As a counterpart to the access to the source code and rights to copy, * modify and redistribute granted by the license, users are provided only * with a limited warranty and the software's author, the holder of the * economic rights, and the successive licensors have only limited -* liability. +* liability. * * The fact that you are presently reading this means that you have had * knowledge of the CeCILL-B license and that you accept its terms. -* ------------------------------------------------------------------------ */ +* ------------------------------------------------------------------------ */ /** -* \file -* \brief Class bbtk::wxBlackBoxEditionDialog . +* \file +* \brief Class bbtk::wxBlackBoxEditionDialog . */ #include "wxBlackBoxEditionDialog.h" @@ -56,7 +56,7 @@ namespace bbtk //========================================================================= - + wxBlackBoxEditionDialog::~wxBlackBoxEditionDialog() { @@ -68,20 +68,24 @@ namespace bbtk { wxBoxSizer *sizerDialog = new wxBoxSizer(wxVERTICAL); - wxStaticText *text = new wxStaticText(this, -1, wxT("Input Ports")); + wxScrolledWindow *scrollWin = new wxScrolledWindow( this, -1, wxDefaultPosition, wxSize(200,200), wxVSCROLL); + + wxStaticText *text = new wxStaticText(scrollWin, -1, wxT("Input Ports")); wxFont font(11, wxDEFAULT, wxNORMAL, wxBOLD); text->SetFont(font); - + + + std::vector lstInputs = _model->getInputPorts(); - wxFlexGridSizer *sizer = new wxFlexGridSizer(lstInputs.size(),3,5,5); + wxFlexGridSizer *sizer = new wxFlexGridSizer(lstInputs.size(),3,5,5); for(int i = 0;i<(int)lstInputs.size();i++) { - GPortModel* port = lstInputs[i]; - std::string type = port->getBBTKType(); - wxStaticText *lblName = new wxStaticText(this, -1, std2wx(port->getBBTKName()),wxDefaultPosition,wxSize(100,25)); - wxStaticText *lblType = new wxStaticText(this, -1, std2wx(type),wxDefaultPosition,wxSize(250,25)); - wxTextCtrl *txtValue = new wxTextCtrl(this, -1, _T(""),wxDefaultPosition,wxSize(90,25)); - + GPortModel* port = lstInputs[i]; + std::string type = port->getBBTKType(); + wxStaticText *lblName = new wxStaticText(scrollWin, -1, std2wx(port->getBBTKName()),wxDefaultPosition,wxSize(100,25)); + wxStaticText *lblType = new wxStaticText(scrollWin, -1, std2wx(type),wxDefaultPosition,wxSize(250,25)); + wxTextCtrl *txtValue = new wxTextCtrl(scrollWin, -1, _T(""),wxDefaultPosition,wxSize(90,25)); + if(port->getValue()!="") { txtValue->SetValue(crea::std2wx(port->getValue())); @@ -102,24 +106,24 @@ namespace bbtk txtValue->SetEditable(false); } - _lstNames.push_back(lblName); + _lstNames.push_back(lblName); _lstValues.push_back(txtValue); _lstTypes.push_back(lblType); - - sizer->Add(lblName,1,wxEXPAND,5); + + sizer->Add(lblName,1,wxEXPAND,5); sizer->Add(txtValue,1,wxEXPAND,5); sizer->Add(lblType,1,wxCENTRE|wxEXPAND,5); - } - - wxBoxSizer *buts = new wxBoxSizer(wxHORIZONTAL); - wxButton *okButton = new wxButton(this, -1, _T("Ok"),wxDefaultPosition, wxSize(70, 30)); - wxButton *closeButton = new wxButton(this, -1, _T("Close"), wxDefaultPosition, wxSize(70, 30)); + + + wxBoxSizer *buts = new wxBoxSizer(wxHORIZONTAL); + wxButton *okButton = new wxButton(scrollWin, -1, _T("Ok"),wxDefaultPosition, wxSize(70, 30)); + wxButton *closeButton = new wxButton(scrollWin, -1, _T("Close"), wxDefaultPosition, wxSize(70, 30)); // connect command event handlers Connect(okButton->GetId(),wxEVT_COMMAND_BUTTON_CLICKED,wxCommandEventHandler(wxBlackBoxEditionDialog::onClickOk)); Connect(closeButton->GetId(),wxEVT_COMMAND_BUTTON_CLICKED,wxCommandEventHandler(wxBlackBoxEditionDialog::onClickClose)); - + buts->Add(okButton,0,wxCENTRE|wxEXPAND,5); buts->Add(closeButton,0,wxCENTRE|wxEXPAND,5); @@ -130,9 +134,16 @@ namespace bbtk sizerDialog->AddSpacer(15); sizerDialog->Add(buts,0,wxALIGN_CENTER | wxTOP | wxBOTTOM); - SetSizer(sizerDialog); + scrollWin->SetSizer(sizerDialog); + scrollWin->Centre(); + + + scrollWin->SetVirtualSize(400,400); + scrollWin->SetSize(300,300); + scrollWin->SetScrollbars(10, 10, 50, 50); +// scrollWin->SetSizer(sizer); + - Centre(); ShowModal(); Destroy(); } @@ -141,15 +152,12 @@ namespace bbtk void wxBlackBoxEditionDialog::onClickOk(wxCommandEvent& event) { -printf("EED wxBlackBoxEditionDialog::onClickOk size %d \n", (int)_lstValues.size() ); for(int i=0;i<(int)_lstValues.size();i++) { std::string text = wx2std(_lstValues[i]->GetValue()); -printf("EED wxBlackBoxEditionDialog::onClickOk text %s \n", text.c_str() ); //TOFIX Search a better alternative if(text!="--No editable--" && text!="--Port Connected--") { -printf("EED wxBlackBoxEditionDialog::onClickOk text %s \n", text.c_str() ); _model->setValueToInputPort(i,text); } } @@ -162,7 +170,7 @@ printf("EED wxBlackBoxEditionDialog::onClickOk text %s \n", text.c_str() ); void wxBlackBoxEditionDialog::onClickClose(wxCommandEvent& event) { printf("EED wxBlackBoxEditionDialog::onClickClose\n"); - Close(true); + Close(true); } //========================================================================= diff --git a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxGEditorTabPanel.cxx b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxGEditorTabPanel.cxx index 53f6204..4291597 100644 --- a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxGEditorTabPanel.cxx +++ b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxGEditorTabPanel.cxx @@ -1,4 +1,4 @@ -/*========================================================================= +/*========================================================================= Program: bbtk Module: $RCSfile$ Language: C++ @@ -11,26 +11,26 @@ Version: $Revision$ * Copyright (c) CREATIS-LRMN (Centre de Recherche en Imagerie Medicale) * Authors : Eduardo Davila, Laurent Guigues, Jean-Pierre Roux * -* This software is governed by the CeCILL-B license under French law and -* abiding by the rules of distribution of free software. You can use, -* modify and/ or redistribute the software under the terms of the CeCILL-B -* license as circulated by CEA, CNRS and INRIA at the following URL -* http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html +* This software is governed by the CeCILL-B license under French law and +* abiding by the rules of distribution of free software. You can use, +* modify and/ or redistribute the software under the terms of the CeCILL-B +* license as circulated by CEA, CNRS and INRIA at the following URL +* http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html * or in the file LICENSE.txt. * * As a counterpart to the access to the source code and rights to copy, * modify and redistribute granted by the license, users are provided only * with a limited warranty and the software's author, the holder of the * economic rights, and the successive licensors have only limited -* liability. +* liability. * * The fact that you are presently reading this means that you have had * knowledge of the CeCILL-B license and that you accept its terms. -* ------------------------------------------------------------------------ */ +* ------------------------------------------------------------------------ */ /** -* \file -* \brief Class bbtk::wxGEditorTabPanel . +* \file +* \brief Class bbtk::wxGEditorTabPanel . */ @@ -61,8 +61,11 @@ namespace bbtk { printf ("EED %p ~wxGEditorTabPanel()\n" , this ); //ED02JUIN2010 _sceneManager->disconnectDrop(); + + _panelsManager->VerifyLastTabPanel(); + } - + //========================================================================= void wxGEditorTabPanel::initWxVtkCanvas() { @@ -70,9 +73,10 @@ printf ("EED %p ~wxGEditorTabPanel()\n" , this ); baseview->Configure(); _sceneManager=new wxVtkSceneManager(this,baseview,_id); + +//EED02JUIN2010 printf("RaC-EED 21-06-2010 wxGEditorTabPanel::initWxVtkCanvas Remove the panelAUIMgr, and change to a normal sizer inside the wxGEditorTabPanel\n"); _panelAUIMgr->AddPane((wxWindow*)baseview->GetWxVTKRenderWindowInteractor(),wxAuiPaneInfo().Fixed().CenterPane()); -//EED02JUIN2010 _panelAUIMgr->Update(); } @@ -92,10 +96,10 @@ printf ("EED %p ~wxGEditorTabPanel()\n" , this ); char *result = NULL; result = strtok( str, delims ); packageName += result; - + result = strtok( NULL, delims ); boxType += result; - + _sceneManager->createGBlackBox(x,y,packageName, boxType); return true; @@ -124,9 +128,9 @@ printf ("EED %p ~wxGEditorTabPanel()\n" , this ); //========================================================================= - std::string wxGEditorTabPanel::getDiagramBBS() + std::string wxGEditorTabPanel::getDiagramBBS(bool wln) { - return _sceneManager->getDiagramBBS(); + return _sceneManager->getDiagramBBS(wln); } //========================================================================= @@ -158,7 +162,7 @@ printf ("EED %p ~wxGEditorTabPanel()\n" , this ); } //========================================================================= - + void wxGEditorTabPanel::saveDiagram(std::string &content) { _sceneManager->saveDiagram(content); @@ -207,7 +211,7 @@ printf ("EED %p ~wxGEditorTabPanel()\n" , this ); } //========================================================================= - + std::map wxGEditorTabPanel::getSelectedObjects() { return _sceneManager->getSelectedObjects(); @@ -220,22 +224,22 @@ printf ("EED %p ~wxGEditorTabPanel()\n" , this ); _sceneManager->addObjects(objectsMap); } - //========================================================================= - + //========================================================================= + int wxGEditorTabPanel::getNumSelectedObjects() { return _sceneManager->getNumSelectedObjects(); } - //========================================================================= + //========================================================================= + - wxVtkSceneManager* wxGEditorTabPanel::getSceneManager() { return _sceneManager; } - - + + } // EO namespace bbtk // EOF diff --git a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxGEditorTabPanel.h b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxGEditorTabPanel.h index 0f3b3bf..28ba74d 100644 --- a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxGEditorTabPanel.h +++ b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxGEditorTabPanel.h @@ -1,4 +1,4 @@ -/*========================================================================= +/*========================================================================= Program: bbtk Module: $RCSfile$ Language: C++ @@ -11,28 +11,28 @@ Version: $Revision$ * Copyright (c) CREATIS-LRMN (Centre de Recherche en Imagerie Medicale) * Authors : Eduardo Davila, Laurent Guigues, Jean-Pierre Roux * -* This software is governed by the CeCILL-B license under French law and -* abiding by the rules of distribution of free software. You can use, -* modify and/ or redistribute the software under the terms of the CeCILL-B -* license as circulated by CEA, CNRS and INRIA at the following URL -* http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html +* This software is governed by the CeCILL-B license under French law and +* abiding by the rules of distribution of free software. You can use, +* modify and/ or redistribute the software under the terms of the CeCILL-B +* license as circulated by CEA, CNRS and INRIA at the following URL +* http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html * or in the file LICENSE.txt. * * As a counterpart to the access to the source code and rights to copy, * modify and redistribute granted by the license, users are provided only * with a limited warranty and the software's author, the holder of the * economic rights, and the successive licensors have only limited -* liability. +* liability. * * The fact that you are presently reading this means that you have had * knowledge of the CeCILL-B license and that you accept its terms. -* ------------------------------------------------------------------------ */ +* ------------------------------------------------------------------------ */ /** -* \file -* \brief Class bbtk::BlackBox : abstract black-box interface. +* \file +* \brief Class bbtk::BlackBox : abstract black-box interface. */ /**** @@ -67,12 +67,12 @@ namespace bbtk class tmpClasswxTextDropTarget : public wxTextDropTarget { - public: + public: virtual bool OnDropText(wxCoord x, wxCoord y, const wxString& data) { return false;} }; - //RaC: It is important if it exists a double relation + //RaC: It is important if it exists a double relation //e.g. wxGEditorTabPanel includes wxVtkSceneManager, and wxVtkSceneManager includes wxGEditorTabPanel class wxVtkSceneManager; class wxTabPanelsManager; @@ -80,18 +80,18 @@ namespace bbtk // RaC Be careful with the double heritance class wxGEditorTabPanel : public wxPanel, public wxTextDropTarget { - public: + public: wxGEditorTabPanel(); wxGEditorTabPanel(wxWindow *parent, int id); ~wxGEditorTabPanel(); void initWxVtkCanvas(); - + // Sets the parent manager void setPanelsManager(wxTabPanelsManager* panelsManager); // Get the BBS script of the pipeline diagram included in the panel - std::string getDiagramBBS(); + std::string getDiagramBBS(bool wln=false); // Saves the actual BBS as complex box // RaC TOFIX It must be included the package of the complex box @@ -102,7 +102,7 @@ namespace bbtk // Save diagram as BBG void saveDiagram(std::string &content); - + // Load BBG diagram void loadDiagram(ifstream &inputStream); @@ -126,7 +126,7 @@ namespace bbtk bool isComplexBox(); void setComplexBox(bool val); - // Returns a map with the id,controller of all the objects selected + // Returns a map with the id,controller of all the objects selected std::map getSelectedObjects(); void addObjects(std::map objectsMap); @@ -135,16 +135,16 @@ namespace bbtk // Receives the string from a drag and drop source as for example the BBTK Package Browser virtual bool OnDropText(wxCoord x, wxCoord y, const wxString& data); - + wxVtkSceneManager* getSceneManager(); //========================================================================= - + private: int _id; wxAuiManager *_panelAUIMgr; wxVtkSceneManager *_sceneManager; - wxTabPanelsManager * _panelsManager; + wxTabPanelsManager *_panelsManager; protected: diff --git a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxTabPanelsManager.cxx b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxTabPanelsManager.cxx index a1e42a0..bca6b0b 100644 --- a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxTabPanelsManager.cxx +++ b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxTabPanelsManager.cxx @@ -1,4 +1,4 @@ -/*========================================================================= +/*========================================================================= Program: bbtk Module: $RCSfile$ Language: C++ @@ -11,26 +11,26 @@ Version: $Revision$ * Copyright (c) CREATIS-LRMN (Centre de Recherche en Imagerie Medicale) * Authors : Eduardo Davila, Laurent Guigues, Jean-Pierre Roux * -* This software is governed by the CeCILL-B license under French law and -* abiding by the rules of distribution of free software. You can use, -* modify and/ or redistribute the software under the terms of the CeCILL-B -* license as circulated by CEA, CNRS and INRIA at the following URL -* http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html +* This software is governed by the CeCILL-B license under French law and +* abiding by the rules of distribution of free software. You can use, +* modify and/ or redistribute the software under the terms of the CeCILL-B +* license as circulated by CEA, CNRS and INRIA at the following URL +* http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html * or in the file LICENSE.txt. * * As a counterpart to the access to the source code and rights to copy, * modify and redistribute granted by the license, users are provided only * with a limited warranty and the software's author, the holder of the * economic rights, and the successive licensors have only limited -* liability. +* liability. * * The fact that you are presently reading this means that you have had * knowledge of the CeCILL-B license and that you accept its terms. -* ------------------------------------------------------------------------ */ +* ------------------------------------------------------------------------ */ /** -* \file -* \brief Class bbtk::wxTabPanelsManager . +* \file +* \brief Class bbtk::wxTabPanelsManager . */ @@ -55,15 +55,15 @@ namespace bbtk wxTabPanelsManager::~wxTabPanelsManager() { } - + //========================================================================= void wxTabPanelsManager::addNewTab() { _lastId++; - wxGEditorTabPanel *newPanel = new wxGEditorTabPanel(_notebook,_lastId); + wxGEditorTabPanel *newPanel = new wxGEditorTabPanel(_notebook,_lastId); newPanel->setPanelsManager(this); - _panels[_lastId]=newPanel; - _actual = newPanel; + _panels[_lastId] = newPanel; + _actual = newPanel; _notebook->AddPage(newPanel,_T("Diagram"),true); } @@ -72,7 +72,7 @@ namespace bbtk { return _notebook; } - + //========================================================================= wxGEditorTabPanel* wxTabPanelsManager::getActualTabPanel() { @@ -95,9 +95,9 @@ namespace bbtk //========================================================================= - std::string wxTabPanelsManager::getActualDiagramBBS() + std::string wxTabPanelsManager::getActualDiagramBBS(bool wln) { - return _actual->getDiagramBBS(); + return _actual->getDiagramBBS(wln); } //========================================================================= @@ -153,11 +153,11 @@ namespace bbtk void wxTabPanelsManager::setActualDiagramComplexBox(bool val) { - _actual->setComplexBox(val); + _actual->setComplexBox(val); } //========================================================================= - + void wxTabPanelsManager::addActualDiagramComplexInputPort(std::string portName) { _actual->addComplexInputPort(portName); @@ -190,12 +190,24 @@ namespace bbtk //========================================================================= + void wxTabPanelsManager::VerifyLastTabPanel() + { +printf("wxTabPanelsManager::VerifyActualTabPanel %d \n", this->_notebook->GetPageCount() ); + if (this->_notebook->GetPageCount()==0) + { + this->_actual=NULL; + } + } + + //========================================================================= + void wxTabPanelsManager::OnTabChanged(wxAuiNotebookEvent& event) { - int index = event.GetSelection(); - wxGEditorTabPanel* tab =(wxGEditorTabPanel*)_notebook->GetPage(index); - int id = tab->getPanelId(); - _actual = _panels[id]; +printf("wxTabPanelsManager::OnTabChanged \n"); + int index = event.GetSelection(); + wxGEditorTabPanel* tab = (wxGEditorTabPanel*)_notebook->GetPage(index); + int id = tab->getPanelId(); + _actual = _panels[id]; _parent->refreshGUIControls(); } diff --git a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxTabPanelsManager.h b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxTabPanelsManager.h index f9ff803..ec6cfdf 100644 --- a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxTabPanelsManager.h +++ b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxTabPanelsManager.h @@ -1,4 +1,4 @@ -/*========================================================================= +/*========================================================================= Program: bbtk Module: $RCSfile$ Language: C++ @@ -11,28 +11,28 @@ Version: $Revision$ * Copyright (c) CREATIS-LRMN (Centre de Recherche en Imagerie Medicale) * Authors : Eduardo Davila, Laurent Guigues, Jean-Pierre Roux * -* This software is governed by the CeCILL-B license under French law and -* abiding by the rules of distribution of free software. You can use, -* modify and/ or redistribute the software under the terms of the CeCILL-B -* license as circulated by CEA, CNRS and INRIA at the following URL -* http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html +* This software is governed by the CeCILL-B license under French law and +* abiding by the rules of distribution of free software. You can use, +* modify and/ or redistribute the software under the terms of the CeCILL-B +* license as circulated by CEA, CNRS and INRIA at the following URL +* http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html * or in the file LICENSE.txt. * * As a counterpart to the access to the source code and rights to copy, * modify and redistribute granted by the license, users are provided only * with a limited warranty and the software's author, the holder of the * economic rights, and the successive licensors have only limited -* liability. +* liability. * * The fact that you are presently reading this means that you have had * knowledge of the CeCILL-B license and that you accept its terms. -* ------------------------------------------------------------------------ */ +* ------------------------------------------------------------------------ */ /** -* \file -* \brief Class bbtk::BlackBox : abstract black-box interface. +* \file +* \brief Class bbtk::BlackBox : abstract black-box interface. */ /**** @@ -66,11 +66,11 @@ namespace bbtk class wxTabPanelsManager : public wxEvtHandler { - public: + public: wxTabPanelsManager(wxGUIEditorGraphicBBS *parent); ~wxTabPanelsManager(); - + void addNewTab(); wxAuiNotebook* getAuiNotebook(); wxGEditorTabPanel* getActualTabPanel(); @@ -78,7 +78,7 @@ namespace bbtk void displayBlackBoxInfo(std::string packageName, std::string boxName); void updateStatusBar(std::string textStatus); - std::string getActualDiagramBBS(); + std::string getActualDiagramBBS(bool wln=false); std::string getActualComplexBoxBBS(std::string cbName,std::string cbAuthor="",std::string cbCategory="",std::string cbDescription=""); void editBlackBox(GBlackBoxModel *bbmodel); @@ -92,18 +92,19 @@ namespace bbtk void addActualDiagramComplexOutputPort(std::string portName); void copySelectedBBoxesToComplexDiagram(); int getNumActualSelectedObjects(); - + void OnTabChanged(wxAuiNotebookEvent& event); + void VerifyLastTabPanel(); private: // Private Attributes - wxGUIEditorGraphicBBS *_parent; - map _panels; - wxGEditorTabPanel* _actual; - wxAuiNotebook *_notebook; - int _lastId; - + wxGUIEditorGraphicBBS *_parent; + map _panels; + wxGEditorTabPanel *_actual; + wxAuiNotebook *_notebook; + int _lastId; + protected: }; diff --git a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxVtkSceneManager.cxx b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxVtkSceneManager.cxx index 60f3cb5..de07bcb 100644 --- a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxVtkSceneManager.cxx +++ b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxVtkSceneManager.cxx @@ -1,4 +1,4 @@ -/*========================================================================= +/*========================================================================= Program: bbtk Module: $RCSfile$ Language: C++ @@ -11,26 +11,26 @@ Version: $Revision$ * Copyright (c) CREATIS-LRMN (Centre de Recherche en Imagerie Medicale) * Authors : Eduardo Davila, Laurent Guigues, Jean-Pierre Roux * -* This software is governed by the CeCILL-B license under French law and -* abiding by the rules of distribution of free software. You can use, -* modify and/ or redistribute the software under the terms of the CeCILL-B -* license as circulated by CEA, CNRS and INRIA at the following URL -* http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html +* This software is governed by the CeCILL-B license under French law and +* abiding by the rules of distribution of free software. You can use, +* modify and/ or redistribute the software under the terms of the CeCILL-B +* license as circulated by CEA, CNRS and INRIA at the following URL +* http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html * or in the file LICENSE.txt. * * As a counterpart to the access to the source code and rights to copy, * modify and redistribute granted by the license, users are provided only * with a limited warranty and the software's author, the holder of the * economic rights, and the successive licensors have only limited -* liability. +* liability. * * The fact that you are presently reading this means that you have had * knowledge of the CeCILL-B license and that you accept its terms. -* ------------------------------------------------------------------------ */ +* ------------------------------------------------------------------------ */ /** -* \file -* \brief Class bbtk::wxVtkSceneManager . +* \file +* \brief Class bbtk::wxVtkSceneManager . */ @@ -56,14 +56,16 @@ namespace bbtk if( _baseView!=NULL ) { -//EED02JUIN2010 +//EED02JUIN2010 printf ("RaC-EED 21-06-2010 %p wxVtkSceneManager::wxVtkSceneManager If you comment this line, the drag and drop functionnality is not initialized.\n" , this ); - _baseView->GetWxVTKRenderWindowInteractor()->SetDropTarget((wxDropTarget*)parent); +#ifdef _APPLE_ + _baseView->GetWxVTKRenderWindowInteractor()->SetDropTarget((wxDropTarget*)parent); +#endif configureBaseView(); _worldState=NOTHING_HAPPENS; registerController(this); - + } _idConnectionInCreation = -1; _contLastId = 0; @@ -86,7 +88,7 @@ namespace bbtk printf ("EED %p ~wxVtkSceneManager()\n" , this ); disconnectDrop(); } - + //========================================================================= void wxVtkSceneManager::configureBaseView() @@ -100,27 +102,27 @@ namespace bbtk interactorstylebaseview->SetInteractor ( iren ); iren->SetInteractorStyle(interactorstylebaseview); interactorstylebaseview->SetwxVtkBaseView(_baseView); - + _baseView->GetRenderer()->GetActiveCamera()->ParallelProjectionOn(); _baseView->GetRenderer()->ResetCamera(-100,100,-100,100,800,1100); - + _baseView->GetRenderer()->SetBackground(0.9,0.9,0.9); _baseView->GetRenderer()->GradientBackgroundOn(); _baseView->Refresh(); - - // Actos Port_Text + + // Actos Port_Text _textActor = vtkTextActor3D::New(); _textActor->SetPosition( -9999 , -9999 , 900 ); _textActor->SetInput( "" ); _textActor->GetTextProperty()->SetFontSize(60); _textActor->GetTextProperty()->BoldOn(); _textActor->GetTextProperty()->SetColor(PORTTEXT_NH_R,PORTTEXT_NH_G,PORTTEXT_NH_B); - + _baseView->GetRenderer()->AddActor( _textActor ); - - + + // Actor Fill_Port_Text - + //------------ double xInic = 0; double yInic = 0; @@ -129,9 +131,9 @@ namespace bbtk vtkPolygon *aPolygon = vtkPolygon::New(); _fillObjectActor = vtkActor::New(); - _pts = vtkPoints::New(); + _pts = vtkPoints::New(); //ups4 EED Borrame - + double w=100,h=10,b=h/15,t=3; _pts->SetNumberOfPoints(21); _pts->InsertPoint(0, xInic+w*0.33-t/2 , yInic , zInic ); @@ -139,17 +141,17 @@ namespace bbtk _pts->InsertPoint(2, xInic+w*0.33+t/2 , yInic , zInic ); _pts->InsertPoint(3, xInic+w*0.33+t/2 , yInic , zInic ); _pts->InsertPoint(4, xInic+w-b*4 , yInic+b*0 , zInic ); - + _pts->InsertPoint( 5, xInic+w-b*4 , yInic+b*0 , zInic ); _pts->InsertPoint( 6, xInic+w-b*2 , yInic+b*1 , zInic ); _pts->InsertPoint( 7, xInic+w-b*1 , yInic+b*2 , zInic ); _pts->InsertPoint( 8, xInic+w-b*0 , yInic+b*4 , zInic ); - + _pts->InsertPoint( 9, xInic+w-b*0 , yInic+h-b*4 , zInic ); _pts->InsertPoint(10, xInic+w-b*1 , yInic+h-b*2 , zInic ); _pts->InsertPoint(11, xInic+w-b*2 , yInic+h-b*1 , zInic ); _pts->InsertPoint(12, xInic+w-b*4 , yInic+h-b*0 , zInic ); - + _pts->InsertPoint(13, xInic+b*4 , yInic+h-b*0 , zInic ); _pts->InsertPoint(14, xInic+b*2 , yInic+h-b*1 , zInic ); _pts->InsertPoint(15, xInic+b*1 , yInic+h-b*2 , zInic ); @@ -159,13 +161,13 @@ namespace bbtk _pts->InsertPoint(18, xInic+b*1 , yInic+b*2 , zInic ); _pts->InsertPoint(19, xInic+b*2 , yInic+b*1 , zInic ); _pts->InsertPoint(20, xInic+b*4 , yInic+b*0 , zInic ); - + aPolygon->GetPointIds()->SetNumberOfIds(21); for (int i=0;i<21; i++) { aPolygon->GetPointIds()->SetId(i, i); } - + vtkUnstructuredGrid *aPolygonGrid = vtkUnstructuredGrid::New(); aPolygonGrid->Allocate(1, 1); aPolygonGrid->InsertNextCell(aPolygon->GetCellType(), aPolygon->GetPointIds()); @@ -177,11 +179,11 @@ namespace bbtk _fillObjectActor->GetProperty()->SetOpacity(0); _aPolygonMapper->Modified(); - _baseView->GetRenderer()->AddActor( _fillObjectActor ); + _baseView->GetRenderer()->AddActor( _fillObjectActor ); } //========================================================================= - + std::string wxVtkSceneManager::generateANewNameForABox() { std::stringstream boxname; @@ -196,7 +198,7 @@ namespace bbtk } //========================================================================= - + std::string wxVtkSceneManager::findANewNameForABox() { std::string boxname=generateANewNameForABox(); @@ -217,13 +219,13 @@ namespace bbtk bbmod->setBBTKName(name); bbmod->setInicPoint(xIn,yIn,zIn); bbmod->setFinalPoint(xEn,yEn,zEn); - bbmod->setExecutable(boxExecutable); - + bbmod->setExecutable(boxExecutable); + bbmod->notifyObservers(_idManager); - } - - + } + + //========================================================================= int wxVtkSceneManager::createGBlackBox(int x, int y, std::string packageName, std::string boxType) @@ -235,39 +237,38 @@ namespace bbtk int type = GBLACKBOX; //Create the MVC Objects - + GBlackBoxModel *model = (GBlackBoxModel*)GObjectsMVCFactory::getInstance()->createGObjectModel(type); vtkGObjectView *view = GObjectsMVCFactory::getInstance()->createGObjectView(type); GObjectController* controller = GObjectsMVCFactory::getInstance()->createGObjectController(type); - + BlackBoxDescriptor::Pointer descriptor = GObjectsMVCFactory::getInstance()->getBlackBoxDescriptor(packageName, boxType); - + //Prepares the initial model - //The coordinates obtained are the following. Top-Left:x=0,y=0 Bottom-Right:x=width,y=height + //The coordinates obtained are the following. Top-Left:x=0,y=0 Bottom-Right:x=width,y=height double xx = x; double yy = windowHeight-y; - + //z value is not important yet, because it is only used a parallel projection double zz = 900; -printf("EED wxVtkSceneManager::createGBlackBox 900-450\n"); _baseView->TransCoordScreenToWorld(xx,yy,zz); model->setInicPoint(xx,yy,zz); - + std::stringstream stream; - + std::string newBoxName; newBoxName = findANewNameForABox(); - - + + stream << newBoxName; - + std::string arraystring = stream.str(); model->setBBTKName(arraystring); model->setBBTKType(boxType); model->setBBTKPackage(packageName); - + model->addObserver(view); model->addObserver(this); @@ -301,13 +302,13 @@ printf("EED wxVtkSceneManager::createGBlackBox 900-450\n"); view->setModel(model); view->setBaseView(_baseView); view->initVtkObjects(); - + //Associates the controller with the correspondent model and view controller->setModelAndView(model,view); //Resgiter change to the observers of the actual model model->notifyObservers(_idManager); - + int newId = addObjectController(controller); return newId; @@ -320,56 +321,56 @@ printf("EED wxVtkSceneManager::createGBlackBox 900-450\n"); { //EED int windowWidth=_baseView->GetRenWin()->GetSize()[0]; int windowHeight=_baseView->GetRenWin()->GetSize()[1]; - + int type = GCOMPLEXINPUTPORT; //Create the MVC Objects - + GComplexBoxPortModel *model = (GComplexBoxPortModel*)GObjectsMVCFactory::getInstance()->createGObjectModel(type); vtkGObjectView *view = GObjectsMVCFactory::getInstance()->createGObjectView(type); GObjectController* controller = GObjectsMVCFactory::getInstance()->createGObjectController(type); - - //Prepares the initial model + + //Prepares the initial model double xx = 5; double yy = windowHeight-5; - + //z value is not important yet, because it is only used a parallel projection double zz = 900; printf("EED wxVtkSceneManager::createGComplexBoxInputPort 900-450\n"); _baseView->TransCoordScreenToWorld(xx,yy,zz); model->setInicPoint(xx,yy,zz); - + model->setBBTKName(inputName); model->setBBTKType("ComplexInputPort"); model->setComplexPortType(type); - + model->addObserver(view); model->addObserver(this); - - //create the output port + + //create the output port GPortController* portController = createGPort(GOUTPUTPORT,inputName,"ComplexInputPort",0,model); model->addOutputPort((GPortModel*)portController->getModel()); - + //Associates the view with the correspondent renderer and the model. //(NOTE: Refresh is only made by the view) view->setModel(model); view->setBaseView(_baseView); view->initVtkObjects(); - + //Associates the controller with the correspondent model and view controller->setModelAndView(model,view); //Resgiter change to the observers of the actual model model->notifyObservers(_idManager); - + int newId = addObjectController(controller); return newId; } //========================================================================= - + int wxVtkSceneManager::createGComplexBoxOutputPort(std::string outputName) { //EED int windowWidth=_baseView->GetRenWin()->GetSize()[0]; @@ -378,47 +379,47 @@ printf("EED wxVtkSceneManager::createGComplexBoxInputPort 900-450\n"); int type = GCOMPLEXOUTPUTPORT; //Create the MVC Objects - + GComplexBoxPortModel *model = (GComplexBoxPortModel*)GObjectsMVCFactory::getInstance()->createGObjectModel(type); vtkGObjectView *view = GObjectsMVCFactory::getInstance()->createGObjectView(type); GObjectController *controller = GObjectsMVCFactory::getInstance()->createGObjectController(type); - - //Prepares the initial model + + //Prepares the initial model double xx = 5; double yy = windowHeight-5; - + //z value is not important yet, because it is only used a parallel projection double zz = 900; - + printf("EED wxVtkSceneManager::createGComplexBoxOutputPort 900-450\n"); _baseView->TransCoordScreenToWorld(xx,yy,zz); model->setInicPoint(xx,yy,zz); - + model->setBBTKName(outputName); model->setBBTKType("ComplexOutputPort"); model->setComplexPortType(type); - + model->addObserver(view); model->addObserver(this); - - //create the output port + + //create the output port GPortController* portController = createGPort(GINPUTPORT,outputName,"ComplexInputPort",0,model); model->addInputPort((GPortModel*)portController->getModel()); - + //Associates the view with the correspondent renderer and the model. //(NOTE: Refresh is only made by the view) view->setModel(model); view->setBaseView(_baseView); view->initVtkObjects(); - + //Associates the controller with the correspondent model and view controller->setModelAndView(model,view); //Resgiter change to the observers of the actual model model->notifyObservers(_idManager); - + int newId = addObjectController(controller); return newId; } @@ -453,7 +454,7 @@ printf("EED wxVtkSceneManager::createGComplexBoxOutputPort 900-450\n"); GObjectController* controller = GObjectsMVCFactory::getInstance()->createGObjectController(type); model->registerInBox(blackBox,portType, posInBox); - + model->setBBTKType(bbtkType); model->setBBTKName(bbtkName); @@ -465,7 +466,7 @@ printf("EED wxVtkSceneManager::createGComplexBoxOutputPort 900-450\n"); view->setModel(model); view->setBaseView(_baseView); view->initVtkObjects(); - + //Associates the controller with the correspondent model and view controller->setModelAndView(model,view); @@ -486,7 +487,7 @@ printf("EED wxVtkSceneManager::createGComplexBoxOutputPort 900-450\n"); manualConnectorContourView* manContourView = new manualConnectorContourView(); manualContourModel* manContourModel = new manualContourModel(); - GConnectorController* connectorcontroller = new GConnectorController(); + GConnectorController* connectorcontroller = new GConnectorController(); GConnectorModel* connectorModel = new GConnectorModel(); vtkGConnectorView* connectorView = new vtkGConnectorView(); connectorModel->setGObjectType(type); @@ -506,7 +507,7 @@ printf("EED wxVtkSceneManager::createGComplexBoxOutputPort 900-450\n"); manContourView->SetShowText(false); manContourControl->SetModelView( manContourModel , manContourView ); - + manContourControl->CreateNewManualContour(); manContourView->RefreshContour(); @@ -517,7 +518,7 @@ printf("EED wxVtkSceneManager::createGComplexBoxOutputPort 900-450\n"); manContourControl->SetState(1); manContourModel->SetCloseContour(false); - + manContourModel->AddPoint(x,y,z); manContourView->AddPoint(); @@ -534,12 +535,12 @@ printf("EED wxVtkSceneManager::createGComplexBoxOutputPort 900-450\n"); int newId = addObjectController(connectorcontroller); - connectorcontroller->setManualContourController(manContourControl); + connectorcontroller->setManualContourController(manContourControl); connectorModel->setManualContourModel(manContourModel); connectorView->setManualContourView(manContourView); connectorView->setModel(connectorModel); connectorView->setBaseView(_baseView); - + connectorModel->addObserver(connectorView); connectorModel->addObserver(this); @@ -578,37 +579,66 @@ printf("EED wxVtkSceneManager::createGComplexBoxOutputPort 900-450\n"); } //========================================================================= - + + //========================================================================= + int wxVtkSceneManager::GetIndexInSelected(int idControler) + { + int index=-1; + for (int i=0; i<(int)_selectedObjects.size(); i++) + { + if(_selectedObjects[i]==idControler) + { + index=i; + break; + } + } + return index; + } + //========================================================================= + void wxVtkSceneManager::update(int idController,int command) { +printf("EED wxVtkSceneManager::update 1 \n" ); + if(command != NO_COMMAND) { if(command == ADD_TO_SELECTED) { -//EED GObjectController* cont = _controllers[idController]; +//EEDBorrame GObjectController* cont = _controllers[idController]; - bool foundID=false; - for (int i=0; i<(int)_selectedObjects.size() && foundID==false; i++) - { - int id = _selectedObjects[i]; - if(id==idController) - { - foundID = true; - } - } - if(!foundID) + if (GetIndexInSelected(idController)==-1) { - int id = idController; - _selectedObjects.push_back(id); + _selectedObjects.push_back(idController); } - } +//EEDBorrame +// bool foundID=false; +// for (int i=0; i<(int)_selectedObjects.size() && foundID==false; i++) +// { +// if(_selectedObjects[i]==idController) +// { +// foundID = true; +// } +// } +// if(!foundID) +// { +// _selectedObjects.push_back(idController); +// } + + }else if(command == REMOVE_FROM_SELECTED) + { + int index=GetIndexInSelected(idController); + if (index>=0) + { + _selectedObjects.erase( _selectedObjects.begin()+index ); + } + } else if(command == INIT_CREATION_CONTOUR) - { - _worldState = INIT_CREATION_CONTOUR; - GObjectController* cont = _controllers[idController]; + { + _worldState = INIT_CREATION_CONTOUR; + GObjectController* cont = _controllers[idController]; GPortModel* startOutputPort = (GPortModel*)cont->getModel(); - + // The last one is the controller of the connector std::map::iterator it2; @@ -635,7 +665,7 @@ printf("EED wxVtkSceneManager::createGComplexBoxOutputPort 900-450\n"); cont->getView()->setState(NOTHING_HAPPENS); cont->getModel()->notifyObservers(_idManager); cont->SetActive(false); - } + } } _selectedObjects.clear(); @@ -644,10 +674,10 @@ printf("EED wxVtkSceneManager::createGComplexBoxOutputPort 900-450\n"); } else if(command == FIN_CREATION_CONTOUR && _worldState == INIT_CREATION_CONTOUR) - { + { _worldState = NOTHING_HAPPENS; //int id = _controllers.size()-1; - GObjectController* cont = _controllers[_idConnectionInCreation]; + GObjectController* cont = _controllers[_idConnectionInCreation]; GConnectorModel* modelContour = (GConnectorModel*)cont->getModel(); GObjectController* finPort = _controllers[idController]; @@ -655,9 +685,9 @@ printf("EED wxVtkSceneManager::createGComplexBoxOutputPort 900-450\n"); { GPortModel* modelPort = (GPortModel*)finPort->getModel(); modelContour->setEndPort(modelPort); - } + } - manualConnectorContourController* manCont = ((GConnectorController*)cont)->getManualContourController(); + manualConnectorContourController* manCont = ((GConnectorController*)cont)->getManualContourController(); manualConnectorContourView* connView = (manualConnectorContourView*)manCont->GetManualViewBaseContour(); connView->Refresh(); @@ -671,11 +701,14 @@ printf("EED wxVtkSceneManager::createGComplexBoxOutputPort 900-450\n"); cont->getView()->setState(NOTHING_HAPPENS); cont->getModel()->notifyObservers(_idManager); } - cont->SetActive(true); + cont->SetActive(true); } } - + } + +printf("EED wxVtkSceneManager::update 2 \n" ); + } //========================================================================= @@ -688,10 +721,10 @@ printf("EED wxVtkSceneManager::createGComplexBoxOutputPort 900-450\n"); wxVTKRenderWindowInteractor *wxVTKiren; wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk3DBaseView()->GetWxVTKRenderWindowInteractor(); wxVTKiren->GetEventPosition(X,Y); - - + + if(_worldState == DRAG_OBJECTS) - { + { for (int i=0; i<(int)_selectedObjects.size(); i++) { int id = _selectedObjects[i]; @@ -716,7 +749,7 @@ printf("EED wxVtkSceneManager::createGComplexBoxOutputPort 900-450\n"); vconn->updateStartEndPoints(); } } - + _startDragging=false; } @@ -730,7 +763,7 @@ printf("EED wxVtkSceneManager::createGComplexBoxOutputPort 900-450\n"); int type = desc->getGObjectType(); int state = desc->getView()->getState(); desc->getModel()->getCenter(px,py,pz); - + if(state == HIGHLIGHTED){ okStatusMessage = true; updateStatusBar(desc->getStatusText()); @@ -747,8 +780,8 @@ printf("EED wxVtkSceneManager::createGComplexBoxOutputPort 900-450\n"); _textActor->SetInput( desc->getStatusText().c_str() ); _textActor->SetScale(0.1); _textActor->SetPosition( px-25 ,py+1 , pz+2 ); - -//ups4 EED Borrame + +//ups4 EED Borrame // FillPortText px=px-33; py=py; @@ -759,25 +792,25 @@ printf("EED wxVtkSceneManager::createGComplexBoxOutputPort 900-450\n"); } // if GPORT } // for controllers it - } + } } - if (okStatusMessage==false) + if (okStatusMessage==false) { updateStatusBar(""); } - - if (okPortMessage==false) + + if (okPortMessage==false) { _textActor->SetScale(0.0001); _fillObjectActor->SetScale(0.0001); } - + return true; } //========================================================================= - + bool wxVtkSceneManager::OnLeftButtonDown() { if(_worldState==INIT_CREATION_CONTOUR) @@ -796,16 +829,18 @@ printf("EED wxVtkSceneManager::createGComplexBoxOutputPort 900-450\n"); isOverPort=true; } // if } // if - } // for - + } // for + if(isOverPort==false) { _worldState=NOTHING_HAPPENS; //int lastId = _controllers.size()-1; - GConnectorController *connector = (GConnectorController*)_controllers[_controllers.size()-1]; +//EED2Oct2010 GConnectorController *connector = (GConnectorController*)_controllers[_controllers.size()-1]; + GConnectorController *connector = (GConnectorController*)_controllers[_idConnectionInCreation]; + connector->removeFromScene(); unregisterController(connector); - _controllers.erase(_controllers.size()-1); + _controllers.erase(_controllers.size()-1); for(it = _controllers.begin(); it != _controllers.end(); ++it) { @@ -813,31 +848,45 @@ printf("EED wxVtkSceneManager::createGComplexBoxOutputPort 900-450\n"); desc->SetActive(true); desc->getView()->setState(NOTHING_HAPPENS); desc->getModel()->notifyObservers(_idManager); - } // for + } // for } // isOverPort } // _worldState - - if(_selectedObjects.size()!=0) - { - _worldState = DRAG_OBJECTS; - _startDragging = true; - for (int i = 0; i < (int)_selectedObjects.size(); i++) - { - int id = _selectedObjects[i]; - GObjectController* cont = _controllers[id]; - cont->getView()->setState(DRAG); - cont->getModel()->notifyObservers(_idManager); - } // for - } // _selectedObjects - - - + _worldState = DRAG_OBJECTS; + _startDragging = true; + + +printf("EED wxVtkSceneManager::OnLeftButtonDown 1 \n" ); + + + int ctrlkey = _vtkInteractorStyleBaseView->GetInteractor()->GetControlKey(); + GObjectController *cont = GetGBlackBoxControlerPointedByMouse(); + + if (GetGBlackBoxControlerPointedByMouse()!=NULL) + { + int state=cont->getView()->getState() ; + if( (ctrlkey==0) && (state==HIGHLIGHTED) ) + { + UnSelectBlackBoxes(); + } + } + + + for (int i = 0; i < (int)_selectedObjects.size(); i++) + { + int id = _selectedObjects[i]; + GObjectController* cont = _controllers[id]; + cont->getView()->setState(DRAG); + cont->getModel()->notifyObservers(_idManager); + } // for + +printf("EED wxVtkSceneManager::OnLeftButtonDown 2 \n" ); + return true; } //========================================================================= - + bool wxVtkSceneManager::OnLeftButtonUp() { if(_worldState == DRAG_OBJECTS) @@ -863,10 +912,11 @@ printf("EED wxVtkSceneManager::createGComplexBoxOutputPort 900-450\n"); { _worldState=NOTHING_HAPPENS; //int lastId = _controllers.size()-1; + GConnectorController *connector = (GConnectorController*)_controllers[_idConnectionInCreation]; connector->removeFromScene(); unregisterController(connector); - _controllers.erase(_idConnectionInCreation); + _controllers.erase(_idConnectionInCreation); std::map::iterator it; for(it = _controllers.begin(); it != _controllers.end(); ++it) @@ -878,7 +928,7 @@ printf("EED wxVtkSceneManager::createGComplexBoxOutputPort 900-450\n"); } } - + for (int i = 0; i < (int)_selectedObjects.size(); i++) { int id = _selectedObjects[i]; @@ -895,8 +945,56 @@ printf("EED wxVtkSceneManager::createGComplexBoxOutputPort 900-450\n"); //========================================================================= + GObjectController *wxVtkSceneManager::GetGBlackBoxControlerPointedByMouse() + { + GObjectController *result=NULL; + int X,Y; + wxVTKRenderWindowInteractor *wxVTKiren; + wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk3DBaseView()->GetWxVTKRenderWindowInteractor(); + wxVTKiren->GetEventPosition(X,Y); + + std::map::iterator it; + + for(it = _controllers.begin(); it != _controllers.end() ; ++it) + { + GObjectController *cont = it->second; + int type = cont->getGObjectType(); + + if( cont->getView()->isPointInside(X,Y)==true ) + { + if(type==GBLACKBOX) + { + result=cont; + } // if type + } // if isPointInside + } // for it + return result; + } + + //========================================================================= + bool wxVtkSceneManager::UnSelectBlackBoxes() + { + for (int i=0; i< (int)_selectedObjects.size(); i++) + { + int id = _selectedObjects[i]; + GObjectController* control = _controllers[id]; + control->getView()->setState(NOTHING_HAPPENS); + }// for _selectedObjects + _selectedObjects.clear(); + } + + //========================================================================= bool wxVtkSceneManager::OnLeftDClick() { + GObjectController *cont = GetGBlackBoxControlerPointedByMouse(); + if (cont!=NULL) + { + UnSelectBlackBoxes(); + _parent->editBlackBox( (GBlackBoxModel*)cont->getModel() ); + } + +/*EED Borrame + int X,Y; wxVTKRenderWindowInteractor *wxVTKiren; wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk3DBaseView()->GetWxVTKRenderWindowInteractor(); @@ -910,7 +1008,7 @@ printf("EED wxVtkSceneManager::createGComplexBoxOutputPort 900-450\n"); { GObjectController *cont = it->second; int type = cont->getGObjectType(); - + if(cont->getView()->isPointInside(X,Y)) { if(type==GBLACKBOX) @@ -926,7 +1024,7 @@ printf("EED wxVtkSceneManager::createGComplexBoxOutputPort 900-450\n"); GBlackBoxModel *bbmodel = (GBlackBoxModel*)cont->getModel(); _parent->editBlackBox(bbmodel); } - clickOnObject = true; + clickOnObject = true; } } @@ -934,16 +1032,16 @@ printf("EED wxVtkSceneManager::createGComplexBoxOutputPort 900-450\n"); { //_parent->editDiagramParameters(this); } - +*/ return true; } - + //========================================================================= bool wxVtkSceneManager::OnChar() - { + { char keyCode = _vtkInteractorStyleBaseView->GetInteractor()-> GetKeyCode(); - + // KeyCode 127 : Delete Key // KeyCode 8 : Backspace Key if(keyCode == 8 || keyCode == 127) @@ -952,7 +1050,7 @@ printf("EED wxVtkSceneManager::createGComplexBoxOutputPort 900-450\n"); { for(int i=0;i<(int)_selectedObjects.size();i++) { - int id = _selectedObjects[i]; + int id = _selectedObjects[i]; std::map::iterator it; it = _controllers.find(id); if (it!=_controllers.end()) @@ -971,7 +1069,7 @@ printf("EED wxVtkSceneManager::createGComplexBoxOutputPort 900-450\n"); void wxVtkSceneManager::AddControlerToBeRemove(std::vector *controllersToRemove, int id) { - + int i; bool ok=true; for(i=0 ; i < (int)controllersToRemove->size() ; i++ ) @@ -981,16 +1079,16 @@ printf("EED wxVtkSceneManager::createGComplexBoxOutputPort 900-450\n"); ok=false; } } - + if (ok==true) { controllersToRemove->push_back( id ); } - + } - + //========================================================================= - + void wxVtkSceneManager::deleteObject(int id) { GObjectController *control = _controllers[id]; @@ -1000,7 +1098,7 @@ printf("EED wxVtkSceneManager::createGComplexBoxOutputPort 900-450\n"); { GBoxModel *bbmod = (GBoxModel*)control->getModel(); std::vector inputs = bbmod->getInputPorts(); - + bool boxConnected = false; // Add box input controllers to be removed @@ -1049,12 +1147,12 @@ printf("EED wxVtkSceneManager::createGComplexBoxOutputPort 900-450\n"); AddControlerToBeRemove( &controllersToRemove, bbmod->getObjectId() ); } else if(control->getGObjectType()==GCONNECTOR) - { + { GConnectorModel *conMod = (GConnectorModel*)control->getModel(); AddControlerToBeRemove( &controllersToRemove, conMod->getObjectId() ); } - + std::map::iterator it; for(int i = 0;i<(int)controllersToRemove.size();i++) @@ -1065,7 +1163,7 @@ printf("EED wxVtkSceneManager::createGComplexBoxOutputPort 900-450\n"); if(cont!=NULL) { cont->removeFromScene(); - unregisterController((InteractorStyleMaracas*)cont); + unregisterController((InteractorStyleMaracas*)cont); _controllers.erase(it); }//if }// for @@ -1085,9 +1183,32 @@ printf("EED wxVtkSceneManager::createGComplexBoxOutputPort 900-450\n"); _parent->updateStatusBar(textStatus); } + + //========================================================================= + std::string wxVtkSceneManager::LineNumber(bool withLineNumber, int &value) + { + std::string result=""; + if (withLineNumber==true) + { + value++; + stringstream StrStream; + StrStream << value; + std::string strValue=StrStream.str(); + if (value<10) + { + result+=" "; + }else if (value<100) + { + result+=" "; + } + + result+=strValue+": "; + } + return result; + } //========================================================================= - std::string wxVtkSceneManager::getDiagramBBS() + std::string wxVtkSceneManager::getDiagramBBS(bool wln) { bool existsExec=false; @@ -1106,7 +1227,7 @@ printf("EED wxVtkSceneManager::createGComplexBoxOutputPort 900-450\n"); if(type==GBLACKBOX) { GBlackBoxModel *mod = (GBlackBoxModel*)desc->getModel(); - + std::string pkg = mod->getBBTKPackage(); bool existsPkg = false; for(int t = 0;t< (int)packages.size() && existsPkg == false;t++) @@ -1135,27 +1256,32 @@ printf("EED wxVtkSceneManager::createGComplexBoxOutputPort 900-450\n"); } } + int lnNmbr=0; std::string script = ""; - script+="# BBTK GEditor Script\n"; - script+="# ----------------------\n"; - script+="\n"; + script+=LineNumber(wln,lnNmbr)+"# BBTK GEditor Script\n"; + script+=LineNumber(wln,lnNmbr)+"# ----------------------\n"; + script+=LineNumber(wln,lnNmbr)+"\n"; if(existsExec) { - script+="include std\n"; // EED - script+="include itkvtk\n"; // EED + script+=LineNumber(wln,lnNmbr)+"include std\n"; // EED + script+=LineNumber(wln,lnNmbr)+"include itkvtk\n"; // EED int i; for(i = 0; i< (int)packages.size();i++) { + script+=LineNumber(wln,lnNmbr); script+="include "; script+=packages[i]; script+="\n"; } + + script+=LineNumber(wln,lnNmbr); script+="\n"; // script+="include std\n"; // JPR for(i = 0; i < (int)boxes.size();i++) { + script+=LineNumber(wln,lnNmbr); script+="new "; int id = boxes[i]; GObjectController *control = _controllers[id]; @@ -1172,6 +1298,7 @@ printf("EED wxVtkSceneManager::createGComplexBoxOutputPort 900-450\n"); GPortModel* inputPort = inputs[j]; if(inputPort->isValueSet()) { + script+=LineNumber(wln,lnNmbr); script+=" set "; script+=model->getBBTKName(); script+="."; @@ -1181,14 +1308,18 @@ printf("EED wxVtkSceneManager::createGComplexBoxOutputPort 900-450\n"); script+="\n"; } } + + script+=LineNumber(wln,lnNmbr); script+="\n"; } + script+=LineNumber(wln,lnNmbr); script+="\n"; for(i = 0; i<(int)connections.size();i++) { + script+=LineNumber(wln,lnNmbr); script+="connect "; int id = connections[i]; GObjectController *control = _controllers[id]; @@ -1211,9 +1342,11 @@ printf("EED wxVtkSceneManager::createGComplexBoxOutputPort 900-450\n"); script+="\n"; } + script+=LineNumber(wln,lnNmbr); script+="\n"; for(i = 0; i<(int)execBoxes.size();i++) { + script+=LineNumber(wln,lnNmbr); script+="exec "; int id = execBoxes[i]; GObjectController *control = _controllers[id]; @@ -1248,7 +1381,7 @@ printf("EED wxVtkSceneManager::createGComplexBoxOutputPort 900-450\n"); if(type==GBLACKBOX) { GBlackBoxModel *mod = (GBlackBoxModel*)desc->getModel(); - + std::string pkg = mod->getBBTKPackage(); bool existsPkg = false; for(int t = 0;t<(int)packages.size() && existsPkg == false;t++) @@ -1404,7 +1537,7 @@ printf("EED wxVtkSceneManager::createGComplexBoxOutputPort 900-450\n"); } script+="\n"; - + for(i = 0; i<(int)execBoxes.size();i++) { script+="exec "; @@ -1426,7 +1559,7 @@ printf("EED wxVtkSceneManager::createGComplexBoxOutputPort 900-450\n"); script+="\n"; script+="endefine"; - script+="\n"; + script+="\n"; return script; } @@ -1434,22 +1567,22 @@ printf("EED wxVtkSceneManager::createGComplexBoxOutputPort 900-450\n"); //========================================================================= void wxVtkSceneManager::deleteAllBoxes() - { + { std::map::iterator it; for(it = _controllers.begin(); it != _controllers.end(); ++it) { - GObjectController *cont = it->second; + GObjectController *cont = it->second; cont->removeFromScene(); unregisterController((InteractorStyleMaracas*)cont); } _selectedObjects.clear(); - _controllers.clear(); + _controllers.clear(); refreshScene(); } //========================================================================= - + void wxVtkSceneManager::refresh() { _baseView->Refresh(); @@ -1460,9 +1593,9 @@ printf("EED wxVtkSceneManager::createGComplexBoxOutputPort 900-450\n"); { _baseView->RefreshView(); } - + //========================================================================= - + void wxVtkSceneManager::centerView() { double temp[3]; @@ -1493,7 +1626,7 @@ printf("EED wxVtkSceneManager::createGComplexBoxOutputPort 900-450\n"); sprintf (buffer, "%d", insize); content+=buffer; content+="\n"; - + for(int i = 0;i> numInputs; - + for(int i = 0;i> numOutputs; - + for(int i = 0;i> numBoxes; - + for(int i = 0;i> yIn; std::istringstream zSt(zInic); zSt >> zIn; - + //---------- getline(inputStream,line);//xEnd:yEnd:zEnd strcpy( coord, line.c_str() ); @@ -1761,14 +1894,14 @@ printf("EED wxVtkSceneManager::createGComplexBoxOutputPort 900-450\n"); { boxExecutable= true; } - + int idBox = createGBlackBox(xIn,yIn,package,type); configGBlackBox(idBox, xIn,yIn,zIn,name, boxExecutable,xEn,yEn,zEn); - + GObjectController *cont = _controllers[idBox]; GBlackBoxModel *bbmod = (GBlackBoxModel*)cont->getModel(); - + //---------- getline(inputStream,line);//PORT o FIN_BOX std::string port=line.substr(0,4); @@ -1782,11 +1915,11 @@ printf("EED wxVtkSceneManager::createGComplexBoxOutputPort 900-450\n"); result = strtok( NULL, delims );//value std::string value(result); - bbmod->setValueToInput(name,value); + bbmod->setValueToInput(name,value); getline(inputStream,line);//PORT o FIN_BOX port=line.substr(0,4); - } // while + } // while //EED bbmod->notifyObservers(_idManager); } // for boxes @@ -1798,11 +1931,11 @@ printf("EED wxVtkSceneManager::createGComplexBoxOutputPort 900-450\n"); strcpy( conns, line.c_str() ); result = strtok( conns, delims ); result = strtok( NULL, delims ); - + int numConns; std::istringstream isCons(result); isCons >> numConns; - + for(int i = 0;igetModel(); cbmod->setInicPoint(xIn,yIn,zIn); - cbmod->notifyObservers(_idManager); + cbmod->notifyObservers(_idManager); } //========================================================================= - - + + //========================================================================= GBoxModel* wxVtkSceneManager::findGBox(std::string boxname) - { + { int j; int idB; GBoxModel *bMod; GBoxModel *boxModel = NULL; - std::vector lstB = getBlackBoxes(); + std::vector lstB = getBlackBoxes(); for(j = 0;j<(int)lstB.size();j++) { idB = lstB[j]; @@ -1865,7 +1998,7 @@ printf("EED wxVtkSceneManager::createGComplexBoxOutputPort 900-450\n"); boxModel = bMod; } } // for - + if((_isComplexBox) && (boxModel==NULL)) { std::vector lstInputs = getComplexInputPorts(); @@ -1876,37 +2009,36 @@ printf("EED wxVtkSceneManager::createGComplexBoxOutputPort 900-450\n"); if(_controllers[idB]->getModel()->getBBTKName()==boxname) { boxModel = bMod; - } + } } // for - + std::vector lstOutputs = getComplexOutputPorts(); for(j = 0;j<(int)lstOutputs.size();j++) { int idB = lstOutputs[j]; bMod = (GBoxModel*)_controllers[idB]->getModel(); if(_controllers[idB]->getModel()->getBBTKName()==boxname) - { + { boxModel = bMod; - } + } } // for - + } // complex box return boxModel; } - + //========================================================================= - void wxVtkSceneManager::configGConnetion(std::string nameStartBox, std::string nameStartPort, std::string + void wxVtkSceneManager::configGConnetion(std::string nameStartBox, std::string nameStartPort, std::string nameEndBox, std::string nameEndPort) { - printf("EED wxVtkSceneManager::configGConnetion 1 %s %s %s %s\n", nameStartBox.c_str(), nameStartPort.c_str(), nameEndBox.c_str(), nameEndPort.c_str() ); - + GBoxModel *boxModel; GPortModel *startP = NULL; GPortModel *endP = NULL; - + boxModel= findGBox(nameStartBox); if (boxModel!=NULL) { @@ -1919,19 +2051,16 @@ printf("EED wxVtkSceneManager::createGComplexBoxOutputPort 900-450\n"); endP = boxModel->getInputPort(nameEndPort); } - - printf("EED wxVtkSceneManager::configGConnetion 2 %p %p \n", startP, endP ); - int idCon = createGConnector(startP); _worldState = NOTHING_HAPPENS; - GConnectorController *tempp = (GConnectorController*)_controllers[idCon]; - + GConnectorController *tempp = (GConnectorController*)_controllers[idCon]; + GConnectorModel *conMod = (GConnectorModel*)tempp->getModel(); vtkGConnectorView *conView = (vtkGConnectorView*)tempp->getView(); tempp->endContourCreation(); - conMod->setEndPort(endP); - conView->updateStartEndPoints(); + conMod->setEndPort(endP); + conView->updateStartEndPoints(); } //========================================================================= @@ -1942,7 +2071,7 @@ printf("EED wxVtkSceneManager::createGComplexBoxOutputPort 900-450\n"); std::map::iterator it; for(it = _controllers.begin(); it != _controllers.end(); ++it) { - GObjectController *cont = it->second; + GObjectController *cont = it->second; if(cont->getModel()->getBBTKName()==boxname) { ok=true; @@ -1959,7 +2088,7 @@ printf("EED wxVtkSceneManager::createGComplexBoxOutputPort 900-450\n"); std::map::iterator it; for(it = _controllers.begin(); it != _controllers.end(); ++it) { - GObjectController *cont = it->second; + GObjectController *cont = it->second; if(cont->getGObjectType()==GBLACKBOX) { vect.push_back(cont->getId()); @@ -1976,7 +2105,7 @@ printf("EED wxVtkSceneManager::createGComplexBoxOutputPort 900-450\n"); std::map::iterator it; for(it = _controllers.begin(); it != _controllers.end(); ++it) { - GObjectController *cont = it->second; + GObjectController *cont = it->second; if(cont->getGObjectType()==GCOMPLEXINPUTPORT) { vect.push_back(cont->getId()); @@ -1993,7 +2122,7 @@ printf("EED wxVtkSceneManager::createGComplexBoxOutputPort 900-450\n"); std::map::iterator it; for(it = _controllers.begin(); it != _controllers.end(); ++it) { - GObjectController *cont = it->second; + GObjectController *cont = it->second; if(cont->getGObjectType()==GCOMPLEXOUTPUTPORT) { vect.push_back(cont->getId()); @@ -2010,7 +2139,7 @@ printf("EED wxVtkSceneManager::createGComplexBoxOutputPort 900-450\n"); std::map::iterator it; for(it = _controllers.begin(); it != _controllers.end(); ++it) { - GObjectController *cont = it->second; + GObjectController *cont = it->second; if(cont->getGObjectType()==GCONNECTOR) { vect.push_back(cont->getId()); @@ -2020,7 +2149,7 @@ printf("EED wxVtkSceneManager::createGComplexBoxOutputPort 900-450\n"); } //========================================================================= - + bool wxVtkSceneManager::isComplexBox() { return _isComplexBox; @@ -2032,7 +2161,7 @@ printf("EED wxVtkSceneManager::createGComplexBoxOutputPort 900-450\n"); { _isComplexBox=val; } - + //========================================================================= int wxVtkSceneManager::addObjectController(GObjectController* objController) @@ -2040,7 +2169,7 @@ printf("EED wxVtkSceneManager::createGComplexBoxOutputPort 900-450\n"); //Register the controller of the new object registerController((InteractorStyleMaracas*) objController); - //Add the object to the objects list + //Add the object to the objects list int newId = _contLastId;//_controllers.size(); objController->setId(newId); _controllers[newId] = objController; @@ -2064,7 +2193,7 @@ printf("EED wxVtkSceneManager::createGComplexBoxOutputPort 900-450\n"); std::map::iterator it; for(it = _controllers.begin(); it != _controllers.end(); ++it) { - GObjectController *cont = it->second; + GObjectController *cont = it->second; if(cont->getGObjectType()==GBLACKBOX && cont->getView()->getState()==SELECTED) { mapSelected[cont->getId()]=cont; @@ -2074,7 +2203,7 @@ printf("EED wxVtkSceneManager::createGComplexBoxOutputPort 900-450\n"); std::map::iterator it2; for(it2 = _controllers.begin(); it2 != _controllers.end(); ++it2) { - GObjectController *cont = it2->second; + GObjectController *cont = it2->second; if(cont->getGObjectType()==GCONNECTOR) { GConnectorModel* cmod = (GConnectorModel*)cont->getModel(); @@ -2083,12 +2212,12 @@ printf("EED wxVtkSceneManager::createGComplexBoxOutputPort 900-450\n"); std::map::iterator iterOBJ1 = mapSelected.find(startPortParentBox->getObjectId()); std::map::iterator iterOBJ2 = mapSelected.find(endPortParentBox->getObjectId()); - + if(iterOBJ1 != mapSelected.end() && iterOBJ2 != mapSelected.end()) - { + { int ID = cont->getId(); mapSelected[ID]=cont; - } + } } } return mapSelected; @@ -2098,11 +2227,11 @@ printf("EED wxVtkSceneManager::createGComplexBoxOutputPort 900-450\n"); void wxVtkSceneManager::addObjects(std::map objectsMap) { - + std::map oldIdNewIdBoxes; std::vector connections; - std::map::iterator it; + std::map::iterator it; for(it = objectsMap.begin(); it != objectsMap.end(); ++it) { GObjectController *cont = it->second; @@ -2118,9 +2247,9 @@ printf("EED wxVtkSceneManager::createGComplexBoxOutputPort 900-450\n"); int idcB = copyBox->getObjectId(); oldIdNewIdBoxes[idcB]=idBox; - cont = _controllers[idBox]; + cont = _controllers[idBox]; GBlackBoxModel* newbox = (GBlackBoxModel*)cont->getModel(); - newbox->setInicPoint(xInic,yInic,zInic); + newbox->setInicPoint(xInic,yInic,zInic); int num = newbox->getNumInputPorts(); for(int j=0;jgetId(); connections.push_back(idCon); } - + } - + for(int i = 0 ;i<(int)connections.size();i++) { int objId = connections[i]; - GObjectController *cont = objectsMap[objId]; + GObjectController *cont = objectsMap[objId]; GConnectorModel* connectModel = (GConnectorModel*)cont->getModel(); - + GPortModel* startPort = connectModel->getStartPort(); int startPortIndex = startPort->getPosInBox(); GPortModel* endPort = connectModel->getEndPort(); - int endPortIndex = endPort->getPosInBox(); + int endPortIndex = endPort->getPosInBox(); GBlackBoxModel* startPortParentBox = (GBlackBoxModel*)startPort->getParentBox(); GBlackBoxModel* endPortParentBox = (GBlackBoxModel*)endPort->getParentBox(); - + int idNewStartBox = oldIdNewIdBoxes[startPortParentBox->getObjectId()]; int idNewEndBox = oldIdNewIdBoxes[endPortParentBox->getObjectId()]; @@ -2159,17 +2288,17 @@ printf("EED wxVtkSceneManager::createGComplexBoxOutputPort 900-450\n"); GPortModel* newStartPort = newStartBox->getOutputPort(startPortIndex); GPortModel* newEndPort = newEndBox->getInputPort(endPortIndex); - // Creates connection + // Creates connection int idCon = createGConnector(newStartPort); - GConnectorController *tempp = (GConnectorController*)_controllers[idCon]; + GConnectorController *tempp = (GConnectorController*)_controllers[idCon]; GConnectorModel *conMod = (GConnectorModel*)tempp->getModel(); vtkGConnectorView *conView = (vtkGConnectorView*)tempp->getView(); tempp->endContourCreation(); - conMod->setEndPort(newEndPort); + conMod->setEndPort(newEndPort); conView->updateStartEndPoints(); } - std::map::iterator itIds; + std::map::iterator itIds; for(itIds = oldIdNewIdBoxes.begin(); itIds != oldIdNewIdBoxes.end(); ++itIds) { int idOld = itIds->first; @@ -2197,7 +2326,7 @@ printf("EED wxVtkSceneManager::createGComplexBoxOutputPort 900-450\n"); if(exist==false) { - //Create complex input + //Create complex input int posInBox = oldInputConnections[k]; GPortModel* inputPort = oldBox->getInputPort(posInBox); std::string inputPortName = inputPort->getBBTKName(); @@ -2209,22 +2338,22 @@ printf("EED wxVtkSceneManager::createGComplexBoxOutputPort 900-450\n"); yIn+=20; cbmod->setInicPoint(xIn,yIn,zIn); cbmod->notifyObservers(_idManager); - + GPortModel* inputPortEnd = newBox->getInputPort(posInBox); - // Creates connection + // Creates connection int idCon = createGConnector(cbmod->getOutputPort(0)); - GConnectorController *tempp = (GConnectorController*)_controllers[idCon]; + GConnectorController *tempp = (GConnectorController*)_controllers[idCon]; GConnectorModel *conMod = (GConnectorModel*)tempp->getModel(); vtkGConnectorView *conView = (vtkGConnectorView*)tempp->getView(); tempp->endContourCreation(); - conMod->setEndPort(inputPortEnd); + conMod->setEndPort(inputPortEnd); conView->updateStartEndPoints(); } - + } - + for(int k = 0; k<(int)oldOutputConnections.size();k++) { @@ -2240,7 +2369,7 @@ printf("EED wxVtkSceneManager::createGComplexBoxOutputPort 900-450\n"); if(exist==false) { - //Create complex output + //Create complex output int posInBox = oldOutputConnections[k]; GPortModel* outputPort = oldBox->getOutputPort(posInBox); std::string outputPortName = outputPort->getBBTKName(); @@ -2252,20 +2381,20 @@ printf("EED wxVtkSceneManager::createGComplexBoxOutputPort 900-450\n"); yIn-=20; cbmod->setInicPoint(xIn,yIn,zIn); cbmod->notifyObservers(_idManager); - + GPortModel* outputPortEnd = newBox->getOutputPort(posInBox); - // Creates connection + // Creates connection int idCon = createGConnector(outputPortEnd); - GConnectorController *tempp = (GConnectorController*)_controllers[idCon]; + GConnectorController *tempp = (GConnectorController*)_controllers[idCon]; GConnectorModel *conMod = (GConnectorModel*)tempp->getModel(); vtkGConnectorView *conView = (vtkGConnectorView*)tempp->getView(); tempp->endContourCreation(); - conMod->setEndPort(cbmod->getInputPort(0)); + conMod->setEndPort(cbmod->getInputPort(0)); conView->updateStartEndPoints(); } - + } } @@ -2273,7 +2402,7 @@ printf("EED wxVtkSceneManager::createGComplexBoxOutputPort 900-450\n"); } - //========================================================================= + //========================================================================= } // EO namespace bbtk diff --git a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxVtkSceneManager.h b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxVtkSceneManager.h index 61dc0ca..d7a4011 100644 --- a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxVtkSceneManager.h +++ b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxVtkSceneManager.h @@ -1,4 +1,4 @@ -/*========================================================================= +/*========================================================================= Program: bbtk Module: $RCSfile$ Language: C++ @@ -11,28 +11,28 @@ Version: $Revision$ * Copyright (c) CREATIS-LRMN (Centre de Recherche en Imagerie Medicale) * Authors : Eduardo Davila, Laurent Guigues, Jean-Pierre Roux * -* This software is governed by the CeCILL-B license under French law and -* abiding by the rules of distribution of free software. You can use, -* modify and/ or redistribute the software under the terms of the CeCILL-B -* license as circulated by CEA, CNRS and INRIA at the following URL -* http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html +* This software is governed by the CeCILL-B license under French law and +* abiding by the rules of distribution of free software. You can use, +* modify and/ or redistribute the software under the terms of the CeCILL-B +* license as circulated by CEA, CNRS and INRIA at the following URL +* http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html * or in the file LICENSE.txt. * * As a counterpart to the access to the source code and rights to copy, * modify and redistribute granted by the license, users are provided only * with a limited warranty and the software's author, the holder of the * economic rights, and the successive licensors have only limited -* liability. +* liability. * * The fact that you are presently reading this means that you have had * knowledge of the CeCILL-B license and that you accept its terms. -* ------------------------------------------------------------------------ */ +* ------------------------------------------------------------------------ */ /** -* \file -* \brief Class bbtk::BlackBox : abstract black-box interface. +* \file +* \brief Class bbtk::BlackBox : abstract black-box interface. */ /**** @@ -91,7 +91,7 @@ namespace bbtk class wxVtkSceneManager : public InteractorStyleMaracas , public Observer { - public: + public: wxVtkSceneManager(wxGEditorTabPanel *parent, wxVtk3DBaseView *baseView, int idManager); ~wxVtkSceneManager(); @@ -104,7 +104,7 @@ namespace bbtk virtual bool OnChar(); virtual bool OnMouseMove(); - virtual bool OnLeftButtonDown(); + virtual bool OnLeftButtonDown(); virtual bool OnLeftButtonUp(); virtual bool OnRightButtonUp(); virtual bool OnLeftDClick(); @@ -119,15 +119,15 @@ namespace bbtk int createGConnector(GPortModel* startPort); void configGBlackBox(int idBox, double xIn, double yIn, double zIn, std::string name, bool boxExecutable,double xEn,double yEn,double zEn); - void configGConnetion( std::string nameStartBox, std::string nameStartPort, std::string + void configGConnetion( std::string nameStartBox, std::string nameStartPort, std::string nameEndBox, std::string nameEndPort); void configGComBoxInputOutputPort(bool inputoutput, std::string inputPortName, double xIn, double yIn,double zIn); GBoxModel* findGBox(std::string boxname); - - + + vtkRenderWindow* getRenderWindow(); - vtkRenderer* getRenderer(); + vtkRenderer* getRenderer(); virtual void update(int idController,int command); @@ -163,14 +163,14 @@ namespace bbtk //------- //Returns a string with the BBS script of the current diagram. - std::string getDiagramBBS(); + std::string getDiagramBBS(bool wln=false); //Returns a string with the BBS script of the complex box. std::string saveComplexBoxBBS(std::string cbName,std::string cbAuthor="",std::string cbCategory="",std::string cbDescription=""); //Delete the object in the list of controllers with the id given by parameter. void deleteObject(int id); - + void AddControlerToBeRemove(std::vector *controllersToRemove, int id); //Clear list of controllers and refresh @@ -179,7 +179,7 @@ namespace bbtk //Save the diagram in the BBG format, in the string given by param. void saveDiagram(std::string &content); - //Load the diagram + //Load the diagram void loadDiagram(ifstream &inputStream); //Center the view of the camera in the initial position @@ -217,18 +217,24 @@ namespace bbtk //Saves the id's of the selected objects in the controllers map std::vector _selectedObjects; - //Is the diagram in state complex box + //Is the diagram in state complex box bool _isComplexBox; int _idConnectionInCreation; int _contLastId; - + vtkTextActor3D *_textActor; vtkPoints *_pts; vtkActor *_fillObjectActor; vtkDataSetMapper *_aPolygonMapper; + std::string LineNumber(bool withLineNumber, int &value); + int GetIndexInSelected(int idControler); + bool UnSelectBlackBoxes(); + GObjectController *GetGBlackBoxControlerPointedByMouse(); + + protected: }; -- 2.46.2