]> Creatis software - bbtkGEditor.git/blobdiff - lib/EditorGraphicBBS/bbsKernelEditorGraphic/GBlackBoxModel.cxx
The app saves and opens diagrams !!!! Allll fiiiinnn se logro !!
[bbtkGEditor.git] / lib / EditorGraphicBBS / bbsKernelEditorGraphic / GBlackBoxModel.cxx
index 7c7bebbcd3da6bde6dc992a7cbbe8b621f80b987..f7fe2e1a9e3fa9fbcd2be3ff94febd34fcc1307c 100644 (file)
@@ -216,11 +216,70 @@ namespace bbtk
                                _inputs[i]->save(content);
                        }
                }
+               content+="FIN_BOX\n";
 
        }
        
        //=========================================================================
 
+       void GBlackBoxModel::setValueToInput(std::string name,std::string value)
+       {
+               for(int i = 0; i<_inputs.size();i++)
+               {
+                       if(_inputs[i]->getBBTKName()==name)
+                       {
+                               _inputs[i]->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