]> Creatis software - bbtkGEditor.git/blobdiff - lib/EditorGraphicBBS/bbsKernelEditorGraphic/GConnectorModel.cxx
v1.1.0 BUG 1400
[bbtkGEditor.git] / lib / EditorGraphicBBS / bbsKernelEditorGraphic / GConnectorModel.cxx
index 28df0dd0f7b2fed660c102bfc5e3f58a4fe93a90..7be647f13f8797d20cb12d80de3a43e72434d3f6 100644 (file)
@@ -82,6 +82,7 @@ namespace bbtk
 
                setFinalPoint(xCenter,yIport,zCenter);
 
+               // Sets the last point of the contour model in the position of the end input port
                manualPoint* point = _model->GetManualPoint(_model->GetSizeLstPoints()-1);
                point->SetPoint(xCenter,yIport,zCenter);
        }
@@ -124,6 +125,7 @@ namespace bbtk
                double xport,yport,zport;
                _startPort->getFinalPoint(xport,yport,zport);
 
+               // Refresh the position of the contourModel first point with the data of the connector model
                manualPoint* point = _model->GetManualPoint(0);
                point->SetPoint(xCenter,yport,zCenter);
 
@@ -131,8 +133,10 @@ namespace bbtk
                _endPort->getCenter(xCenter,yCenter,zCenter);
                _endPort->getInicPoint(xport,yport,zport);
 
+               // Refresh the position of the contourModel last point with the data of the connector model
                point = _model->GetManualPoint(_model->GetSizeLstPoints()-1);
                point->SetPoint(xCenter,yport,zCenter);
+               
        }
 
        //=========================================================================
@@ -152,26 +156,34 @@ namespace bbtk
 
        //=========================================================================
 
-       bool GConnectorModel::isPointInside(double x,double y, double z)//virtual
-       {
-               return false;
-       }
-
-       //=========================================================================
-
        void GConnectorModel::save(std::string &content)
        {
+               char buffer[50];
+
                content+="CONNECTION\n";
 
                // Connection info
                content+=_startPort->getParentBox()->getBBTKName();
-               content+=".";
+               content+=":";
                content+=_startPort->getBBTKName();
                content+=":";
                content+=_endPort->getParentBox()->getBBTKName();
-               content+=".";
+               content+=":";
                content+=_endPort->getBBTKName();
                content+="\n";
+               
+               int i,sizeLstPoints = _model->GetSizeLstPoints()-2;
+               content+="NumberOfControlPoints:";
+               sprintf (buffer, "%d", sizeLstPoints );
+               content+=buffer;
+               content+="\n";
+               
+               for (i=0;i<sizeLstPoints;i++)
+               {
+                       manualPoint *mp = _model->GetManualPoint(i+1);
+                       sprintf (buffer, "%f:%f:%f\n", (float)mp->GetX(),(float)mp->GetY(),(float)mp->GetZ() );
+                       content+=buffer;
+               }               
        }
 
        //=========================================================================