From 098558ac7780900858114a8ae01fe93847d67043 Mon Sep 17 00:00:00 2001 From: corredor <> Date: Wed, 31 Mar 2010 15:36:28 +0000 Subject: [PATCH] Basic functionnality adition showing the black box input ports --- .../bbsKernelEditorGraphic/GBlackBoxModel.cxx | 13 +- .../bbsKernelEditorGraphic/GBlackBoxModel.h | 11 +- .../bbsKernelEditorGraphic/GObjectModel.cxx | 18 +++ .../bbsKernelEditorGraphic/GObjectModel.h | 8 +- .../bbsKernelEditorGraphic/GPortModel.cxx | 64 ++++++++++ .../bbsKernelEditorGraphic/GPortModel.h | 89 ++++++++++++++ .../bbsKernelEditorGraphic/GlobalConstants.h | 2 + .../bbsKernelEditorGraphic/Observable.cxx | 84 +++++++++++++ .../bbsKernelEditorGraphic/Observable.h | 96 +++++++++++++++ .../bbsKernelEditorGraphic/Observer.cxx | 64 ++++++++++ .../bbsKernelEditorGraphic/Observer.h | 83 +++++++++++++ .../wxVtkSceneManager.cxx | 70 ++++++++++- .../wxVtkSceneManager.h | 11 ++ .../GObjectController.cxx | 2 +- .../GObjectsMVCFactory.cxx | 12 ++ .../GObjectsMVCFactory.h | 6 + .../GPortController.cxx | 61 ++++++++++ .../bbsVtkGUIEditorGraphic/GPortController.h | 85 +++++++++++++ .../vtkGBlackBoxView.cxx | 2 +- .../bbsVtkGUIEditorGraphic/vtkGBlackBoxView.h | 2 +- .../bbsVtkGUIEditorGraphic/vtkGObjectView.cxx | 2 +- .../bbsVtkGUIEditorGraphic/vtkGObjectView.h | 5 +- .../bbsVtkGUIEditorGraphic/vtkGPortView.cxx | 115 ++++++++++++++++++ .../bbsVtkGUIEditorGraphic/vtkGPortView.h | 98 +++++++++++++++ 24 files changed, 988 insertions(+), 15 deletions(-) create mode 100644 lib/EditorGraphicBBS/bbsKernelEditorGraphic/GPortModel.cxx create mode 100644 lib/EditorGraphicBBS/bbsKernelEditorGraphic/GPortModel.h create mode 100644 lib/EditorGraphicBBS/bbsKernelEditorGraphic/Observable.cxx create mode 100644 lib/EditorGraphicBBS/bbsKernelEditorGraphic/Observable.h create mode 100644 lib/EditorGraphicBBS/bbsKernelEditorGraphic/Observer.cxx create mode 100644 lib/EditorGraphicBBS/bbsKernelEditorGraphic/Observer.h create mode 100644 lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GPortController.cxx create mode 100644 lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GPortController.h create mode 100644 lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGPortView.cxx create mode 100644 lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGPortView.h diff --git a/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GBlackBoxModel.cxx b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GBlackBoxModel.cxx index 4fc3e68..186c745 100644 --- a/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GBlackBoxModel.cxx +++ b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GBlackBoxModel.cxx @@ -51,13 +51,20 @@ namespace bbtk } //========================================================================= - void GBlackBoxModel::updateBlackBox(BlackBoxDescriptor::Pointer descriptor)//virtual + void GBlackBoxModel::addInputPort(GPortModel *inputport) { - _desc=descriptor; - std::cout<<"RaC Box author:"<<_desc->GetAuthor()< _inputs; + std::vector _outputs; + //Private Methods protected: diff --git a/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GObjectModel.cxx b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GObjectModel.cxx index bcfd60d..4ab7fbf 100644 --- a/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GObjectModel.cxx +++ b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GObjectModel.cxx @@ -106,6 +106,20 @@ namespace bbtk //========================================================================= + void GObjectModel::setGObjectType(int gObjectType) + { + _gObjectType = gObjectType; + } + + //========================================================================= + + int GObjectModel::getGObjectType() + { + return _gObjectType; + } + + //========================================================================= + bool GObjectModel::isPointInside(double x,double y, double z)//virtual { if(x>=_xInic && x<=_xFin && y<=_yInic && y>=_yFin) @@ -121,6 +135,10 @@ namespace bbtk } //========================================================================= + + + //========================================================================= + } // EO namespace bbtk // EOF diff --git a/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GObjectModel.h b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GObjectModel.h index c80da35..889cb75 100644 --- a/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GObjectModel.h +++ b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GObjectModel.h @@ -45,6 +45,7 @@ Version: $Revision$ //Includes same project #include "GlobalConstants.h" +#include "Observable.h" //Includes creaMaracasVisu @@ -57,7 +58,7 @@ Version: $Revision$ namespace bbtk { - class GObjectModel + class GObjectModel //: public Observable { public: @@ -74,9 +75,13 @@ namespace bbtk void setFinalPoint(double& x, double& y, double& z); void setState(int state); int getState(); + virtual bool isPointInside(double x,double y, double z); virtual void updateBlackBox(BlackBoxDescriptor::Pointer descriptor); + int getGObjectType(); + void setGObjectType(int obtype); + private: //Private Attributes @@ -95,6 +100,7 @@ namespace bbtk double _zFin; int _state; + int _gObjectType; //Protected methods diff --git a/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GPortModel.cxx b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GPortModel.cxx new file mode 100644 index 0000000..ded2673 --- /dev/null +++ b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GPortModel.cxx @@ -0,0 +1,64 @@ +/*========================================================================= +Program: bbtk +Module: $RCSfile$ +Language: C++ +Date: $Date$ +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 +* 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. +* +* 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::GPortModel +*/ + + +#include "GPortModel.h" + +namespace bbtk +{ + + + //========================================================================= + GPortModel::GPortModel() + { + _parentBox = NULL; + } + + //========================================================================= + GPortModel::~GPortModel() + { + } + //========================================================================= + + void GPortModel::registerInBox(GBlackBoxModel *blackBox) + { + _parentBox = blackBox; + } + + //========================================================================= +} // EO namespace bbtk + +// EOF + diff --git a/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GPortModel.h b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GPortModel.h new file mode 100644 index 0000000..8df71bf --- /dev/null +++ b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GPortModel.h @@ -0,0 +1,89 @@ +/*========================================================================= +Program: bbtk +Module: $RCSfile$ +Language: C++ +Date: $Date$ +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 +* 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. +* +* 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::GPortModel : abstract black-box interface. +*/ + +/** +* \class bbtk::GPortModel +* \brief +*/ + +#ifndef __GPortModel_h__ +#define __GPortModel_h__ + +//Includes same project +#include "GlobalConstants.h" +#include "GObjectModel.h" + +//Includes creaMaracasVisu + +//Includes std +#include + + +namespace bbtk +{ + + class GBlackBoxModel; + + class GPortModel : public GObjectModel + { + + public: + + //Constructors + GPortModel(); + ~GPortModel(); + + //Public methods + void registerInBox(GBlackBoxModel *blackBox); + private: + + //Attributes + + GBlackBoxModel *_parentBox; + + //Private Methods + + protected: + //Protected methods + + }; + + +} +// namespace bbtk +#endif + diff --git a/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GlobalConstants.h b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GlobalConstants.h index bdc66c1..364c902 100644 --- a/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GlobalConstants.h +++ b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GlobalConstants.h @@ -47,6 +47,8 @@ namespace bbtk const int GBLACKBOX = 1; const int GCONNECTOR = 2; const int GPORT = 3; + const int GINPUTPORT = 4; + const int GOUTPUTPORT = 5; // Object states static const int NOTHING_HAPPENS = 101; diff --git a/lib/EditorGraphicBBS/bbsKernelEditorGraphic/Observable.cxx b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/Observable.cxx new file mode 100644 index 0000000..819f341 --- /dev/null +++ b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/Observable.cxx @@ -0,0 +1,84 @@ +/*========================================================================= +Program: bbtk +Module: $RCSfile$ +Language: C++ +Date: $Date$ +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 +* 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. +* +* 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::Observable +*/ + + +#include "Observable.h" + +namespace bbtk +{ + + + //========================================================================= + Observable::Observable() + { + _changed=false; + } + + //========================================================================= + Observable::~Observable() + { + } + //========================================================================= + + bool Observable::hasChanged() + { + return _changed; + } + + //========================================================================= + + void Observable::notifyObservers() + { + int i; + for(i=0;i<_observers.size();i++) + { + _observers[i]->update(); + } + _changed=false; + } + + //========================================================================= + + void Observable::setChanged() + { + _changed=true; + } + + //========================================================================= + +} // EO namespace bbtk + +// EOF + diff --git a/lib/EditorGraphicBBS/bbsKernelEditorGraphic/Observable.h b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/Observable.h new file mode 100644 index 0000000..72e1e80 --- /dev/null +++ b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/Observable.h @@ -0,0 +1,96 @@ +/*========================================================================= +Program: bbtk +Module: $RCSfile$ +Language: C++ +Date: $Date$ +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 +* 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. +* +* 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::Observable : abstract black-box interface. +*/ + +/** +* \class bbtk::Observable +* \brief +*/ + +#ifndef __Observable_h__ +#define __Observable_h__ + +//Includes same project + +#include "Observer.h" + +//Includes std +#include +#include + +namespace bbtk +{ + + class Observable + { + + public: + + //Constructors + Observable(); + ~Observable(); + + //Public methods + void addObserver(Observer *observer); + + bool hasChanged(); + + void notifyObservers(); + + void setChanged(); + + private: + + //Private Attributes + bool _changed; + + std::vector _observers; + + //Private Methods + + protected: + + //Protected Attributes + + //Protected methods + + }; + + +} +// namespace bbtk +#endif + diff --git a/lib/EditorGraphicBBS/bbsKernelEditorGraphic/Observer.cxx b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/Observer.cxx new file mode 100644 index 0000000..3be8382 --- /dev/null +++ b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/Observer.cxx @@ -0,0 +1,64 @@ +/*========================================================================= +Program: bbtk +Module: $RCSfile$ +Language: C++ +Date: $Date$ +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 +* 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. +* +* 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::Observer +*/ + + +#include "Observer.h" + +namespace bbtk +{ + + + //========================================================================= + Observer::Observer() + { + } + + //========================================================================= + Observer::~Observer() + { + } + //========================================================================= + + void Observer::update() //virtual + { + //virtual + } + + //========================================================================= + +} // EO namespace bbtk + +// EOF + diff --git a/lib/EditorGraphicBBS/bbsKernelEditorGraphic/Observer.h b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/Observer.h new file mode 100644 index 0000000..e01c4d1 --- /dev/null +++ b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/Observer.h @@ -0,0 +1,83 @@ +/*========================================================================= +Program: bbtk +Module: $RCSfile$ +Language: C++ +Date: $Date$ +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 +* 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. +* +* 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::Observer : abstract black-box interface. +*/ + +/** +* \class bbtk::Observer +* \brief +*/ + +#ifndef __Observer_h__ +#define __Observer_h__ + +//Includes std +#include + +namespace bbtk +{ + + class Observer + { + + public: + + //Constructors + Observer(); + ~Observer(); + + //Public methods + void update(); + + + private: + + //Private Attributes + + //Private Methods + + protected: + + //Protected Attributes + + //Protected methods + + }; + + +} +// namespace bbtk +#endif + diff --git a/lib/EditorGraphicBBS/bbsKernelEditorGraphic/wxVtkSceneManager.cxx b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/wxVtkSceneManager.cxx index d9fbd6c..73dcda3 100644 --- a/lib/EditorGraphicBBS/bbsKernelEditorGraphic/wxVtkSceneManager.cxx +++ b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/wxVtkSceneManager.cxx @@ -139,7 +139,7 @@ namespace bbtk int type = GBLACKBOX; //Create the MVC Objects - GObjectModel *model = GObjectsMVCFactory::getInstance()->createGObjectModel(type); + GBlackBoxModel *model = (GBlackBoxModel*)GObjectsMVCFactory::getInstance()->createGObjectModel(type); vtkGObjectView *view = GObjectsMVCFactory::getInstance()->createGObjectView(type); GObjectController* controller = GObjectsMVCFactory::getInstance()->createGObjectController(type); @@ -151,7 +151,23 @@ namespace bbtk double zz = 0; _baseView->TransCoordScreenToWorld(xx,yy,zz); model->setInicPoint(xx,yy,zz); - model->updateBlackBox(descriptor); + //model->addObserver(view); + + //Iterate and create the input ports + std::map descriptorMap = descriptor->GetInputDescriptorMap(); + std::map::iterator it; + + //ERASE + cantTemp=0; + + for(it = descriptorMap.begin(); it != descriptorMap.end(); ++it) + { + BlackBoxInputDescriptor *desc = it->second; + createGInputPort(desc,model); + + //ERASE + cantTemp+=2; + } //Associates the view with the correspondent renderer and the model. @@ -172,6 +188,56 @@ namespace bbtk //========================================================================= + void wxVtkSceneManager::createGInputPort(BlackBoxInputDescriptor *desc,GBlackBoxModel *blackBox) + { + int type = GPORT; + + //Create the MVC Objects + GPortModel *model = (GPortModel*)GObjectsMVCFactory::getInstance()->createGObjectModel(type); + vtkGObjectView *view = GObjectsMVCFactory::getInstance()->createGObjectView(type); + GObjectController* controller = GObjectsMVCFactory::getInstance()->createGObjectController(type); + + model->registerInBox(blackBox); + blackBox->addInputPort(model); + + + //Prepares the initial model + double xx = 0; + double yy = 0; + double zz = 0; + blackBox->getInicPoint(xx,yy,zz); + + xx++; + yy+=cantTemp; + model->setInicPoint(xx,yy,zz); + + //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); + } + + //========================================================================= + + void wxVtkSceneManager::createGOutputPort(BlackBoxOutputDescriptor *desc,GBlackBoxModel *blackBox) + { + int type = GPORT; + + //Create the MVC Objects + GPortModel *model = (GPortModel*)GObjectsMVCFactory::getInstance()->createGObjectModel(type); + vtkGObjectView *view = GObjectsMVCFactory::getInstance()->createGObjectView(type); + GObjectController* controller = GObjectsMVCFactory::getInstance()->createGObjectController(type); + + model->registerInBox(blackBox); + blackBox->addOutputPort(model); + } + + //========================================================================= + void wxVtkSceneManager::registerController(InteractorStyleMaracas *param) { vtkInteractorStyleBaseView* baseViewControlManager = (vtkInteractorStyleBaseView*)_baseView->GetInteractorStyleBaseView(); diff --git a/lib/EditorGraphicBBS/bbsKernelEditorGraphic/wxVtkSceneManager.h b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/wxVtkSceneManager.h index 7d1c7d0..a550948 100644 --- a/lib/EditorGraphicBBS/bbsKernelEditorGraphic/wxVtkSceneManager.h +++ b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/wxVtkSceneManager.h @@ -46,6 +46,10 @@ Version: $Revision$ //Includes same project #include "GObjectsMVCFactory.h" +//Includes bbtk +#include +#include + //Includes creaMaracasVisu #include #include @@ -58,6 +62,8 @@ Version: $Revision$ //Includes std #include +#include + namespace bbtk { @@ -70,6 +76,8 @@ namespace bbtk void configureBaseView(); void createGBlackBox(int x, int y,std::string packageName, std::string boxName); + void createGInputPort(BlackBoxInputDescriptor *desc,GBlackBoxModel *blackBox); + void createGOutputPort(BlackBoxOutputDescriptor *desc,GBlackBoxModel *blackBox); void registerController(InteractorStyleMaracas *param); vtkRenderWindow* getRenderWindow(); @@ -84,6 +92,9 @@ namespace bbtk wxVtk3DBaseView *_baseView; void refreshRenderWindow(); + + //ERASE + int cantTemp; protected: }; diff --git a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GObjectController.cxx b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GObjectController.cxx index 278d9c7..c4b0837 100644 --- a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GObjectController.cxx +++ b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GObjectController.cxx @@ -98,7 +98,7 @@ bool GObjectController::OnMouseMove() } } - _view->refresh(); + _view->update(); } return true; } diff --git a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GObjectsMVCFactory.cxx b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GObjectsMVCFactory.cxx index 9a32bfe..2cb11be 100644 --- a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GObjectsMVCFactory.cxx +++ b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GObjectsMVCFactory.cxx @@ -94,6 +94,10 @@ namespace bbtk { view = new vtkGBlackBoxView(); } + else if(type == GPORT) + { + view = new vtkGPortView(); + } return view; } @@ -106,6 +110,10 @@ namespace bbtk { controller = new GBlackBoxController(); } + else if(type == GPORT) + { + controller = new GPortController(); + } return controller; } @@ -118,6 +126,10 @@ namespace bbtk { model = new GBlackBoxModel(); } + else if(type == GPORT) + { + model = new GPortModel(); + } return model; } diff --git a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GObjectsMVCFactory.h b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GObjectsMVCFactory.h index 8aa1bbe..5235a8d 100644 --- a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GObjectsMVCFactory.h +++ b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GObjectsMVCFactory.h @@ -48,10 +48,16 @@ Version: $Revision$ #include "GObjectController.h" #include "GObjectModel.h" #include "vtkGObjectView.h" + #include "GBlackBoxController.h" #include "vtkGBlackBoxView.h" #include "GBlackBoxModel.h" +#include "GPortController.h" +#include "vtkGPortView.h" +#include "GPortModel.h" + + //Includes creaMaracasVisu //Includes std diff --git a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GPortController.cxx b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GPortController.cxx new file mode 100644 index 0000000..33794ce --- /dev/null +++ b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GPortController.cxx @@ -0,0 +1,61 @@ +/*========================================================================= +Program: bbtk +Module: $RCSfile$ +Language: C++ +Date: $Date$ +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 +* 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. +* +* 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 +*/ + + +#include "GPortController.h" + +namespace bbtk +{ + + + //========================================================================= + GPortController::GPortController() + { + + } + + //========================================================================= + GPortController::~GPortController() + { + } + //========================================================================= + + + //========================================================================= + +} // EO namespace bbtk + +// EOF + diff --git a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GPortController.h b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GPortController.h new file mode 100644 index 0000000..66c3e2a --- /dev/null +++ b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GPortController.h @@ -0,0 +1,85 @@ +/*========================================================================= +Program: bbtk +Module: $RCSfile$ +Language: C++ +Date: $Date$ +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 +* 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. +* +* 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 : +*/ + +/** +* \class bbtk::GPortController +* \brief +*/ + +#ifndef __GPortController_h__ +#define __GPortController_h__ + +//Includes same project +#include "GlobalConstants.h" +#include "GObjectController.h" + +//Includes creaMaracasVisu + +//Includes std +#include + + +namespace bbtk +{ + + class GPortController : public GObjectController + { + + public: + + //Constructors + GPortController(); + ~GPortController(); + + //Public methods + + + private: + + //Attributes + + //Private Methods + + protected: + + }; + + +} +// namespace bbtk +#endif + diff --git a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGBlackBoxView.cxx b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGBlackBoxView.cxx index 684670c..32fbb5f 100644 --- a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGBlackBoxView.cxx +++ b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGBlackBoxView.cxx @@ -51,7 +51,7 @@ namespace bbtk } //========================================================================= - void vtkGBlackBoxView::refresh() + void vtkGBlackBoxView::update() { //paint(); if(_model->getState()==HIGHLIGHTED) diff --git a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGBlackBoxView.h b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGBlackBoxView.h index 72e6819..34b4c5b 100644 --- a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGBlackBoxView.h +++ b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGBlackBoxView.h @@ -88,7 +88,7 @@ namespace bbtk //Protected Methods virtual void createVtkObjects(); - virtual void refresh(); + virtual void update(); }; diff --git a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGObjectView.cxx b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGObjectView.cxx index 5e322e1..eb2155a 100644 --- a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGObjectView.cxx +++ b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGObjectView.cxx @@ -53,7 +53,7 @@ namespace bbtk } //========================================================================= - void vtkGObjectView::refresh() + void vtkGObjectView::update() { if(_model->getState()==NOTHING_HAPPENS) { diff --git a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGObjectView.h b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGObjectView.h index 880c09b..d10991e 100644 --- a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGObjectView.h +++ b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGObjectView.h @@ -46,6 +46,7 @@ Version: $Revision$ //Includes same project #include "GlobalConstants.h" #include "GObjectModel.h" +#include "Observer.h" //Includes creaMaracasVisu #include @@ -64,7 +65,7 @@ Version: $Revision$ namespace bbtk { - class vtkGObjectView + class vtkGObjectView //: public Observer { public: @@ -80,7 +81,7 @@ namespace bbtk bool isPointInside(int X,int Y); - virtual void refresh(); + virtual void update(); private: diff --git a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGPortView.cxx b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGPortView.cxx new file mode 100644 index 0000000..51881b2 --- /dev/null +++ b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGPortView.cxx @@ -0,0 +1,115 @@ +/*========================================================================= +Program: bbtk +Module: $RCSfile$ +Language: C++ +Date: $Date$ +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 +* 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. +* +* 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::vtkGPortView +*/ + + +#include "vtkGPortView.h" + +namespace bbtk +{ + + + //========================================================================= + vtkGPortView::vtkGPortView() + { + } + + //========================================================================= + vtkGPortView::~vtkGPortView() + { + } + + //========================================================================= + void vtkGPortView::update() + { + //paint(); + if(_model->getState()==HIGHLIGHTED) + { + _objectActor->GetProperty()->SetColor(0.0,0.2,0.5); + } + else + { + _objectActor->GetProperty()->SetColor(0.3,0.2,0.2); + } + _baseView->GetRenderer()->Render(); + } + + //========================================================================= + + void vtkGPortView::createVtkObjects() //virtual + { + vtkPoints *_pts = vtkPoints::New(); + vtkCellArray *lines = vtkCellArray::New(); + vtkPolyData *_pd = vtkPolyData::New(); + vtkPolyDataMapper* _bboxMapper=vtkPolyDataMapper::New(); + _objectActor=vtkActor::New(); + + _pts->SetNumberOfPoints(4); + + double xInic, yInic,zInic,xFin, yFin,zFin; + _model->getInicPoint(xInic,yInic,zInic); + _model->getFinalPoint(xFin, yFin,zFin); + cout<<"RaC ----------"<SetPoint(0, xInic, yInic, 0 ); + _pts->SetPoint(1, xInic, yFin, 0 ); + _pts->SetPoint(2, xFin, yFin, 0 ); + _pts->SetPoint(3, xFin, yInic, 0 ); + + lines->InsertNextCell(5); + lines->InsertCellPoint(0); + lines->InsertCellPoint(1); + lines->InsertCellPoint(2); + lines->InsertCellPoint(3); + lines->InsertCellPoint(0); + + _pd->SetPoints( _pts ); + _pd->SetLines( lines ); + + _bboxMapper->SetInput(_pd); + _objectActor->SetMapper(_bboxMapper); + + _objectActor->GetProperty()->SetColor(0.8,0.0,0.0); + + } + + //========================================================================= + + +} // EO namespace bbtk + +// EOF + diff --git a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGPortView.h b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGPortView.h new file mode 100644 index 0000000..fb21d32 --- /dev/null +++ b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGPortView.h @@ -0,0 +1,98 @@ +/*========================================================================= +Program: bbtk +Module: $RCSfile$ +Language: C++ +Date: $Date$ +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 +* 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. +* +* 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::vtkGPortView : abstract black-box interface. +*/ + +/** +* \class bbtk::vtkGPortView +* \brief +*/ + +#ifndef __vtkGPortView_h__ +#define __vtkGPortView_h__ + +//Includes same project +#include "GlobalConstants.h" +#include "vtkGObjectView.h" + +//Includes creaMaracasVisu + +//Includes vtk + +#include "vtkPolyDataMapper.h" +#include "vtkActor.h" + +#include "vtkRenderer.h" +#include "vtkCellArray.h" + + +//Includes std +#include + + +namespace bbtk +{ + + class vtkGPortView : public vtkGObjectView + { + + public: + + //Constructors + vtkGPortView(); + ~vtkGPortView(); + + //Public methods + + private: + + //Private Attributes + + //Private Methods + + protected: + + //Protected Attributes + + //Protected Methods + virtual void createVtkObjects(); + virtual void update(); + }; + + +} +// namespace bbtk +#endif + -- 2.45.1