]> Creatis software - bbtkGEditor.git/blobdiff - lib/EditorGraphicBBS/bbsKernelEditorGraphic/GConnectorModel.cxx
Important change in the location of the classes in the libraries to follow the final...
[bbtkGEditor.git] / lib / EditorGraphicBBS / bbsKernelEditorGraphic / GConnectorModel.cxx
index eed5e18f79db27d5790590b90934da68a59a666e..84cc58d2e669b06db574dbffd9bd9c59306fe8cc 100644 (file)
@@ -43,8 +43,8 @@ namespace bbtk
 
        GConnectorModel::GConnectorModel()
        {               
-               //_startPort = NULL;
-               //_endPort = NULL;
+               _startPort = NULL;
+               _endPort = NULL;
        }
 
        //=========================================================================
@@ -58,6 +58,7 @@ namespace bbtk
        void GConnectorModel::setStartPort(GPortModel* startPort)
        {
                _startPort = startPort;
+               startPort->setConnected(true);
                
                double xCenter,yCenter,zCenter;
                startPort->getCenter(xCenter,yCenter,zCenter);
@@ -72,6 +73,7 @@ namespace bbtk
        void GConnectorModel::setEndPort(GPortModel* endPort)
        {
                _endPort = endPort;
+               endPort->setConnected(true);
 
                double xCenter,yCenter,zCenter;         
                endPort->getCenter(xCenter,yCenter,zCenter);
@@ -133,6 +135,47 @@ namespace bbtk
                point->SetPoint(xCenter,yport,zCenter);
        }
 
+       //=========================================================================
+
+       void GConnectorModel::disconnectConnection()
+       {
+               if(_startPort!=NULL)
+               {
+                       _startPort->setConnected(false);                        
+               }
+
+               if(_endPort!=NULL)
+               {
+                       _endPort->setConnected(false);
+               }
+       }
+
+       //=========================================================================
+
+       bool GConnectorModel::isPointInside(double x,double y, double z)//virtual
+       {
+               return false;
+       }
+
+       //=========================================================================
+
+       void GConnectorModel::save(std::string &content)
+       {
+               content+="CONNECTION\n";
+
+               // Connection info
+               content+=_startPort->getParentBox()->getBBTKName();
+               content+=":";
+               content+=_startPort->getBBTKName();
+               content+=":";
+               content+=_endPort->getParentBox()->getBBTKName();
+               content+=":";
+               content+=_endPort->getBBTKName();
+               content+="\n";
+       }
+
+       //=========================================================================
+
 }  // EO namespace bbtk
 
 // EOF