From: corredor <> Date: Mon, 17 May 2010 14:44:29 +0000 (+0000) Subject: The buttons and the objects to create input and output complex box ports were added... X-Git-Tag: v1_0_0~69 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=343ecf790a799b8089a6d13fec0192fd9ad71da1;p=bbtkGEditor.git The buttons and the objects to create input and output complex box ports were added... Now, saving and changing mode functions are missing. --- diff --git a/data/icons/wxart_complexinputport.xpm b/data/icons/wxart_complexinputport.xpm new file mode 100644 index 0000000..d8bde58 --- /dev/null +++ b/data/icons/wxart_complexinputport.xpm @@ -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 index 0000000..fbccaef --- /dev/null +++ b/data/icons/wxart_complexoutputport.xpm @@ -0,0 +1,22 @@ +/* XPM */ +static const char * complexoutputport_xpm[] = { +"17 15 3 1", +" c None", +". c #101010", +"+ c #80D919", +" ............... ", +" . . ", +" . . ", +" . . ", +" . +++++++ . ", +" . +++++++ . ", +" . +++++++ . ", +" . +++++++ . ", +" . +++++++ . ", +" . +++++++ . ", +" . +++++++ . ", +" . . ", +" . . ", +" . . ", +" ............... ", +}; diff --git a/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GBlackBoxModel.cxx b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GBlackBoxModel.cxx index 47259aa..5351493 100644 --- a/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GBlackBoxModel.cxx +++ b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GBlackBoxModel.cxx @@ -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 GBlackBoxModel::getInputPorts() - { - return _inputs; - } - - //========================================================================= - - std::vector 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 diff --git a/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GBlackBoxModel.h b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GBlackBoxModel.h index 04ae668..74da5f6 100644 --- a/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GBlackBoxModel.h +++ b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GBlackBoxModel.h @@ -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 getInputPorts(); - std::vector 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 _inputs; - std::vector _outputs; bool _isExecutable; //Private Methods diff --git a/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GBoxModel.cxx b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GBoxModel.cxx new file mode 100644 index 0000000..0801e54 --- /dev/null +++ b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GBoxModel.cxx @@ -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 GBoxModel::getInputPorts() + { + return _inputs; + } + + //========================================================================= + + std::vector 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 index 0000000..b02c7a6 --- /dev/null +++ b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GBoxModel.h @@ -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 + + +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 getInputPorts(); + std::vector getOutputPorts(); + + GPortModel* getInputPort(std::string name); + GPortModel* getOutputPort(std::string name); + + void updatePorts(); + + private: + + //Private Attributes + + //Private Methods + + protected: + //Protected Attributes + std::vector _inputs; + std::vector _outputs; + + //Protected methods + + }; + + +} +// namespace bbtk +#endif + diff --git a/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GComplexBoxPortModel.cxx b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GComplexBoxPortModel.cxx new file mode 100644 index 0000000..2bdd8cb --- /dev/null +++ b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GComplexBoxPortModel.cxx @@ -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 index 0000000..74703ac --- /dev/null +++ b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GComplexBoxPortModel.h @@ -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 + + +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 + diff --git a/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GObjectModel.cxx b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GObjectModel.cxx index 1255128..41148af 100644 --- a/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GObjectModel.cxx +++ b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GObjectModel.cxx @@ -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); diff --git a/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GObjectModel.h b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GObjectModel.h index d13b459..39648f9 100644 --- a/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GObjectModel.h +++ b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GObjectModel.h @@ -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); diff --git a/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GPortModel.cxx b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GPortModel.cxx index 200a5f4..c6ca8b0 100644 --- a/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GPortModel.cxx +++ b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GPortModel.cxx @@ -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; } diff --git a/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GPortModel.h b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GPortModel.h index 6b5d772..6dcef4d 100644 --- a/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GPortModel.h +++ b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GPortModel.h @@ -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; diff --git a/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GlobalConstants.h b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GlobalConstants.h index 7405a96..9db8bf0 100644 --- a/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GlobalConstants.h +++ b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GlobalConstants.h @@ -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 diff --git a/lib/EditorGraphicBBS/bbsKernelEditorGraphic/wxVtkSceneManager.cxx b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/wxVtkSceneManager.cxx index 39f1237..9b2dc95 100644 --- a/lib/EditorGraphicBBS/bbsKernelEditorGraphic/wxVtkSceneManager.cxx +++ b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/wxVtkSceneManager.cxx @@ -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; diff --git a/lib/EditorGraphicBBS/bbsKernelEditorGraphic/wxVtkSceneManager.h b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/wxVtkSceneManager.h index 3479c2a..118d136 100644 --- a/lib/EditorGraphicBBS/bbsKernelEditorGraphic/wxVtkSceneManager.h +++ b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/wxVtkSceneManager.h @@ -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); diff --git a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GBlackBoxController.h b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GBlackBoxController.h index 1fc734e..39f8274 100644 --- a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GBlackBoxController.h +++ b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GBlackBoxController.h @@ -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 index 0000000..adb3bf0 --- /dev/null +++ b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GBoxController.cxx @@ -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 index 0000000..8082668 --- /dev/null +++ b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GBoxController.h @@ -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 + + +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 + diff --git a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GObjectsMVCFactory.cxx b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GObjectsMVCFactory.cxx index c9a1bc9..d495b72 100644 --- a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GObjectsMVCFactory.cxx +++ b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GObjectsMVCFactory.cxx @@ -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); diff --git a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GObjectsMVCFactory.h b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GObjectsMVCFactory.h index 30d838c..606b095 100644 --- a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GObjectsMVCFactory.h +++ b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GObjectsMVCFactory.h @@ -58,6 +58,11 @@ Version: $Revision$ #include "vtkGPortView.h" #include "GPortModel.h" +#include "GBoxController.h" +#include "vtkGComplexBoxPortView.h" +#include "GComplexBoxPortModel.h" + + //Includes creaMaracasVisu diff --git a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGBlackBoxView.cxx b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGBlackBoxView.cxx index 2d9f0c1..a617d70 100644 --- a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGBlackBoxView.cxx +++ b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGBlackBoxView.cxx @@ -231,13 +231,6 @@ namespace bbtk //========================================================================= - void vtkGBlackBoxView::updatePorts() - { - GBlackBoxModel* bmod =(GBlackBoxModel*)_model; - bmod->updatePorts(); - } - - //========================================================================= } // EO namespace bbtk diff --git a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGBlackBoxView.h b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGBlackBoxView.h index 4391d61..90494d9 100644 --- a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGBlackBoxView.h +++ b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGBlackBoxView.h @@ -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 index 0000000..f6121e4 --- /dev/null +++ b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGBoxView.cxx @@ -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 index 0000000..268ec9a --- /dev/null +++ b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGBoxView.h @@ -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 + + +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 index 0000000..3f528c0 --- /dev/null +++ b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGComplexBoxPortView.cxx @@ -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 index 0000000..aa08812 --- /dev/null +++ b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGComplexBoxPortView.h @@ -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 + + +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 + diff --git a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.cxx b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.cxx index 871160a..2d4ea9e 100644 --- a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.cxx +++ b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.cxx @@ -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); + } + } } //========================================================================= diff --git a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.h b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.h index 1e472ad..c6f65b9 100644 --- a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.h +++ b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.h @@ -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 diff --git a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxGEditorTabPanel.cxx b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxGEditorTabPanel.cxx index 3c4081e..4e5312e 100644 --- a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxGEditorTabPanel.cxx +++ b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxGEditorTabPanel.cxx @@ -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 diff --git a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxGEditorTabPanel.h b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxGEditorTabPanel.h index af9897a..4322f6a 100644 --- a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxGEditorTabPanel.h +++ b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxGEditorTabPanel.h @@ -91,6 +91,8 @@ namespace bbtk int getPanelId(); bool isComplexBox(); void setComplexBox(bool val); + void addComplexInputPort(std::string portName); + void addComplexOutputPort(std::string portName); //========================================================================= diff --git a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxTabPanelsManager.cxx b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxTabPanelsManager.cxx index 4b06456..2c5721d 100644 --- a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxTabPanelsManager.cxx +++ b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxTabPanelsManager.cxx @@ -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 diff --git a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxTabPanelsManager.h b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxTabPanelsManager.h index 5ac62f4..f3dbfad 100644 --- a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxTabPanelsManager.h +++ b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxTabPanelsManager.h @@ -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);