* knowledge of the CeCILL-B license and that you accept its terms.
* ------------------------------------------------------------------------ */
-/**
-* \file
-* \brief Class bbtk::GBlackBox
-*/
+/****
+* Design and Developpement of BBTK GEditor
+* Ricardo A Corredor J <ra.corredor67@uniandes.edu.co>
+* RaC - 2010
+****/
+
#include "GBlackBoxModel.h"
namespace bbtk
}
//=========================================================================
-
-
-} // EO namespace bbtk
+} // EO namespace bbtk
// EOF
/* ---------------------------------------------------------------------
* Copyright (c) CREATIS-LRMN (Centre de Recherche en Imagerie Medicale)
-* Authors : Eduardo Davila, Laurent Guigues, Jean-Pierre Roux
+* Authors : Ricardo A Corredor, 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,
* 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
-*/
+/****
+* Design and Developpement of BBTK GEditor
+* Ricardo A Corredor J <ra.corredor67@uniandes.edu.co>
+* RaC - 2010
+****/
#ifndef __GBlackBoxModel_h__
#define __GBlackBoxModel_h__
GBlackBoxModel();
~GBlackBoxModel();
- //Public methods
+ //Public methods
+
+ // The black box has an specific package (important to search in the list with the BBTK Interpreter)
std::string getBBTKPackage();
void setBBTKPackage(std::string obpackage);
+ // Text in the status bar
virtual std::string getStatusText();
+
+ // Method to write the information of the black box to be saved in the parameter string
virtual void save(std::string &content);
+ // Is the black box executable or not
bool isExecutable();
void setExecutable(bool executable);
+ // Set 'value' to the port in position 'pos'
void setValueToInputPort(int pos,std::string value);
+
+ // Set 'value' to the port with name 'name'
void setValueToInput(std::string name,std::string value);
+ // Get the value of the port in position 'pos'
std::string getValueInputPort(int pos);
+
+ // Get the value of the port with name 'name'
std::string getValueInput(std::string name);
+ // Get id's of the connected inputs
std::vector<int> getConnectedInputs();
+ // Get id's of the connected outputs
std::vector<int> getConnectedOutputs();
private:
* 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
-*/
+/****
+* Design and Developpement of BBTK GEditor
+* Ricardo A Corredor J <ra.corredor67@uniandes.edu.co>
+* RaC - 2010
+****/
#ifndef __GBoxModel_h__
#define __GBoxModel_h__
namespace bbtk
{
+ // Mandatory when exists a bidirectional relation: GPortModel includes GBoxModel and viceversa
class GPortModel;
class GBoxModel : public GObjectModel
//Public methods
virtual void setInicPoint(double& x, double& y, double& z);
+
void addInputPort(GPortModel *inputport);
void addOutputPort(GPortModel *outputport);
+
int getNumInputPorts();
int getNumOutputPorts();
+
+ // Change the position of the box and its ports
virtual void move(double xx,double yy,double zz);
+ // Text in the status bar
virtual std::string getStatusText();
+
+ // Method to write the information of the black box to be saved in the parameter string
virtual void save(std::string &content);
+ // Returns a vector with inputs or outputs
std::vector<GPortModel*> getInputPorts();
std::vector<GPortModel*> getOutputPorts();
+ // Get input with the name given by parameter
GPortModel* getInputPort(std::string name);
- GPortModel* getOutputPort(std::string name);
-
GPortModel* getInputPort(int pos);
- GPortModel* getOutputPort(int pos);
+ // Get output with the name given by parameter
+ GPortModel* getOutputPort(std::string name);
+ GPortModel* getOutputPort(int pos);
+
+ // Updates the position and finally the view of inputs and outputs
void updatePorts();
private:
protected:
//Protected Attributes
+
std::vector<GPortModel*> _inputs;
std::vector<GPortModel*> _outputs;
* knowledge of the CeCILL-B license and that you accept its terms.
* ------------------------------------------------------------------------ */
-/**
-* \file
-* \brief Class bbtk::GBlackBox
-*/
-
+/****
+* Design and Developpement of BBTK GEditor
+* Ricardo A Corredor J <ra.corredor67@uniandes.edu.co>
+* RaC - 2010
+****/
#include "GComplexBoxPortModel.h"
-/**
-* \file
-* \brief Class bbtk::GBlackBox : abstract black-box interface.
-*/
-
-/**
-* \class bbtk::GBlackBox
-* \brief
-*/
+/****
+* Design and Developpement of BBTK GEditor
+* Ricardo A Corredor J <ra.corredor67@uniandes.edu.co>
+* RaC - 2010
+****/
#ifndef __GComplexBoxPortModel_h__
#define __GComplexBoxPortModel_h__
GComplexBoxPortModel();
~GComplexBoxPortModel();
- //Public methods
+ //Public methods
+
virtual void setInicPoint(double& x, double& y, double& z);
+
int getComplexPortType();
void setComplexPortType(int pType);
private:
//Private Attributes
+
+ // According to the constants in GlobalConstants.h, the complex port can be an input or an output
int _complexPortType;
//Private Methods
setFinalPoint(xCenter,yIport,zCenter);
+ // Sets the last point of the contour model in the position of the end input port
manualPoint* point = _model->GetManualPoint(_model->GetSizeLstPoints()-1);
point->SetPoint(xCenter,yIport,zCenter);
}
double xport,yport,zport;
_startPort->getFinalPoint(xport,yport,zport);
+ // Refresh the position of the contourModel first point with the data of the connector model
manualPoint* point = _model->GetManualPoint(0);
point->SetPoint(xCenter,yport,zCenter);
_endPort->getCenter(xCenter,yCenter,zCenter);
_endPort->getInicPoint(xport,yport,zport);
+ // Refresh the position of the contourModel last point with the data of the connector model
point = _model->GetManualPoint(_model->GetSizeLstPoints()-1);
point->SetPoint(xCenter,yport,zCenter);
}
//=========================================================================
- bool GConnectorModel::isPointInside(double x,double y, double z)//virtual
- {
- return false;
- }
-
- //=========================================================================
-
void GConnectorModel::save(std::string &content)
{
content+="CONNECTION\n";
* ------------------------------------------------------------------------ */
-
-/**
-* \file
-* \brief Class bbtk::GConnectorModel : abstract black-box interface.
-*/
-
-/**
-* \class bbtk::GConnectorModel
-* \brief
-*/
+/****
+* Design and Developpement of BBTK GEditor
+* Ricardo A Corredor J <ra.corredor67@uniandes.edu.co>
+* RaC - 2010
+****/
#ifndef __GConnectorModel_h__
#define __GConnectorModel_h__
GConnectorModel();
~GConnectorModel();
- //Public methods
+ //Public methods
+
+ // Sets the start port of the connection that will be used in the manualContourModel
void setStartPort(GPortModel* startPort);
+
+ // Sets the end port in the BBTKGEditor connector model and also in the contour model
void setEndPort(GPortModel* endPort);
+
+ // Assigns the creaMaracasVisu model
void setManualContourModel(manualContourModel* model);
+ manualContourModel* getManualContourModel();
GPortModel* getStartPort();
GPortModel* getEndPort();
- manualContourModel* getManualContourModel();
+
+ // Refresh the position of the contourModel first and last points with the data of the connector model
void updateStartEndPoints();
+
+ // Set the ports as NO connected
void disconnectConnection();
- virtual bool isPointInside(double x,double y, double z);
+
virtual void save(std::string &content);
private:
- //Attributes
+ //Private Attributes
+
GPortModel* _startPort;
GPortModel* _endPort;
+
manualContourModel* _model;
//Private Methods
protected:
+
+ //Protected Attributes
+
//Protected methods
};
* \brief Class bbtk::GObjectModel : abstract black-box interface.
*/
-/**
-* \class bbtk::GObjectModel
-* \brief
-*/
+/****
+* Design and Developpement of BBTK GEditor
+* Ricardo A Corredor J <ra.corredor67@uniandes.edu.co>
+* RaC - 2010
+****/
#ifndef __GObjectModel_h__
#define __GObjectModel_h__
//Public methods
+ // Method to get the values of Inic or Final point passed as references in the parameters
void getInicPoint(double& x, double& y, double& z);
void getFinalPoint(double& x, double& y, double& z);
+
+ // Returns the center of the enclosing rectangle
void getCenter(double& x, double& y, double& z);
+
+ // Method to set the values of Inic or Final point
virtual void setInicPoint(double& x, double& y, double& z);
virtual void setFinalPoint(double& x, double& y, double& z);
+ // Changes the inic(top-left point) point of the rectangle
virtual void move(double xx,double yy,double zz);
+ // Returns true if (x,y,z) is inside the rectangle
virtual bool isPointInside(double x,double y, double z);
+ // Get the type of the graphical objects (See the GlobalConstants.h file)
int getGObjectType();
void setGObjectType(int obtype);
+ // The type in BBTK, for boxes for example in a BBS line like (new LoadHola abcd), LoadHola is the type
std::string getBBTKType();
void setBBTKType(std::string obtype);
-
+
+ // The name in BBTK, for boxes for example in a BBS line like (new LoadHola abcd), abcd is the name
std::string getBBTKName();
void setBBTKName(std::string obname);
+ // Object ID
int getObjectId();
void setObjectId(int id);
+ // Status bar message
virtual std::string getStatusText();
+
virtual void save(std::string &content);
private:
double _yFin;
double _zFin;
- int _gObjectType;
int _objectId;
+ // The type of the graphical objects (See the GlobalConstants.h file)
+ int _gObjectType;
+
+ // The type in BBTK, for boxes for example in a BBS line like (new LoadHola abcd), LoadHola is the type
std::string _bbtkType;
+
+ // The name in BBTK, for boxes for example in a BBS line like (new LoadHola abcd), abcd is the name
std::string _bbtkName;
//Protected methods
* \brief Class bbtk::GPortModel
*/
-
+/****
+* Design and Developpement of BBTK GEditor
+* Ricardo A Corredor J <ra.corredor67@uniandes.edu.co>
+* RaC - 2010
+****/
#include "GPortModel.h"
namespace bbtk
* \brief Class bbtk::GPortModel : abstract black-box interface.
*/
-/**
-* \class bbtk::GPortModel
-* \brief
-*/
+/****
+* Design and Developpement of BBTK GEditor
+* Ricardo A Corredor J <ra.corredor67@uniandes.edu.co>
+* RaC - 2010
+****/
#ifndef __GPortModel_h__
#define __GPortModel_h__
namespace bbtk
{
+ // Mandatory when exists a bidirectional relation: GPortModel includes GBoxModel and viceversa
class GBoxModel;
class GPortModel : public GObjectModel
GPortModel();
virtual ~GPortModel();
- //Public methods
+ //Public methods
+
+ // Register the input or output in a position of the black box, depending in the portType(INPUT/OUTPUT).
void registerInBox(GBoxModel *blackBox,int portType, int pos);
+
+ // Update the port position based in the parent box initial point
void updatePortPosition();
+
+ // Port type (INPUT/OUTPUT)
int getPortType();
+
GBoxModel* getParentBox();
- virtual std::string getStatusText();
+
+ // Returns the position of the port in the box
+ int getPosInBox();
+
bool isConnected();
void setConnected(bool value);
+
bool isValueSet();
void setValue(std::string value);
+
std::string getValue();
+
+ virtual std::string getStatusText();
virtual void save(std::string &content);
- int getPosInBox();
+
private:
- //Attributes
+ //Private Attributes
GBoxModel *_parentBox;
-
+
+ // Port type (INPUT/OUTPUT)
int _portType;
+
+ // The position of the port in the box
int _posInBox;
+
bool _isConnected;
+
std::string _value;
bool _isValueSet;
* ------------------------------------------------------------------------ */
-
-/**
-* \file
-* \brief bbtk::GlobalConstants
-*/
-
-
+/****
+* Design and Developpement of BBTK GEditor
+* Ricardo A Corredor J <ra.corredor67@uniandes.edu.co>
+* RaC - 2010
+****/
#ifndef __GlobalConstants_h__
#define __GlobalConstants_h__
const double BOXTEXT_SELECTED_G = 0.35;
const double BOXTEXT_SELECTED_B = 0.05;
- // Id's
+ // GUI Id's
const int ID_NEW = 1000;
const int ID_SAVE_AS_DIAGRAM = 1001;
const int ID_OPEN = 1002;
* \brief
*/
+/****
+* Design and Developpement of BBTK GEditor
+* Ricardo A Corredor J <ra.corredor67@uniandes.edu.co>
+* RaC - 2010
+****/
+
#ifndef __Observable_h__
#define __Observable_h__
//Public methods
void addObserver(Observer *observer);
+ // It is possible to notify the observers with an specific command (See GlobalConstants.h), for example,
+ // to initialize the contour creation INIT_CREATION_CONTOUR
void notifyObservers(int idCaller,int command=NO_COMMAND);
private:
* \brief
*/
+/****
+* Design and Developpement of BBTK GEditor
+* Ricardo A Corredor J <ra.corredor67@uniandes.edu.co>
+* RaC - 2010
+****/
+
#ifndef __Observer_h__
#define __Observer_h__
~Observer();
//Public methods
+
+ // It is possible to notify the observers with an specific command (See GlobalConstants.h), for example,
+ // to initialize the contour creation INIT_CREATION_CONTOUR
virtual void update(int idController,int command);
wxVtk3DBaseView *baseview = new wxVtk3DBaseView(this);
baseview->Configure();
_sceneManager=new wxVtkSceneManager(this,baseview,_id);
+
+ printf("RaC-EED 21-06-2010 wxGEditorTabPanel::initWxVtkCanvas Remove the panelAUIMgr, and change to a normal sizer inside the wxGEditorTabPanel\n");
_panelAUIMgr->AddPane((wxWindow*)baseview->GetWxVTKRenderWindowInteractor(),wxAuiPaneInfo().Fixed().CenterPane());
//EED02JUIN2010
if( _baseView!=NULL )
{
//EED02JUIN2010
+ printf ("RaC-EED 21-06-2010 %p wxVtkSceneManager::wxVtkSceneManager If you comment this line, the drag and drop functionnality is not initialized.\n" , this );
_baseView->GetWxVTKRenderWindowInteractor()->SetDropTarget((wxDropTarget*)parent);
configureBaseView();
_worldState=NOTHING_HAPPENS;
void centerView();
//-------
- //Get a collection of object ids
- std::vector<int> getBlackBoxes();
- std::vector<int> getConnections();
- std::vector<int> getComplexInputPorts();
- std::vector<int> getComplexOutputPorts();
-
- //Get the map of selected objects (id, controller)
- std::map<int,GObjectController*> getSelectedObjects();
-
- //Get size of selected objects map
- int getNumSelectedObjects();
-
- //Complex box edition mode
- bool isComplexBox();
- void setComplexBox(bool val);
-
-
+
private: