bbtk::GBlackBoxModel Class Reference

#include <GBlackBoxModel.h>

Inheritance diagram for bbtk::GBlackBoxModel:

Inheritance graph
[legend]
Collaboration diagram for bbtk::GBlackBoxModel:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 GBlackBoxModel ()
 ~GBlackBoxModel ()
std::string getBBTKPackage ()
void setBBTKPackage (std::string obpackage)
virtual std::string getStatusText ()
virtual void save (std::string &content)
bool isExecutable ()
void setExecutable (bool executable)
void setValueToInputPort (int pos, std::string value)
void setValueToInput (std::string name, std::string value)
std::string getValueInputPort (int pos)
std::string getValueInput (std::string name)
std::vector< int > getConnectedInputs ()
std::vector< int > getConnectedOutputs ()
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)
std::vector< GPortModel * > getInputPorts ()
std::vector< GPortModel * > getOutputPorts ()
GPortModelgetInputPort (std::string name)
GPortModelgetInputPort (int pos)
GPortModelgetOutputPort (std::string name)
GPortModelgetOutputPort (int pos)
void updatePorts ()
void addColons (std::string &text)
void removeColons (std::string &text)
void getInicPoint (double &x, double &y, double &z)
void getFinalPoint (double &x, double &y, double &z)
void getCenter (double &x, double &y, double &z)
virtual void setFinalPoint (double &x, double &y, double &z)
virtual bool isPointInside (double x, double y, double z)
int getGObjectType ()
void setGObjectType (int obtype)
std::string getBBTKType ()
void setBBTKType (std::string obtype)
std::string getBBTKName ()
void setBBTKName (std::string obname)
int getObjectId ()
void setObjectId (int id)
void addObserver (Observer *observer)
void notifyObservers (int idCaller, int command=NO_COMMAND)

Protected Attributes

std::string _bbtkPackage
std::vector< GPortModel * > _inputs
std::vector< GPortModel * > _outputs
double _xInic
double _yInic
double _zInic
double _xFin
double _yFin
double _zFin
int _objectId
int _gObjectType
std::string _bbtkType
std::string _bbtkName

Private Attributes

bool _isExecutable


Detailed Description

Definition at line 53 of file GBlackBoxModel.h.


Constructor & Destructor Documentation

bbtk::GBlackBoxModel::GBlackBoxModel (  ) 

Definition at line 45 of file GBlackBoxModel.cxx.

References _isExecutable.

00046         {               
00047                 _isExecutable = false;
00048         }

bbtk::GBlackBoxModel::~GBlackBoxModel (  ) 

Definition at line 52 of file GBlackBoxModel.cxx.

00053         {
00054         }


Member Function Documentation

void bbtk::GBoxModel::addColons ( std::string &  text  )  [inherited]

Definition at line 202 of file GBoxModel.cxx.

00203         {
00204                 std::string character("&&2P&&");                                
00205                 size_t pos;
00206                 pos = text.find(character);
00207                 while(pos != std::string::npos)
00208                 {
00209                 //We replace the character "&&2P&&" with ":" for all the string
00210                         text.replace(pos, character.length(),":");
00211                         pos = text.find(character, pos);
00212                 }
00213         }

void bbtk::GBoxModel::addInputPort ( GPortModel inputport  )  [inherited]

Definition at line 65 of file GBoxModel.cxx.

References bbtk::GBoxModel::_inputs.

Referenced by bbtk::wxVtkSceneManager::createGComplexBoxOutputPort(), and bbtk::wxVtkSceneManager::createGInputPort().

00066         {
00067                 _inputs.push_back(inputport);
00068         }

Here is the caller graph for this function:

void bbtk::Observable::addObserver ( Observer observer  )  [inherited]

void bbtk::GBoxModel::addOutputPort ( GPortModel outputport  )  [inherited]

Definition at line 72 of file GBoxModel.cxx.

References bbtk::GBoxModel::_outputs.

Referenced by bbtk::wxVtkSceneManager::createGComplexBoxInputPort(), and bbtk::wxVtkSceneManager::createGOutputPort().

00073         {
00074                 _outputs.push_back(outputport);
00075         }

Here is the caller graph for this function:

std::string bbtk::GObjectModel::getBBTKName (  )  [inherited]

std::string bbtk::GBlackBoxModel::getBBTKPackage (  ) 

std::string bbtk::GObjectModel::getBBTKType (  )  [inherited]

void bbtk::GObjectModel::getCenter ( double &  x,
double &  y,
double &  z 
) [inherited]

