]> Creatis software - bbtkGEditor.git/commitdiff
Basic functionnality adition showing the black box input ports
authorcorredor <>
Wed, 31 Mar 2010 15:36:28 +0000 (15:36 +0000)
committercorredor <>
Wed, 31 Mar 2010 15:36:28 +0000 (15:36 +0000)
24 files changed:
lib/EditorGraphicBBS/bbsKernelEditorGraphic/GBlackBoxModel.cxx
lib/EditorGraphicBBS/bbsKernelEditorGraphic/GBlackBoxModel.h
lib/EditorGraphicBBS/bbsKernelEditorGraphic/GObjectModel.cxx
lib/EditorGraphicBBS/bbsKernelEditorGraphic/GObjectModel.h
lib/EditorGraphicBBS/bbsKernelEditorGraphic/GPortModel.cxx [new file with mode: 0644]
lib/EditorGraphicBBS/bbsKernelEditorGraphic/GPortModel.h [new file with mode: 0644]
lib/EditorGraphicBBS/bbsKernelEditorGraphic/GlobalConstants.h
lib/EditorGraphicBBS/bbsKernelEditorGraphic/Observable.cxx [new file with mode: 0644]
lib/EditorGraphicBBS/bbsKernelEditorGraphic/Observable.h [new file with mode: 0644]
lib/EditorGraphicBBS/bbsKernelEditorGraphic/Observer.cxx [new file with mode: 0644]
lib/EditorGraphicBBS/bbsKernelEditorGraphic/Observer.h [new file with mode: 0644]
lib/EditorGraphicBBS/bbsKernelEditorGraphic/wxVtkSceneManager.cxx
lib/EditorGraphicBBS/bbsKernelEditorGraphic/wxVtkSceneManager.h
lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GObjectController.cxx
lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GObjectsMVCFactory.cxx
lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GObjectsMVCFactory.h
lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GPortController.cxx [new file with mode: 0644]
lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GPortController.h [new file with mode: 0644]
lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGBlackBoxView.cxx
lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGBlackBoxView.h
lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGObjectView.cxx
lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGObjectView.h
lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGPortView.cxx [new file with mode: 0644]
lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGPortView.h [new file with mode: 0644]

index 4fc3e6840e725f4546f401060e64cb9419f4da6c..186c745baf1c189e64f20d7e6c5b23915ad77945 100644 (file)
@@ -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()<<std::endl;
+               _inputs.push_back(inputport);
        }
 
        //=========================================================================
+
+       void GBlackBoxModel::addOutputPort(GPortModel *outputport)
+       {
+               _outputs.push_back(outputport);
+       }
+
+       //=========================================================================
+
 }  // EO namespace bbtk
 
 // EOF
index c318acde91850c1cb83708af8d07e20c42de78d8..87c47142b060230ab4df5b2929e30542fbe500c6 100644 (file)
@@ -56,6 +56,8 @@ Version:   $Revision$
 namespace bbtk
 {
 
+       class GPortModel;
+
        class GBlackBoxModel : public GObjectModel 
        {
 
@@ -66,13 +68,16 @@ namespace bbtk
                ~GBlackBoxModel();
                
                //Public methods                
-               virtual void updateBlackBox(BlackBoxDescriptor::Pointer descriptor);
+               void addInputPort(GPortModel *inputport);
+               void addOutputPort(GPortModel *outputport);
+
 
        private:
 
                //Attributes
-               BlackBoxDescriptor::Pointer _desc;
-       
+               std::vector<GPortModel*> _inputs;
+               std::vector<GPortModel*> _outputs;
+
                //Private Methods
 
        protected:
index bcfd60d3b3b2a7429db36b6d7e9175eccdc73316..4ab7fbf4647d3f12b99a463d013e7534bd7bc6af 100644 (file)
@@ -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
index c80da3579933afd396c5a3475a56348022934bc6..889cb7580a544f6e19e24f2972bb8cfe77170503 100644 (file)
@@ -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 (file)
index 0000000..ded2673
--- /dev/null
@@ -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 (file)
index 0000000..8df71bf
--- /dev/null
@@ -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 <iostream>
+
+
+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
+
index bdc66c189f243388fd82beca17efd498b2ad1752..364c9026ca431f875db5a16a8c1aa5f3175daecc 100644 (file)
@@ -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 (file)
index 0000000..819f341
--- /dev/null
@@ -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 (file)
index 0000000..72e1e80
--- /dev/null
@@ -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 <iostream>
+#include <vector>
+
+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<Observer*>  _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 (file)
index 0000000..3be8382
--- /dev/null
@@ -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 (file)
index 0000000..e01c4d1
--- /dev/null
@@ -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 <iostream>
+
+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
+
index d9fbd6ce5fb565821c63e2f9a9862ed33abf6257..73dcda3d84d0856026e6eda7b2dce6c55391ee62 100644 (file)
@@ -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<std::string, BlackBoxInputDescriptor*> descriptorMap = descriptor->GetInputDescriptorMap();
+               std::map<std::string, BlackBoxInputDescriptor*>::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();
index 7d1c7d0b9c55cb1c7fadf90510cb056f061c3404..a55094814592a9ee0b26cc69054310a4f4dd62c2 100644 (file)
@@ -46,6 +46,10 @@ Version:   $Revision$
 //Includes same project
 #include "GObjectsMVCFactory.h"
 
+//Includes bbtk
+#include <bbtkBlackBoxInputDescriptor.h>
+#include <bbtkBlackBoxDescriptor.h>
+
 //Includes creaMaracasVisu
 #include <wxVtk3DBaseView.h>
 #include <InteractorStyleMaracas.h>
@@ -58,6 +62,8 @@ Version:   $Revision$
 
 //Includes std
 #include <iostream>
+#include <map>
+
 
 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:
 
        };
index 278d9c768ef514e457e03d718983c2d434ffca9c..c4b0837ee52477062db225e0bfc1bba5e2f66a2c 100644 (file)
@@ -98,7 +98,7 @@ bool GObjectController::OnMouseMove()
                        }
                }
                
-               _view->refresh();
+               _view->update();
        }
        return true;
 }
index 9a32bfe61573f323e1afc7c6ab17ce5b36dcccba..2cb11bed59e3454ba5494509dc056c7817c64695 100644 (file)
@@ -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;
        }
 
index 8aa1bbee56bc03af65f170ad0f88bfaa552b7765..5235a8d0a32e9655a6cdee7814d3e80efb965f20 100644 (file)
@@ -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 (file)
index 0000000..33794ce
--- /dev/null
@@ -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 (file)
index 0000000..66c3e2a
--- /dev/null
@@ -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 <iostream>
+
+
+namespace bbtk
+{
+
+       class GPortController : public GObjectController
+       {
+
+       public: 
+
+               //Constructors
+               GPortController();
+               ~GPortController();
+               
+               //Public methods
+
+
+       private:
+
+               //Attributes
+
+               //Private Methods
+
+       protected:
+
+       };
+
+
+}
+// namespace bbtk
+#endif
+
index 684670cc4c31f3d8fbd5e7f70a5920f03964210e..32fbb5f26d6579d384b3cdad2cfa78e5d1b91689 100644 (file)
@@ -51,7 +51,7 @@ namespace bbtk
        }
 
        //=========================================================================
-       void vtkGBlackBoxView::refresh()
+       void vtkGBlackBoxView::update()
        {
                //paint();
                if(_model->getState()==HIGHLIGHTED)
index 72e6819a1332e11eda78531cbab1422afb551932..34b4c5bfa10d5cff23cfc52365163dae0dd99ccb 100644 (file)
@@ -88,7 +88,7 @@ namespace bbtk
                
                //Protected Methods
                virtual void createVtkObjects();
-               virtual void refresh();
+               virtual void update();
        };
 
 
index 5e322e1a765160ad5e44e2202d9f0f4a9946f2cd..eb2155acba6f9a7341be41c0237f6bb095c5f7fb 100644 (file)
@@ -53,7 +53,7 @@ namespace bbtk
        }
        //=========================================================================
 
-       void vtkGObjectView::refresh()
+       void vtkGObjectView::update()
        {
                if(_model->getState()==NOTHING_HAPPENS)
                {
index 880c09b68120d27afe58e068a2b8e54a99fb8658..d10991ee60ee5e19a4f1e494f41655adb4090050 100644 (file)
@@ -46,6 +46,7 @@ Version:   $Revision$
 //Includes same project
 #include "GlobalConstants.h"
 #include "GObjectModel.h"
+#include "Observer.h"
 
 //Includes creaMaracasVisu
 #include <wxVtkBaseView.h>
@@ -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 (file)
index 0000000..51881b2
--- /dev/null
@@ -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 ----------"<<endl;
+               cout<<"RaC vtkGPortView::createVtkObjects() inic:"<<xInic<<" "<<yInic<<" "<<zInic<<endl;
+               cout<<"RaC vtkGPortView::createVtkObjects() fin:"<<xFin<<" "<<yFin<<" "<<zFin<<endl;
+
+               _pts->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 (file)
index 0000000..fb21d32
--- /dev/null
@@ -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 <iostream>
+
+
+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
+