X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;ds=inline;f=lib%2FEditorGraphicBBS%2FbbsKernelEditorGraphic%2FGBlackBoxModel.cxx;h=a806ea8d347e44aea9fa3c9a7ce371f6ffc53eaa;hb=ac275a79f43b892b4b5182f91b980ada0c8f4926;hp=7c7bebbcd3da6bde6dc992a7cbbe8b621f80b987;hpb=eb765b17b9d4f6952a565569f89e3bc9204f9c6e;p=bbtkGEditor.git diff --git a/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GBlackBoxModel.cxx b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GBlackBoxModel.cxx index 7c7bebb..a806ea8 100644 --- a/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GBlackBoxModel.cxx +++ b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GBlackBoxModel.cxx @@ -28,12 +28,14 @@ Version: $Revision$ * 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 +* RaC - 2010 +****/ + #include "GBlackBoxModel.h" namespace bbtk @@ -51,65 +53,6 @@ namespace bbtk { } - //========================================================================= - - void GBlackBoxModel::setInicPoint(double& x, double& y, double& z) - { - GObjectModel::setInicPoint(x,y,z); - - double xFin=x+BOX_WIDTH,yFin=y-BOX_HEIGHT; - setFinalPoint(xFin,yFin,z); - } - - //========================================================================= - - void GBlackBoxModel::addInputPort(GPortModel *inputport) - { - _inputs.push_back(inputport); - } - - //========================================================================= - - void GBlackBoxModel::addOutputPort(GPortModel *outputport) - { - _outputs.push_back(outputport); - } - - //========================================================================= - - int GBlackBoxModel::getNumInputPorts() - { - return _inputs.size(); - } - - //========================================================================= - - int GBlackBoxModel::getNumOutputPorts() - { - return _outputs.size(); - } - - //========================================================================= - - void GBlackBoxModel::move(double xx,double yy,double zz) - { - setInicPoint(xx,yy,zz); - - //Refresh inputs position - int i; - for(i=0;i<_inputs.size();i++) - { - _inputs[i]->updatePortPosition(); - } - - //Refresh outputs position - for(i=0;i<_outputs.size();i++) - { - _outputs[i]->updatePortPosition(); - } - - } - //========================================================================= std::string GBlackBoxModel::getBBTKPackage() @@ -154,20 +97,6 @@ namespace bbtk //========================================================================= - std::vector GBlackBoxModel::getInputPorts() - { - return _inputs; - } - - //========================================================================= - - std::vector GBlackBoxModel::getOutputPorts() - { - return _outputs; - } - - //========================================================================= - void GBlackBoxModel::setValueToInputPort(int pos,std::string value) { _inputs[pos]->setValue(value); @@ -185,6 +114,17 @@ namespace bbtk content+=":"; content+=_bbtkName; content+="\n"; + content+="ISEXEC:"; + if(_isExecutable) + { + content+="TRUE"; + } + else + { + content+="FALSE"; + } + content+="\n"; + //Box Position char buffer [50]; @@ -209,20 +149,83 @@ namespace bbtk content+="\n"; //Ports with a value - for(int i = 0; i<_inputs.size();i++) + for(int i = 0; i<(int)_inputs.size();i++) { if(_inputs[i]->isValueSet()) { _inputs[i]->save(content); } } + content+="FIN_BOX\n"; } //========================================================================= + void GBlackBoxModel::setValueToInput(std::string name,std::string value) + { + for(int i = 0; i<(int)_inputs.size();i++) + { + if(_inputs[i]->getBBTKName()==name) + { + _inputs[i]->setValue(value); + } + } + } + + //========================================================================= + + std::string GBlackBoxModel::getValueInputPort(int pos) + { + return _inputs[pos]->getValue(); + } + + //========================================================================= -} // EO namespace bbtk + std::string GBlackBoxModel::getValueInput(std::string name) + { + for(int i = 0; i<(int)_inputs.size();i++) + { + if(_inputs[i]->getBBTKName()==name) + { + return _inputs[i]->getValue(); + } + } + return NULL; + } + + //========================================================================= + + std::vector GBlackBoxModel::getConnectedInputs() + { + std::vector connected; + for(int i = 0; i<(int)_inputs.size();i++) + { + if(_inputs[i]->isConnected()) + { + connected.push_back(i); + } + } + return connected; + } + + //========================================================================= + + std::vector GBlackBoxModel::getConnectedOutputs() + { + std::vector connected; + for(int i = 0; i<(int)_outputs.size();i++) + { + if(_outputs[i]->isConnected()) + { + connected.push_back(i); + } + } + return connected; + } + + //========================================================================= +} // EO namespace bbtk // EOF