std::vector< int > bbtk::GBlackBoxModel::getConnectedInputs (  ) 

Definition at line 199 of file GBlackBoxModel.cxx.

References bbtk::GBoxModel::_inputs.

Referenced by bbtk::wxVtkSceneManager::addObjects().

00200         {
00201                 std::vector<int> connected;
00202                 for(int i = 0; i<(int)_inputs.size();i++)
00203                 {
00204                         if(_inputs[i]->isConnected())
00205                         {
00206                                 connected.push_back(i);
00207                         }
00208                 }
00209                 return connected;
00210         }

Here is the caller graph for this function:

std::vector< int > bbtk::GBlackBoxModel::getConnectedOutputs (  ) 

Definition at line 214 of file GBlackBoxModel.cxx.

References bbtk::GBoxModel::_outputs.

Referenced by bbtk::wxVtkSceneManager::addObjects().

00215         {
00216                 std::vector<int> connected;
00217                 for(int i = 0; i<(int)_outputs.size();i++)
00218                 {
00219                         if(_outputs[i]->isConnected())
00220                         {
00221                                 connected.push_back(i);
00222                         }
00223                 }
00224                 return connected;
00225         }

Here is the caller graph for this function:

void bbtk::GObjectModel::getFinalPoint ( double &  x,
double &  y,
double &  z 
) [inherited]

int bbtk::GObjectModel::getGObjectType (  )  [inherited]

Definition at line 109 of file GObjectModel.cxx.

References bbtk::GObjectModel::_gObjectType.

Referenced by bbtk::GObjectController::getGObjectType(), bbtk::wxVtkSceneManager::saveComplexBoxBBS(), and bbtk::wxVtkSceneManager::update().

00110         {
00111                 return _gObjectType;
00112         }

Here is the caller graph for this function:

void bbtk::GObjectModel::getInicPoint ( double &  x,
double &  y,
double &  z 
) [inherited]

GPortModel * bbtk::GBoxModel::getInputPort ( int  pos  )  [inherited]

Definition at line 173 of file GBoxModel.cxx.

References bbtk::GBoxModel::_inputs.

00174         {
00175                 return _inputs[pos];
00176         }

GPortModel * bbtk::GBoxModel::getInputPort ( std::string  name  )  [inherited]

Definition at line 145 of file GBoxModel.cxx.

References bbtk::GBoxModel::_inputs, and bbtk::GObjectModel::getBBTKName().

Referenced by bbtk::wxVtkSceneManager::addObjects(), bbtk::wxVtkSceneManager::configGConnetion(), bbtk::wxVtkSceneManager::DuplicateObjects(), and bbtk::vtkGBlackBoxView::update_X_Fin().

00146         {
00147                 for(int i = 0; i<(int)_inputs.size();i++)
00148                 {
00149                         if(_inputs[i]->getBBTKName()==name)
00150                         {
00151                                 return _inputs[i];
00152                         }
00153                 }
00154                 return NULL;
00155         }

Here is the call graph for this function:

Here is the caller graph for this function:

std::vector< GPortModel * > bbtk::GBoxModel::getInputPorts (  )  [inherited]

int bbtk::GBoxModel::getNumInputPorts (  )  [inherited]

Definition at line 79 of file GBoxModel.cxx.

References bbtk::GBoxModel::_inputs.

Referenced by bbtk::wxVtkSceneManager::addObjects(), bbtk::wxVtkSceneManager::DuplicateObjects(), and bbtk::vtkGBlackBoxView::update_X_Fin().

00080         {
00081                 return _inputs.size();
00082         }

Here is the caller graph for this function:

int bbtk::GBoxModel::getNumOutputPorts (  )  [inherited]

Definition at line 86 of file GBoxModel.cxx.

References bbtk::GBoxModel::_outputs.

Referenced by bbtk::vtkGBlackBoxView::update_X_Fin().

00087         {
00088                 return _outputs.size();
00089         }

Here is the caller graph for this function:

int bbtk::GObjectModel::getObjectId (  )  [inherited]

GPortModel * bbtk::GBoxModel::getOutputPort ( int  pos  )  [inherited]

Definition at line 180 of file GBoxModel.cxx.

References bbtk::GBoxModel::_outputs.

00181         {
00182                 return _outputs[pos];
00183         }

GPortModel * bbtk::GBoxModel::getOutputPort ( std::string  name  )  [inherited]

Definition at line 159 of file GBoxModel.cxx.

References bbtk::GBoxModel::_outputs, and bbtk::GObjectModel::getBBTKName().

