--- /dev/null
+/* XPM */
+static const char * complexinputport_xpm[] = {
+"17 15 3 1",
+" c None",
+". c #101010",
+"+ c #CC1919",
+" ............... ",
+" . . ",
+" . . ",
+" . . ",
+" . +++++++ . ",
+" . +++++++ . ",
+" . +++++++ . ",
+" . +++++++ . ",
+" . +++++++ . ",
+" . +++++++ . ",
+" . +++++++ . ",
+" . . ",
+" . . ",
+" . . ",
+" ............... ",
+};
--- /dev/null
+/* XPM */
+static const char * complexoutputport_xpm[] = {
+"17 15 3 1",
+" c None",
+". c #101010",
+"+ c #80D919",
+" ............... ",
+" . . ",
+" . . ",
+" . . ",
+" . +++++++ . ",
+" . +++++++ . ",
+" . +++++++ . ",
+" . +++++++ . ",
+" . +++++++ . ",
+" . +++++++ . ",
+" . +++++++ . ",
+" . . ",
+" . . ",
+" . . ",
+" ............... ",
+};
{
}
- //=========================================================================
-
- 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()
//=========================================================================
- 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);
//=========================================================================
- 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
//Includes same project
#include "GlobalConstants.h"
-#include "GObjectModel.h"
-#include "GPortModel.h"
+#include "GBoxModel.h"
//Includes creaMaracasVisu
namespace bbtk
{
- class GPortModel;
-
- class GBlackBoxModel : public GObjectModel
- {
+ class GBlackBoxModel : public GBoxModel
+ {
public:
~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);
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
--- /dev/null
+/*=========================================================================
+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
+
--- /dev/null
+/*=========================================================================
+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
+
--- /dev/null
+/*=========================================================================
+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
+
--- /dev/null
+/*=========================================================================
+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
+
//=========================================================================
- void GObjectModel::updateBlackBox(BlackBoxDescriptor::Pointer descriptor)//virtual
- {
- }
-
- //=========================================================================
-
void GObjectModel::move(double xx,double yy,double zz)//virtual
{
setInicPoint(xx,yy,zz);
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);
}
//=========================================================================
- void GPortModel::registerInBox(GBlackBoxModel *blackBox,int portType, int pos)
+ void GPortModel::registerInBox(GBoxModel *blackBox,int portType, int pos)
{
_parentBox = blackBox;
_portType = portType;
//=========================================================================
- GBlackBoxModel* GPortModel::getParentBox()
+ GBoxModel* GPortModel::getParentBox()
{
return _parentBox;
}
//Includes same project
#include "GlobalConstants.h"
#include "GObjectModel.h"
-#include "GBlackBoxModel.h"
+#include "GBoxModel.h"
//Includes creaMaracasVisu
namespace bbtk
{
- class GBlackBoxModel;
+ class GBoxModel;
class GPortModel : public GObjectModel
{
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);
//Attributes
- GBlackBoxModel *_parentBox;
+ GBoxModel *_parentBox;
int _portType;
int _posInBox;
{
// 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
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];
//=========================================================================
- 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());
//=========================================================================
- 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());
//=========================================================================
- 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;
//Includes same project
#include "GObjectsMVCFactory.h"
#include "Observer.h"
+#include "GBoxModel.h"
+#include "GComplexBoxPortModel.h"
#include "GPortModel.h"
#include "vtkGConnectorView.h"
#include "GConnectorModel.h"
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);
//Includes same project
#include "GlobalConstants.h"
-#include "GObjectController.h"
+#include "GBoxController.h"
#include "GBlackBoxModel.h"
//Includes creaMaracasVisu
namespace bbtk
{
- class GBlackBoxController : public GObjectController
+ class GBlackBoxController : public GBoxController
{
public:
--- /dev/null
+/*=========================================================================
+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
+
--- /dev/null
+/*=========================================================================
+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
+
{
view = new vtkGPortView();
}
+ else if(type == GCOMPLEXINPUTPORT || type == GCOMPLEXOUTPUTPORT)
+ {
+ view = new vtkGComplexBoxPortView();
+ }
return view;
}
{
controller = new GPortController();
}
+ else if(type == GCOMPLEXINPUTPORT || type == GCOMPLEXOUTPUTPORT)
+ {
+ controller = new GBoxController();
+ }
return controller;
}
{
model = new GPortModel();
}
+ else if(type == GCOMPLEXINPUTPORT || type == GCOMPLEXOUTPUTPORT)
+ {
+ model = new GComplexBoxPortModel();
+ }
model->setGObjectType(type);
#include "vtkGPortView.h"
#include "GPortModel.h"
+#include "GBoxController.h"
+#include "vtkGComplexBoxPortView.h"
+#include "GComplexBoxPortModel.h"
+
+
//Includes creaMaracasVisu
//=========================================================================
- void vtkGBlackBoxView::updatePorts()
- {
- GBlackBoxModel* bmod =(GBlackBoxModel*)_model;
- bmod->updatePorts();
- }
-
- //=========================================================================
} // EO namespace bbtk
//Includes same project
#include "GlobalConstants.h"
-#include "vtkGObjectView.h"
+#include "vtkGBoxView.h"
#include "GBlackBoxModel.h"
//Includes creaMaracasVisu
namespace bbtk
{
- class vtkGBlackBoxView : public vtkGObjectView
+ class vtkGBlackBoxView : public vtkGBoxView
{
public:
virtual void createVtkObjects();
virtual void update(int idController,int command);
virtual void updateColors();
- void updatePorts();
};
--- /dev/null
+/*=========================================================================
+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
+
--- /dev/null
+/*=========================================================================
+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
+
--- /dev/null
+/*=========================================================================
+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
+
--- /dev/null
+/*=========================================================================
+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
+
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);
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);
//=========================================================================
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);
+ }
+ }
}
//=========================================================================
#include "wxart_delete.xpm"
#include "wxart_centerview.xpm"
#include "wxart_complexbox.xpm"
+#include "wxart_complexinputport.xpm"
+#include "wxart_complexoutputport.xpm"
//Includes creaMaracasVisu
//=========================================================================
+ void wxGEditorTabPanel::addComplexInputPort(std::string portName)
+ {
+ _sceneManager->createGComplexBoxInputPort(portName);
+ }
+
+ //=========================================================================
+
+ void wxGEditorTabPanel::addComplexOutputPort(std::string portName)
+ {
+ _sceneManager->createGComplexBoxOutputPort(portName);
+ }
+
+ //=========================================================================
+
} // EO namespace bbtk
// EOF
int getPanelId();
bool isComplexBox();
void setComplexBox(bool val);
+ void addComplexInputPort(std::string portName);
+ void addComplexOutputPort(std::string portName);
//=========================================================================
_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)
//=========================================================================
+
} // EO namespace bbtk
// EOF
void loadDiagram(ifstream &inputStream);
bool isActualDiagramComplexBox();
void setActualDiagramComplexBox(bool val);
+ void addActualDiagramComplexInputPort(std::string portName);
+ void addActualDiagramComplexOutputPort(std::string portName);
void OnTabChanged(wxAuiNotebookEvent& event);