]> Creatis software - bbtkGEditor.git/blobdiff - lib/EditorGraphicBBS/bbsKernelEditorGraphic/GBlackBoxModel.cxx
Important change in the project to visualize the contour when the output was selected...
[bbtkGEditor.git] / lib / EditorGraphicBBS / bbsKernelEditorGraphic / GBlackBoxModel.cxx
index aa3675e35b46b8d5ca7e56c936af2c1092fc49ef..876dbb072c94123b165b2acf1ead577aab1a4d36 100644 (file)
@@ -42,17 +42,88 @@ namespace bbtk
 
        //=========================================================================
        GBlackBoxModel::GBlackBoxModel()
+       {               
+       }
+
+       //=========================================================================
+       GBlackBoxModel::~GBlackBoxModel()
+       {
+       }
+       //=========================================================================
+
+       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);
        }
 
        //=========================================================================
-       GBlackBoxModel::~GBlackBoxModel()
+
+       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(i);
+               }
+               
+               //Refresh outputs position
+               for(i=0;i<_outputs.size();i++)
+               {
+                       _outputs[i]->updatePortPosition(i);
+               }
+
+       }
+       
+       //=========================================================================
+
+       GPortModel* GBlackBoxModel::getStartOutputPort()
+       {
+               GPortModel* temp = NULL;
+
+               for(int i=0; i<_inputs.size() && temp == NULL;i++)
+               {
+                       if(_outputs[i]->getState() == CREATING_CONTOUR)
+                       {
+                               temp = _outputs[i];
+                       }
+               }
+
+               return temp;
+       }
 
 }  // EO namespace bbtk