Referenced by bbtk::wxVtkSceneManager::addObjects(), bbtk::wxVtkSceneManager::configGConnetion(), bbtk::wxVtkSceneManager::DuplicateObjects(), and bbtk::vtkGBlackBoxView::update_X_Fin().

00160         {
00161                 for(int i = 0; i<(int)_outputs.size();i++)
00162                 {
00163                         if(_outputs[i]->getBBTKName()==name)
00164                         {
00165                                 return _outputs[i];
00166                         }
00167                 }
00168                 return NULL;
00169         }

Here is the call graph for this function:

Here is the caller graph for this function:

std::vector< GPortModel * > bbtk::GBoxModel::getOutputPorts (  )  [inherited]

Definition at line 130 of file GBoxModel.cxx.

References bbtk::GBoxModel::_outputs.

Referenced by bbtk::wxVtkSceneManager::deleteObject().

00131         {
00132                 return _outputs;
00133         }

Here is the caller graph for this function:

std::string bbtk::GBlackBoxModel::getStatusText (  )  [virtual]

Reimplemented from bbtk::GBoxModel.

Definition at line 86 of file GBlackBoxModel.cxx.

References bbtk::GObjectModel::_bbtkName, _bbtkPackage, and bbtk::GObjectModel::_bbtkType.

00087         {
00088                 std::string temp = "";
00089                 temp+=_bbtkPackage;
00090                 temp+=":";
00091                 temp+=_bbtkType;
00092                 temp+=":";
00093                 temp+=_bbtkName;
00094                 
00095                 return temp;
00096         }

std::string bbtk::GBlackBoxModel::getValueInput ( std::string  name  ) 

Definition at line 185 of file GBlackBoxModel.cxx.

References bbtk::GBoxModel::_inputs, and bbtk::GObjectModel::getBBTKName().

00186         {
00187                 for(int i = 0; i<(int)_inputs.size();i++)
00188                 {
00189                         if(_inputs[i]->getBBTKName()==name)
00190                         {
00191                                 return _inputs[i]->getValue();
00192                         }
00193                 }
00194                 return NULL;
00195         }

Here is the call graph for this function:

std::string bbtk::GBlackBoxModel::getValueInputPort ( int  pos  ) 

Definition at line 178 of file GBlackBoxModel.cxx.

References bbtk::GBoxModel::_inputs.

Referenced by bbtk::wxVtkSceneManager::addObjects(), and bbtk::wxVtkSceneManager::DuplicateObjects().

00179         {
00180                 return _inputs[pos]->getValue();
00181         }

Here is the caller graph for this function:

bool bbtk::GBlackBoxModel::isExecutable (  ) 

bool bbtk::GObjectModel::isPointInside ( double  x,
double  y,
double  z 
) [virtual, inherited]

Definition at line 116 of file GObjectModel.cxx.

References bbtk::GObjectModel::_xFin, bbtk::GObjectModel::_xInic, and bbtk::GObjectModel::_yFin.

Referenced by bbtk::vtkGObjectView::isPointInside().

00117         {
00118                 if(x>=_xInic && x<=_xFin && y<=_yInic && y>=_yFin)
00119                 {
00120                         return true;
00121                 }
00122                 else
00123                 {
00124                         return false;
00125                 }
00126         }

Here is the caller graph for this function:

void bbtk::GBoxModel::move ( double  xx,
double  yy,
double  zz 
) [virtual, inherited]

Reimplemented from bbtk::GObjectModel.

Definition at line 93 of file GBoxModel.cxx.

References bbtk::GBoxModel::_inputs, bbtk::GBoxModel::_outputs, and bbtk::GBoxModel::setInicPoint().

Referenced by bbtk::wxVtkSceneManager::DuplicateObjects().

00094         {
00095                 setInicPoint(xx,yy,zz);
00096 
00097                 //Refresh inputs position
00098                 int i;
00099                 for(i=0;i<(int)_inputs.size();i++)
00100                 {
00101                         _inputs[i]->updatePortPosition();
00102                 }
00103                 
00104                 //Refresh outputs position
00105                 for(i=0;i<(int)_outputs.size();i++)
00106                 {
00107                         _outputs[i]->updatePortPosition();
00108                 }
00109 
00110         }

Here is the call graph for this function:

Here is the caller graph for this function:

void bbtk::Observable::notifyObservers ( int  idCaller,
int  command = NO_COMMAND 
) [inherited]

void bbtk::GBoxModel::removeColons ( std::string &  text  )  [inherited]

Definition at line 215 of file GBoxModel.cxx.

