]> Creatis software - bbtkGEditor.git/commitdiff
The buttons and the objects to create input and output complex box ports were added...
authorcorredor <>
Mon, 17 May 2010 14:44:29 +0000 (14:44 +0000)
committercorredor <>
Mon, 17 May 2010 14:44:29 +0000 (14:44 +0000)
32 files changed:
data/icons/wxart_complexinputport.xpm [new file with mode: 0644]
data/icons/wxart_complexoutputport.xpm [new file with mode: 0644]
lib/EditorGraphicBBS/bbsKernelEditorGraphic/GBlackBoxModel.cxx
lib/EditorGraphicBBS/bbsKernelEditorGraphic/GBlackBoxModel.h
lib/EditorGraphicBBS/bbsKernelEditorGraphic/GBoxModel.cxx [new file with mode: 0644]
lib/EditorGraphicBBS/bbsKernelEditorGraphic/GBoxModel.h [new file with mode: 0644]
lib/EditorGraphicBBS/bbsKernelEditorGraphic/GComplexBoxPortModel.cxx [new file with mode: 0644]
lib/EditorGraphicBBS/bbsKernelEditorGraphic/GComplexBoxPortModel.h [new file with mode: 0644]
lib/EditorGraphicBBS/bbsKernelEditorGraphic/GObjectModel.cxx
lib/EditorGraphicBBS/bbsKernelEditorGraphic/GObjectModel.h
lib/EditorGraphicBBS/bbsKernelEditorGraphic/GPortModel.cxx
lib/EditorGraphicBBS/bbsKernelEditorGraphic/GPortModel.h
lib/EditorGraphicBBS/bbsKernelEditorGraphic/GlobalConstants.h
lib/EditorGraphicBBS/bbsKernelEditorGraphic/wxVtkSceneManager.cxx
lib/EditorGraphicBBS/bbsKernelEditorGraphic/wxVtkSceneManager.h
lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GBlackBoxController.h
lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GBoxController.cxx [new file with mode: 0644]
lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GBoxController.h [new file with mode: 0644]
lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GObjectsMVCFactory.cxx
lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GObjectsMVCFactory.h
lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGBlackBoxView.cxx
lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGBlackBoxView.h
lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGBoxView.cxx [new file with mode: 0644]
lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGBoxView.h [new file with mode: 0644]
lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGComplexBoxPortView.cxx [new file with mode: 0644]
lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGComplexBoxPortView.h [new file with mode: 0644]
lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.cxx
lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.h
lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxGEditorTabPanel.cxx
lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxGEditorTabPanel.h
lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxTabPanelsManager.cxx
lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxTabPanelsManager.h

diff --git a/data/icons/wxart_complexinputport.xpm b/data/icons/wxart_complexinputport.xpm
new file mode 100644 (file)
index 0000000..d8bde58
--- /dev/null
@@ -0,0 +1,22 @@
+/* XPM */
+static const char * complexinputport_xpm[] = {
+"17 15 3 1",
+"      c None",
+".     c #101010",
+"+     c #CC1919",
+" ............... ",
+" .             . ",
+" .             . ",
+" .             . ",
+" .   +++++++   . ",
+" .   +++++++   . ",
+" .   +++++++   . ",
+" .   +++++++   . ",
+" .   +++++++   . ",
+" .   +++++++   . ",
+" .   +++++++   . ",
+" .             . ",
+" .             . ",
+" .             . ",
+" ............... ",
+};
diff --git a/data/icons/wxart_complexoutputport.xpm b/data/icons/wxart_complexoutputport.xpm
new file mode 100644 (file)
index 0000000..fbccaef
--- /dev/null
@@ -0,0 +1,22 @@
+/* XPM */
+static const char * complexoutputport_xpm[] = {
+"17 15 3 1",
+"      c None",
+".     c #101010",
+"+     c #80D919",
+" ............... ",
+" .             . ",
+" .             . ",
+" .             . ",
+" .   +++++++   . ",
+" .   +++++++   . ",
+" .   +++++++   . ",
+" .   +++++++   . ",
+" .   +++++++   . ",
+" .   +++++++   . ",
+" .   +++++++   . ",
+" .             . ",
+" .             . ",
+" .             . ",
+" ............... ",
+};
index 47259aaa576c7a9fc0106dfdeb56cca54628a07f..5351493e280e2ac0459b6aae2469b26acd683d3d 100644 (file)
@@ -51,65 +51,6 @@ namespace bbtk
        {
        }
 
-       //=========================================================================
-
-       void GBlackBoxModel::setInicPoint(double& x, double& y, double& z)
-       {
-               GObjectModel::setInicPoint(x,y,z);
-
-               double xFin=x+BOX_WIDTH,yFin=y-BOX_HEIGHT;
-               setFinalPoint(xFin,yFin,z);
-       }
-
-       //=========================================================================
-
-       void GBlackBoxModel::addInputPort(GPortModel *inputport)
-       {
-               _inputs.push_back(inputport);
-       }
-
-       //=========================================================================
-
-       void GBlackBoxModel::addOutputPort(GPortModel *outputport)
-       {
-               _outputs.push_back(outputport);
-       }
-
-       //=========================================================================
-
-       int GBlackBoxModel::getNumInputPorts()
-       {
-               return _inputs.size();
-       }
-
-       //=========================================================================
-
-       int GBlackBoxModel::getNumOutputPorts()
-       {
-               return _outputs.size();
-       }
-
-       //=========================================================================
-
-       void GBlackBoxModel::move(double xx,double yy,double zz)
-       {
-               setInicPoint(xx,yy,zz);
-
-               //Refresh inputs position
-               int i;
-               for(i=0;i<_inputs.size();i++)
-               {
-                       _inputs[i]->updatePortPosition();
-               }
-               
-               //Refresh outputs position
-               for(i=0;i<_outputs.size();i++)
-               {
-                       _outputs[i]->updatePortPosition();
-               }
-
-       }
-       
        //=========================================================================
        
        std::string GBlackBoxModel::getBBTKPackage()
@@ -154,20 +95,6 @@ namespace bbtk
 
        //=========================================================================
 
-       std::vector<GPortModel*> GBlackBoxModel::getInputPorts()
-       {
-               return _inputs;
-       }
-
-       //=========================================================================
-
-       std::vector<GPortModel*> GBlackBoxModel::getOutputPorts()
-       {
-               return _outputs;
-       }
-
-       //=========================================================================
-
        void GBlackBoxModel::setValueToInputPort(int pos,std::string value)
        {
                _inputs[pos]->setValue(value);
@@ -246,52 +173,6 @@ namespace bbtk
 
        //=========================================================================
 
-       GPortModel* GBlackBoxModel::getInputPort(std::string name)
-       {
-               for(int i = 0; i<_inputs.size();i++)
-               {
-                       if(_inputs[i]->getBBTKName()==name)
-                       {
-                               return _inputs[i];
-                       }
-               }
-               return NULL;
-       }
-
-       //=========================================================================
-       
-       GPortModel* GBlackBoxModel::getOutputPort(std::string name)
-       {
-               for(int i = 0; i<_outputs.size();i++)
-               {
-                       if(_outputs[i]->getBBTKName()==name)
-                       {
-                               return _outputs[i];
-                       }
-               }
-               return NULL;
-       }
-
-       //=========================================================================
-
-       void GBlackBoxModel::updatePorts()
-       {
-               for(int i = 0; i<_inputs.size();i++)
-               {       
-                       _inputs[i]->updatePortPosition();
-                       _inputs[i]->notifyObservers(_objectId);
-               }
-
-               for(int i = 0; i<_outputs.size();i++)
-               {
-                       _outputs[i]->updatePortPosition();
-                       _outputs[i]->notifyObservers(_objectId);
-               }
-       }
-
-       //=========================================================================
-
-
 }  // EO namespace bbtk
 
 // EOF
index 04ae668d17ad68a72b1836274a06ad6e7e197d29..74da5f6546421cd8d7db8db858be0b5665f1c37b 100644 (file)
@@ -45,8 +45,7 @@ Version:   $Revision$
 
 //Includes same project
 #include "GlobalConstants.h"
-#include "GObjectModel.h"
-#include "GPortModel.h"
+#include "GBoxModel.h"
 
 //Includes creaMaracasVisu
 
@@ -57,10 +56,8 @@ Version:   $Revision$
 namespace bbtk
 {
 
-       class GPortModel;
-
-       class GBlackBoxModel : public GObjectModel 
-       {
+       class GBlackBoxModel : public GBoxModel
+       {
 
        public: 
 
@@ -69,14 +66,6 @@ namespace bbtk
                ~GBlackBoxModel();
                
                //Public methods                
-               virtual void setInicPoint(double& x, double& y, double& z);
-               void addInputPort(GPortModel *inputport);
-               void addOutputPort(GPortModel *outputport);
-               int getNumInputPorts();
-               int getNumOutputPorts();
-               virtual void move(double xx,double yy,double zz);
-               GPortModel* getStartOutputPort();
-
                std::string getBBTKPackage();
                void setBBTKPackage(std::string obpackage);
 
@@ -86,22 +75,12 @@ namespace bbtk
                bool isExecutable();
                void setExecutable(bool executable);
 
-               std::vector<GPortModel*> getInputPorts();
-               std::vector<GPortModel*> getOutputPorts();
-
                void setValueToInputPort(int pos,std::string value);
                void setValueToInput(std::string name,std::string value);
 
-               GPortModel* getInputPort(std::string name);
-               GPortModel* getOutputPort(std::string name);
-
-               void updatePorts();
-
        private:
 
                //Private Attributes
-               std::vector<GPortModel*> _inputs;
-               std::vector<GPortModel*> _outputs;
                bool _isExecutable;
 
                //Private Methods
diff --git a/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GBoxModel.cxx b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GBoxModel.cxx
new file mode 100644 (file)
index 0000000..0801e54
--- /dev/null
@@ -0,0 +1,194 @@
+/*=========================================================================                                                                               
+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::GBox 
+*/
+
+
+#include "GBoxModel.h"
+
+namespace bbtk
+{
+       //=========================================================================
+
+       GBoxModel::GBoxModel()
+       {               
+       }
+
+       //=========================================================================
+
+       GBoxModel::~GBoxModel()
+       {
+       }
+
+       //=========================================================================
+
+       void GBoxModel::setInicPoint(double& x, double& y, double& z)
+       {
+               GObjectModel::setInicPoint(x,y,z);
+
+               double xFin=x+BOX_WIDTH,yFin=y-BOX_HEIGHT;
+               setFinalPoint(xFin,yFin,z);
+       }
+
+       //=========================================================================
+
+       void GBoxModel::addInputPort(GPortModel *inputport)
+       {
+               _inputs.push_back(inputport);
+       }
+
+       //=========================================================================
+
+       void GBoxModel::addOutputPort(GPortModel *outputport)
+       {
+               _outputs.push_back(outputport);
+       }
+
+       //=========================================================================
+
+       int GBoxModel::getNumInputPorts()
+       {
+               return _inputs.size();
+       }
+
+       //=========================================================================
+
+       int GBoxModel::getNumOutputPorts()
+       {
+               return _outputs.size();
+       }
+
+       //=========================================================================
+
+       void GBoxModel::move(double xx,double yy,double zz)
+       {
+               setInicPoint(xx,yy,zz);
+
+               //Refresh inputs position
+               int i;
+               for(i=0;i<_inputs.size();i++)
+               {
+                       _inputs[i]->updatePortPosition();
+               }
+               
+               //Refresh outputs position
+               for(i=0;i<_outputs.size();i++)
+               {
+                       _outputs[i]->updatePortPosition();
+               }
+
+       }
+       
+       //=========================================================================
+       
+       std::string GBoxModel::getStatusText()
+       {
+               std::string temp = "";
+               
+               return temp;
+       }
+
+       //=========================================================================
+
+       std::vector<GPortModel*> GBoxModel::getInputPorts()
+       {
+               return _inputs;
+       }
+
+       //=========================================================================
+
+       std::vector<GPortModel*> GBoxModel::getOutputPorts()
+       {
+               return _outputs;
+       }
+
+       //=========================================================================     
+
+       void GBoxModel::save(std::string &content)
+       {
+               content+="\n";
+       }
+       
+
+       //=========================================================================
+
+       GPortModel* GBoxModel::getInputPort(std::string name)
+       {
+               for(int i = 0; i<_inputs.size();i++)
+               {
+                       if(_inputs[i]->getBBTKName()==name)
+                       {
+                               return _inputs[i];
+                       }
+               }
+               return NULL;
+       }
+
+       //=========================================================================
+       
+       GPortModel* GBoxModel::getOutputPort(std::string name)
+       {
+               for(int i = 0; i<_outputs.size();i++)
+               {
+                       if(_outputs[i]->getBBTKName()==name)
+                       {
+                               return _outputs[i];
+                       }
+               }
+               return NULL;
+       }
+
+       //=========================================================================
+
+       void GBoxModel::updatePorts()
+       {
+               for(int i = 0; i<_inputs.size();i++)
+               {       
+                       _inputs[i]->updatePortPosition();
+                       _inputs[i]->notifyObservers(_objectId);
+               }
+
+               for(int i = 0; i<_outputs.size();i++)
+               {
+                       _outputs[i]->updatePortPosition();
+                       _outputs[i]->notifyObservers(_objectId);
+               }
+       }
+
+       //=========================================================================
+
+
+}  // EO namespace bbtk
+
+// EOF
+
diff --git a/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GBoxModel.h b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GBoxModel.h
new file mode 100644 (file)
index 0000000..b02c7a6
--- /dev/null
@@ -0,0 +1,109 @@
+/*=========================================================================                                                                               
+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::GBoxModel : abstract black-box interface. 
+*/
+
+/**
+* \class bbtk::GBoxModel
+* \brief 
+*/
+
+#ifndef __GBoxModel_h__
+#define __GBoxModel_h__
+
+//Includes same project
+#include "GlobalConstants.h"
+#include "GObjectModel.h"
+#include "GPortModel.h"
+
+//Includes creaMaracasVisu
+
+//Includes std
+#include <iostream>
+
+
+namespace bbtk
+{
+
+       class GPortModel;
+
+       class GBoxModel : public GObjectModel 
+       {
+
+       public: 
+
+               //Constructors
+               GBoxModel();
+               ~GBoxModel();
+               
+               //Public methods                
+               virtual void setInicPoint(double& x, double& y, double& z);
+               void addInputPort(GPortModel *inputport);
+               void addOutputPort(GPortModel *outputport);
+               int getNumInputPorts();
+               int getNumOutputPorts();
+               virtual void move(double xx,double yy,double zz);
+
+               virtual std::string getStatusText();
+               virtual void save(std::string &content);
+
+               std::vector<GPortModel*> getInputPorts();
+               std::vector<GPortModel*> getOutputPorts();
+
+               GPortModel* getInputPort(std::string name);
+               GPortModel* getOutputPort(std::string name);
+
+               void updatePorts();
+
+       private:
+
+               //Private Attributes
+
+               //Private Methods
+
+       protected:
+               //Protected Attributes
+               std::vector<GPortModel*> _inputs;
+               std::vector<GPortModel*> _outputs;
+
+               //Protected methods
+               
+       };
+
+
+}
+// namespace bbtk
+#endif
+
diff --git a/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GComplexBoxPortModel.cxx b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GComplexBoxPortModel.cxx
new file mode 100644 (file)
index 0000000..2bdd8cb
--- /dev/null
@@ -0,0 +1,103 @@
+/*=========================================================================                                                                               
+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::GBlackBox 
+*/
+
+
+#include "GComplexBoxPortModel.h"
+
+namespace bbtk
+{
+       //=========================================================================
+
+       GComplexBoxPortModel::GComplexBoxPortModel()
+       {               
+       }
+
+       //=========================================================================
+
+       GComplexBoxPortModel::~GComplexBoxPortModel()
+       {
+       }
+
+       //=========================================================================
+
+       void GComplexBoxPortModel::setInicPoint(double& x, double& y, double& z)
+       {
+               GObjectModel::setInicPoint(x,y,z);
+
+               double xFin=x+COMPLEXPORT_WIDTH,yFin=y-COMPLEXPORT_HEIGHT;
+               setFinalPoint(xFin,yFin,z);
+       }
+       
+       //=========================================================================     
+
+       std::string GComplexBoxPortModel::getStatusText()
+       {
+               std::string temp = "";
+               temp+=_bbtkName;
+               
+               return temp;
+       }
+
+       //=========================================================================
+
+       void GComplexBoxPortModel::save(std::string &content)
+       {
+               content+="COMPLEX_BOX_PORT\n";
+               // COMPLEX_BOX_PORT info
+               
+               content+="FIN_COMPLEX_BOX_PORT\n";
+
+       }
+       
+       //=========================================================================
+
+       int GComplexBoxPortModel::getComplexPortType()
+       {
+               return _complexPortType;
+       }
+
+       //=========================================================================
+       
+       void GComplexBoxPortModel::setComplexPortType(int pType)
+       {
+               _complexPortType=pType;
+       }
+
+       //=========================================================================
+
+}  // EO namespace bbtk
+
+// EOF
+
diff --git a/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GComplexBoxPortModel.h b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GComplexBoxPortModel.h
new file mode 100644 (file)
index 0000000..74703ac
--- /dev/null
@@ -0,0 +1,94 @@
+/*=========================================================================                                                                               
+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::GBlackBox : abstract black-box interface. 
+*/
+
+/**
+* \class bbtk::GBlackBox
+* \brief 
+*/
+
+#ifndef __GComplexBoxPortModel_h__
+#define __GComplexBoxPortModel_h__
+
+//Includes same project
+#include "GlobalConstants.h"
+#include "GBoxModel.h"
+
+//Includes creaMaracasVisu
+
+//Includes std
+#include <iostream>
+
+
+namespace bbtk
+{
+
+       class GComplexBoxPortModel : public GBoxModel
+       {
+
+       public: 
+
+               //Constructors
+               GComplexBoxPortModel();
+               ~GComplexBoxPortModel();
+               
+               //Public methods        
+               virtual void setInicPoint(double& x, double& y, double& z);
+               int getComplexPortType();
+               void setComplexPortType(int pType);
+
+               virtual std::string getStatusText();
+               virtual void save(std::string &content);
+
+       private:
+
+               //Private Attributes
+               int _complexPortType;
+
+               //Private Methods
+
+       protected:
+               //Protected Attributes
+
+               //Protected methods
+               
+       };
+
+
+}
+// namespace bbtk
+#endif
+
index 125512896f7731c2b5f165092e5e68358b8c9402..41148af3db9acf02bf04752c096cc48da3e8fb31 100644 (file)
@@ -127,12 +127,6 @@ namespace bbtk
 
        //=========================================================================
 
-       void GObjectModel::updateBlackBox(BlackBoxDescriptor::Pointer descriptor)//virtual
-       {
-       }
-
-       //=========================================================================
-
        void GObjectModel::move(double xx,double yy,double zz)//virtual
        {
                setInicPoint(xx,yy,zz);
index d13b4593877ccaf764426e4d57e1a92b056f5022..39648f9fc3dd712ea5c20dec019e400ec93c0bee 100644 (file)
@@ -78,7 +78,6 @@ namespace bbtk
                virtual void move(double xx,double yy,double zz);
 
                virtual bool isPointInside(double x,double y, double z);
-               virtual void updateBlackBox(BlackBoxDescriptor::Pointer descriptor);
 
                int getGObjectType();
                void setGObjectType(int obtype);
index 200a5f4b278d91ec1316fc04da66500b4b2083ca..c6ca8b0c35855d3cd2ff103d4e88d8b5e552a086 100644 (file)
@@ -57,7 +57,7 @@ namespace bbtk
        }
        //=========================================================================
 
-       void GPortModel::registerInBox(GBlackBoxModel *blackBox,int portType, int pos)
+       void GPortModel::registerInBox(GBoxModel *blackBox,int portType, int pos)
        {
                _parentBox = blackBox;
                _portType = portType;
@@ -125,7 +125,7 @@ namespace bbtk
 
        //=========================================================================
 
-       GBlackBoxModel* GPortModel::getParentBox()
+       GBoxModel* GPortModel::getParentBox()
        {
                return _parentBox;
        }
index 6b5d7723d00758e6ea93d410ddf969bd68300381..6dcef4dda6b8cae3d5d8ca971374f06448e9411e 100644 (file)
@@ -46,7 +46,7 @@ Version:   $Revision$
 //Includes same project
 #include "GlobalConstants.h"
 #include "GObjectModel.h"
-#include "GBlackBoxModel.h"
+#include "GBoxModel.h"
 
 //Includes creaMaracasVisu
 
@@ -57,7 +57,7 @@ Version:   $Revision$
 namespace bbtk
 {
 
-       class GBlackBoxModel;
+       class GBoxModel;
 
        class GPortModel : public GObjectModel 
        {
@@ -69,10 +69,10 @@ namespace bbtk
                virtual ~GPortModel();
                
                //Public methods                
-               void registerInBox(GBlackBoxModel *blackBox,int portType, int pos);
+               void registerInBox(GBoxModel *blackBox,int portType, int pos);
                void updatePortPosition();
                int getPortType();
-               GBlackBoxModel* getParentBox();
+               GBoxModel* getParentBox();
                virtual std::string getStatusText();
                bool isConnected();
                void setConnected(bool value);
@@ -85,7 +85,7 @@ namespace bbtk
 
                //Attributes
                
-               GBlackBoxModel *_parentBox;
+               GBoxModel *_parentBox;
 
                int _portType;
                int _posInBox;
index 7405a962b928b1d00d4a1fe10d8e4369d4d6d991..9db8bf006af3dd31a1f110e0ed356c2f8d20c7c5 100644 (file)
@@ -44,105 +44,125 @@ namespace bbtk
 {
 
        // Object types
-       const int GBLACKBOX = 1;
-       const int GCONNECTOR = 2;
-       const int GPORT = 3;
-       const int GINPUTPORT = 4;
-       const int GOUTPUTPORT = 5;
+       const int GBLACKBOX                                     =       1;
+       const int GCONNECTOR                            =       2;
+       const int GPORT                                         =       3;
+       const int GINPUTPORT                            =       4;
+       const int GOUTPUTPORT                           =       5;
+       const int GCOMPLEXINPUTPORT                     =       6;
+       const int GCOMPLEXOUTPUTPORT            =       7;
 
        // Object states
-       const int NOTHING_HAPPENS = 101;
-       const int HIGHLIGHTED=102;
-       const int CLICKED=103;
-       const int DRAG=104;
-       const int SELECTED=105;
-       const int CREATING_CONTOUR=106;
+       const int NOTHING_HAPPENS                       =       101;
+       const int HIGHLIGHTED                           =       102;
+       const int CLICKED                                       =       103;
+       const int DRAG                                          =       104;
+       const int SELECTED                                      =       105;
+       const int CREATING_CONTOUR                      =       106;
 
        // Object dimensions
-       const double BOX_HEIGHT         =       10;
-       const double BOX_WIDTH          =       100;
-       const double PORT_HEIGHT        =       2.8;
-       const double PORT_WIDTH         =       2.8;
+       const double BOX_HEIGHT                         =       10;
+       const double BOX_WIDTH                          =       100;
+       const double PORT_HEIGHT                        =       2.8;
+       const double PORT_WIDTH                         =       2.8;
+       const double COMPLEXPORT_HEIGHT         =       6;
+       const double COMPLEXPORT_WIDTH          =       6;
 
        // Commands
-       const int NO_COMMAND = 201;
-       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 NO_COMMAND                            =       201;
+       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;
        
        
        //// COLORS (object_state_(R|G|B))
 
-       //Box Border colors
+       //Object Border colors
 
-       const double BOXBORDER_NH_R=0.5;
-       const double BOXBORDER_NH_G=0.25;
-       const double BOXBORDER_NH_B=0.0;
+       const double BOXBORDER_NH_R                                     =       0.5;
+       const double BOXBORDER_NH_G                                     =       0.25;
+       const double BOXBORDER_NH_B                                     =       0.0;
 
-       const double BOXBORDER_HIGHLIGHTED_R=0.05;
-       const double BOXBORDER_HIGHLIGHTED_G=0.25;
-       const double BOXBORDER_HIGHLIGHTED_B=0.45;
+       const double COMPLEXINPUTPORTBORDER_NH_R        =       0.7;
+       const double COMPLEXINPUTPORTBORDER_NH_G        =       0.1;
+       const double COMPLEXINPUTPORTBORDER_NH_B        =       0.1;
 
-       const double BOXBORDER_DRAG_R=0.75;
-       const double BOXBORDER_DRAG_G=0.75;
-       const double BOXBORDER_DRAG_B=0.75;
+       const double COMPLEXOUTPUTPORTBORDER_NH_R       =       0.3;
+       const double COMPLEXOUTPUTPORTBORDER_NH_G       =       0.55;
+       const double COMPLEXOUTPUTPORTBORDER_NH_B       =       0.1;
+
+       const double BOXBORDER_HIGHLIGHTED_R            =       0.05;
+       const double BOXBORDER_HIGHLIGHTED_G            =       0.25;
+       const double BOXBORDER_HIGHLIGHTED_B            =       0.45;
+
+       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;
+       const double BOXBORDER_SELECTED_R                       =       0.45;
+       const double BOXBORDER_SELECTED_G                       =       0.45;
+       const double BOXBORDER_SELECTED_B                       =       0.00;
+
+
+       //Object Fill colors
 
+       const double BOXFILL_NH_R                               =       0.5;
+       const double BOXFILL_NH_G                               =       0.35;
+       const double BOXFILL_NH_B                               =       0.15;
 
-       //Box Fill colors
+       const double COMPLEXINPUTPORTFILL_NH_R  =       0.8;
+       const double COMPLEXINPUTPORTFILL_NH_G  =       0.1;
+       const double COMPLEXINPUTPORTFILL_NH_B  =       0.1;
 
-       const double BOXFILL_NH_R=0.5;
-       const double BOXFILL_NH_G=0.35;
-       const double BOXFILL_NH_B=0.15;
+       const double COMPLEXOUTPUTPORTFILL_NH_R =       0.5;
+       const double COMPLEXOUTPUTPORTFILL_NH_G =       0.85;
+       const double COMPLEXOUTPUTPORTFILL_NH_B =       0.1;
 
-       const double BOXFILL_HIGHLIGHTED_R=0.05;
-       const double BOXFILL_HIGHLIGHTED_G=0.30;
-       const double BOXFILL_HIGHLIGHTED_B=0.45;
+       const double BOXFILL_HIGHLIGHTED_R              =       0.05;
+       const double BOXFILL_HIGHLIGHTED_G              =       0.30;
+       const double BOXFILL_HIGHLIGHTED_B              =       0.45;
 
-       const double BOXFILL_DRAG_R=0.75;
-       const double BOXFILL_DRAG_G=0.75;
-       const double BOXFILL_DRAG_B=0.75;
+       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;
+       const double BOXFILL_SELECTED_R                 =       0.65;
+       const double BOXFILL_SELECTED_G                 =       0.65;
+       const double BOXFILL_SELECTED_B                 =       0.05;
 
 
-       //Box Text colors
+       //Object Text colors
 
-       const double BOXTEXT_NH_R=0.25;
-       const double BOXTEXT_NH_G=0.0;
-       const double BOXTEXT_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;
 
-       const double BOXTEXT_HIGHLIGHTED_R=0.05;
-       const double BOXTEXT_HIGHLIGHTED_G=0.05;
-       const double BOXTEXT_HIGHLIGHTED_B=0.4;
+       const double BOXTEXT_HIGHLIGHTED_R              =       0.05;
+       const double BOXTEXT_HIGHLIGHTED_G              =       0.05;
+       const double BOXTEXT_HIGHLIGHTED_B              =       0.4;
 
-       const double BOXTEXT_DRAG_R=0.75;
-       const double BOXTEXT_DRAG_G=0.75;
-       const double BOXTEXT_DRAG_B=0.75;
+       const double BOXTEXT_DRAG_R                             =       0.75;
+       const double BOXTEXT_DRAG_G                             =       0.75;
+       const double BOXTEXT_DRAG_B                             =       0.75;
 
-       const double BOXTEXT_SELECTED_R=0.35;
-       const double BOXTEXT_SELECTED_G=0.35;
-       const double BOXTEXT_SELECTED_B=0.05;
+       const double BOXTEXT_SELECTED_R                 =       0.35;
+       const double BOXTEXT_SELECTED_G                 =       0.35;
+       const double BOXTEXT_SELECTED_B                 =       0.05;
 
        // Id's
-       const int ID_NEW = 1000;
-       const int ID_SAVE = 1001;
-       const int ID_OPEN = 1002;
-       const int ID_RUN = 1003;
-       const int ID_DELETEALL = 1004;
-       const int ID_CENTERVIEW = 1005;
-       const int ID_BTNCOMPLEXBOX = 1006;
-       const int ID_ADDCOMPLEXBOXINPUT = 1007;
-       const int ID_ADDCOMPLEXBOXOUTPUT = 1008;
-
-       const int wxID_NOTEBOOK = 1010;
+       const int ID_NEW                                                =       1000;
+       const int ID_SAVE                                               =       1001;
+       const int ID_OPEN                                               =       1002;
+       const int ID_RUN                                                =       1003;
+       const int ID_DELETEALL                                  =       1004;
+       const int ID_CENTERVIEW                                 =       1005;
+       const int ID_BTNCOMPLEXBOX                              =       1006;
+       const int ID_ADDCOMPLEXBOXINPUT                 =       1007;
+       const int ID_ADDCOMPLEXBOXOUTPUT                =       1008;
+
+       const int wxID_NOTEBOOK                                 =       1010;
 }
 // namespace bbtk
 #endif
index 39f1237a99d7524167b9a6bff1e686a87ec91ffb..9b2dc954d20f4527528b5f693f07d63c9d03a18f 100644 (file)
@@ -100,7 +100,6 @@ namespace bbtk
 
        int wxVtkSceneManager::createGBlackBox(int x, int y, std::string packageName, std::string boxType)
        {
-
                int windowWidth=_baseView->GetRenWin()->GetSize()[0];
                int windowHeight=_baseView->GetRenWin()->GetSize()[1];
 
@@ -196,7 +195,125 @@ namespace bbtk
 
        //=========================================================================
 
-       int wxVtkSceneManager::createGInputPort(int portType, int posinBox,GBlackBoxModel *blackBox, BlackBoxInputDescriptor *desc)
+       int wxVtkSceneManager::createGComplexBoxInputPort(std::string inputName)
+       {
+               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 
+
+               double xx = 5;
+               double yy = windowHeight-5;
+               
+               //z value is not important yet, because it is only used a parallel projection
+               double zz = 900;
+
+               _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                
+               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);
+               
+               //Register the controller of the new object
+               registerController((InteractorStyleMaracas*) controller);
+
+               //Add the object to the objects list 
+               int newId = _controllers.size();
+               controller->setId(newId);
+               _controllers[newId] = controller;
+               return newId;
+       }
+
+       //=========================================================================
+       
+       int wxVtkSceneManager::createGComplexBoxOutputPort(std::string outputName)
+       {
+               int windowWidth=_baseView->GetRenWin()->GetSize()[0];
+               int windowHeight=_baseView->GetRenWin()->GetSize()[1];
+
+               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 
+
+               double xx = 5;
+               double yy = windowHeight-5;
+               
+               //z value is not important yet, because it is only used a parallel projection
+               double zz = 900;
+
+               _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                
+               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);
+               
+               //Register the controller of the new object
+               registerController((InteractorStyleMaracas*) controller);
+
+               //Add the object to the objects list 
+               int newId = _controllers.size();
+               controller->setId(newId);
+               _controllers[newId] = controller;
+               return newId;
+       }
+
+       //=========================================================================
+
+       int wxVtkSceneManager::createGInputPort(int portType, int posinBox,GBoxModel *blackBox, BlackBoxInputDescriptor *desc)
        {
                GPortController* portController = createGPort(portType,desc->GetName(),desc->GetTypeName(),posinBox,blackBox);
                blackBox->addInputPort((GPortModel*)portController->getModel());
@@ -205,7 +322,7 @@ namespace bbtk
 
        //=========================================================================
 
-       int wxVtkSceneManager::createGOutputPort(int portType, int posinBox,GBlackBoxModel *blackBox, BlackBoxOutputDescriptor *desc)
+       int wxVtkSceneManager::createGOutputPort(int portType, int posinBox,GBoxModel *blackBox, BlackBoxOutputDescriptor *desc)
        {
                GPortController* portController = createGPort(portType,desc->GetName(),desc->GetTypeName(),posinBox,blackBox);
                blackBox->addOutputPort((GPortModel*)portController->getModel());
@@ -214,7 +331,7 @@ namespace bbtk
 
        //=========================================================================
 
-       GPortController* wxVtkSceneManager::createGPort(int portType,std::string bbtkName, std::string bbtkType, int posInBox,GBlackBoxModel *blackBox)
+       GPortController* wxVtkSceneManager::createGPort(int portType,std::string bbtkName, std::string bbtkType, int posInBox,GBoxModel *blackBox)
        {
                int type = GPORT;
 
index 3479c2a72356e5cb4eedcb9e62e9a127f7c2be6f..118d136d2a9fec85a709ff4ab993e4ae252f5310 100644 (file)
@@ -46,6 +46,8 @@ Version:   $Revision$
 //Includes same project
 #include "GObjectsMVCFactory.h"
 #include "Observer.h"
+#include "GBoxModel.h"
+#include "GComplexBoxPortModel.h"
 #include "GPortModel.h"
 #include "vtkGConnectorView.h"
 #include "GConnectorModel.h"
@@ -90,9 +92,11 @@ namespace bbtk
 
                void configureBaseView();
                int createGBlackBox(int x, int y,std::string packageName, std::string boxType);
-               GPortController* createGPort(int portType, std::string bbtkName, std::string bbtkType, int posinBox,GBlackBoxModel *blackBox);
-               int createGInputPort(int portType, int posinBox,GBlackBoxModel *blackBox, BlackBoxInputDescriptor *desc);
-               int createGOutputPort(int portType, int posinBox,GBlackBoxModel *blackBox, BlackBoxOutputDescriptor *desc);
+               int createGComplexBoxInputPort(std::string inputName);
+               int createGComplexBoxOutputPort(std::string outputName);
+               GPortController* createGPort(int portType, std::string bbtkName, std::string bbtkType, int posinBox,GBoxModel *blackBox);
+               int createGInputPort(int portType, int posinBox,GBoxModel *blackBox, BlackBoxInputDescriptor *desc);
+               int createGOutputPort(int portType, int posinBox,GBoxModel *blackBox, BlackBoxOutputDescriptor *desc);
                int createGConnector(GPortModel* startPort);
 
                void registerController(InteractorStyleMaracas *param);
index 1fc734e9caf8081d5a0d368b9ba587ec9f127a1b..39f8274ddff6910fee21801015024795dd3c882f 100644 (file)
@@ -45,7 +45,7 @@ Version:   $Revision$
 
 //Includes same project
 #include "GlobalConstants.h"
-#include "GObjectController.h"
+#include "GBoxController.h"
 #include "GBlackBoxModel.h"
 
 //Includes creaMaracasVisu
@@ -57,7 +57,7 @@ Version:   $Revision$
 namespace bbtk
 {
 
-       class GBlackBoxController : public GObjectController
+       class GBlackBoxController : public GBoxController
        {
 
        public: 
diff --git a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GBoxController.cxx b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GBoxController.cxx
new file mode 100644 (file)
index 0000000..adb3bf0
--- /dev/null
@@ -0,0 +1,152 @@
+/*=========================================================================                                                                               
+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::GBoxController 
+*/
+
+
+#include "GBoxController.h"
+
+namespace bbtk
+{
+
+
+       //=========================================================================
+       GBoxController::GBoxController()
+       {
+               
+       }
+
+       //=========================================================================
+       GBoxController::~GBoxController()
+       {
+       }
+       //=========================================================================
+
+       bool GBoxController::OnMouseMove()
+       {
+               
+               if ( _vtkInteractorStyleBaseView!=NULL)
+               {
+                       int X,Y;
+                       wxVTKRenderWindowInteractor *_wxVTKiren;
+                       _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);   
+                               }                       
+                       }
+                       if( state==HIGHLIGHTED)
+                       {
+                               if(!_view->isPointInside(X,Y))
+                               {
+                                       _view->setState(NOTHING_HAPPENS);
+                               }
+                       }
+                       
+                       _model->notifyObservers(getId());
+                       
+               }
+               return true;
+       }
+
+       //=========================================================================
+       
+       bool GBoxController::OnLeftButtonDown()
+       {
+               int state  = _view->getState();
+                       
+               //Evaluate new state
+               if(state == HIGHLIGHTED)
+               {
+                       _isLeftClickDown=true;
+                       _view->setState(SELECTED);
+                       _model->notifyObservers(getId(),ADD_TO_SELECTED);
+               }
+               return true;
+
+       }
+
+       //=========================================================================
+       
+       bool GBoxController::OnLeftButtonUp()
+       {
+               int X,Y;
+               wxVTKRenderWindowInteractor *wxVTKiren;
+               wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk3DBaseView()->GetWxVTKRenderWindowInteractor();
+               wxVTKiren->GetEventPosition(X,Y);
+
+               int state  = _view->getState();
+                       
+               //Evaluate new state
+               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());
+                       }
+               }
+               return true;
+               
+       }
+       
+       //=========================================================================
+
+       bool GBoxController::OnRightButtonUp()
+       {
+               return true;
+       }
+
+       //=========================================================================
+
+       bool GBoxController::OnMiddleButtonDown()
+       {
+               return true;
+       }
+
+       //=========================================================================
+
+}  // EO namespace bbtk
+
+// EOF
+
diff --git a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GBoxController.h b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GBoxController.h
new file mode 100644 (file)
index 0000000..8082668
--- /dev/null
@@ -0,0 +1,93 @@
+/*=========================================================================                                                                               
+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::GBoxController : 
+*/
+
+/**
+* \class bbtk::GBoxController
+* \brief 
+*/
+
+#ifndef __GBoxController_h__
+#define __GBoxController_h__
+
+//Includes same project
+#include "GlobalConstants.h"
+#include "GObjectController.h"
+#include "GBlackBoxModel.h"
+
+//Includes creaMaracasVisu
+
+//Includes std
+#include <iostream>
+
+
+namespace bbtk
+{
+
+       class GBoxController : public GObjectController
+       {
+
+       public: 
+
+               //Constructors
+               GBoxController();
+               ~GBoxController();
+               
+               //Public methods
+               
+
+
+       private:
+
+               //Attributes
+
+               //Private Methods
+
+       protected:
+               virtual bool  OnMouseMove();
+               virtual bool  OnLeftButtonDown(); 
+               virtual bool  OnLeftButtonUp();
+               virtual bool  OnMiddleButtonDown(); 
+               virtual bool  OnRightButtonUp();
+
+
+       };
+
+
+}
+// namespace bbtk
+#endif
+
index c9a1bc9a1bde6c2bb672b05f83775bcfab2204d4..d495b72ea90ae4649dabc3d18b5465c5500b9ad6 100644 (file)
@@ -98,6 +98,10 @@ namespace bbtk
                {
                        view = new vtkGPortView();
                }
+               else if(type == GCOMPLEXINPUTPORT || type == GCOMPLEXOUTPUTPORT)
+               {
+                       view = new vtkGComplexBoxPortView();
+               }
                return view;
        }
 
@@ -114,6 +118,10 @@ namespace bbtk
                {
                        controller = new GPortController();
                }
+               else if(type == GCOMPLEXINPUTPORT || type == GCOMPLEXOUTPUTPORT)
+               {
+                       controller = new GBoxController();
+               }
                return controller;
        }
 
@@ -130,6 +138,10 @@ namespace bbtk
                {
                        model = new GPortModel();
                }
+               else if(type == GCOMPLEXINPUTPORT || type == GCOMPLEXOUTPUTPORT)
+               {
+                       model = new GComplexBoxPortModel();
+               }
 
                model->setGObjectType(type);
 
index 30d838cfe30e6a3a7babae2d2aa14f7811777fc9..606b0952ead28a06e4514ad432a5a476d6685687 100644 (file)
@@ -58,6 +58,11 @@ Version:   $Revision$
 #include "vtkGPortView.h"
 #include "GPortModel.h"
 
+#include "GBoxController.h"
+#include "vtkGComplexBoxPortView.h"
+#include "GComplexBoxPortModel.h"
+
+
 
 //Includes creaMaracasVisu
 
index 2d9f0c1c8ba0f72dcf4b9a31633f752389fc6938..a617d701a43a2e51e5de69483af25d1c74680151 100644 (file)
@@ -231,13 +231,6 @@ namespace bbtk
 
        //=========================================================================
 
-       void vtkGBlackBoxView::updatePorts()
-       {
-               GBlackBoxModel* bmod =(GBlackBoxModel*)_model;
-               bmod->updatePorts();
-       }
-
-       //=========================================================================
 
 }  // EO namespace bbtk
 
index 4391d61ae561ef8003d25cbfce7158541a27d304..90494d9ac3976b2ce1130eedd6febb16e33f29de 100644 (file)
@@ -45,7 +45,7 @@ Version:   $Revision$
 
 //Includes same project
 #include "GlobalConstants.h"
-#include "vtkGObjectView.h"
+#include "vtkGBoxView.h"
 #include "GBlackBoxModel.h"
 
 //Includes creaMaracasVisu
@@ -71,7 +71,7 @@ Version:   $Revision$
 namespace bbtk
 {
 
-       class vtkGBlackBoxView : public vtkGObjectView
+       class vtkGBlackBoxView : public vtkGBoxView
        {
 
        public: 
@@ -100,7 +100,6 @@ namespace bbtk
                virtual void createVtkObjects();
                virtual void update(int idController,int command);
                virtual void updateColors();
-               void updatePorts();
        };
 
 
diff --git a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGBoxView.cxx b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGBoxView.cxx
new file mode 100644 (file)
index 0000000..f6121e4
--- /dev/null
@@ -0,0 +1,209 @@
+/*=========================================================================                                                                               
+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::vtkGBoxView 
+*/
+
+
+#include "vtkGBoxView.h"
+
+namespace bbtk
+{
+
+
+       //=========================================================================
+       vtkGBoxView::vtkGBoxView()
+       {                       
+       }
+
+       //=========================================================================
+       vtkGBoxView::~vtkGBoxView()
+       {
+       }
+
+       //=========================================================================
+       void vtkGBoxView::update(int idController,int command)
+       {
+               updateColors();
+               
+               double xInic, yInic,zInic,xFin, yFin,zFin;
+               _model->getInicPoint(xInic,yInic,zInic);
+               _model->getFinalPoint(xFin, yFin,zFin);
+
+               // RaC In the actual version, zInic=zFin=900
+
+               _pts->SetPoint(0, xInic, yInic, zInic );
+               _pts->SetPoint(1, xInic, yFin, zInic );
+               _pts->SetPoint(2, xFin, yFin, zFin );
+               _pts->SetPoint(3, xFin, yInic, zFin );
+
+               updatePorts();
+
+               _borderPolyMapper->Modified();
+               _fillPolyMapper->Modified();
+               //-----------
+
+               //-----------
+               setRefreshWaiting();
+       }
+
+       //=========================================================================
+
+       void vtkGBoxView::createVtkObjects() //virtual
+       {
+
+               //------------
+               _pts = vtkPoints::New();        
+               vtkCellArray *lines = vtkCellArray::New();
+               vtkPolyData *_pd = vtkPolyData::New();
+               _borderPolyMapper=vtkPolyDataMapper::New();
+               _borderObjectActor=vtkActor::New();
+                               
+               _pts->SetNumberOfPoints(4);
+
+               double xInic, yInic,zInic,xFin, yFin,zFin;
+               _model->getInicPoint(xInic,yInic,zInic);
+               _model->getFinalPoint(xFin, yFin,zFin);
+
+               // RaC In the actual version, zInic=zFin=900
+
+               _pts->SetPoint(0, xInic, yInic, zInic );
+               _pts->SetPoint(1, xInic, yFin, zInic );
+               _pts->SetPoint(2, xFin, yFin, zFin );
+               _pts->SetPoint(3, xFin, yInic, zFin );
+                               
+               lines->InsertNextCell(5);
+               lines->InsertCellPoint(0);
+               lines->InsertCellPoint(1);
+               lines->InsertCellPoint(2);
+               lines->InsertCellPoint(3);
+               lines->InsertCellPoint(0);
+                       
+               _pd->SetPoints( _pts );
+               _pd->SetLines( lines );
+
+               _borderPolyMapper->SetInput(_pd);
+               _borderObjectActor->SetMapper(_borderPolyMapper);
+               _borderPolyMapper->Modified();
+
+               
+               ///************************* FILL *************************
+
+               vtkCellArray *strip = vtkCellArray::New();
+               vtkPolyData *pdFill = vtkPolyData::New();
+               _fillPolyMapper=vtkPolyDataMapper::New();
+               _fillObjectActor=vtkActor::New();
+
+               // RaC In the actual version, zInic=zFin=900
+
+               strip->InsertNextCell(5);
+               strip->InsertCellPoint(0);
+               strip->InsertCellPoint(1);
+               strip->InsertCellPoint(2);
+               strip->InsertCellPoint(0);
+               strip->InsertCellPoint(3);
+                       
+               pdFill->SetPoints( _pts );
+               pdFill->SetStrips( strip );
+
+               _fillPolyMapper->SetInput(pdFill);
+               _fillObjectActor->SetMapper(_fillPolyMapper);
+               _fillPolyMapper->Modified();
+
+               ///************************* FILL *************************
+
+       }
+
+       //=========================================================================
+
+       void vtkGBoxView::addVtkActors()//virtual
+       {
+               _baseView->GetRenderer()->AddActor(_borderObjectActor);
+               vtkGObjectView::addVtkActors();
+       }
+
+       //=========================================================================
+
+       void vtkGBoxView::removeVtkActors()//virtual
+       {
+               _baseView->GetRenderer()->RemoveActor(_borderObjectActor);
+               vtkGObjectView::removeVtkActors();
+       }
+
+       //=========================================================================
+
+       void vtkGBoxView::updateColors()
+       {
+               _fillObjectActor->GetProperty()->SetAmbient(0.6);
+
+               if(_state==NOTHING_HAPPENS)
+               {
+                       _borderObjectActor->GetProperty()->SetLineWidth(1);
+                       _borderObjectActor->GetProperty()->SetColor(BOXBORDER_NH_R,BOXBORDER_NH_G,BOXBORDER_NH_B);
+                       _fillObjectActor->GetProperty()->SetColor(BOXFILL_NH_R,BOXFILL_NH_G,BOXFILL_NH_B);
+                       
+               }
+               else if(_state==HIGHLIGHTED)
+               {
+                       _borderObjectActor->GetProperty()->SetLineWidth(2);
+                       
+                       _borderObjectActor->GetProperty()->SetColor(BOXBORDER_HIGHLIGHTED_R,BOXBORDER_HIGHLIGHTED_G,BOXBORDER_HIGHLIGHTED_B);
+                       _fillObjectActor->GetProperty()->SetColor(BOXFILL_HIGHLIGHTED_R,BOXFILL_HIGHLIGHTED_G,BOXFILL_HIGHLIGHTED_B);
+               }
+               else if(_state==DRAG)
+               {
+                       _borderObjectActor->GetProperty()->SetLineWidth(1.2);
+                       _borderObjectActor->GetProperty()->SetColor(BOXBORDER_DRAG_R,BOXBORDER_DRAG_G,BOXBORDER_DRAG_B);
+                       _fillObjectActor->GetProperty()->SetColor(BOXFILL_DRAG_R,BOXFILL_DRAG_G,BOXFILL_DRAG_B);
+               }
+               else if(_state==SELECTED)
+               {
+                       _borderObjectActor->GetProperty()->SetLineWidth(2);
+                       _borderObjectActor->GetProperty()->SetColor(BOXBORDER_SELECTED_R,BOXBORDER_SELECTED_G,BOXBORDER_SELECTED_B);
+                       _fillObjectActor->GetProperty()->SetColor(BOXFILL_SELECTED_R,BOXFILL_SELECTED_G,BOXFILL_SELECTED_B);
+               }
+       }
+
+       //=========================================================================
+
+       void vtkGBoxView::updatePorts()
+       {
+               GBoxModel* bmod =(GBoxModel*)_model;
+               bmod->updatePorts();
+       }
+
+       //=========================================================================
+
+}  // EO namespace bbtk
+
+// EOF
+
diff --git a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGBoxView.h b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGBoxView.h
new file mode 100644 (file)
index 0000000..268ec9a
--- /dev/null
@@ -0,0 +1,108 @@
+/*=========================================================================                                                                               
+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::vtkGBoxView : abstract black-box interface. 
+*/
+
+/**
+* \class bbtk::vtkGBoxView
+* \brief 
+*/
+
+#ifndef __vtkGBoxView_h__
+#define __vtkGBoxView_h__
+
+//Includes same project
+#include "GlobalConstants.h"
+#include "vtkGObjectView.h"
+#include "GBoxModel.h"
+
+//Includes creaMaracasVisu
+
+#include "vtkInteractorStyleBaseView.h"
+
+//Includes vtk
+
+#include "vtkPolyDataMapper.h"
+#include "vtkActor.h"
+#include "vtkVectorText.h"
+#include "vtkRenderer.h"
+#include "vtkCellArray.h"
+
+#include "vtkTextActor3D.h"
+#include "vtkTextProperty.h"
+
+
+//Includes std
+#include <iostream>
+
+
+namespace bbtk
+{
+
+       class vtkGBoxView : public vtkGObjectView
+       {
+
+       public: 
+
+               //Constructors
+               vtkGBoxView();
+               ~vtkGBoxView();
+               
+               //Public methods                
+
+       private:
+
+               //Private Attributes
+
+               //Private Methods
+
+       protected:
+
+               //Protected Attributes
+               
+               //Protected Methods
+               virtual void addVtkActors();
+               virtual void removeVtkActors();
+               virtual void createVtkObjects();
+               virtual void update(int idController,int command);
+               virtual void updateColors();
+               void updatePorts();
+       };
+
+
+}
+// namespace bbtk
+#endif
+
diff --git a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGComplexBoxPortView.cxx b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGComplexBoxPortView.cxx
new file mode 100644 (file)
index 0000000..3f528c0
--- /dev/null
@@ -0,0 +1,213 @@
+/*=========================================================================                                                                               
+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::vtkGComplexBoxPortView 
+*/
+
+
+#include "vtkGComplexBoxPortView.h"
+
+namespace bbtk
+{
+
+
+       //=========================================================================
+       vtkGComplexBoxPortView::vtkGComplexBoxPortView()
+       {                       
+       }
+
+       //=========================================================================
+       vtkGComplexBoxPortView::~vtkGComplexBoxPortView()
+       {
+       }
+
+       //=========================================================================
+       void vtkGComplexBoxPortView::update(int idController,int command)
+       {
+               updateColors();
+               
+               double xInic, yInic,zInic,xFin, yFin,zFin;
+               _model->getInicPoint(xInic,yInic,zInic);
+               _model->getFinalPoint(xFin, yFin,zFin);
+
+               // RaC In the actual version, zInic=zFin=900
+
+               _pts->SetPoint(0, xInic, yInic, zInic );
+               _pts->SetPoint(1, xInic, yFin, zInic );
+               _pts->SetPoint(2, xFin, yFin, zFin );
+               _pts->SetPoint(3, xFin, yInic, zFin );
+
+               updatePorts();
+
+               _borderPolyMapper->Modified();
+               _fillPolyMapper->Modified();
+               //-----------
+
+               //-----------
+               setRefreshWaiting();
+       }
+
+       //=========================================================================
+
+       void vtkGComplexBoxPortView::createVtkObjects() //virtual
+       {
+
+               //------------
+               _pts = vtkPoints::New();        
+               vtkCellArray *lines = vtkCellArray::New();
+               vtkPolyData *_pd = vtkPolyData::New();
+               _borderPolyMapper=vtkPolyDataMapper::New();
+               _borderObjectActor=vtkActor::New();
+                               
+               _pts->SetNumberOfPoints(4);
+
+               double xInic, yInic,zInic,xFin, yFin,zFin;
+               _model->getInicPoint(xInic,yInic,zInic);
+               _model->getFinalPoint(xFin, yFin,zFin);
+
+               // RaC In the actual version, zInic=zFin=900
+
+               _pts->SetPoint(0, xInic, yInic, zInic );
+               _pts->SetPoint(1, xInic, yFin, zInic );
+               _pts->SetPoint(2, xFin, yFin, zFin );
+               _pts->SetPoint(3, xFin, yInic, zFin );
+                               
+               lines->InsertNextCell(5);
+               lines->InsertCellPoint(0);
+               lines->InsertCellPoint(1);
+               lines->InsertCellPoint(2);
+               lines->InsertCellPoint(3);
+               lines->InsertCellPoint(0);
+                       
+               _pd->SetPoints( _pts );
+               _pd->SetLines( lines );
+
+               _borderPolyMapper->SetInput(_pd);
+               _borderObjectActor->SetMapper(_borderPolyMapper);
+               _borderPolyMapper->Modified();
+
+               
+               ///************************* FILL *************************
+
+               vtkCellArray *strip = vtkCellArray::New();
+               vtkPolyData *pdFill = vtkPolyData::New();
+               _fillPolyMapper=vtkPolyDataMapper::New();
+               _fillObjectActor=vtkActor::New();
+
+               // RaC In the actual version, zInic=zFin=900
+
+               strip->InsertNextCell(5);
+               strip->InsertCellPoint(0);
+               strip->InsertCellPoint(1);
+               strip->InsertCellPoint(2);
+               strip->InsertCellPoint(0);
+               strip->InsertCellPoint(3);
+                       
+               pdFill->SetPoints( _pts );
+               pdFill->SetStrips( strip );
+
+               _fillPolyMapper->SetInput(pdFill);
+               _fillObjectActor->SetMapper(_fillPolyMapper);
+               _fillPolyMapper->Modified();
+
+               ///************************* FILL *************************
+
+       }
+
+       //=========================================================================
+
+       void vtkGComplexBoxPortView::addVtkActors()//virtual
+       {
+               _baseView->GetRenderer()->AddActor(_borderObjectActor);
+               vtkGObjectView::addVtkActors();
+       }
+
+       //=========================================================================
+
+       void vtkGComplexBoxPortView::removeVtkActors()//virtual
+       {
+               _baseView->GetRenderer()->RemoveActor(_borderObjectActor);
+               vtkGObjectView::removeVtkActors();
+       }
+
+       //=========================================================================
+
+       void vtkGComplexBoxPortView::updateColors()
+       {
+               _fillObjectActor->GetProperty()->SetAmbient(0.6);
+
+               if(_state==NOTHING_HAPPENS)
+               {
+                       _borderObjectActor->GetProperty()->SetLineWidth(1);
+                       
+
+                       GComplexBoxPortModel *portModel = (GComplexBoxPortModel*)_model;
+                       if(portModel->getComplexPortType() == GCOMPLEXINPUTPORT)
+                       {
+                               _fillObjectActor->GetProperty()->SetColor(COMPLEXINPUTPORTFILL_NH_R,COMPLEXINPUTPORTFILL_NH_G,COMPLEXINPUTPORTFILL_NH_B);
+                               _borderObjectActor->GetProperty()->SetColor(COMPLEXINPUTPORTBORDER_NH_R,COMPLEXINPUTPORTBORDER_NH_G,COMPLEXINPUTPORTBORDER_NH_B);
+                       }
+                       else if (portModel->getComplexPortType() == GCOMPLEXOUTPUTPORT)
+                       {
+                               _fillObjectActor->GetProperty()->SetColor(COMPLEXOUTPUTPORTFILL_NH_R,COMPLEXOUTPUTPORTFILL_NH_G,COMPLEXOUTPUTPORTFILL_NH_B);
+                               _borderObjectActor->GetProperty()->SetColor(COMPLEXOUTPUTPORTBORDER_NH_R,COMPLEXOUTPUTPORTBORDER_NH_G,COMPLEXOUTPUTPORTBORDER_NH_B);
+                       }
+                       
+               }
+               else if(_state==HIGHLIGHTED)
+               {
+                       _borderObjectActor->GetProperty()->SetLineWidth(2);
+                       
+                       _borderObjectActor->GetProperty()->SetColor(BOXBORDER_HIGHLIGHTED_R,BOXBORDER_HIGHLIGHTED_G,BOXBORDER_HIGHLIGHTED_B);
+                       _fillObjectActor->GetProperty()->SetColor(BOXFILL_HIGHLIGHTED_R,BOXFILL_HIGHLIGHTED_G,BOXFILL_HIGHLIGHTED_B);
+               }
+               else if(_state==DRAG)
+               {
+                       _borderObjectActor->GetProperty()->SetLineWidth(1.2);
+                       _borderObjectActor->GetProperty()->SetColor(BOXBORDER_DRAG_R,BOXBORDER_DRAG_G,BOXBORDER_DRAG_B);
+                       _fillObjectActor->GetProperty()->SetColor(BOXFILL_DRAG_R,BOXFILL_DRAG_G,BOXFILL_DRAG_B);
+               }
+               else if(_state==SELECTED)
+               {
+                       _borderObjectActor->GetProperty()->SetLineWidth(2);
+                       _borderObjectActor->GetProperty()->SetColor(BOXBORDER_SELECTED_R,BOXBORDER_SELECTED_G,BOXBORDER_SELECTED_B);
+                       _fillObjectActor->GetProperty()->SetColor(BOXFILL_SELECTED_R,BOXFILL_SELECTED_G,BOXFILL_SELECTED_B);
+               }
+       }
+
+       //=========================================================================
+
+
+}  // EO namespace bbtk
+
+// EOF
+
diff --git a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGComplexBoxPortView.h b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGComplexBoxPortView.h
new file mode 100644 (file)
index 0000000..aa08812
--- /dev/null
@@ -0,0 +1,104 @@
+/*=========================================================================                                                                               
+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::vtkGComplexBoxPortView : abstract black-box interface. 
+*/
+
+/**
+* \class bbtk::vtkGComplexBoxPortView
+* \brief 
+*/
+
+#ifndef __vtkGComplexBoxPortView_h__
+#define __vtkGComplexBoxPortView_h__
+
+//Includes same project
+#include "GlobalConstants.h"
+#include "vtkGBoxView.h"
+#include "GComplexBoxPortModel.h"
+
+//Includes creaMaracasVisu
+
+#include "vtkInteractorStyleBaseView.h"
+
+//Includes vtk
+
+#include "vtkPolyDataMapper.h"
+#include "vtkActor.h"
+#include "vtkVectorText.h"
+#include "vtkRenderer.h"
+#include "vtkCellArray.h"
+
+
+//Includes std
+#include <iostream>
+
+
+namespace bbtk
+{
+
+       class vtkGComplexBoxPortView : public vtkGBoxView
+       {
+
+       public: 
+
+               //Constructors
+               vtkGComplexBoxPortView();
+               ~vtkGComplexBoxPortView();
+               
+               //Public methods                
+
+       private:
+
+               //Private Attributes
+
+               //Private Methods
+
+       protected:
+
+               //Protected Attributes
+               
+               //Protected Methods
+               virtual void addVtkActors();
+               virtual void removeVtkActors();
+               virtual void createVtkObjects();
+               virtual void update(int idController,int command);
+               virtual void updateColors();
+       };
+
+
+}
+// namespace bbtk
+#endif
+
index 871160ae384f3a609817531b5307619f227e105a..2d4ea9e632ea86e52cc924d02f51183c344a716d 100644 (file)
@@ -92,6 +92,8 @@ namespace bbtk
                wxBitmap bmp_delete(delete_xpm);
                wxBitmap bmp_centerview(centerview_xpm);
                wxBitmap bmp_complexbox(complexbox_xpm);
+               wxBitmap bmp_complexinputport(complexinputport_xpm);
+               wxBitmap bmp_complexoutputport(complexoutputport_xpm);
 
                wxToolBar  *toolbar = new wxToolBar(this, wxID_ANY);
 
@@ -105,8 +107,8 @@ namespace bbtk
                toolbar->AddSeparator();
                toolbar->AddTool(ID_BTNCOMPLEXBOX,_T("Complex box"),complexbox_xpm, wxNullBitmap, wxITEM_NORMAL,_T("Complex box"), _T("Complex box"));
                toolbar->SetToggle(ID_BTNCOMPLEXBOX,true);
-               toolbar->AddTool(ID_ADDCOMPLEXBOXINPUT,_T("Add input to Complex box"),bmp_centerview, wxNullBitmap, wxITEM_NORMAL,_T("Add input to Complex box"), _T("Add input to Complex box"));
-               toolbar->AddTool(ID_ADDCOMPLEXBOXOUTPUT,_T("Add output to Complex box"),bmp_centerview, wxNullBitmap, wxITEM_NORMAL,_T("Add output Complex box"), _T("Add output Complex box"));
+               toolbar->AddTool(ID_ADDCOMPLEXBOXINPUT,_T("Add input to Complex box"),bmp_complexinputport, wxNullBitmap, wxITEM_NORMAL,_T("Add input to Complex box"), _T("Add input to Complex box"));
+               toolbar->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);
                
@@ -499,13 +501,33 @@ namespace bbtk
        //=========================================================================
 
        void wxGUIEditorGraphicBBS::OnAddComplexBoxInput(wxCommandEvent& event)
-       {
+       {               
+               wxTextEntryDialog *nameDialog = new wxTextEntryDialog(this,wxT("Name of input port"));
+               if (nameDialog->ShowModal() == wxID_OK)
+               {
+                       wxString fileName = nameDialog->GetValue();
+                       if(!fileName.IsEmpty())
+                       {
+                               std::string portName=fileName;
+                               _tabsMgr->addActualDiagramComplexInputPort(portName);
+                       }
+               }               
        }
 
        //=========================================================================
 
        void wxGUIEditorGraphicBBS::OnAddComplexBoxOutput(wxCommandEvent& event)
        {
+               wxTextEntryDialog *nameDialog = new wxTextEntryDialog(this,wxT("Name of output port"));
+               if (nameDialog->ShowModal() == wxID_OK)
+               {
+                       wxString fileName = nameDialog->GetValue();
+                       if(!fileName.IsEmpty())
+                       {
+                               std::string portName=fileName;
+                               _tabsMgr->addActualDiagramComplexOutputPort(portName);
+                       }
+               }       
        }
 
        //=========================================================================
index 1e472adb7e927f5d23a87854c6a71d8c283c4a36..c6f65b9d4fd52e01e076ae73461f926eda3db30f 100644 (file)
@@ -57,6 +57,8 @@
 #include "wxart_delete.xpm"
 #include "wxart_centerview.xpm"
 #include "wxart_complexbox.xpm"
+#include "wxart_complexinputport.xpm"
+#include "wxart_complexoutputport.xpm"
 
 //Includes creaMaracasVisu
 
index 3c4081eddfb66648908924312f469b0178838c55..4e5312e33f192fcd8e49af32df57deffc6a1c57a 100644 (file)
@@ -189,6 +189,20 @@ namespace bbtk
 
        //=========================================================================
 
+       void wxGEditorTabPanel::addComplexInputPort(std::string portName)
+       {
+               _sceneManager->createGComplexBoxInputPort(portName);
+       }
+
+       //=========================================================================
+
+       void wxGEditorTabPanel::addComplexOutputPort(std::string portName)
+       {
+               _sceneManager->createGComplexBoxOutputPort(portName);
+       }
+
+       //=========================================================================
+
 }  // EO namespace bbtk
 
 // EOF
index af9897ae856080663beeacf5aac6a80261c817f6..4322f6a900f081b2282f19ee729a3944039b24f1 100644 (file)
@@ -91,6 +91,8 @@ namespace bbtk
                int getPanelId();
                bool isComplexBox();
                void setComplexBox(bool val);
+               void addComplexInputPort(std::string portName);
+               void addComplexOutputPort(std::string portName);
 
        //=========================================================================
                
index 4b064566ba64e08b698c6d5466bef9d89c5b277c..2c5721dbe10fc2298037817ee655a16495625ccf 100644 (file)
@@ -156,6 +156,20 @@ namespace bbtk
                _actual->setComplexBox(val);    
        }
 
+       //=========================================================================
+       
+       void wxTabPanelsManager::addActualDiagramComplexInputPort(std::string portName)
+       {
+               _actual->addComplexInputPort(portName);
+       }
+
+       //=========================================================================
+
+       void wxTabPanelsManager::addActualDiagramComplexOutputPort(std::string portName)
+       {
+               _actual->addComplexOutputPort(portName);
+       }
+
        //=========================================================================
 
        void wxTabPanelsManager::OnTabChanged(wxAuiNotebookEvent& event)
@@ -170,6 +184,7 @@ namespace bbtk
        //=========================================================================
 
 
+
 }  // EO namespace bbtk
 
 // EOF
index 5ac62f4d60a1d75a65a5f19adbf9b032707a723a..f3dbfadf47dad424f23af3c187b01d0b1e26d14b 100644 (file)
@@ -83,6 +83,8 @@ namespace bbtk
                void loadDiagram(ifstream &inputStream);
                bool isActualDiagramComplexBox();
                void setActualDiagramComplexBox(bool val);
+               void addActualDiagramComplexInputPort(std::string portName);
+               void addActualDiagramComplexOutputPort(std::string portName);
                
                void OnTabChanged(wxAuiNotebookEvent& event);