00216         {
00217                 std::string character(":");                             
00218                 size_t pos;
00219                 pos = text.find(character);
00220                 while(pos != std::string::npos)
00221                 {
00222                         //We replace the character ":" with "&&2P&&" for all the string
00223                         text.replace(pos, character.length(),"&&2P&&");
00224                         pos = text.find(character, pos);
00225                         }
00226         }

void bbtk::GBlackBoxModel::save ( std::string &  content  )  [virtual]

Reimplemented from bbtk::GBoxModel.

Definition at line 107 of file GBlackBoxModel.cxx.

References bbtk::GObjectModel::_bbtkName, _bbtkPackage, bbtk::GObjectModel::_bbtkType, bbtk::GBoxModel::_inputs, _isExecutable, bbtk::GObjectModel::_xFin, bbtk::GObjectModel::_xInic, bbtk::GObjectModel::_yFin, bbtk::GObjectModel::_yInic, bbtk::GObjectModel::_zFin, and bbtk::GObjectModel::_zInic.

00108         {
00109                 content+="BOX\n";
00110                 // Box info
00111                 content+=_bbtkPackage;
00112                 content+=":";
00113                 content+=_bbtkType;
00114                 content+=":";
00115                 content+=_bbtkName;
00116                 content+="\n";
00117                 content+="ISEXEC:";
00118                 if(_isExecutable)
00119                 {
00120                         content+="TRUE";
00121                 }
00122                 else
00123                 {
00124                         content+="FALSE";
00125                 }
00126                 content+="\n";
00127 
00128 
00129                 //Box Position
00130                 char buffer [50];
00131                 sprintf (buffer, "%f", _xInic);
00132                 content+=buffer;
00133                 content+=":";
00134                 sprintf (buffer, "%f", _yInic);
00135                 content+=buffer;
00136                 content+=":";
00137                 sprintf (buffer, "%f", _zInic);
00138                 content+=buffer;
00139                 content+="\n";
00140 
00141                 sprintf (buffer, "%f", _xFin);
00142                 content+=buffer;
00143                 content+=":";
00144                 sprintf (buffer, "%f", _yFin);
00145                 content+=buffer;
00146                 content+=":";
00147                 sprintf (buffer, "%f", _zFin);
00148                 content+=buffer;
00149                 content+="\n";
00150 
00151                 //Ports with a value
00152                 for(int i = 0; i<(int)_inputs.size();i++)
00153                 {
00154                         if(_inputs[i]->isValueSet())
00155                         {
00156                                 _inputs[i]->save(content);
00157                         }
00158                 }
00159                 content+="FIN_BOX\n";
00160 
00161         }

void bbtk::GObjectModel::setBBTKName ( std::string  obname  )  [inherited]

void bbtk::GBlackBoxModel::setBBTKPackage ( std::string  obpackage  ) 

Definition at line 65 of file GBlackBoxModel.cxx.

References _bbtkPackage.

Referenced by bbtk::wxVtkSceneManager::createGBlackBox().

00066         {
00067                 _bbtkPackage = obpackage;
00068         }

Here is the caller graph for this function:

void bbtk::GObjectModel::setBBTKType ( std::string  obtype  )  [inherited]

void bbtk::GBlackBoxModel::setExecutable ( bool  executable  ) 

Definition at line 79 of file GBlackBoxModel.cxx.

References _isExecutable.

Referenced by bbtk::InterpreterBBS::commandExec(), bbtk::wxVtkSceneManager::configGBlackBox(), bbtk::wxVtkSceneManager::MakeBoxExecutable(), and bbtk::GBlackBoxController::OnMiddleButtonDown().

00080         {
00081                 _isExecutable = executable;
00082         }

Here is the caller graph for this function:

void bbtk::GObjectModel::setFinalPoint ( double &  x,
double &  y,
double &  z 
) [virtual, inherited]

void bbtk::GObjectModel::setGObjectType ( int  obtype  )  [inherited]

Definition at line 102 of file GObjectModel.cxx.

References bbtk::GObjectModel::_gObjectType.

Referenced by bbtk::wxVtkSceneManager::createGConnector(), and bbtk::GObjectsMVCFactory::createGObjectModel().

00103         {
00104                 _gObjectType = gObjectType;
00105         }

Here is the caller graph for this function:

void bbtk::GBoxModel::setInicPoint ( double &  x,
double &  y,
double &  z 
) [virtual, inherited]

Reimplemented from bbtk::GObjectModel.

Reimplemented in bbtk::GComplexBoxPortModel.

Definition at line 55 of file GBoxModel.cxx.

References bbtk::BOX_HEIGHT, bbtk::BOX_WIDTH, and bbtk::GObjectModel::setFinalPoint().

Referenced by bbtk::wxVtkSceneManager::addObjects(), bbtk::wxVtkSceneManager::configGBlackBox(), bbtk::wxVtkSceneManager::configGComBoxInputOutputPort(), bbtk::wxVtkSceneManager::createGBlackBox(), bbtk::wxVtkSceneManager::DuplicateObjects(), and bbtk::GBoxModel::move().

00056         {
00057                 GObjectModel::setInicPoint(x,y,z);
00058 
00059                 double xFin=x+BOX_WIDTH,yFin=y-BOX_HEIGHT;
00060                 setFinalPoint(xFin,yFin,z);
00061         }

Here is the call graph for this function:

Here is the caller graph for this function:

void bbtk::GObjectModel::setObjectId ( int  id  )  [inherited]

Definition at line 180 of file GObjectModel.cxx.

References bbtk::GObjectModel::_objectId.

Referenced by bbtk::GObjectController::setId().

00181         {
00182                 _objectId=id;
00183         }

Here is the caller graph for this function:

void bbtk::GBlackBoxModel::setValueToInput ( std::string  name,
std::string  value 
)

Definition at line 165 of file GBlackBoxModel.cxx.

References bbtk::GBoxModel::_inputs, and bbtk::GObjectModel::getBBTKName().

Referenced by bbtk::InterpreterBBS::commandSet().

00166         {
00167                 for(int i = 0; i<(int)_inputs.size();i++)
00168                 {
00169                         if(_inputs[i]->getBBTKName()==name)
00170                         {
00171                                 _inputs[i]->setValue(value);
00172                         }
00173                 }
00174         }

Here is the call graph for this function:

Here is the caller graph for this function:

void bbtk::GBlackBoxModel::setValueToInputPort ( int  pos,
std::string  value 
)

Definition at line 100 of file GBlackBoxModel.cxx.

References bbtk::GBoxModel::_inputs.

Referenced by bbtk::wxVtkSceneManager::addObjects(), bbtk::wxVtkSceneManager::DuplicateObjects(), and bbtk::wxBlackBoxEditionDialog::onClickOk().

00101         {
00102                 _inputs[pos]->setValue(value);
00103         }

Here is the caller graph for this function:

void bbtk::GBoxModel::updatePorts (  )  [inherited]

Definition at line 187 of file GBoxModel.cxx.

References bbtk::GBoxModel::_inputs, bbtk::GObjectModel::_objectId, and bbtk::GBoxModel::_outputs.

Referenced by bbtk::vtkGBoxView::updatePorts().

00188         {
00189                 for(int i = 0; i<(int)_inputs.size();i++)
00190                 {       
00191                         _inputs[i]->updatePortPosition();
00192                         _inputs[i]->notifyObservers(_objectId);
00193                 }
00194 
00195                 for(int i = 0; i<_outputs.size();i++)
00196                 {
00197                         _outputs[i]->updatePortPosition();
00198                         _outputs[i]->notifyObservers(_objectId);
00199                 }
00200         }

Here is the caller graph for this function:


Member Data Documentation

std::string bbtk::GObjectModel::_bbtkName [protected, inherited]

std::string bbtk::GBlackBoxModel::_bbtkPackage [protected]

Definition at line 104 of file GBlackBoxModel.h.

Referenced by getBBTKPackage(), getStatusText(), save(), and setBBTKPackage().

std::string bbtk::GObjectModel::_bbtkType [protected, inherited]

int bbtk::GObjectModel::_gObjectType [protected, inherited]

std::vector<GPortModel*> bbtk::GBoxModel::_inputs [protected, inherited]

Definition at line 98 of file GBlackBoxModel.h.

Referenced by GBlackBoxModel(), isExecutable(), save(), and setExecutable().

int bbtk::GObjectModel::_objectId [protected, inherited]

std::vector<GPortModel*> bbtk::GBoxModel::_outputs [protected, inherited]

double bbtk::GObjectModel::_xFin [protected, inherited]

double bbtk::GObjectModel::_xInic [protected, inherited]

double bbtk::GObjectModel::_yFin [protected, inherited]

double bbtk::GObjectModel::_yInic [protected, inherited]

double bbtk::GObjectModel::_zFin [protected, inherited]

double bbtk::GObjectModel::_zInic [protected, inherited]


The documentation for this class was generated from the following files:

Generated on Thu May 31 15:13:22 2012 for bbtkGEditor by  doxygen 1.5.7.1